Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4802612ooa; Tue, 14 Aug 2018 10:45:27 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzGFF1mdDmCmUSYqUr+D8dvFeyl5RavDGXDkUESFYlOfRiWEMpJWAzxbh4dl8m8LTOi2iK3 X-Received: by 2002:a17:902:622:: with SMTP id 31-v6mr21298722plg.153.1534268727807; Tue, 14 Aug 2018 10:45:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268727; cv=none; d=google.com; s=arc-20160816; b=ujfCNXKtAU7SKfIGmw2dsLx1+LWM4/iuBOFF/cmJzBunXLvLvK9tpYteHfei8Z6X/6 C6nBXPAjuspheCOPL21G8KesxzigTrKtZyBWkpcxXBqDSsVkSFahZVK2dLrByHYIrrzD eHhTi443bb6wajfTLZ5KVFr8v6RWUcslYdn6OOpuwIvhbOL6mAqikcx6jS7Jg/1zwySn pDSN4tC7M0ZaTLnIL7cTq4eT46nADpGCFjUGmDoBc5IOcX8XJll8q5ESWcHM8hhdsmCn PRw0jGuP2Ey6ATBuUgClXujyxrjqB0Bj14AydRiZrXTr7lpjHj5HZrbSESYdqSn8ToGr zQhw== 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=8a4+Kjx8ccb2f+BEUFuqKG4GdlpV43PQpz5Rgv24H80=; b=FxV8OJbNFEA/cLuWO/pYQJypIPIQ2uId6PzBU5Be6s14kw0J4i1Z4wkPzuHdInFM5H ccT1hYfhbA8xICmVuoJgRFQjTBz8+YJeSG+cPR4YCaFu44rUy+NLPEyfhsSYlkQ4ePxE UJHquaug1rvMtEDJrt4M8bksxVDbF2KFPrJSK/El9NMPa0zQnFj5QUFN4aSPSh0SwBvE 0Bqg6kTS+BLwMCgSOuoI/mc12meCG8OMxWEh4VtWiRDwBgmYZYPkYLdvVTWSkc4QfgoZ 1tanoNRu8PCzYdwe2pLn/aD3q5AiR9iAfNhQ9iQO4F/Ff1ryMmSPMt4Jf+03bIrXoaiH 7uIQ== 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 q23-v6si23362943pgq.483.2018.08.14.10.45.13; Tue, 14 Aug 2018 10:45:27 -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 S2390537AbeHNUb1 (ORCPT + 99 others); Tue, 14 Aug 2018 16:31:27 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59800 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728642AbeHNUb1 (ORCPT ); Tue, 14 Aug 2018 16:31:27 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 227DBC7B; Tue, 14 Aug 2018 17:43:15 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Jiri Kosina , Josh Poimboeuf , David Woodhouse Subject: [PATCH 4.9 074/107] x86/kvm: Serialize L1D flush parameter setter Date: Tue, 14 Aug 2018 19:17:37 +0200 Message-Id: <20180814171525.298905299@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171520.883143803@linuxfoundation.org> References: <20180814171520.883143803@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner commit dd4bfa739a72508b75760b393d129ed7b431daab upstream Writes to the parameter files are not serialized at the sysfs core level, so local serialization is required. Signed-off-by: Thomas Gleixner Tested-by: Jiri Kosina Reviewed-by: Greg Kroah-Hartman Reviewed-by: Josh Poimboeuf Link: https://lkml.kernel.org/r/20180713142322.873642605@linutronix.de Signed-off-by: David Woodhouse Signed-off-by: Greg Kroah-Hartman --- arch/x86/kvm/vmx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -194,6 +194,7 @@ extern const ulong vmx_return; static DEFINE_STATIC_KEY_FALSE(vmx_l1d_should_flush); static DEFINE_STATIC_KEY_FALSE(vmx_l1d_flush_always); +static DEFINE_MUTEX(vmx_l1d_flush_mutex); /* Storage for pre module init parameter parsing */ static enum vmx_l1d_flush_state __read_mostly vmentry_l1d_flush_param = VMENTER_L1D_FLUSH_AUTO; @@ -258,7 +259,7 @@ static int vmentry_l1d_flush_parse(const static int vmentry_l1d_flush_set(const char *s, const struct kernel_param *kp) { - int l1tf; + int l1tf, ret; if (!boot_cpu_has(X86_BUG_L1TF)) return 0; @@ -278,7 +279,10 @@ static int vmentry_l1d_flush_set(const c return 0; } - return vmx_setup_l1d_flush(l1tf); + mutex_lock(&vmx_l1d_flush_mutex); + ret = vmx_setup_l1d_flush(l1tf); + mutex_unlock(&vmx_l1d_flush_mutex); + return ret; } static int vmentry_l1d_flush_get(char *s, const struct kernel_param *kp)