-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpf: smp_wmb before bpf_ringbuf really commit #7993
base: bpf-next_base
Are you sure you want to change the base?
Conversation
Upstream branch: e626a13 |
3c8d365
to
8f9bc60
Compare
Upstream branch: e5e4799 |
ad85627
to
f746b14
Compare
8f9bc60
to
103c737
Compare
Upstream branch: 4d99e50 |
f746b14
to
fd2664f
Compare
103c737
to
0e4003e
Compare
Upstream branch: 77017b9 |
fd2664f
to
ad7eb7f
Compare
0e4003e
to
5e2942e
Compare
Upstream branch: f2daa5a |
ad7eb7f
to
33a59fa
Compare
5e2942e
to
3e790e1
Compare
Upstream branch: 9a78313 |
33a59fa
to
af3e042
Compare
3e790e1
to
2f0c8a7
Compare
To guarantee visibility of writing ringbuffer,it is necessary to call smp_wmb before ringbuffer really commit. for instance, when updating the data of buffer in cpu1, it is not visible for the cpu2 which may be accessing buffer. This may lead to the consumer accessing a incorrect data. using the smp_wmb before commmit will guarantee that the consume can access the correct data. CPU1: struct mem_event_t* data = bpf_ringbuf_reserve(); data->type = MEM_EVENT_KSWAPD_WAKE; data->event_data.kswapd_wake.node_id = args->nid; bpf_ringbuf_commit(data); CPU2: cons_pos = smp_load_acquire(r->consumer_pos); len_ptr = r->data + (cons_pos & r->mask); sample = (void *)len_ptr + BPF_RINGBUF_HDR_SZ; access to sample Signed-off-by: zhongjinji <[email protected]>
Upstream branch: 1850ce1 |
af3e042
to
b58face
Compare
Pull request for series with
subject: bpf: smp_wmb before bpf_ringbuf really commit
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=904951