Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Dec 2014 06:50:45 +0000 (UTC)
From:      Bryan Venteicher <bryanv@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r276451 - in projects/paravirt/sys: amd64/amd64 amd64/include i386/i386 i386/include
Message-ID:  <201412310650.sBV6ojOB057198@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bryanv
Date: Wed Dec 31 06:50:44 2014
New Revision: 276451
URL: https://svnweb.freebsd.org/changeset/base/276451

Log:
  Add CPU operation callback when the CPU is stopped
  
  The KVM clock needs this callback to clear its MSR when the CPU is
  stopped so the host does not continue to write into the shared area.

Modified:
  projects/paravirt/sys/amd64/amd64/mp_machdep.c
  projects/paravirt/sys/amd64/amd64/vm_machdep.c
  projects/paravirt/sys/amd64/include/cpu.h
  projects/paravirt/sys/i386/i386/mp_machdep.c
  projects/paravirt/sys/i386/i386/vm_machdep.c
  projects/paravirt/sys/i386/include/cpu.h

Modified: projects/paravirt/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- projects/paravirt/sys/amd64/amd64/mp_machdep.c	Wed Dec 31 04:54:48 2014	(r276450)
+++ projects/paravirt/sys/amd64/amd64/mp_machdep.c	Wed Dec 31 06:50:44 2014	(r276451)
@@ -1427,6 +1427,9 @@ cpustop_handler(void)
 
 	cpu = PCPU_GET(cpuid);
 
+	if (cpu_ops.cpu_stop)
+		cpu_ops.cpu_stop(0);
+
 	savectx(&stoppcbs[cpu]);
 
 	/* Indicate that we are stopped */
@@ -1439,6 +1442,9 @@ cpustop_handler(void)
 	CPU_CLR_ATOMIC(cpu, &started_cpus);
 	CPU_CLR_ATOMIC(cpu, &stopped_cpus);
 
+	if (cpu_ops.cpu_stop)
+		cpu_ops.cpu_stop(1);
+
 #ifdef DDB
 	amd64_db_resume_dbreg();
 #endif

Modified: projects/paravirt/sys/amd64/amd64/vm_machdep.c
==============================================================================
--- projects/paravirt/sys/amd64/amd64/vm_machdep.c	Wed Dec 31 04:54:48 2014	(r276450)
+++ projects/paravirt/sys/amd64/amd64/vm_machdep.c	Wed Dec 31 06:50:44 2014	(r276451)
@@ -644,6 +644,9 @@ cpu_reset_real()
 	struct region_descriptor null_idt;
 	int b;
 
+	if (cpu_ops.cpu_stop)
+		cpu_ops.cpu_stop(0);
+
 	disable_intr();
 
 	/*

Modified: projects/paravirt/sys/amd64/include/cpu.h
==============================================================================
--- projects/paravirt/sys/amd64/include/cpu.h	Wed Dec 31 04:54:48 2014	(r276450)
+++ projects/paravirt/sys/amd64/include/cpu.h	Wed Dec 31 06:50:44 2014	(r276451)
@@ -63,6 +63,7 @@
 struct cpu_ops {
 	void (*cpu_init)(void);
 	void (*cpu_resume)(void);
+	void (*cpu_stop)(int);
 };
 
 extern struct	cpu_ops cpu_ops;

Modified: projects/paravirt/sys/i386/i386/mp_machdep.c
==============================================================================
--- projects/paravirt/sys/i386/i386/mp_machdep.c	Wed Dec 31 04:54:48 2014	(r276450)
+++ projects/paravirt/sys/i386/i386/mp_machdep.c	Wed Dec 31 06:50:44 2014	(r276451)
@@ -1481,6 +1481,9 @@ cpustop_handler(void)
 
 	cpu = PCPU_GET(cpuid);
 
+	if (cpu_ops.cpu_stop)
+		cpu_ops.cpu_stop(0);
+
 	savectx(&stoppcbs[cpu]);
 
 	/* Indicate that we are stopped */
@@ -1493,6 +1496,9 @@ cpustop_handler(void)
 	CPU_CLR_ATOMIC(cpu, &started_cpus);
 	CPU_CLR_ATOMIC(cpu, &stopped_cpus);
 
+	if (cpu_ops.cpu_stop)
+		cpu_ops.cpu_stop(1);
+
 	if (cpu == 0 && cpustop_restartfunc != NULL) {
 		cpustop_restartfunc();
 		cpustop_restartfunc = NULL;

Modified: projects/paravirt/sys/i386/i386/vm_machdep.c
==============================================================================
--- projects/paravirt/sys/i386/i386/vm_machdep.c	Wed Dec 31 04:54:48 2014	(r276450)
+++ projects/paravirt/sys/i386/i386/vm_machdep.c	Wed Dec 31 06:50:44 2014	(r276451)
@@ -697,6 +697,9 @@ cpu_reset_real()
 	int b;
 #endif
 
+	if (cpu_ops.cpu_stop)
+		cpu_ops.cpu_stop(0);
+
 	disable_intr();
 #ifdef XEN
 	if (smp_processor_id() == 0)

Modified: projects/paravirt/sys/i386/include/cpu.h
==============================================================================
--- projects/paravirt/sys/i386/include/cpu.h	Wed Dec 31 04:54:48 2014	(r276450)
+++ projects/paravirt/sys/i386/include/cpu.h	Wed Dec 31 06:50:44 2014	(r276451)
@@ -63,6 +63,7 @@
 struct cpu_ops {
 	void (*cpu_init)(void);
 	void (*cpu_resume)(void);
+	void (*cpu_stop)(int);
 };
 
 extern struct	cpu_ops cpu_ops;



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