Re: [PATCH rdma v7 3/7] RDMA/zrdma: Add internal headers and hardware register definitions
From: Markus Elfring
Date: Tue Oct 27 2026 - 03:11:45 EST
…
> zxdh_free_rsrc() uses guard(spinlock_irqsave), so the lock is released on
> every exit path. zxdh_alloc_rsrc() keeps the explicit locking, as it has
> several early return paths, and takes a pool name so that the exhaustion
> log identifies the affected pool.
How do you think about to move such hints behind the marker line?
…
> ---
> drivers/infiniband/hw/zrdma/zrdma_hw.h | 21 +++
> drivers/infiniband/hw/zrdma/zrdma_main.h | 216 +++++++++++++++++++++++
…
> +++ b/drivers/infiniband/hw/zrdma/zrdma_main.h
> @@ -0,0 +1,216 @@
…
> +static inline int zxdh_alloc_rsrc(struct zxdh_pci_f *rf,
> + unsigned long *rsrc_array, u32 max_rsrc,
> + u32 *req_rsrc_num, u32 *next,
> + const char *rsrc_name)
> +{
> + unsigned long flags;
> + u32 rsrc_num;
> +
> + spin_lock_irqsave(&rf->rsrc_lock, flags);
> + rsrc_num = find_next_zero_bit(rsrc_array, max_rsrc, *next);
…
> + *req_rsrc_num = rsrc_num;
> + spin_unlock_irqrestore(&rf->rsrc_lock, flags);
> +
> + return 0;
> +}
…
I imagine that a lock guard would be helpful also for this function implementation.
Regards,
Markus