From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fNJJy-0007rr-67 for speck@linutronix.de; Mon, 28 May 2018 16:40:26 +0200 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3F2A402243B for ; Mon, 28 May 2018 14:40:18 +0000 (UTC) Received: from [10.36.118.75] (unknown [10.36.118.75]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 64A682026DEF for ; Mon, 28 May 2018 14:40:18 +0000 (UTC) Subject: [MODERATED] Re: L1D-Fault KVM mitigation References: <1524563292.8691.38.camel@infradead.org> <20180424110445.GU4043@hirez.programming.kicks-ass.net> <1527068745.8186.89.camel@infradead.org> <20180524094526.GE12198@hirez.programming.kicks-ass.net> <20180526204319.GB4486@tassilo.jf.intel.com> <20180527182550.GC4486@tassilo.jf.intel.com> From: Paolo Bonzini Message-ID: Date: Mon, 28 May 2018 16:40:17 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="9DWYP2EmP4Y6leJ3mM2eScRKSySPIeSm9"; protected-headers="v1" To: speck@linutronix.de List-ID: This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --9DWYP2EmP4Y6leJ3mM2eScRKSySPIeSm9 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 27/05/2018 20:49, speck for Linus Torvalds wrote: > But why would you emulate halt/mwait/pause anyway? That sounds insane t= o=20 > me. The reason you would want exit-on-halt is so that the host can do=20 > something else if a vcpu goes idle, not so that it can just stay in som= e=20 > emulated idle state. When hlt/mwait is emulated, the thread goes to sleep. When pause is emulated, the thread checks if there is another CPU to yield to, but otherwise stays running. KVM recently grew a new mode where hlt/mwait/pause is passed directly to the guest. It was (partly) contributed by Amazon because that's what they're doing in their KVM-based cloud stuff - it does all I/O in custom hardware so all interrupts will be VT-d posted interrupts and avoid the overhead of the vCPU thread going to sleep and back running. There is a problem though. The only way to know if the guest is in hlt/mwait/pause, is to cause a vmexit, e.g. with an IPI, and read the VM control state (which you can only do from the CPU that was running it!). So even for the "idle in the guest" case you pretty much have to do synchronization. Paolo > If you want to go to low-power mode, you'd just let the halt/mwait happ= en=20 > inside the guest. >=20 > But to be honest, I haven't actually checked what kvm users (or xen, or= =20 > whatever) really do. Am I missing something? --9DWYP2EmP4Y6leJ3mM2eScRKSySPIeSm9--