Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 06 Jul 2018 12:35:20 -0000 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 1fbPxG-0008QK-2n for speck@linutronix.de; Fri, 06 Jul 2018 14:35:19 +0200 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 97D84407706A for ; Fri, 6 Jul 2018 12:35:11 +0000 (UTC) Received: from [10.36.116.92] (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D829B7C4B for ; Fri, 6 Jul 2018 12:35:10 +0000 (UTC) Subject: [MODERATED] Re: Interrupts policy for SMT References: <20180705230732.GJ17013@tassilo.jf.intel.com> From: Paolo Bonzini Message-ID: <1e833994-40b4-babe-d941-ac07d979a944@redhat.com> Date: Fri, 6 Jul 2018 14:35:09 +0200 MIME-Version: 1.0 In-Reply-To: <20180705230732.GJ17013@tassilo.jf.intel.com> Content-Type: multipart/mixed; boundary="KmiYBAB1KJnohUw0ym80vzSTsJAOg1h1N"; protected-headers="v1" To: speck@linutronix.de List-ID: This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --KmiYBAB1KJnohUw0ym80vzSTsJAOg1h1N Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 06/07/2018 01:07, speck for Andi Kleen wrote: > 2. Explicitly force the sibling to exit for interrupts >=20 > The basic idea is to maintain the "i am in a guest" and "i am in > an interrupt states in two cache lins. > The sibling always checks it before executing interrupts. If > is set it sends an IPI. KVM also needs to check and wait > for interrupts before entering the guest. >=20 > The IPI isn't actually fully executed because KVM can intercept > it during an exit and ack it directly. >=20 > I did a prototype patch for this and we saw ~2% performance loss > for doing a kernel build inside the guest. This was before > the optimization of not executing the IPI, with that I would > expect it to be faster I like the handwavy approach, but I'd like to see the code nevertheless. Of course it is impossible to handle userspace, but the same handwavy justifications used for (3) apply even more there, since userspace should hardly run on a properly configured guest. Since we are at it, we could add a sticky bit "I am in an interrupt" sticky (bit 0 =3D am I in an interrupt, bit 1 =3D have I been in an interrupt since the flag was cleared). Then: - the interrupt handler writes 3 on entry and 2 on exit; - KVM writes 0 just before setting IF=3D1 and checks the sticky bit just before vmentry to check whether to do a L1D flush. Paolo --KmiYBAB1KJnohUw0ym80vzSTsJAOg1h1N--