From patchwork Tue Feb 6 10:01:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 197294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1433455dyb; Tue, 6 Feb 2024 02:02:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGeoNSkfY3n56NyRA2p2zjIgRKRma3Y+ARh6BLvkEzHEVrwwvvoO7IdOjsePE6LuIDMi9T X-Received: by 2002:a05:6359:6292:b0:176:d2dc:5115 with SMTP id se18-20020a056359629200b00176d2dc5115mr2023630rwb.20.1707213763598; Tue, 06 Feb 2024 02:02:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707213763; cv=pass; d=google.com; s=arc-20160816; b=AFLRWJBrSsMoQ59pOdAOYPX/WPDoKtbQczy2gbcdbJvRqBXtISabg9GHpPwXvn1mKU eddlP8fzp0nlEoI73mqII3pyu1li8i6xDhopiHEz8Z0GU/iV2oH4VajpFT6IXjIF7BGZ LdezJyJgaalcPDHypMtBSsfLxVg7erSV3gAM1zk78AOCt1a3YHZAXJK8nGxNX3He4SKH t3sfFHD4665W1CBhmAv7rllkX/AGxmjlyOq9HnvH3tbISDn6k/L2IUMOHtPf836B/Rt4 +C17/6RGj8Q6+UkUDiRPhzNPXWG+6CaAlZv0Z5oR+yWi2Ii4y6CCbt/9ydP6EqvZgEYo Tf/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=pw8nOl6Xd35BIIwnw4TJPtMp9fLUt9BWbETiOqwVMss=; fh=bU3ySTiuMnFcRJXgeCckpgE0i0Cqc2DPHk8xDanUm0s=; b=LmA9N8lsk0ANO1IG3O2AtBlc/P3VvqfIiDlBJfDlNiKX0ZVwnnWxzyzRAl05DLsV0v gOQg+Zu2asyCFrYRxFTdH/sFDSE/9bpSQWkMWzqS7otQR6IuPRSY5EpnLc8vBUdayOKI zDR/cZALwWT4XaTM7n7ernkuqoawMTDE6MRtriD7Lij1MDAh1XadL6KyGW5s8GyOohEd IuifGqY+29rC03saflwnv0+PD1ZoRkcqApr+2o2ssmhgf95ZcglZLqw+g09hTMqaOIDY 3CAIbvqsh8jSL3BgrGaMbylzE2ul+3vR09MFbAw2b1clLmKokdrXCoiHhu29TovH253S bVpw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4j3laHXV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-54641-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54641-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de X-Forwarded-Encrypted: i=1; AJvYcCXHZl2CHwbgnRUACnL5T01Aqjc/Eb8wbFisT+xZqTRDrwdEDIF5N0Od8zaGMGRO6z4yN96NMGYdFSEzMPYZYNdtFR3+fA== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e2-20020a63e002000000b005d24ebb61e3si1447354pgh.806.2024.02.06.02.02.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 02:02:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-54641-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=4j3laHXV; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-54641-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-54641-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 53641283697 for ; Tue, 6 Feb 2024 10:02:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3622412E1F1; Tue, 6 Feb 2024 10:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="4j3laHXV"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="PlyAuetE" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8527E12D75F; Tue, 6 Feb 2024 10:02:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707213726; cv=none; b=gDlvrbU0ixsv+cEeZKoHCW6XkXyvOt82s7PaXVZL6E9ouBXjJheIk/tKvEGFMBuwxsLSqXHsjjN6veqQc6vYOArWUSd/05gVSttOvpPgDPQM9NJTIIXOvxeFozWUe7lrb0q9k6zjY7F1waULqqgUlQ8+wsgMZRvrJviKazWu7Oc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707213726; c=relaxed/simple; bh=NTfMPbcLXHzOEzBkAFFoK6F8lJR6D3zYbcL8c4upvs4=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=fsJ3HwKjWAn/JfbPir+gzB3qvBXPfPjBpl/rzSuqK8KlFzDFs5jTul38D8Y+bVmrwDba0Q0pkh1kJZM0bIdLukiOlJEFzgkrKb9z/1O7syhYT4yLSCzH1/Aa6nglR76IducY1wl79UcH+IkZmd/CqVx27kqJrz9+6oETjGrT+tc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=4j3laHXV; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=PlyAuetE; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Tue, 06 Feb 2024 10:01:55 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1707213716; 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=pw8nOl6Xd35BIIwnw4TJPtMp9fLUt9BWbETiOqwVMss=; b=4j3laHXV/SVhfmDa1q8SrWGXQgYi8uEXbmhrEvLm8f3GJVd8RZfHn9Ck0MFDZfjomuwfK7 /G2lqJnTaue+IaNUgDxdEGhfeB9t1zrsMbe5WyuF/40v2F37fytKaI1ZOJwTj+wGlke5SM YI9NKduEy9F/u7P5+jQ0i09D28X/2qgQKY8ox4qZC0t0bI3DA/NNDoi4cacyDq5Yx1xPhp 3g4UhsV13smS2PcXPvzdfhb16MTT7HLyP8ZHpgK0hm1YD1f4LaoABwyaU/l8yZeVPQ/POG hPZ4xGiB3GpGeh1jbIVGFSP/BKg/1QVvMevk4TCx91P6aD5PXqiK50OldR3zcQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1707213716; 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=pw8nOl6Xd35BIIwnw4TJPtMp9fLUt9BWbETiOqwVMss=; b=PlyAuetE1RmvWeEp7wlRTOajknyHzOEuuY5XKy7rASTWd6s/Y4irdwmQxMUWkQgfa0IUUH ka6/GaZ6y8v/8PBg== From: tip-bot2 for NOMURA =?utf-8?b?SlVOSUNISSjph47mnZEg5rez5LiAKQ==?= Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/boot] x86/boot: Add a message about ignored early NMIs Cc: Borislav Petkov , "H. Peter Anvin" , "Jun'ichi Nomura" , "Kirill A. Shutemov" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20231130103339.GCZWhlA196uRklTMNF@fat_crate.local> References: <20231130103339.GCZWhlA196uRklTMNF@fat_crate.local> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170721371582.398.17711309093977482776.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790143379078193095 X-GMAIL-MSGID: 1790143379078193095 The following commit has been merged into the x86/boot branch of tip: Commit-ID: ac456ca0af4fe9630cf84e7efd20b7f7bf596aab Gitweb: https://git.kernel.org/tip/ac456ca0af4fe9630cf84e7efd20b7f7bf596aab Author: NOMURA JUNICHI(野村 淳一) AuthorDate: Fri, 02 Feb 2024 03:51:58 Committer: Borislav Petkov (AMD) CommitterDate: Tue, 06 Feb 2024 10:51:11 +01:00 x86/boot: Add a message about ignored early NMIs Commit 78a509fba9c9 ("x86/boot: Ignore NMIs during very early boot") added an empty handler in early boot stage to avoid boot failure due to spurious NMIs. Add a diagnostic message to show that early NMIs have occurred. [ bp: Touchups. ] [ Committer note: tested by stopping the guest really early and injecting NMIs through qemu's monitor. Result: early console in setup code Spurious early NMIs ignored: 13 ... ] Suggested-by: Borislav Petkov Suggested-by: H. Peter Anvin Signed-off-by: Jun'ichi Nomura Signed-off-by: Borislav Petkov (AMD) Acked-by: Kirill A. Shutemov Link: https://lore.kernel.org/lkml/20231130103339.GCZWhlA196uRklTMNF@fat_crate.local --- arch/x86/boot/compressed/ident_map_64.c | 2 +- arch/x86/boot/compressed/misc.c | 7 +++++++ arch/x86/boot/compressed/misc.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c index d040080..4a029ba 100644 --- a/arch/x86/boot/compressed/ident_map_64.c +++ b/arch/x86/boot/compressed/ident_map_64.c @@ -389,5 +389,5 @@ void do_boot_page_fault(struct pt_regs *regs, unsigned long error_code) void do_boot_nmi_trap(struct pt_regs *regs, unsigned long error_code) { - /* Empty handler to ignore NMI during early boot */ + spurious_nmi_count++; } diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index bf2aac4..bd6857a 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -52,6 +52,7 @@ struct port_io_ops pio_ops; memptr free_mem_ptr; memptr free_mem_end_ptr; +int spurious_nmi_count; static char *vidmem; static int vidport; @@ -506,6 +507,12 @@ asmlinkage __visible void *extract_kernel(void *rmode, unsigned char *output) /* Disable exception handling before booting the kernel */ cleanup_exception_handling(); + if (spurious_nmi_count) { + error_putstr("Spurious early NMIs ignored: "); + error_putdec(spurious_nmi_count); + error_putstr("\n"); + } + return output + entry_offset; } diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h index 6502bc6..b353a7b 100644 --- a/arch/x86/boot/compressed/misc.h +++ b/arch/x86/boot/compressed/misc.h @@ -59,6 +59,7 @@ extern char _head[], _end[]; /* misc.c */ extern memptr free_mem_ptr; extern memptr free_mem_end_ptr; +extern int spurious_nmi_count; void *malloc(int size); void free(void *where); void __putstr(const char *s);