Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp807340pxb; Tue, 12 Apr 2022 14:01:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwlWkeQuRTayP29O24vqkpyAQMUqwRqFIISbTnDJyCW6mlIKTZmcmHurWogDv0doi9rCLw X-Received: by 2002:a05:6870:c147:b0:e1:e6ac:5bd9 with SMTP id g7-20020a056870c14700b000e1e6ac5bd9mr2902842oad.81.1649797271931; Tue, 12 Apr 2022 14:01:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649797271; cv=none; d=google.com; s=arc-20160816; b=u86zHv6ZFl4tlSv+mT/g/f8eXvypdA0dhwVrNh/a3dRrlIoRX8A9JXUGW+RKhHS8Zy zROZxRN/e3kesU/Mvbs+iYOaIEzjGj/CEN4MTvaOrRaT/kx2eC+4NQGa4T3T2XJfhEx1 yDhjcrzveHIusSMDdeTGo2Vpn8j3nD5lc4RdAaWg4CGyQZ4QNRoV/wwlYu3BDlMGfxxM To4Z8xC3TCfnAXnqsMJI2KzQdGUbxZZAVYTKzhx5fTwZ+i7WRFV8RDSpPfEowr4fpg/X li2J8F5hzVIXKFvkSYEc/Sro/3xvBKlEiXafeb8+m/nZj3pnsxZH2PcMuZXqB64LKYDf BPGA== 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=pyFb2hGKFszpGFvZLnh4TcXBY7Fn7r5ZVTpTzPsZtJI=; b=haMvElU15J2GYmgUEAkg6UpKMx2GoCdP4FfDFD2Bbm29I2PyAH6K9H8Ba+EavCRrMf 5wIvSlKMsfSNZvO3UxhKrQn6CTO1jVfEcBJZX8/JngzEFAfgolqqY0310IiIYXXkDJMr MO1J0B3+swSVNsBg+zoe9+PqZWS9+niM9ldOm6q2le8QUFcvTORgqGw7AIgF+0lRijAH nrKTOVpBycq4MwGiS79ciOCUKC+kmSKa6sB8yudhOvK9+L05+DglSa0sitzdI2fC77IN ldlKOBKKD1xbyhdx2fF9QGOhY68adG0Y9FQLXMeiVmOyAsGjVQwl4UI4QdxPoxI+t+6v 6uOg== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z15-20020a056871014f00b000e25cc2e03csi6652374oab.240.2022.04.12.14.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 14:01:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6A72CD64CF; Tue, 12 Apr 2022 13:23:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344389AbiDLNG2 (ORCPT + 99 others); Tue, 12 Apr 2022 09:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356352AbiDLND0 (ORCPT ); Tue, 12 Apr 2022 09:03:26 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 858AC6CA4B for ; Tue, 12 Apr 2022 05:45:11 -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 3FB681570; Tue, 12 Apr 2022 05:45:11 -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 E19033F70D; Tue, 12 Apr 2022 05:45:08 -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 v4 09/21] x86/resctrl: Remove architecture copy of mbps_val Date: Tue, 12 Apr 2022 12:44:07 +0000 Message-Id: <20220412124419.30689-10-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220412124419.30689-1-james.morse@arm.com> References: <20220412124419.30689-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 The resctrl arch code provides a second configuration array mbps_val[] for the MBA software controller. Since resctrl switched over to allocating and freeing its own array when needed, nothing uses the arch code version. Remove it. Reviewed-by: Jamie Iles Tested-by: Xin Hao Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan Tested-by: Cristian Marussi Signed-off-by: James Morse --- Changes since v2: * Made setup_default_ctrlval() static. Changes since v1: * Fixed spelling mistake * Capitalisation --- arch/x86/kernel/cpu/resctrl/core.c | 20 ++++---------------- arch/x86/kernel/cpu/resctrl/internal.h | 3 --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 4 +--- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index f69182973175..f0e2820af475 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -397,7 +397,7 @@ struct rdt_domain *rdt_find_domain(struct rdt_resource *r, int id, return NULL; } -void setup_default_ctrlval(struct rdt_resource *r, u32 *dc, u32 *dm) +static void setup_default_ctrlval(struct rdt_resource *r, u32 *dc) { struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); int i; @@ -406,18 +406,14 @@ void setup_default_ctrlval(struct rdt_resource *r, u32 *dc, u32 *dm) * Initialize the Control MSRs to having no control. * For Cache Allocation: Set all bits in cbm * For Memory Allocation: Set b/w requested to 100% - * and the bandwidth in MBps to U32_MAX */ - for (i = 0; i < hw_res->num_closid; i++, dc++, dm++) { + for (i = 0; i < hw_res->num_closid; i++, dc++) *dc = r->default_ctrl; - *dm = MBA_MAX_MBPS; - } } static void domain_free(struct rdt_hw_domain *hw_dom) { kfree(hw_dom->ctrl_val); - kfree(hw_dom->mbps_val); kfree(hw_dom); } @@ -426,23 +422,15 @@ static int domain_setup_ctrlval(struct rdt_resource *r, struct rdt_domain *d) struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); struct msr_param m; - u32 *dc, *dm; + u32 *dc; dc = kmalloc_array(hw_res->num_closid, sizeof(*hw_dom->ctrl_val), GFP_KERNEL); if (!dc) return -ENOMEM; - dm = kmalloc_array(hw_res->num_closid, sizeof(*hw_dom->mbps_val), - GFP_KERNEL); - if (!dm) { - kfree(dc); - return -ENOMEM; - } - hw_dom->ctrl_val = dc; - hw_dom->mbps_val = dm; - setup_default_ctrlval(r, dc, dm); + setup_default_ctrlval(r, dc); m.low = 0; m.high = hw_res->num_closid; diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index a7e2cbce29d5..373aaba53ecd 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -308,14 +308,12 @@ struct mbm_state { * a resource * @d_resctrl: Properties exposed to the resctrl file system * @ctrl_val: array of cache or mem ctrl values (indexed by CLOSID) - * @mbps_val: When mba_sc is enabled, this holds the bandwidth in MBps * * Members of this structure are accessed via helpers that provide abstraction. */ struct rdt_hw_domain { struct rdt_domain d_resctrl; u32 *ctrl_val; - u32 *mbps_val; }; static inline struct rdt_hw_domain *resctrl_to_arch_dom(struct rdt_domain *r) @@ -529,7 +527,6 @@ void mbm_setup_overflow_handler(struct rdt_domain *dom, void mbm_handle_overflow(struct work_struct *work); void __init intel_rdt_mbm_apply_quirk(void); bool is_mba_sc(struct rdt_resource *r); -void setup_default_ctrlval(struct rdt_resource *r, u32 *dc, u32 *dm); u32 delay_bw_map(unsigned long bw, struct rdt_resource *r); void cqm_setup_limbo_handler(struct rdt_domain *dom, unsigned long delay_ms); void cqm_handle_limbo(struct work_struct *work); diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 07904308245c..441c1b7981c2 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2353,10 +2353,8 @@ 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