Re: [PATCH v2 bpf-next 2/7] tools/memory-model: add BPF ringbuf MPSC litmus tests
From: "Paul E. McKenney" <paulmck@kernel.org>
Date: 2020-05-26 03:05:36
Also in:
bpf
On Mon, May 25, 2020 at 04:33:15PM -0700, Andrii Nakryiko wrote:
On Fri, May 22, 2020 at 11:51 AM Andrii Nakryiko [off-list ref] wrote:quoted
On Thu, May 21, 2020 at 5:34 PM Paul E. McKenney [off-list ref] wrote:quoted
On Sun, May 17, 2020 at 12:57:22PM -0700, Andrii Nakryiko wrote:quoted
Add 4 litmus tests for BPF ringbuf implementation, divided into two different use cases. First, two unbounded case, one with 1 producer and another with 2 producers, single consumer. All reservations are supposed to succeed. Second, bounded case with only 1 record allowed in ring buffer at any given time. Here failures to reserve space are expected. Again, 1- and 2- producer cases, single consumer, are validated. Just for the fun of it, I also wrote a 3-producer cases, it took *16 hours* to validate, but came back successful as well. I'm not including it in this patch, because it's not practical to run it. See output for all included 4 cases and one 3-producer one with bounded use case. Each litmust test implements producer/consumer protocol for BPF ring buffer implementation found in kernel/bpf/ringbuf.c. Due to limitations, all records are assumed equal-sized and producer/consumer counters are incremented by 1. This doesn't change the correctness of the algorithm, though.Very cool!!! However, these should go into Documentation/litmus-tests/bpf-rb or similar. Please take a look at Documentation/litmus-tests/ in -rcu, -tip, and -next, including the README file. The tools/memory-model/litmus-tests directory is for basic examples, not for the more complex real-world ones like these guys. ;-)Oh, ok, I didn't realize there are more litmus tests under Documentation/litmus-tests... Might have saved me some time (more examples to learn from!) when I was writing mine :) Will check those and move everything.Ok, so Documentation/litmus-tests is not present in bpf-next, so I guess I'll have to split this patch out and post it separately. BTW, it's not in -rcu tree either, should I post this against linux-next tree directly?
It is on branch "dev" of -rcu, though yet not on branch "master". Thanx, Paul