From: Andrew Cooper <andrew.cooper3@citrix.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: [PATCH 1/2] L1TF KVM 1
Date: Wed, 30 May 2018 00:54:04 +0100 [thread overview]
Message-ID: <a225b8e5-494c-3f0d-8d2a-25af9f3fafbc@citrix.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1805292350200.1597@nanos.tec.linutronix.de>
[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]
On 29/05/2018 23:49, speck for Thomas Gleixner wrote:
> On Tue, 29 May 2018, speck for Paolo Bonzini wrote:
>> +static void *__read_mostly empty_zero_pages;
>> +
>> +void kvm_l1d_flush(void)
>> +{
>> + asm volatile(
>> + "movq %0, %%rax\n\t"
>> + "leaq 65536(%0), %%rdx\n\t"
> Why 64K?
>
>> + "11: \n\t"
>> + "movzbl (%%rax), %%ecx\n\t"
>> + "addq $4096, %%rax\n\t"
>> + "cmpq %%rax, %%rdx\n\t"
>> + "jne 11b\n\t"
>> + "xorl %%eax, %%eax\n\t"
>> + "cpuid\n\t"
> What's the cpuid invocation for?
>
>> + "xorl %%eax, %%eax\n\t"
>> + "12:\n\t"
>> + "movzwl %%ax, %%edx\n\t"
>> + "addl $64, %%eax\n\t"
>> + "movzbl (%%rdx, %0), %%ecx\n\t"
>> + "cmpl $65536, %%eax\n\t"
> And this whole magic should be documented.
>
>> + "jne 12b\n\t"
>> + "lfence\n\t"
>> + :
>> + : "r" (empty_zero_pages)
>> + : "rax", "rbx", "rcx", "rdx");
> How is that supposed to compile on 32bit?
>
>> +}
> Aside of that do we really need that manual flush thingy? Is that ucode
> update going to take forever?
I already provided feedback on this software loop, but have had radio
silence as a result. The CPUID is serialisation (best as I can guess)
to terminate any WC buffer which got hit, but this is going to truly
suck inside a VM. If it is for full serialisation properties, the least
overhead option would be a write to %cr2, which is serialising on all
affected parts.
Other bits I don't understand are the 64k limit in the first place, why
it gets walked over in 4k strides to begin with (I'm not aware of any
prefetching which would benefit that...) and why a particularly
obfuscated piece of magic is used for the 64byte strides.
~Andrew
next prev parent reply other threads:[~2018-05-29 23:54 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 19:42 [MODERATED] [PATCH 0/2] L1TF KVM 0 Paolo Bonzini
2018-05-29 19:42 ` [MODERATED] [PATCH 1/2] L1TF KVM 1 Paolo Bonzini
2018-05-29 19:42 ` [MODERATED] [PATCH 2/2] L1TF KVM 2 Paolo Bonzini
[not found] ` <20180529194240.7F1336110A@crypto-ml.lab.linutronix.de>
2018-05-29 22:49 ` [PATCH 1/2] L1TF KVM 1 Thomas Gleixner
2018-05-29 23:54 ` Andrew Cooper [this message]
2018-05-30 9:01 ` [MODERATED] " Paolo Bonzini
2018-05-30 11:58 ` Martin Pohlack
2018-05-30 12:25 ` Thomas Gleixner
2018-05-30 14:31 ` Thomas Gleixner
2018-06-04 8:24 ` [MODERATED] " Martin Pohlack
2018-06-04 13:11 ` [MODERATED] Is: Tim, Q to you. Was:Re: " Konrad Rzeszutek Wilk
2018-06-04 17:59 ` [MODERATED] Encrypted Message Tim Chen
2018-06-05 1:25 ` [MODERATED] Re: Is: Tim, Q to you. Was:Re: [PATCH 1/2] L1TF KVM 1 Jon Masters
2018-06-05 1:30 ` Linus Torvalds
2018-06-05 7:10 ` Martin Pohlack
2018-06-05 23:34 ` [MODERATED] Encrypted Message Tim Chen
2018-06-05 23:37 ` Tim Chen
2018-06-07 19:11 ` Tim Chen
2018-06-07 23:24 ` [MODERATED] Re: Is: Tim, Q to you. Was:Re: [PATCH 1/2] L1TF KVM 1 Andi Kleen
2018-06-08 16:29 ` Thomas Gleixner
2018-06-08 17:51 ` [MODERATED] " Josh Poimboeuf
2018-06-11 14:50 ` Paolo Bonzini
2018-05-30 8:55 ` [MODERATED] " Peter Zijlstra
2018-05-30 9:02 ` Paolo Bonzini
2018-05-31 19:00 ` Jon Masters
[not found] ` <20180529194322.8B56F610F8@crypto-ml.lab.linutronix.de>
2018-05-29 23:59 ` [MODERATED] Re: [PATCH 2/2] L1TF KVM 2 Andrew Cooper
2018-05-30 8:38 ` Thomas Gleixner
2018-05-30 16:57 ` [MODERATED] " Andrew Cooper
2018-05-30 19:11 ` Thomas Gleixner
2018-05-30 21:10 ` [MODERATED] " Andi Kleen
2018-05-30 23:19 ` Andrew Cooper
[not found] ` <20180529194239.768D561107@crypto-ml.lab.linutronix.de>
2018-06-01 16:48 ` [MODERATED] Re: [PATCH 1/2] L1TF KVM 1 Konrad Rzeszutek Wilk
2018-06-04 14:56 ` Paolo Bonzini
[not found] ` <20180529194236.EDB8561100@crypto-ml.lab.linutronix.de>
2018-06-06 0:34 ` Dave Hansen
2018-06-06 14:15 ` Dave Hansen
[not found] ` <20180529194240.5654A61109@crypto-ml.lab.linutronix.de>
2018-06-08 17:49 ` Josh Poimboeuf
2018-06-08 20:49 ` Konrad Rzeszutek Wilk
2018-06-08 22:13 ` Josh Poimboeuf
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=a225b8e5-494c-3f0d-8d2a-25af9f3fafbc@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=speck@linutronix.de \
/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.