Return-path: Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by Galois.linutronix.de with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fICHr-00035s-TX for speck@linutronix.de; Mon, 14 May 2018 14:09:08 +0200 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fICHo-0001Y1-Do for speck@linutronix.de; Mon, 14 May 2018 12:09:05 +0000 Date: Mon, 14 May 2018 14:09:02 +0200 From: Peter Zijlstra Subject: [MODERATED] Re: [patch 06/15] Hidden 6 Message-ID: <20180514120902.GQ12217@hirez.programming.kicks-ass.net> References: <20180513140048.543641807@linutronix.de> <20180513140538.715249208@linutronix.de> MIME-Version: 1.0 In-Reply-To: <20180513140538.715249208@linutronix.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On Sun, May 13, 2018 at 04:00:54PM +0200, speck for Thomas Gleixner wrote: > Subject: [patch 06/15] x86/speculation: Handle HT correctly on AMD > From: Thomas Gleixner > > The AMD64_LS_CFG MSR is a per core MSR on Family 17H CPUs. That means when > hyperthreading is enabled the SSBD bit toggle needs to take both cores into > account. Otherwise the following situation can happen: > > CPU0 CPU1 > > disable SSB > disable SSB > enable SSB <- Enables it for the Core, i.e. for CPU0 as well > > So after the SSB enable on CPU1 the task on CPU0 runs with SSB enabled > again. > > On Intel the SSBD control is per core as well, but the synchronization > logic is implemented behind the per thread SPEC_CTRL MSR. > > Add the necessary synchronization logic for AMD family 17H. Unfortunately > that requires a spinlock to serialize the access to the MSR, but the locks > are only shared between siblings. So we don't need this from NMI context anymore?