From patchwork Mon Sep 30 05:21:27 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: 11166017 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 267AC13B1 for ; Mon, 30 Sep 2019 05:23:07 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C89520815 for ; Mon, 30 Sep 2019 05:23:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C89520815 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iEo8E-00021b-Cj; Mon, 30 Sep 2019 05:21:58 +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 1iEo8D-00020w-IR for xen-devel@lists.xenproject.org; Mon, 30 Sep 2019 05:21:57 +0000 X-Inumbo-ID: 3121f678-e342-11e9-96c8-12813bfff9fa Received: from mx1.suse.de (unknown [195.135.220.15]) by localhost (Halon) with ESMTPS id 3121f678-e342-11e9-96c8-12813bfff9fa; Mon, 30 Sep 2019 05:21:44 +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 0C9A3B0CC; Mon, 30 Sep 2019 05:21:42 +0000 (UTC) From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Mon, 30 Sep 2019 07:21:27 +0200 Message-Id: <20190930052135.11257-12-jgross@suse.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190930052135.11257-1-jgross@suse.com> References: <20190930052135.11257-1-jgross@suse.com> Subject: [Xen-devel] [PATCH v5 11/19] 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" 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 Acked-by: Jan Beulich Acked-by: Dario Faggioli --- V1: - new patch V2: - EBUSY as return code (Jan Beulich, Dario Faggioli) - __read_mostly for sched_disable_smt_switching (Jan Beulich) --- xen/arch/x86/sysctl.c | 5 +++++ xen/common/schedule.c | 1 + xen/include/xen/sched.h | 1 + 3 files changed, 7 insertions(+) diff --git a/xen/arch/x86/sysctl.c b/xen/arch/x86/sysctl.c index 3742ede61b..4a76f0f47f 100644 --- a/xen/arch/x86/sysctl.c +++ b/xen/arch/x86/sysctl.c @@ -209,6 +209,11 @@ long arch_do_sysctl( ret = -EOPNOTSUPP; break; } + if ( sched_disable_smt_switching ) + { + ret = -EBUSY; + break; + } plug = op == XEN_SYSCTL_CPU_HOTPLUG_SMT_ENABLE; fn = smt_up_down_helper; hcpu = _p(plug); diff --git a/xen/common/schedule.c b/xen/common/schedule.c index 249ff8a882..0dcf004d78 100644 --- a/xen/common/schedule.c +++ b/xen/common/schedule.c @@ -63,6 +63,7 @@ integer_param("sched_ratelimit_us", sched_ratelimit_us); /* Number of vcpus per struct sched_unit. */ static unsigned int __read_mostly sched_granularity = 1; +bool __read_mostly sched_disable_smt_switching; const cpumask_t *sched_res_mask = &cpumask_all; /* Common lock for free cpus. */ diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index f97303668a..aa8257edc9 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -1037,6 +1037,7 @@ static inline bool is_iommu_enabled(const struct domain *d) } extern bool sched_smt_power_savings; +extern bool sched_disable_smt_switching; extern enum cpufreq_controller { FREQCTL_none, FREQCTL_dom0_kernel, FREQCTL_xen