From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] disable clock before rebooting. Date: Fri, 07 Mar 2008 11:15:58 +0200 Message-ID: <47D107CE.1040601@qumranet.com> References: <1204820092-16532-1-git-send-email-gcosta@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel@lists.sourceforge.net To: Glauber Costa Return-path: In-Reply-To: <1204820092-16532-1-git-send-email-gcosta@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces@lists.sourceforge.net Errors-To: kvm-devel-bounces@lists.sourceforge.net List-Id: kvm.vger.kernel.org Glauber Costa wrote: > This patch writes 0 (actually, what really matters is that the > LSB is cleared) to the system time msr before rebooting/shutting down > the machine. > > Without it, we can have a random memory location being written > when the guest comes back > if (!kvm_para_available()) > @@ -154,6 +181,11 @@ void __init kvmclock_init(void) > pv_time_ops.set_wallclock = kvm_set_wallclock; > pv_time_ops.sched_clock = kvm_clock_read; > pv_apic_ops.setup_secondary_clock = kvm_setup_secondary_clock; > + machine_ops.emergency_restart = kvm_emergency_restart; > + machine_ops.shutdown = kvm_shutdown; > + machine_ops.restart = kvm_restart; > + machine_ops.halt = kvm_halt; > + machine_ops.power_off = kvm_power_off; > clocksource_register(&kvm_clock); > } > } > Oh, I think that these are all unnecessary. You need to stop the clock only if the memory it uses will be reused. Halt, shutdown and poweroff clearly don't. Resets need to go through the host anyway, since they can be invoked without the guest knowing about it. The only case I can think of where we need to stop the clock is kexec. -- Any sufficiently difficult bug is indistinguishable from a feature. ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/