From: "Jan Beulich" Subject: Re: [PATCH 4/6] x86: add scheduling support for Intel CAT Date: Tue, 17 Mar 2015 09:19:42 +0000 Message-ID: <5507FFBE020000780006A9A8@mail.emea.novell.com> References: <1426241605-4114-1-git-send-email-chao.p.peng@linux.intel.com> <1426241605-4114-5-git-send-email-chao.p.peng@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1426241605-4114-5-git-send-email-chao.p.peng@linux.intel.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Chao Peng Cc: wei.liu2@citrix.com, Ian.Campbell@citrix.com, stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com, Ian.Jackson@eu.citrix.com, xen-devel@lists.xen.org, will.auld@intel.com, keir@xen.org, dgdegra@tycho.nsa.gov List-Id: xen-devel@lists.xenproject.org >>> On 13.03.15 at 11:13, wrote: > @@ -407,10 +388,75 @@ void psr_domain_free(struct domain *d) > psr_free_cos(d); > } > > +static void psr_assoc_init(struct psr_assoc *psra) > +{ > + unsigned int socket; > + struct psr_cat_socket_info *info; > + > + socket = cpu_to_socket(smp_processor_id()); > + psra->socket = socket; > + if ( cat_socket_info && socket < opt_socket_num ) > + { > + info = cat_socket_info + socket; > + if ( info->enabled ) > + psra->cos_mask = (~(~0ull << (get_count_order(info->cos_max) > + + 32))) & (~0ull << 32); ((1ull << get_count_order()) - 1) << 32 seems better readable to me. > void psr_ctxt_switch_to(struct domain *d) > { > + uint64_t reg; > + struct psr_assoc *psra = &this_cpu(psr_assoc); > + > + psr_assoc_reg_read(psra, ®); This ultimately leading to psr_assoc_init() makes it really undesirable here imo: Initialization work shouldn't be done during a context switch, even is this a one time thing on each CPU. Jan