Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp5002354iog; Wed, 22 Jun 2022 09:56:03 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uTerGC7KHYj7tg41B9stiSrrHaYS3sjMFdGOVUhQ83QGvUxSX9JjmYrvL8GjZ6cQewhFyu X-Received: by 2002:a17:907:7211:b0:722:e200:5410 with SMTP id dr17-20020a170907721100b00722e2005410mr4017006ejc.614.1655916963659; Wed, 22 Jun 2022 09:56:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655916963; cv=none; d=google.com; s=arc-20160816; b=vZLGHxN6R9LUKApvV1PlYX1rdNHbzNMZhQaL9a5uln3Dc/sY2V1hz19jC+kb3FmVpR G5iHjOyuT1dGSLub6LdqY8hy6GVoiKQrpDanW8haVUCXuZKmRjKDRs4JruTZrEU3NfMd YT9kBsPCUiK7IpkUKmbpspNtG/vaPkyeAIvxNtMSKMUIytsgJOznNXasghqaJpE44bO7 MpzQkvSuaFrUBIsAr28A3UGofqFRG4MVc7hojU/kfioYlofd1/Rvmrxs761kPVG65HQM SJ9xca3Zrr7dpY2dgCCiGsF3+5CCdxb/n6x3jiYVhh3EIKAMshn3eectRKUQlCvB8udj ebOw== 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=UTZzoFR/0CyfZ0M+nFQ5gckpKf3dgqehMc33QgXLH/o=; b=J5Iqfi2BNnMfy1+b89gGQfM0u7y9sf1s6HgmdvdPDHBpPsEzl5bAXAiseChYyB8oBs l8q4cLIU4ABq2711hvq8T6aXp0ZMIvOCgs5Sj/tfTk69X0ofWTGNDYrAQtpwqpvZcec2 pjwNb94rRcQeyb63wkY7vTZC8k0daYf+RA7luw6dVtn0GAyuiBX1zZ5lwGUQzWnQxK0J 8ITx/8NfRETtIUH+zJi2gYNFHgG0VoxU56Dvi1F6UusJFJvOfAz4TXduVber7l1ZDwhY y4QSVpVY0BUHiBb2/c9aCQQSi80D/jaTmszloBI5NYYWmIdMROhXkWU3zkh6Ti/wEI4A juXQ== 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 n12-20020a05640205cc00b004351f578030si24532711edx.230.2022.06.22.09.55.37; Wed, 22 Jun 2022 09:56:03 -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 S1376916AbiFVQu2 (ORCPT + 99 others); Wed, 22 Jun 2022 12:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1376762AbiFVQru (ORCPT ); Wed, 22 Jun 2022 12:47:50 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A8D243FD80 for ; Wed, 22 Jun 2022 09:47:15 -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 97B8912FC; Wed, 22 Jun 2022 09:47:15 -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 1B4463F792; Wed, 22 Jun 2022 09:47:13 -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 v5 06/21] x86/resctrl: Remove set_mba_sc()s control array re-initialisation Date: Wed, 22 Jun 2022 16:46:14 +0000 Message-Id: <20220622164629.20795-7-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220622164629.20795-1-james.morse@arm.com> References: <20220622164629.20795-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 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