All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: [PATCH v2 4/4] L1TF KVM ARCH_CAPABILITIES #4
Date: Tue, 31 Jul 2018 09:39:26 +0200	[thread overview]
Message-ID: <1639d83d-58a5-6c4f-8df5-0e4582c96b75@redhat.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1807302329530.1725@nanos.tec.linutronix.de>

On 30/07/2018 23:36, speck for Thomas Gleixner wrote:
> On Wed, 25 Jul 2018, speck for Paolo Bonzini wrote:
>>  
>> +3.4. Nested virtual machines
>> +""""""""""""""""""""""""""""
>> +
>> +When nested virtualization is in use, three operating systems are involved:
>> +the bare metal hypervisor, the nested hypervisor, and the nested virtual
>> +machine.  VMENTER operations from the nested hypervisor into the nested
>> +guest will always be processed by the bare metal hypervisor.  Therefore:
>> +
>> +When running as a bare metal hypervisor, instead, KVM will:
>> +
>> + - flush the L1D cache on every switch from nested hypervisor to
>> +   nested virtual machine, so that the nested hypervisor's secrets
>> +   are not exposed to the nested virtual machine;
>> +
>> + - flush the L1D cache on every switch from nested virtual machine to
>> +   nested hypervisor; this is a complex operation, and flushing the L1D
>> +   cache avoids that the bare metal hypervisor's secrets be exposed
>> +   to the nested virtual machine;
>> +
>> + - instruct the nested hypervisor to not perform any L1D cache flush.
> 
> I still think that we need some explanation about SMT in guests, i.e. that
> the SMT information in guests is inaccurate and does not tell anything
> about the host side SMT control state. But that's independent of this
> nested optimization as it applies to all guest levels.
> 
>> +u64 kvm_get_arch_capabilities(void)
>> +{
>> +	u64 data;
>> +
>> +	rdmsrl_safe(MSR_IA32_ARCH_CAPABILITIES, &data);
>> +	if (l1tf_vmx_mitigation != VMENTER_L1D_FLUSH_NEVER)
>> +		data |= ARCH_CAP_SKIP_VMENTRY_L1DFLUSH;
> 
> That really wants a comment explaining the magic here.

Something like:

	/*
	 * If we're doing cache flushes (either "always" or "cond")
	 * we will do one whenever the guest does a vmlaunch/vmresume.
	 * If an outer hypervisor is doing the cache flush for us
	 * (VMENTER_L1D_FLUSH_NESTED_VM), we can safely pass that
	 * capability to the guest too, and if EPT is disabled we're not
	 * vulnerable.  Overall, only VMENTER_L1D_FLUSH_NEVER will
	 * require a nested hypervisor to do a flush of its own.
	 */

?

> 
> Thanks,
> 
> 	tglx
> 

  reply	other threads:[~2018-07-31  7:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25 14:30 [MODERATED] [PATCH v2 0/4] L1TF KVM ARCH_CAPABILITIES #0 Paolo Bonzini
2018-07-25 14:30 ` [MODERATED] [PATCH v2 1/4] L1TF KVM ARCH_CAPABILITIES #1 Paolo Bonzini
2018-07-25 19:43   ` [MODERATED] " Andrew Cooper
2018-07-26  8:15     ` Paolo Bonzini
2018-07-25 14:30 ` [MODERATED] [PATCH v2 2/4] L1TF KVM ARCH_CAPABILITIES #2 Paolo Bonzini
2018-07-30 21:27   ` Thomas Gleixner
2018-07-31  8:22     ` [MODERATED] " Paolo Bonzini
2018-07-31  9:15       ` Thomas Gleixner
2018-07-31  9:35         ` [MODERATED] " Paolo Bonzini
2018-07-25 14:30 ` [MODERATED] [PATCH v2 3/4] L1TF KVM ARCH_CAPABILITIES #3 Paolo Bonzini
2018-07-25 14:31 ` [MODERATED] [PATCH v2 4/4] L1TF KVM ARCH_CAPABILITIES #4 Paolo Bonzini
2018-07-30 21:36   ` Thomas Gleixner
2018-07-31  7:39     ` Paolo Bonzini [this message]
2018-07-31  7:59       ` Thomas Gleixner
2018-07-25 15:52 ` [MODERATED] Re: [PATCH v2 0/4] L1TF KVM ARCH_CAPABILITIES #0 Greg KH
2018-07-26  8:12   ` Paolo Bonzini
2018-07-26 10:04     ` Greg KH
2018-07-26 10:41       ` Paolo Bonzini
2018-07-30 21:40         ` Thomas Gleixner
2018-08-02  2:51 ` [MODERATED] " Konrad Rzeszutek Wilk
2018-08-02 12:07   ` Paolo Bonzini

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=1639d83d-58a5-6c4f-8df5-0e4582c96b75@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=speck@linutronix.de \
    /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.