Re: [patch V2 4/9] softirq: Make softirq control and processing RT aware

From: Peter Zijlstra
Date: Wed Dec 09 2020 - 05:35:13 EST


On Fri, Dec 04, 2020 at 06:01:55PM +0100, Thomas Gleixner wrote:
> +void __local_bh_disable_ip(unsigned long ip, unsigned int cnt)
> +{
> + unsigned long flags;
> + int newcnt;
> +
> + WARN_ON_ONCE(in_hardirq());
> +
> + /* First entry of a task into a BH disabled section? */
> + if (!current->softirq_disable_cnt) {
> + if (preemptible()) {

This reminds me of that migrate_disable() thing that didn't work, and
has similar problems.

preempt_disable();
local_bh_disable();
preempt_enable();
spin_lock(&foo);

is valid (albeit daft) code that will now malfunction.

> + local_lock(&softirq_ctrl.lock);