Apply r355819 to sparc64 - fix assertion failure after r355784
From r355819: Repeat the spinlock_enter/exit pattern from amd64 on other architectures to fix an assert violation introduced in r355784. Without this spinlock_exit() may see owepreempt and switch before reducing the spinlock count. amd64 had been optimized to do a single critical enter/exit regardless of the number of spinlocks which avoided the problem and this optimization had not been applied elsewhere. This is completely untested - I have no obsolete Sparc hardware - but someone did try testing recent changes on sparc64 (PR 243534). PR: 243534
This commit is contained in:
parent
1726ab2174
commit
3f2a276c5a
@ -224,9 +224,9 @@ spinlock_enter(void)
|
||||
wrpr(pil, 0, PIL_TICK);
|
||||
td->td_md.md_spinlock_count = 1;
|
||||
td->td_md.md_saved_pil = pil;
|
||||
critical_enter();
|
||||
} else
|
||||
td->td_md.md_spinlock_count++;
|
||||
critical_enter();
|
||||
}
|
||||
|
||||
void
|
||||
@ -236,11 +236,12 @@ spinlock_exit(void)
|
||||
register_t pil;
|
||||
|
||||
td = curthread;
|
||||
critical_exit();
|
||||
pil = td->td_md.md_saved_pil;
|
||||
td->td_md.md_spinlock_count--;
|
||||
if (td->td_md.md_spinlock_count == 0)
|
||||
if (td->td_md.md_spinlock_count == 0) {
|
||||
critical_exit();
|
||||
wrpr(pil, pil, 0);
|
||||
}
|
||||
}
|
||||
|
||||
static phandle_t
|
||||
|
Loading…
x
Reference in New Issue
Block a user