svn commit: r357045 - head/sys/sparc64/sparc64
Ed Maste
emaste at FreeBSD.org
Thu Jan 23 14:11:03 UTC 2020
Author: emaste
Date: Thu Jan 23 14:11:02 2020
New Revision: 357045
URL: https://svnweb.freebsd.org/changeset/base/357045
Log:
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
Modified:
head/sys/sparc64/sparc64/machdep.c
Modified: head/sys/sparc64/sparc64/machdep.c
==============================================================================
--- head/sys/sparc64/sparc64/machdep.c Thu Jan 23 14:01:03 2020 (r357044)
+++ head/sys/sparc64/sparc64/machdep.c Thu Jan 23 14:11:02 2020 (r357045)
@@ -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
More information about the svn-src-all
mailing list