From patchwork Tue Oct 17 12:17:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 154232 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4091666vqb; Tue, 17 Oct 2023 05:19:04 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF6u7GEO5aOhzfWOAgKOKBts6EhCh9O/+Qiov2FA5K0LJvfB1TiLz6FahVYBOgQj60BbUIQ X-Received: by 2002:a05:6a20:7d97:b0:171:947f:465b with SMTP id v23-20020a056a207d9700b00171947f465bmr2003241pzj.4.1697545144461; Tue, 17 Oct 2023 05:19:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697545144; cv=none; d=google.com; s=arc-20160816; b=BvvuTJIRpgLC7IpwKX26Ej3aser4svp8nSeC5qBFX4PjwbGa5HzFQOM8GRB0gAN8Q/ 3WYoUBm7/dENIAqyAGGEHNVL9A2m/kgO5sgxr+Kd8ni9VC9+XzlII0UCKHeYJWjlERFB 3A7sLyMf9yKas+/4tAOrIfkoLQNu+PJt6we8Aqil71e17SYKs+UiVsv0prA5HWeLJFFP Z+eJ7rtUnnRg3vOaxEsOKNXR4wiMDReI6y6VIixb4omyIDjpjlHWE5K8tVnpyh/6Ncc7 lGmZQ3s+8nI3UzQNB4VrRX2Vrp8JJ94FSQKnVaiM7UuxOXFF5Ry2EXnP+4Mg6tS3l8k6 T9AQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=tRii31kzoOkxgXH61iIPFY76NO+CH3zPM7DZu/1Zwk8=; fh=xlieDj8o+jXNpmF12Ogr15ctNOIP4IDTbgVIdoNwRD8=; b=X4z9SaCiJRGJPv0T/O2XdySNHaWyMZjDgNMfHlVSeIVGPqViN64pFcO+wzwKv01PCC p87O4mhKi21uC0Fm/WetXnZ4SafAQY8NJVizl00HCCHIRMSuNQfSQ0pY+Sv8WU1RtC0q LPvY1SMvgPgosBWdCoXbDICOi+Tbs9KEz2N9lim4DrnAv0VImHotx+xTOPUMrquYzNe8 AOStyucPnepXmpbI7EK9PxyboCEDAtTFpGmpt4pM+xRIju9Cd7r3NSiJTl3KjYwDdvk2 0/jO+p3GXmIIEKYAB3kYGIvX93wX1IPfiEkYQWJzt2a+lQgwieNRq12vBuJXOAFCXGVk Hz7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PneOKyJG; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id q6-20020a637506000000b005af4cc9e22fsi1500581pgc.840.2023.10.17.05.19.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 05:19:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=PneOKyJG; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D00D88039864; Tue, 17 Oct 2023 05:19:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235020AbjJQMSH (ORCPT + 19 others); Tue, 17 Oct 2023 08:18:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232804AbjJQMSD (ORCPT ); Tue, 17 Oct 2023 08:18:03 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A54EDF2; Tue, 17 Oct 2023 05:18:01 -0700 (PDT) Date: Tue, 17 Oct 2023 12:17:58 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1697545079; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tRii31kzoOkxgXH61iIPFY76NO+CH3zPM7DZu/1Zwk8=; b=PneOKyJGVIgKTQZWtRM75n4ER7fffExek+XmAGakg20zhvjyn6sI0pqYkOFr1nDiZzeO/Y 5MLU2ILgdn9oauCNTsravWx1Ze7PhVea3nK1CSbGcYknkKhL+nYrT5FtUCK1C/uW0JxhRK fRqhhUDNzVOXuWvtmPjOjWH2Cb0MiCbsz1ZGHPBlw0hZxbyp8r45tnDLaYZC0Lu4XO7EsA pcmL42oyDKRoWsrPirtYtz/Vn1DOi1E0coH70Ht6lSZm1qXUPQQSf06fTLGpoIQpdnf6ye DXMTxiBe54D/per7GoVUxaRHxn36k8TqsJXmiBRlwjn7dUbcDdbmfEBYCDo73g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1697545079; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tRii31kzoOkxgXH61iIPFY76NO+CH3zPM7DZu/1Zwk8=; b=rQaGNMKk4ildL9Baw/2SDksVrWQ3S/2Dgp4Y/k10MawKOQt2mNTwH/l4GwyhP+J/HQjtrZ NBQRcIpFuXLeN2Bw== From: "tip-bot2 for Babu Moger" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] x86/resctrl: Display CLOSID for resource group Cc: Babu Moger , "Borislav Petkov (AMD)" , Peter Newman , Tan Shaopeng , Fenghua Yu , Reinette Chatre , ilpo.jarvinen@linux.intel.com, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231017002308.134480-8-babu.moger@amd.com> References: <20231017002308.134480-8-babu.moger@amd.com> MIME-Version: 1.0 Message-ID: <169754507899.3135.1095916049785753629.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-0.8 required=5.0 tests=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 howler.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 (howler.vger.email [0.0.0.0]); Tue, 17 Oct 2023 05:19:01 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779960131248527864 X-GMAIL-MSGID: 1780005097476392312 The following commit has been merged into the x86/cache branch of tip: Commit-ID: ca8dad225e237493f19b1c5d4a8531f13a9b078f Gitweb: https://git.kernel.org/tip/ca8dad225e237493f19b1c5d4a8531f13a9b078f Author: Babu Moger AuthorDate: Mon, 16 Oct 2023 19:23:06 -05:00 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 17 Oct 2023 14:05:14 +02:00 x86/resctrl: Display CLOSID for resource group In x86, hardware uses CLOSID to identify a control group. When a user creates a control group this information is not visible to the user. It can help resctrl debugging. Add CLOSID(ctrl_hw_id) to the control groups display in the resctrl interface. Users can see this detail when resctrl is mounted with the "-o debug" option. Other architectures do not use "CLOSID". Use the names ctrl_hw_id to refer to "CLOSID" in an effort to keep the naming generic. For example: $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id 1 Signed-off-by: Babu Moger Signed-off-by: Borislav Petkov (AMD) Reviewed-by: Peter Newman Reviewed-by: Tan Shaopeng Reviewed-by: Fenghua Yu Reviewed-by: Reinette Chatre Reviewed-by: Ilpo Järvinen Tested-by: Peter Newman Tested-by: Tan Shaopeng Link: https://lore.kernel.org/r/20231017002308.134480-8-babu.moger@amd.com --- Documentation/arch/x86/resctrl.rst | 4 ++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/resctrl.rst index 68f1161..7412252 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -359,6 +359,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": diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 84e0f45..5814a0b 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -779,6 +779,22 @@ 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; +} + #ifdef CONFIG_PROC_CPU_RESCTRL /* @@ -1881,6 +1897,13 @@ static struct rftype res_common_files[] = { .seq_show = rdt_has_sparse_bitmasks_show, .fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE, }, + { + .name = "ctrl_hw_id", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdtgroup_closid_show, + .fflags = RFTYPE_CTRL_BASE | RFTYPE_DEBUG, + }, };