Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3799959imm; Tue, 29 May 2018 14:02:11 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLH65wfybuPDNoEmo0J7klH1uiWUX69tEflALLEd1XV07oIs5A6JBv4ATI7QmsaabRz5tqv X-Received: by 2002:a17:902:a4:: with SMTP id a33-v6mr23340pla.346.1527627731934; Tue, 29 May 2018 14:02:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527627731; cv=none; d=google.com; s=arc-20160816; b=kTvWUOWCL1qsgLWLiiI64f0sm3PyzlY3yZtdBQC4vMC8pqUF2K3OjMInZwswTXN0iJ q4i4WWj4I5RMb/av/7vQz5QVBr8urA+ePXA+l52b3gLYZhz8Fm4kUDltlxRPgJ12QHHD sBa78b53VFO5es9bWv9V7gcH8phUsUpvTD4NVY7ytGWwtdPOycXVuAVNIE0Gx91gu4t1 G0bkpaY7zZZU3J/R+UWX7cIWuM973X3T9XiBHpdUC53o9kkadhrEFg1ogNUZcAa/Lx0j +OhKRtWK6kya0iobe2WB+Jhx4gK9hFOJ1ZItFXXjfINiT7OUV553t86fQJWJLAhsHija bE4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GnAh5myWPv7Qd5OD/MHPJaPm5X78UklL3b1KSRup01Q=; b=rCShYpgr+mhoYzeRl134Fol/2SZaA6lvMD5eT2p57uNMVvG9TTGeN/ycvbFdTj0vcf 9vcSiDa8zu2zzClKdQjoExW5K5GP46uFvM2uEu05ylstQTSDCMk1odLCje8pATnkWEM4 4PKQ6zPW3GvF/2EhyeWhR4KFMNqLhMEYWo0hwXKeOxOa83f1EL8NxDYBAoaHf3ENl7M/ sce8T8sA+35zOZVPf17MkirndlRZyMeChaPQmGHMiLbNwWtlG9unEvJnvcnZE4fFnG2c mDUJ2LogN+998cXrcGoyh0jgefxA8wEYbHw93MTIiNl8iiQAbnHQpiT6kBpy1PVGYLWj 0t5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s194-v6si11209186pgc.602.2018.05.29.14.01.56; Tue, 29 May 2018 14:02:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937152AbeE2VBD (ORCPT + 99 others); Tue, 29 May 2018 17:01:03 -0400 Received: from mga14.intel.com ([192.55.52.115]:46446 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S936896AbeE2VA4 (ORCPT ); Tue, 29 May 2018 17:00:56 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 29 May 2018 14:00:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,457,1520924400"; d="scan'208";a="60127706" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by orsmga001.jf.intel.com with ESMTP; 29 May 2018 14:00:54 -0700 From: Reinette Chatre To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com, vikas.shivappa@linux.intel.com Cc: gavin.hindman@intel.com, jithu.joseph@intel.com, dave.hansen@intel.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre Subject: [PATCH V5 13/38] x86/intel_rdt: Introduce "bit_usage" to display cache allocations details Date: Tue, 29 May 2018 05:57:38 -0700 Message-Id: <0108de9c39225ff2e8359115f9283c4e410510de.1527593970.git.reinette.chatre@intel.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With cache regions now explicitly marked as "shareable" or "exclusive" we would like to communicate to the user how portions of the cache are used. Introduce "bit_usage" that indicates for each resource how portions of the cache are configured to be used. To assist the user to distinguish whether the sharing is from software or hardware we add the following annotation: 0 - currently unused X - currently available for sharing and used by software and hardware H - currently used by hardware only but available for software use S - currently used and shareable by software only E - currently used exclusively by one resource group Signed-off-by: Reinette Chatre --- arch/x86/kernel/cpu/intel_rdt_rdtgroup.c | 79 ++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c index 5b78b4aa1a50..1097b02c9e85 100644 --- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c +++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c @@ -714,6 +714,78 @@ static int rdt_shareable_bits_show(struct kernfs_open_file *of, return 0; } +/** + * rdt_bit_usage_show - Display current usage of resources + * + * A domain is a shared resource that can now be allocated differently. Here + * we display the current regions of the domain as an annotated bitmask. + * For each domain of this resource its allocation bitmask + * is annotated as below to indicate the current usage of the corresponding bit: + * 0 - currently unused + * X - currently available for sharing and used by software and hardware + * H - currently used by hardware only but available for software use + * S - currently used and shareable by software only + * E - currently used exclusively by one resource group + */ +static int rdt_bit_usage_show(struct kernfs_open_file *of, + struct seq_file *seq, void *v) +{ + struct rdt_resource *r = of->kn->parent->priv; + u32 sw_shareable, hw_shareable, exclusive; + struct rdt_domain *dom; + int i, hwb, swb, excl; + enum rdtgrp_mode mode; + bool sep = false; + u32 *ctrl; + + mutex_lock(&rdtgroup_mutex); + hw_shareable = r->cache.shareable_bits; + list_for_each_entry(dom, &r->domains, list) { + if (sep) + seq_putc(seq, ';'); + ctrl = dom->ctrl_val; + sw_shareable = 0; + exclusive = 0; + seq_printf(seq, "%d=", dom->id); + for (i = 0; i < r->num_closid; i++, ctrl++) { + if (!closid_allocated(i)) + continue; + mode = rdtgroup_mode_by_closid(i); + switch (mode) { + case RDT_MODE_SHAREABLE: + sw_shareable |= *ctrl; + break; + case RDT_MODE_EXCLUSIVE: + exclusive |= *ctrl; + break; + case RDT_NUM_MODES: + WARN(1, + "invalid mode for closid %d\n", i); + break; + } + } + for (i = r->cache.cbm_len - 1; i >= 0; i--) { + hwb = test_bit(i, (unsigned long *)&hw_shareable); + swb = test_bit(i, (unsigned long *)&sw_shareable); + excl = test_bit(i, (unsigned long *)&exclusive); + if (hwb && swb) + seq_putc(seq, 'X'); + else if (hwb && !swb) + seq_putc(seq, 'H'); + else if (!hwb && swb) + seq_putc(seq, 'S'); + else if (excl) + seq_putc(seq, 'E'); + else /* Unused bits remain */ + seq_putc(seq, '0'); + } + sep = true; + } + seq_putc(seq, '\n'); + mutex_unlock(&rdtgroup_mutex); + return 0; +} + static int rdt_min_bw_show(struct kernfs_open_file *of, struct seq_file *seq, void *v) { @@ -996,6 +1068,13 @@ static struct rftype res_common_files[] = { .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, }, { + .name = "bit_usage", + .mode = 0444, + .kf_ops = &rdtgroup_kf_single_ops, + .seq_show = rdt_bit_usage_show, + .fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE, + }, + { .name = "min_bandwidth", .mode = 0444, .kf_ops = &rdtgroup_kf_single_ops, -- 2.13.6