Re: [PATCH v2] blk_iocost: remove some duplicate irq disable/enables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

On Thu, Oct 03, 2024 at 08:38:48AM -0600, Jens Axboe wrote:
...
> >>>   3144          spin_lock(&iocg->ioc->lock);
> >>>
> >>> But why is this not spin_lock_irq()?  I haven't analyzed this so maybe it's
> >>> fine.
> >>
> >> That's a bug.
> >>
> > 
> > I could obviously write this patch but I feel stupid writing the
> > commit message. My level of understanding is Monkey See Monkey do.
> > Could you take care of this?
> 
> Sure - or let's add Tejun who knows this code better. Ah he's already
> added. Tejun?

Yeah, that should be spin_lock_irq() for consistency but at the same time it
doesn't look like anything is actually grabbing that lock (or blkcg->lock
nesting outside of it) from an IRQ context, so no actual deadlock scenario
exists and lockdep doesn't trigger.

> > So somewhere we're taking a lock in the IRQ handler and this can lead
> > to a deadlock? I thought this would have been caught by lockdep?
> 
> It's nested inside blkcg->lock which is IRQ safe, that is enough. But
> doing a quick scan of the file, the usage is definitely (widly)
> inconsistent. Most times ioc->lock is grabbed disabling interrupts, but

Hmm... the only place I see is the one Dan pointed out.

> there are also uses that doesn't disable interrupts, coming from things
> like seq_file show paths which certainly look like they need it. lockdep
> should certainly warn about this, only explanation I have is that nobody
> bothered to do that :-)

The locks are intended to be IRQ-safe but it looks like they don't need to
be at least for now. I'll send a patch to update the ioc_weight_write()
pair.

Thanks.

-- 
tejun




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux