Re: [PATCH] KVM: SVM: Mark SEV launch secret pages as dirty.
From: Sean Christopherson
Date: Wed Sep 23 2020 - 13:26:50 EST
On Wed, Sep 23, 2020 at 07:16:08PM +0200, Paolo Bonzini wrote:
> On 23/09/20 19:04, Sean Christopherson wrote:
> >> Two of the three instances are a bit different though. What about this
> >> which at least shortens the comment to 2 fewer lines:
> > Any objection to changing those to "Flush (on non-coherent CPUs)"? I agree
> > it would be helpful to call out the details, especially for DBG_*, but I
> > don't like that it reads as if the flush is unconditional.
>
> Hmm... It's already fairly long lines so that would wrap to 3 lines, and
Dang, I was hoping it would squeeze into 2.
> the reference to the conditional flush wasn't there before either.
Well, the flush wasn't conditional before (ignoring the NULL check).
> sev_clflush_pages could be a better place to mention that (or perhaps
> it's self-explanatory).
I agree, but with
/*
* Flush before LAUNCH_UPDATE encrypts pages in place, in case the cache
* contains the data that was written unencrypted.
*/
sev_clflush_pages(inpages, npages);
there's nothing in the comment or code that even suggests sev_clflush_pages() is
conditional, i.e. no reason for the reader to peek at the implemenation.
What about:
/*
* Flush (on non-coherent CPUs) before LAUNCH_UPDATE encrypts pages in
* place, the cache may contain data that was written unencrypted.
*/