All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: Krish Sadhukhan <krish.sadhukhan@oracle.com>, kvm@vger.kernel.org
Cc: pbonzini@redhat.com, jmattson@google.com
Subject: Re: [PATCH 2/2] KVM: SVM: Don't flush cache of SEV-encrypted pages if hardware enforces cache coherency across encryption domains
Date: Mon, 31 Aug 2020 11:14:47 -0500	[thread overview]
Message-ID: <ecf8a23a-8d7b-ed8d-e528-8298079d2df7@amd.com> (raw)
In-Reply-To: <20200829005926.5477-2-krish.sadhukhan@oracle.com>

On 8/28/20 7:59 PM, Krish Sadhukhan wrote:
> Some hardware implementations may enforce cache coherency across encryption
> domains. In such cases, it's not required to flush SEV-encrypted pages off
> cache lines.
> 
> Signed-off-by: Krish Sadhukhan <krish.sadhukhan@oracle.com>
> ---
>   arch/x86/kvm/svm/sev.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c
> index 402dc4234e39..c8ed8a62d5ef 100644
> --- a/arch/x86/kvm/svm/sev.c
> +++ b/arch/x86/kvm/svm/sev.c
> @@ -384,7 +384,8 @@ static void sev_clflush_pages(struct page *pages[], unsigned long npages)
>   	uint8_t *page_virtual;
>   	unsigned long i;
>   
> -	if (npages == 0 || pages == NULL)
> +	if ((cpuid_eax(SVM_SME_CPUID_FUNC) & (1u << 10)) || npages == 0 ||

Thanks for the patch. This should really be added as an X86_FEATURE bit, 
and then check that feature here, as opposed to calling CPUID every time. 
Also, there are other places in the kernel that this may be relevant, are 
you investigating those areas, also (e.g. set_memory_encrypted() / 
set_memory_decrypted())?

Thanks,
Tom

> +	    pages == NULL)
>   		return;
>   
>   	for (i = 0; i < npages; i++) {
> 

  reply	other threads:[~2020-08-31 16:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-29  0:59 [PATCH 1/2] SVM: Replace numeric value for SME CPUID leaf with a #define Krish Sadhukhan
2020-08-29  0:59 ` [PATCH 2/2] KVM: SVM: Don't flush cache of SEV-encrypted pages if hardware enforces cache coherency across encryption domains Krish Sadhukhan
2020-08-31 16:14   ` Tom Lendacky [this message]
2020-09-02  2:20     ` Krish Sadhukhan

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=ecf8a23a-8d7b-ed8d-e528-8298079d2df7@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=jmattson@google.com \
    --cc=krish.sadhukhan@oracle.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.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.