From: David Hildenbrand <david@redhat.com>
To: "Ryan Roberts" <ryan.roberts@arm.com>,
"Andrew Morton" <akpm@linux-foundation.org>,
"Shuah Khan" <shuah@kernel.org>,
"Jérôme Glisse" <jglisse@redhat.com>,
"Mark Brown" <broonie@kernel.org>,
"John Hubbard" <jhubbard@nvidia.com>,
"Florent Revest" <revest@chromium.org>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v1 3/9] selftests/mm: Skip soft-dirty tests on arm64
Date: Thu, 13 Jul 2023 16:29:14 +0200 [thread overview]
Message-ID: <aacd934b-9249-cb84-5efa-bf331e78688f@redhat.com> (raw)
In-Reply-To: <556d05f0-7103-1079-fce1-1fb6bd40b17c@arm.com>
On 13.07.23 16:14, Ryan Roberts wrote:
> On 13/07/2023 15: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 <ryan.roberts@arm.com>
>>>>> ---
>>>>> 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;
>
> This is the opposite of the point I was trying to make; If there are 21 tests in
> a suite, I'd like to know that there are 21 tests, 16 of which passed and 5 of
> which were skipped. This will hide the 5 from the test report.
Well, these test are impossible on that architecture, which is IMHO
different to some kind of "impossible in the configuration" like "no
swap", "no hugetlb", "no THP available".
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2023-07-13 14:29 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-13 13:54 [PATCH v1 0/9] selftests/mm fixes for arm64 Ryan Roberts
2023-07-13 13:54 ` [PATCH v1 1/9] selftests: Line buffer test program's stdout Ryan Roberts
2023-07-13 14:16 ` Mark Brown
2023-07-13 14:32 ` Ryan Roberts
2023-07-13 14:45 ` Mark Brown
2023-07-17 8:36 ` Ryan Roberts
2023-07-13 13:54 ` [PATCH v1 2/9] selftests/mm: Give scripts execute permission Ryan Roberts
2023-07-13 14:39 ` David Hildenbrand
2023-07-13 17:32 ` SeongJae Park
2023-07-14 9:44 ` Ryan Roberts
2023-07-14 16:00 ` SeongJae Park
2023-07-14 16:11 ` Mark Brown
2023-07-14 16:26 ` Andrew Morton
2023-07-14 16:28 ` Ryan Roberts
2023-07-13 13:54 ` [PATCH v1 3/9] selftests/mm: Skip soft-dirty tests on arm64 Ryan Roberts
2023-07-13 13:56 ` David Hildenbrand
2023-07-13 14:03 ` Ryan Roberts
2023-07-13 14:09 ` David Hildenbrand
2023-07-13 14:12 ` David Hildenbrand
2023-07-13 14:16 ` Ryan Roberts
2023-07-13 14:14 ` Ryan Roberts
2023-07-13 14:29 ` David Hildenbrand [this message]
2023-07-15 0:04 ` John Hubbard
2023-07-17 8:23 ` Ryan Roberts
2023-07-13 13:54 ` [PATCH v1 4/9] selftests/mm: Enable mrelease_test for arm64 Ryan Roberts
2023-07-13 14:32 ` David Hildenbrand
2023-07-13 13:54 ` [PATCH v1 5/9] selftests/mm: Fix thuge-gen test bugs Ryan Roberts
2023-07-13 13:54 ` [PATCH v1 6/9] selftests/mm: va_high_addr_switch should skip unsupported arm64 configs Ryan Roberts
2023-07-13 14:41 ` David Hildenbrand
2023-07-13 13:54 ` [PATCH v1 7/9] selftests/mm: Make migration test robust to failure Ryan Roberts
2023-07-13 13:54 ` [PATCH v1 8/9] selftests/mm: Optionally pass duration to transhuge-stress Ryan Roberts
2023-07-13 13:54 ` [PATCH v1 9/9] selftests/mm: Run all tests from run_vmtests.sh Ryan Roberts
2023-07-13 14:50 ` David Hildenbrand
2023-07-13 15:04 ` Ryan Roberts
2023-07-13 15:25 ` David Hildenbrand
2023-07-13 15:30 ` Ryan Roberts
2023-07-13 15:30 ` Mark Brown
2023-07-13 15:36 ` Ryan Roberts
2023-07-13 15:43 ` Mark Brown
2023-07-13 15:46 ` Ryan Roberts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aacd934b-9249-cb84-5efa-bf331e78688f@redhat.com \
--to=david@redhat.com \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=broonie@kernel.org \
--cc=jglisse@redhat.com \
--cc=jhubbard@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=revest@chromium.org \
--cc=ryan.roberts@arm.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox