Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp306005ybt; Tue, 7 Jul 2020 23:59:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiNCrKzPzmfX9fHiqBvaDXrzXm6aPm1MY0B5HrGsQcKZqvGoVEg4aKHM//1tTy/gVZSUbb X-Received: by 2002:a50:fc88:: with SMTP id f8mr34308345edq.314.1594191584912; Tue, 07 Jul 2020 23:59:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594191584; cv=none; d=google.com; s=arc-20160816; b=CmYNDHze1vkuwtJ0/uWBFXTKKimDknkr2OUc59saFOq+IhgbgTf86crjQcMy/Pb9nQ gheNkms9KfzKBkIvHYLwyRtFK/OlgY0jMn1MG6qb9MF3HLSYw/Y6I2+OFjdwhNWMVkwm hG/isrVU6Ycf7AfE/jmSOA8ZBILATQJ/ZviU7VBLc4wevpl+5fTdMCynJNDDtrD4vwBp 8HJzC6PGFIKk6PlQL4DiYfF13uGwNybOkq5mdOJdl3EaRpNspP++uRbocYV5r3I5VaDB BkuChRZrrZQWzEvP+rp382CB6pg/GZ9Oxe6HJsAXgvm0Ex8QEmwLuNQMSkyqfr93qVy0 nGrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:ironport-sdr:ironport-sdr; bh=u33HqulXIJIiI8L9W0XoV7okUy/o0gpOdrJueq0JbMk=; b=H0wyAMspVZfu5JJstKaoig/WZRn/ztYNcnhGIHd7JjrCny3fGR56TTKcp4T9dgPmOk SSlcDNhZMXFj1bnlQg5nomsjkhnJl0942CYJBjMUe0/PUh8TSl5yB5PRRR7rIUp87kmd TvCpcxvus9omQ68uTf0/pbDqk17fvzjYZNBXnmEm4gnWyRBWGItvvu3koJuhUG4bF+aH h3s/Ny4UHJkXpIZeCm0luUPTRUHXlBA7tXJJXLtGz5CXocoEEFOI8fvzvDIler7h8kX5 TmQf54/aODCcyCmLP4o3C3KHhIrLUQ6lImlAxY3jFY+s05qnydySNWq4GCmzs+PQAnWy 25iQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id df18si16986365edb.501.2020.07.07.23.59.21; Tue, 07 Jul 2020 23:59:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729856AbgGHG6d (ORCPT + 99 others); Wed, 8 Jul 2020 02:58:33 -0400 Received: from mga18.intel.com ([134.134.136.126]:46706 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726206AbgGHG6c (ORCPT ); Wed, 8 Jul 2020 02:58:32 -0400 IronPort-SDR: xHKvobqF0ZAeaxotMCfGu+6tIbZGrWCcROp9OPk7mI/l5HEP3oO8xLA6gcm4/dgYbugqWg3+DJ 9WWiDJwNt7dQ== X-IronPort-AV: E=McAfee;i="6000,8403,9675"; a="135212687" X-IronPort-AV: E=Sophos;i="5.75,326,1589266800"; d="scan'208";a="135212687" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2020 23:58:32 -0700 IronPort-SDR: luJRpwLAwneuwT559bxQM/zRdHTBf/LN8vSxPKTeitFEwbaQsn4bDDMFnhvdIG7alD1mBaQ8+U PUgdcmCP+Axw== X-IronPort-AV: E=Sophos;i="5.75,326,1589266800"; d="scan'208";a="314556583" Received: from unknown (HELO [10.239.13.102]) ([10.239.13.102]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2020 23:58:26 -0700 Subject: Re: [PATCH v2] x86/speculation/l1tf: Add KConfig for setting the L1D cache flush mode To: Abhishek Bhardwaj , LKML Cc: Anthony Steinhauser , Borislav Petkov , "H. Peter Anvin" , Ingo Molnar , Jim Mattson , Joerg Roedel , Josh Poimboeuf , Mark Gross , Paolo Bonzini , Pawan Gupta , Peter Zijlstra , Sean Christopherson , Thomas Gleixner , Tony Luck , Vitaly Kuznetsov , Waiman Long , Wanpeng Li , kvm@vger.kernel.org, x86@kernel.org References: <20200702213807.2511503-1-abhishekbh@google.com> From: Xiaoyao Li Message-ID: <2dd61d8b-223b-5a61-b739-392e79f1ce92@intel.com> Date: Wed, 8 Jul 2020 14:58:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200702213807.2511503-1-abhishekbh@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/3/2020 5:38 AM, Abhishek Bhardwaj wrote: > This change adds a new kernel configuration that sets the l1d cache > flush setting at compile time rather than at run time. > > Signed-off-by: Abhishek Bhardwaj > > --- > > Changes in v2: > - Fix typo in the help of the new KConfig. > > arch/x86/kernel/cpu/bugs.c | 8 ++++++++ > arch/x86/kvm/Kconfig | 17 +++++++++++++++++ > 2 files changed, 25 insertions(+) > > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > index 0b71970d2d3d2..1dcc875cf5547 100644 > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -1406,7 +1406,15 @@ enum l1tf_mitigations l1tf_mitigation __ro_after_init = L1TF_MITIGATION_FLUSH; > #if IS_ENABLED(CONFIG_KVM_INTEL) > EXPORT_SYMBOL_GPL(l1tf_mitigation); > #endif > +#if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1) > +enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_NEVER; > +#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2) > +enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_COND; > +#elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3) > +enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_ALWAYS; > +#else > enum vmx_l1d_flush_state l1tf_vmx_mitigation = VMENTER_L1D_FLUSH_AUTO; > +#endif how about enum vmx_l1d_flush_state l1tf_vmx_mitigation = #if (CONFIG_KVM_VMENTRY_L1D_FLUSH == 1) VMENTER_L1D_FLUSH_NEVER; #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 2) VMENTER_L1D_FLUSH_COND; #elif (CONFIG_KVM_VMENTRY_L1D_FLUSH == 3) VMENTER_L1D_FLUSH_ALWAYS; #else VMENTER_L1D_FLUSH_AUTO; #endif