Date: Tue, 18 Oct 2005 18:54:28 GMT From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 85512 for review Message-ID: <200510181854.j9IIsS1t099171@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=85512 Change 85512 by jhb@jhb_slimer on 2005/10/18 18:53:56 MFi386: cpu reset fixes. Affected files ... .. //depot/projects/smpng/sys/amd64/amd64/apic_vector.S#8 edit .. //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#25 edit .. //depot/projects/smpng/sys/amd64/amd64/vm_machdep.c#30 edit .. //depot/projects/smpng/sys/i386/i386/mp_machdep.c#90 edit Differences ... ==== //depot/projects/smpng/sys/amd64/amd64/apic_vector.S#8 (text+ko) ==== @@ -297,10 +297,11 @@ test %eax, %eax jnz 2f - movq cpustop_restartfunc, %rax + xorq %rax, %rax + lock + xchgq cpustop_restartfunc, %rax testq %rax, %rax jz 2f - movq $0, cpustop_restartfunc /* One-shot */ call *%rax 2: ==== //depot/projects/smpng/sys/amd64/amd64/mp_machdep.c#25 (text+ko) ==== @@ -1044,6 +1044,7 @@ ipi_nmi_handler() { int cpu = PCPU_GET(cpuid); + void *restartfunc(void); if(!(atomic_load_acq_int(&ipi_nmi_pending) & (1 << cpu))) return 1; @@ -1063,8 +1064,9 @@ atomic_clear_int(&started_cpus,1 << cpu); atomic_clear_int(&stopped_cpus,1 << cpu); - if(cpu == 0 && cpustop_restartfunc != NULL) - cpustop_restartfunc(); + restartfunc = (void (*)(void))atomic_readandclear_long(&cpustop_restartfunc); + if (restartfunc != NULL) + restartfunc(); return 0; } ==== //depot/projects/smpng/sys/amd64/amd64/vm_machdep.c#30 (text+ko) ==== @@ -389,7 +389,9 @@ cpustop_restartfunc = cpu_reset_proxy; cpu_reset_proxy_active = 0; printf("cpu_reset: Restarting BSP\n"); - started_cpus = (1<<0); /* Restart CPU #0 */ + + /* Restart CPU #0. */ + atomic_store_rel_int(&started_cpus, 1 << 0); cnt = 0; while (cpu_reset_proxy_active == 0 && cnt < 10000000) ==== //depot/projects/smpng/sys/i386/i386/mp_machdep.c#90 (text+ko) ==== @@ -1305,7 +1305,7 @@ atomic_clear_int(&started_cpus,1 << cpu); atomic_clear_int(&stopped_cpus,1 << cpu); - restartfunc = (void (*)(void)atomic_readandclear_int(&cpustop_restartfunc); + restartfunc = (void (*)(void))atomic_readandclear_int(&cpustop_restartfunc); if (restartfunc != NULL) restartfunc();
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510181854.j9IIsS1t099171>