[edk2-devel] [RFC/RFT PATCH] OvmfPkg/IoMmuDxe: don't rely on TPLs for re-entrancy

Ard Biesheuvel ardb at kernel.org
Mon Jul 24 14:21:22 UTC 2023


On Sat, 22 Jul 2023 at 00:55, Pedro Falcato <pedro.falcato at gmail.com> wrote:
>
> On Thu, Jul 20, 2023 at 2:46 PM Ard Biesheuvel <ardb at kernel.org> wrote:
> >
> > Instead of relying on raising the TPL to protect the critical sections
> > that manipulate the global bitmask that keeps track of bounce buffer
> > allocations, use compare-and-exchange to manage the global variable, and
> > tweak the logic to line up with that.
> >
> > Given that IoMmuDxe implements a singleton protocol that is shared
> > between multiple drivers, and considering the elaborate and confusing
> > requirements in the UEFP spec regarding TPL levels at which protocol
> > methods may be invoked, not relying on TPL levels at all is a more
>
> Really good change (I had thought of this when reading through the
> other IoMmuDxe thread), but I'm wondering if this warrants the
> addition of bit ops (AND, OR at least) to SynchronizationLib?
>

Thanks.

Atomic AND/OR would only help on the free path in this case.

> Sidenote: the compiler can detect if atomic intrinsics use the "fetch"
> value in (fetch_or, or_fetch, etc) and thus use smaller, more
> efficient instruction sequences (https://godbolt.org/z/zWTTWacEd). if
> only we could use those...
>

In principle, I'd agree but these are rarely used so I'm not sure it's
worth the effort refactoring this.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107171): https://edk2.groups.io/g/devel/message/107171
Mute This Topic: https://groups.io/mt/100256049/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list