From: Mingwei Zhang <mizhang@google.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Ashish Kalra <ashish.kalra@amd.com>,
Jacky Li <jackyli@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Ovidiu Panait <ovidiu.panait@windriver.com>,
Liam Merwick <liam.merwick@oracle.com>,
David Rientjes <rientjes@google.com>,
David Kaplan <david.kaplan@amd.com>,
Peter Gonda <pgonda@google.com>,
kvm@vger.kernel.org, Michael Roth <michael.roth@amd.com>
Subject: Re: [RFC PATCH 0/4] KVM: SEV: Limit cache flush operations in sev guest memory reclaim events
Date: Sat, 2 Dec 2023 06:21:31 +0000 [thread overview]
Message-ID: <ZWrM622xUb4pe7gS@google.com> (raw)
In-Reply-To: <ZWpec_P17GL01yL0@google.com>
On Fri, Dec 01, 2023, Sean Christopherson wrote:
> On Fri, Dec 01, 2023, Mingwei Zhang wrote:
> > On Fri, Dec 1, 2023 at 2:13 PM Sean Christopherson <seanjc@google.com> wrote:
> > >
> > > On Fri, Dec 01, 2023, Mingwei Zhang wrote:
> > > > On Fri, Dec 1, 2023 at 1:30 PM Kalra, Ashish <ashish.kalra@amd.com> wrote:
> > > > > For SNP + gmem, where the HVA ranges covered by the MMU notifiers are
> > > > > not acting on encrypted pages, we are ignoring MMU invalidation
> > > > > notifiers for SNP guests as part of the SNP host patches being posted
> > > > > upstream and instead relying on gmem own invalidation stuff to clean
> > > > > them up on a per-folio basis.
> > > > >
> > > > > Thanks,
> > > > > Ashish
> > > >
> > > > oh, I have no question about that. This series only applies to
> > > > SEV/SEV-ES type of VMs.
> > > >
> > > > For SNP + guest_memfd, I don't see the implementation details, but I
> > > > doubt you can ignore mmu_notifiers if the request does cover some
> > > > encrypted memory in error cases or corner cases. Does the SNP enforce
> > > > the usage of guest_memfd? How do we prevent exceptional cases? I am
> > > > sure you guys already figured out the answers, so I don't plan to dig
> > > > deeper until SNP host pages are accepted.
> > >
> > > KVM will not allow SNP guests to map VMA-based memory as encrypted/private, full
> > > stop. Any invalidations initiated by mmu_notifiers will therefore apply only to
> > > shared memory.
> >
> > Remind me. If I (as a SEV-SNP guest) flip the C-bit in my own x86 page
> > table and write to some of the pages, am I generating encrypted dirty
> > cache lines?
>
> No. See Table 15-39. "RMP Memory Access Checks" in the APM (my attempts to copy
> it to plain test failed miserably).
>
> For accesses with effective C-bit == 0, the page must be Hypervisor-Owned. For
> effective C-bit == 1, the page must be fully assigned to the guest. Violation
> of those rules generates #VMEXIT.
>
> A missing Validated attribute causes a #VC, but that case has lower priority than
> the about checks.
Thank you. RMP check seems to be mandatory on all memory accesses when
SNP is active. Hope that property remain an invarient regardless of any
future optimization.
Thanks.
-Mingwei
prev parent reply other threads:[~2023-12-02 6:21 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
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 [this message]
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=ZWrM622xUb4pe7gS@google.com \
--to=mizhang@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=michael.roth@amd.com \
--cc=ovidiu.panait@windriver.com \
--cc=pbonzini@redhat.com \
--cc=pgonda@google.com \
--cc=rientjes@google.com \
--cc=seanjc@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.