Re: [PATCH] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
From: Sebastian Andrzej Siewior
Date: Mon Oct 19 2026 - 09:44:39 EST
On 2026-10-19 21:22:27 [+0800], Haoran Wang wrote:
> diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> index 2e3973a32..5f68c5d57 100644
> --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> @@ -125,10 +125,9 @@ static int ppm_get_cpu_entries(struct cxgbi_ppm *ppm, unsigned int count,
> if (!ppm->pool)
> return -EINVAL;
>
> - cpu = get_cpu();
> - pool = per_cpu_ptr(ppm->pool, cpu);
> + cpu = raw_smp_processor_id();
> + pool = raw_cpu_ptr(ppm->pool);
cpu needs too be obtained after the lock has been acquired.
Please also explain why it is okay to obtain pool belonging to CPU1 on
CPU0.
> spin_lock_bh(&pool->lock);
> - put_cpu();
>
> i = ppm_find_unused_entries(pool->bmap, ppm->pool_index_max,
> pool->next, count, 0);
Sebastian