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;