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: 188831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp936148dye; Wed, 17 Jan 2024 06:15:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IEaVK1Xikpzpd6iauRDwyGBAHbP17BZbhIhl71iisYXnuv6MScFYW2PPK3U4TJ6c1LBYdpv X-Received: by 2002:aa7:c90c:0:b0:558:302f:205d with SMTP id b12-20020aa7c90c000000b00558302f205dmr897608edt.17.1705500905939; Wed, 17 Jan 2024 06:15:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705500905; cv=pass; d=google.com; s=arc-20160816; b=m+XqZC3MpABz4dW9rZvvEPtCQ7mAYCelJ3cNNv9NS6XwGAE9TPG3ytqV0i07yEJGsM +4MPQ7z17vwRfJ0biq9EWbAR/g/SH8MB6JlLb5bzRf3uWvjIjZDzgUNj1S9f/F0Pd4cd NWfsl7/NTrO8fkk4M2yhq4abU04oGIJRGyDEqB1GNL0n6McV2KTcqD3f/HcPtWQrPcED ZO2xWw6cq5dM2+1z1fPYwzDYbOD/8ebYGsIzRNDD6HJT6fesYD95PbKu7uhYKh1pa51V B3V0jRdNtq7sRdzNOyhpdZciW1euTUtt6Z+NkkQFc8gdiYQC1fz477Q3Rzl3SzewP4wl PFDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=cax1QRJ5lsxNK1A2gaTh4NQDbx9TYQNto6HU4+Cjyck=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=exaxyA01T4ffZDbbAL6RZD5WfwQXG0kvCEhUl7cFRY6ktaWJTgWq/exZ2+59hib2Le Fvlm6lpWbBD7dj9kZmkydp67xk1MED1yqxJytlvKky50Jq1QDQZhy9xu7DfeZWtBaJ2F OvcJ7EVzbaYyUih+TptlCvdkENqJmvwVRcIjURQwIP5Yqp2yxoxOf2UZjhWo8Hobxsf/ atI0eS+Oj8oRzAHn3MWc3KM/ZMi/GA+iwh+gZysx2TCpkUIQUFXWZlYdir8EXuo8DLQr /YJoKgjdn55QUnRloI6EvsYMT3GZjjQaHh9JxXsF4YUh+I8tbMEyTkNuDAbPQFhWGMro raiw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=MCdienl9; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29052-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29052-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o11-20020a056402444b00b0055718ac1fc0si5858089edb.258.2024.01.17.06.15.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:15:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29052-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=MCdienl9; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29052-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29052-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 61C551F24CA1 for ; Wed, 17 Jan 2024 14:15:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20A1920B0A; Wed, 17 Jan 2024 14:14:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="MCdienl9" Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E28D208AF for ; Wed, 17 Jan 2024 14:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500876; cv=none; b=pDuQr1AzLd2yAIo/jYVebKmuyu3gqklXk8V6HRCa1tJZRWqMqSYJIMc+Cg8bD2MLTS2kaYl5eugwp/AN/1R3Wql7H9TgshuqMacke+fPvVu0fgzWfcz2GOY4gTABgu4mrN63iRTl+D6eX/IgCmlBpKq+U7y80oYMXzSfiBWoKWc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500876; c=relaxed/simple; bh=lmgZa7f/ELPa6toEIDJ0EyEhSq23V1tYphW716ZxMHc=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-GUID:X-Proofpoint-ORIG-GUID: X-Proofpoint-Virus-Version; b=itDxp7PvwXQm0y32+WzqmzCIyRShx8YMlDmx5QNHgRfEq94LOjP0Hbs8TSPKGpbiyWDBY64scr3YKUXoCw1Fmjyc7K0IA1Zfv3PkE6TgCOLNkqb5udcFdg0Imp99jm7QOQZN2onLRqyT17u8u9/Uw7Fj0BL1IE7pd64XdFIaw6o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=MCdienl9; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347317766968924 X-GMAIL-MSGID: 1788347317766968924 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: 188841 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp938154dye; Wed, 17 Jan 2024 06:17:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IHLY4Ub9cXC5JTL84Mv8JihclYj+yyw4ir4edKSsZlOHFfLbFOIUXsMRlqYtCCWhIHX4otz X-Received: by 2002:a17:902:8485:b0:1d5:68fe:7733 with SMTP id c5-20020a170902848500b001d568fe7733mr4722819plo.99.1705501065877; Wed, 17 Jan 2024 06:17:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501065; cv=pass; d=google.com; s=arc-20160816; b=Wiy8D8cw+i+VnSz/t8/F6VD+XUqNKJzvrAJE/K+uz3UL+d414/p8kRXXQ26TB4o67F eut+j59UQOCrDxMGqqbOartllSwuAleZMRPNcqLT7sP9Ud+mYRG53zrMDSKt9Wlbgi/5 TjDDf/61pRoWy+6Wy1zKg/aK6DrJhTtOYXsKslBRHbzZCJPkpph5k9B/Ucj0JsGOPw9U 4nVvLVRQvYHa7E1AH/+6XCy7C80l2PEazgotn4ZvFIF7pBJK2rVpQQUMy7u9p1h3lFQG oHzkdntS0YkNTGQ9F1XcYJy0B5XXILtwr0IIez8uFhyI+WB7ugZuuhNq7PfrfF27W9R6 7mjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=rTHrkWdzMVpRooEbJUcNk7UPFjuqmUJZpANqwMplbL0=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=kW5Rug6Q0TYVJng2OOTNdiBz6qWdELEZxO+80zkB8DS2t9nzDqnS0h3DDuu/sEAs1Q 24fHWGBvqtZz77t76TLmmCAnfU60pniLVdWRn2NVfvhN6vMHmmoGuI6MO9c7tRRGfwbf m4NYv7A8Bw4UqJJNUXZRbuCm76srlISb0IMq/4wfq63rjvJmzQno5di8R8h+qKyWqwRf F7b/S6JATC4AyPvfJqZLCCE5i1r3K4gJ/4R/eMhK9pRxvvtEURafVYsmB/rMvp9vQ1vV Sy+v1ytATu7Fh7Ektpr1iGjIRnTrvMe4/lJKyDlwvMm8j3EKgPj2UbLq0C6H4WgyfH9Q BR1Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Y4qAhAMP; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29062-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29062-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e9-20020a17090301c900b001d4bd1d0efesi14708126plh.426.2024.01.17.06.17.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:17:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29062-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Y4qAhAMP; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29062-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29062-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 1AE70281630 for ; Wed, 17 Jan 2024 14:17:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 62C59208C5; Wed, 17 Jan 2024 14:15:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="Y4qAhAMP" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 20713224DE for ; Wed, 17 Jan 2024 14:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500913; cv=none; b=eGjWaz/eR2eGbkFUI5e4wU5pLSB8MpTqez6J4mjMU7BwMiFptSPgRbHbdmovHW0JST/8cyBDDN/BWObUp105Ft4fo4o9vQCdtzFwKCss8xkIsBlgMXsajbZQ6cBJktrrDo6xEdpSJ7CssqH3903TM1mMSPvXRFm1R3RxMPJn5NA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500913; c=relaxed/simple; bh=XqpEiXH77fKWUiq0SUEclrUDkD2zv5jXOhPfycIhMOA=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=EYC0GBlu6Ww9qsc0nnuMElg72X04sozP4znwkq/mb2vyp+AyQrVTkmgAXMDUSI6vt1MUyNntmh0UCdo3uTGInzzkyuAJG6b5TBGGO9FmrXJw+TZ+t2YKyfdpIdpShihPtwTR8hISKssCCDffd9NjmZxg1cB+apI+R4R0yXGaL3U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=Y4qAhAMP; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347485701106866 X-GMAIL-MSGID: 1788347485701106866 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: 188832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp936481dye; Wed, 17 Jan 2024 06:15:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IGdOYEYU8Hz0PKqC4T2jKOeLNznQfUMxnBWqi91Yqyw3XiQWbM5RakcZM8WA6QBxsV3UU+C X-Received: by 2002:a6b:7803:0:b0:7bf:286f:2d92 with SMTP id j3-20020a6b7803000000b007bf286f2d92mr10121159iom.12.1705500933486; Wed, 17 Jan 2024 06:15:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705500933; cv=pass; d=google.com; s=arc-20160816; b=CWdCuuhVZZSSu7jRwI8ytoZGicB70Q8QSY0wnW5LVzSJ59AHaiREyOF6D4fRu90ZPC gi5DlPdMp/S6PXxtbXsgBLxxEURfzYttOhBULXtJah8O9umdjbo4e/uayTW+PBocFozE aysXL3eGGLqdZok3kzjrf81hn3fnKsDG/DP0GT+aBFZLrAMKdlH3JkQh9amfXgxQQ00v CRUVC2WfFbjrFJYHL4biMz2xFN7MayIZ31tSlJzRDmuyo0GrfQqpLE9zOeysY+RbSsLv ifwhS6bnkvow22VWYhzxH88GC/460nAJgAesEI3MW/zvzscTm9TpE0N5L1eI1Iw1qjVi 7deQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=xA6RMJGilhe9+aPlfzYBX8vaxgYauQ2LjbGUd8YkV/k=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=d6WoOC1rzSxr1sKncdhLSwxHd1ELfki+kaE80i+/WFadugKWuhMynC1KPgNjl1rZgi eNSt29wnS0aR+nuX39LnhgUnuFvCZV60nzKlNggrpV1s5/GkZKmoOfTjJh8ILfDYIS+f FGQg37yPAOxBcWD2cNM3juLtaAIckaCXieFiCGhw5ShExQ7VtCLPhFS8vZU13ZXkGEFz 61NzHWo35cQswu6LW3H8lLs/5kkqJ883SKOPnJlJ/edZ/QSjhxBj7xPGSs8XtsWEMtpH 0NiOb6zJ5EPBzFqNyjTspowmt6lzMHK1HCcwrIjhAqMSjMW+5i0yBJhrb033ItmEACPu brYQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Ebmv5tGY; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29054-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29054-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l189-20020a6325c6000000b005c67e10f238si13677931pgl.492.2024.01.17.06.15.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:15:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29054-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Ebmv5tGY; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29054-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29054-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 3813C286918 for ; Wed, 17 Jan 2024 14:15:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3ADC8210E6; Wed, 17 Jan 2024 14:14:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="Ebmv5tGY" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAF2320B16 for ; Wed, 17 Jan 2024 14:14:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500885; cv=none; b=byDKLzzOdqC6VicCEBM4h+f/iOw5r2Y0MqyDLJJZINbLtEybUxRz7Ca3jk7Kx8o16f1LyUA+J/ejeUEdMFwSNcFwyvnRymG2eldytgWq5g5y93i0oiX84FYsBAGsKCpDC9W8H9xNc//QUWJm/XZtoO6ZhGcnNaI+/P5raOGD6xw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500885; c=relaxed/simple; bh=C+aMxZ7Ip/WHsMAvP4P2n1fKInCnWr5NgsE9bQjI62E=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=DlBlp4UE6Fu6jjFhLkQjVbdCiLj9GGbCYjO0jXdHOCrl0Dv1KW32PzVUJ/29A7xUBsIkbckAnUUlFJzO68gP9OImhu3Y1RNS5kRkVYVSu5Aj/Tu1OSz7TbVfm5FOAYKgg/SOAW2wl0EV5KtugZSFJyjE4naib73zKU7z3FW28JE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=Ebmv5tGY; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347346562196732 X-GMAIL-MSGID: 1788347346562196732 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: 188835 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp937372dye; Wed, 17 Jan 2024 06:16:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSeBd/uqb17pXkcf1dsFZ3v5B9DCh91DA6VEnPlR3TeQT9Fb/sxLcaGwR9RkeVGVxX8u9r X-Received: by 2002:a05:6a20:394e:b0:19a:2f04:ed89 with SMTP id r14-20020a056a20394e00b0019a2f04ed89mr8468765pzg.40.1705501003199; Wed, 17 Jan 2024 06:16:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501003; cv=pass; d=google.com; s=arc-20160816; b=FoByIlIVdctDqdrKxmBFAETu4Pd7Fa64Eo1xBTEInK2gQ69scJzFoPt0yQrrCkhidH opUX4R8WOdLRlHyAX1zywseq3NUfpfDbpZayV20pW6COioVGuM2E2ZjJiGBLLQBBj49i q5rtX7NqYxSLuJ5EpwD3yL+vV8pTLkXmajV+8V9jSrSe13pUFe9m2OvJUCTf2ngyXIvh 5itPM1MFEcbb31y9tg0oJA0iD6hhKh08qqTiztCHzOKkAE6RTRQx2TTsbd4q3oyefWcH wrb2IAKSOrN3ucWt73x2CSIXuKifvNLImvqqGSP79NLOtSmq5WbFr3906L+YYtKdSuXj osiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ANvjRHXSTBs+o+k8c9Tv21/16JEVYA9+pOmHZfsxa6g=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=S9oUU2ioDx5MBGYhuxCS7nIHgcfMkBHnB6kbL6/8fYPI6kiADqYM8MfWv50smGzWMv ovUAo2UlXlZBgtq3c+vPW6SNpG9tRnITUyScLPHyEeKQCOXT+iLxwodT8+TQru45zSiY vVv/kMc2vxfeMoT8FKjr9q8xup28hMvTipcD8WiJePRS9LKktmbnMHNqznIW7MBtaA7t nOqB/Gv0n/jXvcb5dCGkQx7/0f6yXvyBzOI8xTF5TFN1QrtidMPzww/YzRtCwraQN5H7 70ScxtnaUNflOr8e6DZnXn7CDNeU31aBu0TBt7RZ9fc5eWSU9Qru7trl4DW6yg2Q6ZzP XMUQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=EpgStO15; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29053-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29053-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i4-20020a639d04000000b00589fcc39ef1si13755436pgd.365.2024.01.17.06.16.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:16:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29053-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=EpgStO15; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29053-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29053-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id D2D06B2504A for ; Wed, 17 Jan 2024 14:15:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D6E2B20DE6; Wed, 17 Jan 2024 14:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="EpgStO15" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAF4E20B18 for ; Wed, 17 Jan 2024 14:14:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500885; cv=none; b=Ss4PrXmgxyCcW0MJEdbteqRHRZbowT8kTiw9aWLQcbCa59JuQZjrYcnF9xST1+aMLiCiq9bp7emloWja8MLwXyI9UWAJlr2FKpwzsqAlNmC76j8Rl7yEqM2G/ox8IcNXHzl/lnZRbuQ8qfmgucXEuumlZIbEt91pTEpWnB2Q5C0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500885; c=relaxed/simple; bh=uDm5mHo0nvURZEeKSIGljx7UOjUrAZi1t7bGD5kftAo=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=tFQSJNV+hrIEWMyqLUa3CeNaQ76dyGaH91MhVcApxv/GrMgi9oNiJrRgt3fXqFvE/kNimXBf5/Y4R7CFo0Gu1SE1Q2cQf+GptqYUQWvuRQrI4PtOvHkUpQH0RYeT8XphRG5G8QiZA7xrdGwoIZzGBg9wBChe5CRCjF8wvy4qjI0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=EpgStO15; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347419830275220 X-GMAIL-MSGID: 1788347419830275220 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: 188834 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp937299dye; Wed, 17 Jan 2024 06:16:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IGoCZJLfi3xAL7OExWUxqHbe8Uz0lRKpm+l3/te0xnw2KEvqxFXFrDCxGXuw8IBhaDqkPpt X-Received: by 2002:a17:902:aa44:b0:1d4:914:b38c with SMTP id c4-20020a170902aa4400b001d40914b38cmr5159016plr.9.1705500996976; Wed, 17 Jan 2024 06:16:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705500996; cv=pass; d=google.com; s=arc-20160816; b=OwuZ1c6mfmgoLGyc8EJYkvmJQNeOm2T3eaRF48WPYJfRtkwPywAcHzAM5dQ2TQ7Cb8 8nOjf6MViRf/dwTSsAjrZSfkdc8wTyEKj4iaa9kU/g4jfyTY9O8L0PpUkK3wfn14sTk+ 5tC1QDX4tUFZfboxHpfZI8usMzy34FoEnuIgSHizRs6rWeXn6w/gi/qHXFyXoVe+OhZB znnoK+tWZgyipvSF+rw35MzDRPPI4ugf1ZjBdH2Lv92aQruZ76P0/JBy1tX7OUl04mCT eU2MmvbZNTkucLSwhA95tluGvJw4ysYLd20gZu80AV/vSWhkfRmBXwCJYrWKfkMB5mdp zmdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=n7v/dHuitqVY/OrcrDypXnmmjVNc5dx4KrCK3+Y0P6k=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=ssoDnv238PC5l64pe32+6mwqABuevlfq32tt2WALkFRKlxfCT7kwE9I55lUfRvLKEr SMTaiIpuhIv5ZKOmOevDRB+UBro/jaGnsNmDI0d1Ba1vsM3pTTZVvz+I0gyS0b1EfUze vKiGjf9TsGG73tZxGJ9AxD3H6Hwe5u48wAIvxJmhzcNy5d69VbJDkQH80M2QzBvidTa6 bXqTFpl1ofH80wuxNcggpawVhFUUMwR7bqFRWHPLoDyuJs2X/Y7i380jylRBGn1QnEJh 3jjsAYBD8mK36mtJ0q55pYfjxzD1xsk6MLoVh69htJVbLJvcPTxVfYzzhgwNw+hH12OL NcNA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=feEuBCZA; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29056-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29056-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e16-20020a170902cf5000b001cff7628fd4si13066536plg.595.2024.01.17.06.16.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:16:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29056-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=feEuBCZA; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29056-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29056-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B8298287228 for ; Wed, 17 Jan 2024 14:16:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7C11621A03; Wed, 17 Jan 2024 14:15:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="feEuBCZA" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78D4D21111 for ; Wed, 17 Jan 2024 14:14:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500899; cv=none; b=lzn2F2kbwMJDZ4j+UPFwXj2mDuz0thfLNJAWAgbslZp6QJoE0tGFfDO2QF6n7XF+W/ku/9Fu44vSUMGMmUDcpzCXWU/K1knpKoNIN6IuI5sZdQugi/stIkOOYKS0tw4J6rb2rUp7yA6K+lEgHIYz7H1b3gToyImv32H9+peGl80= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500899; c=relaxed/simple; bh=PlxnDdzYWanafax0YDQ9BGwaZnEygVqcN/A54H59VCI=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=cGIX4vsOBTbzFbZe3zbG06Rq2Bj0OgU0yY91OYqh6jsnmtWZQcVd0zOulNkeCMboM8oZnF/91VXsTMAIPrWOUxPQlkPrWnC+vWvaYlb25dkI28BqUaJoR/tQTnZNxGaeusNSvURGoh5N4x3bdvkdQgJVosSRc58ncIojjw5u6mE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=feEuBCZA; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347413062189128 X-GMAIL-MSGID: 1788347413062189128 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: 188833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp937172dye; Wed, 17 Jan 2024 06:16:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGMKSxSmgOc2y08quecjPZOJKrpumdDkPLac7H+xYaipJtOEhRy9AO3Ve/IrX/ZQA8HEeKt X-Received: by 2002:a92:2908:0:b0:360:7ea:ac4f with SMTP id l8-20020a922908000000b0036007eaac4fmr10262873ilg.105.1705500988282; Wed, 17 Jan 2024 06:16:28 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705500988; cv=pass; d=google.com; s=arc-20160816; b=gNAHboZR9fXZdK8X7utayf6vV9HPl5trYS7gyiTGrRK8b7oFUdR/v8i8HdBuodUTHU rvhXwdUWFZIiatJH4BpWvD1ZL05cYp0MXMxSXAcQPJPgb28lE3GuOPnTl3Ab/oB0LhXR n+Godffv6W+tJnUijP/Ua1NAoH0JJ69EuecysFBJBFkUFnAl6by5LK6yEl8qSx4+p8/U mhH5LWvUcZXPYyVxDUlGtlE3S3uxuR+KYZL0QPoRjZIrBlbL2Un6LduMmn9qWe6hOyLh SnrrY4h3qnhHGwDhjTRFVxLmocKE7GkqRKvlJHcbxvb2CJ9EKJFg9kpHBwVtIsFVmyJ0 PHOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=1GHNM7+8NlxPbSSdFb5vYISuQDRZWQGahxCDaGr7f4Y=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=09l7J5R2/l3Z/VS53SCnATr2kUFG5Uo88NTb+vueS2RD3nKmGQn78rLPjA6sEL/svm vThX6QqM/ch9eVoy4jOExgeP1iotThao0aZqtGCF2p3vBoy82siFastGqsOXo8v5BHXV y0Asdl9l+H2isJT03YFRGfVF4+pmCQ5iKEyav3CWCbh72p4Ljk2WeBWO/OvVNnPTntkX cNKmNWaJ46TWBaxavBxyoCN/WyKmY8RW8Y6gKGr00xMzcgwOw3y1zRAEBb8bzGl3TTcc iou4Kr3PhLIJ1FctbBycgNlPyjvYw61y3HGOf3wavG443yAhauMGNhVftIJw+6JUpHbn bpSw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=eot7qCge; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29055-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29055-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 10-20020a63164a000000b005c672f5f9e9si13510296pgw.602.2024.01.17.06.16.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:16:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29055-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=eot7qCge; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29055-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29055-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 796C728597F for ; Wed, 17 Jan 2024 14:15:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0DE2821379; Wed, 17 Jan 2024 14:15:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="eot7qCge" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED7D82110E for ; Wed, 17 Jan 2024 14:14:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500898; cv=none; b=oiEm25fKBswhHAYKL05fcwvjcK4rpx0ZniyJGWDmtsa+UxFXPGwtJBHi+jnygdnXjKH2lX0ME2Xokauo56d8IWihq1MiEQcQmxgdHoMgYBNc40fV2QfocUb8BANNtN0Co3f5gGb0Iu9UcFHg57OsM47s7P1VBsmHXFUq7LK5Raw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500898; c=relaxed/simple; bh=HNvW3WKsIlxMJniVquCnypLBT+tR+7lOcEkV6NGM0lY=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=ozFg6swkO1RnhIOjJGlyOpyepTIF08jSwG2Af0qlmMdGcW9xvIhtaMAFNMhPYRf89ehOftiwhBkKJK4EXvc/CIwpew+UaTDk3OczDUk9Y3Qd9rbmsesRbcXz9/vawpHo00OR/ezS++mE6rYO1cnzLsmpbSR7iyLbAtLlZeUu304= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=eot7qCge; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347404186224720 X-GMAIL-MSGID: 1788347404186224720 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: 188837 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp937462dye; Wed, 17 Jan 2024 06:16:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHTT3zRpnD/3W+ZEQvj6p8lefGV2dFtD8uuogtwTwZyJn+6N9RaBCphWshXJvoOFXXNflTT X-Received: by 2002:a17:903:22d1:b0:1d5:c554:7778 with SMTP id y17-20020a17090322d100b001d5c5547778mr6997260plg.75.1705501011700; Wed, 17 Jan 2024 06:16:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501011; cv=pass; d=google.com; s=arc-20160816; b=vWWXfzCCPgEfjBtJPbIZ1P9Z1FUGbMa+Vx6E7D6dnyUsUygWxw9xkaQxSGq1SESc3q MCN5tyDW/IAvs/icvZeQvz3uqSQlTFZUyq/8/lhF9p3nTmnGP5OnYWLWwoc1tZYEcBXU sMvvAklhf10FOwKRgbdrY1v4vDQRn/mbKbSo1EkKu45gdzwfZjmISc37RHu3XjZGmg6s ydsD4GysX4BdE12VmwjrhHdfxaSadMt601e6TfI4M0RkbXdKd+n338o/ci4gwqzu3MKi bNwNGNCGZPbMommI93hiqIyzaV8kJjYuNEQ8Fxvi5LIIp8UCHpe3jhF6kMtGFIQnFwUU Qy2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=m8HLnfWt5Utpa3bLN6g2+5kjNr5BHp8QTjpnSgMN27w=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=sR36lEhbi6pAx8qcSWDWEF43NqJceoIapgppLbSpiyb22aRSkRsJdaveMuUw3pn1OG K94C9BJLmeBi+TiIC4RRBzjTX3QkD8Tv/iFNWySc5x8v7Tw5zP4G4oZjovErDv33rCAv cM+anc52CIZ29RrBVZKoRqz2eb9HsBEod+64Ec2WuiZruKiYf0X4J3foyaNNH6zb4RJ4 qcEtPzhLHdR1ett1PY4l22Dr7yTEUD5N9RZ7YpX2IMLM6vTScH1omIvpt92DkeFcFf+H rviVvkxrU+74kHbc2aLXvxA//4yW+fgw2KAKtFNqF9ZnLYAe+dL4p4acOVoQo8Utofcp JmDg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=HqcdGwWN; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29057-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29057-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e16-20020a170902cf5000b001cff7628fd4si13066536plg.595.2024.01.17.06.16.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:16:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29057-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=HqcdGwWN; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29057-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29057-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 63539282BED for ; Wed, 17 Jan 2024 14:16:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 928C522314; Wed, 17 Jan 2024 14:15:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="HqcdGwWN" Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7DC521A0B for ; Wed, 17 Jan 2024 14:15:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500907; cv=none; b=iPay2UUhqCEmxtKJqF/bffyNebxBbMygUIrxdpzTPkP1cuqZ2P7HGVBpYBwWrfDGMaHyd5ZgrDhWTd35/ptuW+s6MPxVYNmP9OmrCQQkjhNK+28srtiNCNFFzF93ByeiTIwEl0vUEvmfotNZEB8mud10s4+lhRyjxvghbIs/F3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500907; c=relaxed/simple; bh=B31h2YlLbN3wj8fP+StJ7lB3iWgaiyRvRRL+nieP7ks=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-GUID:X-Proofpoint-ORIG-GUID: X-Proofpoint-Virus-Version; b=uEFfgZht+CNUgkzl4e7TD/SYBasuxNbeBDt92AGhredwc3Pi/PgLZykntpvXX8+FZ8f3xtek86rc1b5OFHrDJg5pXqtHACigIZbYpalJG4poGo0FcC00j624uG13Um0UX5J/lKMqQZ1SZtP5+qY/63fpwTvJjzapUdFtfVgaDw4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=HqcdGwWN; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347428866143380 X-GMAIL-MSGID: 1788347428866143380 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: 188839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp937801dye; Wed, 17 Jan 2024 06:17:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHn6mShFChS59YIDPMuYoI1rshiaAQuQ+UT0z7lqDBgviNyrf25ZnbEwFychEm9u0tX20Yh X-Received: by 2002:a05:6359:4112:b0:175:fb18:1c04 with SMTP id kh18-20020a056359411200b00175fb181c04mr1506547rwc.18.1705501037439; Wed, 17 Jan 2024 06:17:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501037; cv=pass; d=google.com; s=arc-20160816; b=ndIWDdqpi4YVnS7SWV7Rfftjw8KawQq2TaHVmShMjQH8Wq0kYwU7E45R+b+tAopcqn LcuCQm1c0m9rgD5CbvpkY+7HfY3Vwqrhrc1xKPUm2QXefwFi9s1w5/t7trGpGstteyPd D/ItnhYkrEpmmhJYFXasc3XahubVjReLbF2DlYvP1od253fp0gjpqI9eQ73v7m5Kba7h jA3hwBTmOmTOkMF6OyyIOvP3fTdfyouHGe6KvTnNNDHIFQGmh90zi62mJcCmI7WRUR9d L4J7mUsrM8cj2rWjOh9lcAptm12vrJVnGiTlHFOJvK6AgEmMijWPiCzp0aNIW6Fd1KXI DCAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=ClHK3/wLgAYScaXmKMdx+tz4GzxuqNqE2DlmfLex1Jw=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=piK77ZGPsYfPQ9rlKwD+iuLJSvLD0hvmgqh7iR1Rkegr4j7q1hiu6URrv0Y7gag0/b 7ga/auPfB//uZP/uyJ/MJO5nAvC5TnSyOVxHJOok+XHR0/tiUF9HilySDhowdqBaM2zf QF6ccS+y8gyGl1Dw9Lem7Pvp4GURhl8H2RK6S2JwOupK5kmvf89ZtttjWbZhqE45zduO 3QCrYXBuUGytG2+9r0mVODbX+y7pLQ81iVOZ4iat9GJdGB6VO7w1Y2KcU0rBRZzzojH0 ZCcvc5VnRD+iMMO0w03MTCtwzt1PnRhx6HDuvoew8NZRJopAuEXcnLxJPIEBk+vZyp5k QWkw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=hrwD04qp; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29059-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29059-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k184-20020a633dc1000000b005cdfd877bbfsi13348822pga.779.2024.01.17.06.17.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:17:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29059-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=hrwD04qp; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29059-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29059-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 46D7128134B for ; Wed, 17 Jan 2024 14:16:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61350224E5; Wed, 17 Jan 2024 14:15:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="hrwD04qp" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16EAA21A16 for ; Wed, 17 Jan 2024 14:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500909; cv=none; b=gOu/B6bmCJK0ynvrGwMz9mlm1xacqh1EWYLvGrBwCA0TAnjyKwPM1RZCuhOneLN/CkraJDyWds9icQ+fZ459Wklb8XNnbum6VEgNdkHvXXPsycm+iIZUGskUB1IjplA7qU+sLKKt1KxfancEIL+Qed6At83NdIZLa7+4JXTfkWI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500909; c=relaxed/simple; bh=Uacz0OmaBpPdLHAvxMrAph8YSMi47QQZn4+e3V7k3n0=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=fbfP+MOpF/Dx/bOscRASWH0s2RBIms8g6nQ3V0w3MJsbUMW3a6qVqveIelrKmmLEb+7DAdgRhKXjFE3850oriuFeKQCU9NFCxpYSeVujzVRfz2yz8BPVDZxPo9pjSNhv7HaoN/7a4PRoCsUXuw1h1z2zAxaBWCKgo/7w0cpSczg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=hrwD04qp; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347455914160421 X-GMAIL-MSGID: 1788347455914160421 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: 188838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp937619dye; Wed, 17 Jan 2024 06:17:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKEgkWi3RCQSJw3pnWv3Y4x0NwXb4D0KgePznF6dfwd/hDCtm4B4mHaA0fd7q7FfmSL1Qd X-Received: by 2002:a05:6512:239c:b0:50b:e724:62a8 with SMTP id c28-20020a056512239c00b0050be72462a8mr5362668lfv.92.1705501024921; Wed, 17 Jan 2024 06:17:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501024; cv=pass; d=google.com; s=arc-20160816; b=OEbJJfsylBId9Gbxk7ZhlbDkFy17z55dNqa2Sc0bmyE5y/L5+aPRugdsfY8vAC4LVs WUokvZkmL2DKHy3ccNBwz3p+hNg7bByqNtz17Eb0qXOTZsSRhUnaLWJ9N/irbi7Tp31L C+hyYP7CK+O12sV1K6QOOMLOJnosSlQ1GCcs4aR0C9ZlFCK36IgQDb/O6WeC08GsckWu GehIcYbWeQp2TL2nwDxD0UrQP7WkprDmG+jUitAwwoutFH67pgs8QJNjErQIGXLWUv2P y8iP2OAYiPEGI2/QKMJE6GfpItQnETy52EpzstIrqL7EOWgTzC59u/Vn6k1UOuWjCZ+0 qrfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=zo41x27c4kcVqmTh43FB/0d5x1krHnjvte4oiC06x+E=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=xkKKjLFeEg/fIiAR3p+/KcxLs5oyV7WHoAKHzmz2nGIq03WnGsjN8wh3H7XY0Sk4Kz OkS9z5gailZNs9eQsrsJ2hjj9dTx6haJs1wFHE58SmiaGMgdG6CnGH6lKTihJVJZj7Xw WdyCyt4ZB+F8xYydLhnzBjyOHn0N95WeRwSVyv3ti+cz+bpyUq2yVM8hzRaL7xB+74vH FULHgHUqc6UlyIv49mzsZxK5ljlNpL8Qmu67Vl3tV+XAFTh4lYn4LIi1Pj1xRIGC8Lde XFp+3lG7Ztxc88BxmMZqHcJYHZUSVEaQg3LlcvnU6tK3F+lQf2aex5jOYbANIZqZ9C2O 4BrA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=LmEOAJxG; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29060-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29060-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h14-20020a170906110e00b00a26f5e23c43si5773473eja.202.2024.01.17.06.17.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:17:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29060-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=LmEOAJxG; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29060-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29060-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 54BCB1F216A6 for ; Wed, 17 Jan 2024 14:17:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53787224F5; Wed, 17 Jan 2024 14:15:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="LmEOAJxG" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 510D621A19 for ; Wed, 17 Jan 2024 14:15:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500909; cv=none; b=VtqFKZsQHz2N4+ZE3EbRf6zSZFbJtCA4OVwg8asyORptkgK+f0Q1BmY2GmBSzSXVI3uPRMBm1+FHQB1VAzK44Vx0016gbRDT7qt4/KNAFJ4VEHQ0zVOeukfyA7nW0e1ORAWBDcQ71ddSD8YCTnohE1t3i2Lxvh/VF2oBfzDcYfI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500909; c=relaxed/simple; bh=DrmYJbwpv8RVrBaCOAySn0hApY2UP4eG38NIM3IFk5w=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=kMxSlmDAqkPyJtXFHTbMtcGZkt6Ne+Tx3GEkMcRJoTsu3/AV2BJB984/wXtiAiLH0MuYQQ0rLPSBZ4Q/NRPxQVXn+TC/499hdmk8XR4Mzmcz2JYA2t1uRrvGaT2iKh5H/3d5JHoN3UP9Ep+ddrzQp3YGnLwrOy64IjnB+4cjYwY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=LmEOAJxG; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347442853670302 X-GMAIL-MSGID: 1788347442853670302 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: 188836 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp937447dye; Wed, 17 Jan 2024 06:16:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFHg7SIfEvPksMAazTTQ7LpkiuDf0OcLDmSGnd51G7eRTdoqVG+Y2ZA70t7zd/cxD/e4aLf X-Received: by 2002:a17:906:a259:b0:a2c:4fd6:192 with SMTP id bi25-20020a170906a25900b00a2c4fd60192mr3794278ejb.2.1705501010677; Wed, 17 Jan 2024 06:16:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501010; cv=pass; d=google.com; s=arc-20160816; b=JWp/1/xxlb2D6m8O5BJrGeGBZld2bOKrEEgHGIMcPu3MXWNSLGN/HgYkzcJFM27MHn n5yIpOU/BOlR29/d0JDFTY/VZw627vutcEdP73Olz5DCpCxrH1Q16ZRm46jR1A2M4gRW IMWinIBNoj7cMg1v31HKcrpCtsochG82XhHF541z1Uxnl3Qh8I9h5bUbtudyv5MPnqOi BrtcJXqM3KqwQBf6Gxfy394TWUrdYiVb2rIJ1orb63BZ08vbgsInzPS5T61vFWODAohI bit4Wnvy7AKJVdhBvVPIqk0Ch02/kvmvZM6HI6MiCJsjlVxTMBS0PtQsVbOAWj9ZFUzS +m+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=0WIJ5Saq1p5+ZFQkIuWbmHjZZkw8Y3vMm4fuMdgzxlI=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=xgQWVXytUipMaUBOJmmM5y/3XTe5GlxGFKdRhjeV3sv8l6Z+pCsSb5skXG4ZcyItia XWMEWmtoPIgyfKGLLUbz9eqBZ5asSW2MkHTXZcaKjdQ8H+LiVvR5gaOleuIzxvZ3sEBF n7zd5x5+cGYJQts6Ty4kC8gAm7tAf9lOvjZFTh9aUQ9Rclbh6PuFEiVQtoN6AUA3AJdC nRr503wOKj7AGbMNVX3YNay47gxR9tzEPNHMnQaf3QjNwm/7e8qd9ZQ1k7hPwq5e+nyO 1eUWfXsIa7qDJ0jO6Hv2YiYxCEC5e0VTKBAE8E7kQ4D2fJ136atlX2mtkD1yC8GnmN6Z TupA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=fzYLqD2e; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29058-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29058-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id pw25-20020a17090720b900b00a2c6a443237si5670229ejb.645.2024.01.17.06.16.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:16:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29058-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=fzYLqD2e; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29058-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29058-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 192E71F209AF for ; Wed, 17 Jan 2024 14:16:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BE0E224D2; Wed, 17 Jan 2024 14:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="fzYLqD2e" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 43B8721A0C for ; Wed, 17 Jan 2024 14:15:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500908; cv=none; b=XKNgi+8delOO0DUKY54Qhup9Ia7IpICZ/fFbNLH3aAuUR6bDzF/PoEaXzqc6nHUeT0TRUBzBQd3IVbydsZ18ZoYDqRk2GnedPD9nPjL1C2n9IdMZEHtYUhiQZYE7IxpXMD8NDjfGw0kkAAkbpZKfjyi8IElNndKU3SgM+9h8TOs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500908; c=relaxed/simple; bh=9nleSWUzKD6TdJg/UJWhtcJTMDxZtwm01y3JBhz3QOM=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=YCPPbN1/seOFdMydehH8fLh0tSKkcnN63/WxWDz16XkcXzRe9lX3CFU1Y54poe6eZ75XPQdpK2HQsJETqdge42tes/RSV9N7W9BozbUiCrGXllIthojBlzyGr/pXwxRhf4r5+7+1o+1b2HoF00QD1ksBdZPUD+YJ+7gOzuBXtqk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=fzYLqD2e; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347428018831566 X-GMAIL-MSGID: 1788347428018831566 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: 188840 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp938112dye; Wed, 17 Jan 2024 06:17:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IGqBELrXXnOsuLkxrSBMwXeL5tSRPJWAsgtzaVq3hHwlkbmT+CHUY/fU3Nz4fvm+G9m/0k6 X-Received: by 2002:a05:6e02:e0b:b0:361:95cf:3117 with SMTP id a11-20020a056e020e0b00b0036195cf3117mr1080512ilk.58.1705501061428; Wed, 17 Jan 2024 06:17:41 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501061; cv=pass; d=google.com; s=arc-20160816; b=K2MVGcU//+kPNRlYNEVZ8sIZOEQmi86hMdxLT1472W8iPt8B07mOk1DBDw4PRXhEL/ 0TvoVPeMB7u6Rb4+MiR4w6NV+eCkGXLK9VirQuVAmoYTi7x54uMITXcqc/BYsGW0jDqg S9gqG4n23Gc1cA+jFyAsOtH9QAqrQSGbP6vjAExUPCCdrdJtFr35qe7+q/zWtU/U0WQk XdylBG3vkuumCd+1445uIG5+fGSkwFBKgpzOaNPeZBsXZia3qRxbKA06ypECXlJBUhcf 1BG36OH0po/UdABrXJhccp6FrL6mLjeiDFGHAyB21IVe8eTqIGrENcOwvvRVbG6cfN4d HO5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=l+S3NRJZhZMZgic+Qg3QaXyHk6lYRiz6QfTJLOdTtvU=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=kfSNua+AIxhS4RLI6m+L/F5CKqOLGE7MPa4nfKCFBUckV5K65WFyAH8vmQzwg979Dz QDE5fHqBC7nVSeTCigFMvKfuo9Vs3EREd0g18SwAkYXmxKiUQnbl0FsWNITvjdcE1ozc iOcuGSGYe8lxkEnNrgEi3riSU9AzIwnemxkiLb1dmmN/Jr6AA9KI5Ztx6xQGBQy44Zb+ UwETjVJN4oiajtz24krdj4iLzGzXp64/ekM/0AbT9NBciZXDOeTpZdqX7VkIntu+62Qn pFmTdpNUQnmFFpf4UxOd2VaGHAkdkK2DrMTedi8kGxTW36BAxkpxebqzbnnOR6Vjn41Q 2bbA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="O/fsvbkW"; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29061-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29061-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id g19-20020a631113000000b005c6977f9c0dsi13717701pgl.214.2024.01.17.06.17.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:17:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29061-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b="O/fsvbkW"; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29061-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29061-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 29D48280D64 for ; Wed, 17 Jan 2024 14:17:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DCAAA208B7; Wed, 17 Jan 2024 14:15:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="O/fsvbkW" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F295E224DA for ; Wed, 17 Jan 2024 14:15:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500913; cv=none; b=LsTCiglRl21L0RUW40zlr3ZhYK2zT7VO1UKwKvSIgcV9P3LmZnc2ev4mAfbutHiE1GAIFnjBgyBydLvUeoAkH8FR3iMQViO2Vp86+9Ecv/cG0j0awnam/Lnz0gpHBgjYWauSnykISdkqcWEJCvzp35bPu6ZOR1KoYLGUFBFxFyY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500913; c=relaxed/simple; bh=R2ihv3gxBjZQJ8LHAqGvREa3UZH1OP8g3M6pOjjvNd0=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=N+QvQWRAqPypHUjIa7KTQuK8cj8OWmSB7yJFPI56fRltjgubnhzztD3SWuhvcorgny84uWdhcR0uzkJ5gdAqO8K6+r4sGca/DzJs1fDyAlavw7Z0YP78RVFIZpbt5XLsmcz3JN1ee7I7avjz0GZcbIRb+CA/+BI7VF0NQ7KaY7A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=O/fsvbkW; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347480720861197 X-GMAIL-MSGID: 1788347480720861197 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: 188843 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp938604dye; Wed, 17 Jan 2024 06:18:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZunInXfU3t6XWnuzoPa8qi0F6Xx8xjekmRTsxo0kARhrNzKz5b12smGu4X26KkceCHGyB X-Received: by 2002:a62:cdca:0:b0:6da:5886:843d with SMTP id o193-20020a62cdca000000b006da5886843dmr9936853pfg.69.1705501104240; Wed, 17 Jan 2024 06:18:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501104; cv=pass; d=google.com; s=arc-20160816; b=lBbQ06YKTRoE83mqbj+wPH25tNh/RAwOrXzPnrKVdGCXU/0ynTN34Vd8bsAEi+XXfC GwOz/1+43ZlP9NQbY6m0o7mcCvnCQbnGjzUGLcThCxHvBPzZK4hEJfQvsL9RePgDYgg5 4xRWfiySgQWzhdb6g/hbv4+1m9E+ocIYh89MUQWmGcJpUeeQfl04a021egUXJ9rXTrTZ YG0KGqABqDcj+k5kwvn3QgyrRxiOk/OkJ+Izm/LghSPsDth3FskdC3SaTySfPOJRXzfy Z4p7hAoRt1C7kR748lmhMt6pPU2rrDbMfx214VQ78Yx2acw1zGxR9+OFOcapHGLk70Wb 0Xkg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AyLoq4qCvNRklZsb/iMNJS5tPScAkgwgIIVRtypuMfA=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=eDfAa6uVrR3A0mHG0/CpriaRkFinzLAZ0NMSEu0LTuMrKhNu6trh3M5QDF1G6QqFVl LFHOcV++kqyNAtkWuYefBLaL4JPiKB2F459cnpLemkVY+602ElUpuUJmtTiLFQZsByJV osBda6h+rmC7zKglBqEki8gmDF5+onrCo9HIi1KHID+qVuFpIYdCYt/arRf/VRhz8aCO h9ADdRsc8i1YASFHKN3H0LCIoNCLQDoMkzVsi/1HQG4kP1ME67wp0g0faSUwrEprh3I8 xuzUjiB0Et0QWAw2ubZWVIIxSyWStn3iZOVl8DXpwwFd0jj81SFwyyUp3MkR4Ijt46q0 BvIA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=kdHSy9Px; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29065-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29065-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id r6-20020a632b06000000b005ccf10e73b9si13141017pgr.726.2024.01.17.06.18.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:18:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29065-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=kdHSy9Px; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29065-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29065-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BF61628147E for ; Wed, 17 Jan 2024 14:18:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2E227225D2; Wed, 17 Jan 2024 14:15:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="kdHSy9Px" Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 18E7820B1E for ; Wed, 17 Jan 2024 14:15:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500925; cv=none; b=HCHdBm7kRzHHA2vqynzgoyg63s5WOJMMkd2w2IFPTzTS+l2PtQKlweOD06ExdB12pExLHvq/QYrzl1fArewf06BJ/esedJ7aeXtly3owqeiQdpvaNQFvGLlw69lRmG0DMXK1enE/Zvbz2C+xmNS9m1Ejl7/VvT2NveeVKDck//M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500925; c=relaxed/simple; bh=Imf7O7zcNOVCd81mclixADJXwQRt2xYwWPLl/E/y0Hc=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-GUID:X-Proofpoint-ORIG-GUID: X-Proofpoint-Virus-Version; b=XAj2sM4h2BGKQa1K4iyMusOOPaYT3VBJMxxbhZgUFw2vRKPyudMPKICbiwV30TNMxi7e+1NxKUS7fWf5qc7PHz6IQbGT2v/RZz7KBej3BS3xwF+pTamYWG7fRv3YDRX/xxNdE3s45Z7TABG6rnZMpID8vwC/DSkNbdk36sGtsYo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=kdHSy9Px; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347525855152904 X-GMAIL-MSGID: 1788347525855152904 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: 188842 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp938516dye; Wed, 17 Jan 2024 06:18:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEJjxOpW+IQKr90629jJasRneuH2c+VvFmBSIP51iaK9SBQnddJCH33Ur1N/wag+1hERoHG X-Received: by 2002:ae9:e215:0:b0:783:37ec:9463 with SMTP id c21-20020ae9e215000000b0078337ec9463mr10209973qkc.20.1705501096690; Wed, 17 Jan 2024 06:18:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501096; cv=pass; d=google.com; s=arc-20160816; b=bOIjQt7Y2BO5Ptw1AnyXGM3xWWo1E54cC77uqs3p1w+MapCwHgMjLBc7HmgK6XsChd eRuPwfp3kz9+0AnlWE1YHYMxL+Q6hD3JZD5kqihWgvAsNrvfbLfC82U3MrjRpjqwNe2P usWBrRL/vPFbyS4Sf9jMRMtRbXdnYQOhlgilVbkBhM/MiErSy4yzfjVhHkrfU6kWgCf5 7mILsotTR9a87Hn40jgFzJfYqlUzGQ/fNqPdBs/q0Cv9KpNqfus9saemGdO414xcygjC oSGxzJ8owEl/UT8QKCsGf7E+5m78uSud2tgwYqqHZ9cNUxAc3wzx8gt9tY3RCcxuGQuz wDDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=e2FEk6dn1f45GCWDdcLSp1yy8Sk+sRaao8A7hXcl/EU=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=xqZo0AmRyiQbHFiUYALAmk3fGnqTVZEzjyx42sPPkm3E2tf0cbNo87yzuH5QTuFg5w tt11iacJ4lcAKgEebit/aWn9OtdJoUsigf/VXSqfVR8uTm48D6KB6o11+/SouSFVYrY1 5Mr/CaiMla45oMO5XZ0sEP3ypDDjWOIVTIQDjtXMrv+y9XMZaGYZ3PfTEWjji7Hl+K+q kXWRtmiDkfaRSdUTcPzFyJd9vSTjke/W2kw+Fqft8+on4QdJ2mHOn1o0Q7FOyn6SoqB5 /IejDF9GpvXCaQPADYQtmjuY/q/iYxYvmUSVJ5aUqFZyFhTy27CneEWB5dkRQA9sm+Di gIkg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=dqopITq0; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29064-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29064-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h15-20020ac85e0f000000b0042a12dd4961si501923qtx.281.2024.01.17.06.18.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:18:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29064-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=dqopITq0; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29064-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29064-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6EB7C1C2184D for ; Wed, 17 Jan 2024 14:18:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C3B50225AF; Wed, 17 Jan 2024 14:15:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="dqopITq0" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 58E3120B0D for ; Wed, 17 Jan 2024 14:15:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500924; cv=none; b=HKs6jFN8Hf12z5hB2OhF0/Z0GuZe1YnfAJmI9x4y8+hUIoCJWJr2xmMj2PVb3/0e0JFZMpe1Z/8Kw8fSqNIEVUHqbUtrZyYFIBBNdCsf2Uz8ZbhsuYNxLCMGH5ulf7dAuT59n21aN+cOZQ38KGZOvVdLf0Rpq+VeM57c27qjVv4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500924; c=relaxed/simple; bh=ZoARrx+gHm4/p7Lyn4Uzr529OkYrUKtuOYv73qnkK1Y=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=DdJUrYMgTNxCjyIRmIxBzj6MmUFGQLD3zlDEw/yujCj5osbvhNg2A+2yN2HsYkp4pZHWQx4FcY9fRHTx6aPfofXb5obQLuw1jzp+ippk+xHjDhHecai34TtnifXF4OHZSt0RaAIy/FxtZ7HDcviM5lvcWYZbkdA87tuvpEMgokQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=dqopITq0; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347517897660704 X-GMAIL-MSGID: 1788347517897660704 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: 188844 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp938717dye; Wed, 17 Jan 2024 06:18:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXdQ69cenpEZfH9sPntBAFbXYlEZAedgtGvp/zSLl02YwGSYU5UeLSoHUaHJVAPzDYSrt8 X-Received: by 2002:a05:622a:3c6:b0:42a:9ce:ae76 with SMTP id k6-20020a05622a03c600b0042a09ceae76mr2184869qtx.87.1705501114808; Wed, 17 Jan 2024 06:18:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705501114; cv=pass; d=google.com; s=arc-20160816; b=GYmZ6629TxwWCOf3CUwmRlmnpsouUvYzpSQ83gNuQpinxHnEZW9phLIY69arT4CGla G3gJidxnL9ndntukrsCSTnDA4RGqf5c5UpwCI/W3yN/WHkA72dDdqF35eqQOf64X6uxD 17v2qlx98Cg0VlzgKDR9cT2nzzUl4f1AuYMfDEWz4HGMcBZXjQV9YAG/wvOt6LPZ4kki 3VvbcWn+rOAVMZce29zlIDADTEZHOuxADEboAL4bNX9tHbWSj6zsMo8/eX2XBpdx0nRr nUb8stBbvSRNW1dbNqUDbO1Dj/eeOAARhsykmXEel6kAySU1QAQg49NxFjo90rXmGI2h 05pw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/xN3AdF7Ae4eT32Wd+i6HZ8ojNOSTLKCSBZfFn/Vwhk=; fh=j6SLEof9e8AyCQLu0pJpTyZST5iXPx6e/Ker9f2ENNE=; b=BYDBjB1eSPvLFOMX1sdRG7a7hTwQedptzRcxaMxV15bl7tdiVxF9ZD0iIC1HYHhwAY iNqhErxssm1lEWWDySn+dcdJyl65lQdTgry6Ub+4kv6H9M1vU27DSVbo95CHyKBXQBeb xNrLol5JyIYI5fO5aVqZuQ5hNqY0WsZaNuqL4Q8JvnsX6jR25+F6VTjE+nsLmLUr83ER EzDnCJI4fF6RZYAFCOVwqLOv5pbSidMmXrRD1XWWoC9Jtxn6cXJa9zhuOy87Wd4wEZLC Dy1c5+GlF9kqNx811rfKZagwmiowWgwlTAvPLymhesIXG4uVgDUzzyTI03MK5au7ml9L KYWg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=QnZPcMGE; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29066-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29066-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h15-20020ac85e0f000000b0042a12dd4961si501923qtx.281.2024.01.17.06.18.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 06:18:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-29066-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=QnZPcMGE; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-29066-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-29066-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 993E11C223A8 for ; Wed, 17 Jan 2024 14:18:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 847BF2262F; Wed, 17 Jan 2024 14:15:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="QnZPcMGE" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A8A3021A0D for ; Wed, 17 Jan 2024 14:15:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500927; cv=none; b=XFx4lXvDTPczMVTm7LvmMipH2w60/TmWJfkgn+JyMNLg+BSQKlO+Abxi195lDYnAFwDqsYdYBDK/NXWK0how32oQExgFAmytTe+bhNOT3FSlniFf+3uygpE36lbukleOXzK0gfvLyCxnYs3xVwi2qSFGfckIS98f8IR1udhZ/mY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705500927; c=relaxed/simple; bh=FPdDtBY/haMyEKtF5ifHGuWUBOHsyQehBf2C9JkxJ6I=; h=Received:DKIM-Signature:Received:Received:Received:Received:From: To:CC:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding:Content-Type: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID: X-Proofpoint-Virus-Version; b=gXXtWIcTR0wk9DA0Zgqq+pTgdhIrZQHb4HpObY2Xhhp7equVO6WXGD0fPhApEIPGsBhZ0ox5DTknJ/CMbsV2EdyIW8VwIXXRbseePK6VWx1VvUvGqXZw5KEDHVgglpOOPzR88FDWwkgm7ampTZXhZs+toZisREyulsiG9jL21qY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=QnZPcMGE; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788347536554574597 X-GMAIL-MSGID: 1788347536554574597 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);