Date: Mon, 9 May 2011 07:06:34 +0000 (UTC) From: Andriy Gapon <avg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r221679 - in user/avg/xcpu/sys: amd64/amd64 kern sys Message-ID: <201105090706.p4976Ypv080553@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: avg Date: Mon May 9 07:06:34 2011 New Revision: 221679 URL: http://svn.freebsd.org/changeset/base/221679 Log: simplify the way of execution of reset on BSP instead of restarting the BSP and having a special restart hook, the hook is placed in the spin loop and it is triggered simply by setting hook function to non-NULL Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c user/avg/xcpu/sys/amd64/amd64/vm_machdep.c user/avg/xcpu/sys/kern/subr_smp.c user/avg/xcpu/sys/sys/smp.h Modified: user/avg/xcpu/sys/amd64/amd64/mp_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:05:36 2011 (r221678) +++ user/avg/xcpu/sys/amd64/amd64/mp_machdep.c Mon May 9 07:06:34 2011 (r221679) @@ -1435,16 +1435,17 @@ cpustop_handler(void) atomic_set_int(&stopped_cpus, cpumask); /* Wait for restart */ - while (!(started_cpus & cpumask)) - ia32_pause(); + while ((started_cpus & cpumask) == 0) { + if (cpu == 0 && cpustop_hook != NULL) { + cpustop_hook(); + cpustop_hook = NULL; + } + ia32_pause(); + } atomic_clear_int(&started_cpus, cpumask); atomic_clear_int(&stopped_cpus, cpumask); - - if (cpu == 0 && cpustop_restartfunc != NULL) { - cpustop_restartfunc(); - cpustop_restartfunc = NULL; - } + return; } /* Modified: user/avg/xcpu/sys/amd64/amd64/vm_machdep.c ============================================================================== --- user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:05:36 2011 (r221678) +++ user/avg/xcpu/sys/amd64/amd64/vm_machdep.c Mon May 9 07:06:34 2011 (r221679) @@ -541,12 +541,11 @@ cpu_reset() } if (PCPU_GET(cpuid) != 0) { cpu_reset_proxyid = PCPU_GET(cpuid); - cpustop_restartfunc = cpu_reset_proxy; cpu_reset_proxy_active = 0; printf("cpu_reset: Restarting BSP\n"); /* Restart CPU #0. */ - atomic_store_rel_int(&started_cpus, 1 << 0); + cpustop_hook = cpu_reset_proxy; cnt = 0; while (cpu_reset_proxy_active == 0 && cnt < 10000000) Modified: user/avg/xcpu/sys/kern/subr_smp.c ============================================================================== --- user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:05:36 2011 (r221678) +++ user/avg/xcpu/sys/kern/subr_smp.c Mon May 9 07:06:34 2011 (r221679) @@ -63,7 +63,7 @@ cpumask_t idle_cpus_mask; cpumask_t hlt_cpus_mask; cpumask_t logical_cpus_mask; -void (*cpustop_restartfunc)(void); +void (* volatile cpustop_hook)(void); #endif /* This is used in modules that need to work in both SMP and UP. */ cpumask_t all_cpus; Modified: user/avg/xcpu/sys/sys/smp.h ============================================================================== --- user/avg/xcpu/sys/sys/smp.h Mon May 9 07:05:36 2011 (r221678) +++ user/avg/xcpu/sys/sys/smp.h Mon May 9 07:06:34 2011 (r221679) @@ -68,7 +68,7 @@ struct cpu_group *smp_topo_2level(int l2 int l1count, int l1flags); struct cpu_group *smp_topo_find(struct cpu_group *top, int cpu); -extern void (*cpustop_restartfunc)(void); +extern void (* volatile cpustop_hook)(void); extern int smp_active; extern int smp_cpus; extern volatile cpumask_t started_cpus;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105090706.p4976Ypv080553>