From patchwork Wed Jul 19 23:21:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 122924 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2776910vqt; Wed, 19 Jul 2023 16:41:56 -0700 (PDT) X-Google-Smtp-Source: APBJJlFY/Rbv64adLXkTmLLf8voTFhR8zEv3hwODa4HljcTvnTr/O+71cx+M4oujAI74ZHH9owMl X-Received: by 2002:a17:906:530c:b0:997:ba19:61a1 with SMTP id h12-20020a170906530c00b00997ba1961a1mr3309028ejo.32.1689810116149; Wed, 19 Jul 2023 16:41:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689810116; cv=pass; d=google.com; s=arc-20160816; b=jY8efJlPa3lOkyYGi5mr6LgtfIArwYOqADq7wxlYCmqtbHakNpRofZxngmRgKQ5DqG TTNaIsqSJf9slYU2ipOAwJhdMUADog+WZYPpsBVLHwOXROJ4Tl2/VxLWXJpmUFzPPhkx 3ZMXEqJ3KMNPI7+oMtNip1SELGaoDm5xRA2AN4/q25yYyRPBt2uPuXZ2DlksctUpxlOF L7aLXjJXn4S08W+j3wIS/kkgMGCTzO5gb7s2QRA8hS8xSqsZn0AtqeW7k90QSQpARhXs EiLp3QZD9UffZjmApxDSH/6u5jPfBOCF38WbJwva3RgeKm9Y8rmJ1lQVH0+lnrKLjrld qXlA== 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=61Al6Z6LQLHeKfkTRNM6veo5Vu35Uwnfb24p/WvWesA=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=iqM9ZaktAERvAvNsvOdAnwWFMRwLp/SJ8LHnBUu6N7z5kifBJUABea7IAyJvqm8W6d suwcDhFWvNZvHwPF6oLeOP+iZB+PhwwdaQvbDbB8XVSC1nbfVJDo6JgyeADKN2QqI1d2 xYgqs7pHqFrDFiTJ8LeYmt7y1pg+f4bL51Y+afmNBupYse7ZPxn66iVcYX3Mp8rY0YJq n1MTm7AML24rNJ4XYNp1DTUDEjYk/41HaZb7ThZlNQk5+GQIHRl7u+dt5CuTjeYteY5v Sk7fLGkXth/wJxzdQ/CsUJwRiIRI4aiwd0Ng/8as4SzbEXSfJZ7dob6lPkEdTlnzHImr GSEw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=4OQW55Qj; 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 z22-20020a170906815600b009659573b4e3si3635977ejw.51.2023.07.19.16.41.32; Wed, 19 Jul 2023 16:41:56 -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=4OQW55Qj; 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 S229945AbjGSXVf (ORCPT + 99 others); Wed, 19 Jul 2023 19:21:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjGSXVc (ORCPT ); Wed, 19 Jul 2023 19:21:32 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2086.outbound.protection.outlook.com [40.107.243.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8FCA19BC; Wed, 19 Jul 2023 16:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ne5kQlhSYZTjxCRITS/m5i7kyggViAIc2rJGDC6qXlgPHSHFwD3XCdmvMxcZiw5f1pj6x1qSHh9HW/V9+er1s7yMi91H+WcWfZievAmX4ZumiiUcHlXcP34YWMa2o/sq71zi0tSD2KiuLQ5MXJgeARcequXncfTMZXmFyvS2hSuF7xwVxiQqhnAhgmUHqppSyzOm+7NJ+TPUulLQo1BG7kwZSYXEphb9zVm5xjk6SSy0sdoO1ppNbs/sC5KBf2fI2IHB/GGPYQkycBIHm0ua11z39G5HZyPglAZCTo+uSH0jq+SQ/gRxKsdX2ZsImofs5w3FlHbIacvTQoVOx9FlmA== 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=61Al6Z6LQLHeKfkTRNM6veo5Vu35Uwnfb24p/WvWesA=; b=kMsUByR7CRgFKB5W2K6/dEtjnfNVTaislE62PxtnHsQmHXWmnDX1k75+cyJatnmaVcj3x7OWQchh9r/fbLy9GnTKD0I7RezVnXT6jyzeb8OjkOhM3Zh+0dd9R5Hp/aiCdR8dWymRnbZ2HX30o0ZcsXjEc6Cwqv37sj58oUOgsc6LMwMlttOR97HZEcHCnvP6RKCO13PMm6jroEWcWM/K/yQ4Aj1ziL2Lwqc4HaBmd6KdNPmWgFozuiuN0kXkoMWrbv2zmnUSNlyhwE4LK2p3hYbBBm0dDVtBlE4tLaA0hqjHoidA/tllW5Ippc10SQNXQ5co2cNMQGsrazr2erlJXQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=61Al6Z6LQLHeKfkTRNM6veo5Vu35Uwnfb24p/WvWesA=; b=4OQW55QjIXZ2NfcMeRydYFRLyJBHMrlLcS2B0+jpl4v1hKZcn8YgFSHYaQVY4vfGRsVQTj8vTSx2zkK55LBAvmZnmpiFXwkuKNsyYvq2hb1UL9dhHXN6Ncat455GR4kz45P4nKPowLLnMF3vPJj++m4tRqHAkhV1p+FjRJMl9SM= Received: from DS7PR03CA0337.namprd03.prod.outlook.com (2603:10b6:8:55::25) by SJ1PR12MB6220.namprd12.prod.outlook.com (2603:10b6:a03:455::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Wed, 19 Jul 2023 23:21:29 +0000 Received: from DM6NAM11FT104.eop-nam11.prod.protection.outlook.com (2603:10b6:8:55:cafe::e9) by DS7PR03CA0337.outlook.office365.com (2603:10b6:8:55::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:21:28 +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 DM6NAM11FT104.mail.protection.outlook.com (10.13.173.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:21:28 +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.2507.23; Wed, 19 Jul 2023 18:21:26 -0500 Subject: [PATCH v6 1/8] x86/resctrl: Add multiple tasks to the resctrl group at once From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:21:20 -0500 Message-ID: <168980888032.1619861.1165593867700435801.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT104:EE_|SJ1PR12MB6220:EE_ X-MS-Office365-Filtering-Correlation-Id: 96af125d-1238-4855-d82d-08db88aee148 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B1f9Q4CMFvA2wcK+oaNgQURFQ+NA9c6KvM1fUMni5Tra6r80sG5TTDjkZ2N7J33J8JE8kWLHjqqbzL+uOgRue9W4/N3mLKFCrMLgTgR6wo2tHcxYcAa4hvQgV91xayxBnbQaQh8WCgwAg27lizTPfv4RN3AKWG11gk2nFOBnkzpFJzR7b5PYsYyJwwmy0MCCY+5LTqMjK5LkJQdxZN5OU3sbTqBXrizBAH7bSkd1ka1brFGU58QqdXcAf1SCoihVYewXh2FMqKg3CjS41IahB7paMlYmK2fxcCmxLJDaZEIN/RHpHOAR7SC/z38/6/Ev8NYT6Lx16Pi/uKyqXPTYcXj8XfeFkgOc9iHYDwIUuMvvu52iB87cG/U8rtqtMzc3qfzUaH18/87ezAtDLPjyJydtBFjRJJ9JT214s6Aoc0y+eH+mPassDE6eVr06vItFiCy2ahdYqegYPULCEYq/aIzEuhtffGOL+jZ8p9/IOgqTCQ34mMveN4EZbpp0dkaom0Z4KHNbaTU06Xqc9/S9snpi3H3iim82wtVKuaNqsp0IPmRcsd1H7jF53sJ5G0t0V0+wFUe87SVAFtpxWOPqsK5f+Qi191t/rkJWxSqTUu1KiyZQOSRyWAQdDzD5MQeglI22ES568oURkOqYC8PRKeAHrl0LULGSH57yPeLC9Kl5SZj9ZGeqPHsbidKm9jhVe4J3UXLx5gFADxvgSP9owVvh4F9vrsBnfV7/VJjUeo2IbqJGKt32x3Z1RAhoabG1w4t5w04XiT9v5LrwtdPWez4sQinCJxs4/JhUymg7oFY= 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)(39860400002)(136003)(451199021)(82310400008)(46966006)(36840700001)(40470700004)(66899021)(4326008)(54906003)(6666004)(478600001)(110136005)(83380400001)(82740400003)(36860700001)(426003)(47076005)(40460700003)(86362001)(103116003)(40480700001)(336012)(356005)(2906002)(33716001)(70586007)(44832011)(186003)(16526019)(26005)(316002)(9686003)(70206006)(81166007)(7406005)(16576012)(8676002)(41300700001)(5660300002)(8936002)(7416002)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:21:28.7610 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96af125d-1238-4855-d82d-08db88aee148 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: DM6NAM11FT104.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6220 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,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1771894332710790910 X-GMAIL-MSGID: 1771894332710790910 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 | 25 ++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index cb05d90111b4..af234681756e 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -299,7 +299,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 725344048f85..8c91c333f9b3 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); @@ -715,7 +714,27 @@ static ssize_t rdtgroup_tasks_write(struct kernfs_open_file *of, goto unlock; } - ret = rdtgroup_move_task(pid, rdtgrp, of); + while (buf && buf[0] != '\0' && buf[0] != '\n') { + pid_str = strim(strsep(&buf, ",")); + + if (kstrtoint(pid_str, 0, &pid)) { + rdt_last_cmd_puts("Task list parsing error\n"); + ret = -EINVAL; + break; + } + + if (pid < 0) { + rdt_last_cmd_printf("Invalid pid %d\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; + } + } unlock: rdtgroup_kn_unlock(of->kn); From patchwork Wed Jul 19 23:21:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 122920 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2773188vqt; Wed, 19 Jul 2023 16:32:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlFG2KL1CTKy4LO94fH0h7OPobMCneJTfEHnp/cUgNNP/+E1PnJUaKwhwrBHxybsT81NOXIz X-Received: by 2002:a17:907:160c:b0:994:55ce:1630 with SMTP id hb12-20020a170907160c00b0099455ce1630mr4046903ejc.42.1689809526183; Wed, 19 Jul 2023 16:32:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689809526; cv=pass; d=google.com; s=arc-20160816; b=hs8tE7EC391MKPmYkL/lvolj/ojxsbn+mYMo4mVi3VospJ3Ie61iuC9e8w0tTVytgo 3nUlmhWoguHOXekOE5kFhElDEEynnz7W/kKqmaV6SX/KcKGkuH2dZhpwvNNX+z1khoP+ R1no4wTALa9Dj+5T+1Z0pUv3OpaT4eRrVKjhkpNPTsXy/IpMj6vbUObEfC7iN6GXjqH5 JOadZeZDNWUJk4yRvrCvUi5VnUEJQHVymiPdzM3QIp4oXNxvevX6bOlQXl2y9xUF9PPT S0Vt4zZ5Bc8Vhp3DMZOcds7KlvzKbghxvSpz04vrJ8HXAo+QyDYlPvxjEA80A+hbdorg QCSg== 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=UjCNKrhhNf0pmqvwTZRd9NA4wMpFYN1ufrYeBdf3TY4=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=NIVl3zi+PScUr4k9t7S3gn+5e+fNOJzrXpXpbt9rjTkRvR9pD11yhbm8g6/9FzIlU2 Ck8OOLg99rfVCETeVSVsYyVxc0wLXcij9zIrsF8bjEjlGEKBzO09b1A7EnNdkD88iwwD hv8ozEWhdUzK3vQ8DXJXujZkrF1s5upMCNb7MpLQ78Zz7Kf8JDT4hMx2ro0hw5LC4mVL CXhDkr84PP1lbSGP83m8IXWl9eno5v+NciDrbVpA/nzfvYcyyMoGRK5tRNVYg1DK8B2x CQbVVxjSBJgQDDvs05EXzH24N8cxXGkahWy9tLTJiW52PELs6/0epVOlosbSUNYH4oUU 0wVw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=EVZKWxgk; 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 m12-20020a170906848c00b00992ade22f04si3460343ejx.108.2023.07.19.16.31.42; Wed, 19 Jul 2023 16:32:06 -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=EVZKWxgk; 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 S229679AbjGSXVz (ORCPT + 99 others); Wed, 19 Jul 2023 19:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbjGSXVx (ORCPT ); Wed, 19 Jul 2023 19:21:53 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2079.outbound.protection.outlook.com [40.107.100.79]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8B3B22103; Wed, 19 Jul 2023 16:21:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HDrXR2rO5CMDCzaSzMa+HXOSYoqOvmV89aCPO9H+zcrNWnTN5ubXeNiy2bEwIjNaFgaTjeFd6Gr3ZvND34EfKpqPD+BDLAOobuIom+Kc9QBDVLYtPswft6MaILlEKMoYz0BYN/NZBxGrdPuSst0WNwY18/GFVBO+dCL/ID3s1gTnHKEy2YNstUzwNk+YcP+RrGKjIhNZNnegIjqMS1hzUOkq2bfhqgdlkqrUYLIdkhLgUVyxXrWomPRFpqCx8vO0w2Vu3j+Qe02C2kzpHkXDQQlT2AVIkBn/6DPRouwkyeWFMOHT+SbVjVOTQlyg7GabRLelz+Cnv0ROHK2Ii+PJug== 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=UjCNKrhhNf0pmqvwTZRd9NA4wMpFYN1ufrYeBdf3TY4=; b=QdrkzXfHLCM3P8u6Dzy6HlLw7bWiE/gAg6jJaDGWaDtQnOI7FKxTcaOe5vuxJIusq7oTEB3IgEBZ7oeCZ272bdhZ2dpFbAtVUQocqji3P6+A/KOwKomhSO/7jvhs2gDyQ0Q3TgmZPkdvgC8ln6TKog3nGsDFdhpPgMCUnaPfc1zHonQsbzMH/YnE1wkpW9bH8Wz0OMBHL/iAfu46VW1Ap1TftrO5WWBwlav/IDe6U+mGeCwW48Abx9yLeLGzhlq53ib8ssDswZDKMUgsYufC+ioh1+DikPxW/eH8k4CBz0VKvNBpG/AnEbeDdU1w534tOuwlRNg7y5pnp6EqLa8UHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=UjCNKrhhNf0pmqvwTZRd9NA4wMpFYN1ufrYeBdf3TY4=; b=EVZKWxgkL04XXWGnfhMI5MfUcmthD84YA7oGhdwjaSkBb9+WJFtVXHBQumOSj4U5PidW3O279toVzpwUR31ATRJrrhSc8pLf1yw7MXcyAmPFrMbCwIlF9hahnwwsuMfDyEWs3uokOopwecusz1hpY59no2zvRnIUG042WVTl5t4= Received: from BYAPR03CA0023.namprd03.prod.outlook.com (2603:10b6:a02:a8::36) by DM4PR12MB7719.namprd12.prod.outlook.com (2603:10b6:8:101::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Wed, 19 Jul 2023 23:21:43 +0000 Received: from DM6NAM11FT026.eop-nam11.prod.protection.outlook.com (2603:10b6:a02:a8:cafe::e1) by BYAPR03CA0023.outlook.office365.com (2603:10b6:a02:a8::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:21:42 +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 DM6NAM11FT026.mail.protection.outlook.com (10.13.172.161) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.35 via Frontend Transport; Wed, 19 Jul 2023 23:21:42 +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.2507.23; Wed, 19 Jul 2023 18:21:39 -0500 Subject: [PATCH v6 2/8] x86/resctrl: Simplify rftype flag definitions From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:21:33 -0500 Message-ID: <168980889343.1619861.8836711283953792286.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT026:EE_|DM4PR12MB7719:EE_ X-MS-Office365-Filtering-Correlation-Id: 91472890-a00b-4cc3-5a6d-08db88aee94a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9IFqKvEPW4HWMnUQlHCqdMTIw1rHM2wUHYy/wZcuCdIFJWiZpDlvIkN2QK7jiSlmGGXjF02Xmmxh36wnI+3rXSUvDQonMh+sjD8pteWWTash1ZiuYsdXxhN0TxSJPMHWqOzEYPuicBBEg8MZcMgYqubLuCae9A/+75L8hRGd9JC+z5BMZBvq2rEvrdX6k+5ekUev62SSrGO9vHGORUm7BVO+sriX8KmWJam5uhfENXJ7Z9yMocn3JGp9L95YDFx+jAL+M8v3k3i7myQBIdGj33GZRzbqCfR5Uz7ntUDkk5XHsxJehuUFOcXopoqFrEMSY0ji7QyKqjHoYxIcSkD++ZETRRelWGdgIOiPQt2DWmRU9SYonWL1faSoA0tGjbvcBOG4GYwIGPHFcNRIpK1fOvFsmbfjyEXduSULJ2Xwwe3HF9wr3ll0MOJbhsZ/Fq8hnJ0edIllQnX56TGoSUgU4GnzFH1BVg5eMGWv5KpPxIlZbgDZyHhpAFXD30yEMIy6lWXiYxTbnhBDP+bGJQe9SlvcfQQQrgAtxM1f6mmh/ylqsrDxhaAAc03ouAMFyQ1wZ97mg5F051BK67flfvOxv6e0LTE4EjGl7kGU17anbhvkwYCakWflDfvzg8MZLWojkCU3oDnFgxuWsHyfSCxtPIJXf5ggq3uQeZzDbeCOkBvA8a81qaTrhvAY0BX6fBt/3p/57C+FeAlMmIdKXnKL2WRxP3siNG3g2FyoHcsB0cS1srk4iHH+Sf27hgSKrGyQSCFqN3TNAlHE1lfmCYd+LE2WRqCtC5vNkCe7+gubT80= 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)(376002)(136003)(39860400002)(451199021)(82310400008)(40470700004)(36840700001)(46966006)(81166007)(356005)(103116003)(82740400003)(33716001)(86362001)(40460700003)(6666004)(9686003)(110136005)(478600001)(2906002)(36860700001)(426003)(26005)(186003)(336012)(47076005)(16526019)(7406005)(54906003)(16576012)(8936002)(41300700001)(7416002)(70206006)(70586007)(4326008)(316002)(40480700001)(5660300002)(8676002)(83380400001)(44832011)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:21:42.1927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 91472890-a00b-4cc3-5a6d-08db88aee94a 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: DM6NAM11FT026.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7719 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,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1771893713300007128 X-GMAIL-MSGID: 1771893713300007128 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. Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan 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 8c91c333f9b3..2f1b9f69326f 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -3242,7 +3242,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 Wed Jul 19 23:21:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 122921 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2773361vqt; Wed, 19 Jul 2023 16:32:29 -0700 (PDT) X-Google-Smtp-Source: APBJJlGvMnww8CidHRPpo8XF2KuOLdnzIoI2xUU0cq5aVE+qW30rSN/wZ87PRQs4Ep7BOAw6iN4+ X-Received: by 2002:a05:6402:b28:b0:51d:d37f:ab49 with SMTP id bo8-20020a0564020b2800b0051dd37fab49mr538243edb.6.1689809548568; Wed, 19 Jul 2023 16:32:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689809548; cv=pass; d=google.com; s=arc-20160816; b=G4YlEwwCT+djL5j+WLGGnYDd1JC0uK3fQTDSdRQySzL5OA2ehwPmLYunGX2UoW/5h0 dGzsNkqP59bBHKEUZjGe1uaU60saDk85krbEGfraHgnjj6uLqldE6L/du7bhzkw7tf4Q 6Ggf6pEXp1hrJ79VKTxs/1WbpZndGSVM7FnxCdHyRzork/ZTQ5ghNSlBAKK2jEjdxs6W ILEUm3g25M9w1fN+SFHDTZhC+/sO5JhbpVXYcO5ZHFCo/AVJCWnFXnx1wvV6t4NNL1be 5ZvKV4FwpaEeI122RInrNmX7YwxpnoDNf0IpbPvRkOXWeTnNAUcosWGYZXyZ+4TreqDU awDA== 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=jqYCi8ldNKkURthjbG3PWbyXcm2Z9fqG5Z7innpufOw=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=khw37ApgbPm8asg/xQq+KPF2J5b/95d/dQI+XnSpPQgYRL3MXYXF21Dl0dW3TIVYD5 vJb3zew+CzcbK4BHg+NeLPEDGfJIOhw1HftYXp7ob0uzvjmYqQlco979/DRDC/cL5tAT +ggJdX1G3LLSF75rfVG1mbVfdR7O/dAKxFC/XIQ6nbIN/HLSoYnRCid9Z4FeSjmLPsJY X0067eoDzh325Dt51MJsjsp/23OlA9WEfPyheeyITnRJrWWv7YQkXON2poSQfG+lKffc baVVkqXU5F+R4AszTP7O70tZnv/zuASxn7TMJAEPp2xyarlGa4YQ0/u4he7axdwCcW7K aieQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=hZa+ackw; 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 l25-20020aa7c3d9000000b0051dd1d7fbeasi3605013edr.683.2023.07.19.16.32.05; Wed, 19 Jul 2023 16:32:28 -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=hZa+ackw; 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 S230211AbjGSXWH (ORCPT + 99 others); Wed, 19 Jul 2023 19:22:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230143AbjGSXWF (ORCPT ); Wed, 19 Jul 2023 19:22:05 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2080.outbound.protection.outlook.com [40.107.243.80]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEE76E53; Wed, 19 Jul 2023 16:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dLK9Lw3auvgXwOr+rbO7u5NpMYZUeYIc5Nz3lGKBnzmBW1KooQgc4O9iYGFDW+1/na8IA5/MiUWfc5ANOr5/yRFZ3moM7EZk4EyW3Ixi2Ev0VC15rkmOHE6OfD1y8qeS5S02JD3SY8KexrMgVWU8dPHVX5qXB+7Fpbm8HhIH0mWi6pZGwJNQREykanMTp71YM7Ix5uxJbER1jzbKEIdiIqBBLnkp5vcur255JOUyolI6fqOW/mdVz0Ei017ontINX0swhJ1pAkuQX1YUGAlkXBgxXagLNrfztMtJdpUR/qJ8qhMwvzm2eG+QcsiEPQyXs/nfGUhldB4khVqp2sbDvg== 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=jqYCi8ldNKkURthjbG3PWbyXcm2Z9fqG5Z7innpufOw=; b=KmuBeJ2uszGNHyrYIt5R3hRmjHrw0hM5IUlhMm7D6AmHHzg1VbXtizXFVH3HWuCwGY/2Q48ZJZFMlhOO/uHXf0saTt3YqK+5537VcGdVUJ84corzXUipUjey/nZy5YrWBPD7Cu+FKdmvmnV9jgWyjH483q6+PxJUeMnAslqImpNEvvfLGHx9xctMPZlTom/PrbPv5hP5kcNZSBgyy5MPn1oUBwGAaaGdBhc+c7mDEhFNfnNj3pzMLEzXqUfa1iSd7uQd4q9ZmQ8K5iP4v0kU55KA0cCmFyKJXP9JP69MK76hJzTNRKW4ASVJhKTo5zD6koEI0SlKxKbOzv2sjoAXlg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=jqYCi8ldNKkURthjbG3PWbyXcm2Z9fqG5Z7innpufOw=; b=hZa+ackwChZn0lWGYWnXZQE+7EKPfuw+TAx4QgXyqZJHDxPu1UhqUSyE3D+BCUinq0wTUUdH4H7xj/BYMbs3KJ5Z9Ko9bWYfg4dqu4XpuGUvIFl9pfTdxCQKk5knOLI70tdQxj4Y86/MUGLfqhSPF16XYrCFEu5E7gkrDbHaNco= Received: from SJ0PR03CA0162.namprd03.prod.outlook.com (2603:10b6:a03:338::17) by MN2PR12MB4549.namprd12.prod.outlook.com (2603:10b6:208:268::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24; Wed, 19 Jul 2023 23:21:51 +0000 Received: from DM6NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:338:cafe::de) by SJ0PR03CA0162.outlook.office365.com (2603:10b6:a03:338::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23 via Frontend Transport; Wed, 19 Jul 2023 23:21:50 +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 DM6NAM11FT053.mail.protection.outlook.com (10.13.173.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:21:50 +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.2507.23; Wed, 19 Jul 2023 18:21:48 -0500 Subject: [PATCH v6 3/8] x86/resctrl: Rename rftype flags for consistency From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:21:46 -0500 Message-ID: <168980890686.1619861.10667395157566002978.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT053:EE_|MN2PR12MB4549:EE_ X-MS-Office365-Filtering-Correlation-Id: 3dc1ecec-12fe-46a5-b85c-08db88aeee48 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fxU8qj+7B/fBlKMso1zIHQgyz219R6rOatqUpuBtZZYZMSZSQ9ig3A9r+H6sLH7nUoPu4DS4xSkzLgjvB8fntt1BlL1BGhUmMD8nd+GZcuFoZBrWFDC98qJIUAjdgm4mRZcY59PvS2c27kbGMXATASPm/2QjtzodCwgWuHgyiDyPIkvmsWHAZKb4g30I3o8STMS1qfAYSb3VnVic2veRyhNLaDGc44VHChQQH933wLzFhkGr+vLP4E1q09wJ5M4V6ajCKqa+o1QJ29Ypp+nLzzxlws5zuKGqSjCpxTbXdcQGZhzLrKFrP1h4xDG+zjxoEOjVXB9tuARmexXliCSTgYH+ErXcZF1NJbqflo4jQEMEZaLHA7+d2uyp7rlw1lqO78e4WIhzmmX8QOByOkWReiPi/gBef202pfThT5+KaKTXubcVtKQ+eGBFBdc5XSHyJzq78SX9uenzlgyMXagAauZ2wPzoLGrYpbwcq2/SsLCYy5MrLe3b/2qPmJjhLg/nn6zaxZohsDORfHPAe1DY0u2EZL4FzjJ4YNzFdZf254jicJ5CM8q8EvEuRRFaRbwmGihV8L/4kaqg4Xf3CjwO/rLUgChU3WcL2sG7mmLNtbJ/vfe3/hN6dyNnX3i0X7Rr8yNujCuVPMyN7WHYsFJNwe0XpQHG5GGv0w6T7TDRiwAR5w5BNxWetLLXbxdNm3F5TyZ0GJ2TpZKddGAUm+NhOQ8sRtpDiUz0eCSgJt7Re+gD58D0AhV38VlDMyeBdDEJyRXncsSHDUG/aV36HkGDbXBr09mDPSyTEoKYZqmQC10= 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)(376002)(136003)(39860400002)(396003)(346002)(451199021)(82310400008)(46966006)(40470700004)(36840700001)(40460700003)(336012)(16526019)(426003)(26005)(186003)(36860700001)(47076005)(83380400001)(70586007)(70206006)(16576012)(4326008)(316002)(7406005)(8676002)(8936002)(7416002)(44832011)(41300700001)(5660300002)(9686003)(2906002)(478600001)(54906003)(110136005)(40480700001)(33716001)(356005)(81166007)(103116003)(86362001)(82740400003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:21:50.5706 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3dc1ecec-12fe-46a5-b85c-08db88aeee48 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: DM6NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4549 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,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1771893737156522808 X-GMAIL-MSGID: 1771893737156522808 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. Reviewed-by: Shaopeng Tan Tested-by: Shaopeng Tan 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 2f1b9f69326f..3010e3a1394d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1705,77 +1705,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 @@ -1794,7 +1794,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", @@ -1841,7 +1841,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", @@ -1849,14 +1849,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, }, }; @@ -1913,7 +1913,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) @@ -1922,7 +1922,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; } /** @@ -2057,21 +2057,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) @@ -3709,7 +3709,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 Wed Jul 19 23:21:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 122922 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2773586vqt; Wed, 19 Jul 2023 16:33:10 -0700 (PDT) X-Google-Smtp-Source: APBJJlH95ihdoO5P4xlIa6NVgQMndausDupT5gdme3rdVBwl8QBWFGn23a3m/dWD6rx0Ce0XrBcj X-Received: by 2002:a05:6358:419e:b0:134:c37f:4b5c with SMTP id w30-20020a056358419e00b00134c37f4b5cmr4066098rwc.22.1689809589964; Wed, 19 Jul 2023 16:33:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689809589; cv=pass; d=google.com; s=arc-20160816; b=X3h7sSzAxyM5j5stEVL1eX4kZXsqm0kfxkglTm9cP3ThQ8swL1nbhe2yxwMEUKeUM2 cVG5WJwwr8i7Jrl6qzDhHqouX/zPMwg+GOVnmi7Fk7DTLBuoiqTaDEFULODQuSlq5l3v AcsefmHwTHR15oQHQ+no4ap0J+9rJTjpYbcvIbMtgCmyT7Rg0101U/p/5ILP35efzjp3 WSjfoPRJfvEWUlDsC4oLXZl0gDgV16rD9vkp8zY+H+g7R6Bjr3rT2MJ4qeMT25ewPmO3 QFy7FOIP1tnsCnmEdGVyPL6eNvvSkRiVM3H78caMNWAvVAopcOobGZBJvtd5QNIIJpWr KHNA== 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=sb12peGDFs/wQKrqWuRnsyseXFMg7ZiqzMWBfgnQtXw=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=NIxDZhEhmaDtAS6tlMsu5y5Qmy39h2SSqcF7cBvVUKrEA6eYxwucOeJuBlgnQ1inVh 2kUCW+xtiOkd60yr8r4OzLQfIxNTcy9eVUS5UY+7mEAe+6Nwka5CJ6iY08zdGsGeNuUf 4JizxRTSApLibbr4G7HNPiU1FPUNamekcRlPEuYfjxbdJKXGfNS8jywmlOOeN8tjBXtK GzPF9MzVelJWZQ1nezezK5Mck/lHkaUC8WzDoTRzLQ3JyAVP0zimMqFmQuJ/0xCOM7wh 2u+dZRkW6raX3LLkL0PhEPMC5bNGHpVzgvN5tNdHhlw/9W4cBBD1jNirwzG3/xd2A6Jo +Dkg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=1RWuwZ5o; 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 s22-20020a63af56000000b005634b3c1a5fsi2804577pgo.352.2023.07.19.16.32.55; Wed, 19 Jul 2023 16:33:09 -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=1RWuwZ5o; 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 S230258AbjGSXWR (ORCPT + 99 others); Wed, 19 Jul 2023 19:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230341AbjGSXWN (ORCPT ); Wed, 19 Jul 2023 19:22:13 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EEAD2123; Wed, 19 Jul 2023 16:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZY7Xc5bLQiS+lSBnCtR21Y+qpo+r2yyVTh7rKtxsMn8HapYX8CejZTmp6qGit+MUHVDfXLMJ9Epefl6B2iNSseGwvHTFvYTprTMj4IGpEEnLJuirMGgM+0kuZ+wtoABoT361EdF/mGaTSZUNokssn5OueEK9RBawUXnVtAfJO/NkGWqVci9vdP+P/3Onxv7YVqbUdBn5j0Z7DPRvADYvJ42L7qNJqVAvzenxuFAl6poGitK1xa/CVwS2Gk+BSZMCLU1JWMEZrjY1G6ruj7xom93/bwQ8wrL0CytKdeoBIz//H/d/JUJbfzA7d2fSAqsdAvMn+92hKwDTFtdlT1RToQ== 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=sb12peGDFs/wQKrqWuRnsyseXFMg7ZiqzMWBfgnQtXw=; b=kMzmQzL1VUjgFfsadZ6EDJUwgCRHY85lfc7NbsxYTux7JypaD+77kL2EG0UgXRrgxAkWAc3LCnm6GWCkJiISMkM6f2tIY4VlFtkNLJ4zHUnUwIXgXZSYg1mq4KPDZPhAjlDr2IImD02o1WpxZGNqeL/ATWqrv4j/OxU2DwQqFA8v3NZK0q+R1IN1GCUOkmPwKcFK5HvzNpyvaIVIVeChPEze1SUW/CD28To5CuKhvqEwmSP5Vqn40HjFImpaTff965T2HJ8rbxAcme7tkWDG7UjTaheffdk6//HrDJ1ZKilznQvD3JU+8FSGpFtlE9EQ3Z2xNw6bYWVbXZV/BOgJNA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=sb12peGDFs/wQKrqWuRnsyseXFMg7ZiqzMWBfgnQtXw=; b=1RWuwZ5oH040weJW5dpTLmoO5XJcIW5cUT5yJRIege4KHSamHKyNgdPfjx1kYm58xGxL8ng8GuQjDd19wvsEOnejceqSSuRLJqne3Rc570YyNQ8gpUpXkSzfDZLSZnVG/+HJpwR0ZREyqq5kjsP1g+2AW647ZTPb1CahvZJCWzs= Received: from DS7PR05CA0107.namprd05.prod.outlook.com (2603:10b6:8:56::25) by DS0PR12MB6487.namprd12.prod.outlook.com (2603:10b6:8:c4::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Wed, 19 Jul 2023 23:21:58 +0000 Received: from DM6NAM11FT064.eop-nam11.prod.protection.outlook.com (2603:10b6:8:56:cafe::c5) by DS7PR05CA0107.outlook.office365.com (2603:10b6:8:56::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:21:58 +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 DM6NAM11FT064.mail.protection.outlook.com (10.13.172.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:21:58 +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.2507.23; Wed, 19 Jul 2023 18:21:56 -0500 Subject: [PATCH v6 4/8] x86/resctrl: Add comments on RFTYPE flags hierarchy From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:21:55 -0500 Message-ID: <168980891501.1619861.11056885467637617879.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT064:EE_|DS0PR12MB6487:EE_ X-MS-Office365-Filtering-Correlation-Id: fb15e83a-b1c1-4c00-3f71-08db88aef318 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: flZ1IBDDmBEY+p+kjZGitUdeMLtoRBvda7xQYFgZ03Ax5eWX9cPthPuvTPc1F4bggEiQQFamXgIHdvIv+j1g0Xm1OEveVG+SEn9IccHqO5B/uHTlAwAfPxEdu+bYfPTCftiOpVeCWGBBvWyG+BBYxvuUkpVktbC3GdYa+eLTHsO6zmw6Nd9G+DJ0LaqNUFRNahhHi0P3j4pqBl1PzZ32QFP02/u7I7b2RtjRvgN6IrIcYKwXBlPd11eStT/x0blXPNbm35PutETKhGs47toCMsip2Yrvae78Gu9NleMtsw3cE/eDQZQuYxWmNUueSjKDk1qYoPzBVwGol2ywDlMHDYb0EJR0c2jy62DSR8KLU8ThfHSPOdBadbPXxmHjsgMqcVOHnAjx5fPhF7gKq4AGzQs8ARIGrvLaN+gTLr9Uu4PXlJxAgT0FrtH2Wm4G2BgxZuMamxEIcNWjA1wuAbtUTeVqgeaMPLvJxRMupa4+3f/KOdVBUrBWtqCbD5uZX8tD8ntPjFanvp7WxNQIC7XqdiBfbqq4r+AT02nGvVICtj0r5nEF4q+bJAep6dTGhvri2dHRYjKAzkUfRqAsiCXy7deUQxAjtGHq0Rg5UeqJoPuPih3rQ8FrtuerxZBzYMjrOL7tR5Gud8EfixX+QkbswKIUM9ODsAfE005t8y+mI0xHDkeUCHfTnHl5F296B5F2XEyjoqqgXzAjHpYQ+fVTPT+YRTcTGKDi08EAgOAVDvKUrS81Lmq7zbE5Pu0wIxhUwCmGFX0f3vzpfSFSKXsQfAKz+dOxp0TAl+l6ypC7qcY= 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)(82310400008)(451199021)(40470700004)(36840700001)(46966006)(33716001)(2906002)(478600001)(54906003)(7416002)(44832011)(7406005)(40460700003)(316002)(16576012)(8676002)(70206006)(41300700001)(70586007)(4326008)(110136005)(336012)(47076005)(86362001)(81166007)(36860700001)(8936002)(426003)(82740400003)(356005)(9686003)(5660300002)(103116003)(16526019)(186003)(26005)(40480700001)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:21:58.6415 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fb15e83a-b1c1-4c00-3f71-08db88aef318 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: DM6NAM11FT064.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6487 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,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1771893780600533254 X-GMAIL-MSGID: 1771893780600533254 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 | 48 ++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 2051179a3b91..783c3e36633c 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -240,6 +240,54 @@ 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 (Top level directory named "info". Contains files that + * | provide details on control and monitoring resources.) + * | + * --> base (Root directory associated with default resource group + * as well as directories created by user for MON and CTRL + * groups. Contains files to interact with MON and CTRL + * groups.) + * + * info directory structure + * ------------------------------------------------------------------ + * --> RFTYPE_INFO + * --> directory + * --> RFTYPE_TOP_INFO + * Files: last_cmd_status + * + * --> RFTYPE_MON_INFO + * --> directory + * Files: max_threshold_occupancy, mon_features, + * num_rmids, mbm_total_bytes_config, + * mbm_locat_bytes_config + * + * --> 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, + * thread_throttle_mode + * + * base (root) directory 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 Wed Jul 19 23:22:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 122923 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2774237vqt; Wed, 19 Jul 2023 16:34:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFlfy64LGdWeoHYQMdPvms/f+ZlLGMfiOJnwAQaUZZZIHaiWX9+Nvcq+uaAaxDKljVuwJ1U X-Received: by 2002:a05:6512:39d3:b0:4f8:49a8:a0e2 with SMTP id k19-20020a05651239d300b004f849a8a0e2mr387401lfu.16.1689809676498; Wed, 19 Jul 2023 16:34:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689809676; cv=pass; d=google.com; s=arc-20160816; b=sy9u6OD28AP4ZwUlxAnP/IFUl8YRBUSCvON+gyEpBzkTEaSqd5dM/v5UDi2Em48kDK BP/a2biQgI6fM+jWw+MPMov8IHJxpensFu+Qr2DOChHsu96wpnv5V/995C9rZhLeEqJ8 xSvGYr2ekBSMcOhmgJbmVf/shytmZSA7AlGSnbauTpGyVz2UxOo/k6DX48NAbLMv9EC7 oR4Y5/waZzMyk41Yzk7OX9M49zfl7F+S/aIh/c0AfJ0RuJs/ZKCV9lKZTo/uZh8ev3by LQRqURcJlQqN6x18e662NgKn1SXcHYksbv//0M09CDRJKvOkFyGKen0mmiIPZz7hPXKd BIXQ== 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=Th6/t3mREpZEsSW4UhPaIsUf+aPY0ugCbYGGZAF13nI=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=kpwKWb/kLJkB3XhmF3eVQCc5ea8OIo4FsRM1GwW7/2KXVXs6+JDx1wH+nTpm0XVpxd +yZBTYbef8tg97p6jnBtrS75hdxhG9vgC99GNAgTiIXx7iVsrK2ghaPOv2XFgPhY+enF 4AUj8cEKZvO2oeYiIu2bvynOihLK3gJQ6FMXKmpYBcsp6kYP/MZlpyYffvfbaaGQ+d9V VIq6e79vRUfoSQliujNlljZfkr9OAxX+Oilg9QY4GRRS4sJtFmRKzwVu49RaZK/vhXrA 3SiLdAQqVfgXgDmJsiOeN6JYJoq/jJVLJAt1WbVPyMBaWBIAICwtZMZnYtv9Qd/OtGNA hTmQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=RgXEcUug; 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 l25-20020aa7c3d9000000b0051dd1d7fbeasi3605013edr.683.2023.07.19.16.34.12; Wed, 19 Jul 2023 16:34: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=RgXEcUug; 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 S230245AbjGSXW2 (ORCPT + 99 others); Wed, 19 Jul 2023 19:22:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230268AbjGSXWZ (ORCPT ); Wed, 19 Jul 2023 19:22:25 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2083.outbound.protection.outlook.com [40.107.102.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2F43268D; Wed, 19 Jul 2023 16:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lAehErivdl0MnBQQuBctUXbMWuJqMmkPP/sR4EN3R7QUOaJzo1QXm61nzjMXk/DrDyQXW94OlSQfZpZ3Jr8t9AymupHQE6ZIvxf5A4vF7doIi8qcEf9zoe2PdK//yv/H63cO7DLku/hV7QCK+TTxdaGhuxLqm0jkGsBdcW/LDLPF1e7kkpjrGwY6Nw6ZylqsOwwbAuCsIcN91gBpFGeWlHEtz+Y4IrNQ6u1IlUgRjDEsPYJrJJe2Q8HCe4y7CNOjW6WZFLVKp52JLABc6YT//J23liM5MZswiIpKss+AwA67d/ZEFpoMGMGlvHqDJaXQcSJI9EOjutg2c5UWBoITIA== 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=Th6/t3mREpZEsSW4UhPaIsUf+aPY0ugCbYGGZAF13nI=; b=g7LsqhF5foAb2VUYNroKt7PHpuT4hwsMO9G1vPWAislrBoWGlJlyQv4VutFzSodKyj3+XA9100jL3nXZMC2Z+xMyvXbX1In3nS4YwOYReMws9umAtIlYSGSlrqoZBrjlYFpNpht92AV62jIfWYQ13xLpON8qi8nJAcV5t29BEuWwYQtHa1Ji4e4biWz6+MYIAKVvTSgUpgXORBUlB+gnOg9PfKszyfHmKG/t/JPdOtJllE1Uv+66R7L0Q8kBkVZfZnIvzxmLEcT+cDN6RkDrui92HHPS2EHLUCnk0gUcrtcB57LgNYclRtzX38Tefi5/+ok9vhKL4vcUMD6dAKcmew== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=Th6/t3mREpZEsSW4UhPaIsUf+aPY0ugCbYGGZAF13nI=; b=RgXEcUugFTlIPxzQq2rcerrioJIW83v7Utn1ZZzsObrgojD2p5lVpiUk8OIux6Xp1JsQvIaMFvzVY8IunqZJLMBOhXiQugy0zxjiguY1SGxQqt+RDMT0JQsfcYYiuKhwdsATv19p5r4UlG1FqXGjNZcLvpREdTVs6Gp6Xv6najU= Received: from DM6PR02CA0062.namprd02.prod.outlook.com (2603:10b6:5:177::39) by DM4PR12MB5231.namprd12.prod.outlook.com (2603:10b6:5:39b::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23; Wed, 19 Jul 2023 23:22:07 +0000 Received: from DM6NAM11FT051.eop-nam11.prod.protection.outlook.com (2603:10b6:5:177:cafe::1c) by DM6PR02CA0062.outlook.office365.com (2603:10b6:5:177::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:22:07 +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 DM6NAM11FT051.mail.protection.outlook.com (10.13.172.243) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:22:07 +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.2507.23; Wed, 19 Jul 2023 18:22:04 -0500 Subject: [PATCH v6 5/8] x86/resctrl: Unwind the errors inside rdt_enable_ctx From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:22:03 -0500 Message-ID: <168980892326.1619861.2405779251348138586.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT051:EE_|DM4PR12MB5231:EE_ X-MS-Office365-Filtering-Correlation-Id: cac4c581-50c2-4519-b385-08db88aef86f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LQHIaSHsrAzt2Lt+PNg6amcJX6kxOmTc8Wf817vCRAkC4s255yLHX26qvOK7Lb3S8On1GaUjgzzRiNxYIqzmKE9Q+BwHaRJCcg4YPn2k6aOZdfMukqzlu06IR0ABB43skT6kS36gyMRgDxj7ZAsPDdT7SHcZ0A0lhZQAAC9e0YCj+MPJWXiW8h2TTSn4sQ0owotR/0Q0IFIFCByIiKSMDXl7/mbvtooI+l5vcnpu8iABb3z+r55JCKBqJINbpC04cKkhyNtBD/deN3UqbaPiP119KGE1xXqAdPee4MX12hZYIwxrkTNTHAegmPklGH8tsM3HSIl44L2xgGc10xMFyubiLXuG0SBVoNaVPbU09DtJMuxohQYbES5bgjaNufPgjiqyG5YywqIYyCeiBiDBm7OyDryiBmDzQGSvT0Os7epulshujQKc3Bgwx/MIR73BL3w8H1NpMiQQiMp/6NQE5aRP+r6GNSMe3U+J9EwxFVP3cbEECKF85pNzNKyw+NH8r1EzOi4uZDxvkoC+uIzdUcuQ91Hyz1iv+HkObTC74dCCsWyysHnrA4+/SqmkVs3V/85G1lyP1hLquiPZX+6nPY9TH7YchQqv5YI0OsLTN5BS+XuOHEG6pUHuXwOGIzIHjDgnD7HtvuMq7V7YS+cLrgW7GgIbE0PXurBg6AKjvLyjAoIoHffOsbh9p0Dnuv7o/K0lf1PuPYaWvboRg9Mpm0zZgzA4k55Ih+8747hS8Jmg0I2SYI0fP9hetnqbzoIAz0o1lUBqHJkdZYxv8Oo9LV/PxQU9bCXFhSSy5eiM1SA= 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)(346002)(396003)(376002)(39860400002)(136003)(451199021)(82310400008)(40470700004)(36840700001)(46966006)(103116003)(16526019)(110136005)(478600001)(54906003)(186003)(26005)(336012)(9686003)(83380400001)(2906002)(70586007)(33716001)(41300700001)(5660300002)(8936002)(7406005)(8676002)(40480700001)(44832011)(7416002)(16576012)(356005)(81166007)(82740400003)(70206006)(36860700001)(47076005)(426003)(86362001)(4326008)(316002)(66899021)(40460700003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:22:07.5720 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cac4c581-50c2-4519-b385-08db88aef86f 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: DM6NAM11FT051.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5231 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,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1771893871413867587 X-GMAIL-MSGID: 1771893871413867587 rdt_enable_ctx() takes care of enabling the features provided during resctrl mount. The error unwinding of rdt_enable_ctx is done from the caller rdt_get_tree. This is not ideal and can cause some error unwinding to be omitted. Fix this by moving all the error unwinding inside rdt_enable_ctx. Suggested-by: Reinette Chatre Signed-off-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 3010e3a1394d..9a7204f71d2d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2381,15 +2381,31 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) { int ret = 0; - if (ctx->enable_cdpl2) + if (ctx->enable_cdpl2) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, true); + if (ret) + goto out; + } - if (!ret && ctx->enable_cdpl3) + if (ctx->enable_cdpl3) { ret = resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, true); + if (ret) + goto out_cdpl2; + } - if (!ret && ctx->enable_mba_mbps) + if (ctx->enable_mba_mbps) { ret = set_mba_sc(true); + if (ret) + goto out_cdpl3; + } + return 0; + +out_cdpl3: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L3, false); +out_cdpl2: + resctrl_arch_set_cdp_enabled(RDT_RESOURCE_L2, false); +out: return ret; } @@ -2497,13 +2513,13 @@ static int rdt_get_tree(struct fs_context *fc) } ret = rdt_enable_ctx(ctx); - if (ret < 0) - goto out_cdp; + if (ret) + goto out; ret = schemata_list_create(); if (ret) { schemata_list_destroy(); - goto out_mba; + goto out_ctx; } closid_init(); @@ -2562,10 +2578,9 @@ static int rdt_get_tree(struct fs_context *fc) kernfs_remove(kn_info); out_schemata_free: schemata_list_destroy(); -out_mba: +out_ctx: if (ctx->enable_mba_mbps) set_mba_sc(false); -out_cdp: cdp_disable_all(); out: rdt_last_cmd_clear(); From patchwork Wed Jul 19 23:22:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 122929 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2790633vqt; Wed, 19 Jul 2023 17:17:30 -0700 (PDT) X-Google-Smtp-Source: APBJJlGCw7jQ5apNnSyvO1l5DokRhhSrLHJee0MRjgCfQiO74eeuC+q7ISP01juu86UvFlfPAfX1 X-Received: by 2002:aa7:c0cd:0:b0:51d:ad30:5ed7 with SMTP id j13-20020aa7c0cd000000b0051dad305ed7mr3319878edp.35.1689812250231; Wed, 19 Jul 2023 17:17:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689812250; cv=pass; d=google.com; s=arc-20160816; b=JGfurl0IcsucckhaALZXiKSIbkWLR/i4V+GD3t2MOiyt5evIWsvV/mLt0TBvTRHDrk 8fpXHguG/a6Em/MRZM4yNp06S1zQJcrgzXRbYRfZImM7Oe3bIPeisN2YMofLS3e6EE45 KY5uZUunJf10gwSD43ZsRHUjY/Tr7e9pHru9zAwz0GrHS96qFOYjgE+UeTmAzI0l9ZfB R7ghnHyfdvPlpkOMKp96YM0buthwO4Plg8Q8I+D/x1uE2tzDd5TvmWyaXxO94pJeIH19 y9D9S88xpz3Eq2C2iWXuPVR8BGgZKRxRZrFgmydLoP1XbrXf6J+HBmCySPtQTk8EPnsQ 5CoA== 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=QrD9V2/prOMs2/duKMdtxaSRbb0w0K/uqb3zoiUjYlg=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=Monp50FsoV4dePUrgDT4YUiWI7Tehr0p9wDzVT9I43NewR4EsoCg+8sngeHAofzFH9 SshcGoBFRIe1pLSiRs7rmqNK4TTInCKA65yXYCQ/FHxgyEd656mfqjOzTaGzx5giH0MY 4J0pbLzshrcD3enzBynKRACehpuMYpMv61lzOz1l9UGpcM8ohN+cja3iZjsorQPCNlXw oUCLtJO0KpVn97SOfHnSojqBMpMVGx2XnerubFomup6i8NUwipoIl40ItR1Z67bkHYHd yPxs3hrJjid+yOCD57loN0tXPhf+OGwHUFNIxQsqF2THkkxn/nqdcT3KoUyNp+ikboF3 cJpA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=JifsHEmM; 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 d3-20020aa7c1c3000000b0051de1341e01si3460426edp.228.2023.07.19.17.17.06; Wed, 19 Jul 2023 17:17:30 -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=JifsHEmM; 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 S229642AbjGSXWh (ORCPT + 99 others); Wed, 19 Jul 2023 19:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230233AbjGSXWf (ORCPT ); Wed, 19 Jul 2023 19:22:35 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2082.outbound.protection.outlook.com [40.107.92.82]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71E841FF9; Wed, 19 Jul 2023 16:22:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OzwR/WxAJb8trhv8YHGD3/vEPsMp49LYmEhSHpECkkBkJDShVVLcams2HAzrrvS0euZPtfga3nRJpp3Ra/ThXGcFe8we+ca5cWXBI3l1JcD5X3Piq3LQ+iNIcTCLCFfV07zUoEzadNAffPODONFPCXu+Tvr/ivki1oQxY9r9DtL6Ed9oaJJS0qO1BZz/bUzUJI49AHhVrFxfhmd+1URYKIqb0w1jguQGTUNYaHv4ETg0QkcGNy1U55FemO3q3/l+ane5yYGXemwW/XgmP2OXHTMFwRWrTE4v6ldhgIpp3W9yVl7lKUh6oNFdTNWaKeMOdZfXuR3w3F7fSYfQ9w2lNQ== 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=QrD9V2/prOMs2/duKMdtxaSRbb0w0K/uqb3zoiUjYlg=; b=MBWO4z1p9w7vg/55/lNcMEnRqN52Nka4N8dKehg51Vq0K9/M9dPTtHUjCTB4kBcOnFtkVX6xqmQxctN9iRtG916xqBSHg8N535lhMkWntjxGj4AcPZZRgvXt1xDEAqwrVU1wmsCHBlZEsWT7a5Vrvs0QmBr/4EZM11K1QgAiuT4uvw3yL4cYQN+7a6j9UQGDsiLE0QQXFsNSDmRTPtqndqw0g5j+8N69aezAf1dVe2Db5kLneSCjiphsWd78DiStupiDZVkJnPKFhdWtim2N7NabaXKecUR1vWERFeSp3/MUBWZzaWFkVROpmzkdNNr21aaDhZd7fQ021GDFCGGPlQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=QrD9V2/prOMs2/duKMdtxaSRbb0w0K/uqb3zoiUjYlg=; b=JifsHEmMMFrEfyDp4GM2y+5FliKNFZa4UZjHSNJqOwGRX14rp5rA8p4mCW9sWFGNkH9kuzSGK9CZZxorS6LTG+bONAkyrilo0Z1gTcdpSPHXURbByvwvaK3h4SHg6ghCWILjndgm13PPV9Rp9Yk9wiLHbWlyiMPM6gzFBuknx4I= Received: from DM5PR07CA0098.namprd07.prod.outlook.com (2603:10b6:4:ae::27) by IA0PR12MB8301.namprd12.prod.outlook.com (2603:10b6:208:40b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Wed, 19 Jul 2023 23:22:16 +0000 Received: from DM6NAM11FT073.eop-nam11.prod.protection.outlook.com (2603:10b6:4:ae:cafe::f8) by DM5PR07CA0098.outlook.office365.com (2603:10b6:4:ae::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:22:16 +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 DM6NAM11FT073.mail.protection.outlook.com (10.13.173.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:22:15 +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.2507.23; Wed, 19 Jul 2023 18:22:12 -0500 Subject: [PATCH v6 6/8] x86/resctrl: Move default control group creation during mount From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:22:11 -0500 Message-ID: <168980893158.1619861.8945141367681744527.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT073:EE_|IA0PR12MB8301:EE_ X-MS-Office365-Filtering-Correlation-Id: 48509f08-1341-4f2c-e3b2-08db88aefd39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CSH5z4GsSB0gEfynm4UUe7x2nJDTxt0pFhm0uQHx++ucEK8tO8ly36qiRzCkJuQ9SfYFSJdM4VZ9Z7+5jv4vDF4syH4jf2Cnm9xvukRkQUv4VcaPNcGxRQ1F3Wfg5F29oGoSxxXvp9xVAPZMOXQyFSequr/K+xZe1JNn+uNUEOOTu0EPtPJFmsziuAAQOcBK3u5/hozlTYyZ7eN1qeANurNNpD/g9qnaEIe7w58E2/jkXTUSMsSKgYlorbEpDiTBskThHdxnU0PNaV6c0qK2O6H0cCHynTCet4b7gPhAw/3GKthPBMJzqaFg18aKYZK5Q5M5D56np2+LHNPYX+meEQhOfLDaH8qv//VHW8gbDXjQri25Tdgtfbs0gAsPSdi46wf5wNw6nAO8O/d8fwm6Gv9Jf4ba36wSuZLyAd1GhrzcSIwTxU8xO/pl1UN49uhmUM6FSBF4sOkcNQ82+vmJOxhWCDoNLo5XDfjHYbpNQN3LBBD4/X5CsBdE6vNmE4C6W23IMpSGhlDItsMWJ//QoGTwgzNxn0jFtNBNWStJ4lLrQqE+TpLF/0cyDj2WLK0YPwNGVA5zDwuxa4dczpLdEg6Az7J5+15bMdMe79YkD3OedC1/wkBUs90b+29uiTtQ6yli1R7D3hrQniEUGqSlJenMDCkODKCAgc2QcTC9EUkQXKhkND0Y0u3/LJefgGuR8eNEi3Zh1zf71pHXc+SMzSI7ePowEt1Dxdx0McD/Dn8jHWr4+vn2F9VpcSutKts7k9xMbreH3Q7JzfgrH/pOy3Q33ASmPDAa/dY1XJQOI4U= 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)(376002)(136003)(396003)(346002)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(7416002)(86362001)(2906002)(33716001)(103116003)(7406005)(44832011)(40460700003)(40480700001)(36860700001)(186003)(16526019)(336012)(83380400001)(426003)(9686003)(47076005)(26005)(82740400003)(81166007)(356005)(16576012)(110136005)(70206006)(54906003)(70586007)(478600001)(4326008)(5660300002)(316002)(41300700001)(8936002)(8676002)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:22:15.5611 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48509f08-1341-4f2c-e3b2-08db88aefd39 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: DM6NAM11FT073.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8301 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,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1771896570185995403 X-GMAIL-MSGID: 1771896570185995403 The resctrl default control group is created during kernel init time. If the new files are to be added to the default group during the mount based on the mount option, then each file needs to be created separately and call kernfs_activate. This can avoided if all the files are created during the mount and destroyed during the umount. Move the root and 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/internal.h | 1 + arch/x86/kernel/cpu/resctrl/rdtgroup.c | 51 ++++++++++++++------------------ 2 files changed, 24 insertions(+), 28 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 783c3e36633c..885b656d1088 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -601,5 +601,6 @@ void rdt_domain_reconfigure_cdp(struct rdt_resource *r); void __init thread_throttle_mode_init(void); void __init mbm_config_rftype_init(const char *config); void rdt_staged_configs_clear(void); +int rdtgroup_setup_root(void); #endif /* _ASM_X86_RESCTRL_INTERNAL_H */ diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 9a7204f71d2d..e0570bce76a2 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2512,10 +2512,16 @@ static int rdt_get_tree(struct fs_context *fc) goto out; } - ret = rdt_enable_ctx(ctx); + ret = rdtgroup_setup_root(); if (ret) goto out; + ctx->kfc.root = rdt_root; + + ret = rdt_enable_ctx(ctx); + if (ret) + goto out_root; + ret = schemata_list_create(); if (ret) { schemata_list_destroy(); @@ -2524,6 +2530,12 @@ 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; @@ -2582,6 +2594,9 @@ static int rdt_get_tree(struct fs_context *fc) if (ctx->enable_mba_mbps) set_mba_sc(false); cdp_disable_all(); +out_root: + list_del(&rdtgroup_default.rdtgroup_list); + kernfs_destroy_root(rdt_root); out: rdt_last_cmd_clear(); mutex_unlock(&rdtgroup_mutex); @@ -2652,7 +2667,6 @@ static int rdt_init_fs_context(struct fs_context *fc) if (!ctx) return -ENOMEM; - ctx->kfc.root = rdt_root; ctx->kfc.magic = RDTGROUP_SUPER_MAGIC; fc->fs_private = &ctx->kfc; fc->ops = &rdt_fs_context_ops; @@ -2821,7 +2835,9 @@ static void rdt_kill_sb(struct super_block *sb) cdp_disable_all(); rmdir_all_sub(); rdt_pseudo_lock_release(); - rdtgroup_default.mode = RDT_MODE_SHAREABLE; + /* Remove the default group and cleanup the root */ + list_del(&rdtgroup_default.rdtgroup_list); + kernfs_destroy_root(rdt_root); schemata_list_destroy(); static_branch_disable_cpuslocked(&rdt_alloc_enable_key); static_branch_disable_cpuslocked(&rdt_mon_enable_key); @@ -3704,10 +3720,8 @@ static struct kernfs_syscall_ops rdtgroup_kf_syscall_ops = { .show_options = rdtgroup_show_options, }; -static int __init rdtgroup_setup_root(void) +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, @@ -3715,28 +3729,17 @@ static int __init rdtgroup_setup_root(void) if (IS_ERR(rdt_root)) return PTR_ERR(rdt_root); - mutex_lock(&rdtgroup_mutex); - rdtgroup_default.closid = 0; rdtgroup_default.mon.rmid = 0; rdtgroup_default.type = RDTCTRL_GROUP; + rdtgroup_default.mode = RDT_MODE_SHAREABLE; INIT_LIST_HEAD(&rdtgroup_default.mon.crdtgrp_list); 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) @@ -3858,13 +3861,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) @@ -3897,9 +3896,6 @@ int __init rdtgroup_init(void) cleanup_mountpoint: sysfs_remove_mount_point(fs_kobj, "resctrl"); -cleanup_root: - kernfs_destroy_root(rdt_root); - return ret; } @@ -3908,5 +3904,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 Wed Jul 19 23:22:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 122927 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2779303vqt; Wed, 19 Jul 2023 16:49:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlFjPH91Zh0vG2mWuQPj4MZQ42Q2BQ/QX5WHzpcFsSLJTeVNg9Lr3wFtVjmlsJed71tUEoYt X-Received: by 2002:a17:906:7a11:b0:974:1e0e:91ee with SMTP id d17-20020a1709067a1100b009741e0e91eemr873627ejo.13.1689810584208; Wed, 19 Jul 2023 16:49:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689810584; cv=pass; d=google.com; s=arc-20160816; b=Yz7jVN72cFw9H6Fx9tJEfQAcOruYhZ0SJqDWxLCCywRZ6eMh4wlEdOA3/Rm9BSLbse keO/+RoY3bqJONjgQjKVm7oj3f6Xb2tnz7b9nau/pHh1Q3uB/vLGCM8resvns7nacwhs v1KgXNDjx+GYVq59nffdGgNY9Qz+uIRpDBjCehVOJ0Ua/GSOtYCMW2YxdvBCT6KhDviv /ZZQIv3cNk7tVNa8bwnGd9fh7/xkGWDw9+9oSQeQgoJ+xjGjNY/WGIelQ0Hw862Cw4xA 1zhfxUcnWj7R1iU8K7DCSUteDpe/7kBtmwjOGHWoB42Fh3O5wqRYbbY3WUrLVycCm13F /mpQ== 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=k6dT+F33syFlQ2/KFTWohshO77y0qLiFpqKxl8jvpp4=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=iH4k9C+XLu4QZaXwSQDL9lf5t9yRyLFUojr/pmuC9c/ZmGiqYB+5NIgXU0qGjFin3J NtGLB7jddtBFFdrXEefewufybo+mCvcR/Herrbn5J0psf4pqjV36Wh4X85pDwRwNjW1X /UQ77H5i3v6qSgrmz6SJzOOX6zU60ds78asB82KCCU79x3H3kao1MCJ2jesNJvEvzfu6 Cxtjz2C6uQj5vokMUd05C8hnUVY7FC9sB8hot0BKkucy38PSArPi5/pSLAAYkw1cqK1C kIhftzrpPRdoun+NxkrBMgF7ZLr1mRd+xLZLD5xZpak8OCLFErmgncGyiM2UIyFCrfns iatA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=fbELrNnk; 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 r6-20020aa7c146000000b0051e28e8f27dsi3707723edp.602.2023.07.19.16.49.20; Wed, 19 Jul 2023 16:49:44 -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=fbELrNnk; 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 S230314AbjGSXXC (ORCPT + 99 others); Wed, 19 Jul 2023 19:23:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230515AbjGSXXA (ORCPT ); Wed, 19 Jul 2023 19:23:00 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20600.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::600]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 288742708; Wed, 19 Jul 2023 16:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SaIXTEyDdlNvyFRL8GJQuAeihiQ6SgjN418fgkdCgN8ABD+nJuQ1e5LD0KEEERlUdMIA1tLZRf3eoWrybrsozlVvOVbls/11/XgWxiSbypMewk1M7AY6xxeSxbehdp+y1kSnruj9TFsRIWwBROAnZnyFjlbECu7C9QW0Ui46y7HwSzgKsHF12CHDEduY7040p+yQWb8F/jwlB5l5lmkDF3ztdn9gqOUTkii3ChZ8lklvz9RFB7cTQyjJJw7UKTs2IGoIXRN5aDmr2VkYIWruQ7ugNeNFI6OhgnmBa6h0U1gZsmo9OozBufoLuZnq2IYBf89FN17hDLXe5HCauHgI9w== 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=k6dT+F33syFlQ2/KFTWohshO77y0qLiFpqKxl8jvpp4=; b=V3dhp1bwuk/mKFH53mBqytNp96jwco/mXHCVe8W/erXm6k5+EpPSMJDlAhnCMUDFOVGIVGh4chex8Qt/T/lGMXctKdsk1wcR2btI31uLWwwFn1eKfCi/Dg9G6tTeTjjvnR2+//vDo1n5Ofm4NUO2fMBTtGF7kQB0Pi20gvhbO+rnF8B7Z/gmG5PJtOSqh4HY8LxKRPnU5D5aMQhashkR48gaBc7RxWm5H8rPxl1KKDdgg8OAEYkmsSw3tXyBVbQkshwU9UeYQnNnxFmUrnMqH5+gkBlwMHFyS5/aL0pHEy3FCNkEZd8KvXFIGmDQlimX52Ge2YSme3Cnn83i+95HhA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=k6dT+F33syFlQ2/KFTWohshO77y0qLiFpqKxl8jvpp4=; b=fbELrNnkNdLBnY4Rjf4kx2Ke1gAqewrKcVNmIHDl3OFJSZenFn0LR0zIKBkjvXQ1svSMMhZmJGpQk1azIBZR7L6eN9rkIhRshIY8cm+wyptabl3v33tr5zaC1Oi80P9WDpVJ9AxQfCDIdQ+JZMjucFfAbQzSSZicL452wFYOblE= Received: from DM6PR06CA0053.namprd06.prod.outlook.com (2603:10b6:5:54::30) by MW4PR12MB7031.namprd12.prod.outlook.com (2603:10b6:303:1ef::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23; Wed, 19 Jul 2023 23:22:29 +0000 Received: from DM6NAM11FT034.eop-nam11.prod.protection.outlook.com (2603:10b6:5:54:cafe::25) by DM6PR06CA0053.outlook.office365.com (2603:10b6:5:54::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.24 via Frontend Transport; Wed, 19 Jul 2023 23:22:28 +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 DM6NAM11FT034.mail.protection.outlook.com (10.13.173.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6609.25 via Frontend Transport; Wed, 19 Jul 2023 23:22:28 +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.2507.23; Wed, 19 Jul 2023 18:22:26 -0500 Subject: [PATCH v6 7/8] x86/resctrl: Introduce "-o debug" mount option From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:22:19 -0500 Message-ID: <168980893967.1619861.7249871216790436466.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT034:EE_|MW4PR12MB7031:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d9abe14-372a-42c1-e62a-08db88af04dc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mmDWzIM/sgigR++mULfOJfVO4MOiRW6O4pgzpsu/lDv8uXs89B1DhnC50B4y1U8nkSo0Wn9qTzOr+jG9GrvOkum/vRK1ZyNhgXBU48Jyw2qvCaQUJv+VdG/T12KCEbbzPk9sLavQum2FgsqPK4fsAiHv9bGvZBW1VCF9kYCLQF47H3nrPNE0WaVXxHCV1jcleI5ArlIRuHY3Z8cFdTpNPj1rh4XsBqkxtr5i6SOru5aWPSOvpMTf1ardRRqyHUPulawCSKvL09HaypY+uTMdGXVMiQbD78ZRJODaqJBhMyW2ovfUpqVlGJ9OuNCXInQRxlhZSEl3oqDiOQij3CtuuKw+fFVDBNhaXBiJ0qsshw28p3WpsGCgVlzOAuPY/YDviBD/IIc0LqYZmTITerUPFI39sHJmhqVnmrertzsx0/Lr5ErW6NXvGqO6/Al7mVUQwMuWCS9UPgCA+WaCprNslFD3hGloOom71RqNkkMqm6JEgIEiwhy4NfWKCe04XlprLkAfiH8wFg0jNUIZx6k6B/v5fiL6949PKsfiGOJxM63hGA9TAu2iLaaapIi2dVLd8VRymj5GItnzycZtlGAnvTaMsH9qVMSI4uUF58d7EyqzBzmbjIczxoofRuQc7pc+pJcN5fpbYbNtPHj1/kO6LuyDlOmaWx8Hki50Qt3cA15azfsLitCudrTIG1kSdzze7QURp08SsgvwqZ7l7VmdnhnkocpRSLYrYgL/zSgoZTZi5V/26Mi5a1qGDsW3SKstd9AJ7bNqmScNIyBMWEgEGW7GrHjyKiphH73wrwkQLFA= 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)(39860400002)(136003)(451199021)(82310400008)(46966006)(36840700001)(40470700004)(186003)(336012)(16526019)(103116003)(86362001)(40460700003)(40480700001)(81166007)(82740400003)(356005)(2906002)(47076005)(9686003)(110136005)(26005)(44832011)(7416002)(7406005)(426003)(36860700001)(478600001)(33716001)(54906003)(4326008)(8936002)(8676002)(83380400001)(16576012)(316002)(70206006)(41300700001)(70586007)(5660300002)(6666004)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:22:28.4516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1d9abe14-372a-42c1-e62a-08db88af04dc 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: DM6NAM11FT034.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7031 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_BLOCKED,SPF_HELO_PASS,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1771894823061633242 X-GMAIL-MSGID: 1771894823061633242 Add "-o debug" option to mount resctrl filesystem in debug mode. This option is used for adding extra files to help resctrl debugging. Signed-off-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 5 ++++- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index af234681756e..5a2346d2c561 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -35,7 +35,7 @@ about the feature from resctrl's info directory. To use the feature mount the file system:: - # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps]] /sys/fs/resctrl + # mount -t resctrl resctrl [-o cdp[,cdpl2][,mba_MBps][,debug]] /sys/fs/resctrl mount options are: @@ -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 885b656d1088..5bc18accb887 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) @@ -296,6 +297,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 e0570bce76a2..058c1dedb2d7 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); @@ -1871,6 +1873,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); @@ -2399,6 +2404,9 @@ static int rdt_enable_ctx(struct rdt_fs_context *ctx) goto out_cdpl3; } + if (ctx->enable_debug) + resctrl_debug = true; + return 0; out_cdpl3: @@ -2591,6 +2599,8 @@ static int rdt_get_tree(struct fs_context *fc) out_schemata_free: schemata_list_destroy(); out_ctx: + if (ctx->enable_debug) + resctrl_debug = false; if (ctx->enable_mba_mbps) set_mba_sc(false); cdp_disable_all(); @@ -2608,6 +2618,7 @@ enum rdt_param { Opt_cdp, Opt_cdpl2, Opt_mba_mbps, + Opt_debug, nr__rdt_params }; @@ -2615,6 +2626,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), {} }; @@ -2640,6 +2652,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; @@ -2829,6 +2844,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); @@ -3710,6 +3727,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 Wed Jul 19 23:22:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 122928 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2790532vqt; Wed, 19 Jul 2023 17:17:17 -0700 (PDT) X-Google-Smtp-Source: APBJJlH74JCjZMuyLfEvio29dCtFpSlgpY5FLQbMi+HKk09BD3gxTSGl69k1n0xaWwJcPL4Vudbj X-Received: by 2002:a17:906:51d9:b0:993:a379:6158 with SMTP id v25-20020a17090651d900b00993a3796158mr3923388ejk.17.1689812236852; Wed, 19 Jul 2023 17:17:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1689812236; cv=pass; d=google.com; s=arc-20160816; b=z3jLssZZqbZ9JZnndJCmS8xqky7nyFek94lwriJznGR1LonKLC2mCKZHhmxO128eec RJ6Em87kJqQ+p8YvyNUZbwC5TaNvfcmCLEJum0cGk3WRkfIC0anc6LVRZOQHs0CPUu81 W4ifmOansZqVbIDYq6gB0CNeT4gETX+GbQK2fyMdokR0VGgbbhHlvutXjH7+HpVJMUtk oIWKvG3zRySiJhl4RCsy3mN/ZUgSd4/BXzCkz4j7VUvHf9Hy9B9LYLna+2W4X10dDACD 0AJKGRghy73FwNHAWr7Kf3s3W4iVvsNJZPW9YawAx1kiE6ObcaWGWNP46wbODApddmc1 5eCQ== 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=gu5Gez9IRORAZnbCM+m/XoNo0yjYDKKAX9wsPEbpSUk=; fh=h28vckfI3GX5WFto8VbLoaUMI0xqlhwXGWb2ZADi/Dw=; b=RwVqFUTUMi2pf68/NjTQhpNDNaENIiK6H95/cwXEmxc/RJo0uLk6sC8qqWUX8bxsMk iEQru/58pnVffLM4Q2kb98dug2AFycA7DNUxiWZbCUR2WdNHjRHenRpBwWZbjG2nXn5q HCu6tW3RLtd7pKZoo2lMMzs2+5/YodOZRKEdYCRKRwhc4/lB2B2AheME3IZwaK9PFC2a D4vo70ELaPj8mFsEtQB1K9/aSWPQM35n/YYfCZJRDRD1LoGRU+Ijy72FnKEqolWZqCqP rkWxNrwj3nBwFp0Vd6a7hlqIXUSSr2yAea3cUsyQWHXqKCal4a2vwVBzC+TqkmnK6Nm1 vBAA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=uuDtBnO5; 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 t27-20020a1709063e5b00b009945340230esi3572915eji.174.2023.07.19.17.16.53; Wed, 19 Jul 2023 17:17:16 -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=uuDtBnO5; 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 S230128AbjGSXX2 (ORCPT + 99 others); Wed, 19 Jul 2023 19:23:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjGSXX1 (ORCPT ); Wed, 19 Jul 2023 19:23:27 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2089.outbound.protection.outlook.com [40.107.237.89]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C955172D; Wed, 19 Jul 2023 16:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mr3PsYlPJPT40QGh1Q5+tWdo3tJZ6wTcxQFIgQzjQVHRd3+Pa/JdUkTidfAKFwnehm7JaeIbAM24xZJgmi8RwCZLZg1JsrJsv4EtOIT1MnQK/U3NiA8y+Y7pocuEZdvENgty3OpKQOJajFVwc+WCwcUez/XheXaUlvQbLzE6Hv7kN91p3YDkQTTFg+5KWwDVZcLJNBwq79IKh1xp6gZuF9e+8+bMBtJcYyu6z6Iy8m2nKTcxbZYGAPRaOPgCM7RjK74CmXorshn8HgldN5B2qbevnNtR0vZITeEBEQZA9JY9RFWo90iI/0pErAYRHyme8gCYA3TVTiAdcih/e1Vm9w== 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=gu5Gez9IRORAZnbCM+m/XoNo0yjYDKKAX9wsPEbpSUk=; b=d/UIwHGLS0GZ3wgt+DHJmpEE8A+yX8gG8KfKyybU5pKLfXOieHRN/P812+q8CAVKAlOfRp7wn7hgDm49InrioAQtL1No6J93Hwc2e2RqSkTgw1ayHputnFu8zXsqO3YcdT2DNUxxRfqvldDrQ3dDE9eDm6++DwypkNE/iN8RrQpGXd6MigiwTLAGQqPZLyaL1RnmB3VDDcKIas/zdO+soofX/jy3pzQchazuXGXSMs+ES1vmdb8VugOym8+p0jDByO3s/mRNFOQpRBdsjx3CvfdiMoyT12H60vtaGTmQ5LiHLv8PXS1QefL6CvHsj2onDnZEh5WdX+y96AFghitSUg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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=gu5Gez9IRORAZnbCM+m/XoNo0yjYDKKAX9wsPEbpSUk=; b=uuDtBnO53EgLY0lAUFuNHQf6EETNGxPCxDxs7UZF//1d7YNmHbtSuULt14hQTecRsJQVMa9KR+CPJmtSMSKwRUGAKsmlMJa1HqikQ+CCOa2Pl9UVscpUNFkMFvYbp8Q9x1m4hcZWftxIbc3RyOjbMtwQYv9A31KuYqAtY+QDZh0= Received: from BY3PR03CA0025.namprd03.prod.outlook.com (2603:10b6:a03:39a::30) by BL1PR12MB5826.namprd12.prod.outlook.com (2603:10b6:208:395::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33; Wed, 19 Jul 2023 23:22:42 +0000 Received: from DM6NAM11FT094.eop-nam11.prod.protection.outlook.com (2603:10b6:a03:39a:cafe::2) by BY3PR03CA0025.outlook.office365.com (2603:10b6:a03:39a::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6609.23 via Frontend Transport; Wed, 19 Jul 2023 23:22:42 +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 DM6NAM11FT094.mail.protection.outlook.com (10.13.172.195) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6588.34 via Frontend Transport; Wed, 19 Jul 2023 23:22:41 +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.2507.23; Wed, 19 Jul 2023 18:22:39 -0500 Subject: [PATCH v6 8/8] x86/resctrl: Display hardware ids of resource groups From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Wed, 19 Jul 2023 18:22:33 -0500 Message-ID: <168980895303.1619861.15190945847281698454.stgit@bmoger-ubuntu> In-Reply-To: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> References: <168980872063.1619861.420806535295905172.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT094:EE_|BL1PR12MB5826:EE_ X-MS-Office365-Filtering-Correlation-Id: 7861284d-c289-4c43-babc-08db88af0cdf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: fXlzLOBc4zRU6lr/SNxddMN4wqJPvLEFBcP5nYtOLqc8K3dS5WbmWFIHHwFAtAxdVKtoMC4FG0XNPIwXSiWb5dmWYwph6RduWJlvRTcjXtUw+I1Usm3QKng/7hcjrcHkyfXV2ZYgc29OSstcUKxqQ0m4llVD2pvIGxW8NKPnaarvJcKry3/g6W113YEJT0OoHiObU/FmrmCxkbXVot30yjx/inlxtgxW5TZSGZtSDtOzw1B6FHY2RaTJZ4bM59tkTrnwoUgsLEpC56EdGo6kloU41u+K9Pmm9ok9AOP8OGvavYTKOgEIgS+A6ZXR8iUvxcBLiG4CnBkBYoMypUAlkvWdBvh0rcfthR6fVLVDysiPSSJfm3+KwmOMlzLsNjYISK33a0FsMcp6shzwmMp3K6BiXCjubXWZxt85n8M58QqaaZRodca6XHW0as9HTqzLCN9aHmpSn9/qgq/aq1znaTqRG+Exrvei3pkJ0gktiMG82BCwfcTzyHVRfGmdrGUtRvicQJJouOQyQGBMW9gz9e8RVyFPglREXVOiLO2/NILBCam4q7FpkagQtMBbwkM38DIb2vUFsNq2D/0iIhDNxVCH5nq5Lk6HG8DBDf9Izs6VbnUajzj9og/9nOTlyTJvkMqBSYeZ1UL5VFfh6jXM/AAeDOMV4IeumbutLzdPsCfdYYb4qBdMtC2oxtLTZy9b53S1vuu3yfnfdv08ydjm6CoJXx4LY4LxdiIUTjSCQhVb5yooQigJo9FE+7+B3R7E+1q7ikG+dnMDhVHBmfATLjygMiJilab8eeE51ox/xuE= 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)(376002)(136003)(346002)(39860400002)(396003)(82310400008)(451199021)(46966006)(40470700004)(36840700001)(36860700001)(8676002)(40460700003)(8936002)(47076005)(83380400001)(2906002)(103116003)(82740400003)(426003)(81166007)(33716001)(356005)(86362001)(7416002)(7406005)(40480700001)(5660300002)(26005)(44832011)(16526019)(336012)(70586007)(6666004)(186003)(316002)(16576012)(70206006)(4326008)(478600001)(41300700001)(9686003)(110136005)(54906003)(71626016)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Jul 2023 23:22:41.8919 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7861284d-c289-4c43-babc-08db88af0cdf 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: DM6NAM11FT094.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5826 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_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: INBOX X-GMAIL-THRID: 1771896556200204905 X-GMAIL-MSGID: 1771896556200204905 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 debugging. 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 resctrl is mounted with "-o debug" option. Other architectures do not use "CLOSID" and "RMID". Use the names ctrl_hw_id and mon_hw_id to refer "CLOSID" and "RMID" respectively in an effort to keep the naming generic. 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 | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 5a2346d2c561..41ad9b1f0c6a 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -351,6 +351,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": @@ -364,6 +368,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 058c1dedb2d7..e8b35013d7c1 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -776,6 +776,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 /* @@ -1837,6 +1869,13 @@ 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, + .fflags = RFTYPE_BASE | RFTYPE_DEBUG, + }, { .name = "schemata", .mode = 0644, @@ -1860,6 +1899,13 @@ 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, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, + }, };