Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp307039ybx; Wed, 6 Nov 2019 00:35:45 -0800 (PST) X-Google-Smtp-Source: APXvYqz5f+JduZR/pDJggTufQ8sksLCubIO1N7Or8dbpAiYRs7XF+Hy42VUTxbcdpmMAsEWmMDy2 X-Received: by 2002:a17:906:7399:: with SMTP id f25mr17611533ejl.176.1573029344953; Wed, 06 Nov 2019 00:35:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573029344; cv=none; d=google.com; s=arc-20160816; b=S8Vgn1z72fiWa9Xb73gz1/atWpkTB10K7T6eDLpGSe/SL/HKPmpX053rpJKTgBmH1c 5aQ409NeouxQenuh5Vr7xRBWZDp9LiokgcKPHzU2FWB1FZKhWY1DKPqxubAs5outXeer w87oVuIjPWm6ZNixq9CycaRhSV0RUMwWVZUw0tVxKFHjR1bHElc2EQWtIFVS0iAygj4N UXG0pNmPylhX2H6JfEMGZVlbSaLa23jQ+lXHHLCZHYwyka5C0dSZI/Fwv3bi+XJwI2YQ CjcPC2WxdtsErEwKra79pHOkAA3zV9E9rUcH/nazPz8gCoNqFNM/vPEVXmrVaSJ+cD1H A5Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=GGL1v+c1ltlTqawzPHu/3IiNRPhlH8S8qHZKrdhagc8=; b=lvltF+E/2bVGgWecAzfLVxqw+6+OInHKEASMH6gRxKqaPICYe0b91LievRtNzBkyoG nrABQMjwJJMorlssqXrzGyl+SAwwQdrj2DYlJZ7OwozmDM60bqWjqqWb3gA94UP7sIks R9t/bHebru3bNhTrWU7ZcjUv9dKAFp3iojWVyNJAaZ1qa1v+J2mcewnfcqJXSSqcv9p8 v9pN/YAnk46Dy5bKoliYkNNyAvk6WF/az7R/QzXSF2fHg/x5o94Lp++ZAM+GU+reWFh5 Jt8o+od0uX73eMs0Nv/BRDOiHiKL876gg5v3JQ/0ME6WsN0VHn9xLP4hvX/NvTer8T2k +yBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Fmf5NiRH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bi3si12845589edb.331.2019.11.06.00.35.21; Wed, 06 Nov 2019 00:35:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Fmf5NiRH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731483AbfKFIcv (ORCPT + 99 others); Wed, 6 Nov 2019 03:32:51 -0500 Received: from merlin.infradead.org ([205.233.59.134]:47640 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730271AbfKFIcu (ORCPT ); Wed, 6 Nov 2019 03:32:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=GGL1v+c1ltlTqawzPHu/3IiNRPhlH8S8qHZKrdhagc8=; b=Fmf5NiRHFmpiEsnYT7W3L8dUB fjHSATuLCvcX3stZRtGuJ76Q1zhXzKbASr1NDuJlt467yL8PbFD6g9idJs9v3rt5+SuKCMIb8zHhN dNqa1k5wKfWZgXAaGDF4wIK7xRuzSb8kIVrQ3ai4oXxaJVMYYvBHsz01Kek6tGoUhE1RJFoLDq8jn VG0yNPUV33BDNvP879ae8Zmw4XIwiQ+5s+C1Qucd6jVbuE17FXTJYSSIpzhIeTeS+yEiu98kTJsu3 9rJWADESIAsRwirz4FWOkElJZMOT41aq3zDr6qGq9dxc9+onGHhkI3JG02Bli1ZesnNis/QljDPzH YLNhACftw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1iSGk1-0004S3-B7; Wed, 06 Nov 2019 08:32:37 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id B456C303DDD; Wed, 6 Nov 2019 09:31:31 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id BAD032020D8FD; Wed, 6 Nov 2019 09:32:35 +0100 (CET) Date: Wed, 6 Nov 2019 09:32:35 +0100 From: Peter Zijlstra To: Sean Christopherson Cc: Vitaly Kuznetsov , kvm@vger.kernel.org, x86@kernel.org, Paolo Bonzini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Jim Mattson , Liran Alon , linux-kernel@vger.kernel.org, "H. Peter Anvin" Subject: Re: [PATCH RFC] KVM: x86: tell guests if the exposed SMT topology is trustworthy Message-ID: <20191106083235.GP4131@hirez.programming.kicks-ass.net> References: <20191105161737.21395-1-vkuznets@redhat.com> <20191105200218.GF3079@worktop.programming.kicks-ass.net> <20191105232528.GF23297@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191105232528.GF23297@linux.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 05, 2019 at 03:25:28PM -0800, Sean Christopherson wrote: > On Tue, Nov 05, 2019 at 09:02:18PM +0100, Peter Zijlstra wrote: > > On Tue, Nov 05, 2019 at 05:17:37PM +0100, Vitaly Kuznetsov wrote: > > > Virtualized guests may pick a different strategy to mitigate hardware > > > vulnerabilities when it comes to hyper-threading: disable SMT completely, > > > use core scheduling, or, for example, opt in for STIBP. Making the > > > decision, however, requires an extra bit of information which is currently > > > missing: does the topology the guest see match hardware or if it is 'fake' > > > and two vCPUs which look like different cores from guest's perspective can > > > actually be scheduled on the same physical core. Disabling SMT or doing > > > core scheduling only makes sense when the topology is trustworthy. > > > > > > Add two feature bits to KVM: KVM_FEATURE_TRUSTWORTHY_SMT with the meaning > > > that KVM_HINTS_TRUSTWORTHY_SMT bit answers the question if the exposed SMT > > > topology is actually trustworthy. It would, of course, be possible to get > > > away with a single bit (e.g. 'KVM_FEATURE_FAKE_SMT') and not lose backwards > > > compatibility but the current approach looks more straightforward. > > > > The only way virt topology can make any sense what so ever is if the > > vcpus are pinned to physical CPUs. > > > > And I was under the impression we already had a bit for that (isn't it > > used to disable paravirt spinlocks and the like?). But I cannot seem to > > find it in a hurry. > > Yep, KVM_HINTS_REALTIME does what you describe. *sigh*, that's a pretty shit name for it :/