bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Hwang <hffilwlqm@gmail.com>
To: paulmck@kernel.org, Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Leon Hwang <leon.hwang@linux.dev>, bpf <bpf@vger.kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Andrii Nakryiko <andrii@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Jiri Olsa <jolsa@kernel.org>
Subject: Re: [BUG] Deadlock triggered by bpfsnoop funcgraph feature
Date: Fri, 29 Aug 2025 10:21:35 +0800	[thread overview]
Message-ID: <42f91ff0-b7bf-4ab8-90fe-4ce42eb6bb75@gmail.com> (raw)
In-Reply-To: <8ab6e14b-e639-413e-91cc-56dc02d1a4fb@paulmck-laptop>



On 29/8/25 01:24, Paul E. McKenney wrote:
> On Thu, Aug 28, 2025 at 09:43:00AM -0700, Alexei Starovoitov wrote:
>> On Thu, Aug 28, 2025 at 6:39 AM Leon Hwang <leon.hwang@linux.dev> wrote:
>>>
>>> On Thu Aug 28, 2025 at 7:50 PM +08, Paul E. McKenney wrote:

[...]

>>>
>>> I think it would be better to add "notrace" to following functions:
>>>
>>> ./bpfsnoop -k 'rcu_read_*lock_*held*,rcu_lockdep_*' --show-func-proto
>>> bool rcu_lockdep_current_cpu_online(); [traceable]
>>> int rcu_read_lock_any_held(); [traceable]
>>> int rcu_read_lock_bh_held(); [traceable]
>>> int rcu_read_lock_held(); [traceable]
>>> int rcu_read_lock_sched_held(); [traceable]
>>
>> Agree. Seems like an easy way to remove a footgun.
> 
> Very good, and please see below.  This might or might not make the next
> merge window, but if not, it should be good for the one after that.
> 
>> Independently it would be good to make noinstr/notrace to include __cpuidle
>> functions. I think right now it's allowed to attach to default_idle()
>> which is causing issues.

Nope.
./bpfsnoop -k 'default_idle' -k '__cpuidle' --show-func-proto
void default_idle();

Here are the traced functions of
./bpfsnoop -D -k "htab_*_elem" --output-fgraph --fgraph-debug
--fgraph-exclude
'rcu_read_lock_*held,rcu_lockdep_current_cpu_online,*raw_spin_*lock*,kvfree,show_stack,put_task_stack':

htab_lru_map_delete_elem
htab_lru_map_lookup_and_delete_elem
htab_lru_map_lookup_elem
htab_lru_map_update_elem
htab_lru_percpu_map_lookup_and_delete_elem
htab_lru_percpu_map_lookup_elem
htab_lru_percpu_map_lookup_percpu_elem
htab_lru_percpu_map_update_elem
htab_map_delete_elem
htab_map_lookup_and_delete_elem
htab_map_lookup_elem
htab_map_seq_show_elem
htab_map_update_elem
htab_of_map_lookup_elem
htab_percpu_map_lookup_and_delete_elem
htab_percpu_map_lookup_elem
htab_percpu_map_lookup_percpu_elem
htab_percpu_map_seq_show_elem
htab_percpu_map_update_elem
add_taint
alloc_htab_elem
arch_scale_cpu_capacity
arch_stack_walk
bpf_list_head_free
__bpf_obj_drop_impl
bpf_obj_free_fields
__bpf_prog_put
bpf_prog_put
bpf_rb_root_free
bpf_timer_cancel_and_free
bpf_wq_cancel_and_free
btf_find_struct_meta
btf_is_kernel
btf_type_seq_show
btf_type_seq_show_flags
btf_type_show
check_and_free_fields
check_panic_on_warn
check_timeout
clear_pending_if_disabled
console_verbose
copy_map_value_locked
ctx_sched_out
__delayacct_blkio_start
__do_set_cpus_allowed
do_trace_write_msr
enter_lazy_tlb
__folio_put
__folio_unqueue_deferred_split
free_frozen_pages
free_htab_elem
free_huge_folio
get_free_pages_noprof
get_state_synchronize_rcu
get_state_synchronize_rcu_full
get_taint
hrtick_start_fair
hrtimer_active
hrtimer_cancel
hrtimer_setup
hrtimer_start_range_ns
__htab_lru_percpu_map_update_elem
__htab_map_lookup_and_delete_elem
__htab_map_lookup_elem
htab_map_update_elem_in_place
invalidate_user_asid
__is_kernel_percpu_address
is_kernel_percpu_address
is_module_address
__is_module_percpu_address
is_module_percpu_address
is_vmalloc_addr
kallsyms_lookup
kexec_crash_loaded
kvfree_call_rcu
local_clock
__mem_cgroup_uncharge
__might_sleep
mm_needs_global_asid
mod_node_page_state
__msecs_to_jiffies
nbcon_cpu_emergency_enter
nbcon_cpu_emergency_exit
nbcon_get_cpu_emergency_nesting
pcpu_copy_value
perf_cgroup_switch
perf_clear_dirty_counters
perf_ctx_disable
perf_ctx_enable
perf_ctx_sched_task_cb
__perf_event_task_sched_out
perf_event_update_time
perf_event_update_userpage
perf_exclude_event
perf_pmu_sched_task
___perf_sw_event
perf_swevent_event
pick_next_task_fair
pick_task_fair
pick_task_fair
pick_task_idle
preempt_model_str
__printk_cpu_sync_put
__printk_cpu_sync_try_get
__printk_cpu_sync_wait
printk_percpu_data_ready
print_modules
print_stop_info
print_tainted
print_tainted_verbose
print_worker_info
profile_hits
put_prev_entity
queue_delayed_work_on
queued_spin_lock_slowpath
__queue_work
queue_work_on
rcu_note_context_switch
rcu_qs
rcu_report_exp_cpu_mult
rcu_tasks_trace_qs_blkd
rcu_trc_cmpxchg_need_qs
resilient_queued_spin_lock_slowpath
sched_balance_newidle
__schedule_bug
__schedule_delayed_monitor_work
seq_putc
seq_write
set_next_entity
stack_trace_print
stack_trace_save
switch_ldt
switch_mm_irqs_off
synchronize_rcu
task_h_load
task_work_add
this_cpu_in_panic
touch_all_softlockup_watchdogs
__traceiter_contention_begin
__traceiter_contention_end
__traceiter_lock_acquire
__traceiter_lock_release
__traceiter_rcu_preempt_task
__traceiter_sched_entry_tp
__traceiter_sched_exit_tp
__traceiter_tlb_flush
unpin_user_page
__update_context_time
update_rq_clock

> 
> Leon, would you be interested in putting together a patch for these?
> 

I think we can apply this patch first.

If other patch is required, I would like to send it later.

Thanks,
Leon


  reply	other threads:[~2025-08-29  2:21 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-27  2:13 [BUG] Deadlock triggered by bpfsnoop funcgraph feature Leon Hwang
2025-08-27  2:23 ` Alexei Starovoitov
2025-08-27  2:58   ` Leon Hwang
2025-08-28  0:42     ` Alexei Starovoitov
2025-08-28  2:40       ` Leon Hwang
2025-08-28 11:50         ` Paul E. McKenney
2025-08-28 13:39           ` Leon Hwang
2025-08-28 16:43             ` Alexei Starovoitov
2025-08-28 17:24               ` Paul E. McKenney
2025-08-29  2:21                 ` Leon Hwang [this message]
2025-08-29 18:08                   ` Alexei Starovoitov
2025-09-01  2:38                     ` Leon Hwang

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=42f91ff0-b7bf-4ab8-90fe-4ce42eb6bb75@gmail.com \
    --to=hffilwlqm@gmail.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=jolsa@kernel.org \
    --cc=leon.hwang@linux.dev \
    --cc=paulmck@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).