From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from a7-10.smtp-out.eu-west-1.amazonses.com (a7-10.smtp-out.eu-west-1.amazonses.com [54.240.7.10])
 by mx.groups.io with SMTP id smtpd.web11.28221.1683295841134470691
 for <devel@edk2.groups.io>;
 Fri, 05 May 2023 07:10:41 -0700
Authentication-Results: mx.groups.io;
 dkim=pass header.i=@ipxe.org header.s=cphpx6z2rfcgehlykjjh3gknqe3hsoe2 header.b=VMB/Cnhj;
 spf=pass (domain: eu-west-1.amazonses.com, ip: 54.240.7.10, mailfrom: 01020187ec402266-6d4dee99-5a0d-4105-abaf-419c2a5607cc-000000@eu-west-1.amazonses.com)
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;
	s=cphpx6z2rfcgehlykjjh3gknqe3hsoe2; d=ipxe.org; t=1683295839;
	h=Message-ID:Date:MIME-Version:To:Cc:References:From:Subject:In-Reply-To:Content-Type:Content-Transfer-Encoding;
	bh=gsimLkzU6iOSzFHRv5nzO9Madhx2NxE0FqjHC9vTttY=;
	b=VMB/Cnhjb4CR1rjkPu0JOvL3SgVEQTUMwRotvWAbhEbFqH3dlmRZ/T9WCl6G2dUF
	IrlDS74MsRoL91X3OCMZ8O8XwG/TMIR9ouVrU+2pHqkiJ4hQQcEazyRoyK7zL4XZJqM
	6oSNsZz/EcliVxzFqQtlZYJ2gmiLIOrnI0gPud5poFLWWrXqdWrdb9jbFvK3//e6yYr
	8wW0Ur1lxwRgc2at7MZGF2SEO7SA0PnuY0vJ3oP98yVXXGmTlcxklQz0y4peFYevyLZ
	VpJsPfJt02t5HC2tW+Wo0NHkzYXUG746BNXYUvqLxPYml+Xu6+BB9Dbg+zmRKeN5EAH
	3T7cbNvaeg==
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple;
	s=shh3fegwg5fppqsuzphvschd53n6ihuv; d=amazonses.com; t=1683295839;
	h=Message-ID:Date:MIME-Version:To:Cc:References:From:Subject:In-Reply-To:Content-Type:Content-Transfer-Encoding:Feedback-ID;
	bh=gsimLkzU6iOSzFHRv5nzO9Madhx2NxE0FqjHC9vTttY=;
	b=f4pWS6+QWW01sii68SsendZEUj/yjFzdiuH+CZliOa4o1sPS34wu9ig81flW6wCY
	7HhhP1WuSHPSwzuww7gajCGcVd/QNV9hNFHWhpRxyP0bebgFyVHO6BsnlEYrF3b2V4U
	w35MdguyZePI11nyhS01paUn0cQYg1vdFsmHmcsQ=
Message-ID: <01020187ec402266-6d4dee99-5a0d-4105-abaf-419c2a5607cc-000000@eu-west-1.amazonses.com>
Date: Fri, 5 May 2023 14:10:38 +0000
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.6.0
To: devel@edk2.groups.io, kraxel@redhat.com
Cc: Oliver Steffen <osteffen@redhat.com>, Pawel Polawski
 <ppolawsk@redhat.com>, Jiewen Yao <jiewen.yao@intel.com>,
 Ard Biesheuvel <ardb+tianocore@kernel.org>,
 Jordan Justen <jordan.l.justen@intel.com>, Laszlo Ersek <lersek@redhat.com>
References: <20230503071954.266637-1-kraxel@redhat.com>
From: "Michael Brown" <mcb30@ipxe.org>
Subject: Re: [edk2-devel] [PATCH v2 1/1] OvmfPkg/NestedInterruptTplLib: replace ASSERT() with a warning logged.
In-Reply-To: <20230503071954.266637-1-kraxel@redhat.com>
X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00,
	URIBL_DBL_BLOCKED_OPENDNS,URIBL_ZEN_BLOCKED_OPENDNS autolearn=ham
	autolearn_force=no version=3.4.2
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on
	blyat.fensystems.co.uk
Feedback-ID: 1.eu-west-1.fspj4M/5bzJ9NLRzJP0PaxRwxrpZqiDQJ1IF94CF2TA=:AmazonSES
X-SES-Outgoing: 2023.05.05-54.240.7.10
Content-Language: en-US
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 03/05/2023 08:19, Gerd Hoffmann wrote:
> 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 <mcb30@ipxe.org>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>   OvmfPkg/Library/NestedInterruptTplLib/Tpl.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
> index e19d98878eb7..fdd7d15c4ba8 100644
> --- a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
> +++ b/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c
> @@ -39,7 +39,9 @@ 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\n", __func__, InterruptedTPL));
> +  }
>   
>     return InterruptedTPL;
>   }

While https://bugzilla.redhat.com/show_bug.cgi?id=2189136 continues to 
track the underlying Windows bug that leads to this assertion being 
triggered: I suspect that this patch will allow people to boot these 
buggy versions of Windows in OVMF, and I don't think it will make things 
any worse.

I would probably suggest changing DEBUG_WARN to DEBUG_ERROR since this 
represents a serious invariant violation being detected.  With that change:

   Reviewed-by: Michael Brown <mcb30@ipxe.org>

Thanks,

Michael