From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> On PowerPC 64 which has 64K pages, it screws up the accounting of some calculations used for tests. For instance, 1% of the ring buffer may not be more than a page. So testing 1% and then subtracting the number of events per page is going to lead to a negative number. This will obviously fail. Take into account that the subbuffer may be very large, and to make a minimum percent to use in case a subbuffer size is greater than 1%. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=219358 Reported-by: Adrien Nader <adrien@xxxxxxxx> Signed-off-by: Steven Rostedt (Google) <rostedt@xxxxxxxxxxx> --- utest/tracefs-utest.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/utest/tracefs-utest.c b/utest/tracefs-utest.c index 742f4546bef0..b5095a18bb16 100644 --- a/utest/tracefs-utest.c +++ b/utest/tracefs-utest.c @@ -1340,6 +1340,17 @@ static void test_cpu_read_buf_percent(struct test_cpu_data *data, int percent) /* For percent == 0, just test for any data */ if (percent) { + int min_percent; + + /* + * For architectures like PowerPC with 64K PAGE_SIZE and thus + * large sub buffers, where we will not have over 100 sub buffers + * percent must at least cover more than 1 sub buffer. + */ + min_percent = (100 + (data->nr_subbufs - 1)) / data->nr_subbufs; + if (percent < min_percent) + percent = min_percent; + expect = data->nr_subbufs * data->events_per_buf * percent / 100; /* Add just under the percent */ -- 2.45.2