From patchwork Thu Jan 11 12:18:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Tk9NVVJBIEpVTklDSEko6YeO5p2RIOa3s+S4gCk=?= X-Patchwork-Id: 187360 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp1407498dyi; Thu, 11 Jan 2024 04:23:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IFQcR2ui4kqmg5WD/n00Q8CmyBvJ5+0nXj2fegrPvuyOL4QvWhjj7YbWVq+lZcOEg5fMMTV X-Received: by 2002:a05:6358:63a3:b0:172:db95:fcc8 with SMTP id k35-20020a05635863a300b00172db95fcc8mr759757rwh.3.1704975801231; Thu, 11 Jan 2024 04:23:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704975801; cv=pass; d=google.com; s=arc-20160816; b=qPY7CHnSNFgRETobYG6UujXieN8/Q3twOGOtV2fPxZi8ZrEiq3xqGWoZWrueijeB5Q XxpZ8/uThlwNnM8VMlGpHCg8gE6tS8n7XWKPVKYNkUaACA+1hQejLpqYWcrNonVkNo13 2qOAE1SAcMQwcgzSJMwQKfxc1uhTrouSM0pKGhu7ztPmwlDy98W6QVDduvP0Q4yechiy CmQo0vacgHzquzs7gmekVm6v73ThDN2OL2egusJD+j0gq7FrVkCrtUp8UKxI5yUO9qvr XwoT0ZgPzDSeQzq0LMBGUqHmBT82m363VwCQRsOMGidPOoeHBuC+exZpN+0wqMVEkLft fQcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:content-id:content-language :accept-language:message-id:date:thread-index:thread-topic:subject :cc:to:from:dkim-signature; bh=9nq9vTua3hhQFtgQumwCXiMvJOdCI/YjeX8+jXDvj7s=; fh=5bFdixol1p/VM4MVpN+e1oXg6itVtNh7eYa3Iv9brxE=; b=VgStErYqLO0iFCGJlIew2tUWgMFmvvvQlUiIPwpdeg+l5T1lxGj0gqzev7xZSgj6cQ af/0WfXuLWeg7OySto/2GEbpOMd7z3DP4qRbFY6SpPZPlQDnGtz4oC5fFv7kt6mbjf8X DBbD5L9aToUQg4X/EUTeKtFfoX+5Gqh2E70cwFKORMl3ZTMOCJnms0jkPeZ73wH8wcUD D08ictTOMGwoZhIZXF075DmJPIChEgjNOJ35o//C395h0RR/Pk8BKtEjU8vfA8oaOmaJ J10SVGHgegF15hi7Qw2IwsDQpGXLgoqpUaD3zJ5Fvw7KtNfhxe3pXKRZlybT24JsGOBc g23g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nec.com header.s=selector2 header.b=qqrCY5Ba; arc=pass (i=1 spf=pass spfdomain=nec.com dkim=pass dkdomain=nec.com dmarc=pass fromdomain=nec.com); spf=pass (google.com: domain of linux-kernel+bounces-23573-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23573-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=nec.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id c6-20020a63d146000000b005bd3d377a54si1033471pgj.123.2024.01.11.04.23.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 04:23:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23573-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@nec.com header.s=selector2 header.b=qqrCY5Ba; arc=pass (i=1 spf=pass spfdomain=nec.com dkim=pass dkdomain=nec.com dmarc=pass fromdomain=nec.com); spf=pass (google.com: domain of linux-kernel+bounces-23573-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23573-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=nec.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3FAB4B235C2 for ; Thu, 11 Jan 2024 12:19:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6DF0215AF9; Thu, 11 Jan 2024 12:19:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nec.com header.i=@nec.com header.b="qqrCY5Ba" Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2058.outbound.protection.outlook.com [40.107.114.58]) (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 6468F156EF for ; Thu, 11 Jan 2024 12:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nec.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nec.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ILcCZI/hNd8V//WXiOUK6pbZ0JeaQDVInjjh9aWVfoo4L3FGaiFSlK/2NlwfO+7RhN6UB97GuB17GVmU/nazfQ7AfPZov+Qf6gBZppNTP9MMCES8X1OKGqFIYDITbNOgnnK/yq3q6puqsN3NT3NPJ1YjDcZeqhvCwF5IbXGfwVS853G4tt5tyPxIPa7DFKOEZGXR25rKr/rFALul9ZlPHpwkyyGDpMouyLhUfO+Q6BEy9mqqoFHP2dOFRHRWpMGmv4svWpQLMdCPGCLkIFf9XZ7sNg6L3ASEh1z/oDz84Bw/MYx0OiQbDR49q9FZxY/hHeikXlWMGF3CT3A7tWITxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9nq9vTua3hhQFtgQumwCXiMvJOdCI/YjeX8+jXDvj7s=; b=bePyu0r3EWBgQ7IpZz4i324pMsyJFdyosdoF6e0ZY4xXet6+hCYvdNOYcKeSIrrKwKWuE0Vliv34OsqBv5EnQyihS8o5ZkTRoQ9gWLWizQ05EhTyQJGWbsYCC9pCxFT4TxyIMiyJTiyWxmBYZLrX4GY6ng1lg2uJJ/MUZPR2dl+craGAHewZok0x2FnS8GNNwxeG0PadVgaKiCaYrvxWXQHn6I1mFKsHMfiD+b3fw92x2jRAw7cX6H7763DiZB/vGYBsJtVZtldNbsTlQKWc+YtsSbAVXwP/DBpF2v0nXEFlJO8uPA+1ZzIXRqYHvutRaFLtWkGDszAAXbwDS7e9fA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nec.com; dmarc=pass action=none header.from=nec.com; dkim=pass header.d=nec.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nec.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=9nq9vTua3hhQFtgQumwCXiMvJOdCI/YjeX8+jXDvj7s=; b=qqrCY5BabyyPjeAfWgJVAc405XOuaS4BoPiQ2AHEVUzgQLgkhfQWrExOxLTsZLa+9wxR1fsPV3GE/e1O43QeQvgZw2OWfRKWjhW/uNcX/KaXZDpHYkV2T0J0Qhj7nYxeTTA9hDD77nBVvTiHQ1SziumV7OqFvhZnUwQpCPhBMVQOHhCgv40sBN+VI64H5/1ICbqMNvKGN5ROCHVK36EZqxKwqazJ31FBcru62CSPJQ7ZdWGE/7X1Razfdy5NDKjGHgS4PJXoGj6nsRR6+h55JiShbRIhFMzsHXZC8Y0utHljQrwzw4rTS90T/VgwiN4qjeMH6q39GXHYfjDMS1+05w== Received: from TYCPR01MB8389.jpnprd01.prod.outlook.com (2603:1096:400:15f::5) by TY3PR01MB10468.jpnprd01.prod.outlook.com (2603:1096:400:310::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.13; Thu, 11 Jan 2024 12:18:58 +0000 Received: from TYCPR01MB8389.jpnprd01.prod.outlook.com ([fe80::97b4:ef67:3174:a230]) by TYCPR01MB8389.jpnprd01.prod.outlook.com ([fe80::97b4:ef67:3174:a230%3]) with mapi id 15.20.7181.015; Thu, 11 Jan 2024 12:18:58 +0000 From: =?utf-8?b?Tk9NVVJBIEpVTklDSEko6YeO5p2R44CA5rez5LiAKQ==?= To: "mingo@redhat.com" , "tglx@linutronix.de" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" CC: =?utf-8?b?Tk9NVVJBIEpVTklDSEko6YeO5p2R44CA5rez5LiAKQ==?= , "hpa@zytor.com" , "kirill.shutemov@linux.intel.com" , "ardb@kernel.org" , "david@redhat.com" , "nikunj@amd.com" , "thomas.lendacky@amd.com" , "debarbos@redhat.com" , "jlelli@redhat.com" , "lgoncalv@redhat.com" , "dzickus@redhat.com" , "linux-kernel@vger.kernel.org" Subject: [PATCH] x86/boot: Add a message about ignored early NMIs Thread-Topic: [PATCH] x86/boot: Add a message about ignored early NMIs Thread-Index: AQHaRIhafVlQIpM4zE+vUjXyVtJi6Q== Date: Thu, 11 Jan 2024 12:18:58 +0000 Message-ID: Accept-Language: ja-JP, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nec.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: TYCPR01MB8389:EE_|TY3PR01MB10468:EE_ x-ms-office365-filtering-correlation-id: 85e96c35-9c59-476f-aee0-08dc129f7d0b x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: oS9QSHeCkEx15HW+/CMaxLPt9YL5Nw8Z3uA4wsW3atHh6jLVTA67taSOLV2Zp0TAMo2CDyiD4iYLN8KSPVsZARYqJfiV94l0+Ax7uF5FB0jKle94s5vz5X+3kVRveX06RkyWQl/iXX/ba74W19mKJoLgXeM1CC9IJz6H3X+QzK+mxbP5V7ZnnlcW164MgCLrKL1VbRWqs/o2zPRBd7c5hZDtd1gioBVOy3Ab+rXZdZv0Ifh9y4x9aDXJQF89GPw3EXAcqim0rx5ySwRGBhlOHc8jH24mArnrgVlP7ijqCQBAtWcjyuWNDcBBlH8juGYHkNLtqQ44pw6fU0vq8Z40YORkyiA7THWJUBra6gVprM4o+LruR5+6v/8qs+VimOkysP2oz/JMuk3JK+X7s9gIPuPNiq6cYM263jg04g5dgE0HbKJ52c/4f0xL3gxCmMGlWxBoBZgrKRv1T5HCBQ/yHZu549BBFU4wDC3txQdwKe0RGvPNiKg9KceeC3esNJZXqBq6DBbSDNE6ZC0+fYpyfLRy8afqQJnpYocHIJweMkh7D9j6FGogsayiMuPNZCg2vM6CHVwZ8QgeYB1GQXPk3x0OYojZGsgkW4VYZC/3svS9ReyeEMyfj/PDk55/FL0Pm/Q0hGNwhEMij8hp2Vv8qA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB8389.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(396003)(136003)(346002)(39860400002)(366004)(230922051799003)(1800799012)(64100799003)(186009)(451199024)(5660300002)(4326008)(8676002)(8936002)(7416002)(2906002)(31686004)(76116006)(66946007)(54906003)(66556008)(64756008)(66476007)(66446008)(15650500001)(110136005)(316002)(6512007)(6506007)(966005)(6486002)(478600001)(41300700001)(71200400001)(85182001)(36756003)(26005)(2616005)(38100700002)(31696002)(83380400001)(86362001)(38070700009)(82960400001)(122000001)(45980500001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?utf-8?q?BS03WNrbI56VapFSZ0/1RxKIed3B?= =?utf-8?q?+VLuQl9JIsFmN9zX0p06ae09ByDBr4XL5/BsI6gPmGa4IyKMVsJsg5rFKOJSJWl71?= =?utf-8?q?lhNaOCAyjiYD1jEdRCmcoeJiY/oD7V0V1ivN0AAoSIlRGwkcSwv+J8IbJxXtG1gOy?= =?utf-8?q?J8O4SSMu6gwLuGpcSkLpjTQVbZEJ9V4o50MnepW0Bh4NTZpmr9rZ6IrCzFJ8qCgwm?= =?utf-8?q?v1Cka6VOr8onKSE2YkOZ2Z6ngjZs/WujQG59byUMBnW2zAwloqUdXHSoXwsqi/6TT?= =?utf-8?q?5lYMSvC+PC3QAehbEEaNeClGZkQCqUd3THSeTp/BGk3rkJMZ6678QmI4lNm4bW3By?= =?utf-8?q?Bs09lrEUm0KxptrmGdxBeAWAJTqMwJyb4o8AgZ9dBip1uVuGiFj4Wcfa54nFchvVi?= =?utf-8?q?gQ9raTwWWRdb4jDgzj7uHqUzClNKqZmHcfZaQTU675uHSXPhSR5RKEowJqzFTeWa9?= =?utf-8?q?jqHfUr6vmgI4caarti3la/FKiyb9Stc9luZ8X21oZI/zzpZG8JFgZeztl7i1d0TRT?= =?utf-8?q?fdrgsv9wtKxkSWwzgMZMwuwu+xULUpQrkcXHlvGum/5QeMNnRP9/9PNtSPnl1buf7?= =?utf-8?q?B6JkgXdGkfF+9XCl5GBoMW6dQPXnQ07paPJ70YZRk97o9xwjeHnvqNEyACgJN7WxE?= =?utf-8?q?fQWSmh5podQALQ88G1lIP23q8FL3J0/+U9oryU+isVz1tGsLANL4gcZR1HGetgG4N?= =?ut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.outlook.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-OriginatorOrg: nec.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB8389.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 85e96c35-9c59-476f-aee0-08dc129f7d0b X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Jan 2024 12:18:58.6726 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: e67df547-9d0d-4f4d-9161-51c6ed1f7d11 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: CxBId7p/tAK1MigZBWev/QNNSP6Lxg8xdAuuxPGPQqngCxkH+i/d29w3VVMNc/96jHw6p2w5GBNrN6rcF4Yyew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY3PR01MB10468 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787796705373705223 X-GMAIL-MSGID: 1787796705373705223 Commit 78a509fba9c9 ("x86/boot: Ignore NMIs during very early boot") added empty handler in early boot stage to avoid boot failure by spurious NMIs. Add a diagnostic message in case we need to know whether early NMIs have occurred and/or what happened to them. Signed-off-by: Jun'ichi Nomura Suggested-by: Borislav Petkov Suggested-by: H. Peter Anvin Link: https://lore.kernel.org/lkml/20231130103339.GCZWhlA196uRklTMNF@fat_crate.local/ diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compressed/ident_map_64.c --- a/arch/x86/boot/compressed/ident_map_64.c +++ b/arch/x86/boot/compressed/ident_map_64.c @@ -387,7 +387,10 @@ void do_boot_page_fault(struct pt_regs *regs, unsigned long error_code) kernel_add_identity_map(address, end); } +extern int spurious_nmi_count; + 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 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -357,6 +357,8 @@ unsigned long decompress_kernel(unsigned char *outbuf, unsigned long virt_addr, return entry; } +int spurious_nmi_count; + /* * The compressed kernel image (ZO), has been moved so that its position * is against the end of the buffer used to hold the uncompressed kernel @@ -493,6 +495,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 NMI ignored. Number of NMIs: 0x"); + error_puthex(spurious_nmi_count); + error_putstr("\n"); + } + return output + entry_offset; }