From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chao Peng Subject: Re: [PATCH v6 1/3] x86: Support enable CDP by boot parameter and add get CDP status Date: Sat, 10 Oct 2015 14:04:48 +0800 Message-ID: <20151010060448.GC18953@pengc-linux.bj.intel.com> References: <1444274637-6104-1-git-send-email-he.chen@linux.intel.com> <1444274637-6104-2-git-send-email-he.chen@linux.intel.com> Reply-To: Chao Peng Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1ZknLS-0003EG-JM for xen-devel@lists.xenproject.org; Sat, 10 Oct 2015 06:09:26 +0000 Content-Disposition: inline In-Reply-To: <1444274637-6104-2-git-send-email-he.chen@linux.intel.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: He Chen Cc: wei.liu2@citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, jbeulich@suse.com, xen-devel@lists.xenproject.org, keir@xen.org List-Id: xen-devel@lists.xenproject.org > + if ( (ecx & PSR_CAT_CDP_CAPABILITY) && (opt_psr & PSR_CDP) && > + cdp_socket_enable && !test_bit(socket, cdp_socket_enable) ) > + { > + rdmsrl(MSR_IA32_PSR_L3_QOS_CFG, val); > + wrmsrl(MSR_IA32_PSR_L3_QOS_CFG, val | (1 << PSR_L3_QOS_CDP_ENABLE_BIT)); > + > + info->cos_to_cbm[0].code = (1ull << info->cbm_len) - 1; > + info->cos_to_cbm[0].data = (1ull << info->cbm_len) - 1; > + > + /* We only write mask1 since mask0 is always all ones by default. */ > + wrmsrl(MSR_IA32_PSR_L3_MASK(1), (1ull << info->cbm_len) - 1); Although I think it maybe not a big deal here, I'd suggest doing this before you actually turning CDP on (writing MSR_IA32_PSR_L3_QOS_CFG above) as strictly speaking before we enabling CDP the data mask(mask1) for cos0 should already be initialised. > + > + /* Cut half of cos_max when CDP is enabled. */ > + info->cos_max >>= 1; > + > + set_bit(socket, cdp_socket_enable); > + } > + printk(XENLOG_INFO "CAT: enabled on socket %u, cos_max:%u, cbm_len:%u, CDP:%s\n", > + socket, info->cos_max, info->cbm_len, > + cdp_is_enabled(socket) ? "on" : "off"); > } > } > > @@ -513,6 +551,7 @@ static void cat_cpu_fini(unsigned int cpu) > xfree(info->cos_to_cbm); > info->cos_to_cbm = NULL; > } > + clear_bit(socket, cdp_socket_enable); Is it possible for cdp_socket_enable to be NULL? e.g. in the case when CDP failed to initilize. You can check if it works for cat-only mode. Chao > clear_bit(socket, cat_socket_enable); > }