public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael Brown" <mcb30@ipxe.org>
To: devel@edk2.groups.io, lersek@redhat.com
Cc: Ray Ni <ray.ni@intel.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [edk2-devel] [PATCH v3 4/5] MdeModulePkg: Add self-tests for NestedInterruptTplLib
Date: Tue, 23 Jan 2024 17:41:56 +0000	[thread overview]
Message-ID: <0102018d376a18e4-553f2c8e-20e7-4a27-a34e-4a00ac8cfd19-000000@eu-west-1.amazonses.com> (raw)
In-Reply-To: <eed3031c-485b-3d17-7442-0ad640868da2@redhat.com>

On 23/01/2024 16:55, Laszlo Ersek wrote:
>> +  ///
>> +  /// Number of self-tests performed.
>> +  ///
>> +  UINTN      SelfTestCount;
>>   } NESTED_INTERRUPT_STATE;
>>   
>>   /**
> 
> I suggest that the new field be UINT32. The (exclusive) limit is a
> 32-bit PCD. Making the counter (potentially) wider than the limit is not
> useful, but it's also a bit of a complication for the debug messages
> (see below).

Great suggestion, thanks!

>> +    ///
>> +    /// Perform a limited number of self-tests on the first few
>> +    /// invocations.
>> +    ///
>> +    if ((IsrState->DeferredRestoreTPL == FALSE) &&
> 
> This comment applies to several locations in the patch:
> 
> BOOLEANs should not be checked using explicit "== TRUE" and "== FALSE"
> operators / comparisons; they should only be evaluated in their logical
> contexts:

We've had this conversation before :)

   https://edk2.groups.io/g/devel/message/104369

I personally find that the "!" operators get visually lost in the EDK2 
coding style with its very long variable and function names.  That said, 
I'm happy to omit all of the explicit comparisons, but I should then add 
a precursor patch that changes the existing code style first.  Thoughts?

>> +VOID
>> +NestedInterruptSelfTest (
>> +  IN NESTED_INTERRUPT_STATE  *IsrState
>> +  )
>> +{
>> +  UINTN SelfTestCount;
>> +  UINTN TimeOut;
> 
> Did this pass the uncrustify check? I think uncrustify would insist on
> inserting two spaces here.
> 
> For running uncrustify locally:

You are right, and thank you for reminding me how to run the EDK2 
version of uncrustify.  I've fixed up everything it identified.

>> +  // This error represents a bug in the platform-specific timer
>> +  // interrupt handler.
>> +  //
>> +  DEBUG ((
>> +    DEBUG_ERROR,
>> +    "Nested interrupt self-test %u/%u failed: no nested interrupt\n",
>> +    SelfTestCount,
>> +    NUMBER_OF_SELF_TESTS
>> +    ));
>> +  ASSERT (FALSE);
>> +}
> 
> I'd prefer something stronger than just ASSERT (FALSE) here, but -- per
> previous discussion -- we don't have a generally accepted "panic" API
> yet, and CpuDeadLoop() is not suitable for all platforms, so this should do.
> 
> With my trivial comments addressed:
> 
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> 
> Comment on the general idea: I much like that the self-test is active on
> every boot (without high costs).

Thank you!

> Side idea: technically we could merge the first two patches in
> separation (pending MdeModulePkg maintainer approval), and then consider
> the last three patches as new improvements (possibly needing longer
> review). This kind of splitting has both advantages and disadvantages;
> the advantage is that the code movement / upstreaming to MdeModulePkg is
> not blocked by (somewhat) unrelated discussion. The disadvantages are
> that more admin work is needed (more posting, and more PRs), and that
> patches in the series that one might consider to belong together will
> fly apart in the git history. So I just figured I'd raise the option.

I'm happy to work either way, and shall await instruction.

In the absence of any instruction to the contrary, I'll send out a v4 
tomorrow with everyone's suggestions and tags included, but without the 
above-mentioned precursor patch to remove the boolean comparisons.

Thanks,

Michael



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114227): https://edk2.groups.io/g/devel/message/114227
Mute This Topic: https://groups.io/mt/103911608/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-01-23 17:42 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <17ACFF3FDD20CD9A.13754@groups.io>
2024-01-23 15:31 ` [edk2-devel] [PATCH v3 0/5] MdeModulePkg: Move NestedInterruptTplLib to MdeModulePkg Michael Brown
2024-01-25 12:17   ` Ni, Ray
     [not found] ` <20240123153104.2451759-1-mcb30@ipxe.org>
2024-01-23 15:31   ` [edk2-devel] [PATCH v3 1/5] " Michael Brown
2024-01-23 15:31   ` [edk2-devel] [PATCH v3 2/5] MdeModulePkg: Add missing Iret.h to NestedInterruptTplLib sources list Michael Brown
2024-01-23 15:31   ` [edk2-devel] [PATCH v3 3/5] MdeModulePkg: Do nothing on NestedInterruptRestoreTPL(TPL_HIGH_LEVEL) Michael Brown
2024-01-23 16:32     ` Laszlo Ersek
2024-01-23 16:59       ` Michael Brown
2024-01-24 12:52         ` Laszlo Ersek
2024-01-23 15:31   ` [edk2-devel] [PATCH v3 4/5] MdeModulePkg: Add self-tests for NestedInterruptTplLib Michael Brown
2024-01-23 16:55     ` Laszlo Ersek
2024-01-23 17:41       ` Michael Brown [this message]
2024-01-24 12:58         ` Laszlo Ersek
2024-01-24 10:24     ` Ni, Ray
2024-01-24 10:26       ` Ni, Ray
2024-01-23 15:31   ` [edk2-devel] [PATCH v3 5/5] MdeModulePkg: Extend NestedInterruptTplLib to support Arm CPUs Michael Brown
2024-01-23 15:51     ` Ard Biesheuvel
2024-01-23 16:48       ` Michael Brown
2024-01-23 17:10     ` Laszlo Ersek
2024-01-23 17:21       ` Michael Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0102018d376a18e4-553f2c8e-20e7-4a27-a34e-4a00ac8cfd19-000000@eu-west-1.amazonses.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox