Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp64806imm; Tue, 22 May 2018 14:05:16 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoM6DQRgSMDxPeg4fGc/ct2lOSozU5kddtPxTmh6/asC3HfgZ6Lab3de2TbKb6xpo9shLPg X-Received: by 2002:a62:303:: with SMTP id 3-v6mr52044pfd.255.1527023116270; Tue, 22 May 2018 14:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527023116; cv=none; d=google.com; s=arc-20160816; b=Y7cJmszk3DOHB2QsbZVK7cm76Gao4kLJooIAIaXw40xh+Uhm9ICToup/VpEiImWFw7 ghAdZwXRkZyFgRgEjBHfet8xLFjKagBO1hYzxcU99NAlty15TmoafWWFBDPjBkBRAqhB Ilu1XBPpr9dDm0wraGe12HGkTdK7G9woJWV1JNL0A1hv8ANxuRHB4J2QZwmui2SC9ETh 4VJStsj4d3nm0MjMEQc/0oHXO/TWY7MWJPuAZrzNP/FqRcqzWC9U/KOLHnJKiZ/9f5DX QCpPAXvjtLnV1nHBVAF+A9HPdJ8a02pWR+Cr4ZE4qEqzeIkkSDG6cE3GtKT6EXyoUw2r yfQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=HBsz2q6qpxpRdVKGEdo3hFfGmUnCvQACSHAnbK3XYVw=; b=YGzeUoOiUmrAgRRt7nDlHk/S7vRo+KmnXb2ov6p/y5mq9RDbtrnyJSBT3UcXHGXCUm xMvGBpTcoyYJq5/4p3Z5UiiZoIRs6nlgVhPBE/sLwPFDOywpnT3KmA/9ZGfKASXp+d4G yWuuJ/F68soxX3GJJ5R+PBvr0eA6z+pg1W+jB6Q/0B7xpAkymPdXJ/esSfLMVj54hTOB XPBzClMb4YNKEyM3Wt9oODxjo4mTa/jt4KikEtKO5X9J10V3ZVk0JxtQ4R11vBMR7ccL S0OWvGiE4rHp+gqEFFY+zxb5W7WnYbuVlbv6DltdYpG2WSHuZ6cev3reOG57Nuy8IaAc wsqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=sYxgLKUe; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q3-v6si598548plb.529.2018.05.22.14.04.55; Tue, 22 May 2018 14:05:16 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=sYxgLKUe; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753047AbeEVVEI (ORCPT + 99 others); Tue, 22 May 2018 17:04:08 -0400 Received: from merlin.infradead.org ([205.233.59.134]:54772 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752631AbeEVVEH (ORCPT ); Tue, 22 May 2018 17:04:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=HBsz2q6qpxpRdVKGEdo3hFfGmUnCvQACSHAnbK3XYVw=; b=sYxgLKUeNKucg4VMaRTINPlfD8 aP8kwo1AMoUy997dDqzCM85ZkzN4Dg/mS3EVHERdie4FUcqv8/PzjaeP/FseKQxq30rjl3rIbV++I 2ZFKfwvvJoRy3Bu0OHPEn+zxXWClk9mNIGrjUVJhIma49n0ThH6tT7ljcSTsfSfdwu/4BfOQUFALj V/6lH0LUwkXoSJwfloc10N+0zDU890EBAw47e4UzX9zpL6tXKkjup8DyGV8ihxcJW/fvCPrURjNMN iC0Y0fceaS6KrazOZtSX0MH1yRVqltmIe6v6TJYwY/zT3w5aQCOSqV1n3q5tdjRklmmp+4uzHYTSR /Yr3PJGw==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fLERs-0005ZM-NJ; Tue, 22 May 2018 21:04:01 +0000 Subject: Re: [PATCH V4 13/38] x86/intel_rdt: Introduce "bit_usage" to display cache allocations details To: Reinette Chatre , 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 References: From: Randy Dunlap Message-ID: <06e4e2d6-aeb0-21c1-1472-47c14ff37f00@infradead.org> Date: Tue, 22 May 2018 14:03:56 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/22/2018 04:29 AM, Reinette Chatre wrote: > 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(+) > Hi, All occurrences of seq_puts(f, one_char_string); should instead be seq_putc(f, one_char); Same for patch 14. > diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c > index 5b78b4aa1a50..d0040f83532d 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_puts(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_puts(seq, "X"); > + else if (hwb && !swb) > + seq_puts(seq, "H"); > + else if (!hwb && swb) > + seq_puts(seq, "S"); > + else if (excl) > + seq_puts(seq, "E"); > + else /* Unused bits remain */ > + seq_puts(seq, "0"); > + } > + sep = true; > + } > + seq_puts(seq, "\n"); > + mutex_unlock(&rdtgroup_mutex); > + return 0; > +} -- ~Randy