public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] call write_guest_time as soon as we register the paravirt clock.
@ 2008-02-21 21:04 Glauber de Oliveira Costa
  2008-02-22  7:47 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Glauber de Oliveira Costa @ 2008-02-21 21:04 UTC (permalink / raw)
  To: kvm-devel; +Cc: chrisw, avi, Glauber Costa

From: Glauber Costa <gcosta@redhat.com>

In situations, like, cpu hotplugging, a cpu can arrive
later on the game and register its paravirt clock
while everything else is already running, which will lead to
breakage, since the time readings will return bogus values.

To prevent this, we write system time as soon as the guest
registers its clock

Signed-off-by: Glauber Costa <gcosta@redhat.com>
---
 arch/x86/kvm/x86.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 5dfc21f..03c0c6d 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -595,6 +595,8 @@ int kvm_set_msr_common(struct kvm_vcpu *
 
 		if (is_error_page(vcpu->arch.time_page))
 			vcpu->arch.time_page = NULL;
+
+		kvm_write_guest_time(vcpu);
 		break;
 	}
 	default:
-- 
1.4.2


-------------------------------------------------------------------------
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/

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] call write_guest_time as soon as we register the paravirt clock.
  2008-02-21 21:04 [PATCH] call write_guest_time as soon as we register the paravirt clock Glauber de Oliveira Costa
@ 2008-02-22  7:47 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-02-22  7:47 UTC (permalink / raw)
  To: Glauber de Oliveira Costa; +Cc: kvm-devel, chrisw

Glauber de Oliveira Costa wrote:
> From: Glauber Costa <gcosta@redhat.com>
>
> In situations, like, cpu hotplugging, a cpu can arrive
> later on the game and register its paravirt clock
> while everything else is already running, which will lead to
> breakage, since the time readings will return bogus values.
>
> To prevent this, we write system time as soon as the guest
> registers its clock
>   

Applied, thanks.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


-------------------------------------------------------------------------
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/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-02-22  7:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-21 21:04 [PATCH] call write_guest_time as soon as we register the paravirt clock Glauber de Oliveira Costa
2008-02-22  7:47 ` Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox