From patchwork Fri Apr 14 10:38:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 83346 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp288153vqo; Fri, 14 Apr 2023 03:59:47 -0700 (PDT) X-Google-Smtp-Source: AKy350Z9RajTYBvC8vpX049pT7wUX1ZIE2OKC284S0RHlRG8hLydftNpNmyfzpGBalct09gFM+g9 X-Received: by 2002:a05:6a00:23d2:b0:626:29ed:941f with SMTP id g18-20020a056a0023d200b0062629ed941fmr7660244pfc.5.1681469986937; Fri, 14 Apr 2023 03:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681469986; cv=none; d=google.com; s=arc-20160816; b=jaDaVo4XmSO/R1CH0TfR++NP1IKK/uuUyOvAjHvMZUkuVzUM9bJDVpT9ZvhZICdhOx PBrPzuOvmgJINA7Q/8tzSu+xYQBtJQIE7CqwB/yYW9AELtA2/M26NQhiSQen5AKuC2UG FT9X0qpKre+QFYxb8qHc/YE19cXUIDdHOwiJ9Q9ngdzGiafpzr/Q9edC0U1AsV2bH+m0 MP0TIcq7GT4r8d4zeqhvUQ6jOPdkOabllpMwFhx3Yz1llL8pyxrq679uK+1XX0pnLX08 QQthoVhQfqkxZW+uc/AkaeUsU0LLfKpYyPDZalrwCKq+aaHv0uCTFIrdJaC/3iQEa4WQ SX5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=npO0D8Vo1wi+XzrnkB7csP/fIIyWYUfjkdVUgReY53c=; b=FU/uu8jOpxfybN/1d+Ga+kRBumVd9Aur+ge6h2dRjBZtfieO+VfU8HQ0QENboaovbZ eMEUKR3OPK20NzIqblFqhUWh9KE4V16sXs/GWVs3ySlzl3ybkxcL1rYkcB5eD00qMjon 9EV219YHcOwL729JNtogLx/pHONwXQ9ouqv3l3aQh4eNxmxDT4NwYw8A3hGYGInrWhP1 mnJ9NDkNu2ZNrSPyYB2DZxAHjoR+8k3CUTaVGt1gQXpEA8Anhv18rmeZroXs9P73UVi3 eypEnWqcz0xSAF5/QupjcAaYcBj2pTPz/mJugL7dxrPcRyQ/dGE22bIbXLMcw9Kmm2Xp UDvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=A7ITVD5z; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h188-20020a6253c5000000b0062d90384500si4103473pfb.307.2023.04.14.03.59.31; Fri, 14 Apr 2023 03:59:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=A7ITVD5z; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230281AbjDNKj3 (ORCPT + 99 others); Fri, 14 Apr 2023 06:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230175AbjDNKjZ (ORCPT ); Fri, 14 Apr 2023 06:39:25 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15D292705; Fri, 14 Apr 2023 03:38:58 -0700 (PDT) Date: Fri, 14 Apr 2023 10:38:54 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681468735; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=npO0D8Vo1wi+XzrnkB7csP/fIIyWYUfjkdVUgReY53c=; b=A7ITVD5z2LZfawIZmtS+A8f4v7WCbTB+de9e2gLPZkKdteGOU19R6wCl3lRGlKbGvQjcqS ip4cg+5s6kLWcS/jzBMMjN/QUUzxePMTuiA3sD4+5jlrMlhnMXYZB4R07pd2q9/j7D5emN SMU6hkl2CDYSFpDJBBBtcpyoqdY/7dVZBxOFD+pKDa1Fyh1hwUp7Q/U7tUO8n6sZxKC32i aQk1krwE1h1guuHwDVnpTBh1zDXE9MKpMim2gHZ0fni5zOlpfVOo5repxOhx1fsTdil5sm EM7vzxI7nYiS15GjC/1fhWJaklohWNngx5cGBswKQsy6+kAog4ndv7s7H8Q73g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681468735; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=npO0D8Vo1wi+XzrnkB7csP/fIIyWYUfjkdVUgReY53c=; b=57toTX39E09HdmdfFYwWKbbd2OYhoqNeuOfSpJDaTNy05QzNK2fJYCely2pasgKHpGN5yl lGkzclmI6bd81bDg== From: "tip-bot2 for Borislav Petkov (AMD)" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/microcode] x86/microcode: Do not taint when late loading on AMD Cc: "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20230411125056.2333-1-bp@alien8.de> References: <20230411125056.2333-1-bp@alien8.de> MIME-Version: 1.0 Message-ID: <168146873499.404.13384379805660350129.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762886341586564986?= X-GMAIL-MSGID: =?utf-8?q?1763149073061416752?= The following commit has been merged into the x86/microcode branch of tip: Commit-ID: 7bc9c1df89a3e5496ace55c198ff09409da0feb0 Gitweb: https://git.kernel.org/tip/7bc9c1df89a3e5496ace55c198ff09409da0feb0 Author: Borislav Petkov (AMD) AuthorDate: Fri, 03 Mar 2023 12:46:49 +01:00 Committer: Borislav Petkov (AMD) CommitterDate: Fri, 14 Apr 2023 12:27:36 +02:00 x86/microcode: Do not taint when late loading on AMD Describe why the concurrency issues which late loading poses are not affecting AMD hardware, after discussing it with hw folks. Thus, do not taint when late loading on it. Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20230411125056.2333-1-bp@alien8.de --- Documentation/x86/microcode.rst | 10 ++++++++++ arch/x86/kernel/cpu/microcode/core.c | 9 +++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Documentation/x86/microcode.rst b/Documentation/x86/microcode.rst index b627c6f..15b52e2 100644 --- a/Documentation/x86/microcode.rst +++ b/Documentation/x86/microcode.rst @@ -208,6 +208,16 @@ Basically there is no way to declare a new microcode update suitable for late-loading. This is another one of the problems that caused late loading to be not enabled by default. +AMD +--- + +Late loading on AMD does not have the concurrency issues described +above: when loading is attempted on T0, the T1 is quiesced and does not +execute instructions. Therefore, even if a higher priority interrupt or +a fault happens, the whole core will see it either before the microcode +patch has been applied or after. In either case, T0 and T1 will have the +same microcode revision and nothing intermediate. + Builtin microcode ================= diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c index 7a329e5..22cf57c 100644 --- a/arch/x86/kernel/cpu/microcode/core.c +++ b/arch/x86/kernel/cpu/microcode/core.c @@ -440,9 +440,6 @@ static int microcode_reload_late(void) int old = boot_cpu_data.microcode, ret; struct cpuinfo_x86 prev_info; - pr_err("Attempting late microcode loading - it is dangerous and taints the kernel.\n"); - pr_err("You should switch to early loading, if possible.\n"); - atomic_set(&late_cpus_in, 0); atomic_set(&late_cpus_out, 0); @@ -498,7 +495,11 @@ put: if (ret == 0) ret = size; - add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK); + if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD) { + pr_err("Late microcode loading is dangerous and taints the kernel.\n"); + pr_err("You should switch to early loading if possible.\n"); + add_taint(TAINT_CPU_OUT_OF_SPEC, LOCKDEP_STILL_OK); + } return ret; }