All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Jacky Li <jackyli@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Ovidiu Panait <ovidiu.panait@windriver.com>,
	 Liam Merwick <liam.merwick@oracle.com>,
	Ashish Kalra <Ashish.Kalra@amd.com>,
	 David Rientjes <rientjes@google.com>,
	David Kaplan <david.kaplan@amd.com>,
	 Peter Gonda <pgonda@google.com>,
	Mingwei Zhang <mizhang@google.com>,
	kvm@vger.kernel.org
Subject: Re: [RFC PATCH 1/4] KVM: SEV: Drop wbinvd_on_all_cpus() as kvm mmu notifier would flush the cache
Date: Fri, 1 Dec 2023 09:53:58 -0800	[thread overview]
Message-ID: <ZWodtj_FM1feBPEM@google.com> (raw)
In-Reply-To: <20231110003734.1014084-2-jackyli@google.com>

On Fri, Nov 10, 2023, Jacky Li wrote:
> Remove the wbinvd_on_all_cpus inside sev_mem_enc_unregister_region() and
> sev_vm_destroy() because kvm mmu notifier invalidation event would flush
> the cache.

This needs a much longer explanation of why this is safe.  This might also need
an opt-in, e.g. if userspace is reusing the memory for something else without
freeing it back to the kernel, and thus is relying on KVM to do the WBINVD.

The key thing is that userspace can access the memory at any time and _can_ do
CLFLUSH{OPT} if userspace wants to do its own conversions.  I.e. the WBINVD doesn't
protect against a misbehaving corrupting guest/userspace data.  But it's still
possible that userspace is relying on the WBINVD, and thou shalt not break userspace.

  reply	other threads:[~2023-12-01 17:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-10  0:37 [RFC PATCH 0/4] KVM: SEV: Limit cache flush operations in sev guest memory reclaim events Jacky Li
2023-11-10  0:37 ` [RFC PATCH 1/4] KVM: SEV: Drop wbinvd_on_all_cpus() as kvm mmu notifier would flush the cache Jacky Li
2023-12-01 17:53   ` Sean Christopherson [this message]
2023-11-10  0:37 ` [RFC PATCH 2/4] KVM: SEV: Plumb mmu_notifier_event into sev function Jacky Li
2023-11-10  0:37 ` [RFC PATCH 3/4] KVM: SEV: Limit the call of WBINVDs based on the event type of mmu notifier Jacky Li
2023-11-10 18:52   ` Kalra, Ashish
2023-11-10  0:37 ` [RFC PATCH 4/4] KVM: SEV: Use a bitmap module param to decide whether a cache flush is needed during the guest memory reclaim Jacky Li
2023-12-01 18:00   ` Sean Christopherson
2023-12-01 18:05 ` [RFC PATCH 0/4] KVM: SEV: Limit cache flush operations in sev guest memory reclaim events Sean Christopherson
2023-12-01 19:02   ` Mingwei Zhang
2023-12-01 21:30     ` Kalra, Ashish
2023-12-01 21:58       ` Mingwei Zhang
2023-12-01 22:13         ` Kalra, Ashish
2023-12-01 22:13         ` Sean Christopherson
2023-12-01 22:22           ` Mingwei Zhang
2023-12-01 22:30             ` Sean Christopherson
2023-12-02  6:21               ` Mingwei Zhang

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=ZWodtj_FM1feBPEM@google.com \
    --to=seanjc@google.com \
    --cc=Ashish.Kalra@amd.com \
    --cc=david.kaplan@amd.com \
    --cc=jackyli@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=liam.merwick@oracle.com \
    --cc=mizhang@google.com \
    --cc=ovidiu.panait@windriver.com \
    --cc=pbonzini@redhat.com \
    --cc=pgonda@google.com \
    --cc=rientjes@google.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 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.