linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Ralph Campbell <rcampbell@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jerome Glisse <jglisse@redhat.com>,
	John Hubbard <jhubbard@nvidia.com>,
	Christoph Hellwig <hch@lst.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <shuah@kernel.org>, <linux-rdma@vger.kernel.org>,
	<linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>,
	<linux-kselftest@vger.kernel.org>
Subject: Re: [PATCH v8 0/3] mm/hmm/test: add self tests for HMM
Date: Mon, 23 Mar 2020 11:21:13 -0700	[thread overview]
Message-ID: <010050db-a37d-d200-88d4-696cc2c8d9d6@nvidia.com> (raw)
In-Reply-To: <20200322081038.GG650439@unreal>


On 3/22/20 1:10 AM, Leon Romanovsky wrote:
> On Sat, Mar 21, 2020 at 06:55:05PM -0300, Jason Gunthorpe wrote:
>> On Sat, Mar 21, 2020 at 10:27:46AM -0700, Ralph Campbell wrote:
>>>
>>> On 3/21/20 2:00 AM, Leon Romanovsky wrote:
>>>> On Fri, Mar 20, 2020 at 05:31:05PM -0700, Ralph Campbell wrote:
>>>>> This series adds basic self tests for HMM and are intended for Jason
>>>>> Gunthorpe's rdma tree which has a number of HMM patches applied.
>>>>>
>>>>> Changes v7 -> v8:
>>>>> Rebased to Jason's rdma/hmm tree, plus Jason's 6 patch series
>>>>>     "Small hmm_range_fault() cleanups".
>>>>> Applied a number of changes from Jason's comments.
>>>>>
>>>>> Changes v6 -> v7:
>>>>> Rebased to linux-5.6.0-rc6
>>>>> Reverted back to just using mmu_interval_notifier_insert() and making
>>>>>     this series only introduce HMM self tests.
>>>>>
>>>>> Changes v5 -> v6:
>>>>> Rebased to linux-5.5.0-rc6
>>>>> Refactored mmu interval notifier patches
>>>>> Converted nouveau to use the new mmu interval notifier API
>>>>>
>>>>> Changes v4 -> v5:
>>>>> Added mmu interval notifier insert/remove/update callable from the
>>>>>     invalidate() callback
>>>>> Updated HMM tests to use the new core interval notifier API
>>>>>
>>>>> Changes v1 -> v4:
>>>>> https://lore.kernel.org/linux-mm/20191104222141.5173-1-rcampbell@nvidia.com
>>>>>
>>>>> Ralph Campbell (3):
>>>>>     mm/hmm/test: add selftest driver for HMM
>>>>>     mm/hmm/test: add selftests for HMM
>>>>>     MAINTAINERS: add HMM selftests
>>>>>
>>>>>    MAINTAINERS                            |    3 +
>>>>>    include/uapi/linux/test_hmm.h          |   59 ++
>>>>
>>>> Isn't UAPI folder supposed to be for user-visible interfaces that follow
>>>> the rule of non-breaking user space and not for selftests?
>>>>
>>>> Thanks
>>>>
>>>
>>> Most of the other kernel module tests seem to invoke the test as part of the
>>> module load/init. I'm open to moving it if there is a more appropriate location.
>>
>> Is it even possible to create a user mm_struct and put crazy things in
>> it soley from a kernel module?
> 
> I didn't look very closely of what Ralph did in his patchsets, but from
> what I know, if you want in-kernel interface, you use in-kernel module,
> if you want to test user visible uapi, you write application. You don't
> create new UAPI just to test something in the kernel.
> 
> Can kunit help here?
> https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html
> 
> Thanks
> 
>>
>> Jason

The tests are intended to cover hmm_range_fault() and the migrate_vma_setup(),
migrate_vma_pages(), and migrate_vma_finalize() kernel functions that a device
driver can call to initialize hardware that has its own page tables.
An example is a GPU where the code on the GPU sees the same address space as
code running on the host CPU. This means the test has to have a user process
to create a user process address space and a device driver to simulate some
real device driver. The UAPI is for the user level test program to tell the
kernel module test driver what to do and return results.
The complexity is all around maintaining coherent copies of the user process
page tables while hardware and CPUs are accessing the same physical addresses.
The pages are not pinned as with most I/O so system activity like pagein/pageout,
LRU page reclaim, compaction, and the process calling functions like
mmap(), mprotect(), madvise(), fork(), etc. all update the CPU and device page
tables and would be very hard to duplicate in a kernel level only KUNIT style
of test.



  reply	other threads:[~2020-03-23 18:21 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-21  0:31 [PATCH v8 0/3] mm/hmm/test: add self tests for HMM Ralph Campbell
2020-03-21  0:31 ` [PATCH v8 1/3] mm/hmm/test: add selftest driver " Ralph Campbell
2020-03-21  0:31 ` [PATCH v8 2/3] mm/hmm/test: add selftests " Ralph Campbell
2020-03-21  0:31 ` [PATCH v8 3/3] MAINTAINERS: add HMM selftests Ralph Campbell
2020-03-21  9:00 ` [PATCH v8 0/3] mm/hmm/test: add self tests for HMM Leon Romanovsky
2020-03-21 17:27   ` Ralph Campbell
2020-03-21 21:55     ` Jason Gunthorpe
2020-03-22  8:10       ` Leon Romanovsky
2020-03-23 18:21         ` Ralph Campbell [this message]
2020-03-23 18:25         ` Jason Gunthorpe
2020-03-21 14:43 ` Jason Gunthorpe
2020-04-15 14:41 ` Jason Gunthorpe
2020-04-15 17:28   ` Ralph Campbell
2020-04-15 19:29     ` Leon Romanovsky
2020-04-15 19:32       ` Jason Gunthorpe
2020-04-15 19:39       ` Ralph Campbell
2020-04-15 19:52         ` Leon Romanovsky

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=010050db-a37d-d200-88d4-696cc2c8d9d6@nvidia.com \
    --to=rcampbell@nvidia.com \
    --cc=akpm@linux-foundation.org \
    --cc=hch@lst.de \
    --cc=jgg@ziepe.ca \
    --cc=jglisse@redhat.com \
    --cc=jhubbard@nvidia.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --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;
as well as URLs for NNTP newsgroup(s).