public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: Michael Brown <mcb30@ipxe.org>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	Laszlo Ersek <lersek@redhat.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>,
	"Zimmer, Vincent" <vincent.zimmer@intel.com>
Cc: "Ni, Ray" <ray.ni@intel.com>
Subject: Re: [edk2-devel] RFC: Another solution to the nested interrupt issue
Date: Thu, 25 Jan 2024 15:06:44 +0000	[thread overview]
Message-ID: <MN6PR11MB8244B18678939777C8AA097D8C7A2@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <0102018d41031cb5-c2701b16-0698-4004-9217-2204050254f7-000000@eu-west-1.amazonses.com>

> That would then be a bug in HpetTimer, which ought to be fixed.  If
> HpetTimer were to be used on a platform where the NotifyFunction
> correctly assumes that it is called at TPL_HIGH_LEVEL and does something
> that would break at a lower level, then this could lead to undefined
> behaviour.

In theory, it could happen that the NotifyFunction may not raise TPL
to HIGH.
In real world, NotifyFunction (CoreTimerTick() in DxeCore) does raise
TPL to HIGH.
I agree binding the NotifyFunction to CoreTimerTick() is not the best.
But it could help to reduce the complexity of the problem.


> As a pure code change, I do agree that it solves the problem and it's a
> much simpler approach.  However, it is a breaking change to the
> specification and I think it would need be handled as such.
> 
> The minimal specification change I can think of that would make this
> possible would be to relax the wording on NotifyFunction in the next
> version of the PI specification to say that
> 
> * the NotifyFunction can be called at any TPL level
> 
> * the NotifyFunction will raise TPL to TPL_HIGH_LEVEL, restore TPL back
> to the original TPL before returning
> 
> * the NotifyFunction may re-enable interrupts during its execution, and
> that the caller must be prepared to be re-entered before NotifyFunction
> returns
> 
> * the timer interrupt must have been rearmed before calling NotifyFunction
> 
> * the NotifyFunction must guarantee that it never reaches a state in
> which the TPL has been restored to the original level with CPU
> interrupts enabled.

I agree with you about the above PI spec clarifications.
Would you like to write a PI spec ECR?

But I do not think the PI spec version stored in the PI system table needs to
reflect whether a DxeCore implementation follows the clarification.

Since the DxeCore::CoreTimerTick() implementation raises TPL to HIGH in the very first version created
in more than 10 years ago, I think it's safe for TimerInterruptHandler() assumes CoreTimerTick() will
raise TPL to HIGH so that TimerInterruptHandler() does not need to raise TPL to HIGH.
(I agree changing the spec version is the most correct way if we review the problem in a very theorical way.)

I really want to keep the UEFI world simple with the bug fixed.
(The cost is assumption on existing DxeCore::CoreTimerTick().)




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



  reply	other threads:[~2024-01-25 15:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25  7:57 [edk2-devel] RFC: Another solution to the nested interrupt issue Ni, Ray
2024-01-25 13:03 ` Michael Brown
2024-01-25 13:54   ` Ni, Ray
2024-01-25 14:25     ` Michael Brown
2024-01-25 15:06       ` Ni, Ray [this message]
2024-01-25 15:29         ` 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=MN6PR11MB8244B18678939777C8AA097D8C7A2@MN6PR11MB8244.namprd11.prod.outlook.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