From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86701C001B0 for ; Thu, 13 Jul 2023 14:13:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 27E3D900023; Thu, 13 Jul 2023 10:13:04 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 207F590001C; Thu, 13 Jul 2023 10:13:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 081BE900023; Thu, 13 Jul 2023 10:13:04 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id E821390001C for ; Thu, 13 Jul 2023 10:13:03 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id B8579A01E4 for ; Thu, 13 Jul 2023 14:13:03 +0000 (UTC) X-FDA: 81006780246.13.61B8ACC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf14.hostedemail.com (Postfix) with ESMTP id 346A5100015 for ; Thu, 13 Jul 2023 14:12:58 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hZSvvqyD; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1689257579; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=3/nnrivJjCXjlWiXJUfPLOop1LXmbzPVIWYgCWPNVXA=; b=QszyXID3D5v6NNIvDrVHda3Scr/1WEW0ZIs3lpz7nNpuLE2uxCsbhO2NVZawDg+MNe0Rif c8QUj89owWXErZVYOHrydKMlC7q4TwXptXeGO0qK051KSsezAVa4NSnZpuoTrfEYKjXX9N Rl+9WiGS1szy0VaEi7uefjPFcQYK7p0= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=hZSvvqyD; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf14.hostedemail.com: domain of david@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=david@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689257579; a=rsa-sha256; cv=none; b=cXsxhnK/pZIlyQUgAn+YcBhTHOCpFEhbyrokngK5Hsqrx3QsFK5077sq5yIaifmwj5k9Dm 8UfgL0VEh3uaYhri4Ggi7epn9HcLl26GG0mkdZnTvVegr9sDLN905sanQPMybWN7nO8N5n I5iaaM3+wvOE8fftw+EeTz0WYJqIF+U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689257578; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3/nnrivJjCXjlWiXJUfPLOop1LXmbzPVIWYgCWPNVXA=; b=hZSvvqyDnOqjpMrjkNiPpaslezcU7P5JDsjOkLjRBUSxrvub8Ev9LqXCbj3ZZVTep5vuXW 0qYiCzJH1eM0RZvq1hR751k5Bz3D5m20ew0VMTn6nAbhPOc4Ve+opoqE7bPyOtIaa3FBdU RKNM4yQ1Kmx3TtkrWqDdwjKqZdvQ4Lg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-547-kM8ZJXoENH2dY0WDtsedCw-1; Thu, 13 Jul 2023 10:12:51 -0400 X-MC-Unique: kM8ZJXoENH2dY0WDtsedCw-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-31444df0fafso447225f8f.2 for ; Thu, 13 Jul 2023 07:12:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689257552; x=1691849552; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3/nnrivJjCXjlWiXJUfPLOop1LXmbzPVIWYgCWPNVXA=; b=aUbeXwjFW1uvUyyymxB0D0hcfeMvRx428aHBfaw6zn+djqWnOBP8iVavfMxOYIqKsW sja27LCqopud5eQ8Q22+FXqbzD12wyHzsvfEXdCJ1qwJ2+Q2DgIK5dUhjmBw320zY56J y8gUzMii6iXX/DbHIx1UNSBVybXG+YQzSVLXV7I0Aq4GNotmXHnoRq64Kt79BhvOWaOA khrVSPHpOivQBFj/WCTwKpiHaulbWGlBx5TOUHsX59YJWrCfyVRjFmjaSsgxtLVjXR1+ miCYQNHsZA/mDp8YJnCgwz/I5aerSNYfhCtuN49UVeVs6yxZw0h8ilKbjbHJOKAf9Lrm na7g== X-Gm-Message-State: ABy/qLY0nyguA845LzltW8oY+Hdso6GlsYLyfMYvb8Nsxntu7JG27Fmy 6Da0E94AXYnn5fNDn3954+hXmjuxZMtNadOkWvewQdgIqswKo3/OhojbVtTg4IFMlgIIqJJczkY HZOGsBqY9acE= X-Received: by 2002:a05:6000:12c7:b0:315:94ea:31ad with SMTP id l7-20020a05600012c700b0031594ea31admr1865780wrx.66.1689257552060; Thu, 13 Jul 2023 07:12:32 -0700 (PDT) X-Google-Smtp-Source: APBJJlEWNh5gZnV4JtCol9lSOLwX0rF7KydONdLi+U9y34fnkgItDimt2DDoKS0RlZOnXZYcC33AAg== X-Received: by 2002:a05:6000:12c7:b0:315:94ea:31ad with SMTP id l7-20020a05600012c700b0031594ea31admr1865755wrx.66.1689257551677; Thu, 13 Jul 2023 07:12:31 -0700 (PDT) Received: from [192.168.3.108] (p4ff23613.dip0.t-ipconnect.de. [79.242.54.19]) by smtp.gmail.com with ESMTPSA id o13-20020a5d684d000000b00314315071bbsm8126744wrw.38.2023.07.13.07.12.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 13 Jul 2023 07:12:31 -0700 (PDT) Message-ID: <373e7e67-6ccc-5508-6937-6ea5a3eed5ea@redhat.com> Date: Thu, 13 Jul 2023 16:12:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v1 3/9] selftests/mm: Skip soft-dirty tests on arm64 From: David Hildenbrand To: Ryan Roberts , Andrew Morton , Shuah Khan , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Mark Brown , John Hubbard , Florent Revest , "Liam R. Howlett" Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org References: <20230713135440.3651409-1-ryan.roberts@arm.com> <20230713135440.3651409-4-ryan.roberts@arm.com> <773cc0a8-24b8-7fcb-2980-7676fc772014@arm.com> <3c566e28-c7ad-7ba8-4583-619266282387@redhat.com> Organization: Red Hat In-Reply-To: <3c566e28-c7ad-7ba8-4583-619266282387@redhat.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 346A5100015 X-Rspam-User: X-Rspamd-Server: rspam02 X-Stat-Signature: fa8q8bwbw3ttqsyhah45t1mj3pp94zbb X-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wjDQ3KSqa0MqAqd9GO2l2d2dVw9/W7TDugskeMUP+0b/yWGBTA3unXoJAhZf768zqZ+ByM5736LEfTlSA7nKCm2lrBxmoERW2p1xQGS8cf4TkDsy242MRg8JNdSz5VqlGj0EJtMUR101j7XdaPlALbT+ANXaStY6bsWA3gj0MxHcxRFcLQCHNW3BWX9ZhYTEM5XNPnibKZ119dKBWDhr8ga+Qzr8CxxTRI4dBIwpWyAgzRtRXbZTCBJgHM22ORaigDbqcU3ZL1U3moNg1MST6UKu4xFBXariIAO9NgVhfatq2VdZX638h9alXGA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 13.07.23 16:09, David Hildenbrand wrote: > On 13.07.23 16:03, Ryan Roberts wrote: >> On 13/07/2023 14:56, David Hildenbrand wrote: >>> On 13.07.23 15:54, Ryan Roberts wrote: >>>> arm64 does not support the soft-dirty PTE bit. However there are tests >>>> in `madv_populate` and `soft-dirty` which assume it is supported and >>>> cause spurious failures to be reported when preferred behaviour would be >>>> to mark the tests as skipped. >>>> >>>> Unfortunately, the only way to determine if the soft-dirty dirty bit is >>>> supported is to write to a page, then see if the bit is set in >>>> /proc/self/pagemap. But the tests that we want to conditionally execute >>>> are testing precicesly this. So if we introduced this feature check, we >>>> could accedentally turn a real failure (on a system that claims to >>>> support soft-dirty) into a skip. >>>> >>>> So instead, do the check based on architecture; for arm64, we report >>>> that soft-dirty is not supported. This is wrapped up into a utility >>>> function `system_has_softdirty()`, which is used to skip the whole >>>> `soft-dirty` suite, and mark the soft-dirty tests in the `madv_populate` >>>> suite as skipped. >>>> >>>> Signed-off-by: Ryan Roberts >>>> --- >>>>   tools/testing/selftests/mm/madv_populate.c | 18 +++++++++++++----- >>>>   tools/testing/selftests/mm/soft-dirty.c    |  3 +++ >>>>   tools/testing/selftests/mm/vm_util.c       | 17 +++++++++++++++++ >>>>   tools/testing/selftests/mm/vm_util.h       |  1 + >>>>   4 files changed, 34 insertions(+), 5 deletions(-) >>>> >>>> diff --git a/tools/testing/selftests/mm/madv_populate.c >>>> b/tools/testing/selftests/mm/madv_populate.c >>>> index 60547245e479..5a8c176d7fec 100644 >>>> --- a/tools/testing/selftests/mm/madv_populate.c >>>> +++ b/tools/testing/selftests/mm/madv_populate.c >>>> @@ -232,6 +232,14 @@ static bool range_is_not_softdirty(char *start, ssize_t >>>> size) >>>>       return ret; >>>>   } >>>> >>>> +#define ksft_test_result_if_softdirty(cond, ...)    \ >>>> +do {                            \ >>>> +    if (system_has_softdirty())            \ >>>> +        ksft_test_result(cond, __VA_ARGS__);    \ >>>> +    else                        \ >>>> +        ksft_test_result_skip(__VA_ARGS__);    \ >>>> +} while (0) >>>> + >>>>   static void test_softdirty(void) >>>>   { >>>>       char *addr; >>>> @@ -246,19 +254,19 @@ static void test_softdirty(void) >>>> >>>>       /* Clear any softdirty bits. */ >>>>       clear_softdirty(); >>>> -    ksft_test_result(range_is_not_softdirty(addr, SIZE), >>>> +    ksft_test_result_if_softdirty(range_is_not_softdirty(addr, SIZE), >>>>                "range is not softdirty\n"); >>>> >>>>       /* Populating READ should set softdirty. */ >>>>       ret = madvise(addr, SIZE, MADV_POPULATE_READ); >>>> -    ksft_test_result(!ret, "MADV_POPULATE_READ\n"); >>>> -    ksft_test_result(range_is_not_softdirty(addr, SIZE), >>>> +    ksft_test_result_if_softdirty(!ret, "MADV_POPULATE_READ\n"); >>>> +    ksft_test_result_if_softdirty(range_is_not_softdirty(addr, SIZE), >>>>                "range is not softdirty\n"); >>>> >>>>       /* Populating WRITE should set softdirty. */ >>>>       ret = madvise(addr, SIZE, MADV_POPULATE_WRITE); >>>> -    ksft_test_result(!ret, "MADV_POPULATE_WRITE\n"); >>>> -    ksft_test_result(range_is_softdirty(addr, SIZE), >>>> +    ksft_test_result_if_softdirty(!ret, "MADV_POPULATE_WRITE\n"); >>>> +    ksft_test_result_if_softdirty(range_is_softdirty(addr, SIZE), >>>>                "range is softdirty\n"); >>> >>> We probably want to skip the whole test_*softdirty* test instead of adding this >>> (IMHO suboptimal) ksft_test_result_if_softdirty. >> >> Yeah I thought about doing it that way, but then the output just looks like >> there were fewer tests and they all passed. But thinking about it now, I guess >> the TAP header outputs the number of planned tests and the number of tests >> executed are fewer, so a machine parser would still notice. I just don't like >> that it outputs skipped:0. >> >> But it a lightly held view. Happy to just do: >> >> if (system_has_softdirty()) >> test_softdirty() >> >> If you insist. ;-) > > diff --git a/tools/testing/selftests/mm/madv_populate.c b/tools/testing/selftests/mm/madv_populate.c > index 60547245e479..33fda0337b32 100644 > --- a/tools/testing/selftests/mm/madv_populate.c > +++ b/tools/testing/selftests/mm/madv_populate.c > @@ -266,12 +266,16 @@ static void test_softdirty(void) > > int main(int argc, char **argv) > { > + int nr_tests = 16; > int err; > > pagesize = getpagesize(); > > + if (system_has_softdirty()) > + nr_tests += 5; > + > ksft_print_header(); > - ksft_set_plan(21); > + ksft_set_plan(nr_tests); > > sense_support(); > test_prot_read(); > @@ -279,7 +283,8 @@ int main(int argc, char **argv) > test_holes(); > test_populate_read(); > test_populate_write(); > - test_softdirty(); > + if (system_has_softdirty()) > + test_softdirty(); > > err = ksft_get_fail_cnt(); > if (err) > > Oh, and if you want to have the skip, then you can think about converting test_softdirty() to only perform a single ksft_test_result(), and have a single skip on top. All cleaner IMHO than ksft_test_result_if_softdirty ;) -- Cheers, David / dhildenb