From patchwork Tue May 28 10:33:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SsO8cmdlbiBHcm/Dnw==?= X-Patchwork-Id: 10964695 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F237876 for ; Tue, 28 May 2019 10:36:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E17552838B for ; Tue, 28 May 2019 10:36:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D56FE286CF; Tue, 28 May 2019 10:36:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 833662022B for ; Tue, 28 May 2019 10:36:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hVZRA-0006uV-Bs; Tue, 28 May 2019 10:34:32 +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 1hVZQH-0004yt-30 for xen-devel@lists.xenproject.org; Tue, 28 May 2019 10:33:37 +0000 X-Inumbo-ID: 08adfb80-8134-11e9-914a-c75b1fe74b72 Received: from mx1.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 08adfb80-8134-11e9-914a-c75b1fe74b72; Tue, 28 May 2019 10:33:30 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 498ECB052; Tue, 28 May 2019 10:33:29 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Tue, 28 May 2019 12:33:02 +0200 Message-Id: <20190528103313.1343-50-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190528103313.1343-1-jgross@suse.com> References: <20190528103313.1343-1-jgross@suse.com> Subject: [Xen-devel] [PATCH 49/60] xen/sched: reject switching smt on/off with core scheduling active 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 , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Ian Jackson , Tim Deegan , Julien Grall , Jan Beulich , Dario Faggioli , =?utf-8?q?Roger_Pau_Monn=C3=A9?= MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP When core or socket scheduling are active enabling or disabling smt is not possible as that would require a major host reconfiguration. Add a bool sched_disable_smt_switching which will be set for core or socket scheduling. Signed-off-by: Juergen Gross --- V1: new patch --- xen/arch/x86/sysctl.c | 3 ++- xen/common/schedule.c | 1 + xen/include/xen/sched.h | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 3f06fecbd8..034d78fe67 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -200,7 +200,8 @@ long arch_do_sysctl( case XEN_SYSCTL_CPU_HOTPLUG_SMT_ENABLE: case XEN_SYSCTL_CPU_HOTPLUG_SMT_DISABLE: - if ( !cpu_has_htt || boot_cpu_data.x86_num_siblings < 2 ) + if ( !cpu_has_htt || boot_cpu_data.x86_num_siblings < 2 || + sched_disable_smt_switching ) { ret = -EOPNOTSUPP; break; diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 3c85861b15..8607262a71 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -57,6 +57,7 @@ integer_param("sched_ratelimit_us", sched_ratelimit_us); /* Number of vcpus per struct sched_unit. */ static unsigned int sched_granularity = 1; +bool sched_disable_smt_switching; const cpumask_t *sched_res_mask = &cpumask_all; /* Various timer handlers. */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index b6496f57f6..7dc63c449b 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -1020,6 +1020,7 @@ static inline bool is_vcpu_online(const struct vcpu *v) } extern bool sched_smt_power_savings; +extern bool sched_disable_smt_switching; extern enum cpufreq_controller { FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen