Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp1416059ybx; Tue, 5 Nov 2019 15:57:35 -0800 (PST) X-Google-Smtp-Source: APXvYqw7AlFHnIQQ1lzxntUppb9vQspvum6IPLs7368d5qJlJAAXQW/SmwdmMjOIxImnlAlh63iy X-Received: by 2002:a17:906:e2cb:: with SMTP id gr11mr33054322ejb.205.1572998255882; Tue, 05 Nov 2019 15:57:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572998255; cv=none; d=google.com; s=arc-20160816; b=Xhqrt0n8tfWmv824Lv27zWKEsea0ayaMf7DSokEsB7gSEuGyrNYuwFjKnbRYlxMbzh vUY6JtDmt8zlOHyR3Yi7tggBV5IPWPhsVs1YwH+nWuA9uApvebw/ws9L2JxpeSZthxzO DMIFIPn6X7ZC8DFE1MdPI6BTW9Sxceta330zhzwFu0NwlGA+NO1FMnIGNIE3MqXDJeFa feAZ+pwYf5UpAuctE5ATpuoMqjk9ZBHtVoumFENf7IckRgSezJLrb68rf4Ics9o7zeNB czWIOCzV03+itgRNQPyKugtA2tuPC1GppXu1GoajHVg+mKwVqtm+dqiF6vhEIHzhEh+D ynEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:openpgp:from:references:cc:to:subject; bh=06M8EIegAgG0v07Clyq4kGwN0RVfmrVZoqQU2t3v1Zs=; b=H1j/Nrxky+YDD6tL7ZeKkd1T2/i+v1oOQdznm1Uqyfwn+RMUFCieR3/ja6c6lbgBqq /Sld6saYI18G1tmKnU6vDDqYL88ZnjiCpY6y/8R/rpm+W2CqWWw9hr4x3bKv4pIWmE09 bG6dvIhoiG3vkbdAvKK/jq/6Drq4uQXty8LK0JhLXuIZtAWIHr/4rw8deUGgMOxVnvuD /Rh6fp4eaEyb5iMmv21d1gAsO1TpILDU38Rf/Od2OkJQkmoeUnXGl6DImMUnyLfV+42v JggdfnziavYCYp+ud2yFX1RgQCylHU1qSAeZw+ET/Sc/c/KBNjufJaNTzY2yQrRI1u0s J3nA== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v12si12616148edf.71.2019.11.05.15.57.12; Tue, 05 Nov 2019 15:57:35 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730645AbfKEX4Z (ORCPT + 99 others); Tue, 5 Nov 2019 18:56:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:44036 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730531AbfKEX4V (ORCPT ); Tue, 5 Nov 2019 18:56:21 -0500 Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A0079368E6 for ; Tue, 5 Nov 2019 23:56:20 +0000 (UTC) Received: by mail-wr1-f72.google.com with SMTP id j17so12972513wru.13 for ; Tue, 05 Nov 2019 15:56:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=06M8EIegAgG0v07Clyq4kGwN0RVfmrVZoqQU2t3v1Zs=; b=m/IMlBYq6+JTDrmqWEGaWFqO2M7yYQfp9jFlET+GTGPcyuz5ykZrbLWlpXN5t2gemH Hyscj/R/NHO28d9TKAKifyLBv948D4eQYhdis2aj+XzLHAi6402EPEhI2j0tMaINVc4C dNsDfkKCy/APfWf8o2e/yuqF5nSl247aU5c5NQzcD/KU3cRuQEBER2NKhcOpS/7BNzbP ZzAL+jT6V0MkxXOgpj224Vd4k/a7C5o6re/ZbDi0jdI9ttPdpWvJw1eVdIlYiGvPMNWf oxvqFDTNMSar4iZrJMwvfoxhrQqWKPq7h9NczmKMmTF9F/xI9uOLS6HyuqC2o6ThDU07 10vA== X-Gm-Message-State: APjAAAWN0epQjmoXBmSPIgJQTiDI07aPWFzj85Sd8LEXfDaqi0ec0STX HVv/ZO+emKpt54dWxVhMnHua0L+mjBals9mv4RMo7pjElBldlY/qH/6vCMNwgCrw1FVDSiCQL2m TqVcbCk6u68135XKT2MnnCZda X-Received: by 2002:a1c:4606:: with SMTP id t6mr1208608wma.73.1572998179160; Tue, 05 Nov 2019 15:56:19 -0800 (PST) X-Received: by 2002:a1c:4606:: with SMTP id t6mr1208582wma.73.1572998178811; Tue, 05 Nov 2019 15:56:18 -0800 (PST) Received: from [192.168.10.150] ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id 4sm1154288wmd.33.2019.11.05.15.56.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Nov 2019 15:56:18 -0800 (PST) Subject: Re: [PATCH RFC] KVM: x86: tell guests if the exposed SMT topology is trustworthy To: Vitaly Kuznetsov , kvm@vger.kernel.org Cc: x86@kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Sean Christopherson , Jim Mattson , Liran Alon , linux-kernel@vger.kernel.org, "H. Peter Anvin" , "Peter Zijlstra (Intel)" References: <20191105161737.21395-1-vkuznets@redhat.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: Date: Wed, 6 Nov 2019 00:56:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191105161737.21395-1-vkuznets@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/11/19 17:17, Vitaly Kuznetsov wrote: > There is also one additional piece of the information missing. A VM can be > sharing physical cores with other VMs (or other userspace tasks on the > host) so does KVM_FEATURE_TRUSTWORTHY_SMT imply that it's not the case or > not? It is unclear if this changes anything and can probably be left out > of scope (just don't do that). > > Similar to the already existent 'NoNonArchitecturalCoreSharing' Hyper-V > enlightenment, the default value of KVM_HINTS_TRUSTWORTHY_SMT is set to > !cpu_smt_possible(). KVM userspace is thus supposed to pass it to guest's > CPUIDs in case it is '1' (meaning no SMT on the host at all) or do some > extra work (like CPU pinning and exposing the correct topology) before > passing '1' to the guest. > > Signed-off-by: Vitaly Kuznetsov > --- > Documentation/virt/kvm/cpuid.rst | 27 +++++++++++++++++++-------- > arch/x86/include/uapi/asm/kvm_para.h | 2 ++ > arch/x86/kvm/cpuid.c | 7 ++++++- > 3 files changed, 27 insertions(+), 9 deletions(-) > > diff --git a/Documentation/virt/kvm/cpuid.rst b/Documentation/virt/kvm/cpuid.rst > index 01b081f6e7ea..64b94103fc90 100644 > --- a/Documentation/virt/kvm/cpuid.rst > +++ b/Documentation/virt/kvm/cpuid.rst > @@ -86,6 +86,10 @@ KVM_FEATURE_PV_SCHED_YIELD 13 guest checks this feature bit > before using paravirtualized > sched yield. > > +KVM_FEATURE_TRUSTWORTHY_SMT 14 set when host supports 'SMT > + topology is trustworthy' hint > + (KVM_HINTS_TRUSTWORTHY_SMT). > + Instead of defining a one-off bit, can we make: ecx = the set of known "hints" (defaults to edx if zero) edx = the set of hints that apply to the virtual machine Paolo