Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2727097ybv; Mon, 24 Feb 2020 10:24:10 -0800 (PST) X-Google-Smtp-Source: APXvYqzEtGlbheWysDr01LGPL84prt5SKDWxsusGmEWP5/WoI58K9x2m0DSaCMY92rrrH7HT+Y99 X-Received: by 2002:a9d:74c4:: with SMTP id a4mr42533360otl.119.1582568650683; Mon, 24 Feb 2020 10:24:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582568650; cv=none; d=google.com; s=arc-20160816; b=t2nKyI4Wsdmk4U4a7dP1tPkGUaaVJmdM125CGuaph+AlCi9ya4UN9Hh1zfy7zHAh4o jJrnQs//ks9Xeo2k3TncJLHNUvnLrvX82kVD+LCJttMzR2yYRBzR2m0RGrovJprLfeS7 HVqLRjPi5xLKiwzueQwm6Ua+HGdC1Bq6yDYdWWXyxWacadqwSgHsh6OpviSfIVC83vd2 4XV9vRxMIBsn+0AQAIAtabTk3stl1J97COyYFAPondbHLf8SMCpzdN2Er4Btt32fUIWJ ohqfIeLLv8/LyVWHbUJ3FOLJ3DT5vucDM8j9cn/9uInIJXN53PeL8x4Tx+NhiGafORDq CeMw== 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:from:references:cc:to:subject; bh=6Vm2CeXe0R5HgY4UOmxGdeBenlOEYoHr2hPODIOW60g=; b=dC1Q/Qp7tJGGxZOQznUelmgPToYWiI8ILDH45T2XqnNgRRsjN1V0yIvwnTQMchLEZ5 xv+uOa+dILzvNNmc2IXt588yuAYXVc5ip4C2hOHepjM5YqbFdSg4z66JW45yGETSejzE P4FtxyshXgjGZCU8i278P1ueV8kDnfiLR4LKziN0JxnOKVlelnngdlzXgsmt1UWs3lKl ZV5/JE57+9HQ1tZw6BuYLvd0iwHnKMwraHapayKBmAfzcWLnubVnxnHoGHqfkfGynu4Y B0QBrECgqWmHuwiXLc9ldGAspDS0FBN7KocQl9QbQ7J20l27zPFw6yUpr0D3i1bN6QtX 1vlA== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 8si4945919oix.109.2020.02.24.10.23.58; Mon, 24 Feb 2020 10:24:10 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727744AbgBXSXq (ORCPT + 99 others); Mon, 24 Feb 2020 13:23:46 -0500 Received: from mga14.intel.com ([192.55.52.115]:33650 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727426AbgBXSXp (ORCPT ); Mon, 24 Feb 2020 13:23:45 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Feb 2020 10:23:45 -0800 X-IronPort-AV: E=Sophos;i="5.70,481,1574150400"; d="scan'208";a="384209626" Received: from rchatre-mobl.amr.corp.intel.com (HELO [10.24.14.134]) ([10.24.14.134]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 24 Feb 2020 10:23:44 -0800 Subject: Re: [PATCH v3] x86/resctrl: Preserve CDP enable over cpuhp To: James Morse , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H . Peter Anvin" , Babu Moger References: <20200221162105.154163-1-james.morse@arm.com> From: Reinette Chatre Message-ID: <8d84868f-4045-8d69-ed45-d0f0629ba25c@intel.com> Date: Mon, 24 Feb 2020 10:23:42 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 MIME-Version: 1.0 In-Reply-To: <20200221162105.154163-1-james.morse@arm.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 Hi James, On 2/21/2020 8:21 AM, James Morse wrote: > Resctrl assumes that all CPUs are online when the filesystem is > mounted, and that CPUs remember their CDP-enabled state over CPU > hotplug. > > This goes wrong when resctrl's CDP-enabled state changes while all > the CPUs in a domain are offline. > > When a domain comes online, enable (or disable!) CDP to match resctrl's > current setting. > > Fixes: 5ff193fbde20 ("x86/intel_rdt: Add basic resctrl filesystem support") > Suggested-by: Reinette Chatre > Signed-off-by: James Morse > --- > arch/x86/kernel/cpu/resctrl/core.c | 2 ++ > arch/x86/kernel/cpu/resctrl/internal.h | 1 + > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ > 3 files changed, 16 insertions(+) > > diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c > index 89049b343c7a..d8cc5223b7ce 100644 > --- a/arch/x86/kernel/cpu/resctrl/core.c > +++ b/arch/x86/kernel/cpu/resctrl/core.c > @@ -578,6 +578,8 @@ static void domain_add_cpu(int cpu, struct rdt_resource *r) > d->id = id; > cpumask_set_cpu(cpu, &d->cpu_mask); > > + rdt_domain_reconfigure_cdp(r); > + > if (r->alloc_capable && domain_setup_ctrlval(r, d)) { > kfree(d); > return; > diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h > index 181c992f448c..3dd13f3a8b23 100644 > --- a/arch/x86/kernel/cpu/resctrl/internal.h > +++ b/arch/x86/kernel/cpu/resctrl/internal.h > @@ -601,5 +601,6 @@ bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d); > void __check_limbo(struct rdt_domain *d, bool force_free); > bool cbm_validate_intel(char *buf, u32 *data, struct rdt_resource *r); > bool cbm_validate_amd(char *buf, u32 *data, struct rdt_resource *r); > +void rdt_domain_reconfigure_cdp(struct rdt_resource *r); > > #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ > diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > index 064e9ef44cd6..1c78908ef395 100644 > --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c > +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > @@ -1859,6 +1859,19 @@ static int set_cache_qos_cfg(int level, bool enable) > return 0; > } > > +/* Restore the qos cfg state when a domain comes online */ > +void rdt_domain_reconfigure_cdp(struct rdt_resource *r) > +{ > + if (!r->alloc_capable) > + return; > + > + if (r == &rdt_resources_all[RDT_RESOURCE_L2DATA]) > + l2_qos_cfg_update(&r->alloc_enabled); > + > + if (r == &rdt_resources_all[RDT_RESOURCE_L3DATA]) > + l3_qos_cfg_update(&r->alloc_enabled); > +} > + > /* > * Enable or disable the MBA software controller > * which helps user specify bandwidth in MBps. > As mentioned in my response to v2 the lockdep annotation that formed part of this fix is welcome. It is not clear to me if you will be submitting again with the annotation added back. Since it is not required for this fix I will add my tag here and you could include it if you do decide to resubmit. Thank you Reviewed-by: Reinette Chatre Reinette