On Tue, Apr 09 2024 at 13:10, Oleg Nesterov wrote:
> On 04/09, Thomas Gleixner wrote:
> It seems that this is because in your tree check_timer_distribution() does
>
>       if (timer_delete(id)) {
>               ksft_perror("Can't delete timer");
>               return 0;
>       }
>
> while in Linus's tree it returns -1 if timer_delete()
> fails. Nevermind.

Ooops.

>> +static bool check_kernel_version(unsigned int min_major, unsigned int 
>> min_minor)
>> +{
>> +    unsigned int major, minor;
>> +    struct utsname info;
>> +
>> +    uname(&info);
>> +    if (sscanf(info.release, "%u.%u.", &major, &minor) != 2)
>> +            ksft_exit_fail();
>> +    return major > min_major || (major == min_major && minor >= min_minor);
>> +}
>
> this looks useful regardless. Perhaps it should be moved into
> tools/testing/selftests/kselftest.h as ksft_ck_kernel_version() ?

Makes sense.

>> +static int check_timer_distribution(void)
>> +{
>> +    const char *errmsg;
>> +
>> +    if (!check_kernel_version(6, 3)) {
>> +            ksft_test_result_skip("check signal distribution (old 
>> kernel)\n");
>>              return 0;
>
> ..
>
>> +    ksft_test_result(!ctd_failed, "check signal distribution\n");
>
> Perhaps
>
>       if (!ctd_failed)
>               ksft_test_result_pass("check signal distribution\n");
>       else if (check_kernel_version(6, 3))
>               ksft_test_result_fail("check signal distribution\n");
>       else
>               ksft_test_result_skip("check signal distribution (old 
> kernel)\n");
>
> makes more sense?
>
> This way it can be used on the older kernels with bcb7ee79029d backported.

Indeed.

Reply via email to