From nobody Tue Apr 7 05:10:21 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 822CEC433FE for ; Mon, 10 Oct 2022 20:32:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbiJJUcY (ORCPT ); Mon, 10 Oct 2022 16:32:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230201AbiJJUb6 (ORCPT ); Mon, 10 Oct 2022 16:31:58 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2058.outbound.protection.outlook.com [40.107.244.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C155B13D01; Mon, 10 Oct 2022 13:30:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b6ZpytFwH8+a//Tisybpmt9pEI7zQMrnzlWS5Yx8vneggNr5Do9s2L8VbQHsYBa9AjNWS8QjUJWX3GzGnmEDLjXY0KhplLO0rqmeyJcuMALcN/Ng0RvZWLZEIM+EFZgJubdPTNA2R35hgrZPzk8JtdKMK2GC4eJnRxtJjwg1gjkwgO0zpiGzXEGaoF0Cq34CuNp2xap4fhsfB8j0UUouA3IG6oM2XPbBGmdrRAUNK887f+0FvDP9R3u/FignfxNA2M4bO5tkxGWnbubGkw/6gTBrPg0hekMD8M+b+FRaBDHLUcbiLUTMV5EFjfM6IEG7oBW7gl51suNijUyxVNt0fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NICPXrq+QsQoxlNMsQMMrBhT49k4nzEuqoTHOywL1uA=; b=FyDMj/oJemDVQcWugbtegjZNUBpH8VAZfisgw2C7fF6RUuNcLpL+0aaC38ulfusiGAGHJOF5j00YjiI159GJCCM8XNfh67312jMot99X1f3ru12v4kJgY5WYydMtnf7ERZ9KtaHPXwktV/5ueduA1qTEs5o6R/2bRuOwWjTxAI/FmTJLTLQnpwk8VejlK2xzioikISYxhTA+Jj14XkEM8az3nL07YLsJ4Wmm+eG+ofZJdkGe+IJ2nHNLevVdJhD6kcBuPz9K5+yz8oVDfsLAzw+QmkowS3/QDjlOQh3EAYK5AVBekLwNK7q/HUf73MrhDLPuZZYz3+R0aM/mlZBZ/Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=opensource.wdc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NICPXrq+QsQoxlNMsQMMrBhT49k4nzEuqoTHOywL1uA=; b=3gsy240TOYpEOZU1wJxR0Zwrko+Y3Tz7OnSpMO8rVo7gaWASpWgELLXoft6o7W0I4O12Ga/FjJbZxrIIgEC8AV3yfBMqz0TVwhKwAwiQwsb46sEvsr/2LU7EePNVC5jvuz+BNkL+BktDN3ghVQRff+nve3F5jj6MjJxGqxOZTrY= Received: from DS7PR05CA0035.namprd05.prod.outlook.com (2603:10b6:8:2f::18) by MW3PR12MB4522.namprd12.prod.outlook.com (2603:10b6:303:5f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.28; Mon, 10 Oct 2022 20:30:35 +0000 Received: from DM6NAM11FT039.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2f:cafe::62) by DS7PR05CA0035.outlook.office365.com (2603:10b6:8:2f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.10 via Frontend Transport; Mon, 10 Oct 2022 20:30:35 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DM6NAM11FT039.mail.protection.outlook.com (10.13.172.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5709.10 via Frontend Transport; Mon, 10 Oct 2022 20:30:35 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Mon, 10 Oct 2022 15:30:33 -0500 Subject: [PATCH v6 11/12] x86/resctrl: Replace smp_call_function_many() with on_each_cpu_mask() From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , Date: Mon, 10 Oct 2022 15:30:33 -0500 Message-ID: <166543383308.23830.18388408549121180741.stgit@bmoger-ubuntu> In-Reply-To: <166543345606.23830.3120625408601531368.stgit@bmoger-ubuntu> References: <166543345606.23830.3120625408601531368.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT039:EE_|MW3PR12MB4522:EE_ X-MS-Office365-Filtering-Correlation-Id: 58904a36-670b-48e2-ed6c-08daaafe497d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MMk99x+Ule0V555h1uciuVpeqeQmCQAMe56L9pUsnNZjG/ESBIkYEy9ofH3+Anwyb7EBSFzvU1Sg1QKNehfxvVujw09kXeaVmgfQxUotTyN6LvS3oMlY4wisAajpMWWZdl/QLQJCFZQriEmThFWF5HpTmIt6csPhyiAB11NWTRVDmCuW8Ylgnkh5mcWyutqvY9mG9fT/OYLUn9t1o6Vn5WD1WKinp4b8PN4rdpCKxE94hJqRpJebN/43I1S7QbYk7Udzhl/p4RnIRUvUdpIi/Yf3jbDu7uphSRAqSmgpKAsMFW3xeR0ROTIATEXwMEwhQXiDJeSwH1fiSKJZlEc/3F9PYsVIzwoddzQCCiSf49KqaIRlyk5+Q/B8Dxv4z34QNGE+n1rfY9GS62pftykmunjHc4fznl8CQ8Y6vtO1Q9Jv5/R943GDhAEFLjQq3QCgctc5GDXiwfrf/3U0xmW1SZwQWEzwRuZV6dQVBIZu4xNjv1s3hiXFelnAAbHubcDNVRqSx7fsXJ/erIOgyvSOvaEXXeNeG2cEQPCWmriHt19cAMY7PGlNQ/5TMtcV+7nQX7hsSS9ENlnndqjSFEWK7Y67aSS2ttT3mYPQ7lr+aRIK1ZzLNyae5dgXCc/M2nd+YUqH4PSgC/f6cNv7R+G6NhzNf3EQFhw4d9ckAYX++hKIVyAeBYofcVorC9RuzRj25eFUVS/EvSHcwhklLx/x2sxuiIJX14XKG4G23ExBvp6jBtHi8kUZQQz7Kb6fkbueZsHbJ3U+92GNekf0eJIECWKJb73E9AgBZnehD7NpoH1HCvINTcOZAxcycQKjzlYHF3UmkilxLB7GzHU7YBSIGw== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(7916004)(346002)(136003)(396003)(39860400002)(376002)(451199015)(36840700001)(46966006)(40470700004)(316002)(36860700001)(478600001)(2906002)(40480700001)(70586007)(70206006)(7416002)(82310400005)(103116003)(5660300002)(86362001)(4326008)(8676002)(8936002)(82740400003)(33716001)(81166007)(41300700001)(40460700003)(16576012)(54906003)(110136005)(44832011)(356005)(426003)(47076005)(186003)(16526019)(83380400001)(336012)(26005)(9686003)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2022 20:30:35.6813 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 58904a36-670b-48e2-ed6c-08daaafe497d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DM6NAM11FT039.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4522 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The call on_each_cpu_mask() can run the function on each CPU specified by cpumask, which may include the local processor. So, replace the call smp_call_function_many() with on_each_cpu_mask() to simplify the code. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index e744db5dc057..4f8a1c9c3e7a 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -325,12 +325,7 @@ static void update_cpu_closid_rmid(void *info) static void update_closid_rmid(const struct cpumask *cpu_mask, struct rdtgroup *r) { - int cpu =3D get_cpu(); - - if (cpumask_test_cpu(cpu, cpu_mask)) - update_cpu_closid_rmid(r); - smp_call_function_many(cpu_mask, update_cpu_closid_rmid, r, 1); - put_cpu(); + on_each_cpu_mask(cpu_mask, update_cpu_closid_rmid, r, 1); } =20 static int cpus_mon_write(struct rdtgroup *rdtgrp, cpumask_var_t newmask, @@ -2131,13 +2126,9 @@ static int set_cache_qos_cfg(int level, bool enable) /* Pick one CPU from each domain instance to update MSR */ cpumask_set_cpu(cpumask_any(&d->cpu_mask), cpu_mask); } - cpu =3D get_cpu(); - /* Update QOS_CFG MSR on this cpu if it's in cpu_mask. */ - if (cpumask_test_cpu(cpu, cpu_mask)) - update(&enable); - /* Update QOS_CFG MSR on all other cpus in cpu_mask. */ - smp_call_function_many(cpu_mask, update, &enable, 1); - put_cpu(); + + /* Update QOS_CFG MSR on all the CPUs in cpu_mask */ + on_each_cpu_mask(cpu_mask, update, &enable, 1); =20 free_cpumask_var(cpu_mask); =20 @@ -2614,7 +2605,7 @@ static int reset_all_ctrls(struct rdt_resource *r) struct msr_param msr_param; cpumask_var_t cpu_mask; struct rdt_domain *d; - int i, cpu; + int i; =20 if (!zalloc_cpumask_var(&cpu_mask, GFP_KERNEL)) return -ENOMEM; @@ -2635,13 +2626,9 @@ static int reset_all_ctrls(struct rdt_resource *r) for (i =3D 0; i < hw_res->num_closid; i++) hw_dom->ctrl_val[i] =3D r->default_ctrl; } - cpu =3D get_cpu(); - /* Update CBM on this cpu if it's in cpu_mask. */ - if (cpumask_test_cpu(cpu, cpu_mask)) - rdt_ctrl_update(&msr_param); - /* Update CBM on all other cpus in cpu_mask. */ - smp_call_function_many(cpu_mask, rdt_ctrl_update, &msr_param, 1); - put_cpu(); + + /* Update CBM on all the CPUs in cpu_mask */ + on_each_cpu_mask(cpu_mask, rdt_ctrl_update, &msr_param, 1); =20 free_cpumask_var(cpu_mask); =20