Thread View: linux.kernel.netdev
13 messages
13 total messages
Started by Haoran Wang
Mon, 19 Oct 2026 13:22
[PATCH] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: Haoran Wang
Date: Mon, 19 Oct 2026 13:22
Date: Mon, 19 Oct 2026 13:22
51 lines
10066 bytes
10066 bytes
ppm_get_cpu_entries() disables preemption with get_cpu(), reads the
current CPU's pool with per_cpu_ptr(), then acquires spin_lock_bh()
while preemption is still disabled, and finally put_cpu().
cpu = get_cpu();
pool = per_cpu_ptr(ppm->pool, cpu);
spin_lock_bh(&pool->lock);
put_cpu();
On PREEMPT_RT kernels spin_lock_bh() becomes a sleeping lock
(rt_spin_lock). get_cpu() raises preempt_count, so acquiring the
lock right after sleeps with preempt_count still positive. Sleeping
in that state is the scheduling-while-atomic case, which under
CONFIG_DEBUG_ATOMIC_SLEEP reports a BUG and, if the lock is contended,
deadlocks on the spot. The trigger path is any iSCSI offload I/O
through a Chelsio NIC that reaches ppm_get_cpu_entries().
The preemption disable exists only to stabilize the per-CPU accessor,
the pool is serialized by pool->lock, not by preemption. Replace
get_cpu() + per_cpu_ptr() + put_cpu() with raw_smp_processor_id() +
raw_cpu_ptr(), which read the current CPU without disabling preemption.
On non-RT kernels spin_lock_bh() does not sleep, so the BUG does not
fire there; the defect is PREEMPT_RT-specific.
With the fix, preempt_count is 0 at spin_lock_bh(), so rt_spin_lock()'s
might_sleep() no longer triggers.
Signed-off-by: Haoran Wang <haoranwangsec@gmail.com>
---
drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
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);
spin_lock_bh(&pool->lock);
- put_cpu();
i = ppm_find_unused_entries(pool->bmap, ppm->pool_index_max,
pool->next, count, 0);
Re: [PATCH] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: netdev-bot+sinfo
Date: Mon, 19 Oct 2026 13:29
Date: Mon, 19 Oct 2026 13:29
26 lines
6554 bytes
6554 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages. - What hardware the change was tested on. For driver fixes please mention the device (and if relevant firmware version) used for testing, or say that the change was not tested on real hardware. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then. The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: Sebastian Andrzej Siewior
Date: Mon, 19 Oct 2026 13:29
Date: Mon, 19 Oct 2026 13:29
27 lines
7356 bytes
7356 bytes
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
Re: [PATCH] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: netdev-bot+sashiko
Date: Thu, 22 Oct 2026 07:25
Date: Thu, 22 Oct 2026 07:25
131 lines
12502 bytes
12502 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch introduces a cpu/pool mismatch race in
ppm_get_cpu_entries()…
- [Low] The commit is a bug fix for a user-visible 'BUG: sleeping
function called from invalid context' on PREEMPT_RT.
--
libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
This patch changes ppm_get_cpu_entries(). It drops get_cpu(),
per_cpu_ptr() and put_cpu() and uses raw_smp_processor_id() and
raw_cpu_ptr() instead. The aim is to stop spin_lock_bh() from being taken
with preemption disabled, which triggers a sleeping-in-atomic BUG on
PREEMPT_RT.
> Signed-off-by: Haoran Wang <haoranwangsec@gmail.com>
[Severity: Low]
This fixes a user-visible BUG on PREEMPT_RT, but the commit has no Fixes:
tag. The get_cpu()/per_cpu_ptr()/spin_lock_bh()/put_cpu() sequence has
not changed since it was added in:
Fixes: 47da7e62b391 ("cxgb4: add iSCSI DDP page pod manager")
Should that tag be added, possibly with a Cc: stable?
> diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> index 2e3973a32d9d..5f68c5d5766e 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);
[Severity: High]
Can cpu and pool refer to different CPUs here?
The new code reads the current CPU twice, with preemption and migration
both enabled. Say the task moves from CPU A to CPU B between
raw_smp_processor_id() and raw_cpu_ptr(). The bit is then reserved in CPU
B's bitmap under CPU B's lock, but the returned index is built from the
old cpu value:
drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c:ppm_get_cpu_entries() {
...
i += cpu * ppm->pool_index_max;
ppm_mark_entries(ppm, i, count, caller_data);
...
}
The index and the ppod_data[] entry now point into CPU A's slice, while
bit i in CPU A's bitmap is still clear.
Could a task on CPU A then get the same index, hardware page pod and
ppod_data slot while the first transfer is still in flight?
cxgbi_ppm_ppods_reserve() turns this index into hwidx and the DDP tag.
cxgbit_ddp_reserve() and cxgbi_ddp_reserve() then program that tag into
the adapter. The caller_data in ppod_data[] is also what
cxgbi_parse_pdu_itt() uses later to match responses to tasks.
On release, ppm_unmark_entries() gets the pool back from the index:
cpu = i / ppm->pool_index_max;
i %= ppm->pool_index_max;
pool = per_cpu_ptr(ppm->pool, cpu);
spin_lock_bh(&pool->lock);
bitmap_clear(pool->bmap, i, count);
That would clear the bit in CPU A's pool, which may free another
transfer's live entry. The bit that was really set in CPU B's pool would
never be cleared.
One preemptible caller that holds no spinlock is the iSCSI target TX
path:
iscsit_send_r2t()
cxgbit_get_r2t_ttt()
cxgbit_ddp_reserve()
cxgbi_ppm_ppods_reserve()
ppm_get_cpu_entries()
iscsit_get_r2t_from_list() drops r2t_lock before it returns, so this
whole chain runs unlocked. A remote initiator can drive it simply by
sending WRITE commands to a Chelsio-offloaded target.
The raw_ accessors are not checked by CONFIG_DEBUG_PREEMPT, so nothing
would warn. The race exists on any SMP kernel built with CONFIG_PREEMPT,
PREEMPT_LAZY or PREEMPT_RT.
Given that, do these parts of the commit message still hold?
The preemption disable exists only to stabilize the per-CPU accessor,
the pool is serialized by pool->lock, not by preemption.
...the defect is PREEMPT_RT-specific.
The returned index encodes cpu, so cpu and pool still have to match even
though pool->lock serializes the bitmap.
Would it work to keep the saved cpu and derive the pool from it? For
example:
cpu = raw_smp_processor_id();
pool = per_cpu_ptr(ppm->pool, cpu);
Another option would be to wrap the lookup in
migrate_disable()/migrate_enable().
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/179241614797.5916.13928836073297916808%40whr
[PATCH v3] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: Haoran Wang
Date: Mon, 09 Nov 2026 10:07
Date: Mon, 09 Nov 2026 10:07
97 lines
14368 bytes
14368 bytes
ppm_get_cpu_entries() disables preemption with get_cpu(), reads the
current CPU's pool with per_cpu_ptr(), then acquires the pool's
spin_lock_bh() while preemption is still disabled, and finally put_cpu().
On PREEMPT_RT kernels spin_lock_bh() becomes a sleeping lock
(rt_spin_lock), so the task may sleep with preempt_count elevated:
scheduling while atomic, reported as a BUG by CONFIG_DEBUG_ATOMIC_SLEEP
and a deadlock once the lock is contended. Any iSCSI offload I/O
through a Chelsio NIC that reaches ppm_get_cpu_entries() triggers it.
Read the current CPU with raw_cpu_ptr() without raising preempt_count,
and derive the global index base from pool->base (initialised when the
pools are allocated) instead of cpu * pool_index_max, so the base
always matches the pool that was locked. The owning CPU remains in the
debug output, now derived from pool->base.
Signed-off-by: Haoran Wang <haoranwangsec@gmail.com>
---
(Resent with the complete Cc list; the earlier copy reached only you.)
Hi Sebastian,
thanks for the review. v3 below addresses your comments:
- The commit message now describes what the patch does; the review
rationale moved into the changelog below the --- separator.
- PREEMPT_RT spelled out.
- pr_debug() keeps printing the owning CPU of the pool, derived as
pool->base / ppm->pool_index_max; the global index stays
i + pool->base.
- Tested on: x86_64, compile-tested with CONFIG_PREEMPT_RT=y and
CONFIG_DEBUG_ATOMIC_SLEEP=y; no Chelsio hardware at hand, so the
change is not exercised on real offload I/O.
Changes since v2:
- Keep the owning CPU in the pr_debug() output, derived from
pool->base / ppm->pool_index_max (suggested by Sebastian).
- Reword the commit message to describe what the patch does and move
the review discussion into this changelog; spell PREEMPT_RT.
Changes since v1:
- Drop the cpu variable: read the global-index base from pool->base
(initialised at pool allocation) instead of a cpu captured before
the lock, so the base is always consistent with the pool that was
locked. The per-CPU pools are shards of the global ppod index
space and not tied to the running CPU (ppm_unmark_entries() derives
the owning pool from the index itself), so locking another CPU's
pool after a migration is a cache-locality matter, not a
correctness one.
drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
--- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
+++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
@@ -119,16 +119,13 @@
unsigned long caller_data)
{
struct cxgbi_ppm_pool *pool;
- unsigned int cpu;
int i;
if (!ppm->pool)
return -EINVAL;
- cpu = get_cpu();
- pool = per_cpu_ptr(ppm->pool, cpu);
+ pool = raw_cpu_ptr(ppm->pool);
spin_lock_bh(&pool->lock);
- put_cpu();
i = ppm_find_unused_entries(pool->bmap, ppm->pool_index_max,
pool->next, count, 0);
@@ -145,10 +142,10 @@
spin_unlock_bh(&pool->lock);
pr_debug("%s: cpu %u, idx %d + %d (%d), next %u.\n",
- __func__, cpu, i, count, i + cpu * ppm->pool_index_max,
- pool->next);
+ __func__, pool->base / ppm->pool_index_max, i, count,
+ i + pool->base, pool->next);
- i += cpu * ppm->pool_index_max;
+ i += pool->base;
ppm_mark_entries(ppm, i, count, caller_data);
return i;
@@ -375,6 +372,7 @@
memset(ppool, 0, alloc_sz);
spin_lock_init(&ppool->lock);
+ ppool->base = count;
count += ppmax;
}
Re: [PATCH v3] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: netdev-bot+sinfo
Date: Mon, 09 Nov 2026 10:11
Date: Mon, 09 Nov 2026 10:11
18 lines
8562 bytes
8562 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then. The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH v3] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: David Laight
Date: Mon, 09 Nov 2026 20:03
Date: Mon, 09 Nov 2026 20:03
125 lines
16072 bytes
16072 bytes
On Mon, 09 Nov 2026 18:07:48 +0800
Haoran Wang <haoranwangsec@gmail.com> wrote:
> ppm_get_cpu_entries() disables preemption with get_cpu(), reads the
> current CPU's pool with per_cpu_ptr(), then acquires the pool's
> spin_lock_bh() while preemption is still disabled, and finally put_cpu().
>
> On PREEMPT_RT kernels spin_lock_bh() becomes a sleeping lock
> (rt_spin_lock), so the task may sleep with preempt_count elevated:
> scheduling while atomic, reported as a BUG by CONFIG_DEBUG_ATOMIC_SLEEP
> and a deadlock once the lock is contended. Any iSCSI offload I/O
> through a Chelsio NIC that reaches ppm_get_cpu_entries() triggers it.
>
> Read the current CPU with raw_cpu_ptr() without raising preempt_count,
> and derive the global index base from pool->base (initialised when the
> pools are allocated) instead of cpu * pool_index_max, so the base
> always matches the pool that was locked. The owning CPU remains in the
> debug output, now derived from pool->base.
I think you really need to explain why it doesn't matter that the pool
for the 'wrong' cpu is used.
You don't need a big explanation of why you can't call spin_lock_bh()
with preemption disabled, it is probably enough just to say that you
can't (the most reason would be 'can sleep on PREEMPT_RT kernels).
This is separate from any issues of acquiring the wrong lock.
I'm not sure about the trace, if you are tracing the cpu the data belongs
to - then that should be what you call it.
Once you hold the lock I think the cpu is fixed (even under PREEMPT_RT)
so you could trace the actual cpu as well - especially if anything 'funny'
might happen because the data wor the wrong cpu is being used.
Of course, it the code is just trying to avoid lock contention (and maybe
reduce cache line bouncing) it may not matter at all which copy of the
data you get.
In fact one for each cpu may be excessive - think of systems with 1000s
of cpu not single digits.
David
>
> Signed-off-by: Haoran Wang <haoranwangsec@gmail.com>
>
> ---
> (Resent with the complete Cc list; the earlier copy reached only you.)
>
> Hi Sebastian,
>
> thanks for the review. v3 below addresses your comments:
>
> - The commit message now describes what the patch does; the review
> rationale moved into the changelog below the --- separator.
> - PREEMPT_RT spelled out.
> - pr_debug() keeps printing the owning CPU of the pool, derived as
> pool->base / ppm->pool_index_max; the global index stays
> i + pool->base.
> - Tested on: x86_64, compile-tested with CONFIG_PREEMPT_RT=y and
> CONFIG_DEBUG_ATOMIC_SLEEP=y; no Chelsio hardware at hand, so the
> change is not exercised on real offload I/O.
>
> Changes since v2:
> - Keep the owning CPU in the pr_debug() output, derived from
> pool->base / ppm->pool_index_max (suggested by Sebastian).
> - Reword the commit message to describe what the patch does and move
> the review discussion into this changelog; spell PREEMPT_RT.
>
> Changes since v1:
> - Drop the cpu variable: read the global-index base from pool->base
> (initialised at pool allocation) instead of a cpu captured before
> the lock, so the base is always consistent with the pool that was
> locked. The per-CPU pools are shards of the global ppod index
> space and not tied to the running CPU (ppm_unmark_entries() derives
> the owning pool from the index itself), so locking another CPU's
> pool after a migration is a cache-locality matter, not a
> correctness one.
>
> drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> @@ -119,16 +119,13 @@
> unsigned long caller_data)
> {
> struct cxgbi_ppm_pool *pool;
> - unsigned int cpu;
> int i;
>
> if (!ppm->pool)
> return -EINVAL;
>
> - cpu = get_cpu();
> - pool = per_cpu_ptr(ppm->pool, cpu);
> + pool = raw_cpu_ptr(ppm->pool);
> spin_lock_bh(&pool->lock);
> - put_cpu();
>
> i = ppm_find_unused_entries(pool->bmap, ppm->pool_index_max,
> pool->next, count, 0);
> @@ -145,10 +142,10 @@
> spin_unlock_bh(&pool->lock);
>
> pr_debug("%s: cpu %u, idx %d + %d (%d), next %u.\n",
> - __func__, cpu, i, count, i + cpu * ppm->pool_index_max,
> - pool->next);
> + __func__, pool->base / ppm->pool_index_max, i, count,
> + i + pool->base, pool->next);
>
> - i += cpu * ppm->pool_index_max;
> + i += pool->base;
> ppm_mark_entries(ppm, i, count, caller_data);
>
> return i;
> @@ -375,6 +372,7 @@
>
> memset(ppool, 0, alloc_sz);
> spin_lock_init(&ppool->lock);
> + ppool->base = count;
> count += ppmax;
> }
>
>
[PATCH v4] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: Haoran Wang
Date: Tue, 10 Nov 2026 08:57
Date: Tue, 10 Nov 2026 08:57
385 lines
36003 bytes
36003 bytes
--===============3289614648381437450==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
ppm_get_cpu_entries() must not acquire a sleeping lock while preemption
is disabled: get_cpu() raises preempt_count and spin_lock_bh() may sleep
on PREEMPT_RT kernels. Read the current CPU with raw_cpu_ptr() instead,
which keeps the per-CPU accessor stable without disabling preemption.
Using the pool of a CPU the thread has since migrated away from is
harmless: the per-CPU pools are shards of the global ppod index space,
and the free path ppm_unmark_entries() derives the owning pool from the
index instead of from the running CPU, so any thread can service any
shard. Derive the global index base from pool->base so it always
matches the pool that was locked.
Signed-off-by: Haoran Wang <haoranwangsec@gmail.com>
---
Hi David,
thanks for the comments. v4 below:
- The commit message now explains why using the pool of another CPU is
harmless, and the PREEMPT_RT problem statement is trimmed to two
sentences.
- pr_debug() now labels the pool's owner as "pool cpu" and also prints
the running CPU, so a thread servicing a foreign shard is visible in
the log.
- I also stress-tested the patched allocator itself: the unmodified
libcxgb_ppm.c with this patch applied, compiled into an out-of-tree
module and driven through the real cxgbi_ppm_ppods_reserve() /
cxgbi_ppm_ppod_release() API by 8 unbound kernel threads on a 2-CPU
QEMU x86_64 guest, with about half of the releases executed by
another thread (and so, usually, another CPU). Across 7 runs
totalling 1.12M allocations there was no double-issued index, no bad
free, and every pool drained back to empty each run; 4 allocations
were naturally served by another CPU's pool because the caller
migrated inside the allocator, and the accounting stayed exact. The
test harness is AI-generated; module and logs are attached.
- On the sharding granularity: agreed, the per-pool split only spreads
lock contention and cache-line bouncing; on systems with thousands of
CPUs a coarser sharding would serve the same purpose. That is a
separate optimisation and does not affect this fix, so I left it
untouched here.
Changes since v3:
- Explain in the commit message why a foreign CPU's pool is harmless;
trim the PREEMPT_RT problem description (review).
- pr_debug(): print the running CPU and the pool-owning CPU separately
and label them accordingly (review).
- pr_debug(): the owning CPU keeps being derived from pool->base, so it
is always consistent with the locked pool.
- Attach stress-test evidence for the foreign-pool argument.
Changes since v2:
- Keep the owning CPU in the pr_debug() output, derived from
pool->base / ppm->pool_index_max (suggested by Sebastian).
- Reword the commit message to describe what the patch does and move
the review discussion into this changelog; spell PREEMPT_RT.
Changes since v1:
- Drop the cpu variable: read the global-index base from pool->base
(initialised at pool allocation) instead of a cpu captured before
the lock, so the base is always consistent with the pool that was
locked.
drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
--- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
+++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
@@ -119,16 +119,13 @@
unsigned long caller_data)
{
struct cxgbi_ppm_pool *pool;
- unsigned int cpu;
int i;
if (!ppm->pool)
return -EINVAL;
- cpu = get_cpu();
- pool = per_cpu_ptr(ppm->pool, cpu);
+ pool = raw_cpu_ptr(ppm->pool);
spin_lock_bh(&pool->lock);
- put_cpu();
i = ppm_find_unused_entries(pool->bmap, ppm->pool_index_max,
pool->next, count, 0);
@@ -144,11 +141,12 @@
spin_unlock_bh(&pool->lock);
- pr_debug("%s: cpu %u, idx %d + %d (%d), next %u.\n",
- __func__, cpu, i, count, i + cpu * ppm->pool_index_max,
- pool->next);
+ pr_debug("%s: cpu %u, pool cpu %u, idx %d + %d (%d), next %u.\n",
+ __func__, raw_smp_processor_id(),
+ pool->base / ppm->pool_index_max, i, count, i + pool->base,
+ pool->next);
- i += cpu * ppm->pool_index_max;
+ i += pool->base;
ppm_mark_entries(ppm, i, count, caller_data);
return i;
@@ -375,6 +373,7 @@
memset(ppool, 0, alloc_sz);
spin_lock_init(&ppool->lock);
+ ppool->base = count;
count += ppmax;
}
--===============3289614648381437450==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="ppm_v4_stresstest.txt"
bGliY3hnYiBwcG0gdjQgLS0gc3RyZXNzIHRlc3QgZm9yIHRoZSAid3JvbmcgQ1BVJ3MgcG9vbCIg
cXVlc3Rpb24KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT0KCkRJU0NMT1NVUkUKLS0tLS0tLS0tLQpUaGUgdGVzdCBoYXJuZXNz
IGJlbG93IChwb29sdGVzdF9yZWFsLmMsIE1ha2VmaWxlIGFuZCB0aGUgcnVuIHJlY2lwZSkKaXMg
QUktZ2VuZXJhdGVkIGNvZGUgKENsYXVkZSkuICBUaGUgY29kZSB1bmRlciB0ZXN0IGlzIHRoZSB1
bm1vZGlmaWVkCmRyaXZlcnMvbmV0L2V0aGVybmV0L2NoZWxzaW8vbGliY3hnYi9saWJjeGdiX3Bw
bS5jIChMaW51eCA3LjMpLCB3aXRoCnRoZSBwcm9wb3NlZCB2NCBwYXRjaCBhcHBsaWVkIHZlcmJh
dGltIHZpYSBgcGF0Y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Rlc3QubyBwb29sdGVzdF9yZWFsLm8K
CktESVIgIDo9IC9yb290L2xpbnV4LTcuMwpCVUlMRCA6PSAvcm9vdC9sa2J1aWxkNzMKCmFsbDoK
CW1ha2UgLUMgJChLRElSKSBPPSQoQlVJTEQpIE09JChDVVJESVIpIEtCVUlMRF9NT0RQT1NUX1dB
Uk49MSBtb2R1bGVzCg==
--===============3289614648381437450==--
Re: [PATCH v4] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: netdev-bot+sinfo
Date: Tue, 10 Nov 2026 09:02
Date: Tue, 10 Nov 2026 09:02
22 lines
8888 bytes
8888 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. - Whether the issue was actually triggered, or is only theoretical (e.g. found by code inspection). If it was triggered please include the symptoms, like the stack trace or error messages. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then. The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH v4] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: Sebastian Andrzej Siewior
Date: Wed, 11 Nov 2026 12:17
Date: Wed, 11 Nov 2026 12:17
53 lines
11530 bytes
11530 bytes
On 2026-11-10 16:57:51 [+0800], Haoran Wang wrote: > ppm_get_cpu_entries() must not acquire a sleeping lock while preemption > is disabled: get_cpu() raises preempt_count and spin_lock_bh() may sleep I would say "disables preemption" rather than "raises preempt_count". > on PREEMPT_RT kernels. Read the current CPU with raw_cpu_ptr() instead, > which keeps the per-CPU accessor stable without disabling preemption. That is not what is happening. raw_cpu_ptr() obtains the per-CPU pointer of ppm->pool of the current CPU. I don't know what means "accessor stable" and the following. Without disabled preemption the scheduler can migrate the task to a different CPU. The access is still stable but if the "locking" of the data structure is based on "the data structure can only be accessed from the local CPU" then it is no longer valid. > Using the pool of a CPU the thread has since migrated away from is > harmless: the per-CPU pools are shards of the global ppod index space, ppod? > and the free path ppm_unmark_entries() derives the owning pool from the > index instead of from the running CPU, so any thread can service any > shard. Derive the global index base from pool->base so it always > matches the pool that was locked. The important part is that ppm_find_unused_entries() acquires slots (read-modify-write operation on the structure) and it happens under the lock therefore cross-CPU access does not matter. Does it always happen under the lock? Then it is safe - otherwise it is not. > Signed-off-by: Haoran Wang <haoranwangsec@gmail.com> > > > thanks for the comments. v4 below: > > - pr_debug() now labels the pool's owner as "pool cpu" and also prints > the running CPU, so a thread servicing a foreign shard is visible in > the log. Was this asked for? The pool CPU might be interesting to know so you have which CPU's pool is serving the request. But the current CPU is probably less useful. The changes below look reasonable and I *think* it is unchanged from the last time I looked at them Please look at Documentation/process/maintainer-netdev.rst for the subject prefix, fixes tag and "Resending after review". Sebastian
Re: [PATCH v3] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: netdev-bot+sashiko
Date: Wed, 11 Nov 2026 16:08
Date: Wed, 11 Nov 2026 16:08
128 lines
12530 bytes
12530 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The patch changes how ppm_get_cpu_entries() encodes the global
ppod index but leaves the release path decoding it the old way.
- [Low] The commit fixes a user-visible PREEMPT_RT bug in
ppm_get_cpu_entries()…
--
libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
The commit removes the get_cpu()/put_cpu() pair around spin_lock_bh() in
ppm_get_cpu_entries(), so the code no longer takes a sleeping lock with
preemption disabled on PREEMPT_RT. It reads the pool with raw_cpu_ptr().
It also builds the global ppod index from a new pool->base, set in
ppm_alloc_cpu_pool(), instead of cpu * pool_index_max.
> diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> index 2e3973a32d9d1..7fb6c8a41e98f 100644
> --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> @@ -119,16 +119,13 @@ static int ppm_get_cpu_entries(struct cxgbi_ppm *ppm, unsigned int count,
> unsigned long caller_data)
> {
> struct cxgbi_ppm_pool *pool;
> - unsigned int cpu;
> int i;
>
> if (!ppm->pool)
> return -EINVAL;
>
> - cpu = get_cpu();
> - pool = per_cpu_ptr(ppm->pool, cpu);
> + pool = raw_cpu_ptr(ppm->pool);
> spin_lock_bh(&pool->lock);
> - put_cpu();
[Severity: Low]
This isn't a bug, but should the patch have a Fixes: tag? The sequence
get_cpu(); per_cpu_ptr(); spin_lock_bh(); put_cpu(); dates back to the
original page pod manager, before the file moved to libcxgb:
Fixes: 47da7e62b391 ("cxgb4: add iSCSI DDP page pod manager")
>
> i = ppm_find_unused_entries(pool->bmap, ppm->pool_index_max,
> pool->next, count, 0);
> @@ -145,10 +142,10 @@ static int ppm_get_cpu_entries(struct cxgbi_ppm *ppm, unsigned int count,
> spin_unlock_bh(&pool->lock);
>
> pr_debug("%s: cpu %u, idx %d + %d (%d), next %u.\n",
> - __func__, cpu, i, count, i + cpu * ppm->pool_index_max,
> - pool->next);
> + __func__, pool->base / ppm->pool_index_max, i, count,
> + i + pool->base, pool->next);
>
> - i += cpu * ppm->pool_index_max;
> + i += pool->base;
> ppm_mark_entries(ppm, i, count, caller_data);
>
> return i;
> @@ -375,6 +372,7 @@ ppm_alloc_cpu_pool(unsigned int *total, unsigned int *pcpu_ppmax)
>
> memset(ppool, 0, alloc_sz);
> spin_lock_init(&ppool->lock);
> + ppool->base = count;
> count += ppmax;
> }
[Severity: High]
Does the new encoding still match the release path?
ppm_alloc_cpu_pool() walks the pools with for_each_possible_cpu(), so
pool->base is the CPU's position in cpu_possible_mask times ppmax. It is
not cpu * ppmax. ppm_get_cpu_entries() now returns i + pool->base.
ppm_unmark_entries() is unchanged and still treats that value as a CPU
id:
drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c:ppm_unmark_entries() {
...
cpu = i / ppm->pool_index_max;
i %= ppm->pool_index_max;
pool = per_cpu_ptr(ppm->pool, cpu);
spin_lock_bh(&pool->lock);
bitmap_clear(pool->bmap, i, count);
...
}
If cpu_possible_mask has no holes, position and CPU id are the same.
If it has holes, they differ.
With possible = {0,2,3}, CPU 3 is at position 2. So
cxgbi_ppm_ppod_release()->ppm_unmark_entries() clears CPU 3's entries in
CPU 2's pool:
- CPU 3's bits are never freed.
- CPU 2 can hand out an index that is still in use, so two live DDP tags
could share one hardware page pod.
With possible = {0,2}, CPU 2's entries decode to cpu 1, which is not a
possible CPU. per_cpu_ptr(ppm->pool, 1) then points at a slot that was
never memset() or spin_lock_init()'d. The code takes a lock in it and
clears bits in it.
The new pr_debug() above also prints this position as "cpu".
The v1 changelog says "ppm_unmark_entries() derives the owning pool from
the index itself". After this patch, the index it decodes no longer
matches how ppm_get_cpu_entries() builds it.
Should ppm_unmark_entries() be updated as well? For example, it could
find the possible CPU whose [base, base + pool_index_max) range holds
the index, or the owning CPU could be recorded.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261109180748.33682-1-haoranwangsec%40gmail.com
Re: [PATCH v4] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: netdev-bot+sashiko
Date: Thu, 12 Nov 2026 02:59
Date: Thu, 12 Nov 2026 02:59
136 lines
13082 bytes
13082 bytes
Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · Low: 1
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [High] The allocation and free paths no longer agree on how a per-CPU
pool index is encoded.
- [Low] The commit fixes a user-visible PREEMPT_RT bug: `spin_lock_bh()`,
which is a sleeping rt_mutex-based lock on RT, is taken inside a…
--
libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
This patch replaces the get_cpu()/per_cpu_ptr()/put_cpu() sequence in
ppm_get_cpu_entries() with raw_cpu_ptr(). As a result, spin_lock_bh() is
no longer taken with preemption disabled on PREEMPT_RT. It also stores a
base index in each per-CPU pool in ppm_alloc_cpu_pool(), and builds the
global ppod index from pool->base instead of cpu * pool_index_max.
> diff --git a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> index 2e3973a32d9d1..708013623c2f7 100644
> --- a/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> +++ b/drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c
> @@ -119,16 +119,13 @@ static int ppm_get_cpu_entries(struct cxgbi_ppm *ppm, unsigned int count,
> unsigned long caller_data)
> {
> struct cxgbi_ppm_pool *pool;
> - unsigned int cpu;
> int i;
>
> if (!ppm->pool)
> return -EINVAL;
>
> - cpu = get_cpu();
> - pool = per_cpu_ptr(ppm->pool, cpu);
> + pool = raw_cpu_ptr(ppm->pool);
> spin_lock_bh(&pool->lock);
> - put_cpu();
[Severity: Low]
Should this patch have a Fixes: tag? The get_cpu(); per_cpu_ptr();
spin_lock_bh(); put_cpu(); sequence appears to come from:
Fixes: 47da7e62b391 ("cxgb4: add iSCSI DDP page pod manager")
Commit a248384e6420 later moved it into libcxgb_ppm.c. Without the tag,
it is harder for stable maintainers to tell which trees need this fix.
[ ... ]
> @@ -144,11 +141,12 @@ static int ppm_get_cpu_entries(struct cxgbi_ppm *ppm, unsigned int count,
>
> spin_unlock_bh(&pool->lock);
>
> - pr_debug("%s: cpu %u, idx %d + %d (%d), next %u.\n",
> - __func__, cpu, i, count, i + cpu * ppm->pool_index_max,
> - pool->next);
> + pr_debug("%s: cpu %u, pool cpu %u, idx %d + %d (%d), next %u.\n",
> + __func__, raw_smp_processor_id(),
> + pool->base / ppm->pool_index_max, i, count, i + pool->base,
> + pool->next);
>
> - i += cpu * ppm->pool_index_max;
> + i += pool->base;
> ppm_mark_entries(ppm, i, count, caller_data);
>
> return i;
> @@ -375,6 +373,7 @@ ppm_alloc_cpu_pool(unsigned int *total, unsigned int *pcpu_ppmax)
>
> memset(ppool, 0, alloc_sz);
> spin_lock_init(&ppool->lock);
> + ppool->base = count;
> count += ppmax;
> }
[Severity: High]
Do the alloc and free paths still agree on the index encoding when
cpu_possible_mask has holes?
for_each_possible_cpu() sets base from the pool's position in the
possible mask (0, ppmax, 2 * ppmax, ...), not from cpu * ppmax.
ppm_get_cpu_entries() now returns i + pool->base. ppm_unmark_entries()
was not changed, and it still decodes the index as a cpu id:
drivers/net/ethernet/chelsio/libcxgb/libcxgb_ppm.c:ppm_unmark_entries() {
...
cpu = i / ppm->pool_index_max;
i %= ppm->pool_index_max;
pool = per_cpu_ptr(ppm->pool, cpu);
spin_lock_bh(&pool->lock);
bitmap_clear(pool->bmap, i, count);
...
}
Take a possible mask of {0,2}. CPU 2's pool gets base = 1 * ppmax, and
the release path through cxgbi_ppm_ppod_release()->ppm_unmark_entries()
computes cpu = 1. CPU 1 is not possible. setup_per_cpu_areas() in
mm/percpu.c only fills __per_cpu_offset[] for possible CPUs, so
per_cpu_ptr(ppm->pool, 1) does not point into this allocation.
Can spin_lock_bh(), bitmap_clear() and the pool->next store then write to
unrelated kernel memory?
Now take a possible mask of {0,2,3}. Entries from CPU 3's pool
(position 2) would be released into CPU 2's real pool.
Could that clear bits that CPU 2 has already handed out? If so, the same
page-pod index could be given to a second DDP tag while the first is
still in use, and CPU 3's bits would never be cleared.
The commit message says:
the free path ppm_unmark_entries() derives the owning pool from the
index instead of from the running CPU, so any thread can service any
shard.
That only holds while pool->base / pool_index_max equals the cpu id. The
new "pool cpu" label in pr_debug() makes the same assumption. The 2-CPU
stress test runs with a contiguous mask, so it would not reach this case.
The old cpu * ppmax encoding was also wrong on sparse masks, because it
could run past pool_rsvd into the general pool. Would it work to either
update ppm_unmark_entries() to map the index back to the pool in the
same way, or keep base = cpu * ppmax and size pool_rsvd from nr_cpu_ids?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261110165742.1204-1-haoranwangsec%40gmail.com
Re: [PATCH v4] libcxgb: use raw_cpu_ptr() in ppm_get_cpu_entries()
Author: Jakub Kicinski
Date: Thu, 19 Nov 2026 01:15
Date: Thu, 19 Nov 2026 01:15
17 lines
8722 bytes
8722 bytes
On Tue, 10 Nov 2026 09:02:51 +0000 netdev-bot+sinfo@kernel.org wrote: > This is an automated message. This series looks like a fix, but its > commit messages seem to be missing some information: > > - How the issue was discovered, e.g. hit in production, hit during > development, syzbot report, manual code inspection, LLM or static > analysis tool scan. > > - Whether the issue was actually triggered, or is only theoretical > (e.g. found by code inspection). If it was triggered please include > the symptoms, like the stack trace or error messages. If / when you post v5 please answer these questions in the commit msg. Please *do not* submit v5 in the same thread/in-reply to previous posting, start a new thread.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads