> On 25/01/2024 07:57, Ni, Ray wrote: > > This mail is to bring another approach to solve the stack-overflow due > > to nested interrupts. Michael solved this problem in OVMF through > > NestedInterruptTplLib. > > > > I made a draft patch as attached “DxeCore.diff”. The patch simply to > > avoid the interrupt in enable state when TPL is dropped to the > > interrupted TPL. The interrupt will be enabled later through “IRET”. > > I don't disagree with the approach, but it does break the API as per the > UEFI PI specification (version 1.8 section II-12.10), and so this is not > something that can just be dropped in as an EDK2 code change.
You think that the TimerInterruptHandler() doesn't raise/restore TPL which would violate the PI spec as PI spec says " NotifyFunction ... executes at EFI_TPL_HIGH_LEVEL."? I do not think the PI spec requires TimerInterruptHandler() raises TPL to HIGH before invoking NotifyFunction. It just means the NotifyFunction will execute at TPL_HIGH. If you review HpetTimer driver, it does not raise TPL to HIGH before invoking NotifyFunction. And I think implementing the DxeCore changes as attached does not prevent the TimerInterruptHandler() from calling raise/restore TPL. So, with the changes done in DxeCore, a timer driver could either not raise/restore TPL in TimerInterruptHandler(), or it calls NestedInterruptTplLib if it wants. I like the idea behind NestedInterruptTplLib. The only concern is the maintenance effort. I want to avoid the difficulty of debuggability brought by NestedInterruptTplLib when some timer interrupt related issues happen in future. I am ok with OvmfPkg code using NestedInterruptTplLib. Thanks, Ray -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114405): https://edk2.groups.io/g/devel/message/114405 Mute This Topic: https://groups.io/mt/103950154/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/9847357/21656/1706620634/xyzzy [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-