Re: [PATCH v2 01/12] aoe: Enable lock context analysis
Bart Van Assche <[email protected]> Mon, 3 Aug 2026 10:24:12 -0700
| Newsgroups | org.kernel.vger.linux-block |
|---|---|
| Message-ID | <[email protected]> |
On 8/3/26 5:53 AM, Nilay Shroff wrote:
> As I see, iocq->lock guards iocq->head. So shouldn't we annotate
> iocq->head with __guarded_by(iocq->lock)? For instance,
>=20
> struct iocq_ktio {
> =C2=A0=C2=A0=C2=A0=C2=A0struct list_head head;
> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0 __guarded_by(&lock);
> =C2=A0=C2=A0=C2=A0=C2=A0spinlock_t lock;
> };
How about integrating the change below into this patch?
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 54c57b9f8894..7ceda4ee4e55 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -51,8 +51,8 @@ static struct ktstate *kts;
/* io completion queue */
struct iocq_ktio {
- struct list_head head;
spinlock_t lock;
+ struct list_head head __guarded_by(&lock);
};
static struct iocq_ktio *iocq;
@@ -1717,8 +1717,8 @@ aoecmd_init(void)
}
for (i =3D 0; i < ncpus; i++) {
- INIT_LIST_HEAD(&iocq[i].head);
- spin_lock_init(&iocq[i].lock);
+ scoped_guard(spinlock_init, &iocq[i].lock)
+ INIT_LIST_HEAD(&iocq[i].head);
init_waitqueue_head(&ktiowq[i]);
snprintf(kts[i].name, sizeof(kts[i].name), "aoe_ktio%d", i);
kts[i].fn =3D ktio;
Thanks,
Bart.