Re: [PATCH v2 11/19] lib/stackdepot: use read/write lock

From: Andrey Konovalov
Date: Mon Oct 23 2023 - 12:17:03 EST


On Mon, Oct 9, 2023 at 11:45 AM Alexander Potapenko <glider@xxxxxxxxxx> wrote:
>
> > static struct stack_record *depot_fetch_stack(depot_stack_handle_t handle)
> > {
> > union handle_parts parts = { .handle = handle };
> > - /*
> > - * READ_ONCE pairs with potential concurrent write in
> > - * depot_init_pool.
> > - */
> > - int pools_num_cached = READ_ONCE(pools_num);
> > void *pool;
> > size_t offset = parts.offset << DEPOT_STACK_ALIGN;
> > struct stack_record *stack;
> >
> > - if (parts.pool_index > pools_num_cached) {
> > + lockdep_assert_held(&pool_rwlock);
>
> Shouldn't it be lockdep_assert_held_read()?

Indeed, this is more precise. Will fix in v3, thanks!