From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936195AbcIHHDX (ORCPT ); Thu, 8 Sep 2016 03:03:23 -0400 Received: from mga05.intel.com ([192.55.52.43]:22481 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932826AbcIHG6W (ORCPT ); Thu, 8 Sep 2016 02:58:22 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,298,1470726000"; d="scan'208";a="1052967036" From: "Fenghua Yu" To: "Thomas Gleixner" , "H. Peter Anvin" , "Ingo Molnar" , "Tony Luck" , "Peter Zijlstra" , "Tejun Heo" , "Borislav Petkov" , "Stephane Eranian" , "Marcelo Tosatti" , "David Carrillo-Cisneros" , "Shaohua Li" , "Ravi V Shankar" , "Vikas Shivappa" , "Sai Prakhya" Cc: "linux-kernel" , "x86" , Fenghua Yu Subject: [PATCH v2 16/33] x86/intel_rdt: Class of service and capacity bitmask management for CDP Date: Thu, 8 Sep 2016 02:57:10 -0700 Message-Id: <1473328647-33116-17-git-send-email-fenghua.yu@intel.com> X-Mailer: git-send-email 1.8.0.1 In-Reply-To: <1473328647-33116-1-git-send-email-fenghua.yu@intel.com> References: <1473328647-33116-1-git-send-email-fenghua.yu@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vikas Shivappa Add support to manage CLOSid(CLass Of Service id) and capacity bitmask(cbm) for code data prioritization(CDP). Closid management includes changes to allocating, freeing closid and closid_get and closid_put and changes to closid availability map during CDP set up. CDP has a separate cbm for code and data. Each closid is mapped to a (dcache_cbm, icache_cbm) pair when cdp mode is enabled. Signed-off-by: Vikas Shivappa Signed-off-by: Fenghua Yu Reviewed-by: Tony Luck --- arch/x86/kernel/cpu/intel_rdt.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/intel_rdt.c b/arch/x86/kernel/cpu/intel_rdt.c index e0f23b6..9cee3fe 100644 --- a/arch/x86/kernel/cpu/intel_rdt.c +++ b/arch/x86/kernel/cpu/intel_rdt.c @@ -27,7 +27,13 @@ #include /* - * cctable maintains 1:1 mapping between CLOSid and cache bitmask. + * During cache alloc mode cctable maintains 1:1 mapping between + * CLOSid and cache bitmask. + * + * During CDP mode, the cctable maintains a 1:2 mapping between the closid + * and (dcache_cbm, icache_cbm) pair. + * index of a dcache_cbm for CLOSid 'n' = n << 1. + * index of a icache_cbm for CLOSid 'n' = n << 1 + 1 */ static struct clos_cbm_table *cctable; /* @@ -50,6 +56,13 @@ bool cdp_enabled; #define __DCBM_TABLE_INDEX(x) (x << 1) #define __ICBM_TABLE_INDEX(x) ((x << 1) + 1) +#define __DCBM_MSR_INDEX(x) \ + CBM_FROM_INDEX(__DCBM_TABLE_INDEX(x)) +#define __ICBM_MSR_INDEX(x) \ + CBM_FROM_INDEX(__ICBM_TABLE_INDEX(x)) + +#define DCBM_TABLE_INDEX(x) (x << cdp_enabled) +#define ICBM_TABLE_INDEX(x) ((x << cdp_enabled) + cdp_enabled) struct rdt_remote_data { int msr; @@ -107,9 +120,12 @@ void __intel_rdt_sched_in(void *dummy) state->closid = 0; } +/* + * When cdp mode is enabled, refcnt is maintained in the dcache_cbm entry. + */ static inline void closid_get(u32 closid) { - struct clos_cbm_table *cct = &cctable[closid]; + struct clos_cbm_table *cct = &cctable[DCBM_TABLE_INDEX(closid)]; lockdep_assert_held(&rdtgroup_mutex); @@ -139,7 +155,7 @@ static int closid_alloc(u32 *closid) static inline void closid_free(u32 closid) { clear_bit(closid, cconfig.closmap); - cctable[closid].cbm = 0; + cctable[DCBM_TABLE_INDEX(closid)].cbm = 0; if (WARN_ON(!cconfig.closids_used)) return; @@ -149,7 +165,7 @@ static inline void closid_free(u32 closid) static void closid_put(u32 closid) { - struct clos_cbm_table *cct = &cctable[closid]; + struct clos_cbm_table *cct = &cctable[DCBM_TABLE_INDEX(closid)]; lockdep_assert_held(&rdtgroup_mutex); if (WARN_ON(!cct->clos_refcnt)) -- 2.5.0