Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp38682rdg; Tue, 10 Oct 2023 03:43:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwxpWxH8kTQBRn9pTlqhSD8faLJdzCfYa809ig4wW9N6WNmm2hPmDQvd8VV7mj6LiWtOYa X-Received: by 2002:a17:902:e551:b0:1c5:741d:f388 with SMTP id n17-20020a170902e55100b001c5741df388mr19136866plf.9.1696934617937; Tue, 10 Oct 2023 03:43:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696934617; cv=none; d=google.com; s=arc-20160816; b=d43uxDbRriqYoXqvMVHT20T34QGuAvDbMyie4EUqsawv6ctmQEU3DuUWPWGZ95H7EE l89DWZCDoQtV4+mrfdKfZ4A4BU/pB8NzoSGO4Y1e0qrkIdew4tvochft0YxblpadIGzc tNOmEfK0JvX7qOusdWAuEL+lro5kL0kdIWKi0isLhgK+0ywWBX1KPawIDi1/BOslIKFC Y3bjeNH2GIsEbWE8QZHdYT92MPl4Cx0edHgCm4yNYWXjAk8Ewv2Jistw72guSKEZyWzm 6tn/lhI486+6gPTCTo2QwcfjZdba+kny0NM+EUJ79YsG22LBDt2iJiUXThH6ndjVIxMu 5PhQ== ARC-Message-Signature: i=1; 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=w7H/Suc+QBKFBHiBNR5ZhFiWUbQJw+CBSPx50UyA9FE=; fh=/xaEWW9ZHpZ646oyGDk2W8f0ad1BtXK5S5oK3tS3Fj4=; b=Zs9Pz/EFT0Tpm9GGQa1HTCl73Eiv0RSHq+ae62nfLBPQyix1A+2cle7+dpTGiSgZ3C C5cPIPRFM/zAvp1Rq0KHmdrLI593K9RuP4HtgGd3Olk9aA5BRW2Y6wnF2M5VOlh13uIl wbH4pktN3jfMFAmuGqxPdAOmley6SIEzG6KqNyhKTVXbDipArd8E6Dbp3FVxpIONMgNG duFNQMnH40oSOvwAXAMK5/lkDtgP4+ZBX4YsSOiSnMSqNZg49cXsGHOthG9LvjaWGR1D cYZyQak0XqF4WzEGqIZvYPnIDTIcFmsJ6vRphDLMMYw8CX6WttWYKS/3M7LzX4unv93m iRXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="c8z/Gwwr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id n15-20020a170902d2cf00b001c62cfff799si908632plc.176.2023.10.10.03.43.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 03:43:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="c8z/Gwwr"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id ACE77826E8C5; Tue, 10 Oct 2023 03:43:35 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231273AbjJJKn2 (ORCPT + 99 others); Tue, 10 Oct 2023 06:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbjJJKn0 (ORCPT ); Tue, 10 Oct 2023 06:43:26 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00414CF for ; Tue, 10 Oct 2023 03:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696934605; x=1728470605; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tnFhS525p9Ln8nHW8diiC8jRFWmU74qmS9OxkRmAO9A=; b=c8z/GwwrnmeONaUl9+AwDrrGR4XsQUBNu1S2ggotI1oLfN4P8gzq3Gqt fiukN4xOtcPMPUzwURYdrW4U9Ru1f8aPuCKBPk0xtgH9QQdBe50qkQnuf FRozkoII+LpoijahfaWJtSjNIkW8QxS5aLuicP7aVCHPvz5RHUqu3BkK+ 8OO69nlVYgOPE8EdafyLI5QoL15zb6i2uzcNJBogue+uYd/5cw65dm0tR u2bT1Bb3AA1+mxCbcrEYUvqJcoVg9N35IDZGiKOT3d6TOdk6f4q0zddxc TINI7ttsOXv+ELtgB/fOKma8AiY+0SC0PLpqqzXnlDyUFIYR0UH+rC8Tl w==; X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="374703520" X-IronPort-AV: E=Sophos;i="6.03,212,1694761200"; d="scan'208";a="374703520" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2023 03:43:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10858"; a="747033015" X-IronPort-AV: E=Sophos;i="6.03,212,1694761200"; d="scan'208";a="747033015" Received: from asalaman-mobl.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.16.145]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2023 03:43:19 -0700 From: Maciej Wieczor-Retman To: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: ilpo.jarvinen@linux.intel.com, Peter Newman , Babu Moger , linux-kernel@vger.kernel.org Subject: [PATCH v5 3/4] x86/resctrl: Add sparse_masks file in info Date: Tue, 10 Oct 2023 12:42:38 +0200 Message-ID: <7300535160beba41fd8aa073749ec1ee29b4621f.1696934091.git.maciej.wieczor-retman@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.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 (morse.vger.email [0.0.0.0]); Tue, 10 Oct 2023 03:43:35 -0700 (PDT) X-Spam-Level: ** From: Fenghua Yu Add the interface in resctrl FS to show if sparse cache allocation bit masks are supported on the platform. Reading the file returns either a "1" if non-contiguous 1s are supported and "0" otherwise. The file path is /sys/fs/resctrl/info/{resource}/sparse_masks, where {resource} can be either "L2" or "L3". Signed-off-by: Fenghua Yu Signed-off-by: Maciej Wieczor-Retman Tested-by: Peter Newman Reviewed-by: Ilpo Järvinen Reviewed-by: Peter Newman Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger --- Changelog v5: - Add Babu's reviewed-by tag. Changelog v4: - Add Ilpo's reviewed-by tag. - Add Reinette's reviewed-by tag. Changelog v3: - Add Peter's tested-by and reviewed-by tags. - Reword patch message slightly. (Reinette) Changelog v2: - Change bitmap naming convention to bit mask. (Reinette) - Change file name to "sparse_masks". (Reinette) arch/x86/kernel/cpu/resctrl/rdtgroup.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 725344048f85..945801898a4d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -895,6 +895,17 @@ static int rdt_shareable_bits_show(struct kernfs_open_file *of, return 0; } +static int rdt_has_sparse_bitmasks_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct resctrl_schema *s = of->kn->parent->priv; + struct rdt_resource *r = s->res; + + seq_printf(seq, "%u\n", r->cache.arch_has_sparse_bitmasks); + + return 0; +} + /** * rdt_bit_usage_show - Display current usage of resources * @@ -1839,6 +1850,13 @@ static struct rftype res_common_files[] = { .seq_show = rdtgroup_size_show, .fflags = RF_CTRL_BASE, }, + { + .name = "sparse_masks", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdt_has_sparse_bitmasks_show, + .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + }, }; -- 2.42.0