[RFC] The purpose of raw_spin_lock_bh()

From: Sebastian Andrzej Siewior
Date: Fri Jan 08 2021 - 12:58:08 EST


I just noticed that we have raw_spin_lock_bh() and it has a few users.
My guess is that the API should be removed and the existing user(s)
should be moved to spin_lock_bh() / spinlock_t instead.
On !RT it works as expected and there is no difference compared to
spinlock_t.
On RT it is kind of broken: It uses a raw_spinlock_t, disables BH but
does not disable preemption. So it will spin on the lock but the owner
could be scheduled out.

I could (of course) make raw_spin_lock_bh() do the right thing on RT
but from a quick look in sock_map_update_common() there is at least
raw_spin_lock_bh(&stab->lock);
-> sock_map_add_link()
-> spin_lock_bh(&psock->link_lock);

which would then trigger a might_sleep().

Sebastian