Re: [PATCH 2/2] perf test: Test FASYNC with watermark wakeups.

From: Arnaldo Carvalho de Melo
Date: Fri Feb 23 2024 - 12:59:42 EST


On Fri, Feb 23, 2024 at 09:35:29AM -0800, Kyle Huey wrote:
> On Thu, Feb 22, 2024 at 11:54 AM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > fd = sys_perf_event_open(&attr, 0, -1, -1, perf_event_open_cloexec_flag());
> > if (fd < 0) {
> > if (attr_has_sigtrap()) {
> > pr_debug("FAILED sys_perf_event_open(): %s\n",
> > str_error_r(errno, sbuf, sizeof(sbuf)));
> > } else {
> > pr_debug("perf_event_attr doesn't have sigtrap\n");
> > ret = TEST_SKIP;
> > }
> > goto out_restore_sigaction;

> I think perhaps I'm barking up the wrong tree here. This seems like a
> ton of work just to write a regression test. Maybe I should be doing
> this in tools/testing/selftests instead?

Well, if it tests a perf feature, then yeah, that would be better placed
in 'perf test'.

Maybe you can just assume this will run just on modern kernels where
this feature is expected to be present and then add some pr_debug()
stating that maybe this feature is not present in the kernel.

For the vast majority of cases this will be enough, so that is what I
encourage you to do now.

Its possible that distros, like Red Hat, end up backporting first the
perf tools with this test and not the feature it is being tested, if
that happens, then it will eventually come to my attention and I will be
able to do the BTF treatment, as in that case even a test based on the
kernel version would be insufficient.

- Arnaldo