Received: by 10.192.165.148 with SMTP id m20csp4143300imm; Mon, 30 Apr 2018 12:33:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpn4IfkLX3GleaPT9wID8mJWMmPPMjltJX33HKzgEhi4G88/Ld3dUOaLJ1Dz6Duk3cLDHoE X-Received: by 2002:a63:a503:: with SMTP id n3-v6mr10795942pgf.19.1525116824194; Mon, 30 Apr 2018 12:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525116824; cv=none; d=google.com; s=arc-20160816; b=O9zxZNsHU1H6KOiUhWaVgQprOf5OGNoeXFGfZ26rpp7+yOMhhnKSLAAJizEF97dgTh eLQ4sKy5VGXhc8ga+bva0twFJ9sxW64OeXQI+z+JTKzJpEVqbNWHtFrEpUzUEKuUBtTv i3mhNp+jLotV8cDLysAnfrd21Dw9ikBwXTqZjlTiRqM4dKvuKBI6PjtgYtoMwDkUKUEG OtHLF+2CeQxJCHDQPsFUk0jqW56897pmaYPY2p7MK9abFAQWFRYmtFPs7a1pfnyFOlAD dFNuXd1Sg7Q2RU66PU7ou5VrWAtiEVSf5vFAOKBYqfgzNlmkeyVRdNE4wbk3/IceZERU KFGQ== 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:dmarc-filter :arc-authentication-results; bh=4zQ7Gpvh9pBx+jFkm43dcP2Ggl8OFrzc6xB0MEwX7CI=; b=f83zCkz/0oYVNc1i6YM8Fo7Hwni2xt7LkIx9P3FIous1u4yjknu8fFEZJkuQHk2/Xz PbI6xo6W/SuAEg69Ij+W9FNxXO10WCF/VBhcWXLCLMuQqWJBE8ke+4zzj07njxzbeHHk szRjKkIpIRDk3QC3OQuz+3o1lJIxPM+NDde4mXybR4k7ga47tjZuXCGL2bpdyhXeZLWc I6P7ZGXyO7ye0ZCe56kuvmwy2CXsME/enhAG5hQ4IQIOaFtqCCo1NtmEUTcGPeg80JJ6 ahUDbzV8enao83a4f7AtiekOMyxQZVDKNkD4Nu7o9M2Gke0p8LOuLHunSfqiW9Nk1fbH MZ3w== 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 a96-v6si1407728pla.169.2018.04.30.12.33.29; Mon, 30 Apr 2018 12:33:44 -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 S932459AbeD3T3B (ORCPT + 99 others); Mon, 30 Apr 2018 15:29:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:37286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756372AbeD3T24 (ORCPT ); Mon, 30 Apr 2018 15:28:56 -0400 Received: from localhost (unknown [104.132.1.102]) (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 24C46235E5; Mon, 30 Apr 2018 19:28:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 24C46235E5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitezslav Samel , Borislav Petkov , Thomas Gleixner , Ashok Raj Subject: [PATCH 4.16 110/113] x86/microcode: Do not exit early from __reload_late() Date: Mon, 30 Apr 2018 12:25:21 -0700 Message-Id: <20180430184019.843643264@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184015.043892819@linuxfoundation.org> References: <20180430184015.043892819@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: Borislav Petkov commit 09e182d17e8891dd73baba961a0f5a82e9274c97 upstream. Vitezslav reported a case where the "Timeout during microcode update!" panic would hit. After a deeper look, it turned out that his .config had CONFIG_HOTPLUG_CPU disabled which practically made save_mc_for_early() a no-op. When that happened, the discovered microcode patch wasn't saved into the cache and the late loading path wouldn't find any. This, then, lead to early exit from __reload_late() and thus CPUs waiting until the timeout is reached, leading to the panic. In hindsight, that function should have been written so it does not return before the post-synchronization. Oh well, I know better now... Fixes: bb8c13d61a62 ("x86/microcode: Fix CPU synchronization routine") Reported-by: Vitezslav Samel Signed-off-by: Borislav Petkov Signed-off-by: Thomas Gleixner Tested-by: Vitezslav Samel Tested-by: Ashok Raj Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20180418081140.GA2439@pc11.op.pod.cz Link: https://lkml.kernel.org/r/20180421081930.15741-2-bp@alien8.de Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/cpu/microcode/core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -564,14 +564,12 @@ static int __reload_late(void *info) apply_microcode_local(&err); spin_unlock(&update_lock); + /* siblings return UCODE_OK because their engine got updated already */ if (err > UCODE_NFOUND) { pr_warn("Error reloading microcode on CPU %d\n", cpu); - return -1; - /* siblings return UCODE_OK because their engine got updated already */ + ret = -1; } else if (err == UCODE_UPDATED || err == UCODE_OK) { ret = 1; - } else { - return ret; } /*