iovisor / bcc

BCC - Tools for BPF-based Linux IO analysis, networking, monitoring, and more
Apache License 2.0
20.36k stars 3.86k forks source link

Can bpf_spin_lock directly be used in BCC? #4844

Open ganli2015 opened 9 months ago

ganli2015 commented 9 months ago

kernel 5.1, Can I use bpf_spin_lock in BCC like this:

        bpf_spin_lock(&q->lock);  
        u64 stack_id = stack_traces.get_stackid(ctx, STACK_FLAGS);
        bpf_spin_unlock(&q->lock);
chenhengqi commented 9 months ago

No, you can't use bpf_spin_lock in tracing progs as of kernel v5.1. See the conversation here.

ganli2015 commented 9 months ago

No, you can't use bpf_spin_lock in tracing progs as of kernel v5.1. See the conversation here.

And sync_lock_test_and_set or sync_val_compare_and_swap are also not available yet?

Found errors like that. image

chenhengqi commented 9 months ago

This requires -mcpu=v3 features which is not available on v5.1.