From patchwork Thu Jun 1 19:00:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 102142 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp552099vqr; Thu, 1 Jun 2023 12:06:13 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4n3ob3fJFTwCCsO9yX+5RXStFhGhuMlXC69DSot8Y6/2DabOF88jsZaVgECOk2KKr9KXp0 X-Received: by 2002:a05:6a00:1789:b0:646:74ce:a36c with SMTP id s9-20020a056a00178900b0064674cea36cmr13094682pfg.8.1685646372928; Thu, 01 Jun 2023 12:06:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685646372; cv=pass; d=google.com; s=arc-20160816; b=QV8EtfhYBN9CcPX1Z7hD4lxtyxRiNUsICNBBU8M4eplDfxJIHplaGwz2mvqzez8SSD Xa5vHx9p8DFTMUhYdNSzSDA86cCNfdGCPvgT037+ekBLT08dI+txWFSGIKCo+op97oZb gYYobRW9/2rNEM5w4+Zx0F9sSA8veLckmTkcyF7oZHB3cKOG3AYMNHAmygbBDzxDkQEW t/I79/msmPkS3TiQ1ZMt/tP0B8tGveeJKUVoKfFKN803cmYFucFydPHan+QAkjTnEcBb W2kDA5zwWiMblYVaRy42Ajw9oltwV97d7FXxW7wtZ2LoJax9bmVC4QWHOc8Oasm3D+C9 bgvA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=G+Ri0OnIn94g0sfsasntb/wfY9Ip1jUmxeT1yDBE54A=; b=c9KbsmIQDqXS3GF3EiQDfjI4kPbC2JBYWhsdTi0P9RV4/uJzaMIDieMyEIo+SO0OaO kEH51FievkeDWwbg2CVDVvrAkzRcb8oNezaa48lQuiJuwmTKYQ/rpp8XiZbaWJ8kZQ2T 33Jpsk3ktxi0YFzVDWhicFwFsXcQTFL+DErf8qGtVMHSYJMtI9TPSHfnXzQiBDbdbiGM worXWKlGoE0TH5wwmPSVzAXzBRCnrPtQMx2D4wSRDm8Bx/dhTg76XXBKEroYqq1dEQp8 sAzi3yKiU1MEHfC37vuJOSwdaDpb1Xoilov7HB2DhDi3OugKDjbMr3ORRgtlepzbBMh0 N2cg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=XbYQ4fli; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b127-20020a62cf85000000b0064d2ddc63ebsi5823506pfg.306.2023.06.01.12.05.59; Thu, 01 Jun 2023 12:06:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=XbYQ4fli; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232248AbjFATBK (ORCPT + 99 others); Thu, 1 Jun 2023 15:01:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbjFATBH (ORCPT ); Thu, 1 Jun 2023 15:01:07 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2070.outbound.protection.outlook.com [40.107.94.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3485184; Thu, 1 Jun 2023 12:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ODfIwWKBvGqiWo2WWAdLUFd0YPpYV1SkAyNj+JCUNnl88Uy7sF/bt9v9zvUQdJOcs4HAmYhgBLncIfNvisljBh175vv3R7EUMym3IqCp7s6d0992EYTuKZgPvYPicO49/7qxeE/sZiZhhC6keVvKFjFiiw5VOtogeAtstPf/H3p1FcsNypQHZbBbCV+ZaA/b9zwG2QOHIPJHP6Pz1/uObIymB8FkuUxZYriTGVkoEgNCq/Mc+5Ug07YpZeUf7WIGoLKtU+lthqYGP3HFhNPQkVwc2NfQjTdOGvOquMW+99NHJRUlz57xczAzef+HXfj1WK24VDKca7V9ftKmHpo1GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=G+Ri0OnIn94g0sfsasntb/wfY9Ip1jUmxeT1yDBE54A=; b=lME24c35jIEIRRoN9MhjSihb6U8JYPQYdC4hJVNSHuY9as+6GBnXhm2pTRURXqHZRPMeCHpwGLGol0RW54/MpPlzjvTdr2G3j22xMlzU75msR1ky8q902cEPttQ8AeoicmcFaN4GOoN3/uqbbZ3DUasorkeZ28gkCeScd84Jm5pAsuVbXFioJ/ssP1BHrakBEX8jlWgWCXl19lgvMKg8lDs6EO3rLrYRjWQ2uUMuGI0TgBYm0e0QBx7NiPD9abGQHzGlRyyuwy7HQ5NgZU6CSYL3y129a+xpmp5dX8RFCjQoDnCFLONLllbkxC4UL4cBfWXzPjW+coX4VRiwNAR4ng== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=G+Ri0OnIn94g0sfsasntb/wfY9Ip1jUmxeT1yDBE54A=; b=XbYQ4fliniaeKUQY8V98TFNVsOvqAIeBrGY9I1/tvN6AHpMoP3XYXZkvu+TNIscNIThVjU2Vb11pN+Xo3+6x5tDQHjajjBQwo1tDlGai4oKgaxFNF/2NIPml62wmDbELJYSb+w9ornShHOZJ/0+4p/KLAVu0r2vj+vhf5Dd0Q0Y= Received: from BN0PR03CA0050.namprd03.prod.outlook.com (2603:10b6:408:e7::25) by MN6PR12MB8471.namprd12.prod.outlook.com (2603:10b6:208:473::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Thu, 1 Jun 2023 19:00:59 +0000 Received: from BN8NAM11FT027.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e7:cafe::54) by BN0PR03CA0050.outlook.office365.com (2603:10b6:408:e7::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:00:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT027.mail.protection.outlook.com (10.13.177.96) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:00:59 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Jun 2023 14:00:56 -0500 Subject: [PATCH v5 1/8] x86/resctrl: Add multiple tasks to the resctrl group at once From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:00:54 -0500 Message-ID: <168564605452.527584.8450496267087240475.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT027:EE_|MN6PR12MB8471:EE_ X-MS-Office365-Filtering-Correlation-Id: 57b0aee3-8b1c-4b07-660c-08db62d28992 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aBJ63Ky2+pJhpJHP4+xCnHBhp8jah6s4G/xxTJSJOW2KSOanjfAHBekmHFQxEga8TEavzFQiQ1PGjOwP2C5KFwoA7ovGaOYESfIickPgSrVcL/AZsElSFx/ITsaR4xzbfqRc5jDH9Jd5vMWnm8ryqzn6X6AdkGkFOXN8ZO32CeShH/o+d7dRgoSV2MXYB9czBMtNcuHT5Wk2/Nn5UOnZMyrl8pCnxLnZNEXxI/KfGgox+E/6+PovswxO846sLB/zevbQLdeZjL1SIW1T/c5LL7KtJKqsW4VmCa2eMgMRGirg461FuI0hdngHl7ByZ5hJMckv59ZWVao2tP21nmzpOxQsVdOp1zDN6BWtzEsVye54B41VQt1JnEstE1nNhHApY7oo8XB7TattrSbHyAwX7b97o+Tj3OwI7forMwQ8OB5cqJ00obI1vLS8ObLdr3Jd6KbBOdkhU3Ly3VdDXQblWzbSsnH2KYe+iJw5HD3Sxx+/bn9tnHfzhHU4v2HRQ3/alrxyT11bomXr5OpW2VNqNS4n9xVQKfh9MahM1VRZPQzoJBiNYFwtYwaO99XliTpe6ixp56KfXWTbCg02OnGUt2uLFkTDiZHs2WWvqKef+eLZeHMrhyo0aqPtsv9eSIcQ3NxOgq1C5IUXcjJgxyJZ7AP46yiVtDgqR60mpv/rlIoxcs0dtRHgFOpsth5xOTWS/QPk9nrlAttRnjoQ8wkWGs7NH4G6bCK1vGh2Z1X4R6Z376u32IhHm2Dh6r3bCgUaWWmtscHXemaP9HCjhwhekw3UKNsWtW9xVLU7myIgBDk= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(396003)(376002)(39860400002)(346002)(136003)(451199021)(46966006)(40470700004)(36840700001)(356005)(82310400005)(82740400003)(81166007)(36860700001)(47076005)(83380400001)(33716001)(70206006)(70586007)(426003)(16576012)(66899021)(4326008)(110136005)(336012)(86362001)(54906003)(103116003)(2906002)(316002)(16526019)(186003)(26005)(9686003)(44832011)(7416002)(7406005)(5660300002)(41300700001)(8676002)(8936002)(478600001)(40460700003)(40480700001)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:00:59.3159 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 57b0aee3-8b1c-4b07-660c-08db62d28992 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT027.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN6PR12MB8471 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767528331562672873?= X-GMAIL-MSGID: =?utf-8?q?1767528331562672873?= The resctrl task assignment for monitor or control group needs to be done one at a time. For example: $mount -t resctrl resctrl /sys/fs/resctrl/ $mkdir /sys/fs/resctrl/ctrl_grp1 $echo 123 > /sys/fs/resctrl/ctrl_grp1/tasks $echo 456 > /sys/fs/resctrl/ctrl_grp1/tasks $echo 789 > /sys/fs/resctrl/ctrl_grp1/tasks This is not user-friendly when dealing with hundreds of tasks. Support multiple task assignment in one command with tasks ids separated by commas. For example: $echo 123,456,789 > /sys/fs/resctrl/ctrl_grp1/tasks Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 8 +++++++- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 30 ++++++++++++++++++++---------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 387ccbcb558f..290f01aa3002 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -292,7 +292,13 @@ All groups contain the following files: "tasks": Reading this file shows the list of all tasks that belong to this group. Writing a task id to the file will add a task to the - group. If the group is a CTRL_MON group the task is removed from + group. Multiple tasks can be added by separating the task ids + with commas. Tasks will be assigned sequentially. Multiple + failures are not supported. A single failure encountered while + attempting to assign a task will cause the operation to abort. + Failures will be logged to /sys/fs/resctrl/info/last_cmd_status. + + If the group is a CTRL_MON group the task is removed from whichever previous CTRL_MON group owned the task and also from any MON group that owned the task. If the group is a MON group, then the task must already belong to the CTRL_MON parent of this diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 6ad33f355861..504137a5d31f 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -696,11 +696,10 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, char *buf, size_t nbytes, loff_t off) { struct rdtgroup *rdtgrp; + char *pid_str; int ret = 0; pid_t pid; - if (kstrtoint(strstrip(buf), 0, &pid) || pid < 0) - return -EINVAL; rdtgrp = rdtgroup_kn_lock_live(of->kn); if (!rdtgrp) { rdtgroup_kn_unlock(of->kn); @@ -708,16 +707,27 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, } rdt_last_cmd_clear(); - if (rdtgrp->mode == RDT_MODE_PSEUDO_LOCKED || - rdtgrp->mode == RDT_MODE_PSEUDO_LOCKSETUP) { - ret = -EINVAL; - rdt_last_cmd_puts("Pseudo-locking in progress\n"); - goto unlock; - } + while (buf && buf[0] != '\0') { + pid_str = strim(strsep(&buf, ",")); - ret = rdtgroup_move_task(pid, rdtgrp, of); + if (kstrtoint(pid_str, 0, &pid)) { + rdt_last_cmd_puts("Task list parsing error\n"); + ret = -EINVAL; + break; + } -unlock: + if (pid < 0) { + rdt_last_cmd_printf("Invalid pid %d value\n", pid); + ret = -EINVAL; + break; + } + + ret = rdtgroup_move_task(pid, rdtgrp, of); + if (ret) { + rdt_last_cmd_printf("Error while processing task %d\n", pid); + break; + } + } rdtgroup_kn_unlock(of->kn); return ret ?: nbytes; From patchwork Thu Jun 1 19:01:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 102157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp567027vqr; Thu, 1 Jun 2023 12:33:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5rxCxlXNpD0ukAwchgfOXGGUoYzwDxp5USO6EdiMiv6/Zz8lliWmNGfbzv3VJMzaTuyyAd X-Received: by 2002:a05:6a21:6d84:b0:10f:6529:5442 with SMTP id wl4-20020a056a216d8400b0010f65295442mr8178298pzb.49.1685647994913; Thu, 01 Jun 2023 12:33:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685647994; cv=pass; d=google.com; s=arc-20160816; b=YZ/qlyn5HvJceFcRxO5FKDtSiPOGL31+VdXKnhxUbzR2Bd+Qaqr4INIUb6VFvl3JMP usa3YDtHQTZIwWFvCk2f9oe9xOCHnfARH5x+tx2V+a04FYGcyl+P+tb2cvzF5kEbbzJn bOaH2S76ZrMwZyPDXF3WfltE44uSDgK1q7CbY4xa7taOW2KpZbDY/30gTodwwDu5f9y2 8wpqJtIcOJdHfJRe68mQFmoykgkX+2G4AWPMjcChr/tbHqGPKy3yH/SAUncSFjv0FJuX iPG2wG9TBpd3p1hC5vdwspPfs48sPNXm7opiGN8fQoY3czJSKyBCFBBRJKIps2IiB9TE 09tA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=WlnhP17pFYN7SOTt0fSv/J4PlLca4pwPzJyMFj3G0UM=; b=d8q/txrK0ixtYNtfIeXbctzw8uxRk0YFhVGjnVw+p4rNq10SNRuI5yozdvopNHH9vu nwY21lBUiHZ/tIg0vB31nk55svc2qnDVHYWL92OEgLQmHthfiwMsPIMNT5m9jUun8E2T MeC4xp8Dl+f+A+DI1cwFv37WfFdrnxTP2ySNFn4TeojQinysHRp0J2oZZaauNkmMzaMA jWKkL+N624st+UYc7+ZZN5dCTs8JuLGc7b7yCpRQhNeaIEEMAake4AmSJqY6g09cWPul IizpR6tcae69244P3zUUoX9pOefiihruTEU7+XxvFkPsUt7NjCisV9P0On9K2klWDcm6 Q1Cg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=TFpHqsR1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a63734a000000b0054294720d51si80108pgn.386.2023.06.01.12.32.59; Thu, 01 Jun 2023 12:33:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=TFpHqsR1; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232421AbjFATBV (ORCPT + 99 others); Thu, 1 Jun 2023 15:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232323AbjFATBP (ORCPT ); Thu, 1 Jun 2023 15:01:15 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2050.outbound.protection.outlook.com [40.107.244.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C5618D; Thu, 1 Jun 2023 12:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=X7xfuOtRXRmHvN4TfUjSi3R+rA9ie7cWj7kEDFEvAIa0w1I/yG3YdTRZNvST+4rD2W8Nj+RoeEph4AgpG42ee31XrO2Msb+TG7cpAbt3kn1WuHQfKkcopKgZk80fkmmis/Zi+JYNo4i/aMVMi+KyJw16URrAzPJZbzEYurmu5qrDRhvRC8Uer+vfTH28ULOJYt8Rv5ujs+1p5AU8sUFT+QkzECVPRjFx8cxlBCsgw6PyqTwSD8Hm8GXOcRDOmQ+ZIlica4WUf72OWuJLhfKOSx4ETLw4rKncJZv70scXpoIqE1xNqxb3dmExAOj3BvF5e+MRfW47CIN7+88thBxB2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WlnhP17pFYN7SOTt0fSv/J4PlLca4pwPzJyMFj3G0UM=; b=cIlmUE35IG2m9/P+//kz5wPzdY8yJ36H4wc27uB32MucNcVockE530jE6CAafglkwXw6tU/TQwhlTdE7JgufjKsuo65IYyDTgIqLj20qhhm+AK8Vod2oMG+eR3ZjKMXB4vh1IRnqtlvwSpH/cxtMTBnrH36/y5JRedYuxcGwikAfG9QA7suMn6aE/1SgqpuOO1x00hQKenxgk6NvcSawVM07gavmGJv7HGMPJ8CF1tkCiyn8aWvTwCRNyHZWEG/cDD0NtXCu73trYvmN6d40NNDRAa+f3Sq3lB/xhJtcExm3ghSL2UGJ4cqMUSy5JafZ0dPdSx4bxXvKZdLM8P+4Dw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WlnhP17pFYN7SOTt0fSv/J4PlLca4pwPzJyMFj3G0UM=; b=TFpHqsR1Kmlh9T0CjgPAmdCn40Fym317+Mkt0kbNLPdmWWN38EAslOwLXRLF4yvIzC1hQ5rFho/PrW4wxZaDyy895+71bvmAMnXe2tLsTM/xrRz0dk/MH+cx8R3EX8/0xza/AuXSaL7TpStmezvsFtCmldIGf1ScREok9cnosgc= Received: from BN9PR03CA0282.namprd03.prod.outlook.com (2603:10b6:408:f5::17) by MN0PR12MB6149.namprd12.prod.outlook.com (2603:10b6:208:3c7::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.24; Thu, 1 Jun 2023 19:01:09 +0000 Received: from BN8NAM11FT086.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f5:cafe::9a) by BN9PR03CA0282.outlook.office365.com (2603:10b6:408:f5::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:01:09 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT086.mail.protection.outlook.com (10.13.176.220) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:01:09 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Jun 2023 14:01:05 -0500 Subject: [PATCH v5 2/8] x86/resctrl: Simplify rftype flag definitions From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:01:04 -0500 Message-ID: <168564606414.527584.9565322327658331140.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT086:EE_|MN0PR12MB6149:EE_ X-MS-Office365-Filtering-Correlation-Id: 7cab67f2-1f71-4b8d-fc38-08db62d28f84 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yM0ONVZ7DoRNQs7ZA7e+MWnKelTLyRdGPp6q+Qhus9wgAdRBjWWT6WFQ4Xt1y+rb4xKC1oy2YEFDnZHQA3ccJXY+Io5RWncNRP9LaJ2EAuVoIlKH+D660ryzE6z3mu4aWcB+q56uQYQYRIQjaeabMd3FBtrgdwXgs2zkDIoVHiF7Ka5HogiplKDgKY1aXzyOcqe9K0wRjhkJhu/Tc4ppkeFoI/YJIRFXDawhUJTEGIvLnNPYejhcaQ+SQY/kOjtYfpCpM2q9DnTklXlkiGRb9daIuHE7hRAUwNijAV/noPzJ8lEopQr0Epo4wfmVFqYuS2gIW3zFnqus6G0i8OXVV9KqJBFPSDrXY+gkDKPXi/XTIfLVTJYNGaLzdgtZapuOa9luXggyzBaatqCblAvQr3GqEqU9DUWoypls7NPGOoFMY0FPDb33Exx8iDoVUPZI1GF2IpZHfExHSCIRQgCH+fjIjdVUrR5Gia+yhssvTYq3RzVOPyXTZPjl6bXRoBZtCwqABVHjV0xMA9dnW5oc/FJ9zVatjXPFT+5M9hlO46A6Ms9QfVEO3mWJziazylOqp1YE4Ky8GgFiHxkQ5jJjZOrb2Qdu/05lHD7pgG77XzDOf0tOfhDqnyUNNY2ILl/EUBEm1clLWpRGW8f9bx8MUE9cKf+jMMpXYIcjVJ/fcu33nKqFKr5fhrj8RwlgZVV0nyll362ABKyPP4+gGcUbpMgtHMXHIRLngrwq35uTtDDJSxWnBiM/nLL+yFSSFkp45r5C3JyFxTbTz7Q62/vKIDBpKxdDwAAqvi6ZbyCKVao= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(396003)(346002)(136003)(39860400002)(376002)(451199021)(36840700001)(46966006)(40470700004)(16526019)(36860700001)(2906002)(86362001)(336012)(426003)(70586007)(70206006)(81166007)(47076005)(41300700001)(186003)(4326008)(83380400001)(356005)(82740400003)(44832011)(26005)(9686003)(33716001)(8936002)(8676002)(103116003)(40460700003)(5660300002)(82310400005)(7406005)(7416002)(478600001)(40480700001)(316002)(110136005)(16576012)(54906003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:01:09.2943 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7cab67f2-1f71-4b8d-fc38-08db62d28f84 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT086.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6149 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767530031882921439?= X-GMAIL-MSGID: =?utf-8?q?1767530031882921439?= The rftype flags are bitmaps used for adding files under resctrl filesystem. Some of these bitmaps have one extra level of indirection which is not necessary. Make them all direct definition to be consistent and easier to read. Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/internal.h | 9 +++------ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 6 +++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 85ceaf9a31ac..62767774810d 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -243,12 +243,9 @@ struct rdtgroup { */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) -#define RF_CTRLSHIFT 4 -#define RF_MONSHIFT 5 -#define RF_TOPSHIFT 6 -#define RFTYPE_CTRL BIT(RF_CTRLSHIFT) -#define RFTYPE_MON BIT(RF_MONSHIFT) -#define RFTYPE_TOP BIT(RF_TOPSHIFT) +#define RFTYPE_CTRL BIT(4) +#define RFTYPE_MON BIT(5) +#define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) #define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 504137a5d31f..181612d2c84b 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3220,7 +3220,11 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn, goto out_destroy; } - files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype); + if (rtype == RDTCTRL_GROUP) + files = RFTYPE_BASE | RFTYPE_CTRL; + else + files = RFTYPE_BASE | RFTYPE_MON; + ret = rdtgroup_add_files(kn, files); if (ret) { rdt_last_cmd_puts("kernfs fill error\n"); From patchwork Thu Jun 1 19:01:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 102148 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp560714vqr; Thu, 1 Jun 2023 12:20:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4VWAS1NfuLwjAGpcdXxqRwKXYvtw6JVbzigy9r52LlSBW+Q/xKxOg6TMR0iacu134FoIYu X-Received: by 2002:a17:90b:3c8:b0:255:b068:37c0 with SMTP id go8-20020a17090b03c800b00255b06837c0mr392988pjb.5.1685647257222; Thu, 01 Jun 2023 12:20:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685647257; cv=pass; d=google.com; s=arc-20160816; b=ti4ux+8DxjO5WMwr/7FM233dAksamwcBf9RUrtiVpogUd83/1pI49Mm5MKFcFevDZ/ R2vbEOQr25S2HueEgEaE73QxUB9zBdXEcxEolD9Y/bQj1fvOoGEQ1k0qG4z0FF2NMDmI fjJZfFcjn+pdC1FcWe72zhtdeesT/+YJblKXwfLRXBrUjTSJvKHxcvEZ1fvhfiK43Uh9 6LgIQ2RupKnThsIXgLv45CJG6Qr2SSvRaQbw4CWHLLnJLw6/wXbgt2yBPswDaW/fTIS3 nsCdz83RToFET2pk+nqSrUuiSKD+vwIQkV3iVbMGdzYkfg2QUb7xpDsG77BTJ7pUb6O9 t84w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=uX88MpTyUE+PNaifsspcaB6+7j91LsUzb3hkIMAJ6K8=; b=ahCu3WxfJRN9DEKo9jhTQAKkEzzHEbveZiD0yeGsLAx3FtHNejEGX8xMC89ORYWNuy 78ScGNTuxxEn7e3kwo7JX/fRWQN5FNjsi0mArI/m2U9ucShkhrDOSjU2ZiILE5yfCOMb PWxaLYiwMkqnMFIt51tIsjRtKOI2LKBCX9OswIvQuChvS1YOexvSjeR4yBo80QKsSNDD ltm1bj9Z7nl/M64Jy9w4FxZEG7GATWMtzHsv/Xit5BMddC4KZuUuNDdmckYAGioWZaSM 6dNL6DGbvd1gIK6aO9WwSFFqnd0vHCspCYFxiY911agYI6Co2iW7ro6kO58Zz+A2Yefh YaPQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Jt8GS9vz; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm10-20020a17090b3eca00b002508889985fsi1577922pjb.95.2023.06.01.12.20.44; Thu, 01 Jun 2023 12:20:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=Jt8GS9vz; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232616AbjFATBx (ORCPT + 99 others); Thu, 1 Jun 2023 15:01:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232524AbjFATBq (ORCPT ); Thu, 1 Jun 2023 15:01:46 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2085.outbound.protection.outlook.com [40.107.212.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7A1818D; Thu, 1 Jun 2023 12:01:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UtfrsZjWS+/mb8WOyPmqoGBEj73z6WJQNy1ilI9kxiAaX5Br9RakQ5dBA5Vkf4+fALZqqIG7PNDxsoboh4STTRmvZ2NNUvEUuXjzkFgOSNgBayRWMUYbpm/CmajIrjD1hob+f+4GpKOKqoMl+hSc4APC/gUCTT1zUU10se8npA/q6VeHs8urer0FNYMJG1rtkqIeDMDoha15gSXAmmhuYfDfHPTi8gAvp3jsAI+fthVD1i7c15Ht63M20LTNG7GNemhp7uf5nvZusqTTIBKwEtKSGJ7WDRXr9gjGWKg/ID0bz81ci1kMbIMObq9ZZVNgH8ZdiDrME48Fa+hj6iJaSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uX88MpTyUE+PNaifsspcaB6+7j91LsUzb3hkIMAJ6K8=; b=nXLRMTIcV42nC/Yrz3wUKm/ufSyrNDHu1NOLrL/nYWKJXcoGJMp/+w+UMfnXaFMWvcbZCkGj6IVYUGfHjFjJLQ7FBzl22K/ErrWRQaaDV5mNdB9tLaHNDx3rp1dKV0dHP9gXohKMy56gtFhOj6c5oWciEdXGKxOkTqjIpNLnBp5WhOAPX3VI2is7xR/fZdUggFv/542G6PEhsEWECrqA0z30N5e2roI3H0wLBt3/XGG/sguZWUZKDTATu5NnJnsvDGf/e4Je9YpaNe+6Jls9hmAPOns2AD8LtEHMgVRXmSz6dUMrH0e2pgSvW1RbPRMZjHktfP2ouvTnPnju0EaOJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=uX88MpTyUE+PNaifsspcaB6+7j91LsUzb3hkIMAJ6K8=; b=Jt8GS9vzXZVThvcEYdE4KB97caUQ7YXlHzUPv2FT9bzppEA3OxMVuXVaSaVw8lqHRWZUBx43/2P+TH5mwhMOHaaG5sRUCL+FIMhidL76m7piFmYKcGi2Cksu/bxMClPSphEO/Yfm4uU1cHSq2ToQk4gS97FwYMuWP6ec7hfiHhA= Received: from BN9PR03CA0608.namprd03.prod.outlook.com (2603:10b6:408:106::13) by DM4PR12MB7744.namprd12.prod.outlook.com (2603:10b6:8:100::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.26; Thu, 1 Jun 2023 19:01:27 +0000 Received: from BN8NAM11FT008.eop-nam11.prod.protection.outlook.com (2603:10b6:408:106:cafe::76) by BN9PR03CA0608.outlook.office365.com (2603:10b6:408:106::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.31 via Frontend Transport; Thu, 1 Jun 2023 19:01:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT008.mail.protection.outlook.com (10.13.177.95) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.24 via Frontend Transport; Thu, 1 Jun 2023 19:01:27 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Jun 2023 14:01:14 -0500 Subject: [PATCH v5 3/8] x86/resctrl: Rename rftype flags for consistency From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:01:12 -0500 Message-ID: <168564607296.527584.16017427105138548499.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT008:EE_|DM4PR12MB7744:EE_ X-MS-Office365-Filtering-Correlation-Id: b0bd7900-fa28-473d-69bc-08db62d29a6a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uiTidZZ+o2ceNqrcrBRY+TirvkDi7o4bL2e5DZjE7KszIYL9VvgVkalfiLCRu9KSerGo49V2Yf4I0F9CEQNqjsdg7jX7/ho/A3+dE6dAdG/+RoRZTWdCUpI+bNIANiSy0FXY9v2Feeq9QLdOa198DMFhYPMot9kD4GTdis5SypVJBn9PdUOIbGb/oAxC0ZgkkrJbrvJH8M1YIINyU+7e3mcbIfPxSVJD1wynEXbQwtfhc3imH3KuuI1kfjYdaV8AJgQoMu4NXZ6cdGu5315XGU3iLLIyiaNATPzVJQC2mlbCUXykyShnZNiPuJ+twtcUl2rcgCstpHhGE8fxCqYA0OjLiPJos0Ce3y7Dua+oisE8aOfzjHAoRWgBSMaBkPYsJiF0uJ6vyoGQz0WEfORCV7LB+8PL/LVx2cmd6AydRd6Djdpfe6LPL3N6JbmzHgZgD0j3+PoRePtSPdLtOpusQRuc3X3ApuU1MwmbI5G59iquzcvD5QsJ6UuxzoINdE2z9435XFbCyaFVnN8bBlBzlMRUOtqE/tiATZPlulB8x9KLJGTqXz709Wrhzycric0MYJE64k+0MVonWbQl88dbmVzqcCyn8j6keqPCcnz2a9EQF47+dtdnI0sHHNu6je6HO28R+ThyGTbAkkUwd5IMizcbAOoDVQMBFdIi2TSz1+PJLlMB0YEl22RmSGnMqRmJU+amoICMoCSAVGsqmcZkT97s7EbZo5sbNTQW+7MyB/6JTqjygaf+q051XCQKqxrWuDUIXjnq8ihQ68g/KCvHWI8N3DRHFWd4Qk7B0ZBupBw= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(396003)(136003)(376002)(346002)(39860400002)(451199021)(40470700004)(36840700001)(46966006)(81166007)(336012)(356005)(82740400003)(26005)(83380400001)(9686003)(40480700001)(426003)(186003)(16526019)(47076005)(36860700001)(103116003)(8676002)(2906002)(7406005)(7416002)(5660300002)(8936002)(44832011)(478600001)(316002)(40460700003)(4326008)(110136005)(41300700001)(16576012)(70206006)(70586007)(54906003)(86362001)(33716001)(82310400005)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:01:27.5907 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0bd7900-fa28-473d-69bc-08db62d29a6a X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT008.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7744 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767529258282921779?= X-GMAIL-MSGID: =?utf-8?q?1767529258282921779?= resctrl associates rftype flags with its files so that files can be chosen based on the resource, whether it is info or base, and if it is control or monitor type file. These flags use the RF_ as well as RFTYPE_ prefixes. Change the prefix to RFTYPE_ for all these flags to be consistent. Signed-off-by: Babu Moger Reviewed-by: Reinette Chatre --- arch/x86/kernel/cpu/resctrl/internal.h | 10 ++++---- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 42 ++++++++++++++++---------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 62767774810d..2051179a3b91 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -248,10 +248,10 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) -#define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) -#define RF_MON_INFO (RFTYPE_INFO | RFTYPE_MON) -#define RF_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) -#define RF_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) +#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) +#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) +#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) +#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL) /* List of all resource groups */ extern struct list_head rdt_all_groups; @@ -267,7 +267,7 @@ void __exit rdtgroup_exit(void); * @mode: Access mode * @kf_ops: File operations * @flags: File specific RFTYPE_FLAGS_* flags - * @fflags: File specific RF_* or RFTYPE_* flags + * @fflags: File specific RFTYPE_* flags * @seq_show: Show content of the file * @write: Write to the file */ diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 181612d2c84b..baed20b2d788 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1692,77 +1692,77 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_last_cmd_status_show, - .fflags = RF_TOP_INFO, + .fflags = RFTYPE_TOP_INFO, }, { .name = "num_closids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_closids_show, - .fflags = RF_CTRL_INFO, + .fflags = RFTYPE_CTRL_INFO, }, { .name = "mon_features", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_mon_features_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "num_rmids", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_num_rmids_show, - .fflags = RF_MON_INFO, + .fflags = RFTYPE_MON_INFO, }, { .name = "cbm_mask", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_default_ctrl_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_cbm_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_cbm_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "shareable_bits", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_shareable_bits_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "bit_usage", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bit_usage_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, { .name = "min_bandwidth", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_min_bw_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "bandwidth_gran", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_bw_gran_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, { .name = "delay_linear", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdt_delay_linear_show, - .fflags = RF_CTRL_INFO | RFTYPE_RES_MB, + .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB, }, /* * Platform specific which (if any) capabilities are provided by @@ -1781,7 +1781,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = max_threshold_occ_write, .seq_show = max_threshold_occ_show, - .fflags = RF_MON_INFO | RFTYPE_RES_CACHE, + .fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE, }, { .name = "mbm_total_bytes_config", @@ -1828,7 +1828,7 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_schemata_write, .seq_show = rdtgroup_schemata_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "mode", @@ -1836,14 +1836,14 @@ static struct rftype res_common_files[] = { .kf_ops = &rdtgroup_kf_single_ops, .write = rdtgroup_mode_write, .seq_show = rdtgroup_mode_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, { .name = "size", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_size_show, - .fflags = RF_CTRL_BASE, + .fflags = RFTYPE_CTRL_BASE, }, }; @@ -1900,7 +1900,7 @@ void __init thread_throttle_mode_init(void) if (!rft) return; - rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB; + rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB; } void __init mbm_config_rftype_init(const char *config) @@ -1909,7 +1909,7 @@ void __init mbm_config_rftype_init(const char *config) rft = rdtgroup_get_rftype_by_name(config); if (rft) - rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE; + rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE; } /** @@ -2044,21 +2044,21 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn) if (IS_ERR(kn_info)) return PTR_ERR(kn_info); - ret = rdtgroup_add_files(kn_info, RF_TOP_INFO); + ret = rdtgroup_add_files(kn_info, RFTYPE_TOP_INFO); if (ret) goto out_destroy; /* loop over enabled controls, these are all alloc_capable */ list_for_each_entry(s, &resctrl_schema_all, list) { r = s->res; - fflags = r->fflags | RF_CTRL_INFO; + fflags = r->fflags | RFTYPE_CTRL_INFO; ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags); if (ret) goto out_destroy; } for_each_mon_capable_rdt_resource(r) { - fflags = r->fflags | RF_MON_INFO; + fflags = r->fflags | RFTYPE_MON_INFO; sprintf(name, "%s_MON", r->name); ret = rdtgroup_mkdir_info_resdir(r, name, fflags); if (ret) @@ -3559,7 +3559,7 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RF_CTRL_BASE); + ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); if (ret) { kernfs_destroy_root(rdt_root); goto out; From patchwork Thu Jun 1 19:01:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 102147 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp560527vqr; Thu, 1 Jun 2023 12:20:34 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6nzuZ/Ovm0M4qXZ2X5l6eSrGGFD2zMADchTzFQt6WOeJhEYPGK0bdKKWV1mCsm98FogqUh X-Received: by 2002:a17:90a:d702:b0:24e:3b69:a87f with SMTP id y2-20020a17090ad70200b0024e3b69a87fmr290353pju.25.1685647234412; Thu, 01 Jun 2023 12:20:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685647234; cv=pass; d=google.com; s=arc-20160816; b=oljagMr9NDdyoYK8jLONT/+q9qiPwpxqx/pxOxGA36PuCHO5fZ5hTv5mtHlY4Vr9dO TwEtHsqZ6iDVXMP8KMhquxpjbonyXYW6AGBkxKq3L4c2hqlCb5uZ7h89IJL58bVgHJ2B 8Odd1eUIe3N8yT1gB7/UVOo++VLsBhCnP/rE1oB/vaec8FkuyY+jvzh61eFwoa0ktXOk whtfkmKtJc1H1+pTJKfQCCANRZerjM4mh4w/hf6j2L+EVTvviNMyFdgUyPpXOfaWhR/Y 57Xsbg0GyfU6ktC06aF5qTvUtsWyWYUgShqV1e1ipoEJHK1u+o625q86HF+R8kQZpaGv uRwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=qoVa02dLFHualE+BoKCmgPQ9TgNP0FupFOQWvV33T20=; b=B/Ji/E1atajzid6v1zmDGLnmb05WWHRQGn6zLPLV2lUtize6Ok3PBAwZMM9QUFI72J FSC+J6jF37h/dqFD8B7njuz6p8cmOcKDnQj7nEwO/9PA7UwtvfJvnl8sHq/oQSDNuB/B 8kK+SfihJmOTcy7e9PCfbhbO1Qkt1FH2BGjSGox7pozAW7luf1dNlN6ZWbQuagqUpWK5 VPCPoZMH81KnCHdaGGbPvCbz6zhUPSOD3vGuUnnJtxDIowQVkCT1q3sCNtINJ6ln7cHW uaIZFjVjT3n0a8hgaN/3BMg6D1SL7H57yEm6TAb5Pw0eApIq1oyP0nEPsaRUeCK+mUN2 Rc6w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=qCoOP3FI; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rm10-20020a17090b3eca00b002508889985fsi1577922pjb.95.2023.06.01.12.20.21; Thu, 01 Jun 2023 12:20:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=qCoOP3FI; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232579AbjFATB4 (ORCPT + 99 others); Thu, 1 Jun 2023 15:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231994AbjFATBv (ORCPT ); Thu, 1 Jun 2023 15:01:51 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2062.outbound.protection.outlook.com [40.107.100.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D774E48; Thu, 1 Jun 2023 12:01:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ehUxeGvyoQXvp66xMnH1dCyap0VKIDzwaCCjVe/M6W0fzwBSVVMvgEYvEW3D1m4dbJDhplfWiXBNUdHv4ITSgNOEUMEe865tBiSv1U25n5LblecW5u0/woHhgWhx5uJbrevh/hDKdi/F3cD5X/oYeuQHX9x4n7/aSesHjGpE7Z8wCstWD67Grtsl0VqlI5PldIcWF5t6nBwophiVnxDKVeFQ/gogrt3tnsX+l1xv7VCP67Yw/cyd4GN3CDvmgm8TNrPZtYXX83aAPVP/xXqlSmMr8AFhh80Lhhzt/2zBL5WSyCU8HcFVakIfw87r6UhqmSjgDRGaJ5ih5xdiIReTxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qoVa02dLFHualE+BoKCmgPQ9TgNP0FupFOQWvV33T20=; b=D25libUkwKM2E+oxP3SwXRsB9MS5l7gYzQWkOO94q8xP1GmjrdCwKv0OAEekbB5lyffvQGkhn1fiEu8snI9mIecQKtop+gcZTNPmz9qSQzlZZocyCbgqyCIJietcZI7CkKQKZvcQ0mIESSfwPeoTWZhwCwxobZtJoNfp8iYv3WBZO3iOFi5HHs6ED8WHgH6SX2mVWQTN/CBhQw7SGGRpKSX2e5WJJQuNrkYorqVDtVJnW47bBshQpLsHR6iZei2PAHiASUZ3M62UC7i+ddvnM2k+QF9e61iu0rRIHXVdiahmvURk34YStym+353Lc8nzIgXr8JJKdi4b51Axof4jlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qoVa02dLFHualE+BoKCmgPQ9TgNP0FupFOQWvV33T20=; b=qCoOP3FI0bKZj5Dr4P84pFbdWLwyl5FeR8mooCKXNyR8u7ByU7vDYPFOXf+cdoh7Ly4/nGaqdYUBVfCjI8/9WGw4q3Oeu25smRA+k5UJs5bSpWrFoerhAGA3ktpmMmONQj6fNKjxcqRL3uDbUYHj0XZQbcWwRtlutlBMo3WE7Kg= Received: from BN9PR03CA0674.namprd03.prod.outlook.com (2603:10b6:408:10e::19) by IA1PR12MB6235.namprd12.prod.outlook.com (2603:10b6:208:3e5::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23; Thu, 1 Jun 2023 19:01:36 +0000 Received: from BN8NAM11FT081.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10e:cafe::68) by BN9PR03CA0674.outlook.office365.com (2603:10b6:408:10e::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:01:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT081.mail.protection.outlook.com (10.13.177.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.24 via Frontend Transport; Thu, 1 Jun 2023 19:01:36 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Jun 2023 14:01:33 -0500 Subject: [PATCH v5 4/8] x86/resctrl: Add comments on RFTYPE flags hierarchy From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:01:31 -0500 Message-ID: <168564609148.527584.17320328540832247657.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT081:EE_|IA1PR12MB6235:EE_ X-MS-Office365-Filtering-Correlation-Id: 9eaaa9a9-b9b5-4f65-b0ce-08db62d29f7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zJ2WtJ7bvgw/5qWAXxu/XOMx5+bWeMQmIvSj59pr+W9G7crDcztDsddaVSyAYjtKbixHAXHVL9RwlCcpsDPcNST/TdatgFbn/IvWQkTn7u3h6UDwuUwrz3EENZCYoJtwd9Uev/oV4gcw9uJQnf5gavikl3wGnn9dh3bYtf89nh/wPgZCu5UOJDpayt1yBf57QVFpzOlRmwgLdbFPTW9HgU8+gsd9EEUAFvpBOsMumGZ7G4AyJcFmouxupR0T8uHyM5HbzR5Yq+gmgZH2BwnYzaozLgKWPE250Ykao/yKZudAQP5Vo2AMomZEGHxMhVVqQW4mgoizzjd7A/pzWYe7JOPRwSvkZiUCL6UZj9cZalg1FZR8Ve4hTVMB1h0ES6R0hxK8WqZvCF+pnCDdlsxWcn73tPFIQc8RfYv3Nn0AgOodahIpPmCllv+1VL3GSCAyqjsmJ61NRmFwSDvDK6AKy2zNKTcSzrcLSmzK3mSmMfmWguOw++rZzTnG74jjVrVVWypXHKQjqFZbR2mCnzCSDGahwX7e0JP6xX6aeRpHJyP8XlQMXNL77oOxObnrWw+qUAmW/fmKwk5ZJdfqXxOTn0PXDkovrGh4f+LzCVGo703a/xMLCRYxVPUGdt2TDachWF/Buw9mP+AjCw3D3COOjUB619mTX//YVmUfhI6Z+a7VI+8EvFhKnoIUmNtQY82UYHlFX8YqOcu81tZx6jGZFdsROOqKRZUhpdZAiWL09HIKNOyHEFJainAdH5AeFU81hxDgBY/YADHzkHumNF5mZCnGtUre8Zimy3MzyoHxh8s= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(136003)(39860400002)(346002)(376002)(396003)(451199021)(46966006)(36840700001)(40470700004)(103116003)(33716001)(478600001)(47076005)(40480700001)(9686003)(26005)(186003)(16526019)(426003)(336012)(36860700001)(40460700003)(41300700001)(4326008)(356005)(81166007)(70586007)(70206006)(82740400003)(316002)(82310400005)(44832011)(7416002)(7406005)(86362001)(2906002)(5660300002)(8936002)(8676002)(16576012)(54906003)(110136005)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:01:36.0679 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9eaaa9a9-b9b5-4f65-b0ce-08db62d29f7c X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT081.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6235 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767529234208019804?= X-GMAIL-MSGID: =?utf-8?q?1767529234208019804?= resctrl uses RFTYPE flags for creating resctrl directory structure. Definitions and directory structures are not documented. Add comments to improve the readability and help future additions. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 45 ++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 2051179a3b91..c20cd6acb7a3 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -240,6 +240,51 @@ struct rdtgroup { /* * Define the file type flags for base and info directories. + * + * RESCTRL filesystem has two main components + * a. info + * b. base + * + * /sys/fs/resctrl/ + * | + * --> info (directory and provides details on control + * | and monitoring resources) + * | + * --> base (Lists the files and information to interact with control + * or monitor groups. Provides details on default control + * group when filesystem is created. There is no directory + * with name base) + * + * info structure + * ------------------------------------------------------------- + * --> RFTYPE_INFO + * --> directory + * --> RFTYPE_TOP_INFO + * Files: last_cmd_status + * + * --> RFTYPE_MON_INFO + * --> directory + * Files: max_threshold_occupancy, mbm_local_bytes_config, + * mbm_total_bytes_config, mon_features, num_rmids + * + * --> RFTYPE_CTRL_INFO + * --> RFTYPE_RES_CACHE + * --> directory + * Files: bit_usage, cbm_mask, min_cbm_bits, + * num_closids, shareable_bits + * + * --> RFTYPE_RES_MB + * --> directory + * Files: bandwidth_gran, delay_linear, min_bandwidth, + * num_closids + * + * base structure + * ----------------------------------------------------------- + * --> RFTYPE_BASE (Files common for both MON and CTRL groups) + * Files: cpus, cpus_list, tasks + * + * --> RFTYPE_CTRL_BASE (Files only for CTRL group) + * Files: mode, schemata, size */ #define RFTYPE_INFO BIT(0) #define RFTYPE_BASE BIT(1) From patchwork Thu Jun 1 19:01:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 102158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp567096vqr; Thu, 1 Jun 2023 12:33:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7UaZaGd5tjqBbkAi/6jg1GDqbqDurzv04p5HgAq4iQNRhvDXeZz+GeeCMAsscxB/tB4sVb X-Received: by 2002:a05:6a20:a120:b0:10f:3d02:863 with SMTP id q32-20020a056a20a12000b0010f3d020863mr9112600pzk.9.1685648004659; Thu, 01 Jun 2023 12:33:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685648004; cv=pass; d=google.com; s=arc-20160816; b=s4ysHD7zo94xOJ11L1qAtU8rjUq3J5jd93r9uhkaqJ4gmcTPjgMvvloKzcr9B59TV6 d96hRGCx8SFbkd+oGmPJYF3GFNBJvKgT0ES5layPSikrubgX9uWkrB4KN0uz4d8TzwKJ LowEv0KR4gXoHCnQDt26eu1Wg3JftyFG2lv3IQbiY/0G9A0C8RshUcIbuBzHI8bzMgTX FJZHqRjmSTyenyIwIfxPT/PRyGDdpsOk8ImmABKwGzNr7wLq+fLhOS+/XnwliNoKFzkT IqLOI6kLEpn2y9fCE1rPvZrEe+58p3CWQc7ZDFILhwu/VuFqju2tDzQnL3FkJf+FvtIE dIMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=sM+u9qPh9p1d/oY1rC3cLQAN+jtCywVZGoNJo2u42+Q=; b=GIEczlYIK++37qdkWIM/eaglC69BxdKLj6aimDFTgADQ4pgc0FIwmrQu3xW/XjfbmT YKWOJkjIcLVX9WvC3XBtTTD3wxQdMajEPyXwe3xJxwoVYCOEaQXv1myT5KjM+wgUzAhM s/nrH9exRfmn7s/owTtu4xRsZzUAoBPNbVYtqwGlx2o0ojHgJGa9PtoxNkWv7/Q5zign GmswHkmolAuZguqn0jLZ05iMP8HrlRIXiEfxorLkZkqNNaTpQbwuJ7IMNLmafvSAJxnm NaFKopW/hN9pXDTAc983hdRj0I25F+NBygHkQHTKvfZq7NieLVAOGNEqbziBDC4y7t0E rqXg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=DZFBtwZw; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a636f02000000b0053fb8976fa3si3309603pgc.431.2023.06.01.12.33.10; Thu, 01 Jun 2023 12:33:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=DZFBtwZw; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231493AbjFATCK (ORCPT + 99 others); Thu, 1 Jun 2023 15:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbjFATCF (ORCPT ); Thu, 1 Jun 2023 15:02:05 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2075.outbound.protection.outlook.com [40.107.243.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB7CE13E; Thu, 1 Jun 2023 12:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HB0kH+/h5zfhsRMnWFNZCfpVpdpe3WN9igjZ8+EWjD6haeamK96kdxu6yqbzea+MoUQD2xE2FOeXgZRyR4DxSBL9v7r/OvJDCr5thXYCkx5WZVBxrT3kDFTU9J1HHdbENPaeoiGeuUKkdO9VOMkjpOLaR12spVM8bCNRl5PxePuLZ5tIos/xFK3SnLCStT/idq74nMxmCdMlBzQNhdYIl4vDbbz3YVoGDCk5ggad6I5TCAJlAWOFn9T6hCtI9cEueVPrf52zISVMFStTuBeYtmHM1XieyNN9yikfCe7ouKkf9BIfh3C7LvIPW/iOqt+6bi2HQsIRCBTqMO+dggnS6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=sM+u9qPh9p1d/oY1rC3cLQAN+jtCywVZGoNJo2u42+Q=; b=NyCNfYYhpoS2It8t66+VohiUgUdL6YFH2ytdzoYw8LEn8I4x5TeR5uTpfNlPjA1B+wuIJMPFWCCvylkZtz+3201gXxmk4pgWl9KaDkFTyLAIiQUtXjrf6HLO1cA6XyUK9WYc/2MFMRafcVllbEfw/GixN/LEUSN01THlihSDP4xUlm3/EIOnn2O24e2tPCuquuMN4YaoYfvvePyfpNCPzFY6aAsR7N7G2XIJBbwXIM9P1La5LCD44kZRnS6NtNf9N0xGaCRLrKK2Le5B82GXK6u2u6Rl5UT+l4zWritrIgFIhyUh1xUPYmduwUo15R2gpgevmH6VodERrkd7f1Jmqg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sM+u9qPh9p1d/oY1rC3cLQAN+jtCywVZGoNJo2u42+Q=; b=DZFBtwZwfAF7wkimePycfQwPhy76tZQPOP5kjhJqFiy0v05pM/TjWXhSAQ9ryumEiNb0LPrdEiSxXEnEZUb2bEAWe4Of6BbPYu1WQG61+XoZVwGHlyRCgudtc2kl/D9+McUr3B8fD4KVXtQv0MIIwSC3k0HWGKJnfTFNrGsep2k= Received: from BN9PR03CA0543.namprd03.prod.outlook.com (2603:10b6:408:138::8) by SA1PR12MB8723.namprd12.prod.outlook.com (2603:10b6:806:385::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Thu, 1 Jun 2023 19:01:48 +0000 Received: from BN8NAM11FT010.eop-nam11.prod.protection.outlook.com (2603:10b6:408:138:cafe::c2) by BN9PR03CA0543.outlook.office365.com (2603:10b6:408:138::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:01:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT010.mail.protection.outlook.com (10.13.177.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.24 via Frontend Transport; Thu, 1 Jun 2023 19:01:47 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Jun 2023 14:01:42 -0500 Subject: [PATCH v5 5/8] x86/resctrl: Introduce "-o debug" mount option From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:01:40 -0500 Message-ID: <168564610093.527584.3413729327027786408.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT010:EE_|SA1PR12MB8723:EE_ X-MS-Office365-Filtering-Correlation-Id: 8c52d751-95b0-4b64-2aee-08db62d2a621 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kvNK7/yy2hIB8Iob0KMsqRvfxhuIYdnQ9JmcJtLpDoHl+zGq8N8YldUbTmq/CW2xrNkQ2oEy8rAgc1Zx/bD7d46G2ofdxom1we38T9n6F2WM/x/lEB69HWWGkSo8bRa3sFjD2v50qux2F6TmSIJk88/2emYpQ9oihIPe6xYDn6dNIikb2M2GbPhXUrstK39LnkxZ4z+UdgzjQsSVGb1RSnVXjcIkyAVuXiNI9TSl6Zenu/45o9eiO2tBDFD2aLJ3Mr/AYL25ygQ2QA8HsVFFidv4o7ZWsPSPPq6b+5Lf4HjWdwvcfaJHA5Swo+uUbHL6qZ1uXEYloN7i6OFYL+ez6I3wI4itjNwni9xSnuYG7SyTNmvohsZKHkxjnm5kSR/l5H33Iu/EkUyVRrv5mOkUTUFxvWCnW4s/pqoWSYasQdy9wNlvRdjFoxYi74FXhElfjXYgqlfEaIeQSYPPReMF96azneSq/Xf9+f2DM9BtX6zYCfeaei12MYssScxNQGWmmUlcHZKQV+77PldZuaFt2JSBlguPt134SllimYYJRjusx11mo4LFvhezCC6UPFtJbt/QayINRbi5eltk4l7UBkXG2xGllah1g0oIxbJGy6fKXc/8w29vBLMV593HTTFmnam5nNWsHPvxS/pnIxUJp/cvBVkTGxBrLZDIp6HBzGfLbyQlNswYgo6YfCBxDJHNhudeF9PdPquBt9j8PcAoxPb+1pcIybgZ9pGyFFDwq2o1ewIs5+AN1MXqSgvPXSDAjMt5BlLf9l7SqVxrYUp3aWj78a/xB5KCTl/6CPilBEk= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(346002)(376002)(396003)(136003)(39860400002)(451199021)(40470700004)(46966006)(36840700001)(81166007)(82740400003)(36860700001)(356005)(47076005)(83380400001)(33716001)(70206006)(426003)(86362001)(4326008)(70586007)(54906003)(336012)(110136005)(16576012)(82310400005)(103116003)(2906002)(186003)(16526019)(316002)(26005)(9686003)(44832011)(5660300002)(41300700001)(8936002)(7416002)(7406005)(478600001)(8676002)(40480700001)(40460700003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:01:47.2277 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8c52d751-95b0-4b64-2aee-08db62d2a621 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT010.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8723 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767530042277826339?= X-GMAIL-MSGID: =?utf-8?q?1767530042277826339?= Add "-o debug" option to mount resctrl filesystem in debug mode. This option can be used for adding extra files to help debug resctrl issues. For example, hardware uses CLOSID and RMIDs to control and monitor resctrl resources. These numbers are not visible to the user. These details can help to debug issues. Debug option provides a method to add these files to resctrl. Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 3 +++ arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 290f01aa3002..afdee4d1f691 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -46,6 +46,9 @@ mount options are: "mba_MBps": Enable the MBA Software Controller(mba_sc) to specify MBA bandwidth in MBps +"debug": + Make debug files accessible. Available debug files are annotated with + "Available only with debug option". L2 and L3 CDP are controlled separately. diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index c20cd6acb7a3..c07c6517d856 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -59,6 +59,7 @@ struct rdt_fs_context { bool enable_cdpl2; bool enable_cdpl3; bool enable_mba_mbps; + bool enable_debug; }; static inline struct rdt_fs_context *rdt_fc2context(struct fs_context *fc) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index baed20b2d788..be91dea5f927 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -56,6 +56,8 @@ static char last_cmd_status_buf[512]; struct dentry *debugfs_resctrl; +static bool resctrl_debug; + void rdt_last_cmd_clear(void) { lockdep_assert_held(&rdtgroup_mutex); @@ -2368,6 +2370,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) if (!ret && ctx->enable_mba_mbps) ret = set_mba_sc(true); + if (!ret && ctx->enable_debug) + resctrl_debug = true; + return ret; } @@ -2556,6 +2561,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2563,6 +2569,7 @@ static const struct fs_parameter_spec rdt_fs_parameters[] = { fsparam_flag("cdp", Opt_cdp), fsparam_flag("cdpl2", Opt_cdpl2), fsparam_flag("mba_MBps", Opt_mba_mbps), + fsparam_flag("debug", Opt_debug), {} }; @@ -2588,6 +2595,9 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) return -EINVAL; ctx->enable_mba_mbps = true; return 0; + case Opt_debug: + ctx->enable_debug = true; + return 0; } return -EINVAL; @@ -2778,6 +2788,8 @@ static void rdt_kill_sb(struct super_block *sb) set_mba_sc(false); + resctrl_debug = false; + /*Put everything back to default values. */ for_each_alloc_capable_rdt_resource(r) reset_all_ctrls(r); @@ -3530,6 +3542,9 @@ static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf) if (is_mba_sc(&rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl)) seq_puts(seq, ",mba_MBps"); + if (resctrl_debug) + seq_puts(seq, ",debug"); + return 0; } From patchwork Thu Jun 1 19:01:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 102154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp564867vqr; Thu, 1 Jun 2023 12:29:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MVUC/mf7QPFcNXuo1W1sFCR3DvjQQsWdYzl+6mNQPKTqn6b6aqAK0K8gd2TmL1KJfPeLU X-Received: by 2002:a17:90b:93:b0:256:959f:3443 with SMTP id bb19-20020a17090b009300b00256959f3443mr308527pjb.25.1685647776076; Thu, 01 Jun 2023 12:29:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685647776; cv=pass; d=google.com; s=arc-20160816; b=walirs2gUPcY4DNVN08MxNnQBON6iLMaPk4CMnRKgwcQ4OnRnB39xrsYIQht4gA2Y2 iV0lKXjgOBO+Ht11zXUgDc/Ht8jEYEH/qSjd6MmuoKwLbjYWG3LYnIB8sk0AUuYA0pLl rYdYD2DvkSVxmdTixxJqpgY71whqxdped9/qwpUPVepubhQEMsQqYl7h1G043NXR3XCy ZJSIS+kxbMWguy3fSXBkNvI+IBIxW8V+lyXxc+2jCbLJTUOhsBjzzK8GYZ+VbUvpaBZi k665w1erouiWDgjZaIhzWkgj+ofC6WZRp1XMXXq+Bd7GS0Wy/AB5dzbc9Ad98TNfvAPZ ClLg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=Pc7gUMeTIQG06bGDJbpD3jGGCpa1NF77PZ/v+V6CXYs=; b=lJB4mtQdwcH0V/CjQby4Fp8A1Qlvr+8qErLHbmwe+XOxMkrQwL6fA18ZfBeQ7j5pTo fXmnRdcHFn9uGP9qDuHckK2EWT7jdH5cvZrsgXLEOxyXKyFkCatmeCW2BMuF7BrxTPDM MKV4xPEyxo/icImzlPI0DL8+NceV0dgcvv5vIyBn7xylnrMkuiGYP059MbRa5BzrA9dS TkJSpHkLxAwFaJBwbdRnK9+Idr7+sHWvMS7TXfI0AZrwLL4qiVgFbKQNbK5QzfFGZ8eW x3l6RBQgfXVLVVs3T54ecx9fpv0o9DkCaJyUttoP1OqC8Ti+SkHcaWjHw8sYQ5ldVRH0 +FmQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RPQAelQR; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l26-20020a63701a000000b00534919e40fcsi3295579pgc.626.2023.06.01.12.29.21; Thu, 01 Jun 2023 12:29:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RPQAelQR; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232885AbjFATC0 (ORCPT + 99 others); Thu, 1 Jun 2023 15:02:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232663AbjFATCR (ORCPT ); Thu, 1 Jun 2023 15:02:17 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2060.outbound.protection.outlook.com [40.107.94.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31011B8; Thu, 1 Jun 2023 12:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q+GjEAZG90EUMswPrruQtJ7h/myQN6aRYaiCiMgr1Ql5V5k7xG6cp7AS+30Ij+cRN0VZtiDzgFEwSxV+Kc/J4ezia0rdakXCFfgw3oyKycloUni7+1/fj0gvjbc8NYgOEccua701M4/X3t8LF3snyr4fWnlrtOgA4UONyOxYyH2AzB7f6yfa0dqKosw5fEzWcwITfMd+rX+TfLD5iueJdy0X1c/SP7Sj1T/aaKodAg+r3EmjWy1IF8W77GrzFneMUsm7l/VHahvqQbuQ3zSJSt4po+bGYhSG1zSKVkZEk6bjhu1mMQ2GYVs6Qj4sQrrTNwtbHwNIwAqGTP5k6SwEpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Pc7gUMeTIQG06bGDJbpD3jGGCpa1NF77PZ/v+V6CXYs=; b=NDGEBoag0QrlgzGPCYpNUaakVDmnow6z7QjARnHebvRXj1Lq1oECk11aZ5ffTgMLY7XTkXd4RkL4vasOh1EeA3/tyGw26Lr3VJtzwJw3XIfblu3gnlxKSlS3BfBAFDpINyDGRf5eJ2W89rJhWR2qFJeeOBQtkl0kGProwffNNYvrle3OxhvfPB5e901aci0EQT/JTdXf1dpqblC8fYyKMe3v3RNHS4Ah7fB9pKYejhOsES/uOlFYT34fRm7obs3Z4PVPTnpxQvJ/KHlzBdBadIMfJVhOMd16kdN+QHNZ2lsUvBfS0E/apLdashgVQhfmC+ng7ZoNGQdPIoW/zhwmGw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Pc7gUMeTIQG06bGDJbpD3jGGCpa1NF77PZ/v+V6CXYs=; b=RPQAelQR3wf5eluYNGjy5HcMvnIprlw9YI14J5+Lpu0Yldjy7iUbSpzzIyvvZTZ8Ltpcpuv1uegl5rFmw7YL8AXTLNKul1G8pvsVMVT6UVmUEn90cRmZh8nNhn1IoYtob/bBuKhcRDaGjX7UAo/SUiBxIh07zCzlXI4esU8ayjE= Received: from BN9PR03CA0204.namprd03.prod.outlook.com (2603:10b6:408:f9::29) by MW4PR12MB6753.namprd12.prod.outlook.com (2603:10b6:303:1ec::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.24; Thu, 1 Jun 2023 19:01:56 +0000 Received: from BN8NAM11FT009.eop-nam11.prod.protection.outlook.com (2603:10b6:408:f9::4) by BN9PR03CA0204.outlook.office365.com (2603:10b6:408:f9::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:01:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT009.mail.protection.outlook.com (10.13.176.65) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.24 via Frontend Transport; Thu, 1 Jun 2023 19:01:56 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Jun 2023 14:01:53 -0500 Subject: [PATCH v5 6/8] x86/resctrl: Display CLOSID and RMID for the resctrl groups From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:01:51 -0500 Message-ID: <168564611100.527584.7981937236207103115.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT009:EE_|MW4PR12MB6753:EE_ X-MS-Office365-Filtering-Correlation-Id: 0cb3154a-6fbe-4109-9695-08db62d2ab78 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PBdrmy7MTlTWcT64L/wGoBX6gH9+RXMZ5j0SI12SBEJEW2lVuzBltjJL4WZCGLJf52u+Ci8PYtElh5ks8/P6sjwx3BNxcaIet35VvZI5fxQ4m/F0qLCiBK6r/gbiEXDqi/hbNpxb7+fWjEQqlb3VkQiORGS3cQsLgxPtUEn3VazPgmoAsmk3cogoVkC1UPGcFbUEGXbXM/AXBR777Cd97WaSCAu3vWYERqib5EXnWFaNn9LugOXl2TKOcQVoB1lcF6UD46Wb+9FxpBmKilB4WoqkPLydGJi2C0J7RqfKddYqaMZP54qf5VXQibX46ZMMkLhmOXRVZClnrvbJTxPThgoMWet1Ro1lP3p3UeJVGTeqWbU9NNFxhJXBz8lqMVGLMBlJ8WNvl/ryJSWhHSlcg49tcU2iZKSiiGCOGW8tfd+qIqxnlShCzANJjozQgZ8f8YlDu+Dl9DXhntn3KGuGBt1qD6n2ZR/VsSOoGdEc6HWf7p7gNJCoedW+LplSnIynKy59f4GrLUjeHzPOignN5VymqGbaVZ917y6D+kQLDLwQET/AvZoEBscgbYyBeztEJt0wzZSsU03n+2ZBLGXGjEq84nlnNUlC8aVf09+XMaePYBfs91NzMsHRGka1f1hkEJkA1J7XM4jKbOyHnZ5XakINGbL0PVUybuwj2SKKwnwOF9CrGF8i2YEqoovUNqqlVgdiETlbXpUMUCIevVi9wQkVwJ2P6Kxq+dRe5n+q6jWzYCH775NF6hWGWKHDwqEI9E99iE73Cj5gtY4EabTXKioR9kDhOBjRaeu8YPPpn38= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(136003)(346002)(39860400002)(376002)(396003)(451199021)(46966006)(40470700004)(36840700001)(110136005)(7416002)(7406005)(54906003)(5660300002)(70586007)(70206006)(356005)(81166007)(82740400003)(8936002)(8676002)(16576012)(478600001)(186003)(9686003)(16526019)(44832011)(316002)(4326008)(41300700001)(26005)(426003)(2906002)(86362001)(336012)(103116003)(47076005)(33716001)(40460700003)(83380400001)(36860700001)(40480700001)(82310400005)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:01:56.1893 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0cb3154a-6fbe-4109-9695-08db62d2ab78 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT009.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6753 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767529802230857053?= X-GMAIL-MSGID: =?utf-8?q?1767529802230857053?= In x86, hardware uses CLOSID and an RMID to identify a control group and a monitoring group respectively. When a user creates a control or monitor group these details are not visible to the user. These details can help to debug the issues. Add CLOSID(ctrl_hw_id) and RMID(mon_hw_id) to the control/monitor groups display in resctrl interface. Users can see these details when mounted with "-o debug" option. For example: $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id 1 $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id 3 Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 8 ++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 44 ++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index afdee4d1f691..1baf857ad8c6 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -344,6 +344,10 @@ When control is enabled all CTRL_MON groups will also contain: file. On successful pseudo-locked region creation the mode will automatically change to "pseudo-locked". +"ctrl_hw_id": + Available only with debug option. The identifier used by hardware + for the control group. On x86 this is the CLOSID. + When monitoring is enabled all MON groups will also contain: "mon_data": @@ -357,6 +361,10 @@ When monitoring is enabled all MON groups will also contain: the sum for all tasks in the CTRL_MON group and all tasks in MON groups. Please see example section for more details on usage. +"mon_hw_id": + Available only with debug option. The identifier used by hardware + for the monitor group. On x86 this is the RMID. + Resource allocation rules ------------------------- diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index be91dea5f927..2f5cdc638607 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -763,6 +763,38 @@ static int rdtgroup_tasks_show(struct kernfs_open_file *of, return ret; } +static int rdtgroup_closid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->closid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + +static int rdtgroup_rmid_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret = 0; + + rdtgrp = rdtgroup_kn_lock_live(of->kn); + if (rdtgrp) + seq_printf(s, "%u\n", rdtgrp->mon.rmid); + else + ret = -ENOENT; + rdtgroup_kn_unlock(of->kn); + + return ret; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1824,6 +1856,12 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_tasks_show, .fflags = RFTYPE_BASE, }, + { + .name = "mon_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_rmid_show, + }, { .name = "schemata", .mode = 0644, @@ -1847,6 +1885,12 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_size_show, .fflags = RFTYPE_CTRL_BASE, }, + { + .name = "ctrl_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_closid_show, + }, }; From patchwork Thu Jun 1 19:02:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 102145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp555029vqr; Thu, 1 Jun 2023 12:10:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6u31NbpBDyyDjUmQ0jbTFcP8e+5TcYMiyiULurADkHgwxLKlfTkPjxxXeaEWW76RbtOBqe X-Received: by 2002:a05:6358:71d:b0:123:46bf:718e with SMTP id e29-20020a056358071d00b0012346bf718emr7906912rwj.1.1685646659006; Thu, 01 Jun 2023 12:10:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685646658; cv=pass; d=google.com; s=arc-20160816; b=Cp5tdWQxAThmxeP1SaCUJGJGn/D+j+SCoMpBh1KMmcqflH9khLrvKcrMwv+b2meMjg +IfnmCLwqaWP2Ck78LeZoQpixxbrb29CxB/Yx+Y1M0GqbelY2iQ0L8cjq6ZOMrmAxEed NpMAMMbmDSPvl3pf39KwnAg2aNJ4Bf3w4Ykta7WKfHeEr+W3r6W/7k2wgQV161nh8Rrf LWcFnIbORoODs9fLCJEJa5qNP1CEfEfH/2hXcknsAEPoeFl7ocEl9YDkzLCFsL1ZOfw4 yy+qlNWHOfioeG7j3m3ct9XR0vz9YES8Yk0aO/5wnBX1U/ec4MJJ4cCAfyNezocCCKuo GHRw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=mxBu8aT+dt1aSZHgIZBlGrThsrvlYt0Itxizp0QbX9Q=; b=QtQKjtoy2QQQ73bjiSxeI9jWqchtxq8mkG1V5pkFGl7YZxgUkAMwL6UNnN425cFcYs F8mKDtiEBHxThBToFRt5XYHTG7AtzTppK1e6f6BaN9YFCUcAh38vDTamQS5gIFSe/oUa 1UOv1dgoR0fZBIRhlw/GX9uU/dVgrNbbLx34L8ilqgXkTWRKV4LtsjsLTEli/sVn+Ndh hjinXiREqD+hn/faPhhCq+P35SHuUjV7t+hStJHPFZbd0jIFlgZA0eVMxZnxJXtFScKQ Nb71qkwdTP3V9DWG1BgE28wME00b4BfTHTezh5PSETVFaOlk33py4pUlwt/zaQP0nz+i GyLA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RAYUeuDE; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q16-20020a17090a2e1000b00258d8f6eabdsi64187pjd.66.2023.06.01.12.10.37; Thu, 01 Jun 2023 12:10:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RAYUeuDE; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231315AbjFATCn (ORCPT + 99 others); Thu, 1 Jun 2023 15:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231862AbjFATCl (ORCPT ); Thu, 1 Jun 2023 15:02:41 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2081.outbound.protection.outlook.com [40.107.212.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EFBCE5C; Thu, 1 Jun 2023 12:02:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FqmYZu+bCE7ysv59y8IxgXPd3zYUbXdUPZFMR8zPawyX1FtNoD/M4bj49LdoEk4/lI09yIieMsCSB/r8D5fd7YgFDBI2s3+MVTGlW4EXyyaiI3Y7tqp3d6xpdZc3CioBlu+nDj4VPMyJAUIlPhZKsLciTiioXECDAW0INLOtXOkubnTZDSXnbbevQKClo/puhqnkpANCqQh66+XAxzzXn8WHj0jHd3WJW1m1aP8eVt6MsciO49nL/5XI8Nvc4OnDkBcz2iZFKH2EShrFwo3m9gxq5Y6ac4c9OXF/JjohSLMWrVQ/Jn/M2MP6igERirCRXcgT/zPMjF85iVdXwOH2mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mxBu8aT+dt1aSZHgIZBlGrThsrvlYt0Itxizp0QbX9Q=; b=oWzkkX/yMOH5bnzxYCzJyxLLc6UIy71hfxCB+FLqx4GATafU/vFW6DIgIaki0et/Qvy3D4I6iqTPPNVwjfxcrrcqBtoSjEuZ7Lq9GoTFQNeG/9jYLgXAy+v97IiTmeBVvv4yOe8STbKh1JaSDa9GtjmivjG3sov+XYDgVBvS4s2v3fYaGlBMYQwMc2i48koGD8R/+vG5nOJ2kSIl2JSZv5GwgW+o27LDClcCKuVjCtHEDvugXqj61zHFCH7lcywhnEA6yS1ELHohy3Xd1ieTNK7bKet7wEjuoxwjjWRL4q5ionv2L4W0ebz6pEPxtYJTiSERJ1MR62FXBpjFV2yISA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mxBu8aT+dt1aSZHgIZBlGrThsrvlYt0Itxizp0QbX9Q=; b=RAYUeuDEAp7ChCLa7YdoHHF36EJDLg1zmHpumcM/1QLJnKsQ0ozMNXYUWSILV//vh++GSocxf2DLwz0xRbEW78XtX6KFm8fPa2Vw6hpxpx7a6eYlyR+4fnaU7m1hzUzZGIXqglZdrqeIfFcjPAAyKffGfnao8P1IDn3qz4jJx1U= Received: from BN1PR14CA0016.namprd14.prod.outlook.com (2603:10b6:408:e3::21) by SN7PR12MB7298.namprd12.prod.outlook.com (2603:10b6:806:2ae::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Thu, 1 Jun 2023 19:02:12 +0000 Received: from BN8NAM11FT032.eop-nam11.prod.protection.outlook.com (2603:10b6:408:e3:cafe::e1) by BN1PR14CA0016.outlook.office365.com (2603:10b6:408:e3::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:02:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT032.mail.protection.outlook.com (10.13.177.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:02:12 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Jun 2023 14:02:09 -0500 Subject: [PATCH v5 7/8] x86/resctrl: Move default control group creation during mount From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:02:01 -0500 Message-ID: <168564612103.527584.4866621411469438225.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT032:EE_|SN7PR12MB7298:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fdc22f0-fd6c-47d8-b69f-08db62d2b501 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xWU+6QkMXvcP8T9IF76B5cTsBiYELsGnUtdYZG5wSrpvE/dOEyljDdDyTOMOO6sdmmVQrtLwC+78tAMSrR246Dgc4pEwNbIAENWeWwx+j+naFcfdjHBzZfzhEgYwsM8RnEMFeKgWxOrkwbcsnXXgZbRMhvfIlhlqV2Z0zz7lW+kY6M/UprLn9Ml9D3p3hS+ldboojTSFR3A2VfFj0vbCQUqr5VmgDsMTuvxQkqUdxwgRcPRRiBgiThMFzzAUzn722IvdDW0PeQvXBo569rOwDk3JM3JHjTo5r8EyfU16RPwHUicOYZhTU+bRc1znqHXOD/U/QFmdaGlxOkWSmEjPgNE9h21UWmDmt76t82wykZCH+H2OdbV1UsnoLKcaIC/J/iSySITT4vqW88I5QVD7sFWVMkX0hLB+4DqDYmFsZbolrGiMOJ+mJ3/tjY2XpWZPJ5L13aE+NFJtItvixEoTy5gu80jihz23LIWv0n4tYY70PF9IaG+76KXZ9rX+1c3KTReSrM2yLGnm3DYSinHCBNwBdf3kW12jvg712DavjIVuoZFvBQxHXWjNp0aRkcTbFNAtyfoKpyWggm+l/uusiO9RaeIUG+sJhHoyRQYZ0C6BCktTdkbYenkF2wHSrgRZfrPmh3mNjSsAYYpRyVEo5LwbgYPX/bPLydxzCcn+a7N+wnX15QrbfMw+eJDdKJPFpZ/yF91kO66Cjl4VG35V/b91cUmd9VzrgyQ635hZPTP3wtVCCkRjBRE4JBTSuoi/gIpH4No5JtaSd2nFMd2fg8Tl9KoNeokcAMA2/KwI4jM= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(7916004)(4636009)(39860400002)(396003)(346002)(136003)(376002)(451199021)(40470700004)(36840700001)(46966006)(81166007)(2906002)(33716001)(16526019)(336012)(356005)(86362001)(82310400005)(41300700001)(8936002)(186003)(8676002)(82740400003)(478600001)(426003)(26005)(110136005)(16576012)(9686003)(54906003)(6666004)(316002)(103116003)(47076005)(7416002)(83380400001)(70586007)(70206006)(7406005)(4326008)(36860700001)(44832011)(5660300002)(40460700003)(40480700001)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:02:12.1093 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fdc22f0-fd6c-47d8-b69f-08db62d2b501 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT032.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7298 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767528630890741934?= X-GMAIL-MSGID: =?utf-8?q?1767528630890741934?= Currently, the resctrl default control group is created during kernel init time and rest of the files are added during mount. If the new files are to be added to the default group during the mount then it has to be done separately again. This can avoided if all the files are created during the mount and destroyed during the umount. Move the default group creation in rdt_get_tree and removal in rdt_kill_sb. Suggested-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 59 ++++++++++++++++---------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 2f5cdc638607..e03cb01c4742 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -57,6 +57,7 @@ static char last_cmd_status_buf[512]; struct dentry *debugfs_resctrl; static bool resctrl_debug; +static int rdtgroup_setup_root(void); void rdt_last_cmd_clear(void) { @@ -2515,13 +2516,6 @@ static int rdt_get_tree(struct fs_context *fc) cpus_read_lock(); mutex_lock(&rdtgroup_mutex); - /* - * resctrl file system can only be mounted once. - */ - if (static_branch_unlikely(&rdt_enable_key)) { - ret = -EBUSY; - goto out; - } ret = rdt_enable_ctx(ctx); if (ret < 0) @@ -2535,9 +2529,15 @@ static int rdt_get_tree(struct fs_context *fc) closid_init(); + ret = rdtgroup_add_files(rdtgroup_default.kn, RFTYPE_CTRL_BASE); + if (ret) + goto out_schemata_free; + + kernfs_activate(rdtgroup_default.kn); + ret = rdtgroup_create_info_dir(rdtgroup_default.kn); if (ret < 0) - goto out_schemata_free; + goto out_default; if (rdt_mon_capable) { ret = mongroup_create_dir(rdtgroup_default.kn, @@ -2587,6 +2587,8 @@ static int rdt_get_tree(struct fs_context *fc) kernfs_remove(kn_mongrp); out_info: kernfs_remove(kn_info); +out_default: + kernfs_remove(rdtgroup_default.kn); out_schemata_free: schemata_list_destroy(); out_mba: @@ -2664,10 +2666,23 @@ static const struct fs_context_operations rdt_fs_context_ops = { static int rdt_init_fs_context(struct fs_context *fc) { struct rdt_fs_context *ctx; + int ret; + + /* + * resctrl file system can only be mounted once. + */ + if (static_branch_unlikely(&rdt_enable_key)) + return -EBUSY; + + ret = rdtgroup_setup_root(); + if (ret) + return ret; ctx = kzalloc(sizeof(struct rdt_fs_context), GFP_KERNEL); - if (!ctx) + if (!ctx) { + kernfs_destroy_root(rdt_root); return -ENOMEM; + } ctx->kfc.root = rdt_root; ctx->kfc.magic = RDTGROUP_SUPER_MAGIC; @@ -2845,6 +2860,9 @@ static void rdt_kill_sb(struct super_block *sb) static_branch_disable_cpuslocked(&rdt_alloc_enable_key); static_branch_disable_cpuslocked(&rdt_mon_enable_key); static_branch_disable_cpuslocked(&rdt_enable_key); + /* Remove the default group and cleanup the root */ + list_del(&rdtgroup_default.rdtgroup_list); + kernfs_destroy_root(rdt_root); kernfs_kill_sb(sb); mutex_unlock(&rdtgroup_mutex); cpus_read_unlock(); @@ -3598,10 +3616,8 @@ static struct kernfs_syscall_ops rdtgroup_kf_syscall_ops = { .show_options = rdtgroup_show_options, }; -static int __init rdtgroup_setup_root(void) +static int rdtgroup_setup_root(void) { - int ret; - rdt_root = kernfs_create_root(&rdtgroup_kf_syscall_ops, KERNFS_ROOT_CREATE_DEACTIVATED | KERNFS_ROOT_EXTRA_OPEN_PERM_CHECK, @@ -3618,19 +3634,11 @@ static int __init rdtgroup_setup_root(void) list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups); - ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE); - if (ret) { - kernfs_destroy_root(rdt_root); - goto out; - } - rdtgroup_default.kn = kernfs_root_to_node(rdt_root); - kernfs_activate(rdtgroup_default.kn); -out: mutex_unlock(&rdtgroup_mutex); - return ret; + return 0; } static void domain_destroy_mon_state(struct rdt_domain *d) @@ -3752,13 +3760,9 @@ int __init rdtgroup_init(void) seq_buf_init(&last_cmd_status, last_cmd_status_buf, sizeof(last_cmd_status_buf)); - ret = rdtgroup_setup_root(); - if (ret) - return ret; - ret = sysfs_create_mount_point(fs_kobj, "resctrl"); if (ret) - goto cleanup_root; + return ret; ret = register_filesystem(&rdt_fs_type); if (ret) @@ -3791,8 +3795,6 @@ int __init rdtgroup_init(void) cleanup_mountpoint: sysfs_remove_mount_point(fs_kobj, "resctrl"); -cleanup_root: - kernfs_destroy_root(rdt_root); return ret; } @@ -3802,5 +3804,4 @@ void __exit rdtgroup_exit(void) debugfs_remove_recursive(debugfs_resctrl); unregister_filesystem(&rdt_fs_type); sysfs_remove_mount_point(fs_kobj, "resctrl"); - kernfs_destroy_root(rdt_root); } From patchwork Thu Jun 1 19:02:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 102149 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp560943vqr; Thu, 1 Jun 2023 12:21:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WsDQsCqEMtYLZBkdjKXIIjvSjdNHiEeIHbg13DYNcIE0GRKA83+vzHRYPuWODdoVB2Far X-Received: by 2002:a05:6a20:ce44:b0:111:346c:3445 with SMTP id id4-20020a056a20ce4400b00111346c3445mr7279320pzb.38.1685647282904; Thu, 01 Jun 2023 12:21:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1685647282; cv=pass; d=google.com; s=arc-20160816; b=yihbgC/eo69WF5xHhxR/Ig7xS9PrmSXxPpDa/76tMSpeRNYtUeuut0EXFEpYVHQ/Gz bpD034S4ANwEvXklBFO0nl1gaXpHYP3bpNBeUg6+xE2/fXX3Oey4j4lKuc3MpUf1M5oz cPeL7ZhKrVC3SBCI5L5JPNFRMZNuPTri+LPk+ggE6sRwN6GQi7akBk3Ey864ngMe+Csf m1o0tG1AgfZ/manwKMGKpXUzBHz9JSK/kyI5xGH16Ls0QWG7EKD0wYtG/KMZAqEA9E66 UHUH6vhUOWC9Uj4XBm05szRHdznnnfI99gfVH87KrNl+EWbV5/I2cRKw/e9Hgwz3LWRk ZuQg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=7OP3izmuN35dIUh+t44uEj8GzBCiBS9lxHY/vshGP5g=; b=JbBS9suOxAdf0ZzGHXn4p4wvo7WmH8+Kjx9UkI4eC+q1AvTClltZ6b4A+LqhuCsSsF Q1UqXbszBm/hRgN827lQJo/UUKYfIAP1ePrdogUyJRdUkdmQ8KA3uJ+Nv73kBjB7QGlr fXyr9C1Kyf1gB9dDcBZNnZytsleXTEohy/2ubf+S2OnAp1q2jLZboVGbGip1B/FE0Nzk lDZ1ccy4un7ZXbT+ROu5VQCl8VMsxMh0l10clA6oZs3rRSDzqPG8et+2IPSVcwAgAASK igv7disJEGrp8YEUyP95HXj9Kvz/QZRMDuZYOEd6oDM6GHT7UpWaCryRQKiQSrNVXvrM uDeA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2wblee+8; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a633f0e000000b0054294720d57si63415pga.617.2023.06.01.12.21.10; Thu, 01 Jun 2023 12:21:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=2wblee+8; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232618AbjFATDF (ORCPT + 99 others); Thu, 1 Jun 2023 15:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231410AbjFATDC (ORCPT ); Thu, 1 Jun 2023 15:03:02 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2069.outbound.protection.outlook.com [40.107.96.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9EC9E4C; Thu, 1 Jun 2023 12:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MmeCByQ/YO8SckBUAAYsnDDlRU8L4MJiplWNHv9dNHutJpd/DpOK1N/z37UwRSrMIV+0GsV5afTK26TxH7XeOEcNlkZ0sX4LwRxN9d2Hm/GDdWNQG+B48HF21W3z9Qg9hkH2byOe4gk7/DOnIS4ij7n4yIkyqLUr5iyHzZqEWwVRuqmFgzqu7XVndQyxxjRrrFxmSSt4sQRpmV24jBnd9Nw1FE7jkOWvuQhGJxOoMZw/HMY14cLmV9PVDjhDc9eIkhq992k0mxpbrX2RzQeOr5MYzpO/Zjr1bMZ6IUFSk9Yn9sCpu0KYgF3+weC3NTk7SGdW5ja9uRg0RXU6nHIJFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7OP3izmuN35dIUh+t44uEj8GzBCiBS9lxHY/vshGP5g=; b=MtM473ky7NSLLxKeqspH/iMnB1Zg5k93L1FOlWpEWI3/zu9Zm1ykZdkO3xkd0tjq9M0VLSg3vAHJqEr3JBm3ScdOVlzv8WPSTn3OAqaCZodpkorH4QrFNRNy1DAEgxRCvTu+2zejTAanUTSDwdnkkLLHMX+gucFdQnXWRfi2NuAkLPvKVwFAKESQqcD1yCjTDMlY5NrubaJN5OdlGbMmKG/ekzFsvef3ndBZ3mkcw6yCNoNelIdVJWvqwf7ptY+kqDEnrOW3LEfVVjAm8FAZmJfpH6QQbF/n47lUZ7mZ2tOYdKxDRHlJoBOBp1K2aXU4ZN+4ACZ6l5v8aNxhuSP0uA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7OP3izmuN35dIUh+t44uEj8GzBCiBS9lxHY/vshGP5g=; b=2wblee+8wRF0RmmVqldUeeUV59c/j6DnFlHMyy3jsnxWPxjIiI9q1nRJT0lp7+RiveJwFL9EnXJBiHiQftLfx+A3MEbDwR2kf2FIz/MvKKz/0Qo18442bUeoFMcwFP47Aoqml9J2E/61eTevYFMhyRDNUTu0VnL2bMDi/y+5E60= Received: from BN7PR02CA0031.namprd02.prod.outlook.com (2603:10b6:408:20::44) by DM8PR12MB5463.namprd12.prod.outlook.com (2603:10b6:8:27::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.24; Thu, 1 Jun 2023 19:02:22 +0000 Received: from BN8NAM11FT109.eop-nam11.prod.protection.outlook.com (2603:10b6:408:20:cafe::b1) by BN7PR02CA0031.outlook.office365.com (2603:10b6:408:20::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 19:02:21 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BN8NAM11FT109.mail.protection.outlook.com (10.13.176.221) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6455.24 via Frontend Transport; Thu, 1 Jun 2023 19:02:21 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 1 Jun 2023 14:02:18 -0500 Subject: [PATCH v5 8/8] x86/resctrl: Introduce RFTYPE_DEBUG flag From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 1 Jun 2023 14:02:16 -0500 Message-ID: <168564613667.527584.13233260903070279360.stgit@bmoger-ubuntu> In-Reply-To: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> References: <168564586603.527584.10518315376465080920.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT109:EE_|DM8PR12MB5463:EE_ X-MS-Office365-Filtering-Correlation-Id: db3550a6-92e1-4b36-a7c3-08db62d2ba88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Hrr8cmr3cVMGrqEPl1gdY7wqzahCwkjl6ILwFj5El3s+VJsJ0qXmqnDO2IvCysGig4ux5EEsYDF5ZVE5IbPIWdnAfQieAkPvRkEVmOzLDEGTk6mK9+ubPJe8ITBMoiEsggX9uGHLSZaFXgSn9/2WiCHJSnpfiCNx84cnsgMBtFLI9lnsKOEfatj85LNx9eG2a1qlNakjiRzhezpHK1ZPZDWqPKlUiIzVsYoBTcbfGof54rtwj/vm2vbKsKD9BJsSm+icLDHetsW0pbUv8XM+D20Pjs2bFQdh3WkFT0JCoIi6WEq/AePP/BfurFzRMM8CFD/JvRjYlJP0WPLhO0mzyEiT0s+QTUCk/s6Wbq3FqXAPEYrzRd4u7dvQAypmANZsvo3SC0tHV+UkPr4dbBqKuiwGdLSh6DaQoG7V4cxYI1/gvNW8gvVhnPZib1sJaEo4WSPo/2GNb77lPyliPkLoPyY7OCFTEw2fInxPPNlRoSBvsRCSwLOtgXNmBrLiyu1HBsHABd4QBI+F/OssSGYduflk9Y9reAwxfHWf2o04ulpABZ5y1B+XB1jBVwH4tggfsmOTyxsaAbkjnd3MBTel1mjjoDZGrilYCqUWaCIGpEnHRi8vXyPaRkINXDanL8AiIJVW51EyuZdW3OO4ZtEmd8fEAiCAAvOy0ujXqFqU8tG7Dsx4Q7xxulZDXGMUlTeJ7upHz3R9KSUqIIoVIp+jEMaULLEkQRQBP+hgWbcjs0BxoPs2B657+Dse0BS+SV8LhQaBDSWEWkCbgeYNe+Zm7yLdXvyXbSTiyy6SrimT9Wc= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230028)(4636009)(7916004)(396003)(346002)(39860400002)(376002)(136003)(451199021)(36840700001)(40470700004)(46966006)(40460700003)(36860700001)(336012)(47076005)(426003)(83380400001)(82310400005)(86362001)(103116003)(81166007)(82740400003)(33716001)(9686003)(26005)(186003)(16526019)(40480700001)(356005)(110136005)(54906003)(8676002)(16576012)(2906002)(8936002)(316002)(41300700001)(5660300002)(7416002)(7406005)(44832011)(4326008)(70206006)(70586007)(478600001)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 19:02:21.4604 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db3550a6-92e1-4b36-a7c3-08db62d2ba88 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT109.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM8PR12MB5463 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767529285134004797?= X-GMAIL-MSGID: =?utf-8?q?1767529285134004797?= Introduce RFTYPE_DEBUG flag which can be used to add files when resctrl is mounted with "-o debug" option. RFTYPE_DEBUG is OR'd with other RFTYPE_ flags. These other flags decide where in resctrl structure these files should be created. Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index c07c6517d856..5bc8d371fc3e 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -294,6 +294,7 @@ struct rdtgroup { #define RFTYPE_TOP BIT(6) #define RFTYPE_RES_CACHE BIT(8) #define RFTYPE_RES_MB BIT(9) +#define RFTYPE_DEBUG BIT(10) #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) #define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index e03cb01c4742..9e42ecbb9063 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1862,6 +1862,7 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_rmid_show, + .fflags = RFTYPE_BASE | RFTYPE_DEBUG, }, { .name = "schemata", @@ -1891,6 +1892,7 @@ static struct rftype res_common_files[] = { .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = rdtgroup_closid_show, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, }, }; @@ -1905,6 +1907,9 @@ static int rdtgroup_add_files(struct kernfs_node *kn, unsigned long fflags) lockdep_assert_held(&rdtgroup_mutex); + if (resctrl_debug) + fflags |= RFTYPE_DEBUG; + for (rft = rfts; rft < rfts + len; rft++) { if (rft->fflags && ((fflags & rft->fflags) == rft->fflags)) { ret = rdtgroup_add_file(kn, rft);