Page MenuHomeFreeBSD

LinuxKPI: Allow spin_lock_irqsave to be called within a critical section
ClosedPublic

Authored by wulf on Jan 13 2022, 11:48 PM.
Tags
None
Referenced Files
F111008876: D33887.diff
Wed, Feb 26, 3:52 AM
Unknown Object (File)
Mon, Feb 24, 6:25 AM
Unknown Object (File)
Jan 24 2025, 3:58 AM
Unknown Object (File)
Jan 17 2025, 6:02 PM
Unknown Object (File)
Jan 17 2025, 3:42 PM
Unknown Object (File)
Jan 10 2025, 8:33 PM
Unknown Object (File)
Jan 8 2025, 3:51 PM
Unknown Object (File)
Dec 4 2024, 9:53 PM

Details

Summary

with spinning on spin_trylock. dma-buf part of drm-kmod depends on this
property and absence of it support results in "mi_switch: switch in a
critical section" assertions [1][2].

[1] https://github.com/freebsd/drm-kmod/issues/116
[2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261166

MFC after: 1 week

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 43915
Build 40803: arc lint + arc unit

Event Timeline

wulf requested review of this revision.Jan 13 2022, 11:48 PM
This revision is now accepted and ready to land.Jan 14 2022, 6:28 AM
sys/compat/linuxkpi/common/include/linux/spinlock.h
120

Is this a property of spin_lock_irqsave() only or should other spin_lock() functions be updated aswell?

sys/compat/linuxkpi/common/include/linux/spinlock.h
120

AFAIK no, they should not. Ordinary spin_lock() requires fully preemptible context at least on RT-kernels. See PREEMPT_RT caveats section of https://www.kernel.org/doc/html/latest/locking/locktypes.html

May be some other spin_lock_XXX functions e.g. spin_lock_irqsave_nested() can be updated too, but I did not dig in to this direction.

sys/compat/linuxkpi/common/include/linux/spinlock.h
120

Please updsate spin_lock_irqsave_nested() aswell and let's get moving :-)