From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.15051.1682673023625005673 for ; Fri, 28 Apr 2023 02:10:23 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UUwSW3bu; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682673022; h=from:from: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; bh=oV6SNDtsoYUwAMPvadE9nlPAkEfQVz8hQyWVT2kQUxc=; b=UUwSW3buVlt4z501j/xfn60vOMSQl9WNTM87kXD6D8oOs7+MfNrUF8R4PhW4WzlhjOQZ55 FZZjqBPgXwbazQ8lKRzta8N/f60r4xzfY5GuewpTOn7mSsG0rXY9RdTvARY40nZke+u1g/ Em7OU/gzOYTV+UYOx9SmC4s6Nz7pd8c= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-588-7XHoIczYNeWr2XxgUkmyeA-1; Fri, 28 Apr 2023 05:10:21 -0400 X-MC-Unique: 7XHoIczYNeWr2XxgUkmyeA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3E70C1C05AB0; Fri, 28 Apr 2023 09:10:21 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.195.158]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB91E1121314; Fri, 28 Apr 2023 09:10:20 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 9B53C1800935; Fri, 28 Apr 2023 11:10:19 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Oliver Steffen , Jiewen Yao , Ard Biesheuvel , Pawel Polawski , Gerd Hoffmann , Jordan Justen , Michael Brown , Laszlo Ersek Subject: [PATCH 1/1] OvmfPkg/NestedInterruptTplLib: replace ASSERT() with a warning logged. Date: Fri, 28 Apr 2023 11:10:19 +0200 Message-Id: <20230428091019.1506923-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true OVMF can't guarantee that the ASSERT() doesn't happen. Misbehaving EFI applications can trigger this. So log a warning instead and try to continue. Reproducer: Fetch windows 11 22H2 iso image, boot it in qemu with OVMF. Traced to BootServices->Stall() being called with IPL=TPL_HIGH_LEVEL and Interrupts /enabled/ while windows is booting. Cc: Michael Brown Cc: Laszlo Ersek Signed-off-by: Gerd Hoffmann --- OvmfPkg/Library/NestedInterruptTplLib/Tpl.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c index e19d98878eb7..cd65a5c995a0 100644 --- a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c +++ b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c @@ -39,7 +39,15 @@ NestedInterruptRaiseTPL ( // ASSERT (GetInterruptState () == FALSE); InterruptedTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL); - ASSERT (InterruptedTPL < TPL_HIGH_LEVEL); + if (InterruptedTPL >= TPL_HIGH_LEVEL) { + DEBUG (( + DEBUG_WARN, + "%a: Called at IPL %d, trying to fixup and continue...\n", + __func__, + InterruptedTPL + )); + InterruptedTPL = TPL_HIGH_LEVEL - 1; + } return InterruptedTPL; } -- 2.40.0