[PATCH bpf v4] bpf: zero-fill re-used per-cpu map element

2020-11-04 Thread David Verbeiren
pus remain whatever they were when the re-used entry was previously freed. A selftest is added to validate correct operation in above scenario as well as in case of LRU per-cpu map element re-use. Fixes: 6c9059817432 ("bpf: pre-allocate hash map elements") Acked-by: Matthieu Baerts

[PATCH bpf v3] bpf: zero-fill re-used per-cpu map element

2020-11-03 Thread David Verbeiren
pus remain whatever they were when the re-used entry was previously freed. A selftest is added to validate correct operation in above scenario as well as in case of LRU per-cpu map element re-use. Fixes: 6c9059817432 ("bpf: pre-allocate hash map elements") Acked-by: Matthieu Baerts

Re: [PATCH bpf] selftest/bpf: Validate initial values of per-cpu hash elems

2020-11-02 Thread David Verbeiren
On Thu, Oct 29, 2020 at 11:37 PM Andrii Nakryiko wrote: > > On Thu, Oct 29, 2020 at 11:36 AM Song Liu wrote: > > > > On Thu, Oct 29, 2020 at 4:19 AM David Verbeiren > > wrote: > > > > > > Tests that when per-cpu hash map or LRU hash map elements are

Re: [PATCH bpf v2] bpf: zero-fill re-used per-cpu map element

2020-10-29 Thread David Verbeiren
On Tue, Oct 27, 2020 at 11:55 PM Andrii Nakryiko wrote: > Looks good, but would be good to have a unit test (see below). Maybe > in a follow up. Here is the associated new selftest, implementing the sequence you proposed (thanks for that!), and also one for LRU case: https://lore.kernel.org/bpf/2

[PATCH bpf] selftest/bpf: Validate initial values of per-cpu hash elems

2020-10-29 Thread David Verbeiren
-david.verbei...@tessares.net/ Change-Id: I38bc7b3744ed40704a7b2cc6efa179fb344c4bee Suggested-by: Andrii Nakryiko Signed-off-by: David Verbeiren --- .../selftests/bpf/prog_tests/map_init.c | 204 ++ 1 file changed, 204 insertions(+) create mode 100644 tools/testing/selftests

[PATCH bpf v2] bpf: zero-fill re-used per-cpu map element

2020-10-27 Thread David Verbeiren
pus remain whatever they were when the re-used entry was previously freed. Fixes: 6c9059817432 ("bpf: pre-allocate hash map elements") Acked-by: Matthieu Baerts Signed-off-by: David Verbeiren --- Notes: v2: - Moved memset() to separate pcpu_init_value() function,

Re: [PATCH bpf] bpf: zero-fill re-used per-cpu map element

2020-10-27 Thread David Verbeiren
On Mon, Oct 26, 2020 at 11:48 PM Andrii Nakryiko wrote: > > On Fri, Oct 23, 2020 at 8:48 AM David Verbeiren > wrote: > > [...] > > + if (!onallcpus) > > + for_each_possible_cpu(cpu) > > +

[PATCH bpf] bpf: zero-fill re-used per-cpu map element

2020-10-23 Thread David Verbeiren
other cpus remain whatever they were when the re-used entry was previously freed. Fixes: 6c9059817432 ("bpf: pre-allocate hash map elements") Acked-by: Matthieu Baerts Signed-off-by: David Verbeiren --- kernel/bpf/hashtab.c | 12 1 file changed, 12 insertions(+) diff --git a/