Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jan 2013 22:52:20 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r245850 - in head/sys/sparc64: include sparc64
Message-ID:  <201301232252.r0NMqLxh085107@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Wed Jan 23 22:52:20 2013
New Revision: 245850
URL: http://svnweb.freebsd.org/changeset/base/245850

Log:
  Revert the part of r239864 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.
  
  MFC after:	3 days

Modified:
  head/sys/sparc64/include/smp.h
  head/sys/sparc64/sparc64/tick.c

Modified: head/sys/sparc64/include/smp.h
==============================================================================
--- head/sys/sparc64/include/smp.h	Wed Jan 23 21:44:48 2013	(r245849)
+++ head/sys/sparc64/include/smp.h	Wed Jan 23 22:52:20 2013	(r245850)
@@ -42,6 +42,7 @@
 #include <sys/cpuset.h>
 #include <sys/proc.h>
 #include <sys/sched.h>
+#include <sys/smp.h>
 
 #include <machine/intr_machdep.h>
 #include <machine/pcb.h>
@@ -202,6 +203,7 @@ ipi_rd(u_int cpu, void *func, u_long *va
 		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 */
@@ -368,12 +358,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)
 {
 

Modified: head/sys/sparc64/sparc64/tick.c
==============================================================================
--- head/sys/sparc64/sparc64/tick.c	Wed Jan 23 21:44:48 2013	(r245849)
+++ head/sys/sparc64/sparc64/tick.c	Wed Jan 23 22:52:20 2013	(r245850)
@@ -334,7 +334,7 @@ stick_get_timecount_mp(struct timecounte
 	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
 	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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301232252.r0NMqLxh085107>