From patchwork Wed Jan 17 14:13:52 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: 13521776 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 784AFC47258 for ; Wed, 17 Jan 2024 14:15:04 +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=H7Av5l7Fwbc2BfJC2gJ0fQ2IxrQN+4jWDUJzVQX0r9Y=; b=x5hY8AO6ZLZb3V iGcgRO6HVsBE3kQUBUMkESurNt2ZYhKjBXYxVcnDaKxDZxdgsHmL9r+HL95ln0D27hTWTb9z0bUfA l7WEBObTHAVQn9DzIGWKQUTWr3ou/fTmktrvjXZbr01HvP9OTjyTpRxIJbwuXp/Nh75TWnCtePozN JIUqF8fdOBk2UlYLPK43oeK/ELFU0NYoFOygyvEvTuWexFaOafYbQ6/ShTJcgvjTFU6378OE3cr3g e0WYKleMT8ShzrmAworNIkhWkBGRA5Ixo1hnupdiFylT1TfosmTGkOweyNDxX7WUbfkJ+I1puyi5e OW/AsWsogua1Vl1OdhDg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6gf-00Gxge-17; Wed, 17 Jan 2024 14:14:37 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6gZ-00Gxb5-2u for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:14:33 +0000 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40H9DZua012699; Wed, 17 Jan 2024 06:14:18 -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=cax1QRJ5lsxNK1A2gaTh4NQDbx9TYQNto6HU4+Cjyck=; b=MCd ienl9Jp1cJld56wvt7+QqIVdn/KPA6IKuWxiJw9H1VKgHCB+Sx/gsCO3brIPtlyH Vm/EyqRzcVMUk9JjLqebljKUCBrmT2ZOCOD6s8oMLYXmKWefvwbPEVpZIxqAFm/l dXPyX5zT3dxTtXXplcAXxpOmcyKPht8m+z9RHPti7IiwOp0uSZHFD6W+EJITJA86 fuBL/0jFooNSzCYvvXoOTbXGi5f2vp0ywvKgxg5L2F1UM3O4ShJjdeoL7I8RUGtn 6mX3b69feFITBLFz9eYejuAKSuAcntv1ENVeJ7Uv/Y6rNInX2EkHZS9c/Ec8zxTs q3O341t3JBYaRK4wMUA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vp0ge391x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:17 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 17 Jan 2024 06:14:15 -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:15 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 7B9625B693F; Wed, 17 Jan 2024 06:14:12 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 01/14] fs/resctrl: group the resource control types for schemata list Date: Wed, 17 Jan 2024 19:43:52 +0530 Message-ID: <20240117141405.3063506-2-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-GUID: dg164YAmtkz7pJkD482dY42myEbx2shd X-Proofpoint-ORIG-GUID: dg164YAmtkz7pJkD482dY42myEbx2shd 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_061432_054453_8BD7B527 X-CRM114-Status: GOOD ( 16.74 ) 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 At the moment, resource control group support the basic control features (that can be applied to system resources like cache, and Memory) such as CAT (Cache Allocation Technology), and MBA (Memory Bandwidth Allocation). Apart from these basic controls, System can support other controls that does not directly affect the allocation of memory-system resources. Instead, it has an effect on conflicts that arise during access to resources, such as Priority partitioning found on ARM MPAM. In order to support control types of different nature, lets divide them into different groups, already existing control features (CAT, and MBA) is grouped under basic schemata type .i.e. SCHEMATA_BASIC, and to support priority partition (the downstream priority one), it is placed under SCHEMA_DSPRI control type. These control type is associated with list(s) of schemata. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * No change, it's new patch. --- fs/resctrl/rdtgroup.c | 26 ++++++++++++++++---------- include/linux/resctrl.h | 1 + include/linux/resctrl_types.h | 6 ++++++ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 9c5dfaaa7fa2..12e31d4dddf6 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2256,7 +2256,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) return ret; } -static int schemata_list_add(struct rdt_resource *r, enum resctrl_conf_type type) +static int schemata_list_add(struct rdt_resource *r, + enum resctrl_conf_type type, + enum resctrl_ctrl_type ctrl_type) { struct resctrl_schema *s; const char *suffix = ""; @@ -2284,10 +2286,12 @@ static int schemata_list_add(struct rdt_resource *r, enum resctrl_conf_type type break; } - ret = snprintf(s->name, sizeof(s->name), "%s%s", r->name, suffix); - if (ret >= sizeof(s->name)) { - kfree(s); - return -EINVAL; + if (ctrl_type == SCHEMA_BASIC) { + ret = snprintf(s->name, sizeof(s->name), "%s%s", r->name, suffix); + if (ret >= sizeof(s->name)) { + kfree(s); + return -EINVAL; + } } cl = strlen(s->name); @@ -2300,14 +2304,15 @@ static int schemata_list_add(struct rdt_resource *r, enum resctrl_conf_type type if (r->cdp_capable && !resctrl_arch_get_cdp_enabled(r->rid)) cl += 4; - if (cl > max_name_width) + if (cl > max_name_width && ctrl_type == SCHEMA_BASIC) max_name_width = cl; /* * Choose a width for the resource data based on the resource that has * widest cbm/data_width. */ - max_data_width = max(max_data_width, r->data_width); + if (ctrl_type == SCHEMA_BASIC) + max_data_width = max(max_data_width, r->data_width); INIT_LIST_HEAD(&s->list); list_add(&s->list, &resctrl_schema_all); @@ -2328,17 +2333,18 @@ static int schemata_list_create(void) continue; if (resctrl_arch_get_cdp_enabled(r->rid)) { - ret = schemata_list_add(r, CDP_CODE); + ret = schemata_list_add(r, CDP_CODE, SCHEMA_BASIC); if (ret) break; - ret = schemata_list_add(r, CDP_DATA); + ret = schemata_list_add(r, CDP_DATA, SCHEMA_BASIC); } else { - ret = schemata_list_add(r, CDP_NONE); + ret = schemata_list_add(r, CDP_NONE, SCHEMA_BASIC); } if (ret) break; + } return ret; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 3ad308e9e226..125c4b0c2ff7 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -249,6 +249,7 @@ struct resctrl_schema { struct list_head list; char name[8]; enum resctrl_conf_type conf_type; + enum resctrl_ctrl_type ctrl_type; struct rdt_resource *res; u32 num_closid; }; diff --git a/include/linux/resctrl_types.h b/include/linux/resctrl_types.h index 3897de9c4ecb..b9268ec3ba71 100644 --- a/include/linux/resctrl_types.h +++ b/include/linux/resctrl_types.h @@ -57,6 +57,12 @@ enum resctrl_res_level { RDT_NUM_RESOURCES, }; +enum resctrl_ctrl_type { + SCHEMA_BASIC = 0, + SCHEMA_DSPRI, + SCHEMA_NUM_CTRL_TYPE +}; + #define CDP_NUM_TYPES (CDP_DATA + 1) /* From patchwork Wed Jan 17 14:13:53 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: 13521785 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 DFA06C47258 for ; Wed, 17 Jan 2024 14:16:02 +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=7UvFy+p0+IjM2cGWw3N2oxrf7SpLKyv+ug2fUE89wyo=; b=VX6kP7ktUmIDLc j9KdE211WPQtN+LLhhtb8IbztXKk6TBTw20xGqbZGpu4w3ivuBa7Nw2fytgIZ7+x2N2gmvFQix2vk C+5RqHGGTuxMtROIV7ClIFlRQzm+NT7BynvtnTwmBkudXAEvd8yek5GyWT4efYuCtoJhnXIyyE2nA NuwBklHnTUpbvHcnfJVUt6uwR26+eBOYMSnYRnjVjLsJOog+1yTO2Oag6KDNTXlIM0h8W8WINo7QE TUiCcz6SzhAfJjOvE+nWLa2CAVxF9kwx0vGEryTisgZZ8gHf685d+R4vJh0wdf2zcm3mOCSk5Gtro ybpGTxdHhdpH48pstFcw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hW-00GyS6-2h; Wed, 17 Jan 2024 14:15:30 +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 1rQ6hC-00Gy7G-1d for linux-arm-kernel@bombadil.infradead.org; Wed, 17 Jan 2024 14:15:10 +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=rTHrkWdzMVpRooEbJUcNk7UPFjuqmUJZpANqwMplbL0=; b=fgjyIrFRF68sFE2ykm2bN5j2b0 9qI8Rx6HvWlUSGlhq3hqXlhv39VY0EU4LHyZzkJvG+3VrFxH4T1Z9A3bITWw0l2vq/WhcAKRvGKFQ l8Sgi45NE/RRMBLVzmeCwdXq8grTH2lJgtI/zZmBY9XZ9bMmVXFKkWCWrzPlxyrOt9hu1SdWTziJA kKhBZScZC+LLc8TBbYEPszpye/vRkR24FojboHi0vFlzSPzV1sorrpk/4+J95JchYdGuRls5xBa0h U1OZAV56xm1Bq3lqonBemK9IwagreEMKskmx98ruGcAnsgVa3Ikgqs9zkn096bg00ACNOQjJF5QBR PxgNP1VA==; 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-00000000UCq-1TxR for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:09 +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 40H7jROl028480; Wed, 17 Jan 2024 06:14:21 -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=rTHrkWdzMVpRooEbJUcNk7UPFjuqmUJZpANqwMplbL0=; b=Y4q AhAMPXhv3tDDDIogb5f0ehr8BUhpggzdQeB8fjlTleGmzvQDCyresuYYawHZw8yd Rvvl6Lc8yB1Zqh27ss1dGGVoUCPhHetcMgaLdhHjdiw16MojgBtwwR1XUHUqNixT uNl8vep6Ezi0ye/T7/ExFXE9lR+e2E7nR1RolnX/KyCWqrN1Bp6gcYpWLHo/PVS5 1SRxqbWrhDbQiSXzcJpuQHUgTQqWhBNs+GM9wq7b1SuZcaCuo5lX88yin5+E6KHH Hkp/06V3r3y22V1b+Td7uVzM72KPgkzmL2Up00K0OlH8CmWdrBJ+HXaaYAeR+kL0 kbX478OphYkh9Bf0Y5w== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask950r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:21 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) 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:19 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 06:14:19 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 542765B6949; Wed, 17 Jan 2024 06:14:16 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 02/14] arm_mpam: resctrl: Detect priority partitioning capability Date: Wed, 17 Jan 2024 19:43:53 +0530 Message-ID: <20240117141405.3063506-3-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: VcNmQzlMrK097VLHZ7DMYhHno_UZvD3W X-Proofpoint-GUID: VcNmQzlMrK097VLHZ7DMYhHno_UZvD3W 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_974424_3909D605 X-CRM114-Status: GOOD ( 13.98 ) 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 ARM MPAM supports different control that can be applied to different resources in the system, for instance priority partitioning control where priority value is generated from one MSC, propagates over interconnect to other MSC (known as downstream priority), or can be applied within an MSC for internal operations. This change lets the resctrl know the about MSC's priority partitioning capability. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * No change. --- drivers/platform/mpam/mpam_resctrl.c | 14 ++++++++++++++ include/linux/resctrl.h | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c index 1dbfb6f6dd34..09618d9ceb1d 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -435,6 +435,16 @@ static bool cache_has_usable_cpor(struct mpam_class *class) return (class->props.cpbm_wd <= RESCTRL_MAX_CBM); } +static bool cache_has_usable_priority_part(struct mpam_class *class) +{ + struct mpam_props *cprops = &class->props; + + if (!mpam_has_feature(mpam_feat_dspri_part, cprops)) + return false; + + return (class->props.dspri_wd <= RESCTRL_MAX_DSPRI); +} + static bool cache_has_usable_csu(struct mpam_class *class) { struct mpam_props *cprops; @@ -691,6 +701,7 @@ static int mpam_resctrl_resource_init(struct mpam_resctrl_res *res) res->resctrl_res.rid == RDT_RESOURCE_L3) { bool has_csu = cache_has_usable_csu(class); bool has_mbwu = class_has_usable_mbwu(class); + bool has_ppart = cache_has_usable_priority_part(class); /* TODO: Scaling is not yet supported */ r->cache.cbm_len = class->props.cpbm_wd; @@ -718,6 +729,9 @@ static int mpam_resctrl_resource_init(struct mpam_resctrl_res *res) exposed_alloc_capable = true; } + if (has_ppart) + r->priority_cap = true; + /* * MBWU counters may be 'local' or 'total' depending on where * they are in the topology. If The counter is on the L3, its diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 125c4b0c2ff7..d49aed80a05e 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -38,6 +38,8 @@ int proc_resctrl_show(struct seq_file *m, */ #define RESCTRL_MAX_CBM 32 +#define RESCTRL_MAX_DSPRI 63 + /* The format for packing fields into the u64 'id' exposed to user-space */ #define RESCTRL_ID_CLOSID GENMASK_ULL(31, 0) #define RESCTRL_ID_RMID GENMASK_ULL(63, 32) @@ -195,6 +197,7 @@ struct resctrl_membw { * @rid: The index of the resource * @alloc_capable: Is allocation available on this machine * @mon_capable: Is monitor feature available on this machine + * @priority_capable: Is priority partitioning feature available on this machine * @num_rmid: Number of RMIDs available * @cache_level: Which cache level defines scope of this resource * @cache: Cache allocation related data @@ -212,6 +215,7 @@ struct rdt_resource { int rid; bool alloc_capable; bool mon_capable; + bool priority_cap; int num_rmid; int cache_level; struct resctrl_cache cache; From patchwork Wed Jan 17 14:13:54 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: 13521778 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 13F5BC47258 for ; Wed, 17 Jan 2024 14:15:31 +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=zFbWDby2cq4K8YAGmmmEaTN+n/OBmyeIFdnRySkssY4=; b=VUnz4+Gn5ROvz6 tWUifX/mnZFFJ9hLX7VigTjgilZQKffbx1zbxvJ+Qb92fX2I2+F9WSSRUqDNXf99Ug94zJGdVQOOx 8td3yVZ5zZBAtj4OCKDVU9lJ5MLG0mIUDBfaFisMfmTnPlhxMFiewb2LkttrwF8YAGrZSyq7S5APl DvXWen98sZ5eqmT7aTXV+W/aKgqYlW2+ugxzbaYCJ9Hz95q85a5h3erwLlyTGpQAXL3iKASPeTCD8 bawD7vSUrNCcW+OkbHTCD72F8x2Q0Ofg/cwRA/akB0xfLIdVL/yjAmcOmbVd/F3wc4Nuj/okfDELo O3bxYHTabmgqesDVKwfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6gw-00GxrS-2W; Wed, 17 Jan 2024 14:14:54 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6gj-00GxiH-1p for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:14:43 +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 40H7jo62029521; Wed, 17 Jan 2024 06:14:25 -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=xA6RMJGilhe9+aPlfzYBX8vaxgYauQ2LjbGUd8YkV/k=; b=Ebm v5tGYwdekmSthXwAeQr5CFeWk/VM5oC/ANkfVeka6rPiNP2jl/GAUus2xyz/9JS9 1FlB2SOreXBE2KQdmzHZ4h4YkdfJN3a/4y4O03x5BydLNbVk9f9ZTXmknPy6F5Fs 3aPPaoDFmJia4XdPHjuCbaXZbkEijH7oJxrj7GtO6Br9BoJAz+kmy4ZAw6lQl5rs wAOxudHu8/HZ8+XU7BcG7jtbs3dabb5uhbVyM48PXb63F5Bxv2Ai8B0j4M2z8cWS xtTmKacUWVtgBlq8o9PuioPdniRdQZhbCMMpAcUVtTKFtrwgQ2PEOC+ibvmUi4tf YIgeBIQu+51cWntUw0g== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask950w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:25 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) 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:23 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 06:14:23 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 30F7B5B6931; Wed, 17 Jan 2024 06:14:19 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 03/14] arm_mpam: resctrl: extend the schemata list to support priority partition Date: Wed, 17 Jan 2024 19:43:54 +0530 Message-ID: <20240117141405.3063506-4-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: ScJjFKCWYsT3vvpncs3L39Bf0sa10WLO X-Proofpoint-GUID: ScJjFKCWYsT3vvpncs3L39Bf0sa10WLO 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_061441_640872_9CED040C X-CRM114-Status: GOOD ( 18.53 ) 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 At the moment, "schemata" list is consist of two basic control types .i.e. cache portion bitmap (CPBM), and memory bandwidth allocation (MBA), represented as following under schemata file. MB:0=0100 L3:0=ffff Lets' extend the "schemata" list to support priority partition control, This control is listed in following format (last column indicates the priority value) under schemata file. L3DSPRI:0=f Signed-off-by: Amit Singh Tomar --- Changes since RFC: * This patch is reworked, Now in order to configure DSPRI partition control dedicated schemata is used (L3DSPRI). --- drivers/platform/mpam/mpam_resctrl.c | 7 +++++- fs/resctrl/rdtgroup.c | 34 ++++++++++++++++++++++------ include/linux/resctrl.h | 3 +++ include/linux/resctrl_types.h | 3 +++ 4 files changed, 39 insertions(+), 8 deletions(-) diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c index 09618d9ceb1d..6fd2bfeffa0a 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -729,8 +729,13 @@ static int mpam_resctrl_resource_init(struct mpam_resctrl_res *res) exposed_alloc_capable = true; } - if (has_ppart) + if (has_ppart) { r->priority_cap = true; + if (class->props.dspri_wd > 0x10) + class->props.dspri_wd = 0x10; + + r->dspri_data_width = (class->props.dspri_wd + 3) / 4; + } /* * MBWU counters may be 'local' or 'total' depending on where diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 12e31d4dddf6..568bb9bb7913 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2261,7 +2261,7 @@ static int schemata_list_add(struct rdt_resource *r, enum resctrl_ctrl_type ctrl_type) { struct resctrl_schema *s; - const char *suffix = ""; + const char *suffix = "", *ext_suffix = ""; int ret, cl; s = kzalloc(sizeof(*s), GFP_KERNEL); @@ -2286,12 +2286,22 @@ static int schemata_list_add(struct rdt_resource *r, break; } - if (ctrl_type == SCHEMA_BASIC) { + s->ctrl_type = ctrl_type; + switch (ctrl_type) { + case SCHEMA_DSPRI: + ext_suffix = "DSPRI"; + break; + } + + if (ctrl_type == SCHEMA_BASIC) ret = snprintf(s->name, sizeof(s->name), "%s%s", r->name, suffix); - if (ret >= sizeof(s->name)) { - kfree(s); - return -EINVAL; - } + else + ret = snprintf(s->name, sizeof(s->name), "%s%s%s", r->name, + suffix, ext_suffix); + + if (ret >= sizeof(s->name)) { + kfree(s); + return -EINVAL; } cl = strlen(s->name); @@ -2312,7 +2322,9 @@ static int schemata_list_add(struct rdt_resource *r, * widest cbm/data_width. */ if (ctrl_type == SCHEMA_BASIC) - max_data_width = max(max_data_width, r->data_width); + s->max_data_width = max(max_data_width, r->data_width); + else + s->max_data_width = max(max_data_width, r->dspri_data_width); INIT_LIST_HEAD(&s->list); list_add(&s->list, &resctrl_schema_all); @@ -2322,6 +2334,7 @@ static int schemata_list_add(struct rdt_resource *r, static int schemata_list_create(void) { + enum resctrl_ctrl_type ctrl_type; enum resctrl_res_level i; struct rdt_resource *r; int ret = 0; @@ -2345,6 +2358,13 @@ static int schemata_list_create(void) if (ret) break; + for_each_extend_ctrl_type(ctrl_type) { + if (ctrl_type == 1 && r->priority_cap) { + ret = schemata_list_add(r, CDP_NONE, SCHEMA_DSPRI); + if (ret) + break; + } + } } return ret; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index d49aed80a05e..cb17c7704fd7 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -205,6 +205,7 @@ struct resctrl_membw { * @domains: RCU list of all domains for this resource * @name: Name to use in "schemata" file. * @data_width: Character width of data when displaying + * @dspri_data_width Character width of dspri value when displaying * @default_ctrl: Specifies default cache cbm or memory B/W percent. * @format_str: Per resource format string to show domain value * @evt_list: List of monitoring events @@ -223,6 +224,7 @@ struct rdt_resource { struct list_head domains; char *name; int data_width; + int dspri_data_width; u32 default_ctrl; const char *format_str; struct list_head evt_list; @@ -256,6 +258,7 @@ struct resctrl_schema { enum resctrl_ctrl_type ctrl_type; struct rdt_resource *res; u32 num_closid; + int max_data_width; }; /* diff --git a/include/linux/resctrl_types.h b/include/linux/resctrl_types.h index b9268ec3ba71..b1a22053d7cd 100644 --- a/include/linux/resctrl_types.h +++ b/include/linux/resctrl_types.h @@ -57,6 +57,9 @@ enum resctrl_res_level { RDT_NUM_RESOURCES, }; +#define for_each_extend_ctrl_type(t) \ + for (t = SCHEMA_DSPRI; t != SCHEMA_NUM_CTRL_TYPE; t++) + enum resctrl_ctrl_type { SCHEMA_BASIC = 0, SCHEMA_DSPRI, From patchwork Wed Jan 17 14:13:55 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: 13521777 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 5565FC47DA2 for ; Wed, 17 Jan 2024 14:15:20 +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=+/itAulTwRmTlPPFDwgFbKGfF0GgsB9OkfXiPe8VFE8=; b=FbteHnchwoO9rD NuwTS6piYUflJCmxs8OJlgwxEWUcr9MuNyyKrkNNHLIBmEB4wqW6UEs3Bimgv9/EayqFRal8BXlW0 DKyGV6Y7FB6yUoP8uTYB7IxOQfDgb9VwHglL03RNsn29e0Lb7e83k5jT6Yy568AGwgnxl/p4ovA57 3Squ9jsRBM5BmqfJA/DTZ6oNDW3NU+qQ3Kix+O4rhyDWf1tE/oWkEaFxfnd4WgU35FUbFsiBPl8sp z/VT8kuPkhpXimK+rnyXwt3IMdNVRLVGOjPKb0nBT9v8fqZkwInLmXx9qVivTqOovjwqh7uAYU/HP YHxUhfPzA5QRrx6ww9Uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6gv-00Gxq3-18; Wed, 17 Jan 2024 14:14:53 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6gj-00Gxjt-1p for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:14:43 +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 40H7jhMM028705; Wed, 17 Jan 2024 06:14:29 -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=ANvjRHXSTBs+o+k8c9Tv21/16JEVYA9+pOmHZfsxa6g=; b=Epg StO15+lQDCJbHRGqTJ0BRWuLsb/FWECFGFixMNlBqH3G/h6MBMh3DukFdR5W0+x1 thy4nSoYKZk5P6gMHg1oeNO80NfevMyx0EuEqvn2Sh6AJFsX6NLsUXoCj5aSrAQU MnBTLy7FMjWNxDudgSE7qPdK1AEvaxII0a1P55sxDAgZVZBIo2M+hf4SCnC5pj11 t3cOA+Xidz5IIz9C/PeaAck4jnMvDL2+N6lpm1+ySsWWMJMWEcomI9c5fQ5DpLEb nsWqmuKx/yILC8UAyruv+VnP0Nhr/8pNN+OokrPKFLmGHRCFLiMnvpWTDuD7w+Nb 8hIZjhgXBcHFt/jszWQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask951a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:28 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) 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:27 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 06:14:27 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 09B095B6932; Wed, 17 Jan 2024 06:14:23 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 04/14] fs/resctrl: Set-up downstream priority partition resources Date: Wed, 17 Jan 2024 19:43:55 +0530 Message-ID: <20240117141405.3063506-5-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: pjjdJceoYJ1X477T0McyxvG5TmSUHVCJ X-Proofpoint-GUID: pjjdJceoYJ1X477T0McyxvG5TmSUHVCJ 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_061441_636932_9CB18AF9 X-CRM114-Status: GOOD ( 14.28 ) 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 Upon resource control group creation, Cache portion bitmap, and Memory bandwidth allocation gets initialized to the default/maximum values, obtained from resource control code. Let's replicate it for priority partition resource, and setup the default downstream priority value. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * Reworked a bit to support new Schemata L3DSPRI, for instance, removed the "dspri_store" flag. --- drivers/platform/mpam/mpam_resctrl.c | 1 + fs/resctrl/rdtgroup.c | 21 +++++++++++++++++++++ include/linux/resctrl.h | 2 ++ 3 files changed, 24 insertions(+) diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c index 6fd2bfeffa0a..02efec42bbe2 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -735,6 +735,7 @@ static int mpam_resctrl_resource_init(struct mpam_resctrl_res *res) class->props.dspri_wd = 0x10; r->dspri_data_width = (class->props.dspri_wd + 3) / 4; + r->default_dspri_ctrl = BIT_MASK(class->props.dspri_wd) - 1; } /* diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 568bb9bb7913..d57eb2c7afa7 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3071,6 +3071,21 @@ static int rdtgroup_init_cat(struct resctrl_schema *s, u32 closid) return 0; } +/* Initialize with default downstream priority values. */ +static int rdtgroup_init_dspri(struct rdt_resource *r, u32 closid) +{ + struct resctrl_staged_config *cfg; + struct rdt_domain *d; + + list_for_each_entry(d, &r->domains, list) { + cfg = &d->staged_config[CDP_NONE]; + cfg->new_ctrl = r->default_dspri_ctrl; + cfg->have_new_ctrl = true; + } + + return 0; +} + /* Initialize MBA resource with default values. */ static void rdtgroup_init_mba(struct rdt_resource *r, u32 closid) { @@ -3108,6 +3123,12 @@ static int rdtgroup_init_alloc(struct rdtgroup *rdtgrp) return ret; } + if (r->priority_cap && s->ctrl_type == SCHEMA_DSPRI) { + ret = rdtgroup_init_dspri(r, rdtgrp->closid); + if (ret < 0) + return ret; + } + ret = resctrl_arch_update_domains(r, rdtgrp->closid); if (ret < 0) { rdt_last_cmd_puts("Failed to initialize allocations\n"); diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index cb17c7704fd7..93b3e3b21d5d 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -207,6 +207,7 @@ struct resctrl_membw { * @data_width: Character width of data when displaying * @dspri_data_width Character width of dspri value when displaying * @default_ctrl: Specifies default cache cbm or memory B/W percent. + * @default_dspri_ctrl: Specifies default downstream priority value. * @format_str: Per resource format string to show domain value * @evt_list: List of monitoring events * @fflags: flags to choose base and info files @@ -226,6 +227,7 @@ struct rdt_resource { int data_width; int dspri_data_width; u32 default_ctrl; + u32 default_dspri_ctrl; const char *format_str; struct list_head evt_list; unsigned long fflags; From patchwork Wed Jan 17 14:13:56 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: 13521780 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 87006C47DA2 for ; Wed, 17 Jan 2024 14:15:42 +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=9ZrdhLLWEo2PXKYtFWYxZSjDuMfu+lR5reMaHRh8oLY=; b=tQiJxGEWE31Bgx pihcU5WyJXnyIipqrsVKCWxeUrW7aNrO+tEawacj6fQqgqEWB0tCrwaG7nHMSser43HE8zlGlm83F Ru9EfE1SXoaIpA40b0nni2Dpz5750bMQhnj2qkIO+mVqAwtZ+0Fv0DY5RPM226iZFAGh+aH97uBHB YRKPzAeB0G0ZJSvKQYG4zxQfP2r6yK6OpK6qzWTnpxzX9B4beAEmm4/tIHKJ4LYGM4njscVZHL2Jo RNvu2ycnN/Kni8ZZm5aF8pvi9YGmTQ/yZacU5gCLD87S90Yz5nSYXJDnAcLU+WV+wDUUuLX44AIHb 6qYwwjtmuanrBMBI3ejw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6h8-00Gy3e-1q; Wed, 17 Jan 2024 14:15:06 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6gu-00Gxmv-18 for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:14:57 +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 40H7jROm028480; Wed, 17 Jan 2024 06:14:32 -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=n7v/dHuitqVY/OrcrDypXnmmjVNc5dx4KrCK3+Y0P6k=; b=feE uBCZAe3zIlJLmpbclGDkkjXd/hqgoGufJ4bnnANMRw2ub6Kl+8aZNMSLcqAst6Tm pF2tq4onVhdNHiZ4/JizFDaThxU9D/QjgqsgymS5bPJfD6iHgzZ5p/7I23unlIoK F4lhuX+Un4Mo7oWF9kIRFZwqGSkwopm7B0ddZuVRYGXU2nGl16NMmpZpIZrgeQSg zBPxog54KtBAPTBYqwHXLO49+i01+jSoo+uJCMMnTC7xVQQHNkgAUi2PjA+9Gx9L G3oSOY5ffGNmxSt+UwfR+AsYS/hv1/SLvXG/vNaWKMjF0/hp2J2kt61mJZFMsSdx hQqGF9ohWBMlKtpWaRw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask951j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:32 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) 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:31 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 06:14:31 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id D6EC75B6931; Wed, 17 Jan 2024 06:14:27 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 05/14] fs/resctrl: fetch configuration based on control type Date: Wed, 17 Jan 2024 19:43:56 +0530 Message-ID: <20240117141405.3063506-6-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: 3S_HAtC8gmVQXzdJNFcbPofkXiDQLEf5 X-Proofpoint-GUID: 3S_HAtC8gmVQXzdJNFcbPofkXiDQLEf5 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_061452_495411_41932AE9 X-CRM114-Status: GOOD ( 15.42 ) 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 fetch 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 | 3 ++- drivers/platform/mpam/mpam_resctrl.c | 3 ++- fs/resctrl/ctrlmondata.c | 6 ++++-- fs/resctrl/monitor.c | 3 ++- fs/resctrl/rdtgroup.c | 19 +++++++++++++------ include/linux/resctrl.h | 3 ++- 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c index 0d10107eab62..b34e86cfc111 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -116,7 +116,8 @@ int resctrl_arch_update_domains(struct rdt_resource *r, u32 closid) } u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, - u32 closid, enum resctrl_conf_type type) + u32 closid, enum resctrl_conf_type type, + enum resctrl_conf_type ctrl_type) { struct rdt_hw_domain *hw_dom = resctrl_to_arch_dom(d); u32 idx = resctrl_get_config_index(closid, type); diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c index 02efec42bbe2..4c44d65e6047 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -848,7 +848,8 @@ void mpam_resctrl_exit(void) } u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, - u32 closid, enum resctrl_conf_type type) + u32 closid, enum resctrl_conf_type type, + enum resctrl_ctrl_type ctrl_type) { u32 partid; struct mpam_config *cfg; diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index 27d8bc25a4cb..451cbb7357fb 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -373,6 +373,7 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, static void show_doms(struct seq_file *s, struct resctrl_schema *schema, int closid) { + enum resctrl_ctrl_type ctrl_type = schema->ctrl_type; struct rdt_resource *r = schema->res; struct rdt_domain *dom; bool sep = false; @@ -390,9 +391,10 @@ static void show_doms(struct seq_file *s, struct resctrl_schema *schema, int clo ctrl_val = dom->mbps_val[closid]; else ctrl_val = resctrl_arch_get_config(r, dom, closid, - schema->conf_type); + schema->conf_type, + ctrl_type); - seq_printf(s, r->format_str, dom->id, max_data_width, + seq_printf(s, r->format_str, dom->id, schema->max_data_width, ctrl_val); sep = true; } diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 885b0ca177b0..6c0804273753 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -478,7 +478,8 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct rdt_domain *dom_mbm) delta_bw = pmbm_data->delta_bw; /* MBA resource doesn't support CDP */ - cur_msr_val = resctrl_arch_get_config(r_mba, dom_mba, closid, CDP_NONE); + cur_msr_val = resctrl_arch_get_config(r_mba, dom_mba, closid, CDP_NONE, + SCHEMA_BASIC); /* * For Ctrl groups read data from child monitor groups. diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index d57eb2c7afa7..92d9bee210eb 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -1064,7 +1064,8 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of, if (!closid_allocated(i)) continue; ctrl_val = resctrl_arch_get_config(r, dom, i, - s->conf_type); + s->conf_type, + s->ctrl_type); mode = rdtgroup_mode_by_closid(i); switch (mode) { case RDT_MODE_SHAREABLE: @@ -1281,7 +1282,7 @@ static bool __rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d /* Check for overlap with other resource groups */ for (i = 0; i < closids_supported(); i++) { - ctrl_b = resctrl_arch_get_config(r, d, i, type); + ctrl_b = resctrl_arch_get_config(r, d, i, type, SCHEMA_BASIC); mode = rdtgroup_mode_by_closid(i); if (closid_allocated(i) && i != closid && mode != RDT_MODE_PSEUDO_LOCKSETUP) { @@ -1365,7 +1366,8 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp) has_cache = true; list_for_each_entry(d, &r->domains, list) { ctrl = resctrl_arch_get_config(r, d, closid, - s->conf_type); + s->conf_type, + s->ctrl_type); if (rdtgroup_cbm_overlaps(s, d, ctrl, closid, false)) { rdt_last_cmd_puts("Schemata overlaps\n"); return false; @@ -1499,6 +1501,7 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, struct seq_file *s, void *v) { struct resctrl_schema *schema; + enum resctrl_ctrl_type ctrl_type; enum resctrl_conf_type type; struct rdtgroup *rdtgrp; struct rdt_resource *r; @@ -1536,6 +1539,7 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, list_for_each_entry(schema, &resctrl_schema_all, list) { r = schema->res; type = schema->conf_type; + ctrl_type = schema->ctrl_type; sep = false; seq_printf(s, "%*s:", max_name_width, schema->name); list_for_each_entry(d, &r->domains, list) { @@ -1549,7 +1553,8 @@ static int rdtgroup_size_show(struct kernfs_open_file *of, else ctrl = resctrl_arch_get_config(r, d, closid, - type); + type, + ctrl_type); if (r->rid == RDT_RESOURCE_MBA) size = ctrl; else @@ -3013,11 +3018,13 @@ static int __init_one_rdt_domain(struct rdt_domain *d, struct resctrl_schema *s, */ if (resctrl_arch_get_cdp_enabled(r->rid)) peer_ctl = resctrl_arch_get_config(r, d, i, - peer_type); + peer_type, + s->ctrl_type); else peer_ctl = 0; ctrl_val = resctrl_arch_get_config(r, d, i, - s->conf_type); + s->conf_type, + s->ctrl_type); used_b |= ctrl_val | peer_ctl; if (mode == RDT_MODE_SHAREABLE) cfg->new_ctrl |= ctrl_val | peer_ctl; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 93b3e3b21d5d..2c0dc01d070e 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -377,7 +377,8 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, u32 closid, enum resctrl_conf_type t, u32 cfg_val); u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, - u32 closid, enum resctrl_conf_type type); + u32 closid, enum resctrl_conf_type type, + enum resctrl_ctrl_type ctrl_type); int resctrl_online_domain(struct rdt_resource *r, struct rdt_domain *d); void resctrl_offline_domain(struct rdt_resource *r, struct rdt_domain *d); int resctrl_online_cpu(unsigned int cpu); From patchwork Wed Jan 17 14:13:57 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: 13521779 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 E3CD2C47DA2 for ; Wed, 17 Jan 2024 14:15:33 +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=Eu7NjCmmDlHe/HGjhBbcewUiazEIz5vC9ey6zqd8GMs=; b=AEBLk9P1QMc4RS odsIC1ZRaBtWZE6L3vGfsQ/psns5p5QzyDrh6hAPFLRo2EMtETGNVx5b9YDfegfssGawLbHlh9nTO VMJ4yJf72cYl0MlcOuIn9DaeNPgTefNmQNovZ32UkNgqykAFQ42v8hzkuFFwVKSS95SIdDikej5W6 A0Ivux+7d7iEM02SmI7Xrpi0lltdeP5Dh3NZqKZuXZt7mlETch7aVdkGedgfA5lHALC6PcJST3C1C WWWsdds6bqalLZ4E7Dfq2KhDRQQxVFARW8mW61xc6xF06wG8oXFj4a3a9VQPDoytP9QktZIjw8uIA IwyxNgflQqDsu1SInOZA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6h6-00Gy1v-33; Wed, 17 Jan 2024 14:15:05 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6gu-00Gxmy-18 for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:14:56 +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 40H7jhMO028705; Wed, 17 Jan 2024 06:14:36 -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=1GHNM7+8NlxPbSSdFb5vYISuQDRZWQGahxCDaGr7f4Y=; b=eot 7qCgeBIML4qezMB3bQ7MNs3dEL7TCEDzVb/nfkrQwGw9JGYrT9FgWJBkFRahG5J4 dpOIRbWIv/cFReS4nhTURSIG5Ax1/tJFqTC1mgkbhh+Odkl7NnnPuDA1SxR2JrPX v2UgxMtBQjQu/xo0zYSV37ueaS0N3GDUZ4QZs8pcc4dVQrM/KMbthp3UVYAFr9MB Me8d44s+VxP4Q+ZQvOy5cgJ+YHBPKaF0AKjA5K1819PVSBlqhhivHT5Sf11M/AyD KFZus3gENc52epW65Huiu2vxH9rdc67Yu4i06dwRTdES9j2IXYvAiaYwC4xCATno 0n7m+Y9Rryy7LjDgb9A== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask951u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:36 -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:35 -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:35 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id B26705B6932; Wed, 17 Jan 2024 06:14:31 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 06/14] arm_mpam: resctrl: Retrieve priority values from arch code Date: Wed, 17 Jan 2024 19:43:57 +0530 Message-ID: <20240117141405.3063506-7-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: R37DkmxraFyJkxBGo5nvB__FmHpVufj_ X-Proofpoint-GUID: R37DkmxraFyJkxBGo5nvB__FmHpVufj_ 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_061452_452608_8B79F6BD X-CRM114-Status: GOOD ( 13.60 ) 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 Downstream priority values can be read from the "schemata" file, which is fetched from mpam_config structure. This change does the necessary modifications in arch specific code to facilitate reading priority values. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * Reworked, To configure DSPRI partition control use control type instead of dspri_show/store flags. --- drivers/platform/mpam/mpam_internal.h | 1 + drivers/platform/mpam/mpam_resctrl.c | 23 ++++++++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/platform/mpam/mpam_internal.h b/drivers/platform/mpam/mpam_internal.h index 30e32389d394..45552ae6548b 100644 --- a/drivers/platform/mpam/mpam_internal.h +++ b/drivers/platform/mpam/mpam_internal.h @@ -160,6 +160,7 @@ struct mpam_config { u32 cpbm; u32 mbw_pbm; u16 mbw_max; + u16 dspri; }; struct mpam_component diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c index 4c44d65e6047..0de09e9deee5 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -860,8 +860,12 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, lockdep_assert_cpus_held(); - if (!mpam_is_enabled()) - return r->default_ctrl; + if (!mpam_is_enabled()) { + if (ctrl_type == SCHEMA_DSPRI) + return r->default_dspri_ctrl; + else + return r->default_ctrl; + } res = container_of(r, struct mpam_resctrl_res, resctrl_res); dom = container_of(d, struct mpam_resctrl_dom, resctrl_dom); @@ -873,7 +877,10 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, switch (r->rid) { case RDT_RESOURCE_L2: case RDT_RESOURCE_L3: - configured_by = mpam_feat_cpor_part; + if (ctrl_type == SCHEMA_DSPRI) + configured_by = mpam_feat_dspri_part; + else + configured_by = mpam_feat_cpor_part; break; case RDT_RESOURCE_MBA: if (mba_class_use_mbw_part(cprops)) { @@ -889,13 +896,19 @@ u32 resctrl_arch_get_config(struct rdt_resource *r, struct rdt_domain *d, } if (!r->alloc_capable || partid >= resctrl_arch_get_num_closid(r) || - !mpam_has_feature(configured_by, cfg)) - return r->default_ctrl; + !mpam_has_feature(configured_by, cfg)) { + if (ctrl_type == SCHEMA_DSPRI) + return r->default_dspri_ctrl; + else + return r->default_ctrl; + } switch (configured_by) { case mpam_feat_cpor_part: /* TODO: Scaling is not yet supported */ return cfg->cpbm; + case mpam_feat_dspri_part: + return cfg->dspri; case mpam_feat_mbw_part: /* TODO: Scaling is not yet supported */ return mbw_pbm_to_percent(cfg->mbw_pbm, cprops); From patchwork Wed Jan 17 14:13:58 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: 13521781 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 C2E08C47DA2 for ; Wed, 17 Jan 2024 14:15:49 +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=AbkTzFVzNwFmEYvEHy6L+puqfmTHUZwDXjdiGLKLt+0=; b=Sp8MOcKsDiK29P 2z44dudZG24nxuhYNCn/HY55PuQPUPMaiTda5kQ3TSCE2MVFCldss2pNR40ebaiiVc0kfPvuAv0Ho 9nAEbXW2oAqk79mT7/+v59f1LeLZDW96B+wUevg3uIyTHYU78OCcdoQECBXq4Bw3TmhQgqMuZ0KOW a4xiBWXPKGlqILGZmmveCKd5/A5ucpnL7sT/tKmRtjaRo4ZMJBwsEZ3WvmETzq0cfpwN4/ntqhc8I H/gO6sVgyChS2lu6rwRCjdcdUGj1Evh3h9H2XLCi1CO4mnevuKTXqaJgjxagzyymtxAUBfJjc9j9i +WiJsdh9WIvCNGwXLnNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hK-00GyF3-21; Wed, 17 Jan 2024 14:15:19 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6h1-00GxvU-0Y for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:04 +0000 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40H8rSAI012703; Wed, 17 Jan 2024 06:14:41 -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=m8HLnfWt5Utpa3bLN6g2+5kjNr5BHp8QTjpnSgMN27w=; b=Hqc dGwWNDmhvajA4RbAz8cKg/qpEQe8XOzV9ZJMP8s/8wN+5wjbr7ZVXBDglm0vSk6A GUkRINNiKGrPpNyHZYB5uHaMDS+uVySNArKJMmREhFsRRcp6aofHN99iOhp2jxbd Cm6nyR5AARY8vKJI6+cV7rVkBo0DHFJ9qhMQRoHiQ9nsJmEfM3VyEoa9845xaD/K +h4ErTulsEKleacw5WW2R7TLbhi9z5BYPjf+Eo0D2piUxV5ILdMRYhOhiCOEhOKP wbe6aO8NsnQT3B5KP1u5wMYKRwKUW6FsjES/XJNjj02yHS9YKurjTMtYQ6chkW4K Bo6/zMCl4A7H3VzPQrw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vp0ge3937-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:40 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 17 Jan 2024 06:14:38 -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:38 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 8B60E5B6933; Wed, 17 Jan 2024 06:14:35 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 07/14] fs/resctrl: Schemata write only for intended resource Date: Wed, 17 Jan 2024 19:43:58 +0530 Message-ID: <20240117141405.3063506-8-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-GUID: 8fM2urcjehga6paIeoziVV4rQ93g8m6D X-Proofpoint-ORIG-GUID: 8fM2urcjehga6paIeoziVV4rQ93g8m6D 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_061459_419956_5E73142D X-CRM114-Status: GOOD ( 11.17 ) 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 At present, schemata write (for Cache Portion Bit Map or Memory Bandwidth Allocation) goes through list of all the resources (supported by schemata), and regardless of write for one resource, it attempts to write for all other resources. As an example, When the intended write is for only MBA resource, it attempts (by calling resctrl_arch_update_domains) to write for CPBM as well. Fix it, by doing schemata write based on input schemata supplied from user. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * No change, it's new patch. --- fs/resctrl/ctrlmondata.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index 451cbb7357fb..78f9fb1c52fa 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -351,9 +351,11 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file *of, if (is_mba_sc(r)) continue; - ret = resctrl_arch_update_domains(r, rdtgrp->closid); - if (ret) - goto out; + if (!strcmp(resname, s->name)) { + ret = resctrl_arch_update_domains(r, rdtgrp->closid); + if (ret) + goto out; + } } if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { From patchwork Wed Jan 17 14:13:59 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: 13521784 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 8A199C47DA2 for ; Wed, 17 Jan 2024 14:16:01 +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=H+LKthzMwvgG5BzsFaBubmahjEK1c2Ca7Ti5ZMw3al4=; b=QeNZ6eIVbU9/W0 ywqqgryoL++ccxcwcSFgKNnE7nKEFIKxOWC5yYffoBqx7ftEYFyAhtT/3nT+RFMdurzcaTEZcjG60 qh3CM4YP6V98LcWV3hQP2sZzL2K2TfatxUubWHaTdfZsRZvDJ6YhuqnjT6IoxB814KEyQT70MhH7m 3u8+XrrAXUAHHLtH7iGBanWgSBNtzHGMCA4hMp+JYvZP6S4xceY5WrWH7mKNV+22ACmYZJqHX9Dni fGeWu8DwCSNN2GJXlGbvYsoI2bwBdNxzolDa5GcozQl/mQVedcs/VwDVUChSRulYRzvGD+XF6pRP0 7wJyKB3pf/U3DFRPK38w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hS-00GyO3-2k; Wed, 17 Jan 2024 14:15:26 +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-00Gy5X-1r 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=ClHK3/wLgAYScaXmKMdx+tz4GzxuqNqE2DlmfLex1Jw=; b=c8+xfGRcbnIQhteoWeQapabtDk mvUwDkdy4k19xZXNqHXooWjVFSyojQjaF2zFnXDH1JNzGOCYk8S1NA+TFM7/Yv9/mo/BMKOiAhsvF xwynI2KVbUt6KJNOZQjyRS6IJhsUXpclKI7jLtutCVSU4LbfSYXBQCjfwAszg9h6OqcvJE2iXOL83 gBdRM4m6DOBRoOoFTT7150NWsvpBB0lVvGisoLYCVcqyAgueU9sH6W9L+52Cl909mRHUliXAAhK+H fdPJCvImwDAACzAi9fCAD6kKUuvDyWwXt17QOBcijET41ZTu5uT4GwlA7wqVO56Pw1gSEqsKWz91z l3Y4aeqQ==; 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-00000000UCo-1LKx 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 40H7jROo028480; Wed, 17 Jan 2024 06:14:44 -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=ClHK3/wLgAYScaXmKMdx+tz4GzxuqNqE2DlmfLex1Jw=; b=hrw D04qp8VwXtDOdngWTYpLQTHAQsAV1lE+nexzfgW0tiHgnzQ9L66kDvYL1KUnbtVR c8+ifAs+OcpvK9rASdZBXXGwmGVUZjZ/i4owr/K2cdsii7lze1v4ctIfja92RLCO yhX/nTLbCmNloAoUCi6hwsQ3geKf/hiF89fAWFlItImiZUGMD73tDggpTdQqG2Fl Zz6R+1SDch+SrU54Llg3TMkdRT0RpWe0IAKaT4MVoWKBrYvQv8F9++6OS85apas2 jhzsR5uItU6N+3QpOo8RFMf4YboKCh4n60SHprynP4npssnOoQimsYRhXU7uuPq4 uEb4eBgLC1wDCiOnwXA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask9528-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:44 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) 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:42 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 06:14:42 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 6DC035B6931; Wed, 17 Jan 2024 06:14:39 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 08/14] fs/resctrl: Extend schemata write for priority partition control Date: Wed, 17 Jan 2024 19:43:59 +0530 Message-ID: <20240117141405.3063506-9-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: 6BxRsaXflju6f4cNxs1tIwQfGAIJiaHO X-Proofpoint-GUID: 6BxRsaXflju6f4cNxs1tIwQfGAIJiaHO 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_949879_2F3AB7AC X-CRM114-Status: GOOD ( 16.32 ) 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 Currently, Users can pass the configurations for CPBM, and MBA through schemata file. For instance, CPBM can be passed using: echo L3:0=ffff > schemata This change allows, users to pass a new configuration for downstream priority. For instance, dspri value of "0xa" can be passed as: echo L3DSPRI:0=a > schemata Signed-off-by: Amit Singh Tomar --- Changes since RFC: * As suggested by Fenghua Yu, Parse for DSPRI is called from parse_line(). * Decluttering code from rdtgroup_schemata_write(). --- fs/resctrl/ctrlmondata.c | 59 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/fs/resctrl/ctrlmondata.c b/fs/resctrl/ctrlmondata.c index 78f9fb1c52fa..f1f57bbfa094 100644 --- a/fs/resctrl/ctrlmondata.c +++ b/fs/resctrl/ctrlmondata.c @@ -30,6 +30,55 @@ typedef int (ctrlval_parser_t)(struct rdt_parse_data *data, struct resctrl_schema *s, struct rdt_domain *d); +static bool dspri_validate(char *buf, unsigned long *data, struct rdt_resource *r) +{ + + unsigned long dspri_val; + bool success = true; + int ret; + + ret = kstrtoul(buf, 16, &dspri_val); + if (ret) { + pr_info("Non-hex character in the mask %s\n", buf); + success = false; + goto out; + } + + if (dspri_val > r->default_dspri_ctrl) { + pr_info("dspri value %ld out of range [%d-%d]\n", dspri_val, + 0, r->default_dspri_ctrl); + success = false; + goto out; + } + + *data = dspri_val; + +out: + return success; +} + +static int parse_dspri(struct rdt_parse_data *data, struct resctrl_schema *s, + struct rdt_domain *d) +{ + struct resctrl_staged_config *cfg; + struct rdt_resource *r = s->res; + unsigned long pri_val; + + cfg = &d->staged_config[s->conf_type]; + if (cfg->have_new_ctrl) { + pr_info("Duplicate domain %d\n", d->id); + return -EINVAL; + } + + if (!dspri_validate(data->buf, &pri_val, r)) + return -EINVAL; + + cfg->new_ctrl = pri_val; + cfg->have_new_ctrl = true; + + return 0; +} + /* * Check whether MBA bandwidth percentage value is correct. The value is * checked against the minimum and max bandwidth values specified by the @@ -201,10 +250,14 @@ static int parse_cbm(struct rdt_parse_data *data, struct resctrl_schema *s, return 0; } -static ctrlval_parser_t *get_parser(struct rdt_resource *res) +static ctrlval_parser_t *get_parser(struct resctrl_schema *s) { - if (res->fflags & RFTYPE_RES_CACHE) + struct rdt_resource *res = s->res; + + if (res->fflags & RFTYPE_RES_CACHE && !s->ctrl_type) return &parse_cbm; + else if (s->ctrl_type == SCHEMA_DSPRI) + return &parse_dspri; else return &parse_bw; } @@ -218,7 +271,7 @@ static ctrlval_parser_t *get_parser(struct rdt_resource *res) static int parse_line(char *line, struct resctrl_schema *s, struct rdtgroup *rdtgrp) { - ctrlval_parser_t *parse_ctrlval = get_parser(s->res); + ctrlval_parser_t *parse_ctrlval = get_parser(s); enum resctrl_conf_type t = s->conf_type; struct resctrl_staged_config *cfg; struct rdt_resource *r = s->res; 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, From patchwork Wed Jan 17 14:14:01 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: 13521782 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 E3DFAC47DA2 for ; Wed, 17 Jan 2024 14:15:52 +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=zH2t23QQHqHg0Kr26zULwWPfYEE2iH6c/5TzTxGK8uo=; b=wjPLVGoiGkL7L3 ht6CfL7aF0jR6YU9PYBM5bRyOzWUlnTeKkva3ejQ1wys7gtkpabFvaAixXdlb8LbIb63iazfZc5Mt iB2aJ2ZlvqEClu2Q1c+iZDbV0L0TSABJMbSzKPtfyzb+PTWEvXkr8KkNYBnatMixEoWf+Nk+hY2IM 0u7cdfHPfhDobeWgKkefhOjf6KRzrqXf/DTt8ynkkNL3imwUFbf2sLsMlaNNPbAsLolO0TbR931QZ GE0ZrzkaHj7HJBFP0tD1AZ2X0qL0rN0AetjT2ThHj/7uEVp/Zs/FofjOiM7hxrqUCG58TZVtO5GdP LSlnYp7B63h8nC0FATeg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hM-00GyHc-2v; Wed, 17 Jan 2024 14:15:20 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6h3-00Gxyp-2z for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:06 +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 40H7jo69029521; Wed, 17 Jan 2024 06:14:52 -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=0WIJ5Saq1p5+ZFQkIuWbmHjZZkw8Y3vMm4fuMdgzxlI=; b=fzY LqD2eeckn2TGAN+FrnWZWqW7SnFe6KexzmVa/MZ0cGQZKtT7yF8UIY62FmLQ3kKM GS88UryB4nUx2ZkDBDzZvs8RRX0c6D8Mv83IeebmOFRZzILTr1yVMJ5ImBuvDDlI y/AwwE+mBSDELApc7Z4ZBuF60o1NykgqJiOmO8mXnAZRhlHbk7nuSM3/g0IHyqpx yU5qpaFDba3aL8yNqTEqHBmkXTggThslQ4G8tRX66UlLruN/vt/yQOXYTLPzUAy7 WGtdUELGvDG0HwKXthNBq30CtUQnDhQkeN+mfxtRbsKwv+WflO1A2E8IR1/wmzNL I8n1HebnHTwPSFPxDNQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask952w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:52 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) 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:50 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 06:14:50 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 25DA35B6931; Wed, 17 Jan 2024 06:14:46 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 10/14] arm_mpam: resctrl: Facilitate writing downstream priority value Date: Wed, 17 Jan 2024 19:44:01 +0530 Message-ID: <20240117141405.3063506-11-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: qrSVuiQUoMB2R6Cr5vwbsSEvLyZpLED2 X-Proofpoint-GUID: qrSVuiQUoMB2R6Cr5vwbsSEvLyZpLED2 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_061502_057363_FAFCE35A X-CRM114-Status: GOOD ( 14.88 ) 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 This change provides a way to write downstream priority value (passed from schemata file) to arch specific resource control code. The priority value is stored in mpam_config structure, and eventually gets programmed into MPAMCFG_PRI register. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * Schemata write is based on Control type. --- drivers/platform/mpam/mpam_devices.c | 4 ---- drivers/platform/mpam/mpam_resctrl.c | 26 ++++++++++++++++---------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 589ff1ef2b6b..3ef9e5d70afc 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -2329,10 +2329,6 @@ int mpam_apply_config(struct mpam_component *comp, u16 partid, lockdep_assert_cpus_held(); - if (!memcmp(&comp->cfg[partid], cfg, sizeof(*cfg))) - return 0; - - comp->cfg[partid] = *cfg; arg.comp = comp; arg.partid = partid; diff --git a/drivers/platform/mpam/mpam_resctrl.c b/drivers/platform/mpam/mpam_resctrl.c index 7a797f9bcaed..42602bffba3f 100644 --- a/drivers/platform/mpam/mpam_resctrl.c +++ b/drivers/platform/mpam/mpam_resctrl.c @@ -925,7 +925,7 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, { int err; u32 partid; - struct mpam_config cfg; + struct mpam_config *cfg; struct mpam_props *cprops; struct mpam_resctrl_res *res; struct mpam_resctrl_dom *dom; @@ -940,24 +940,30 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, cprops = &res->class->props; partid = resctrl_get_config_index(closid, t); + cfg = &dom->comp->cfg[partid]; if (!r->alloc_capable || partid >= resctrl_arch_get_num_closid(r)) return -EINVAL; switch (r->rid) { case RDT_RESOURCE_L2: case RDT_RESOURCE_L3: + if (type == SCHEMA_DSPRI) { + cfg->dspri = cfg_val; + mpam_set_feature(mpam_feat_dspri_part, cfg); + } else { /* TODO: Scaling is not yet supported */ - cfg.cpbm = cfg_val; - mpam_set_feature(mpam_feat_cpor_part, &cfg); + cfg->cpbm = cfg_val; + mpam_set_feature(mpam_feat_cpor_part, cfg); + } break; case RDT_RESOURCE_MBA: if (mba_class_use_mbw_part(cprops)) { - cfg.mbw_pbm = percent_to_mbw_pbm(cfg_val, cprops); - mpam_set_feature(mpam_feat_mbw_part, &cfg); + cfg->mbw_pbm = percent_to_mbw_pbm(cfg_val, cprops); + mpam_set_feature(mpam_feat_mbw_part, cfg); break; } else if (mpam_has_feature(mpam_feat_mbw_max, cprops)) { - cfg.mbw_max = percent_to_mbw_max(cfg_val, cprops); - mpam_set_feature(mpam_feat_mbw_max, &cfg); + cfg->mbw_max = percent_to_mbw_max(cfg_val, cprops); + mpam_set_feature(mpam_feat_mbw_max, cfg); break; } fallthrough; @@ -971,15 +977,15 @@ int resctrl_arch_update_one(struct rdt_resource *r, struct rdt_domain *d, */ if (mpam_resctrl_hide_cdp(r->rid)) { partid = resctrl_get_config_index(closid, CDP_CODE); - err = mpam_apply_config(dom->comp, partid, &cfg); + err = mpam_apply_config(dom->comp, partid, cfg); if (err) return err; partid = resctrl_get_config_index(closid, CDP_DATA); - return mpam_apply_config(dom->comp, partid, &cfg); + return mpam_apply_config(dom->comp, partid, cfg); } else { - return mpam_apply_config(dom->comp, partid, &cfg); + return mpam_apply_config(dom->comp, partid, cfg); } } From patchwork Wed Jan 17 14:14:02 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: 13521786 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 CEAF6C47258 for ; Wed, 17 Jan 2024 14:16:09 +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=Qzjz4Ey8H4WPQ3jo3BJngf5Qfypzvnn/7xGMMKNKxhg=; b=F/EcLctNmOzzL8 UMSbHnXqOgKOCf8yddGH2RGPZ6/s0DwVG1NvuwIGoun8g/MQ5atDz3XRCrnn/t+nwbiXhBdBzijIH h94kjqb7jITxtf5NjCqbfceUfOeNqzZLElAC/2/v2m0xC+Y3ILS32w6QT+LUCMtQsRQnKNdzIwSIo SNGnbgCqpeALI8Vy0Hf0wySKtOK258VNBDi3lure+S+Qa5a241mnIj5WkpysOJLYZl1aK6Koe1Kca 7oVKCYBwSSxq/pbzXXM0wynFNDRMdG5AEHa5Qi29rVVhoYTf8S598uV/rjrT7/lTMiDbeRayaD008 3loKk60eppJhBM4fAXyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6ha-00GyVy-0R; Wed, 17 Jan 2024 14:15:34 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hB-00Gy6z-2W for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:11 +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 40H7jROq028480; Wed, 17 Jan 2024 06:14:56 -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=l+S3NRJZhZMZgic+Qg3QaXyHk6lYRiz6QfTJLOdTtvU=; b=O/f svbkW6gIfyjwmzl/FgCh5iDYg3mix3P3+KVpgMAEqve/+AsSgxL6BV4lvUhkCoHf mCGvyeGIDFklERsAt54ZI7TLXsfmgiivYxvmJLRpi9zm6iczAXQYRHxhXd4EBwTk fXFC67TQA1r6rWymkarDh1f9Owr/THgfkfkJtWqkLpLwhDOm12Y+kGsQE88KBkDd U+TwIFtfKlCC6OTlsNNu1AHA0FqFJVi6UA24loSUsGZZ36BpijjYHORHXoEadpiu 1tLPGvJsv3Pa/gYb3067n5D0Px+5+Xi+bnYbD/Pzucmgs5EHDq/Hd52AXjknIQb3 Tk1UEan28F1T0uLDDmA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask9538-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:14:56 -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:54 -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:54 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 00B125B6932; Wed, 17 Jan 2024 06:14:50 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 11/14] arm_mpam: Fix Downstream and internal priority mask Date: Wed, 17 Jan 2024 19:44:02 +0530 Message-ID: <20240117141405.3063506-12-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: f_mntF0stDJ-zIfagyjHlMshtsHXYiSJ X-Proofpoint-GUID: f_mntF0stDJ-zIfagyjHlMshtsHXYiSJ 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_061509_901620_3D63DC7C X-CRM114-Status: GOOD ( 12.07 ) 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 MPAMF_PRI_IDR_NS[DSPRI_WD] determines the number of implemented bits in the downstream priority field (MPAMCFG_PRI_NS). For instance, if the value of DSPRI_WD is 4, then the maximum value for dspri is 0xf, and mask should be GENMASK(3,0). But with current implementation, it turned out to be GENMASK(4,0) .i.e. 0x1f instead of 0xf. u16 dspri = GENMASK(rprops->dspri_wd, 0); Let's fix it (for both downstream, and internal), by subtracting 1 from DSPRI_WD, and INTPRI_WD value. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * Include fix for INTPRI as well. --- drivers/platform/mpam/mpam_devices.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 3ef9e5d70afc..9953f2050d35 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1099,8 +1099,8 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid, struct mpam_msc *msc = ris->msc; u16 bwa_fract = MPAMCFG_MBW_MAX_MAX; struct mpam_props *rprops = &ris->props; - u16 dspri = GENMASK(rprops->dspri_wd, 0); - u16 intpri = GENMASK(rprops->intpri_wd, 0); + u16 dspri = GENMASK((rprops->dspri_wd - 1), 0); + u16 intpri = GENMASK((rprops->intpri_wd - 1), 0); lockdep_assert_held(&msc->lock); From patchwork Wed Jan 17 14:14:03 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: 13521788 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 DC5E3C47DA2 for ; Wed, 17 Jan 2024 14:16:28 +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=PScKghiZdHw/PlnIVRTFsXLenh+FBHvmqHdQSl2FReU=; b=jURaPBnkj7heOK B19wBv+L1hflKEujKlM6Jx6FOXkItnFCgG3Hj7ByK/1+K1dfKKjrOjNU9nIDmWXxoZ5xf7yE0WYV+ +Ej3gq1L5hiFLDUgvZsanx6c4ue4jylRpSQWlS2GILiJzvIpK8fa00v+ZkQxmJSnyAkY8mn9RllGk KpZBiiCoxEpB3/5p24Yas4GbnaWmolp3d5G9OpxFtOklhINQ6wWRwk4ENmj7u/R7mqj2wgThY9BTW i0+UIgzmsRCRfBtu2dHRUsKU/7M0czFZGSMnKCFIg0Umv6omlinTemdsxnLk6wxUGBd7/A/UdOkxM UR1wt1zeXfn6lN6PPHbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hz-00Gyus-1c; Wed, 17 Jan 2024 14:15:59 +0000 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hJ-00GyDi-35 for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:23 +0000 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40H8Ydfc012684; Wed, 17 Jan 2024 06:15:00 -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=AyLoq4qCvNRklZsb/iMNJS5tPScAkgwgIIVRtypuMfA=; b=kdH Sy9Px9R7Tvl0q0/LYGJ+MZyus/ZDTBeBOZy34UQ9y2H9pwUcWnTzOS7W3NwtO/sM y8eVeyPel4oTGTL0sIugJbEAbmjOE73fmhn62MPlfZR7mqnN/LrI9CyaqJMyCgtb +PrqOmXTw0FUTqXeHlmXsFO9sS1VuIQZGohS8AYJXa0Srvi6bke3M8czpke7q/q1 oa+QtSyI6pvH0UsI6lfC/v9rcw2Ggp2PdRlGBoQeFPckXoi8uGsZLS0I9a8FRI8k wiqHsjKFL8kGXDbabTOG0ZjMhmlolBwO4WM4HBgFmvrYh8ds2yponi2/E3uay9UJ u6Z2Sc138bK8bCvMTRA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3vp0ge393y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:15:00 -0800 (PST) Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 17 Jan 2024 06:14:58 -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:58 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id D7A7D5B6931; Wed, 17 Jan 2024 06:14:54 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 12/14] arm_mpam: Program Downstream priority value Date: Wed, 17 Jan 2024 19:44:03 +0530 Message-ID: <20240117141405.3063506-13-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-GUID: zpp2hqTM8jJAkQKnD65_Nno9V8gilWRY X-Proofpoint-ORIG-GUID: zpp2hqTM8jJAkQKnD65_Nno9V8gilWRY 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_061518_196334_E3B8FE68 X-CRM114-Status: GOOD ( 11.22 ) 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 Downstream priorities values can be passed from resource control schemata file, let's program it into memory mapped Priority Partition Configuration Register. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * Priority value is inverted based on DSPRI_0_IS_LOW value. --- drivers/platform/mpam/mpam_devices.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 9953f2050d35..388d57281fd8 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1101,6 +1101,7 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid, struct mpam_props *rprops = &ris->props; u16 dspri = GENMASK((rprops->dspri_wd - 1), 0); u16 intpri = GENMASK((rprops->intpri_wd - 1), 0); + u8 dspri_part_0_low, dspri_rprops, dspri_cfg; lockdep_assert_held(&msc->lock); @@ -1143,18 +1144,33 @@ static void mpam_reprogram_ris_partid(struct mpam_msc_ris *ris, u16 partid, if (mpam_has_feature(mpam_feat_ccap_part, rprops)) mpam_write_partsel_reg(msc, CMAX, cmax); - if (mpam_has_feature(mpam_feat_intpri_part, rprops) || - mpam_has_feature(mpam_feat_dspri_part, rprops)) { + if (mpam_has_feature(mpam_feat_intpri_part, rprops)) { /* aces high? */ if (!mpam_has_feature(mpam_feat_intpri_part_0_low, rprops)) intpri = 0; - if (!mpam_has_feature(mpam_feat_dspri_part_0_low, rprops)) - dspri = 0; if (mpam_has_feature(mpam_feat_intpri_part, rprops)) pri_val |= FIELD_PREP(MPAMCFG_PRI_INTPRI, intpri); - if (mpam_has_feature(mpam_feat_dspri_part, rprops)) - pri_val |= FIELD_PREP(MPAMCFG_PRI_DSPRI, dspri); + + mpam_write_partsel_reg(msc, PRI, pri_val); + } + + dspri_rprops = mpam_has_feature(mpam_feat_dspri_part, + rprops); + dspri_part_0_low = mpam_has_feature(mpam_feat_dspri_part_0_low, + rprops); + if (dspri_rprops) { + dspri_cfg = mpam_has_feature(mpam_feat_dspri_part, + cfg); + if (dspri_cfg) { + pri_val |= (!dspri_part_0_low) + ? FIELD_PREP(MPAMCFG_PRI_DSPRI, cfg->dspri ^ dspri) + : FIELD_PREP(MPAMCFG_PRI_DSPRI, cfg->dspri & dspri); + } else { + pri_val |= (!dspri_part_0_low) + ? FIELD_PREP(MPAMCFG_PRI_DSPRI, 0) + : FIELD_PREP(MPAMCFG_PRI_DSPRI, dspri); + } mpam_write_partsel_reg(msc, PRI, pri_val); } From patchwork Wed Jan 17 14:14:04 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: 13521787 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 0462CC47DA2 for ; Wed, 17 Jan 2024 14:16:24 +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=sVJLy2r9O/gtka7VigfqVcofnUA72JCO6YHB990WYkk=; b=JhXplzNz3DR/qi ajOeZfKzn386QWXDEANafqVuFzHY5N75hOOZIUNTp5IxJyynHZxf7SGZ3oVzNePfub9Xv5wcXUTwC RxfZYGPVvux5jdNmkeHIlhjKggqHL2gYEDzGL3xk6dLDhnzGrUUktexMgZF08shwyJy1TYLbIhXXy XIJPqCNFSrT0JM2ydJAi/2s5zxJwEqMrAj1VBJQ50LjcrelRPV4N9/MTMW670tyR738dUNKSX2YvR 5yKcbJEctp0em7RHolEtCDNOmOvW/mW0biSrA12L5nK8JdhnHb3QSGqcQSOMyEg4xQFeFrtGH1Krp S4I3RsLGZs/28mrHv9QQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hu-00Gypz-24; Wed, 17 Jan 2024 14:15:54 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hI-00GyCL-1W for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:22 +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 40H7jo6D029521; Wed, 17 Jan 2024 06:15:04 -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=e2FEk6dn1f45GCWDdcLSp1yy8Sk+sRaao8A7hXcl/EU=; b=dqo pITq0ZvmdXV5iNtzQ66DUxRchrnsJZFhGD4BmR87AbU3gTZxwCAq7biLjsZaZQCc SybPqJVr87HQcOYnW97z4l+YQevdBP+9ACFTM3GJu5FiqiVv02HoEJvBDvp/jD78 XlZZyXMauL5zW4CfAW4doaRmlvT+SJgrSJaBdHQFgZg0UApPqNu97hdn2A36MFgx qKRvpcMYGjWsEXBE9HPe7hsqcKDrCqAnDtHRc3HwjW6OFT2rJ3AF/ezFV8qlGgnP Qp6rq4Ti6FDX4fZNxHVBZDybn3w+X0MP2UxBALcw8p/4pttn233TBM5TfoBoZzYK c5+5lwPLy7lMfBmUFrw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask953n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:15:04 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 17 Jan 2024 06:15:02 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 06:15:02 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id B0AA05B694B; Wed, 17 Jan 2024 06:14:58 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 13/14] arm_mpam: Handle resource instances mapped to different controls Date: Wed, 17 Jan 2024 19:44:04 +0530 Message-ID: <20240117141405.3063506-14-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: 7DY7CrDzFhuxEwNa6eWmX5ZR2SQcd4hT X-Proofpoint-GUID: 7DY7CrDzFhuxEwNa6eWmX5ZR2SQcd4hT 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_061516_764126_AAFA0680 X-CRM114-Status: GOOD ( 16.52 ) 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 At the moment, configuring multiple resource instances (mapped to same control) under a resource class is not supported. For instance, on MARVELL SoC MPAMF_IDR_NS[RIS_MAX] (under LLC MSC) is 0x2, and there are three different resource at index 0,1,2. These are enumerated in TAD_CMN_MPAM_RIS_E: 0: MSC 1: LTG 2: DTG LLC MSC resource at index 0 has the Priority partitioning features. If MPAMCFG_PART_SEL_NS[RIS] is set to 0 (MSC), then MPAMF_IDR_NS[HAS_PRI_PART] is set to 1, leaving HAS_CPOR_PART bit to 0. CPOR and PRI_PART are mutually exclusive resources as far configuration is concerned. With this change, multiple resource instances that maps to different control, say LTG for CPOR, and MSC for PRI_PART is handled properly. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * Trimmed down the commit message. * Tried to handle the corner case as suggested by Jonathan by calling the __resource_props_mismatch even when different controls are enumerated at different RIS index. --- drivers/platform/mpam/mpam_devices.c | 36 ++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/drivers/platform/mpam/mpam_devices.c b/drivers/platform/mpam/mpam_devices.c index 388d57281fd8..df7ac2c8bcb3 100644 --- a/drivers/platform/mpam/mpam_devices.c +++ b/drivers/platform/mpam/mpam_devices.c @@ -1788,11 +1788,15 @@ __resource_props_mismatch(struct mpam_msc_ris *ris, struct mpam_class *class) lockdep_assert_held(&mpam_list_lock); /* we modify class */ - /* Clear missing features */ - cprops->features &= rprops->features; + /* Clear missing features, we don't want to clear features, + * when different controls are implemented at different RIS + * index. + */ + if (class->props.features == ris->props.features) + cprops->features &= rprops->features; /* Clear incompatible features */ - if (cprops->cpbm_wd != rprops->cpbm_wd) + if (cprops->cpbm_wd != rprops->cpbm_wd && rprops->cpbm_wd) mpam_clear_feature(mpam_feat_cpor_part, &cprops->features); if (cprops->mbw_pbm_bits != rprops->mbw_pbm_bits) mpam_clear_feature(mpam_feat_mbw_part, &cprops->features); @@ -1802,14 +1806,14 @@ __resource_props_mismatch(struct mpam_msc_ris *ris, struct mpam_class *class) cprops->bwa_wd = min(cprops->bwa_wd, rprops->bwa_wd); /* For num properties, take the minimum */ - if (cprops->num_csu_mon != rprops->num_csu_mon) + if (cprops->num_csu_mon != rprops->num_csu_mon && rprops->num_csu_mon) cprops->num_csu_mon = min(cprops->num_csu_mon, rprops->num_csu_mon); if (cprops->num_mbwu_mon != rprops->num_mbwu_mon) cprops->num_mbwu_mon = min(cprops->num_mbwu_mon, rprops->num_mbwu_mon); if (cprops->intpri_wd != rprops->intpri_wd) cprops->intpri_wd = min(cprops->intpri_wd, rprops->intpri_wd); - if (cprops->dspri_wd != rprops->dspri_wd) + if (cprops->dspri_wd != rprops->dspri_wd && rprops->dspri_wd) cprops->dspri_wd = min(cprops->dspri_wd, rprops->dspri_wd); /* {int,ds}pri may not have differing 0-low behaviour */ @@ -1845,6 +1849,20 @@ static void mpam_enable_init_class_features(struct mpam_class *class) class->props = ris->props; } +/* Club different resource properties under a class that resctrl uses, + * for instance, L3 cache that supports both CPOR, and DSPRI need to have + * knowledge of both cpbm_wd and dspri_wd. This is needed when two controls + * are enumerated under differnt RIS Index. + */ +static void mpam_enable_club_class_features(struct mpam_class *class, + struct mpam_msc_ris *ris) +{ + class->props.features |= ris->props.features; + class->props.cpbm_wd |= ris->props.cpbm_wd; + class->props.dspri_wd |= ris->props.dspri_wd; + class->props.num_csu_mon |= ris->props.num_csu_mon; +} + /* Merge all the common resource features into class. */ static void mpam_enable_merge_features(void) { @@ -1860,6 +1878,14 @@ static void mpam_enable_merge_features(void) list_for_each_entry(comp, &class->components, class_list) { list_for_each_entry(ris, &comp->ris, comp_list) { __resource_props_mismatch(ris, class); + /* + * There can be multiple resources under a class which is + * mapped to different controls, For instance L3 cache + * can have both CPOR and DSPRI implemented with different + * RIS. + */ + if (class->props.features != ris->props.features) + mpam_enable_club_class_features(class, ris); class->nrdy_usec = max(class->nrdy_usec, ris->msc->nrdy_usec); From patchwork Wed Jan 17 14:14:05 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: 13521789 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 209A9C47258 for ; Wed, 17 Jan 2024 14:16:38 +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=4ZoHf8fFDtb4INKuYa7V+LTz5FurznnoBTrue2oegRU=; b=u6DyxujB4h2wMH /Bt/se2XmMOUkt8gIMXfL/1ybvcZf2QFklg6/M5rMQrwp0leRjlmGUgdYrmCWbZ1GK1lElgdHMWAJ ozdoTT6gPdzQLXK93vBSXosmDymMdZjADFfPYyI2FHr+mtb6ox6Juzm1O0D1zPc2kRDn6osaqxVtb pjCkTa4OUqQSpSbgfMW5Vv4DwIniPJY+FuEyDLay1Zb4hQZixwH+3WAeFZfdno2RZTfGZHAX4HlcX h+SvByzo0m1xry5ngwZg3HquGh3NgGm0SFAe8k9otFlblFY2MC/ZBpafZ2lp8i307fisMH5i4JAB3 T502SfdCDaqt6hFZ5H7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6i4-00Gyzn-07; Wed, 17 Jan 2024 14:16:04 +0000 Received: from mx0a-0016f401.pphosted.com ([67.231.148.174] helo=mx0b-0016f401.pphosted.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rQ6hN-00GyI6-1D for linux-arm-kernel@lists.infradead.org; Wed, 17 Jan 2024 14:15:26 +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 40H7jROr028480; Wed, 17 Jan 2024 06:15:07 -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=/xN3AdF7Ae4eT32Wd+i6HZ8ojNOSTLKCSBZfFn/Vwhk=; b=QnZ PcMGEQGEOruHyipobT//aEmS6RsveLW385X87nb9Zyg0VpGIayETnKDrfBsK635A /WbQHy4+dymBS8AOUJmFMKFt6LVOeAzlMftiUyXABzwEp82tkdo/BcX4q/O8waxI YfuD2J0DhM1TXH7G1PudFQ6gNjPxJKagHceFoa5qhy9fZpJsG4dq3yNYxlZugVaL DO2MZ20lxt9ztBTyWNUfahBqaUjKBirL4y1hqKLNBleTUXAtdNnlr6jDAQYqnZzu Q4TjrC8U4dsqutLiLUNUNHDMnmYJFKpZeeXAThGJNGMfRX91iVXh7q/gJY0ciFDC MVaMOlIIJQsGjmdTKwg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vpask953w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 17 Jan 2024 06:15:07 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 17 Jan 2024 06:15:06 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 17 Jan 2024 06:15:06 -0800 Received: from localhost.localdomain (unknown [10.28.36.167]) by maili.marvell.com (Postfix) with ESMTP id 8BE755B6963; Wed, 17 Jan 2024 06:15:02 -0800 (PST) From: Amit Singh Tomar To: , CC: , , , , , , , , Amit Singh Tomar Subject: [PATCH v1 14/14] arm64/mpam: resctrl: export DSPRI value to info directory Date: Wed, 17 Jan 2024 19:44:05 +0530 Message-ID: <20240117141405.3063506-15-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: ZnrcZP3-NuROoWY2QqQdv4tcfeVQxXYM X-Proofpoint-GUID: ZnrcZP3-NuROoWY2QqQdv4tcfeVQxXYM 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_061522_180424_385ADB85 X-CRM114-Status: GOOD ( 12.59 ) 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 priority partitioning, let's export Downstream priority value (maximum value that user can supply) to info directory. This value is visible under resource directory to which this control (Downstream priority partition ) is applied. Signed-off-by: Amit Singh Tomar --- Changes since RFC: * No change, it's new patch. --- fs/resctrl/rdtgroup.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index d71fac0ae4d4..8c3df4bb8ee9 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -1118,6 +1118,16 @@ static int rdt_bit_usage_show(struct kernfs_open_file *of, return 0; } +static int rdt_max_dspri_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct resctrl_schema *s = of->kn->parent->priv; + struct rdt_resource *r = s->res; + + seq_printf(seq, "%u\n", r->default_dspri_ctrl); + return 0; +} + static int rdt_min_bw_show(struct kernfs_open_file *of, struct seq_file *seq, void *v) { @@ -1713,6 +1723,13 @@ static struct rftype res_common_files[] = { .seq_show = rdt_bit_usage_show, .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, }, + { + .name = "max_dspri", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdt_max_dspri_show, + .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + }, { .name = "min_bandwidth", .mode = 0444, @@ -2009,6 +2026,9 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) /* loop over enabled controls, these are all alloc_capable */ list_for_each_entry(s, &resctrl_schema_all, list) { + if (s->ctrl_type == SCHEMA_DSPRI) + continue; + r = s->res; fflags = r->fflags | RF_CTRL_INFO; ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags);