From cb48c4a48dc8d53443cef46261b3eba7b706604f Mon Sep 17 00:00:00 2001 From: marius Date: Sun, 27 Jan 2013 23:21:47 +0000 Subject: [PATCH] MFC: r245850 Revert the part of r239864 (MFC'ed to stable/9 in r241681) which removed obtaining the SMP mutex around reading registers from other CPUs. As it turns out, the hardware doesn't really like concurrent IPI'ing causing adverse effects. Also the thought deadlock when using this spin lock here and the targeted CPU(s) are also holding or in case of nested locks can't actually happen. This is due to the fact that on sparc64, spinlock_enter() only raises the PIL but doesn't disable interrupts completely. Thus direct cross calls as used for the register reading (and all other MD IPI needs) still will be executed by the targeted CPU(s) in that case. git-svn-id: svn://svn.freebsd.org/base/stable/9@246014 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/sparc64/include/smp.h | 20 ++------------------ sys/sparc64/sparc64/tick.c | 4 ++-- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/sys/sparc64/include/smp.h b/sys/sparc64/include/smp.h index db173095e..2e1110b95 100644 --- a/sys/sparc64/include/smp.h +++ b/sys/sparc64/include/smp.h @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -202,6 +203,7 @@ ipi_rd(u_int cpu, void *func, u_long *val) return (NULL); sched_pin(); ira = &ipi_rd_args; + mtx_lock_spin(&smp_ipi_mtx); CPU_SETOF(cpu, &ira->ira_mask); ira->ira_val = val; cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira); @@ -298,18 +300,6 @@ ipi_wait(void *cookie) } } -static __inline void -ipi_wait_unlocked(void *cookie) -{ - volatile cpuset_t *mask; - - if ((mask = cookie) != NULL) { - while (!CPU_EMPTY(mask)) - ; - sched_unpin(); - } -} - #endif /* _MACHINE_PMAP_H_ && _SYS_MUTEX_H_ */ #endif /* !LOCORE */ @@ -367,12 +357,6 @@ ipi_wait(void *cookie __unused) } -static __inline void -ipi_wait_unlocked(void *cookie __unused) -{ - -} - static __inline void tl_ipi_cheetah_dcache_page_inval(void) { diff --git a/sys/sparc64/sparc64/tick.c b/sys/sparc64/sparc64/tick.c index a8dd42a24..01ff9b60d 100644 --- a/sys/sparc64/sparc64/tick.c +++ b/sys/sparc64/sparc64/tick.c @@ -334,7 +334,7 @@ stick_get_timecount_mp(struct timecounter *tc) if (curcpu == 0) stick = rdstick(); else - ipi_wait_unlocked(ipi_rd(0, tl_ipi_stick_rd, &stick)); + ipi_wait(ipi_rd(0, tl_ipi_stick_rd, &stick)); sched_unpin(); return (stick); } @@ -348,7 +348,7 @@ tick_get_timecount_mp(struct timecounter *tc) if (curcpu == 0) tick = rd(tick); else - ipi_wait_unlocked(ipi_rd(0, tl_ipi_tick_rd, &tick)); + ipi_wait(ipi_rd(0, tl_ipi_tick_rd, &tick)); sched_unpin(); return (tick); } -- 2.45.0