From nobody Wed Apr 24 13:17:38 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1560334424; cv=none; d=zoho.com; s=zohoarc; b=hNJqZ8aEiHakgIQquE50iOd21K56RLMYANMjrPiDmUe2Z2wWkocfeyg59JkabfXO03KfaXlDW5C5KBFlr67xgY14Y95jeWCpY3Y2/AcGmj9wUR445J7DG3W6bCAWvBLZoP2j62xEpa7ekeXPaljxKIBUc7VyalIi4RvEHbxL2h8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560334424; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=hHu3tNLHXtmlRofiRF81MTuaWwmQ1CsVvaiP2HL7IPs=; b=YETDU7EQ1KaE0y2jjJlaq/yCbK9uWyrlx9FbFjNl7mFV6EJNg4cpP6OTRvVDKqgMW5NLm6x1SMG6MLQ5zX+tK2Gh/eAB3XoJSmfP0/2mgIkWADn7GpgwJ/PQXA5DTrzfmgSFo5sWCofdM79yFtOct1qehAHqJHluCU0yEb/jLXs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1560334424810955.1266572195084; Wed, 12 Jun 2019 03:13:44 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hb0FD-0008JD-OA; Wed, 12 Jun 2019 10:12:39 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hb0FC-0008J8-Es for xen-devel@lists.xenproject.org; Wed, 12 Jun 2019 10:12:38 +0000 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 97a56338-8cfa-11e9-bbeb-e7fef4e86fbf; Wed, 12 Jun 2019 10:12:33 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 96C5DAF81; Wed, 12 Jun 2019 10:12:31 +0000 (UTC) X-Inumbo-ID: 97a56338-8cfa-11e9-bbeb-e7fef4e86fbf X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org Date: Wed, 12 Jun 2019 12:12:28 +0200 Message-Id: <20190612101228.23898-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH] x86/xen: disable nosmt in Xen guests X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Stefano Stabellini , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Boris Ostrovsky , Thomas Gleixner MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" When running as a Xen guest selecting "nosmt" either via command line or implicitly via default settings makes no sense, as the guest has no clue about the real system topology it is running on. With Xen it is the hypervisor's job to ensure the proper bug mitigations are active regarding smt settings. So when running as a Xen guest set cpu_smt_control to "not supported" in order to avoid disabling random vcpus. Signed-off-by: Juergen Gross --- arch/x86/xen/enlighten.c | 8 ++++++++ arch/x86/xen/enlighten_hvm.c | 2 ++ arch/x86/xen/enlighten_pv.c | 2 ++ arch/x86/xen/xen-ops.h | 2 ++ 4 files changed, 14 insertions(+) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 750f46ad018a..312b73698d0c 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -345,3 +345,11 @@ void xen_arch_unregister_cpu(int num) } EXPORT_SYMBOL(xen_arch_unregister_cpu); #endif + +void __init xen_disable_nosmt(void) +{ +#ifdef CONFIG_HOTPLUG_SMT + /* Don't allow SMT disabling in Xen guests. */ + cpu_smt_control =3D CPU_SMT_NOT_SUPPORTED; +#endif +} diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c index 0e75642d42a3..7c62662cd2ca 100644 --- a/arch/x86/xen/enlighten_hvm.c +++ b/arch/x86/xen/enlighten_hvm.c @@ -116,6 +116,8 @@ static void __init init_hvm_pv_info(void) this_cpu_write(xen_vcpu_id, ebx); else this_cpu_write(xen_vcpu_id, smp_processor_id()); + + xen_disable_nosmt(); } =20 #ifdef CONFIG_KEXEC_CORE diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 4722ba2966ac..dcfec65bca60 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -131,6 +131,8 @@ static void __init xen_pv_init_platform(void) =20 /* pvclock is in shared info area */ xen_init_time_ops(); + + xen_disable_nosmt(); } =20 static void __init xen_pv_guest_late_init(void) diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index 2f111f47ba98..63a31b9d7217 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h @@ -161,4 +161,6 @@ void xen_hvm_post_suspend(int suspend_cancelled); static inline void xen_hvm_post_suspend(int suspend_cancelled) {} #endif =20 +void __init xen_disable_nosmt(void); + #endif /* XEN_OPS_H */ --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel