Received: by 2002:a4a:311b:0:0:0:0:0 with SMTP id k27-v6csp4796444ooa; Tue, 14 Aug 2018 10:40:17 -0700 (PDT) X-Google-Smtp-Source: AA+uWPySD6YcwfTxSDtQKWVO7WqbzSSZKMevhiftE1zmOBWhHDkxZ8dOAM0lq0GDDgTjYOkCvxU9 X-Received: by 2002:a17:902:15c5:: with SMTP id a5-v6mr21128271plh.137.1534268417876; Tue, 14 Aug 2018 10:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534268417; cv=none; d=google.com; s=arc-20160816; b=s+3D1rUnqcGQGHbhYS3BJAVLXOsVjD5Y9o+qhcjEjq8bK6YDUy9k76gaY7v2omwcJ7 22BjQMn15ibsDZeog1S4qC/E6Rx+nzDDIMc4pHhPhF4nCoL5RX3P7aErBMiKtCyrANI9 ImbnAWjcJJaU16CEUF0wg9ohLwlZKwygZ50UOGBbgUcGU3nZXENdo+qqSrplTc2N30kx oXyn9s6bmtgVYl2JUw/OSEYwuCMeDkg2dWKfvBLFoxcpIcaCK/4Wv7b31g4H9evrXELd gjN66F5KIFq+k6isSPHicPB9U1zoUTfw30uukb1lv48fQyuhgx9ReLtaLpUw/qUjtOlA olLQ== 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=LJXyrCjn2+PzH7IGeYWrhcxYx111fHQ684CfcC6Qa7o=; b=JmyZZdsTF1a6Eg5ScvPCP5HMshbNGgRI83j654S1n2IBjtUawv4KUOES1uVMwRTT4y 5n4P+eJlNaV8CYDvpueuYADiLZhMYkO95CeteS71fZQ7bkfLHtmloF6KLojBL8DF9cfe m3iY+tHPIOyJL97Qhl2SmPOWLXDeLVzCZOEwKanEyLUt6z4a6r0iPMNf+TtjoBlVEcFU cwvC+5gV/zFdUlyi1QyfJziDNoSOsFTIWmOMfPXYTpbDwshGgtwtNXJtYbfnyiDu4dpO SYhuxn/BuJaAf4WWCg43nCUXGCsyxw8Oxl0xBV0amW1293axnZrBAFlT+uXoTdkBZBRi Ypag== 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 u6-v6si17580043plz.423.2018.08.14.10.40.02; Tue, 14 Aug 2018 10:40:17 -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 S1733099AbeHNU0w (ORCPT + 99 others); Tue, 14 Aug 2018 16:26:52 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58372 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728596AbeHNU0u (ORCPT ); Tue, 14 Aug 2018 16:26:50 -0400 Received: from localhost (unknown [194.244.16.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DEDD2CBA; Tue, 14 Aug 2018 17:38:40 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Josh Poimboeuf , Borislav Petkov , David Woodhouse Subject: [PATCH 4.14 104/104] x86/microcode: Allow late microcode loading with SMT disabled Date: Tue, 14 Aug 2018 19:17:58 +0200 Message-Id: <20180814171521.742489790@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180814171515.270692185@linuxfoundation.org> References: <20180814171515.270692185@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.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Josh Poimboeuf commit 07d981ad4cf1e78361c6db1c28ee5ba105f96cc1 upstream The kernel unnecessarily prevents late microcode loading when SMT is disabled. It should be safe to allow it if all the primary threads are online. Signed-off-by: Josh Poimboeuf Acked-by: Borislav Petkov Signed-off-by: David Woodhouse Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/microcode/core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -509,12 +509,20 @@ static struct platform_device *microcode static int check_online_cpus(void) { - if (num_online_cpus() == num_present_cpus()) - return 0; + unsigned int cpu; - pr_err("Not all CPUs online, aborting microcode update.\n"); + /* + * Make sure all CPUs are online. It's fine for SMT to be disabled if + * all the primary threads are still online. + */ + for_each_present_cpu(cpu) { + if (topology_is_primary_thread(cpu) && !cpu_online(cpu)) { + pr_err("Not all CPUs online, aborting microcode update.\n"); + return -EINVAL; + } + } - return -EINVAL; + return 0; } static atomic_t late_cpus_in;