From owner-svn-src-projects@FreeBSD.ORG Wed Dec 31 06:50:47 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 149FBF50; Wed, 31 Dec 2014 06:50:47 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F0FDB3668; Wed, 31 Dec 2014 06:50:46 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id sBV6okwV057207; Wed, 31 Dec 2014 06:50:46 GMT (envelope-from bryanv@FreeBSD.org) Received: (from bryanv@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id sBV6ojOB057198; Wed, 31 Dec 2014 06:50:45 GMT (envelope-from bryanv@FreeBSD.org) Message-Id: <201412310650.sBV6ojOB057198@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bryanv set sender to bryanv@FreeBSD.org using -f From: Bryan Venteicher Date: Wed, 31 Dec 2014 06:50:45 +0000 (UTC) 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 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 31 Dec 2014 06:50:47 -0000 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;