Thread (603 messages) 603 messages, 6 authors, 1d ago

Re: [PATCH v5 17/19] drivers: release DPAA bpid on driver destructor

flat view

From: Stephen Hemminger <stephen@networkplumber.org>
Date: 2026-06-26 17:03:26

On Fri, 26 Jun 2026 12:26:53 +0530
Hemant Agrawal [off-list ref] wrote:
From: Jun Yang <redacted>

Track allocated BPIDs in a static per-BPID flag table and register a
driver destructor that releases any BPIDs still marked as in use at
process exit. This prevents BPID leaks when an application exits without
calling rte_mempool_free(). Also tune the per-lcore mempool cache flush
threshold to match the hardware bulk release size (DPAA_MBUF_MAX_ACQ_REL)
so that buffers are returned to HW in optimal burst sizes.

Signed-off-by: Jun Yang <redacted>
---
Build with ASAN fails with this patch.
Simple fix is usually replacing all use of rte_memcpy with memcpy.
Rte_memcpy on x86 confuses ASAN and it thinks certain sizes reference past
end of buffer. I would just do a global replace of rte_memcpy with memcpy
across all of drivers/bus/dpaa none of this is performance critical on old
versions of Gcc which is the only reason rte_memcpy still exists.

This needs to be fixed before merging.

In file included from /usr/lib/gcc/x86_64-linux-gnu/15/include/immintrin.h:43,
                 from /usr/lib/gcc/x86_64-linux-gnu/15/include/x86intrin.h:32,
                 from ../lib/eal/x86/include/rte_vect.h:24,
                 from ../lib/eal/x86/include/rte_memcpy.h:17,
                 from ../drivers/bus/dpaa/base/qbman/bman.c:7:
In function ‘_mm256_loadu_si256’,
    inlined from ‘rte_mov32’ at ../lib/eal/x86/include/rte_memcpy.h:119:9,
    inlined from ‘rte_mov64’ at ../lib/eal/x86/include/rte_memcpy.h:158:2,
    inlined from ‘rte_mov128’ at ../lib/eal/x86/include/rte_memcpy.h:169:2,
    inlined from ‘rte_memcpy_generic_more_than_64’ at ../lib/eal/x86/include/rte_memcpy.h:389:4,
    inlined from ‘rte_memcpy’ at ../lib/eal/x86/include/rte_memcpy.h:715:10,
    inlined from ‘bman_release_fast’ at ../drivers/bus/dpaa/base/qbman/bman.c:296:3:
/usr/lib/gcc/x86_64-linux-gnu/15/include/avxintrin.h:873:10: warning: array subscript ‘__m256i_u[1]’ is partly outside array bounds of ‘struct bm_buffer[8]’ [-Warray-bounds=]
  873 |   return *__P;
      |          ^~~~
../drivers/bus/dpaa/base/qbman/bman.c: In function ‘bman_release_fast’:
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset 40 into object ‘bm_bufs’ of size 64
  270 |         struct bm_buffer bm_bufs[FSL_BM_BURST_MAX];
      |                          ^~~~~~~
In function ‘_mm256_loadu_si256’,
    inlined from ‘rte_mov32’ at ../lib/eal/x86/include/rte_memcpy.h:119:9,
    inlined from ‘rte_mov64’ at ../lib/eal/x86/include/rte_memcpy.h:157:2,
    inlined from ‘rte_mov128’ at ../lib/eal/x86/include/rte_memcpy.h:170:2,
    inlined from ‘rte_memcpy_generic_more_than_64’ at ../lib/eal/x86/include/rte_memcpy.h:389:4,
    inlined from ‘rte_memcpy’ at ../lib/eal/x86/include/rte_memcpy.h:715:10,
    inlined from ‘bman_release_fast’ at ../drivers/bus/dpaa/base/qbman/bman.c:296:3:
/usr/lib/gcc/x86_64-linux-gnu/15/include/avxintrin.h:873:10: warning: array subscript 2 is outside array bounds of ‘struct bm_buffer[8]’ [-Warray-bounds=]
  873 |   return *__P;
      |          ^~~~
../drivers/bus/dpaa/base/qbman/bman.c: In function ‘bman_release_fast’:
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset 72 into object ‘bm_bufs’ of size 64
  270 |         struct bm_buffer bm_bufs[FSL_BM_BURST_MAX];
      |                          ^~~~~~~
In function ‘_mm256_loadu_si256’,
    inlined from ‘rte_mov32’ at ../lib/eal/x86/include/rte_memcpy.h:119:9,
    inlined from ‘rte_mov64’ at ../lib/eal/x86/include/rte_memcpy.h:158:2,
    inlined from ‘rte_mov128’ at ../lib/eal/x86/include/rte_memcpy.h:170:2,
    inlined from ‘rte_memcpy_generic_more_than_64’ at ../lib/eal/x86/include/rte_memcpy.h:389:4,
    inlined from ‘rte_memcpy’ at ../lib/eal/x86/include/rte_memcpy.h:715:10,
    inlined from ‘bman_release_fast’ at ../drivers/bus/dpaa/base/qbman/bman.c:296:3:
/usr/lib/gcc/x86_64-linux-gnu/15/include/avxintrin.h:873:10: warning: array subscript 3 is outside array bounds of ‘struct bm_buffer[8]’ [-Warray-bounds=]
  873 |   return *__P;
      |          ^~~~
../drivers/bus/dpaa/base/qbman/bman.c: In function ‘bman_release_fast’:
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset 104 into object ‘bm_bufs’ of size 64
  270 |         struct bm_buffer bm_bufs[FSL_BM_BURST_MAX];
      |                          ^~~~~~~
In function ‘_mm256_loadu_si256’,
    inlined from ‘rte_mov32’ at ../lib/eal/x86/include/rte_memcpy.h:119:9,
    inlined from ‘rte_mov64’ at ../lib/eal/x86/include/rte_memcpy.h:158:2,
    inlined from ‘rte_memcpy_generic_more_than_64’ at ../lib/eal/x86/include/rte_memcpy.h:396:4,
    inlined from ‘rte_memcpy’ at ../lib/eal/x86/include/rte_memcpy.h:715:10,
    inlined from ‘bman_release_fast’ at ../drivers/bus/dpaa/base/qbman/bman.c:296:3:
/usr/lib/gcc/x86_64-linux-gnu/15/include/avxintrin.h:873:10: warning: array subscript ‘__m256i_u[1]’ is partly outside array bounds of ‘const void[64]’ [-Warray-bounds=]
  873 |   return *__P;
      |          ^~~~
../drivers/bus/dpaa/base/qbman/bman.c: In function ‘bman_release_fast’:
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [40, 48] into object ‘bm_bufs’ of size 64
  270 |         struct bm_buffer bm_bufs[FSL_BM_BURST_MAX];
      |                          ^~~~~~~
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [41, 64] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [168, 176] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [40, 48] into object ‘bm_bufs’ of size 64
In function ‘_mm256_loadu_si256’,
    inlined from ‘rte_mov32’ at ../lib/eal/x86/include/rte_memcpy.h:119:9,
    inlined from ‘rte_memcpy_generic_more_than_64’ at ../lib/eal/x86/include/rte_memcpy.h:401:4,
    inlined from ‘rte_memcpy’ at ../lib/eal/x86/include/rte_memcpy.h:715:10,
    inlined from ‘bman_release_fast’ at ../drivers/bus/dpaa/base/qbman/bman.c:296:3:
/usr/lib/gcc/x86_64-linux-gnu/15/include/avxintrin.h:873:10: warning: array subscript [2, 66] is outside array bounds of ‘const void[64]’ [-Warray-bounds=]
  873 |   return *__P;
      |          ^~~~
../drivers/bus/dpaa/base/qbman/bman.c: In function ‘bman_release_fast’:
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [8, 64] into object ‘bm_bufs’ of size 64
  270 |         struct bm_buffer bm_bufs[FSL_BM_BURST_MAX];
      |                          ^~~~~~~
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [9, 64] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [136, 208] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [8, 64] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [9, 64] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [136, 208] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [8, 64] into object ‘bm_bufs’ of size 64
In function ‘_mm256_loadu_si256’,
    inlined from ‘rte_mov32’ at ../lib/eal/x86/include/rte_memcpy.h:119:9,
    inlined from ‘rte_memcpy_generic_more_than_64’ at ../lib/eal/x86/include/rte_memcpy.h:402:4,
    inlined from ‘rte_memcpy’ at ../lib/eal/x86/include/rte_memcpy.h:715:10,
    inlined from ‘bman_release_fast’ at ../drivers/bus/dpaa/base/qbman/bman.c:296:3:
/usr/lib/gcc/x86_64-linux-gnu/15/include/avxintrin.h:873:10: warning: array subscript [2, 67] is outside array bounds of ‘const void[64]’ [-Warray-bounds=]
  873 |   return *__P;
      |          ^~~~
../drivers/bus/dpaa/base/qbman/bman.c: In function ‘bman_release_fast’:
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [9, 64] into object ‘bm_bufs’ of size 64
  270 |         struct bm_buffer bm_bufs[FSL_BM_BURST_MAX];
      |                          ^~~~~~~
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [10, 64] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [137, 209] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [9, 64] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [10, 64] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [137, 209] into object ‘bm_bufs’ of size 64
../drivers/bus/dpaa/base/qbman/bman.c:270:26: note: at offset [9, 64] into object ‘bm_bufs’ of size 64
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help