Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5764824imm; Mon, 23 Jul 2018 05:48:42 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdCVZkzlHLPnbJ3aIdqcMB61cUVicaKgepR6VhUK7iwbYUQTBiszGghpQUVqWQaXY+ZWvn6 X-Received: by 2002:a63:d80f:: with SMTP id b15-v6mr12292215pgh.347.1532350122511; Mon, 23 Jul 2018 05:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532350122; cv=none; d=google.com; s=arc-20160816; b=XVbyKmOmUp4/460Kd7BuwO6/BD1N1bLwLIwDXvU394mWv+odLtM37RcvNU8fKXYKRS rFxKmfm8tUM7sSWayPPd16pH0SeqetjA5WFOHIjzwleY2IxI9bz4OZuZpPHnb0g/xGF+ 1cjD5vvrvv76IfKLYtE5gOBWW9MG4jD61SGiIkCg6xM0ssq7KttQ5iRdIlEU/mSebvIS Xq+h7pUZ4BCw0vPcb/4KQe2O+QoKCQnOYLOr0Zp9NARn47X0jwfCFzjmvWolKNNEjFEj nh+T0uq7Pr54M2oGGaS3xxcI5Dl7BmkZHeuwMqwkfm03KHkXUiRL9S90IAZBS2MskRNT l+Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=VAdLTxz49Nf/VNk1uS33OdlyZuCW/TEO9h1SFaXCRS4=; b=jnzysEqmIH5pP5BOMSPzIHzPUz9kiIQQttsNw6n3VeauoaMo7UJCDG4J+QDJWAZPG2 BkQq+4GAryZJmXC3Hxeb5nwTuHdso5Kr14jK+NWxeyBLdNkpvKiVOAT/O1H2odmfqr1U VPVxLWmkJKUEFRk4pDrHMHp83oEcyniBRoPtl87yCCmMyFLQe5j44KbJwG3xGg8aw6ce BkVdboMNrDXyyNwm72TVOEx72mTNuB25z3gAWCNszjeflHaoNHpFqQYJgGXnNkHsUlUu Cou2zGXvU64wN8tk4AuuFsSEC76ZLZTOE6MNl7eycjyTdU1TGP390dWzshvGqeBtAQuy lcdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11-v6si8144753plb.100.2018.07.23.05.48.28; Mon, 23 Jul 2018 05:48:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389621AbeGWNsF (ORCPT + 99 others); Mon, 23 Jul 2018 09:48:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51470 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389592AbeGWNsE (ORCPT ); Mon, 23 Jul 2018 09:48:04 -0400 Received: from localhost (LFbn-1-12238-233.w90-92.abo.wanadoo.fr [90.92.53.233]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 538CDC83; Mon, 23 Jul 2018 12:46:41 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Borislav Petkov , Konrad Rzeszutek Wilk , David Woodhouse , "Srivatsa S. Bhat" , "Matt Helsley (VMware)" , Alexey Makhalov , Bo Gan Subject: [PATCH 4.4 091/107] x86/speculation: Rework speculative_store_bypass_update() Date: Mon, 23 Jul 2018 14:42:25 +0200 Message-Id: <20180723122418.050188313@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723122413.003644357@linuxfoundation.org> References: <20180723122413.003644357@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner commit 0270be3e34efb05a88bc4c422572ece038ef3608 upstream The upcoming support for the virtual SPEC_CTRL MSR on AMD needs to reuse speculative_store_bypass_update() to avoid code duplication. Add an argument for supplying a thread info (TIF) value and create a wrapper speculative_store_bypass_update_current() which is used at the existing call site. Signed-off-by: Thomas Gleixner Reviewed-by: Borislav Petkov Reviewed-by: Konrad Rzeszutek Wilk Signed-off-by: David Woodhouse Signed-off-by: Greg Kroah-Hartman Signed-off-by: Srivatsa S. Bhat Reviewed-by: Matt Helsley (VMware) Reviewed-by: Alexey Makhalov Reviewed-by: Bo Gan Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/spec-ctrl.h | 7 ++++++- arch/x86/kernel/cpu/bugs.c | 2 +- arch/x86/kernel/process.c | 4 ++-- 3 files changed, 9 insertions(+), 4 deletions(-) --- a/arch/x86/include/asm/spec-ctrl.h +++ b/arch/x86/include/asm/spec-ctrl.h @@ -42,6 +42,11 @@ extern void speculative_store_bypass_ht_ static inline void speculative_store_bypass_ht_init(void) { } #endif -extern void speculative_store_bypass_update(void); +extern void speculative_store_bypass_update(unsigned long tif); + +static inline void speculative_store_bypass_update_current(void) +{ + speculative_store_bypass_update(current_thread_info()->flags); +} #endif --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -596,7 +596,7 @@ static int ssb_prctl_set(struct task_str * mitigation until it is next scheduled. */ if (task == current && update) - speculative_store_bypass_update(); + speculative_store_bypass_update_current(); return 0; } --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -334,10 +334,10 @@ static __always_inline void __speculativ intel_set_ssb_state(tifn); } -void speculative_store_bypass_update(void) +void speculative_store_bypass_update(unsigned long tif) { preempt_disable(); - __speculative_store_bypass_update(current_thread_info()->flags); + __speculative_store_bypass_update(tif); preempt_enable(); }