From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753415AbcKOQm5 (ORCPT ); Tue, 15 Nov 2016 11:42:57 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:43886 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752308AbcKOQmz (ORCPT ); Tue, 15 Nov 2016 11:42:55 -0500 Date: Tue, 15 Nov 2016 17:40:05 +0100 (CET) From: Thomas Gleixner To: Fenghua Yu cc: "H. Peter Anvin" , Ingo Molnar , Tony Luck , Ravi V Shankar , Sai Prakhya , Vikas Shivappa , linux-kernel , x86 Subject: Re: [PATCH 3/3] x86/intel_rdt: Update closid in PQR_ASSOC registers in synchronous mode when changing "cpus" In-Reply-To: Message-ID: References: <1478912558-55514-1-git-send-email-fenghua.yu@intel.com> <1478912558-55514-3-git-send-email-fenghua.yu@intel.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Nov 2016, Thomas Gleixner wrote: > On Fri, 11 Nov 2016, Fenghua Yu wrote: > > +/* > > + * MSR_IA32_PQR_ASSOC is scoped per logical CPU, so all updates > > + * are always in thread context. > > And this comment tells us what? Nothing useful. It lacks the most important > information why this is safe against a logical CPU switching the MSR right > at this moment during context switch. It's safe because the pqr_switch_to > function is called with interrupts disabled. > > > + */ > > +static void rdt_update_pqr_assoc_closid(void *v) > > +{ > > + struct intel_pqr_state *state = this_cpu_ptr(&pqr_state); > > + > > + state->closid = *(int *)v; > > + wrmsr(MSR_IA32_PQR_ASSOC, state->rmid, state->closid); Furthermore, unconditionally writting the MSR is Just Wrong because the current executing task might have it's own closid set which gets overwritten by this. No cookies! tglx