Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-21 Thread Christoph Hellwig
On Thu, Mar 19, 2020 at 09:03:45PM -0300, Jason Gunthorpe wrote: > > Should tests enable the feature or the feature enable the test? > > IMHO, if the feature is being compiled into the kernel, that should > > enable the menu item for the test. If the feature isn't selected, > > no need to test it

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-20 Thread Jason Gunthorpe
On Thu, Mar 19, 2020 at 06:33:04PM -0700, Ralph Campbell wrote: > > > + .default_flags = dmirror_hmm_flags[HMM_PFN_VALID] | > > > + (write ? dmirror_hmm_flags[HMM_PFN_WRITE] : 0), > > > + .dev_private_owner = dmirror->mdevice, > > > + }; > > > + int ret =

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-20 Thread Jason Gunthorpe
On Tue, Mar 17, 2020 at 04:14:31PM -0700, Ralph Campbell wrote: > +static int dmirror_fault(struct dmirror *dmirror, unsigned long start, > + unsigned long end, bool write) > +{ > + struct mm_struct *mm = dmirror->mm; > + unsigned long addr; > + uint64_t pfns[64];

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-20 Thread Jason Gunthorpe
On Thu, Mar 19, 2020 at 03:56:50PM -0700, Ralph Campbell wrote: > Adding linux-kselft...@vger.kernel.org for the test config question. > > On 3/19/20 11:17 AM, Jason Gunthorpe wrote: > > On Tue, Mar 17, 2020 at 04:14:31PM -0700, Ralph Campbell wrote: > > > > > > On 3/17/20 5:59 AM, Christoph

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-19 Thread Ralph Campbell
On 3/19/20 5:14 PM, Jason Gunthorpe wrote: On Tue, Mar 17, 2020 at 04:14:31PM -0700, Ralph Campbell wrote: +static int dmirror_fault(struct dmirror *dmirror, unsigned long start, +unsigned long end, bool write) +{ + struct mm_struct *mm = dmirror->mm; +

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-19 Thread Jason Gunthorpe
On Tue, Mar 17, 2020 at 04:14:31PM -0700, Ralph Campbell wrote: > > On 3/17/20 5:59 AM, Christoph Hellwig wrote: > > On Tue, Mar 17, 2020 at 09:47:55AM -0300, Jason Gunthorpe wrote: > > > I've been using v7 of Ralph's tester and it is working well - it has > > > DEVICE_PRIVATE support so I think

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-18 Thread Christoph Hellwig
On Tue, Mar 17, 2020 at 03:43:47PM -0700, Ralph Campbell wrote: >> Obviously no driver cared for that so far. Once we have test cases >> for that and thus testable code we can add code to fault it in from >> hmm_vma_handle_pte. >> > > I'm OK with the series. I think I would have been less

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Ralph Campbell
On 3/17/20 5:59 AM, Christoph Hellwig wrote: On Tue, Mar 17, 2020 at 09:47:55AM -0300, Jason Gunthorpe wrote: I've been using v7 of Ralph's tester and it is working well - it has DEVICE_PRIVATE support so I think it can test this flow too. Ralph are you able? This hunk seems trivial enough to

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Ralph Campbell
On 3/17/20 12:34 AM, Christoph Hellwig wrote: On Mon, Mar 16, 2020 at 03:49:51PM -0700, Ralph Campbell wrote: On 3/16/20 12:32 PM, Christoph Hellwig wrote: Remove the code to fault device private pages back into system memory that has never been used by any driver. Also replace the usage of

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Jason Gunthorpe
On Tue, Mar 17, 2020 at 01:59:55PM +0100, Christoph Hellwig wrote: > On Tue, Mar 17, 2020 at 09:47:55AM -0300, Jason Gunthorpe wrote: > > I've been using v7 of Ralph's tester and it is working well - it has > > DEVICE_PRIVATE support so I think it can test this flow too. Ralph are > > you able? >

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Christoph Hellwig
On Tue, Mar 17, 2020 at 09:47:55AM -0300, Jason Gunthorpe wrote: > I've been using v7 of Ralph's tester and it is working well - it has > DEVICE_PRIVATE support so I think it can test this flow too. Ralph are > you able? > > This hunk seems trivial enough to me, can we include it now? I can send

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Christoph Hellwig
On Tue, Mar 17, 2020 at 09:15:36AM -0300, Jason Gunthorpe wrote: > > Getting rid of HMM_PFN_DEVICE_PRIVATE seems reasonable to me since a driver > > can > > look at the struct page but what if a driver needs to fault in a page from > > another device's private memory? Should it call

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Christoph Hellwig
On Mon, Mar 16, 2020 at 04:59:23PM -0300, Jason Gunthorpe wrote: > However, between patch 3 and 4 doesn't this break amd gpu as it will > return device_private pages now if not requested? Squash the two? No change in behavior in this patch as long as HMM_PFN_DEVICE_PRIVATE isn't set in ->pfns or

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Jason Gunthorpe
On Mon, Mar 16, 2020 at 03:49:51PM -0700, Ralph Campbell wrote: > > On 3/16/20 12:32 PM, Christoph Hellwig wrote: > > Remove the code to fault device private pages back into system memory > > that has never been used by any driver. Also replace the usage of the > > HMM_PFN_DEVICE_PRIVATE flag in

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Christoph Hellwig
On Tue, Mar 17, 2020 at 01:24:45PM +0100, Christoph Hellwig wrote: > On Tue, Mar 17, 2020 at 09:15:36AM -0300, Jason Gunthorpe wrote: > > > Getting rid of HMM_PFN_DEVICE_PRIVATE seems reasonable to me since a > > > driver can > > > look at the struct page but what if a driver needs to fault in a

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Christoph Hellwig
On Mon, Mar 16, 2020 at 03:49:51PM -0700, Ralph Campbell wrote: > On 3/16/20 12:32 PM, Christoph Hellwig wrote: >> Remove the code to fault device private pages back into system memory >> that has never been used by any driver. Also replace the usage of the >> HMM_PFN_DEVICE_PRIVATE flag in the

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-17 Thread Jason Gunthorpe
On Tue, Mar 17, 2020 at 01:28:13PM +0100, Christoph Hellwig wrote: > On Tue, Mar 17, 2020 at 01:24:45PM +0100, Christoph Hellwig wrote: > > On Tue, Mar 17, 2020 at 09:15:36AM -0300, Jason Gunthorpe wrote: > > > > Getting rid of HMM_PFN_DEVICE_PRIVATE seems reasonable to me since a > > > > driver

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-16 Thread Ralph Campbell
On 3/16/20 12:32 PM, Christoph Hellwig wrote: Remove the code to fault device private pages back into system memory that has never been used by any driver. Also replace the usage of the HMM_PFN_DEVICE_PRIVATE flag in the pfns array with a simple is_device_private_page check in nouveau.

Re: [PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-16 Thread Jason Gunthorpe
On Mon, Mar 16, 2020 at 08:32:15PM +0100, Christoph Hellwig wrote: > diff --git a/mm/hmm.c b/mm/hmm.c > index 180e398170b0..cfad65f6a67b 100644 > +++ b/mm/hmm.c > @@ -118,15 +118,6 @@ static inline void hmm_pte_need_fault(const struct > hmm_vma_walk *hmm_vma_walk, > /* We aren't ask to do

[PATCH 3/4] mm: simplify device private page handling in hmm_range_fault

2020-03-16 Thread Christoph Hellwig
Remove the code to fault device private pages back into system memory that has never been used by any driver. Also replace the usage of the HMM_PFN_DEVICE_PRIVATE flag in the pfns array with a simple is_device_private_page check in nouveau. Signed-off-by: Christoph Hellwig ---