Allow to set single values on percpu maps with python
- Dominant language
- C
- Stars
- 22.7k
- Forks
- 4.1k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 3
Description
I'm using a percpu_hash and I need to modify the value on a map specific to a cpu from the userland.
As introduced with the PR #458 the map can be modified via the python binding but the entry of all maps has to be modified at the same time.
This is something I need to avoid since I don't want to modify the entries of maps belonging to other CPUs.
Currently I'm doing something like:
```
global_value = bpf_map[key]
global_value[cpu] = 0
bpf_map[key] = global_value
```
However between the read at line 1 and the write at line 3 the value of the maps not belonging to `cpu` and copied in `global_value` could have been changed.
Is there a way to only update the map belonging to `cpu`?
Contributor guide
No contributing guide indexed for this repository
Research direction
Review PR #458 and the Python binding entry point for percpu_hash map access first. Trace how bpf_map[key] reads and writes all CPU values, then identify the binding and tests that cover per-CPU updates. Done means userland can update only the selected CPU's map entry without overwriting concurrent changes on other CPUs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, python
- Domain
- operating-systems, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100