linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Sudarsan Mahendran <sudarsanm@google.com>,
	linux-kselftest@vger.kernel.org
Cc: Shuah Khan <shuah@kernel.org>,
	Axel Rasmussen <axelrasmussen@google.com>,
	linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, trivial@kernel.org
Subject: Re: [PATCH] selftests/mm: pass filename as input param to VM_PFNMAP tests
Date: Fri, 1 Aug 2025 09:14:58 +0200	[thread overview]
Message-ID: <1f95e865-ee09-4ddd-b6db-f2092f0d4b10@redhat.com> (raw)
In-Reply-To: <20250731201009.888945-1-sudarsanm@google.com>

On 31.07.25 22:10, Sudarsan Mahendran wrote:
> Enable these tests to be run on other pfnmap'ed memory like
> NVIDIA's EGM.
> 
> Add '--' as a separator to pass in file path. This allows
> passing of cmd line arguments to kselftest_harness.
> Use '/dev/mem' as default filename.
> 
> Existing test passes:
> 	pfnmap
> 	TAP version 13
> 	1..6
> 	# Starting 6 tests from 1 test cases.
> 	# PASSED: 6 / 6 tests passed.
> 	# Totals: pass:6 fail:0 xfail:0 xpass:0 skip:0 error:0
> 
> Pass params to kselftest_harness:
> 	pfnmap -r pfnmap:mremap_fixed
> 	TAP version 13
> 	1..1
> 	# Starting 1 tests from 1 test cases.
> 	#  RUN           pfnmap.mremap_fixed ...
> 	#            OK  pfnmap.mremap_fixed
> 	ok 1 pfnmap.mremap_fixed
> 	# PASSED: 1 / 1 tests passed.
> 	# Totals: pass:1 fail:0 xfail:0 xpass:0 skip:0 error:0
> 
> Pass random file name as input:
> 	pfnmap -- /dev/blah
> 	TAP version 13
> 	1..6
> 	# Starting 6 tests from 1 test cases.
> 	#  RUN           pfnmap.madvise_disallowed ...
> 	#      SKIP      Cannot open '/dev/blah'

Now, if you really just pass a random *actual file* that exists, the 
test case will not actually test what we want.

Unless you have a way to verify that you actually get a PFNMAP mapping, 
this extension is questionable. It will make the test report possibly 
wrong results when wrong files are provided.

I think we can test whether we get a PFNMAP mapping by looking at the 
flags in smaps output ("pf" in flags), so I would expect such a test to 
be done in pfnmap, and the test should FAIL if the file would not create 
a PFNMAP.


But more importantly, we rely on "/proc/iomem" to find a RAM target in 
/dev/mem. That doesn't make any sense with what you are doing here.

If we are not provided /dev/mem, you should probably try mapping offset 
0 of the file.

-- 
Cheers,

David / dhildenb


  reply	other threads:[~2025-08-01  7:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 20:10 [PATCH] selftests/mm: pass filename as input param to VM_PFNMAP tests Sudarsan Mahendran
2025-08-01  7:14 ` David Hildenbrand [this message]
2025-08-01 23:46   ` Sudarsan Mahendran

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=1f95e865-ee09-4ddd-b6db-f2092f0d4b10@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=axelrasmussen@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=shuah@kernel.org \
    --cc=sudarsanm@google.com \
    --cc=trivial@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;
as well as URLs for NNTP newsgroup(s).