Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 1912
b: refs/heads/master
c: 05062d9
h: refs/heads/master
v: v3
  • Loading branch information
Peter Chubb authored and Linus Torvalds committed Jun 8, 2005
1 parent 3176cf6 commit eb5bd17
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f829fd23c87918374bac0d90404fe12f0e788d52
refs/heads/master: 05062d96a23ec0959ee5ea969f40813170c73c0e
6 changes: 6 additions & 0 deletions trunk/arch/ia64/kernel/ptrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,11 +635,17 @@ ia64_flush_fph (struct task_struct *task)
{
struct ia64_psr *psr = ia64_psr(ia64_task_regs(task));

/*
* Prevent migrating this task while
* we're fiddling with the FPU state
*/
preempt_disable();
if (ia64_is_local_fpu_owner(task) && psr->mfh) {
psr->mfh = 0;
task->thread.flags |= IA64_THREAD_FPH_VALID;
ia64_save_fpu(&task->thread.fph[0]);
}
preempt_enable();
}

/*
Expand Down
11 changes: 10 additions & 1 deletion trunk/arch/ia64/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,21 @@ disabled_fph_fault (struct pt_regs *regs)

/* first, grant user-level access to fph partition: */
psr->dfh = 0;

/*
* Make sure that no other task gets in on this processor
* while we're claiming the FPU
*/
preempt_disable();
#ifndef CONFIG_SMP
{
struct task_struct *fpu_owner
= (struct task_struct *)ia64_get_kr(IA64_KR_FPU_OWNER);

if (ia64_is_local_fpu_owner(current))
if (ia64_is_local_fpu_owner(current)) {
preempt_enable_no_resched();
return;
}

if (fpu_owner)
ia64_flush_fph(fpu_owner);
Expand All @@ -244,6 +252,7 @@ disabled_fph_fault (struct pt_regs *regs)
*/
psr->mfh = 1;
}
preempt_enable_no_resched();
}

static inline int
Expand Down
10 changes: 8 additions & 2 deletions trunk/include/asm-ia64/processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,21 @@ extern void ia64_setreg_unknown_kr (void);
* task_struct at this point.
*/

/* Return TRUE if task T owns the fph partition of the CPU we're running on. */
/*
* Return TRUE if task T owns the fph partition of the CPU we're running on.
* Must be called from code that has preemption disabled.
*/
#define ia64_is_local_fpu_owner(t) \
({ \
struct task_struct *__ia64_islfo_task = (t); \
(__ia64_islfo_task->thread.last_fph_cpu == smp_processor_id() \
&& __ia64_islfo_task == (struct task_struct *) ia64_get_kr(IA64_KR_FPU_OWNER)); \
})

/* Mark task T as owning the fph partition of the CPU we're running on. */
/*
* Mark task T as owning the fph partition of the CPU we're running on.
* Must be called from code that has preemption disabled.
*/
#define ia64_set_local_fpu_owner(t) do { \
struct task_struct *__ia64_slfo_task = (t); \
__ia64_slfo_task->thread.last_fph_cpu = smp_processor_id(); \
Expand Down

0 comments on commit eb5bd17

Please sign in to comment.