Received: by 2002:a05:6504:1d0:b0:1de:de76:8684 with SMTP id e16csp877278ltn; Fri, 2 Sep 2022 09:12:26 -0700 (PDT) X-Google-Smtp-Source: AA6agR5kBqL3A9Qb1JMKygQ9O+nLSZ3984NkMjiz5VdPiG+EbzG0sm1dONMr49ghHffbVR994a29 X-Received: by 2002:a17:902:cf4a:b0:175:4fbb:7766 with SMTP id e10-20020a170902cf4a00b001754fbb7766mr11503589plg.94.1662135146363; Fri, 02 Sep 2022 09:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662135146; cv=none; d=google.com; s=arc-20160816; b=l7jgOVki0kGbzhztzw27CpTBoq4JEyAWY9Ggr8uboZaHazGg/3tgEBHKg5KIrPExyB fvtl51fQDL3JQIjHfdpuI8yOY0qiJlAdkIxxeijzw6QWD8/jwGm1aA4WFaSYr+ciTISY oFw5nqSfJNJUSELOTX9Ia6QPO5O1P+2d0/mDzp7FLMdbyZaMdqbZW4oVum766gbSvATs O5AZ4l16Dc9uvLIBDB4l50x7Pju4C6fAoyCdEAJ2KSF0dp+iIW6C2OVmECXQNbadp/26 /OnAuoe88rNTASF5tBPJXgkQYz+KsKQFGdsIB8u9+4Ywbb/ACNgRgM1IjrbYbLGtSlAB fSKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XlnyUftoc2cOIa0r6xF04B/i5dLlvHskf/tyHiKxbC4=; b=ebGZs03FeA4GFOmwff6r4ncFlbNOtRU72PCISOlqiTuXNYMdnrEi40InniTBgY9Yh0 0UiyKp37gIa6PRk2h5IXH0Ko1+cYVxIGtYhYYCwzdAeVWWFH9WSx6d6cA0E7j9rsAgDq GRVJnAwKzm52AlLRcAHXZZJVXLs5zCfG8MeuIaMnDW2K0QCH3KJYOrB+wArE/6PehT8h 3jh6hK2k7QNcZT0UCQbgbc2PAme8VHfy9eNMvPPlxhtM67MqkUzkw3YknvfIq41S0qsq po6CToc2FUiTfYgxLiXnPP+4uknhvcIXoj4pnMXtoWf4DulgltcdEjrL7SHYnC6JIS0G qbNg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d13-20020a056a00198d00b00536c1bda94fsi2454563pfl.281.2022.09.02.09.12.14; Fri, 02 Sep 2022 09:12:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237587AbiIBPzh (ORCPT + 99 others); Fri, 2 Sep 2022 11:55:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237491AbiIBPya (ORCPT ); Fri, 2 Sep 2022 11:54:30 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BF3C9C61 for ; Fri, 2 Sep 2022 08:49:10 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 594551596; Fri, 2 Sep 2022 08:49:16 -0700 (PDT) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C85773F766; Fri, 2 Sep 2022 08:49:07 -0700 (PDT) From: James Morse To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , James Morse , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, Jamie Iles , Cristian Marussi , Xin Hao , xingxin.hx@openanolis.org, baolin.wang@linux.alibaba.com Subject: [PATCH v6 06/21] x86/resctrl: Remove set_mba_sc()s control array re-initialisation Date: Fri, 2 Sep 2022 15:48:14 +0000 Message-Id: <20220902154829.30399-7-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220902154829.30399-1-james.morse@arm.com> References: <20220902154829.30399-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org set_mba_sc() enables the 'software controller' to regulate the bandwidth based on the byte counters. This can be managed entirely in the parts of resctrl that move to /fs/, without any extra support from the architecture specific code. set_mba_sc() is called by rdt_enable_ctx() during mount and umount. It currently resets the arch code's ctrl_val[] and mbps_val[] arrays. The ctrl_val[] was already reset when the domain was created, and by reset_all_ctrls() when the filesystem was last umounted. Doing the work in set_mba_sc() is not necessary as the values are already at their defaults due to the creation of the domain, or were previously reset during umount(), or are about to reset during umount(). Add a reset of the mbps_val[] in reset_all_ctrls(), allowing the code in set_mba_sc() that reaches in to the architecture specific structures to be removed. Reviewed-by: Jamie Iles Tested-by: Xin Hao Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan Tested-by: Cristian Marussi Reviewed-by: Reinette Chatre Signed-off-by: James Morse --- Changes since v3: * Spelling mistakes in commit message. Changes since v2: * Moved earlier in the series, added the reset in reset_all_ctrls(). * Rephrased commit message. --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 5830905a92d2..b32ceff8325a 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1898,18 +1898,12 @@ void rdt_domain_reconfigure_cdp(struct rdt_resource *r) static int set_mba_sc(bool mba_sc) { struct rdt_resource *r = &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl; - struct rdt_hw_domain *hw_dom; - struct rdt_domain *d; if (!is_mbm_enabled() || !is_mba_linear() || mba_sc == is_mba_sc(r)) return -EINVAL; r->membw.mba_sc = mba_sc; - list_for_each_entry(d, &r->domains, list) { - hw_dom = resctrl_to_arch_dom(d); - setup_default_ctrlval(r, hw_dom->ctrl_val, hw_dom->mbps_val); - } return 0; } @@ -2327,8 +2321,10 @@ static int reset_all_ctrls(struct rdt_resource *r) hw_dom = resctrl_to_arch_dom(d); cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask); - for (i = 0; i < hw_res->num_closid; i++) + for (i = 0; i < hw_res->num_closid; i++) { hw_dom->ctrl_val[i] = r->default_ctrl; + hw_dom->mbps_val[i] = MBA_MAX_MBPS; + } } cpu = get_cpu(); /* Update CBM on this cpu if it's in cpu_mask. */ -- 2.30.2