Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2221475rdd; Fri, 12 Jan 2024 03:14:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzLLCeYQvGm1kzHzCNvx5OF2fkB8AER5xcKtm0sGMU8qsBBwXJDeefhdIdRNPd/S0N8Rwl X-Received: by 2002:a05:6402:17d4:b0:557:1268:39fb with SMTP id s20-20020a05640217d400b00557126839fbmr586613edy.4.1705058048058; Fri, 12 Jan 2024 03:14:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705058048; cv=pass; d=google.com; s=arc-20160816; b=uCnJWZS4qzfRPBbU2JN3pdj2EgZIHQJfiS7NW++rmiMcsD4jOT0gnEYoZtgqKmhYqt 8BuVuIl/VkBoqT0ycCSaWU4Q7N99ToRmmHw11XqxCGJ0IJCSw79svOxhKP+obb2GS/4R 7e5w/2TFaJWWkGUR+TqXLhB+b4UtF93YsayUvBo3haxxgK22riXGVHr0WJN1dSDroi1W B2h8dGMXlEXV4hhLC4HJKIgfCSHgI4TPBZLnXn0RElPJh9qC6jfyswmJyhfbo1lMq1jR y+0kHsGE0/W/9/Tgqqgg+va344bSs8Shxc5W8Ra4gqdpPyjfE4uVUOd78i3Fzti2GV/w q2sQ== 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=se8IQa1LA7gMOrBE/V4zvoFHnQeE8/XXodFUi5fsZ8U=; fh=FdiOYi7qnXt73TMeghAfqA175SiW0DV/wLsr01DakM0=; b=Jwvc3LbyGnkE+BlyKhEoepUaBkb4osMQothYKb3QY90zXhQ3shQTulh6vsX0q6r4n9 8vP4hY/iobbAtQ2YWDgu02GEje28b9qLgsQxhn862+r9bO1gvr1Kgu2vI0YrzQRzfsZT pXsS8QHZpeMkcPAR7+EzFhm1vMxVy4sCQRVtQg/Ih5xRxJOl35BgNmcTYfY7nTAkc2qP gQGvVWofi1J8XhO0nFsEy//hloY0dfpiQk9LQEdzvmzSY2m/DoTYlMycpKCAg1ZCGYQf cC5X1K/qTfKv5S9HvBi+4WIVsqwZdql14mm9b33ILIYs9lzCLsjMxqt95JZ4ZIxL/QbA QgLA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nec.com header.s=selector2 header.b=oUqnDDJC; 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-24606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=nec.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id b9-20020aa7df89000000b005540261f0ccsi1322862edy.691.2024.01.12.03.14.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jan 2024 03:14:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@nec.com header.s=selector2 header.b=oUqnDDJC; 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-24606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24606-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id A26811F24429 for ; Fri, 12 Jan 2024 11:14:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2581967E6D; Fri, 12 Jan 2024 11:14:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nec.com header.i=@nec.com header.b="oUqnDDJC" Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2069.outbound.protection.outlook.com [40.107.114.69]) (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 548FD67E60 for ; Fri, 12 Jan 2024 11:13:55 +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=cN8uNpBQUGV2l6ZNo5v0rF5nZ4CGGtp2S46Zh0Ff4meybIs5OtCIgulaMDvy80CMenqF2a6ZVYiOiRz4vR12euBOY+pMUJgJZzkoFE+pD6jTGrQlCKlkzWhKpwTKNPFHjIcR5Hpi4noBy0fhMqvminye5OVMdmCvxcEyADKeVuGW2mxviWj8j0aDti7ezWhuNa3Btp4+klm1HJ1Fmjl9B6OJ8xxcv9cetcfbd10E3x+d8klgVzffQfaDhsSjbv36JqBCblWhzsEsXvRSlmfW1JRd85+2+kTOrHebXc7wNg6PGTiOYNXDpEnQ7Ksf9ZL2Epax3sn50qrpZKLvENObqw== 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=se8IQa1LA7gMOrBE/V4zvoFHnQeE8/XXodFUi5fsZ8U=; b=g4wdDosZVv0XYi9OUjdwysTshCIxrUeaiV1abwcMJbM2PnN0MJqel8GFebetapNL/ey8nbC2hYuPGpIxha2LxcJbFgD/YXfmyzBwU/hjP6+SLVK+OxYlDEbkfkO8mL/dpmdWqq0gTH7Dk3r1ivgE9J42/7ljKIsYv1gK6rd8suSV0J6+PgwBhOKHttHvQ5eR0ydevka9166LMz9WVE1SCCDDucWgO1vG3WGh9kW7jTPo0aEdl97cZ2ipxSppMvf82NXiUNUpge07dnbYpo8dyxFnXrL5jbrr7zWi/bbyO0uQi+2V5L8HowL07Mhs76116dAa0uxpPzMWspacSOCmEw== 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=se8IQa1LA7gMOrBE/V4zvoFHnQeE8/XXodFUi5fsZ8U=; b=oUqnDDJC48uslqIb81gRdFP0DhHM3CgcmDAhsdAef0wPHPgCZ61BmWa6a0Q8RN6mEAmk2qRZXiS6yzD5s6hGYN4fIaVNwBLWuMuYNC22wi/O6JJCtxGK3Dy21Szs6vQ7ex7Zli688a9bc+W5XizDt/uEXgg3ni8P6WFzUQ7vCR87nNVCPQAGsqUq/xQiN22Lj/Sf5iiiYhcQXKrZqyz8RwSfxhpOVN8s8HTO0DZcHKz7CDyHIPlLEsn3DWKFGiWtQri6pfhO8d+feM7STRkvxWD0wR/Ip3YUmeMY/79mBZtYRU1jlDZZh0ZXIiocJqB1HylDIKcmT5PyOs4WcD0B8g== Received: from TYCPR01MB8389.jpnprd01.prod.outlook.com (2603:1096:400:15f::5) by TYWPR01MB8696.jpnprd01.prod.outlook.com (2603:1096:400:17c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.14; Fri, 12 Jan 2024 11:13:53 +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.7202.014; Fri, 12 Jan 2024 11:13:53 +0000 From: =?iso-2022-jp?B?Tk9NVVJBIEpVTklDSEkoGyRCTG5CPCEhPV8wbBsoQik=?= To: "mingo@redhat.com" , "tglx@linutronix.de" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" CC: "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 repost] x86/boot: Add a message about ignored early NMIs Thread-Topic: [PATCH repost] x86/boot: Add a message about ignored early NMIs Thread-Index: AQHaRUhttMsB94tJmUuDDAl0tLENcQ== Date: Fri, 12 Jan 2024 11:13:53 +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_|TYWPR01MB8696:EE_ x-ms-office365-filtering-correlation-id: 37fcad32-6847-4ff9-e3b4-08dc135f8fb4 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tD4L3sH++MxHY20X7SqKThf6F6k2K1b9r6ShjfuTwmSwPar5yRThQV8KqnQM9+VbT256v8RT23lSHscn/xYbWTaJdKnpCPcJu0Kg5pcW1lnRqxRTF1QFe3G+vOudOzHrugRPkDDu69oXhp8FqC8Dt9FE/s4N2mVxCeGHTyOZ7k1a1rEqLT2mV4Ikn8zN1VAjulOS8ZHJOwEaO28G37WfzGFSMvOcitJegJSuEJXmytnNdiiovJwh/vLyuuSR+Vtn23x6E7OSp8fqBRtRPjTeuLEeiTZlCDvgw8bC0GmP32tSEuTHFrrMBO6OZ2X3qt7jTJiWsPMsrjaAr1wK5gYj4rVr514MYt5Js/Q0foSwJ2AGn4kC2+KmEAqg35grO0BzyZHvdfK+8iYXMVhVe9Zzx9F3uxeSFo21f4BgppfPegBF0anGysjRQFK7w/qXpOJLfI1+g56SM15WvqmV1hRbrE13/V5tacl1XKfs4aAY/kOnUGHNQ+9PLU0vOgtDJRXBcV6+z1skI9xZbVkqB/xWfeQ8RGkwwlD+nfaSH8OtEThye2HB9eE33W9dUWQstWtuQov7wwtIwnx8HQnqNqRK+SN/8UuXpKJ0T38RGfawNt4m9cgCzq9PZ7zHOmTCnK/v 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)(39860400002)(136003)(346002)(396003)(376002)(366004)(230922051799003)(64100799003)(1800799012)(186009)(451199024)(966005)(6486002)(6512007)(6506007)(55236004)(71200400001)(26005)(85182001)(83380400001)(38070700009)(38100700002)(86362001)(122000001)(82960400001)(41300700001)(9686003)(478600001)(8936002)(15650500001)(8676002)(4326008)(5660300002)(66946007)(66476007)(66556008)(110136005)(76116006)(316002)(2906002)(66446008)(7416002)(54906003)(64756008)(67856001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-2022-jp?B?aTNQaFpxdW42U3JiZW9WSFBJbzVHU3dMWlhHKy9wNHlYeUttcUszR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ZnFuZi93aTRHYStUME9KK0NHRHIzTUJXQUlKUTFi?= =?iso-2022-jp?B?L3ByU28wc25NdUdnSk04RW9RY2VlN3ROeTVKVFpvaGZtTGk5dFIwS1g3?= =?iso-2022-jp?B?N2VrWHFONnZHZGpjYjZDYWV4eEhsMENSZGh1MDFXZFh4WmRTZmFQOEJo?= =?iso-2022-jp?B?ZHZ5eDlJT3hsUkJQSVVYVmhJajBFWTFQMkRlVGVsSlRFZ1doVTMvK3V6?= =?iso-2022-jp?B?ZTQ0TDYvR2RUY2UrOVB2b3lqMm9JSkRYZTlzQm1HSjJ0QWw3OHZzNmNk?= =?iso-2022-jp?B?ejNycGlBaFZOemN3VDJMc29QZ3JTM2pNRW9ET291bUhrYWdicG1IMndj?= =?iso-2022-jp?B?cXFvYUdTU29BWXh2VG90bzM0cVdyOWcyc2prQ0huMGNreG5nQkZqRXlq?= =?iso-2022-jp?B?U1pOOUs3N3BvekdMT25oVm9DdVRwV0JIaTlaTXJleGZrTmtyMExleGR1?= =?iso-2022-jp?B?dCtQSzc3ZlhrUEd5NUZrOU5qaHo5QmhGNFE9PQ==?= Content-Type: text/plain; charset="iso-2022-jp" Content-ID: Content-Transfer-Encoding: quoted-printable 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: 37fcad32-6847-4ff9-e3b4-08dc135f8fb4 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jan 2024 11:13:53.3153 (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: zSxWO8Z7c06z8ch4le93BZmGlKBCuWw+vv1qX+LxvGHcQji0jR7lwbnxyccVGRESxVNsQR7DQfkib5Rsz7zUCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWPR01MB8696 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_cr= ate.local/ diff --git a/arch/x86/boot/compressed/ident_map_64.c b/arch/x86/boot/compre= ssed/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); } =20 +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/mis= c.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; } =20 +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(); =20 + 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; } =