From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753311AbdKNAm5 (ORCPT ); Mon, 13 Nov 2017 19:42:57 -0500 Received: from mga01.intel.com ([192.55.52.88]:37796 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752710AbdKNAmW (ORCPT ); Mon, 13 Nov 2017 19:42:22 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,392,1505804400"; d="scan'208";a="2288297" 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 14/20] x86/intel_rdt: Enable testing for pseudo-locked region Date: Mon, 13 Nov 2017 08:39:37 -0800 Message-Id: <7996f6de3340cbc041a896df2cdfb4352cd344db.1510568528.git.reinette.chatre@intel.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce a new test that can be used to determine if a provided CBM intersects with an existing pseudo-locked region of cache domain. Signed-off-by: Reinette Chatre --- arch/x86/kernel/cpu/intel_rdt.h | 1 + arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/arch/x86/kernel/cpu/intel_rdt.h b/arch/x86/kernel/cpu/intel_rdt.h index b4426a997516..529fe535b357 100644 --- a/arch/x86/kernel/cpu/intel_rdt.h +++ b/arch/x86/kernel/cpu/intel_rdt.h @@ -457,6 +457,7 @@ void cqm_setup_limbo_handler(struct rdt_domain *dom, unsigned long delay_ms); void cqm_handle_limbo(struct work_struct *work); bool has_busy_rmid(struct rdt_resource *r, struct rdt_domain *d); void __check_limbo(struct rdt_domain *d, bool force_free); +bool cbm_pseudo_locked(unsigned long cbm, struct rdt_domain *d); int rdt_pseudo_lock_fs_init(struct kernfs_node *root); void rdt_pseudo_lock_fs_remove(void); int rdt_pseudo_lock_mkdir(const char *name, umode_t mode); diff --git a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c index c859ff7dea6e..9c0f002c08ea 100644 --- a/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c +++ b/arch/x86/kernel/cpu/intel_rdt_pseudo_lock.c @@ -273,6 +273,25 @@ static void pseudo_lock_region_kn_unlock(struct kernfs_node *kn) } /** + * cbm_pseudo_locked - Test if all or portion of CBM is pseudo-locked + * @cbm: bitmask to be tested + * @d: rdt_domain for which @cbm was provided + * + * RETURNS: + * True if bits from @cbm intersects with what has been pseudo-locked in + * rdt_domain @d, false otherwise. + */ +bool cbm_pseudo_locked(unsigned long cbm, struct rdt_domain *d) +{ + if (d->plr && + bitmap_intersects(&cbm, (unsigned long *)&d->plr->cbm, + d->plr->r->cache.cbm_len)) + return true; + + return false; +} + +/** * 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 -- 2.13.5