kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Sheng Yang <sheng@linux.intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>, kvm@vger.kernel.org
Subject: Re: [PATCH 2/4] KVM: Extended shared_msr_global to per CPU
Date: Thu, 17 Dec 2009 17:06:11 +0200	[thread overview]
Message-ID: <4B2A48E3.2060404@redhat.com> (raw)
In-Reply-To: <200912172301.33033.sheng@linux.intel.com>

On 12/17/2009 05:01 PM, Sheng Yang wrote:
>
>>> -void kvm_define_shared_msr(unsigned slot, u32 msr)
>>> +static void shared_msr_update(unsigned slot, u32 msr)
>>>    {
>>> -	int cpu;
>>> +	struct kvm_shared_msrs *smsr;
>>>    	u64 value;
>>>
>>> +	smsr =&__get_cpu_var(shared_msrs);
>>> +	/* only read, and nobody should modify it at this time,
>>> +	 * so don't need lock */
>>> +	if (slot>= shared_msrs_global.nr) {
>>> +		printk(KERN_ERR "kvm: invalid MSR slot!");
>>> +		return;
>>> +	}
>>> +	if (smsr->values[slot].initialized)
>>> +		return;
>>>        
>> I don't think .initialized is worthwhile.  shared_msr_update is run very
>> rarely.
>>      
> The reason is, after cpu hotplug, the MSR_TSC_AUX would be rewritten by
> vsyscall_init again. But in the hotplug notifier chain, KVM has higher
> priority(20 vs 0 for vsyscall_init), so maybe the rdmsr() here would get a
> bogus value... Then I think prevent it from initializing again should be
> safer.
>
>    

So let's raise vsyscall_init's priority?

> But I just think of another issue: if we hot plug in a cpu(without hot plug
> off), it would have a bogus value as well in the same path? Sound
> troublesome...
>    

Removing .initialized would take care of this issue.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2009-12-17 15:06 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-16  5:48 [PATCH 0/4] Add support for RDTSCP in VMX Sheng Yang
2009-12-16  5:48 ` [PATCH 1/4] KVM: VMX: Remove redundant variable Sheng Yang
2009-12-16  5:48 ` [PATCH 2/4] KVM: Extended shared_msr_global to per CPU Sheng Yang
2009-12-16  9:21   ` Avi Kivity
2009-12-17  9:32     ` Sheng Yang
2009-12-17 10:32       ` Avi Kivity
2009-12-17 15:01         ` Sheng Yang
2009-12-17 15:06           ` Avi Kivity [this message]
2009-12-16  5:48 ` [PATCH 3/4] x86: Add IA32_TSC_AUX MSR Sheng Yang
2009-12-16  5:48 ` [PATCH 4/4] KVM: VMX: Add instruction rdtscp support for guest Sheng Yang
2009-12-16  9:47   ` Avi Kivity
2009-12-17  9:33     ` Sheng Yang
2009-12-17 10:39       ` Avi Kivity
2009-12-17 14:52         ` Sheng Yang

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=4B2A48E3.2060404@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=sheng@linux.intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).