All of lore.kernel.org
 help / color / mirror / Atom feed
From: Saket Kumar Bhaskar <skb99@linux.ibm.com>
To: bpf@vger.kernel.org
Cc: ast@kernel.org, andrii@kernel.org, daniel@iogearbox.net,
	puranjay@kernel.org, puranjay12@gmail.com,
	hbathini@linux.ibm.com
Subject: [BUG] poweprc64/bpf: bpf arena broken after kmalloc_nolock() change
Date: Tue, 9 Dec 2025 12:49:40 +0530	[thread overview]
Message-ID: <aTfNjDu1Lbc-LPtO@linux.ibm.com> (raw)

Hi,

On powerpc, bpf arena support was enabled by:
  a2485d06cad3 ("powerpc64/bpf: Implement bpf_addr_space_cast instruction")
and the status of selftests was:

# ./test_progs -t arena
#3/1     arena_atomics/add:OK
#3/2     arena_atomics/sub:OK
#3/3     arena_atomics/and:OK
#3/4     arena_atomics/or:OK
#3/5     arena_atomics/xor:OK
#3/6     arena_atomics/cmpxchg:OK
#3/7     arena_atomics/xchg:OK
#3/8     arena_atomics/uaf:OK
#3/9     arena_atomics/load_acquire:SKIP
#3/10    arena_atomics/store_release:SKIP
#3       arena_atomics:OK (SKIP: 2/10)
#4/1     arena_htab/arena_htab_llvm:OK
#4/2     arena_htab/arena_htab_asm:OK
#4       arena_htab:OK
#5/1     arena_list/arena_list_1:OK
#5/2     arena_list/arena_list_1000:OK
#5       arena_list:OK
#6/1     arena_spin_lock/arena_spin_lock_1:SKIP
#6/2     arena_spin_lock/arena_spin_lock_1000:SKIP
#6/3     arena_spin_lock/arena_spin_lock_50000:SKIP
#6       arena_spin_lock:SKIP
#7/1     arena_strsearch/arena_strsearch:OK
#7       arena_strsearch:OK
#417     stream_arena_fault_address:SKIP
tester_init:pass:tester_log_buf 0 nsec
process_subtest:pass:obj_open_mem 0 nsec
process_subtest:pass:specs_alloc 0 nsec
#504/1   verifier_arena/basic_alloc1:OK
#504/2   verifier_arena/basic_alloc2:OK
#504/3   verifier_arena/basic_alloc3:OK
#504/4   verifier_arena/basic_reserve1:OK
#504/5   verifier_arena/basic_reserve2:OK
#504/6   verifier_arena/reserve_twice:OK
run_subtest:pass:obj_open_mem 0 nsec
run_subtest:pass:unexpected_load_failure 0 nsec
do_prog_test_run:pass:bpf_prog_test_run 0 nsec
run_subtest:fail:1299 Unexpected retval: 4 != 0
#504/7   verifier_arena/reserve_invalid_region:FAIL
#504/8   verifier_arena/iter_maps1:OK
#504/9   verifier_arena/iter_maps2:OK
#504/10  verifier_arena/iter_maps3:OK
#504     verifier_arena:FAIL
#505/1   verifier_arena_large/big_alloc1:OK
#505/2   verifier_arena_large/access_reserved:OK
#505/3   verifier_arena_large/request_partially_reserved:OK
#505/4   verifier_arena_large/free_reserved:OK
#505/5   verifier_arena_large/big_alloc2:OK
#505     verifier_arena_large:OK

All error logs:
tester_init:pass:tester_log_buf 0 nsec
process_subtest:pass:obj_open_mem 0 nsec
process_subtest:pass:specs_alloc 0 nsec
run_subtest:pass:obj_open_mem 0 nsec
run_subtest:pass:unexpected_load_failure 0 nsec
do_prog_test_run:pass:bpf_prog_test_run 0 nsec
run_subtest:fail:1299 Unexpected retval: 4 != 0
#504/7   verifier_arena/reserve_invalid_region:FAIL
#504     verifier_arena:FAIL
Summary: 7/27 PASSED, 6 SKIPPED, 1 FAILED


After commit f8c67d8550ee("bpf: Use kmalloc_nolock() in range tree") all
arena related selftests are failing for powerpc:

All error logs:
test_arena_atomics:pass:arena atomics skeleton open 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
libbpf: failed to load BPF skeleton 'arena_atomics': -ENOMEM
test_arena_atomics:fail:arena atomics skeleton load unexpected error: -12 (errno 12)
#3       arena_atomics:FAIL
libbpf: map 'arena': failed to create: -ENOMEM
libbpf: failed to load BPF skeleton 'arena_htab': -ENOMEM
test_arena_htab_llvm:fail:arena_htab__open_and_load unexpected error: -12
#4/1     arena_htab/arena_htab_llvm:FAIL
libbpf: map 'arena': failed to create: -ENOMEM
libbpf: failed to load BPF skeleton 'arena_htab_asm': -ENOMEM
test_arena_htab_asm:fail:arena_htab_asm__open_and_load unexpected error: -12
#4/2     arena_htab/arena_htab_asm:FAIL
#4       arena_htab:FAIL
libbpf: map 'arena': failed to create: -ENOMEM
libbpf: failed to load BPF skeleton 'arena_list': -ENOMEM
test_arena_list_add_del:fail:arena_list__open_and_load unexpected error: -12
#5/1     arena_list/arena_list_1:FAIL
libbpf: map 'arena': failed to create: -ENOMEM
libbpf: failed to load BPF skeleton 'arena_list': -ENOMEM
test_arena_list_add_del:fail:arena_list__open_and_load unexpected error: -12
#5/2     arena_list/arena_list_1000:FAIL
#5       arena_list:FAIL
libbpf: map 'arena': failed to create: -ENOMEM
libbpf: failed to load BPF skeleton 'arena_spin_lock': -ENOMEM
test_arena_spin_lock_size:fail:arena_spin_lock__open_and_load unexpected error: -12
#6/1     arena_spin_lock/arena_spin_lock_1:FAIL
libbpf: map 'arena': failed to create: -ENOMEM
libbpf: failed to load BPF skeleton 'arena_spin_lock': -ENOMEM
test_arena_spin_lock_size:fail:arena_spin_lock__open_and_load unexpected error: -12
#6/2     arena_spin_lock/arena_spin_lock_1000:FAIL
libbpf: map 'arena': failed to create: -ENOMEM
libbpf: failed to load BPF skeleton 'arena_spin_lock': -ENOMEM
test_arena_spin_lock_size:fail:arena_spin_lock__open_and_load unexpected error: -12
#6/3     arena_spin_lock/arena_spin_lock_50000:FAIL
#6       arena_spin_lock:FAIL
libbpf: map 'arena': failed to create: -ENOMEM
libbpf: failed to load BPF skeleton 'arena_strsearch': -ENOMEM
test_arena_str:fail:arena_strsearch__open_and_load unexpected error: -12
#7/1     arena_strsearch/arena_strsearch:FAIL
#7       arena_strsearch:FAIL
tester_init:pass:tester_log_buf 0 nsec
process_subtest:pass:obj_open_mem 0 nsec
process_subtest:pass:specs_alloc 0 nsec
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#504/1   verifier_arena/basic_alloc1:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#504/2   verifier_arena/basic_alloc2:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#504/3   verifier_arena/basic_alloc3:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#504/4   verifier_arena/basic_reserve1:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#504/5   verifier_arena/basic_reserve2:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#504/6   verifier_arena/reserve_twice:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#504/7   verifier_arena/reserve_invalid_region:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#504/8   verifier_arena/iter_maps1:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:pass:unexpected_load_success 0 nsec
validate_msgs:fail:920 expect_msg
VERIFIER LOG:
=============
=============
EXPECTED   SUBSTR: 'expected pointer to STRUCT bpf_map'
#504/9   verifier_arena/iter_maps2:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:pass:unexpected_load_success 0 nsec
validate_msgs:fail:920 expect_msg
VERIFIER LOG:
=============
=============
EXPECTED   SUBSTR: 'untrusted_ptr_bpf_map'
#504/10  verifier_arena/iter_maps3:FAIL
#504     verifier_arena:FAIL
tester_init:pass:tester_log_buf 0 nsec
process_subtest:pass:obj_open_mem 0 nsec
process_subtest:pass:specs_alloc 0 nsec
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#505/1   verifier_arena_large/big_alloc1:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#505/2   verifier_arena_large/access_reserved:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#505/3   verifier_arena_large/request_partially_reserved:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
=============
=============
#505/4   verifier_arena_large/free_reserved:FAIL
run_subtest:pass:obj_open_mem 0 nsec
libbpf: map 'arena': failed to create: -ENOMEM
run_subtest:fail:unexpected_load_failure unexpected error: -12 (errno 12)
VERIFIER LOG:
=============
=============
#505/5   verifier_arena_large/big_alloc2:FAIL
#505     verifier_arena_large:FAIL
Summary: 1/0 PASSED, 1 SKIPPED, 7 FAILED

This is because powerpc currently does not support 128-bit cmpxchg and
in-turn kmalloc_nolock() but new range tree implementation unconditionally
uses kmalloc_nolock().

Can use of kmalloc_nolock() be avoided for now or made conditional on
availability of arch support for it? I’m ready to implement a patch 
aligned with your preferred course of action.

Thanks,
Saket

             reply	other threads:[~2025-12-09  7:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-09  7:19 Saket Kumar Bhaskar [this message]
2025-12-10  9:09 ` [BUG] poweprc64/bpf: bpf arena broken after kmalloc_nolock() change Alexei Starovoitov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTfNjDu1Lbc-LPtO@linux.ibm.com \
    --to=skb99@linux.ibm.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=hbathini@linux.ibm.com \
    --cc=puranjay12@gmail.com \
    --cc=puranjay@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.