Commit 2831300e authored by David Mosberger's avatar David Mosberger Committed by David Mosberger

ia64: Make fph-restore lazy. Patch by Asit K. Mallick.

parent 5c8ee10d
...@@ -248,10 +248,9 @@ disabled_fph_fault (struct pt_regs *regs) ...@@ -248,10 +248,9 @@ disabled_fph_fault (struct pt_regs *regs)
if (fpu_owner) if (fpu_owner)
ia64_flush_fph(fpu_owner); ia64_flush_fph(fpu_owner);
ia64_set_fpu_owner(current);
} }
#endif /* !CONFIG_SMP */ #endif /* !CONFIG_SMP */
ia64_set_fpu_owner(current);
if ((current->thread.flags & IA64_THREAD_FPH_VALID) != 0) { if ((current->thread.flags & IA64_THREAD_FPH_VALID) != 0) {
__ia64_load_fpu(current->thread.fph); __ia64_load_fpu(current->thread.fph);
psr->mfh = 0; psr->mfh = 0;
......
...@@ -223,6 +223,7 @@ struct thread_struct { ...@@ -223,6 +223,7 @@ struct thread_struct {
__u64 map_base; /* base address for get_unmapped_area() */ __u64 map_base; /* base address for get_unmapped_area() */
__u64 task_size; /* limit for task size */ __u64 task_size; /* limit for task size */
struct siginfo *siginfo; /* current siginfo struct for ptrace() */ struct siginfo *siginfo; /* current siginfo struct for ptrace() */
__u64 last_fph_cpu; /* CPU that may hold the contents of f32-f127 */
#ifdef CONFIG_IA32_SUPPORT #ifdef CONFIG_IA32_SUPPORT
__u64 eflag; /* IA32 EFLAGS reg */ __u64 eflag; /* IA32 EFLAGS reg */
...@@ -389,8 +390,6 @@ ia64_set_kr (unsigned long regnum, unsigned long r) ...@@ -389,8 +390,6 @@ ia64_set_kr (unsigned long regnum, unsigned long r)
} }
} }
#ifndef CONFIG_SMP
static inline struct task_struct * static inline struct task_struct *
ia64_get_fpu_owner (void) ia64_get_fpu_owner (void)
{ {
...@@ -403,8 +402,6 @@ ia64_set_fpu_owner (struct task_struct *t) ...@@ -403,8 +402,6 @@ ia64_set_fpu_owner (struct task_struct *t)
ia64_set_kr(IA64_KR_FPU_OWNER, (unsigned long) t); ia64_set_kr(IA64_KR_FPU_OWNER, (unsigned long) t);
} }
#endif /* !CONFIG_SMP */
extern void __ia64_init_fpu (void); extern void __ia64_init_fpu (void);
extern void __ia64_save_fpu (struct ia64_fpreg *fph); extern void __ia64_save_fpu (struct ia64_fpreg *fph);
extern void __ia64_load_fpu (struct ia64_fpreg *fph); extern void __ia64_load_fpu (struct ia64_fpreg *fph);
......
...@@ -396,14 +396,23 @@ extern void ia64_load_extra (struct task_struct *task); ...@@ -396,14 +396,23 @@ extern void ia64_load_extra (struct task_struct *task);
* task->thread.fph, avoiding the complication of having to fetch * task->thread.fph, avoiding the complication of having to fetch
* the latest fph state from another CPU. * the latest fph state from another CPU.
*/ */
# define switch_to(prev,next,last) do { \ # define switch_to(prev,next,last) do { \
if (ia64_psr(ia64_task_regs(prev))->mfh) { \ if (ia64_psr(ia64_task_regs(prev))->mfh) { \
ia64_psr(ia64_task_regs(prev))->mfh = 0; \ ia64_psr(ia64_task_regs(prev))->mfh = 0; \
(prev)->thread.flags |= IA64_THREAD_FPH_VALID; \ (prev)->thread.flags |= IA64_THREAD_FPH_VALID; \
__ia64_save_fpu((prev)->thread.fph); \ __ia64_save_fpu((prev)->thread.fph); \
} \ (prev)->thread.last_fph_cpu = smp_processor_id(); \
ia64_psr(ia64_task_regs(prev))->dfh = 1; \ } \
__switch_to(prev,next,last); \ if ((next)->thread.flags & IA64_THREAD_FPH_VALID) { \
if (((next)->thread.last_fph_cpu == smp_processor_id()) \
&& (ia64_get_fpu_owner() == next)) \
{ \
ia64_psr(ia64_task_regs(next))->dfh = 0; \
ia64_psr(ia64_task_regs(next))->mfh = 0; \
} else \
ia64_psr(ia64_task_regs(next))->dfh = 1; \
} \
__switch_to(prev,next,last); \
} while (0) } while (0)
#else #else
# define switch_to(prev,next,last) do { \ # define switch_to(prev,next,last) do { \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment