public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Jon Kohler <jon@nutanix.com>
Cc: Borislav Petkov <bp@alien8.de>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"x86@kernel.org" <x86@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Balbir Singh <sblbir@amazon.com>,
	Kim Phillips <kim.phillips@amd.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	Andrea Arcangeli <aarcange@redhat.com>,
	Kees Cook <keescook@chromium.org>,
	Waiman Long <longman@redhat.com>
Subject: Re: [PATCH v3] x86/speculation, KVM: only IBPB for switch_mm_always_ibpb on vCPU load
Date: Tue, 10 May 2022 14:22:11 +0000	[thread overview]
Message-ID: <Ynp1E73OZtXudLUH@google.com> (raw)
In-Reply-To: <4E46337F-79CB-4ADA-B8C0-009E7500EDF8@nutanix.com>

On Sat, Apr 30, 2022, Jon Kohler wrote:
> 
> > On Apr 30, 2022, at 5:50 AM, Borislav Petkov <bp@alien8.de> wrote:
> > So let me try to understand this use case: you have a guest and a bunch
> > of vCPUs which belong to it. And that guest gets switched between those
> > vCPUs and KVM does IBPB flushes between those vCPUs.
> > 
> > So either I'm missing something - which is possible - but if not, that
> > "protection" doesn't make any sense - it is all within the same guest!
> > So that existing behavior was silly to begin with so we might just as
> > well kill it.
> 
> Close, its not 1 guest with a bunch of vCPU, its a bunch of guests with
> a small amount of vCPUs, thats the small nuance here, which is one of 
> the reasons why this was hard to see from the beginning. 
> 
> AFAIK, the KVM IBPB is avoided when switching in between vCPUs
> belonging to the same vmcs/vmcb (i.e. the same guest), e.g. you could 
> have one VM highly oversubscribed to the host and you wouldn’t see
> either the KVM IBPB or the switch_mm IBPB. All good. 

No, KVM does not avoid IBPB when switching between vCPUs in a single VM.  Every
vCPU has a separate VMCS/VMCB, and so the scenario described above where a single
VM has a bunch of vCPUs running on a limited set of logical CPUs will emit IBPB
on every single switch.

  parent reply	other threads:[~2022-05-10 14:56 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-22 16:21 [PATCH v3] x86/speculation, KVM: only IBPB for switch_mm_always_ibpb on vCPU load Jon Kohler
2022-04-28 12:51 ` Jon Kohler
2022-04-29 16:59 ` Borislav Petkov
2022-04-29 17:31   ` Jon Kohler
2022-04-29 19:32     ` Borislav Petkov
2022-04-29 20:08       ` Jon Kohler
2022-04-29 20:29       ` Sean Christopherson
2022-04-29 20:59         ` Borislav Petkov
2022-04-29 21:59           ` Sean Christopherson
2022-04-29 22:22             ` Borislav Petkov
2022-04-29 23:23               ` Sean Christopherson
2022-04-30  9:50                 ` Borislav Petkov
2022-04-30 14:50                   ` Jon Kohler
2022-04-30 16:08                     ` Borislav Petkov
2022-05-06 15:42                       ` Jon Kohler
2022-05-10 14:44                       ` Sean Christopherson
2022-05-10 15:03                         ` Jon Kohler
2022-05-10 15:50                           ` Sean Christopherson
2022-05-12 13:44                             ` Borislav Petkov
2022-05-12 17:56                               ` Jon Kohler
2022-05-10 14:22                     ` Sean Christopherson [this message]
2022-05-10 14:49                       ` Jon Kohler

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=Ynp1E73OZtXudLUH@google.com \
    --to=seanjc@google.com \
    --cc=aarcange@redhat.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jmattson@google.com \
    --cc=jon@nutanix.com \
    --cc=joro@8bytes.org \
    --cc=jpoimboe@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kim.phillips@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=sblbir@amazon.com \
    --cc=tglx@linutronix.de \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    /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