From db477d6cc8ce84b3c1172aef86628ca121119c98 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 16 Nov 2005 20:58:40 +0000 Subject: [PATCH] Revert a part of the previous commits to these files that made the NMI IPI_STOP handling code use atomic_readandclear() to execute the restart function on the first CPU to resume and restore the behavior of always executing the restart function on the BSP since this is in fact what the non-NMI IPI_STOP handler does. I did add back in a statement to clear the restart function pointer after it is executed to match the behavior of the non-NMI IPI_STOP handler. --- sys/amd64/amd64/mp_machdep.c | 9 ++++----- sys/i386/i386/mp_machdep.c | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index be4f878b6324..2e02f2c0a3aa 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -1072,7 +1072,6 @@ ipi_nmi_handler() { int cpu = PCPU_GET(cpuid); int cpumask = PCPU_GET(cpumask); - void (*restartfunc)(void); if (!(ipi_nmi_pending & cpumask)) return 1; @@ -1091,10 +1090,10 @@ ipi_nmi_handler() atomic_clear_int(&started_cpus, cpumask); atomic_clear_int(&stopped_cpus, cpumask); - restartfunc = (void (*)(void))atomic_readandclear_long( - (u_long *)&cpustop_restartfunc); - if (restartfunc != NULL) - restartfunc(); + if (cpu == 0 && cpustop_restartfunc != NULL) { + cpustop_restartfunc(); + cpustop_restartfunc = NULL; + } return 0; } diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index bfc3c5b511ca..fab5e0f0aa23 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -1311,7 +1311,6 @@ ipi_nmi_handler() { int cpu = PCPU_GET(cpuid); int cpumask = PCPU_GET(cpumask); - void (*restartfunc)(void); if (!(ipi_nmi_pending & cpumask)) return 1; @@ -1330,10 +1329,10 @@ ipi_nmi_handler() atomic_clear_int(&started_cpus, cpumask); atomic_clear_int(&stopped_cpus, cpumask); - restartfunc = (void (*)(void))atomic_readandclear_int( - (u_int *)&cpustop_restartfunc); - if (restartfunc != NULL) - restartfunc(); + if (cpu == 0 && cpustop_restartfunc != NULL) { + cpustop_restartfunc(); + cpustop_restartfunc = NULL; + } return 0; }