Message ID | 166759207601.3281208.770005576930282516.stgit@bmoger-ubuntu |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp610049wru; Fri, 4 Nov 2022 13:03:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5qXQV2E5jYyrii9T7HBT5IPYuRuWl0zf43oTxfVj/bnmA4/wgwaAyWIPnsBZlG8IfhEWRQ X-Received: by 2002:a05:6a00:acc:b0:530:e79e:fc27 with SMTP id c12-20020a056a000acc00b00530e79efc27mr37356377pfl.61.1667592186191; Fri, 04 Nov 2022 13:03:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1667592186; cv=pass; d=google.com; s=arc-20160816; b=Pt47kwo4Z8gMPlmjT/2/hgRi6ReZx2OBJDyr7V4KSam0lxS5WVW1LFX1dzYsUmwo6s 3EreKVzWT1dndMV3gVP0rHAsGCmpdptc+vL2pO6S4nLvaO6hTPfOIQNvCIVWwwNc50B8 VrcntDu24ywZo4gDlHXjARzOB1eDw41L5sojeAJsXGoKSpnVf3CMkzmzt259aQqxxlcm 3xmU+TN2wf0+WAJxVDO9CCW4v+pJrIObZW3dWcUuFNaJhHM9cWaeYJx54hcEuWIWJMo3 x2e18RiIOh0844Y8F8imlyXYWLVxEaxzOU++L4sTQOcuo7LMpHnS/MJB9Z91E/RNTA81 ubVQ== 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=zwWna5ohYvk6/hKT2RmHI9Xdzj9jtWfTFAzrIAfz3hI=; b=yoMhBqVGgjZAxeVDsDMHQUn0kwsVidmTart2RHbDGy7S8n0AJTYhcLKINUkmkx5VNi DTmfypBfGVEsoYImt51cZeuqc0tyzQJym5F/AoWTiTJrn+aXgPNSIqoDslYUSJYlK/0i yo25RniSJS6A76hofZVCSphc9I7SjKhlos8rosdCXqe9eAZaTW3svIXb1xHo30jhFQkk PGUmO/UuYG3pyfAJhP8hSKp0vswYfhiGqmGY5Ov698NG99zbzCduslgVW2U8BltzHhs/ wyUgGFxKDX/9dGtjdYG7QRjtlauOLVYYBaee11+9Q22IKFbS0u6iigA/M4iBjMqCIAfh 1zLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=HBVrw3oc; 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 t10-20020a63444a000000b0043ce223c86dsi391820pgk.843.2022.11.04.13.02.50; Fri, 04 Nov 2022 13:03: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=HBVrw3oc; 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 S229894AbiKDUCG (ORCPT <rfc822;hjfbswb@gmail.com> + 99 others); Fri, 4 Nov 2022 16:02:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229884AbiKDUB3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 4 Nov 2022 16:01:29 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2043.outbound.protection.outlook.com [40.107.92.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4251B4B996; Fri, 4 Nov 2022 13:01:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UbAbuQoaYIYvbAVKw0sNu1IezEX2udmPokc8D0FVgK8eaz4J2e4Py3BFyzA0joQx+5arxwvuhWRubIuRe2CxL4tG6PMKNMSXbH6oIZSFIIOMWZY/mrHwGS5CmR8JlsKikIFiM9HV8kTsiHX8tMMj9fU0Lw21qR8vIfgmBJmIoOS43MsBFr7MgPidCziuCqI18b6o8NqPvADi2/ZzMzVD9n6rQiucN8H5njbXKO3eG2VJ0xovPQXzlDIqda6CAyEMHs93+XWhI5uk8HuWpKMJHBCF8lyUaCkpEFwFGFfDdX/RAzLnIFhyyYyMTt0TcUBQW6ILc6PO+MkGK67T9nzoyA== 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=zwWna5ohYvk6/hKT2RmHI9Xdzj9jtWfTFAzrIAfz3hI=; b=fr3iARF92gRpitQFYSaeev0BqD1prDK2V/KD30YhqB/6i75fguVeVkbQ5KHhWNK75EAvSnyhUoxn7cVKf30Fj+G/g0xpqEmVMxrPFEQTNZPI6kKjoluN3fYENRjQZjcdd3pOQ5mj3uMNyWdFTgX4uN3+8ieL+3Jww9jsP+q/xV2fvHqIG4JSj4Vec77iqp4xpfoCZWvrvJAoGYQKQJIWUoQcFOktKrW7t6s7SdWlUuc+Xqoh1ts5/DFvtL9FQZaxMgL4nbh5f/mf2w+SsGTsXjCn08lfaOqFup/noOnbvS6rJpfb3sFzxNeSEJdRMX+EsqYKMQ3LSG78G8Qq/Yjmhg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=quicinc.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zwWna5ohYvk6/hKT2RmHI9Xdzj9jtWfTFAzrIAfz3hI=; b=HBVrw3oc6lbK8U9OgSRhuQPKI4UwasYNTQK4RTWqb5PPzpUvo0pSfO7H5rlC3QXXAsxZiIxasKbuCJFTowDd8QltrjDi6CztKsoHHpJ/84/a6ph1xfciRStCZLQT69fk7KqWfn7GW0Y3cYOwUksYYHeQdqFf+Epy8nY/tFOhtiQ= Received: from DM6PR02CA0136.namprd02.prod.outlook.com (2603:10b6:5:1b4::38) by CH2PR12MB4197.namprd12.prod.outlook.com (2603:10b6:610:ab::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.22; Fri, 4 Nov 2022 20:01:19 +0000 Received: from DM6NAM11FT083.eop-nam11.prod.protection.outlook.com (2603:10b6:5:1b4:cafe::33) by DM6PR02CA0136.outlook.office365.com (2603:10b6:5:1b4::38) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.23 via Frontend Transport; Fri, 4 Nov 2022 20:01:18 +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 DM6NAM11FT083.mail.protection.outlook.com (10.13.173.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5791.20 via Frontend Transport; Fri, 4 Nov 2022 20:01:18 +0000 Received: from [127.0.1.1] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 4 Nov 2022 15:01:16 -0500 Subject: [PATCH v8 11/13] x86/resctrl: Add sysfs interface to write mbm_local_bytes_config From: Babu Moger <babu.moger@amd.com> To: <corbet@lwn.net>, <reinette.chatre@intel.com>, <tglx@linutronix.de>, <mingo@redhat.com>, <bp@alien8.de> CC: <fenghua.yu@intel.com>, <dave.hansen@linux.intel.com>, <x86@kernel.org>, <hpa@zytor.com>, <paulmck@kernel.org>, <akpm@linux-foundation.org>, <quic_neeraju@quicinc.com>, <rdunlap@infradead.org>, <damien.lemoal@opensource.wdc.com>, <songmuchun@bytedance.com>, <peterz@infradead.org>, <jpoimboe@kernel.org>, <pbonzini@redhat.com>, <babu.moger@amd.com>, <chang.seok.bae@intel.com>, <pawan.kumar.gupta@linux.intel.com>, <jmattson@google.com>, <daniel.sneddon@linux.intel.com>, <sandipan.das@amd.com>, <tony.luck@intel.com>, <james.morse@arm.com>, <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <bagasdotme@gmail.com>, <eranian@google.com> Date: Fri, 4 Nov 2022 15:01:16 -0500 Message-ID: <166759207601.3281208.770005576930282516.stgit@bmoger-ubuntu> In-Reply-To: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> References: <166759188265.3281208.11769277079826754455.stgit@bmoger-ubuntu> User-Agent: StGit/1.1.dev103+g5369f4c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT083:EE_|CH2PR12MB4197:EE_ X-MS-Office365-Filtering-Correlation-Id: 39dac42e-b12f-4585-e63c-08dabe9f5663 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uYb+W8AtB4KF0Y40ugVd3+JteoOjYSfgrzVJVmi2G96Ul5xV5brCzembHHppZ523hBZcuxu/1JQcMwM6bI4kNK0ArOWONI4ZhHYDL37Pyj/ldeW9xJT1c0Q7IZHQdrCj79JxVAKxl3puwfEEp8V8FpMF9Nj/fuIAuzdBpHwEfCSoOG/lISDmxf7zYantRHzORNIOlSBcX2XemJT0qCJiTNKwuaOQrTlid26bsATkiz2Q+9ogTvx2AobpC1CTTvd1eVEdZaOmn3Q4IEu7MgVL6Vuemi9Z555BeIJUcr0I57t+2eTmq3zDlJj1ELigv+D3n45L0gt1u1Z1Kj3ssaVC+Ji4UCY8CfkARcnmC4Dyu7PE4J65TlY7UO8noPSg2oLdV0ys9WcIZC9w0u7HUMmx9a/TEhUafCNySuF3rPecfq5veIX7o5rPcYoW4y0tWZvidAHbKxVPQRqTocbbXW7pp3gAlS6duz1EtwbLcP3W2psL0nV+UNC8tTYa4smCPV+5jvkpco/6SvwilSaC0gxMAy9Bho0mWz7yQ+xlY4PVN238g865Yp3bR8vdMq+1qfbzbXZ7RWolG9bYVja9f+dN2GsEQRfE922cC2ixIOUKXVAbh2ku/CE5ZpRDsQx5Q60rdbT9Zd7EknqvvR4rZj/xRM4j9eHDrjWb6iRZKiWf7R1gZQRnKhsOInmqcsPbVc2792T53FDxdIK4X4ptkNr+7LLGlsTyXlSBOzthTYAD4UbOYQPvL59zWM+49KUwiUkIHn50FDRFGtUgIBWNZI+VPuqsTCIkNjmzVjt1wmvrC7Oub2Dtdu08jlkt2yo8syPq06WirKNNy2igf6zo9J4veQ== 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:(13230022)(7916004)(4636009)(396003)(39860400002)(136003)(346002)(376002)(451199015)(36840700001)(40470700004)(46966006)(44832011)(82740400003)(36860700001)(7416002)(2906002)(86362001)(356005)(47076005)(83380400001)(426003)(5660300002)(103116003)(81166007)(40460700003)(40480700001)(316002)(110136005)(478600001)(9686003)(16576012)(336012)(16526019)(186003)(54906003)(8936002)(41300700001)(4326008)(70586007)(8676002)(70206006)(82310400005)(26005)(33716001)(71626007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2022 20:01:18.4030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 39dac42e-b12f-4585-e63c-08dabe9f5663 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: DM6NAM11FT083.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4197 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748597144135983459?= X-GMAIL-MSGID: =?utf-8?q?1748597144135983459?= |
Series |
Support for AMD QoS new features
|
|
Commit Message
Moger, Babu
Nov. 4, 2022, 8:01 p.m. UTC
The current event configuration for mbm_local_bytes can be changed by
the user by writing to the configuration file
/sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config.
The event configuration settings are domain specific and will affect all
the CPUs in the domain.
Following are the types of events supported:
==== ===========================================================
Bits Description
==== ===========================================================
6 Dirty Victims from the QOS domain to all types of memory
5 Reads to slow memory in the non-local NUMA domain
4 Reads to slow memory in the local NUMA domain
3 Non-temporal writes to non-local NUMA domain
2 Non-temporal writes to local NUMA domain
1 Reads to memory in the non-local NUMA domain
0 Reads to memory in the local NUMA domain
==== ===========================================================
For example:
To change the mbm_local_bytes_config to count all the non-temporal writes
on domain 0, the bits 2 and 3 needs to be set which is 1100b (in hex 0xc).
Run the command.
$echo 0=0xc > /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config
To change the mbm_local_bytes to count only reads to local NUMA domain 1,
the bit 0 needs to be set which 1b (in hex 0x1). Run the command.
$echo 1=0x1 > /sys/fs/resctrl/info/L3_MON/mbm_local_bytes_config
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 29 ++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 0cdccb69386e..f37ecc16b34b 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1632,6 +1632,32 @@ static ssize_t mbm_total_bytes_config_write(struct kernfs_open_file *of, return ret ?: nbytes; } +static ssize_t mbm_local_bytes_config_write(struct kernfs_open_file *of, + char *buf, size_t nbytes, + loff_t off) +{ + struct rdt_resource *r = of->kn->parent->priv; + int ret; + + /* Valid input requires a trailing newline */ + if (nbytes == 0 || buf[nbytes - 1] != '\n') + return -EINVAL; + + cpus_read_lock(); + mutex_lock(&rdtgroup_mutex); + + rdt_last_cmd_clear(); + + buf[nbytes - 1] = '\0'; + + ret = mon_config_parse(r, buf, QOS_L3_MBM_LOCAL_EVENT_ID); + + mutex_unlock(&rdtgroup_mutex); + cpus_read_unlock(); + + return ret ?: nbytes; +} + /* rdtgroup information files for one cache resource. */ static struct rftype res_common_files[] = { { @@ -1739,9 +1765,10 @@ static struct rftype res_common_files[] = { }, { .name = "mbm_local_bytes_config", - .mode = 0444, + .mode = 0644, .kf_ops = &rdtgroup_kf_single_ops, .seq_show = mbm_local_bytes_config_show, + .write = mbm_local_bytes_config_write, }, { .name = "cpus",