Re: [PATCH v4 4/8] KVM-HV: Add VCPU running/pre-empted state for guest

Nikunj A Dadhania
2012-08-24T05:20:08Z

On Thu, 23 Aug 2012 08:46:22 -0300, Marcelo Tosatti <mtosatti@redhat.com> wrote:
> On Tue, Aug 21, 2012 at 04:56:43PM +0530, Nikunj A. Dadhania wrote:
> > From: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
> >
> > Hypervisor code to indicate guest running/pre-empteded status through
> > msr. The page is now pinned during MSR write time and use
> > kmap_atomic/kunmap_atomic to access the shared area vcpu_state area.
> >
> > Suggested-by: Marcelo Tosatti <mtosatti@redhat.com>
> > Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
> > ---

[...]

> > +
> > +static void kvm_set_vcpu_state(struct kvm_vcpu *vcpu)
> > +{
> > + struct kvm_vcpu_state *vs;
> > + char *kaddr;
> > +
> > + if (!((vcpu->arch.v_state.msr_val & KVM_MSR_ENABLED) &&
> > + vcpu->arch.v_state.vs_page))
> > + return;
>
> It was agreed it was necessary to have valid vs_page only if MSR was
> enabled? Or was that a misunderstanding?
>
There is a case where MSR is enabled but vs_page is NULL, this is
gaurding that case. The check is now:

if (!(msr_enabled && vs_page))
return;

I had proposed that here:
http://www.spinics.net/lists/kvm/msg77147.html

Regards
Nikunj