[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <925f3337-cf9b-4dc1-87ea-f1e63168fbc4@stanley.mountain>
Date: Wed, 2 Oct 2024 21:10:36 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Waiman Long <longman@...hat.com>
Cc: Yu Kuai <yukuai3@...wei.com>, Tejun Heo <tj@...nel.org>,
Josef Bacik <josef@...icpanda.com>, Jens Axboe <axboe@...nel.dk>,
cgroups@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v2] blk_iocost: remove some duplicate irq disable/enables
On Wed, Oct 02, 2024 at 01:49:48PM -0400, Waiman Long wrote:
> > - spin_unlock_irq(&ioc->lock);
> > + spin_unlock(&ioc->lock);
> > return 0;
> > }
>
> I would suggest adding a "lockdep_assert_irqs_disabled()" call before
> spin_lock() to confirm that irq is indeed disabled just in case the callers
> are changed in the future.
It's really hard to predict future bugs. I doubt we'll add new callers.
Outputting this information to a struct seq_file *sf is pretty specific.
If there were a bug related to this, then wouldn't it be caught by lockdep?
The other idea is that we could catch bugs like this using static analysis.
Like every time we take the &ioc->lock, either IRQs should already be disabled
or we disable it ourselves. I could write a Smatch check like this.
KTODO: add Smatch check to ensure IRQs are disabled for &ioc->lock
regards,
dan carpenter
Powered by blists - more mailing lists