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 17:13:42 -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 1fbUIe-00011N-HQ for speck@linutronix.de; Fri, 06 Jul 2018 19:13:41 +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 E9A5372647 for ; Fri, 6 Jul 2018 17:13:33 +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 67A2C2026D68 for ; Fri, 6 Jul 2018 17:13:33 +0000 (UTC) Subject: [MODERATED] Re: Interrupts policy for SMT References: <20180705230732.GJ17013@tassilo.jf.intel.com> <1e833994-40b4-babe-d941-ac07d979a944@redhat.com> <20180706164635.GA25550@tassilo.jf.intel.com> From: Paolo Bonzini Message-ID: Date: Fri, 6 Jul 2018 19:13:32 +0200 MIME-Version: 1.0 In-Reply-To: <20180706164635.GA25550@tassilo.jf.intel.com> Content-Type: multipart/mixed; boundary="CNhO20uKoys7Achx9jMbjXWT8UAzNH1XJ"; protected-headers="v1" To: speck@linutronix.de List-ID: This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --CNhO20uKoys7Achx9jMbjXWT8UAzNH1XJ Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 06/07/2018 18:46, speck for Andi Kleen wrote: >> 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. > What do you mean? user space on the host would be handled by > the scheduler in this case (e.g. exclusive cpuset) I mean KVM userspace (whoever invokes the KVM_RUN ioctl). > This proposal was merely about interrupts. Understood. >> 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 ju= st >> before vmentry to check whether to do a L1D flush. > > Not sure what the point of this is, but if we wanted something > like that the easiest would be to maintain a interrupt count > per CPU. The point is to detect interrupts that happen during the processing of vmexits. "External interrupt" vmexits are easy, but interrupts can happen even during the processing of other exits. An interrupt count has to be updated during interrupts, and also retrieved and compared in KVM. Why not reuse the same flag you're adding= ? Paolo --CNhO20uKoys7Achx9jMbjXWT8UAzNH1XJ--