All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wanpeng Li <kernellwp@gmail.com>
To: Liran Alon <LIRAN.ALON@oracle.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Radim Krcmar <rkrcmar@redhat.com>, kvm <kvm@vger.kernel.org>,
	idan.brown@oracle.com,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: [PATCH] KVM: x86: pvclock: Handle first-time write to pvclock-page contains random junk
Date: Mon, 13 Nov 2017 09:37:59 +0800	[thread overview]
Message-ID: <CANRm+CxEnrpnfpQLcBB9nQKQD-Lrs-Ct4drnZKeZ4iJroxmb+Q@mail.gmail.com> (raw)
In-Reply-To: <CANRm+CxZHJ4HLOdUfDFouH9zHd6tKQwCsVOYcrpfv7keFXLeBg@mail.gmail.com>

2017-11-13 9:03 GMT+08:00 Wanpeng Li <kernellwp@gmail.com>:
> 2017-11-13 8:55 GMT+08:00 Liran Alon <LIRAN.ALON@oracle.com>:
>>
>>
>> On 13/11/17 02:52, Wanpeng Li wrote:
>>>
>>> 2017-11-13 8:44 GMT+08:00 Liran Alon <LIRAN.ALON@oracle.com>:
>>>>
>>>>
>>>>
>>>> On 13/11/17 02:40, Wanpeng Li wrote:
>>>>>
>>>>>
>>>>> 2017-11-05 22:11 GMT+08:00 Liran Alon <liran.alon@oracle.com>:
>>>>>>
>>>>>>
>>>>>> When guest passes KVM it's pvclock-page GPA via WRMSR to
>>>>>> MSR_KVM_SYSTEM_TIME / MSR_KVM_SYSTEM_TIME_NEW, KVM don't initialize
>>>>>> pvclock-page to some start-values. It just requests a clock-update
>>>>>> which
>>>>>
>>>>>
>>>>>
>>>>> KVM does, please refer to memset(hv_clock, 0, size) in kvmclock_init().
>>>>
>>>>
>>>>
>>>> kvmclock_init() is the code that runs in KVM-guest. I was talking here
>>>> about
>>>> the code that handles the WRMSR in KVM hypervisor code.
>>>>
>>>> The issue happens when the guest doesn't init pvclock-page as done in
>>>> kvmclock_init(). Not all guests behave nicely :)
>>>
>>>
>>> But the codes which you modify just works for kvm guest I think.
>>
>> No, it's the code that runs in KVM hypervisor for any guest that knows how
>> to work with KVM pv-clock PV interface.
>> Linux guest is just one of the possible guests which can use this interface.
>> kvmclock_init() you mentioned is part of the linux-guest. But there are
>> other guests which use KVM pv-clock PV interface.
>
> Good to know it, could you point one?

In addition, there is a BUG_ON(if version != 0) just before the codes
which you added. I will move these avoid random junk logics into msr
setup in order that it can avoid '& operation' each time update the pv
stuff. I will send a patch later.

Regards,
Wanpeng Li

  reply	other threads:[~2017-11-13  1:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-05 14:11 [PATCH] KVM: x86: pvclock: Handle first-time write to pvclock-page contains random junk Liran Alon
2017-11-06  9:13 ` Paolo Bonzini
2017-11-10 21:36 ` Radim Krčmář
2017-11-13  0:40 ` Wanpeng Li
2017-11-13  0:44   ` Liran Alon
2017-11-13  0:52     ` Wanpeng Li
2017-11-13  0:55       ` Liran Alon
2017-11-13  1:03         ` Wanpeng Li
2017-11-13  1:37           ` Wanpeng Li [this message]
2017-11-13  5:53             ` Wanpeng Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CANRm+CxEnrpnfpQLcBB9nQKQD-Lrs-Ct4drnZKeZ4iJroxmb+Q@mail.gmail.com \
    --to=kernellwp@gmail.com \
    --cc=LIRAN.ALON@oracle.com \
    --cc=idan.brown@oracle.com \
    --cc=konrad.wilk@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=rkrcmar@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.