Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp128706rdb; Fri, 29 Sep 2023 20:36:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFCfKwMMyjJQLQ8YKRUuX+9/Z7vIplb3TGd7TzeewqA/670UJeV4Ee/ZvxpVEa0s0N2oRug X-Received: by 2002:a05:6870:239b:b0:1db:71b9:419c with SMTP id e27-20020a056870239b00b001db71b9419cmr6406593oap.58.1696045012876; Fri, 29 Sep 2023 20:36:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696045012; cv=none; d=google.com; s=arc-20160816; b=Y6/Ymx0A5mC9OgSwY4HpNohAcEHrUcBEoMaExxXYueyruMH2i3aw2d0qyCNaLl4TmL iQANMpz7bvVEfx2JBSO7ZL92TICcNlNvYo9CDR5PlD81+ttt3T7qbcwPcDXj1zu0SNMp bhLUsA9eVMJW0I7T40MsImcAQDXFmhV9a53eDa6OBvJCBNTcLywdNFt6Otbj1uva/z89 xFs+QZr2blgp4DsS5gNLxk/gt/bxEtQDPnxCiR8WLuF5MbQxDsfmEB/nWFJ9o4PitRpG iSir9SfRbe+kn88E4AMo+sjTn6EMa5GqWPh6IxOFxJAWWumbEjjeE7hDhvk3r4aqwkQ6 P+bA== 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=wp6W+iC7pFQXwSZ/n7ONhkK479ckbnZxQ77q0/fqSwg=; fh=K7BLUOueAP1xQ5VQKmWbJlQeJFsX2bnYHK9BvjV3p1o=; b=R8r97eg5j5nK1MLq18q6kQo8rEXeEwWnKvdPjKPASB18/tjRhpU7YOvVBcVKaM99Tg EU/VxiqlCaiN61gpri6PJ/18Qz8VpBvvmxMfgwwysgCepsk1qmoQjchvnUM1rVmgpGIA sYe7myn00IKq01h0Y8zrFDn9ifWzlAeWGuTxN2M7vXUuFJatIW5LHg3uzVyF/c/q/oai TChNLyeXNcjoZfFBVGXIyCUev1I/Fb8leovrtnnLUNRDgQAMaGMsrRD1bRwzRmS0IclK j6YpWvGyvP2/4N0nDxtUduwB81qVx4NiH0atXJ/lhWucuf903f8n6Y+WX7qnGYGWlf1v 7nzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jaQ1hdGO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id o15-20020a656a4f000000b00577f67a0614si25949588pgu.879.2023.09.29.20.36.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 20:36:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jaQ1hdGO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 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 howler.vger.email (Postfix) with ESMTP id 2C01980D1DD4; Fri, 29 Sep 2023 02:03:22 -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 S232905AbjI2JDQ (ORCPT + 99 others); Fri, 29 Sep 2023 05:03:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232833AbjI2JDO (ORCPT ); Fri, 29 Sep 2023 05:03:14 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D99E31B2 for ; Fri, 29 Sep 2023 02:03:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695978191; x=1727514191; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JtSNJh/6iFRzjvSsEmFDTl3PNN/JVLrNJbMF8kuGwZk=; b=jaQ1hdGO0nSLmwTH3Awme9rjBJRecao/hBMiauauGcSDRufdrMHl3h9A qOvkN+VEuL9tLnjAQ4BPlTvsp1yl1B9wCF60xNi0mMvWU3vyUhoVR/JsT SZrUXOJB1oqyFdWxKFfLNH/6nbH4+yfV9+rzL2LSXtpBj35oznaVgFmkd f8oPnBWn6wys5i28/BE6hBYz1ecp3dABnPxVoYRMzIYcG5oWh6a5W37e0 9vkD5Apwl4EfhQWK/mMkyc+WbmG2G65RRc41+glEUNl88eNDZIqPyBUeF ceGZbKNqfUGsQnrhVzPKu4+EQdILV7fWYuujVQ//3pzFIKAMioaeUlbKf Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="385078591" X-IronPort-AV: E=Sophos;i="6.03,186,1694761200"; d="scan'208";a="385078591" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 02:03:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="749904545" X-IronPort-AV: E=Sophos;i="6.03,186,1694761200"; d="scan'208";a="749904545" Received: from tzebrows-mobl.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.26.85]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 02:03:03 -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: Peter Newman , linux-kernel@vger.kernel.org Subject: [PATCH v3 3/4] x86/resctrl: Add sparse_masks file in info Date: Fri, 29 Sep 2023 11:02:17 +0200 Message-ID: <46d7aa4948b4e669d35dc5b2b0b6b0167ec9c8d7.1695977733.git.maciej.wieczor-retman@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE 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: 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]); Fri, 29 Sep 2023 02:03:22 -0700 (PDT) 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 Reviewed-by: Peter Newman Tested-by: Peter Newman Signed-off-by: Maciej Wieczor-Retman --- 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