All of lore.kernel.org
 help / color / mirror / Atom feed
* Guest handling of IA32_DEBUGCTL MSR
@ 2015-04-28 11:42 Nadav Amit
  2015-04-28 11:43 ` Paolo Bonzini
  0 siblings, 1 reply; 5+ messages in thread
From: Nadav Amit @ 2015-04-28 11:42 UTC (permalink / raw)
  To: Paolo Bonzini, kvm list

It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the
nested VM and get this value to the physical IA32_DEBUGCTL (see
prepare_vmcs02), while it cannot set IA32_DEBUGCTL for itself (see
kvm_set_msr_common).

Am I missing something?

Regards,
Nadav

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

* Re: Guest handling of IA32_DEBUGCTL MSR
  2015-04-28 11:42 Guest handling of IA32_DEBUGCTL MSR Nadav Amit
@ 2015-04-28 11:43 ` Paolo Bonzini
  2015-04-28 12:00   ` Jan Kiszka
  0 siblings, 1 reply; 5+ messages in thread
From: Paolo Bonzini @ 2015-04-28 11:43 UTC (permalink / raw)
  To: Nadav Amit, kvm list



On 28/04/2015 13:42, Nadav Amit wrote:
> It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the
> nested VM and get this value to the physical IA32_DEBUGCTL (see
> prepare_vmcs02), while it cannot set IA32_DEBUGCTL for itself (see
> kvm_set_msr_common).
> 
> Am I missing something?

No, it makes no sense.

Paolo

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

* Re: Guest handling of IA32_DEBUGCTL MSR
  2015-04-28 11:43 ` Paolo Bonzini
@ 2015-04-28 12:00   ` Jan Kiszka
  2015-04-28 12:09     ` Nadav Amit
  2015-04-28 12:32     ` Paolo Bonzini
  0 siblings, 2 replies; 5+ messages in thread
From: Jan Kiszka @ 2015-04-28 12:00 UTC (permalink / raw)
  To: Paolo Bonzini, Nadav Amit, kvm list

Am 2015-04-28 um 13:43 schrieb Paolo Bonzini:
> 
> 
> On 28/04/2015 13:42, Nadav Amit wrote:
>> It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the
>> nested VM and get this value to the physical IA32_DEBUGCTL (see
>> prepare_vmcs02), while it cannot set IA32_DEBUGCTL for itself (see
>> kvm_set_msr_common).
>>
>> Am I missing something?
> 
> No, it makes no sense.

Are you sure that vmx is not allowing direct access to that MSR while in
guest mode? We do save/restore it on all Intel CPUs, see
setup_vmcs_config. Not sure about the AMD situation, though.

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SES-DE
Corporate Competence Center Embedded Linux

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

* Re: Guest handling of IA32_DEBUGCTL MSR
  2015-04-28 12:00   ` Jan Kiszka
@ 2015-04-28 12:09     ` Nadav Amit
  2015-04-28 12:32     ` Paolo Bonzini
  1 sibling, 0 replies; 5+ messages in thread
From: Nadav Amit @ 2015-04-28 12:09 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Paolo Bonzini, kvm list

Jan Kiszka <jan.kiszka@siemens.com> wrote:

> Am 2015-04-28 um 13:43 schrieb Paolo Bonzini:
>> On 28/04/2015 13:42, Nadav Amit wrote:
>>> It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the
>>> nested VM and get this value to the physical IA32_DEBUGCTL (see
>>> prepare_vmcs02), while it cannot set IA32_DEBUGCTL for itself (see
>>> kvm_set_msr_common).
>>> 
>>> Am I missing something?
>> 
>> No, it makes no sense.
> 
> Are you sure that vmx is not allowing direct access to that MSR while in
> guest mode? We do save/restore it on all Intel CPUs, see
> setup_vmcs_config. Not sure about the AMD situation, though.

Unless you explicitly disable the interception of the MSR in the bitmap, you
trap WRMSR to this MSR. I guess the original intention of saving/restoring
it was to address situations in which the CPU itself implicitly changes it
(e.g., clearing LBR when “freezing LBR on PMI” is set). I think that these
situations do not apply when the MSR is zeroed, as it happens to be in KVM.

Nadav

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

* Re: Guest handling of IA32_DEBUGCTL MSR
  2015-04-28 12:00   ` Jan Kiszka
  2015-04-28 12:09     ` Nadav Amit
@ 2015-04-28 12:32     ` Paolo Bonzini
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2015-04-28 12:32 UTC (permalink / raw)
  To: Jan Kiszka, Nadav Amit, kvm list



On 28/04/2015 14:00, Jan Kiszka wrote:
> > > It seems strange that the guest is allowed to set IA32_DEBUGCTL MSR for the
> > > nested VM and get this value to the physical IA32_DEBUGCTL (see
> > > prepare_vmcs02), while it cannot set IA32_DEBUGCTL for itself (see
> > > kvm_set_msr_common).
> > >
> > > Am I missing something?
> > 
> > No, it makes no sense.
> 
> Are you sure that vmx is not allowing direct access to that MSR while in
> guest mode? We do save/restore it on all Intel CPUs, see
> setup_vmcs_config. Not sure about the AMD situation, though.

Right now, L1 could for example enable LBR for the L2 guest, but it
wouldn't make sense since the L1 guest cannot then read the last branch
MSRs.

Paolo

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

end of thread, other threads:[~2015-04-28 12:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-28 11:42 Guest handling of IA32_DEBUGCTL MSR Nadav Amit
2015-04-28 11:43 ` Paolo Bonzini
2015-04-28 12:00   ` Jan Kiszka
2015-04-28 12:09     ` Nadav Amit
2015-04-28 12:32     ` Paolo Bonzini

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.