Received: by 2002:a05:7412:518d:b0:e2:908c:2ebd with SMTP id fn13csp342306rdb; Thu, 5 Oct 2023 07:33:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEmwEau8l7Bq9AFrvbmVN5kye8Wu9rqChXYL0X/i1KGU5aq3g6TIXCjfGzlJ/6TSO4bS+/K X-Received: by 2002:a17:902:d48e:b0:1c6:11ca:8861 with SMTP id c14-20020a170902d48e00b001c611ca8861mr2292944plg.21.1696516425245; Thu, 05 Oct 2023 07:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696516425; cv=none; d=google.com; s=arc-20160816; b=kWU2qYUk2U0dr3Qj1xJoRtzCC8l0f0GE5cGClF6VZKhIeSVGxhPuLZoWE7YcB4atYT naZ+7rhjWOBr5Hp53UClGLxkC7OhCMF+72Mo3x7RKu7ZWNpw9p65S+ohuSn10O7N1Qwv iDW0J8cKxJ79azWqY1C6dIrJ6FwhhzSuNO9xA3LtvxJ45nqJACQlSpzzr2vSZZNGzVHR n2xt+VRHqZfw0qVT4pbDp8iDYuf+qLnlFNK1qs3Ej5KAy8BiykHXeZAyF/MRww58nOW+ +HNmSTpuUM1vKQ8WClzqk/U/K0uTR+UZdTDmOzRCVbzxm1fFdwKbhHCJPmxO+KK4A/AV VSUQ== 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=fuUFXb8zzLiV2rWPwRJEEE78D5kv1fWpAVZakdJ1Quk=; fh=taTM0Ub91m2QPo770QmKUJX9+RhaD+q65yPrlZgvRRU=; b=GTdVAqv1Rw0B2cpfLEig23QhvxneQcAAiANW55Mbt4eBbhmAoPvYLI8smPzFJJwGF2 E3ivesZWvYDRJ6qSRKgp1UH/+ur7BrTYUizg4P6WHycNA8KnKWDrh/YScO1/BDiwrA9V Yg8UejJ/CIiegY55Mvt31R4lnZB7vIErtXRXtomU4ocUf717mayq1dgMLs9mkFhV4rnA dUHNGppSJAP+sYExg6+E0p1nre/tnYl5K4yVgadIEq00Er9czk1sMoQVbnY9/jZLtxM+ pfKeOgS9pr3zszjROuJGtpq+WiyMXxwtPQY6pDLlsAaxBNmZqrvKgQPXDtAhh3xdUStT jhSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ByEtnrW5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id k9-20020a170902c40900b001bd9e2b4b46si1567011plk.601.2023.10.05.07.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Oct 2023 07:33:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ByEtnrW5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 4774A809B09A; Thu, 5 Oct 2023 07:33:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234922AbjJEOb4 (ORCPT + 99 others); Thu, 5 Oct 2023 10:31:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233113AbjJEO3k (ORCPT ); Thu, 5 Oct 2023 10:29:40 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2A31BD8 for ; Thu, 5 Oct 2023 06:49:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1696513800; x=1728049800; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RsEbDDQE5OYZlZy6VBAukZsVljHVFXdnty31uYM0gh0=; b=ByEtnrW5zzrBBsyY/z9L0ZlGTgPCSrIE3GyP9YUAvLks0Jt3kAECq5id WB2YdY6LVIUsCrMXwnKJKzyTjduHDfgPHQxE5EiedJLvLIFjR9wyHv+jd HcAS1lGpBd5noe0q4BEGs+or9ZMhfPQnZ3xFxUbDwk8Jqg+I6CvVokA3u B20ePqOUbPQvWkZPVqRRnodsZ+uGmIY5WS96RJ2VILkVe4S68w50B9pzJ Ao2+u2tjd+2HiQbZBl43SAFW0zyftJtUNcBGjH2nch/653FK9eZnyFMns aKgpElqpSA05U081/19/MvT68TlXRe/uWGBwVOQ9Dd/LDDOBy5WDkBp03 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="383339446" X-IronPort-AV: E=Sophos;i="6.03,202,1694761200"; d="scan'208";a="383339446" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 01:16:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10853"; a="875477034" X-IronPort-AV: E=Sophos;i="6.03,202,1694761200"; d="scan'208";a="875477034" Received: from lpopiela-mobl.ger.corp.intel.com (HELO wieczorr-mobl1.intel.com) ([10.213.13.229]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Oct 2023 01:16:18 -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 , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , linux-kernel@vger.kernel.org Subject: [PATCH v4 3/4] x86/resctrl: Add sparse_masks file in info Date: Thu, 5 Oct 2023 10:15:38 +0200 Message-ID: <684da427338d68b216c1f5636a4930bba06f7b60.1696493034.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=-0.8 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,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.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 (pete.vger.email [0.0.0.0]); Thu, 05 Oct 2023 07:33:20 -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 Signed-off-by: Maciej Wieczor-Retman Tested-by: Peter Newman Reviewed-by: Ilpo Järvinen Reviewed-by: Peter Newman Reviewed-by: Reinette Chatre --- 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