From patchwork Wed Jan 17 14:14:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Singh Tomar X-Patchwork-Id: 13521783 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3E8C9C47258 for ; Wed, 17 Jan 2024 14:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Zk6a4bjWsvmltookFOVqibNKdUqidiwMc2DUanPAtUQ=; b=CTHpaM4Bx9cbvm 7FvVEdhDOd4k26OXTB+67t/zQQLq5ffBCSQMFbm7oG5Gkax9j5qB8aoMlF4mHfqqIM0Idm0RAnwe/ fRUDyTek4X0UoVVEprAU8JiQVjSf1JAtGE7tEmhODIsSNzT4+W2lI1AD6Ovmj4bzTwR2Qs5I72CZx D63RF/3xLTgQLzv0dYX3f398EwEJMi5F4NUg0+mR7CdqosMCf5F9RafEtlyyou4hx9O0QyIi4XiQi Xiy87qBl+l5J2Iyoi2fpl0yVeQbaoY9DAp3dKZ5VdTlaCKo898AIoh5jQ0aIfpSxbq65bR3HRl5f+ s3XFFiE16GOPcgym33gA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hQ-00GyKX-0p; Wed, 17 Jan 2024 14:15:24 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hB-00Gy5Y-1s for linux-arm-kernel@bombadil.infradead.org; Wed, 17 Jan 2024 14:15:09 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=zo41x27c4kcVqmTh43FB/0d5x1krHnjvte4oiC06x+E=; b=fHwHx6jignmQDTd8HnjrVrLa2f /NqA6lwCyrver71Gn0KMo2NctqZCXT8w/NPpVnc++UzIt1YIWm2v8TjrHgvXffBPRhatHQ8UNHM7W HwZZMNDag3Yx6ihtnNabHCMspeqcAeeOj/wmKzivbya+/dp8zMU2odLy6Mi5MRBcsTg2GRZGykYIe NrSnePws8UJ+EkPPvjVIbwdVhwVBBcys3K1xK1uPMyPu1u1Er4mUytWC6oyqV+cx0ZNWVZRSqH3P+ rO6xfJpmwT5towhzwcFPvSA/DgAPAE0tbFpdc7ZJ+PSUNDkckivtQ2PJAtbbDbBF1m3IUlByY2TnY QFigiL3A==; Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rQ6h6-00000000UCn-1Peo for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:07 +0000 Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40H7jfHh028536; Wed, 17 Jan 2024 06:14:48 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= pfpt0220; bh=zo41x27c4kcVqmTh43FB/0d5x1krHnjvte4oiC06x+E=; b=LmE OAJxGpsu0A1Vo6q7FUpeLRx7pafIP/fl1ytcFclFCkWwZRv3aEddZdOd6ZUuGhAz siBW9l9Yi1RbbYBtuIwuuYYqJA5IMWOibKh7Anr96/t7hvR8+/rMxOwhZfr19WKY vD5gcb8+7I/+XfPNLM3QnEZnK/A9Z7PTYngnw6v0WrYcGVvD+cxVFYCtTknK4Plb vJEKuFpstWJXD6lXxUHEdqhivwU8QofQgcZbQMrMpDaA9UmWOjvMvi6xSJKS/3GY Tg07T4paMRYTbBrUaXiZ/n4/lkTp6txI61KrRLm96HAXv85PCGtAPFelAVp/TdRX FIv8i0sF5gZLRjA1Gng== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask952s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:48 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 17 Jan 2024 06:14:46 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 06:14:46 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 492455B6932; Wed, 17 Jan 2024 06:14:43 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 09/14] fs/resctrl: set configuration based on Control type Date: Wed, 17 Jan 2024 19:44:00 +0530 Message-ID: <20240117141405.3063506-10-amitsinght@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240117141405.3063506-1-amitsinght@marvell.com> References: <20240117141405.3063506-1-amitsinght@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: ZUM7RWHKmN4PPOpzbZYqgyMr01Hrf6Xw X-Proofpoint-GUID: ZUM7RWHKmN4PPOpzbZYqgyMr01Hrf6Xw X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-17_08,2024-01-17_01,2023-05-22_02 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240117_141504_950936_37BEDA58 X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that, we have support for different control types, divided into the BASIC and PRIORITY controls types. Schemata list is pertained to the SCHEMAT_BASIC control type that is used to set up/configure CAT (Cache Allocation Technology) and MBA (Memory Bandwidth Allocation) capabilities, and SCHEMAT_DSPRI used to configure downstream priority partitioning. Let's add boilerplate changes to set the control configuration based on different control types. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * No change, it's new patch. --- arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 6 ++++-- drivers/platform/mpam/mpam_resctrl.c | 9 ++++++--- fs/resctrl/ctrlmondata.c | 3 ++- fs/resctrl/monitor.c | 3 ++- fs/resctrl/rdtgroup.c | 3 ++- include/linux/resctrl.h | 6 ++++-- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c index b34e86cfc111..4423d8979b5e 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -39,7 +39,8 @@ static bool apply_config(struct rdt_hw_domain *hw_dom, } int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, - u32 closid, enum resctrl_conf_type t, u32 cfg_val) + u32 closid, enum resctrl_conf_type t, u32 cfg_val, + enum resctrl_ctrl_type type) { struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r); struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); @@ -59,7 +60,8 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, return 0; } -int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) +int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid, + enum resctrl_ctrl_type type) { struct resctrl_staged_config *cfg; struct rdt_hw_domain *hw_dom; diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c index 0de09e9deee5..7a797f9bcaed 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -920,7 +920,8 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, } int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, - u32 closid, enum resctrl_conf_type t, u32 cfg_val) + u32 closid, enum resctrl_conf_type t, u32 cfg_val, + enum resctrl_ctrl_type type) { int err; u32 partid; @@ -983,7 +984,8 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, } /* TODO: this is IPI heavy */ -int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) +int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid, + enum resctrl_ctrl_type type) { int err = 0; struct rdt_domain *d; @@ -1000,7 +1002,8 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) continue; err = resctrl_arch_update_one(r, d, closid, t, - cfg->new_ctrl); + cfg->new_ctrl, + type); if (err) return err; } diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index f1f57bbfa094..005a91192847 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -405,7 +405,8 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, continue; if (!strcmp(resname, s->name)) { - ret = resctrl_arch_update_domains(r, rdtgrp->closid); + ret = resctrl_arch_update_domains(r, rdtgrp->closid, + s->ctrl_type); if (ret) goto out; } diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 6c0804273753..5eccb38cb7d7 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -514,7 +514,8 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_domain *dom_mbm) return; } - resctrl_arch_update_one(r_mba, dom_mba, closid, CDP_NONE, new_msr_val); + resctrl_arch_update_one(r_mba, dom_mba, closid, CDP_NONE, new_msr_val, + SCHEMA_BASIC); /* * Delta values are updated dynamically package wise for each diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 92d9bee210eb..d71fac0ae4d4 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3136,7 +3136,8 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) return ret; } - ret = resctrl_arch_update_domains(r, rdtgrp->closid); + ret = resctrl_arch_update_domains(r, rdtgrp->closid, + s->ctrl_type); if (ret < 0) { rdt_last_cmd_puts("Failed to initialize allocations\n"); return ret; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 2c0dc01d070e..f28d4ff737dc 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -334,7 +334,8 @@ int resctrl_rdtgroup_show(struct seq_file *seq, u32 closid, u32 rmid); u32 resctrl_arch_get_num_closid(struct rdt_resource *r); struct rdt_domain *resctrl_arch_find_domain(struct rdt_resource *r, int id); -int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid); +int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid, + enum resctrl_ctrl_type type); /* For use by arch code that needs to remap resctrl's smaller CDP closid */ static inline u32 resctrl_get_config_index(u32 closid, @@ -374,7 +375,8 @@ resctrl_get_domain_from_cpu(int cpu, struct rdt_resource *r) * Must be called on one of the domain's CPUs. */ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, - u32 closid, enum resctrl_conf_type t, u32 cfg_val); + u32 closid, enum resctrl_conf_type t, u32 cfg_val, + enum resctrl_ctrl_type ctrl_type); u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, u32 closid, enum resctrl_conf_type type,