From patchwork Fri Sep 15 22:42:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Moger, Babu" X-Patchwork-Id: 140968 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1507608vqi; Fri, 15 Sep 2023 23:26:58 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFXu25HozilBiyZ8IYFhoDvYDcJSw1ig/5T1QJiGYBfU6w9LdjVvUD8TnLrY/WXokdD4vhM X-Received: by 2002:a17:902:d510:b0:1c0:d7a9:1c48 with SMTP id b16-20020a170902d51000b001c0d7a91c48mr3272445plg.49.1694845618298; Fri, 15 Sep 2023 23:26:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694845618; cv=pass; d=google.com; s=arc-20160816; b=cbTVyjGXUJwYrzh3/uqFhzAJJYCIwIXWT+0RHL9gtKMXuBeUme85KEEGFQegXvm5Ik IA2cusVc+oeeRxCJ+isHk+Q4khn5bURj9DVa9wMs70Fub8DLvtRy7sSPcIDeyExt+Ugb NcLC6PBmBBVaEpV989cqn5US7sdzlMHL6MR9XKEf1GEwprt/nWwk3eFRgVwCBsCaRt+6 q85Rv0SXeNp9nPlYFhO4VZCPBVuEYh3GKt/lgvpvOACwYYdxyChUH09yw3JMC8vQZ04F SruKEa+WI3YSARwFKm3NZI1Ox7C0SpW9imFkJWyiK/Jm0nspMAI/bIEBdzol+JeKm9OS LylQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=tnwcG3l72kLybYiBjLxO5k4/kCMEuedhA0eBwbmELfE=; fh=a8QQDpsyeps30vd5Li+WI6v6dtcd7xKVvftia9bksQM=; b=GoWFvW392qdrtnqr/UvWbH9NwW24nvaiSQAkFyL7Ls6Ghy8weGRYE7bErZSCZ83cUR rtOwA4Y9odzNDyCb3SFW+DT2h06YNCkv5TBVtKMIeWt7qfUERpOVa2PlAaRmOC2toC6R I938U2bmuRnAYa2yAxgaXEjlOlkhwGX/knjeaoxzOQcJLN7SVeKa8QoiNaZZw7mzAeeU ZQSELI82nT9Jy0f4Xgpb2oOjEBsMtplAuuKDBY8iRmLqIMitTHbVzqGyySdhIIKk2fE8 /PwuO20EClrAkhKZt5eZRMBzvNmQ1kJOQxFDIhV3R7GVZZ/Y9+Jq3L1zsCqaTg/2lX5B jy/g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FqRTAqVB; 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::3:5 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 groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id o5-20020a17090323c500b001b8b37f6b46si4380036plh.556.2023.09.15.23.26.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 23:26:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=FqRTAqVB; 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::3:5 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 0681980732BA; Fri, 15 Sep 2023 15:44:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237950AbjIOWnN (ORCPT + 28 others); Fri, 15 Sep 2023 18:43:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237874AbjIOWms (ORCPT ); Fri, 15 Sep 2023 18:42:48 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2086.outbound.protection.outlook.com [40.107.94.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A625115; Fri, 15 Sep 2023 15:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IiZXcCqN3cUrHynLVVdk4d2u146HB9yjgplOZ9nQN/uRZk1XE8OuDQmxVMUuNh0ZrWml0i9oCC+us9+/Gtjr8nTeeimALNUGbZudh+F6EFjFDTDeAtiwPVa105bEeZJlMh7GNH6WnRXikvXp2nf0ZHi9BvSL+DPakJO5db+ChGfEFKRychV1jsZUlzUZ3BpU1bhKYqa5qKTDRD4B8HiUhP8V3SpX5F2V8XKsJcaIHOiIBq2vlfRpnUGXwlw1UYWkAsVUF4t43BN35meAPao+Uk4WYq1b6UscH4e5SDRm1ZPgeQq4cg71GMszefPQySzcbRmqtyd9w37HKaQNoSW0BQ== 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=tnwcG3l72kLybYiBjLxO5k4/kCMEuedhA0eBwbmELfE=; b=IrXoit5U9GXJr5XRAnYxtFMygmx1e6eCYS85MNg0Bn+i6ERtfnMsSnagrxXVPJtDrruTpcx4FdXjGBlRYm19ZnmOCnxNqiaLgHnCSVCFrTJRScoFjASeehCWhI5iRpl1XW+yI5ZTV4D1/CUpyZH+aYGuKwIRYkwBNCAFv7qeYduFic9Y691TL+W8vFz7XFPh3YWbdWaRlZs/7zexObnL//9Pj+DPtqLbd2w/Gat99/AuYg9tkbJmaz23BspoeYouEHJkOn4Q9t7LNMiMNyzNcqhI3f8cHGf/7xnMMzK5rP3geC6WIzIOBctpGvSUqZXgsnrWOb27PAABEsXM67/JOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lwn.net 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=tnwcG3l72kLybYiBjLxO5k4/kCMEuedhA0eBwbmELfE=; b=FqRTAqVBCC053wgXz4OmZgZN0LAU+BP6hA5Gs/uEDMszYt2dbYu0maZsWsrzQCUOoC/u831MyqwM7QNTOVp8AqN1GqsdMV1D7C4/h4jjhiPWJQ2dSmYFJCKPaStndtjMd5EHXG1Ny0Q3d+1BPKTyRFusgDsI/aUcsSllG8uPtwU= Received: from CY5P221CA0097.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:9::37) by SJ2PR12MB9239.namprd12.prod.outlook.com (2603:10b6:a03:55e::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Fri, 15 Sep 2023 22:42:39 +0000 Received: from CY4PEPF0000E9CD.namprd03.prod.outlook.com (2603:10b6:930:9:cafe::25) by CY5P221CA0097.outlook.office365.com (2603:10b6:930:9::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.21 via Frontend Transport; Fri, 15 Sep 2023 22:42:39 +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 CY4PEPF0000E9CD.mail.protection.outlook.com (10.167.241.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6792.20 via Frontend Transport; Fri, 15 Sep 2023 22:42:39 +0000 Received: from bmoger-ubuntu.amd.com (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.27; Fri, 15 Sep 2023 17:42:36 -0500 From: Babu Moger To: , , , , CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 02/10] x86/resctrl: Simplify rftype flag definitions Date: Fri, 15 Sep 2023 17:42:19 -0500 Message-ID: <20230915224227.1336967-3-babu.moger@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915224227.1336967-1-babu.moger@amd.com> References: <20230915224227.1336967-1-babu.moger@amd.com> 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: CY4PEPF0000E9CD:EE_|SJ2PR12MB9239:EE_ X-MS-Office365-Filtering-Correlation-Id: bf9636cb-6ede-4e6c-e0cc-08dbb63d10a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: lD787liTZzf7ohBgjfgCI2Vx5kCI8YTGx3LfKSi+jJlbDNqu9tRaamSvFTq6R9mPEfA7Xt0cHcZlBb8Xo4XEM+j6f5AThqeZUYorRntEG8iVCmFV0ideoigW8s0cJm0gFu0Kn2gZtTFHOFYK6AOe2eeASBIuk5tgMyLPRTOLzM4fyJ2olVHnfG0rmlZpzySWZTy5eeQwvXP/j1j+VmuQCqwpm11hvORS6OMuSJqptqACKEK0eWsjvwFxE5mUsSug35Zfm2/csUh6bc9SVA9ZoZr5+K4ID7E3vTU04fpy/BMy2/kQdb6FlJw+IANwIu1eAXAdLxZMGJHMK/7hk1gkkngtVBWnCSIwgcve25h5QJMlq6LW8vxH/digqp3Dh1+wu3sLeqrVqJo+gEA3jDaymOxaI3WqG+dL5i3FL1LIpxJNjvxSKIJJFnSuFbtLuwZBvWnzAsxmE9cOKEL2Y9dHmfcy+dyGdMjRuoJvuz7K2qv8McyiswStHy9aPy79c2TuT+iCzfRkE4IpsuMApejwvZ8vLgMQUN+X3+aCZFwQKAsL9VGMhlXdeHwmj8A99VVDz1t9JG7lHG5XQh3e0gl+Ua+4oI3wm6HgRdL44hS5A+L4o8uXwGltpe7QZ2YrLxVDDDB0uqVmxEURUpISd0FiWLEDRA/NEZ0u6ezp7s0K0W0veKVq+Ou/VxmPbaExUDXMtazEJSXkKHyTSuzRsRpmuK3JA4XFfoy+GhnDDlM2YEQ+cZgmz2z6QwfqVh92JDzX2Ww5+sjLJA2AkdV6fq9lhw== 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:(13230031)(4636009)(376002)(136003)(39860400002)(346002)(396003)(1800799009)(186009)(451199024)(82310400011)(40470700004)(46966006)(36840700001)(40460700003)(36860700001)(7416002)(7406005)(2906002)(47076005)(36756003)(86362001)(356005)(82740400003)(81166007)(40480700001)(8676002)(8936002)(1076003)(2616005)(70206006)(5660300002)(26005)(110136005)(7696005)(70586007)(54906003)(316002)(16526019)(4326008)(41300700001)(336012)(426003)(478600001)(83380400001)(6666004)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Sep 2023 22:42:39.0424 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bf9636cb-6ede-4e6c-e0cc-08dbb63d10a1 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: CY4PEPF0000E9CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9239 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 15 Sep 2023 15:44:35 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777174439103242955 X-GMAIL-MSGID: 1777174439103242955 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 Reviewed-by: Reinette Chatre Reviewed-by: Fenghua Yu Signed-off-by: Babu Moger Reviewed-by: Ilpo Järvinen --- 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 f0d163950969..7ddfa4b470e6 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");