git: kernel - Add MONITOR/MWAIT support to the LWKT scheduler

YONETANI Tomokazu qhwt.dfly at les.ath.cx
Sat Dec 25 06:36:42 PST 2010


Hi.

On Sun, Dec 19, 2010 at 09:40:31AM -0800, Matthew Dillon wrote:
> 
> commit 0f0466c0c36e1dc71c1917d6835dca144fb80cb3
> Author: Matthew Dillon <dillon at apollo.backplane.com>
> Date:   Sun Dec 19 09:25:17 2010 -0800
				:
>     * Adjust the x86-64 idle loop to use MONITOR/MWAIT when available when
>       the idle halt mode (machdep.cpu_idle_hlt) is set to 1.  This
>       significantly improves performance for event-oriented programs, including
>       compile pipelines.

This commit removes the RQF_IDLECHECK_WK_MASK check *before*
the CLI instruction when MONITOR/MWAIT is unavailable, because
of how C evaluates expressions.  Some strange panic in vm_map_lookup()
started annoying me after upgrading the kernel recently, and
bisecting showed that this is the first commit with the problem.

I'm running the kernel with the following change to see if it
fixes the panic, which usually takes several hours to be triggered.

Best Regards,
YONETANI Tomokazu

diff --git a/sys/platform/pc64/x86_64/machdep.c b/sys/platform/pc64/x86_64/machdep.c
index c07dc8c..0e2fe58 100644
--- a/sys/platform/pc64/x86_64/machdep.c
+++ b/sys/platform/pc64/x86_64/machdep.c
@@ -985,9 +985,10 @@ cpu_idle(void)
 		if (quick && (cpu_mi_feature & CPU_MI_MONITOR) &&
 		    (reqflags & RQF_IDLECHECK_WK_MASK) == 0) {
 			cpu_mmw_pause_int(&gd->gd_reqflags, reqflags);
 			++cpu_idle_hltcnt;
-		} else if (cpu_idle_hlt) {
+		} else if (cpu_idle_hlt &&
+			   (reqflags & RQF_IDLECHECK_WK_MASK) == 0) {
 			__asm __volatile("cli");
 			splz();
 			if ((gd->gd_reqflags & RQF_IDLECHECK_WK_MASK) == 0) {
 				if (quick)
-- 
1.7.3.2






More information about the Commits mailing list