Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2099503ybv; Fri, 14 Feb 2020 11:26:27 -0800 (PST) X-Google-Smtp-Source: APXvYqwbdqhPBUx4LmkWBFhrMQNb+P0MrOEYp9X1bzUd7Iz2Y+PzSRADZEpElKzlv2GoiCcYh3Ds X-Received: by 2002:a05:6830:1bda:: with SMTP id v26mr3402968ota.314.1581708387495; Fri, 14 Feb 2020 11:26:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581708387; cv=none; d=google.com; s=arc-20160816; b=sYkoZNG8Rhgdn83XU32UTGq0ki1YlzCQ0vAxHDFr6FALBnINnR1XNz0k1OJ7JvZJHa Q6W5I+MqGvICu8OzZu1TQpcnkjxw6oCJrtkVfqRQP/m770x6OClyHMRv1GqPrutkZDpR voY5jG+B8RSyZ4lDNRsIgsKeDGH+XKKq7y/PZ5cLD3FYJPPSxqBEMQJfnrm2m+M3mSJH PqT2fXnLucRUp87gByLzIyq4dXAo4tTgqctWJrNmmG+y/VyNqvuz9/hIa2nX4PNAkwhw v7g7yJRaaAxyVowmvBROnHwmAgDSz6cf1puDMjhi8iEkoSFeHhE2ECfps6SzEnFXzpnm +3vg== 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=rIfNOvAuyT4V8Gn3ElX4T2phCai/Ec7XWkqaNucXAvw=; b=v2AK0hN+yG4aibl1E7su4HLs+fQIm2kYS5pJtlMvxPGnbOyyOv+lyD0XJYUx6bN14J 8qthwcRQYmi0EZUCFfpliss2zIjoHxxixWfxJMx/VI82bqavUioQaTTQyGGSOA0VK0a8 dVBaOAsffrCc7UEse80JO0tAG9OyMEYDVtooCCh+oPzDx2lgT78kfytIp7NS1Q10youE yFFsU1hR44lAUHHVCNVEQXn1wVWvpq8jVT91nzLP+lIkaXL8/3XowB23mB+PTLPgdyj3 R9sADJvIU+2pkH3FODTxiy9d5KzJiMXHJPOscnq6ILtRHbc6Zsz+qIck2LNblQooll11 2s6Q== 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 9si3113313ois.90.2020.02.14.11.26.15; Fri, 14 Feb 2020 11:26:27 -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 S2388461AbgBNTY5 (ORCPT + 99 others); Fri, 14 Feb 2020 14:24:57 -0500 Received: from mga01.intel.com ([192.55.52.88]:21002 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388364AbgBNTYy (ORCPT ); Fri, 14 Feb 2020 14:24:54 -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 fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 14 Feb 2020 11:24:54 -0800 X-IronPort-AV: E=Sophos;i="5.70,441,1574150400"; d="scan'208";a="381537616" Received: from rchatre-mobl.amr.corp.intel.com (HELO [10.251.23.248]) ([10.251.23.248]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Feb 2020 11:24:53 -0800 Subject: Re: [PATCH v2] 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" References: <20200214181600.38779-1-james.morse@arm.com> From: Reinette Chatre Message-ID: <214c845b-d093-bafc-02d0-dfd810283f1a@intel.com> Date: Fri, 14 Feb 2020 11:24:52 -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: <20200214181600.38779-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/14/2020 10:16 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 > > --- > Changes since v1: > * Explicitly test for L2/L3 resources to ignore duplicate calls. > * Poke the LxDATA resources to avoid confusing CDP-off with CDP-unsupported. > * Moved code to rdtgroup.c for fewer exported functions. > > v1: lore.kernel.org/r/20200212185359.163111-1-james.morse@arm.com > --- > arch/x86/kernel/cpu/resctrl/core.c | 2 ++ > arch/x86/kernel/cpu/resctrl/internal.h | 1 + > arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++ > 3 files changed, 21 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..5967320a1951 100644 > --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c > +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c > @@ -1831,6 +1831,9 @@ static int set_cache_qos_cfg(int level, bool enable) > struct rdt_domain *d; > int cpu; > > + /* CDP state is restored during cpuhp, which takes this lock */ > + lockdep_assert_held(&rdtgroup_mutex); > + I think this hunk can be dropped. (1) The code path where this annotation is added is not part of this fix. (2) The comment implies that the taking of the mutex is something new/unique added in the CPU hotplug path but that is not accurate since this mutex is also taken in the only other existing call path of this snippet that is handling the mounting of the filesystem. You do mention that these annotations is helpful for the MPAM work. Could the annotations instead be added as a separate patch forming part of that work? > if (level == RDT_RESOURCE_L3) > update = l3_qos_cfg_update; > else if (level == RDT_RESOURCE_L2) > @@ -1859,6 +1862,21 @@ static int set_cache_qos_cfg(int level, bool enable) > return 0; > } > > +/* Restore the qos cfg state when a package comes online */ s/package/domain/? When, for example, considering L2 then "package" is not the right term to use. > +void rdt_domain_reconfigure_cdp(struct rdt_resource *r) > +{ > + lockdep_assert_held(&rdtgroup_mutex); > + > + 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. > Thank you very much. Reinette