Received: by 10.223.164.202 with SMTP id h10csp201405wrb; Mon, 13 Nov 2017 16:43:41 -0800 (PST) X-Google-Smtp-Source: AGs4zMYwpXiwmcQeL2ZHIxzqI1KtxeIJxpsaoGAassjiWS2xAEYPShoBUilEecy3ZwNZr3wvyAl9 X-Received: by 10.84.133.15 with SMTP id 15mr9128911plf.367.1510620221302; Mon, 13 Nov 2017 16:43:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510620221; cv=none; d=google.com; s=arc-20160816; b=XoLUdAyxOoobGhKlX0Da8c63BDDcC3s0HZWR1S7h/t9WPR1QLe2pTALEkptfu3NubP aZj3Q0HgPRf/ge5uENB4oRPHLXkhQQ/HWLLm7c7OPxxfXLJXjfNTsA1/s5IK+HaMSs4m LCfsH2jGIoLOy8Jz7vGnK0QzWrhOO/53EqmzkY2IpkOz3+rWBadusaW3x2n/YisMiCS7 zVsHCG+YDDrr2Paon46EBSohOUXmm4712GNadu7j3YrdV8A9rUMTsZXFgTPFZ7lgnNKJ X1+/i7NiF9NjG4mAgQfsYz/AkhcI6kYcJjqoiep66v4OnFTL3KBHDUe3OmIgRydn3iz4 8DJg== 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=vPh8yeu7ev7fnG6VaOMP+YwPRCT39zFe3C3tMDjUlPY=; b=LsOQnThergZwTimspBeug1hPHDzBKV2jKlxRgqzoeKGsYhQCztz2qYqCTZEar7Ua19 cCf1BP7C9kHyNq7Uq4AViaTQlmKJcyY8sinWPMEYWhzH4bdDgTTbG40PltLc7+SmGVVS sfZejVTWIrSeEtToagHSDGGHIcm0Uhwaex4FngoWvbfuU5xD5e1Wr1Nop07jrgXQerpw md2XMsVVMkBfUXR6P6tLvR0BtgI4x0ac6R53ROZkV4B1zzPUG75QEFYQl822RPa5jR8n sa4vM4pNEegHi6Q/QRk7LC3iqNDWe0Rr3UbvuwfmLK+nve1tWfFIPNXtCSxN/5BRIx85 pA0w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q66si13301352pga.467.2017.11.13.16.43.28; Mon, 13 Nov 2017 16:43:41 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753069AbdKNAmg (ORCPT + 90 others); Mon, 13 Nov 2017 19:42:36 -0500 Received: from mga01.intel.com ([192.55.52.88]:37783 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752407AbdKNAmT (ORCPT ); Mon, 13 Nov 2017 19:42:19 -0500 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Nov 2017 16:42:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,392,1505804400"; d="scan'208";a="2288267" Received: from rchatre-s.jf.intel.com ([10.54.70.76]) by fmsmga001.fm.intel.com with ESMTP; 13 Nov 2017 16:42:18 -0800 From: Reinette Chatre To: tglx@linutronix.de, fenghua.yu@intel.com, tony.luck@intel.com Cc: vikas.shivappa@linux.intel.com, dave.hansen@intel.com, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, linux-kernel@vger.kernel.org, Reinette Chatre Subject: [RFC PATCH 05/20] x86/intel_rdt: Print more accurate pseudo-locking availability Date: Mon, 13 Nov 2017 08:39:28 -0800 Message-Id: X-Mailer: git-send-email 2.13.5 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 A region of cache is considered available for pseudo-locking when: * Cache area is in use by default COS. * Cache area is NOT in use by any other (other than default) COS. * Cache area is not shared with any other entity. Specifically, the cache area does not appear in "Bitmask of Shareable Resource with Other executing entities" found in EBX during CAT enumeration. * Cache area is not currently pseudo-locked. At this time the first three tests are possible and we update the "avail" file associated with pseudo-locking to print a more accurate reflection of pseudo-locking availability. Signed-off-by: Reinette Chatre --- arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 62 ++++++++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c index ad8b97747024..a787a103c432 100644 --- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c +++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c @@ -26,9 +26,69 @@ static struct kernfs_node *pseudo_lock_kn; +/** + * pseudo_lock_avail_get - return bitmask of cache available for locking + * @r: resource to which this cache instance belongs + * @d: domain representing the cache instance + * + * Availability for pseudo-locking is determined as follows: + * * Cache area is in use by default COS. + * * Cache area is NOT in use by any other (other than default) COS. + * * Cache area is not shared with any other entity. Specifically, the + * cache area does not appear in "Bitmask of Shareable Resource with Other + * executing entities" found in EBX during CAT enumeration. + * + * Below is also required to determine availability and will be + * added in later: + * * Cache area is not currently pseudo-locked. + * + * LOCKING: + * rdtgroup_mutex is expected to be held when called + * + * RETURNS: + * Bitmask representing region of cache that can be locked, zero if nothing + * available. + */ +static u32 pseudo_lock_avail_get(struct rdt_resource *r, struct rdt_domain *d) +{ + u32 avail; + int i; + + lockdep_assert_held(&rdtgroup_mutex); + + avail = d->ctrl_val[0]; + for (i = 1; i < r->num_closid; i++) { + if (closid_allocated(i)) + avail &= ~d->ctrl_val[i]; + } + avail &= ~r->cache.shareable_bits; + + return avail; +} + static int pseudo_lock_avail_show(struct seq_file *sf, void *v) { - seq_puts(sf, "0\n"); + struct rdt_resource *r; + struct rdt_domain *d; + bool sep; + + mutex_lock(&rdtgroup_mutex); + + for_each_alloc_enabled_rdt_resource(r) { + sep = false; + seq_printf(sf, "%s:", r->name); + list_for_each_entry(d, &r->domains, list) { + if (sep) + seq_puts(sf, ";"); + seq_printf(sf, "%d=%x", d->id, + pseudo_lock_avail_get(r, d)); + sep = true; + } + seq_puts(sf, "\n"); + } + + mutex_unlock(&rdtgroup_mutex); + return 0; } -- 2.13.5 From 1583980445031903103@xxx Mon Nov 13 19:31:08 +0000 2017 X-GM-THRID: 1583980306349482085 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread