Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp789301imm; Mon, 21 May 2018 14:29:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqG8A0wzSQIv2yrAcXFuSgxkVWs1WwXAsR7TftVoujiv0mFpZcQp/LG8k3213YHI31q7bEg X-Received: by 2002:a62:991:: with SMTP id 17-v6mr21664307pfj.34.1526938183553; Mon, 21 May 2018 14:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526938183; cv=none; d=google.com; s=arc-20160816; b=vr9in3UaK8APTGsracKjv1xeSnpHbffMEvgfm247A/dS0E0m5rnMoqwJnhGlsdt0Vt Edh/NXjao/lGEDbqfNhp201xdnz3a04OWK4bkpQgTDllLwiCdjQg8A7ayVayQP4bWRvC F04IDWrk18MlsdroPwoMBfuz8dqXVjGR9zkF7E+Oq6fIsh8DgNEM2Cuk6caoJECtLLdm d2MqFTq9SlYV8XQN+zqDYdpTKqOrz98S+BGpwd+P4Y2KlGJjDdgVvwueAVXono9Bhi5N nq8zZor0hezGzzBhqItH6IOm51qzk3JCPyY6icD7TAnLzz2EocwOG6kkQO5xXAcNXJGV 3Sfw== 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:dkim-signature :arc-authentication-results; bh=wXdihtaGZBzn4jIJgDjT+hakTnFGC5ZWQ1tAYWjUT28=; b=uWEjU+397jtlA614gq7UWFEHlZjZlHDCsqNo48kNrwy7LMhVSLD+vatBVLmbF5L85v eKMAqoazL7Rpg1zfFm4Z4VWKecBVeakq+Fzyx/f9x2D4FCJ7ysxCcGX1OYmbhJpmrX3I 8xUrrMFcDjX6A/Hj9kSuZ2/JW4rCHMx1rhnevSuDujlofnUBGz+mP86M/2L5icD4En3B R+Sstbb4ILAp11EyXEO9ZEcBhbJqdkTb23fkbdJqVbop85LU0mhxxGpVnRwL9PFCVNKo CoWjhzykk/DbyWWa1jnG4U3j2svO+XLApN7IEgszU6seTW3/Z79QEyOjRQfNLJfjOS4w l/Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uGusPKJt; 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 a8-v6si14619786ple.222.2018.05.21.14.29.29; Mon, 21 May 2018 14:29:43 -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; dkim=pass header.i=@kernel.org header.s=default header.b=uGusPKJt; 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 S932750AbeEUV3M (ORCPT + 99 others); Mon, 21 May 2018 17:29:12 -0400 Received: from mail.kernel.org ([198.145.29.99]:41940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932675AbeEUV1H (ORCPT ); Mon, 21 May 2018 17:27:07 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 69E6420873; Mon, 21 May 2018 21:27:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526938026; bh=qJw7VrLMFaU7v9VklZyGYcxlFNS/cEkFEVYsLZRUi6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uGusPKJtdyb4GRnNIFkcr/uY+XAsncacVmQXm4tVpPpnGcS0tGOVkJUfEjcJ5sWB2 uLFhwu5K2Y03FunUVuhHuKrxcnJ0FQrL5m4M9HdluEYei2IrkV3Z/nMzKFXEiBd2Ck MUjvcr+gLGXyTbHrk6QtwuW9CMlJKNs9xxLLIJMw= 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 Subject: [PATCH 4.16 102/110] x86/speculation: Rework speculative_store_bypass_update() Date: Mon, 21 May 2018 23:12:39 +0200 Message-Id: <20180521210514.708160559@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@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.16-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: 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 @@ -598,7 +598,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 @@ -414,10 +414,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(); }