Ralph Campbell
2020-Jun-26 17:26 UTC
[Nouveau] [PATCH] nouveau: fix page fault on device private memory
If system memory is migrated to device private memory and no GPU MMU page table entry exists, the GPU will fault and call hmm_range_fault() to get the PFN for the page. Since the .dev_private_owner pointer in struct hmm_range is not set, hmm_range_fault returns an error which results in the GPU program stopping with a fatal fault. Fix this by setting .dev_private_owner appropriately. Fixes: 08ddddda667b ("mm/hmm: check the device private page owner in hmm_range_fault()") Signed-off-by: Ralph Campbell <rcampbell at nvidia.com> --- This is based on Linux-5.8.0-rc2 and is for Ben Skeggs nouveau tree. It doesn't depend on any of the other nouveau/HMM changes I have recently posted. drivers/gpu/drm/nouveau/nouveau_svm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c index ba9f9359c30e..6586d9d39874 100644 --- a/drivers/gpu/drm/nouveau/nouveau_svm.c +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c @@ -562,6 +562,7 @@ static int nouveau_range_fault(struct nouveau_svmm *svmm, .end = notifier->notifier.interval_tree.last + 1, .pfn_flags_mask = HMM_PFN_REQ_FAULT | HMM_PFN_REQ_WRITE, .hmm_pfns = hmm_pfns, + .dev_private_owner = drm->dev, }; struct mm_struct *mm = notifier->notifier.mm; int ret; -- 2.20.1
Jason Gunthorpe
2020-Jun-26 17:44 UTC
[Nouveau] [PATCH] nouveau: fix page fault on device private memory
On Fri, Jun 26, 2020 at 10:26:26AM -0700, Ralph Campbell wrote:> If system memory is migrated to device private memory and no GPU MMU > page table entry exists, the GPU will fault and call hmm_range_fault() > to get the PFN for the page. Since the .dev_private_owner pointer in > struct hmm_range is not set, hmm_range_fault returns an error which > results in the GPU program stopping with a fatal fault. > Fix this by setting .dev_private_owner appropriately. > > Fixes: 08ddddda667b ("mm/hmm: check the device private page owner in hmm_range_fault()") > Signed-off-by: Ralph Campbell <rcampbell at nvidia.com> > --- > > This is based on Linux-5.8.0-rc2 and is for Ben Skeggs nouveau tree. > It doesn't depend on any of the other nouveau/HMM changes I have > recently posted.Makes sense to me Reviewed-by: Jason Gunthorpe <jgg at mellanox.com> Jason
John Hubbard
2020-Jun-26 18:05 UTC
[Nouveau] [PATCH] nouveau: fix page fault on device private memory
On 2020-06-26 10:26, Ralph Campbell wrote:> If system memory is migrated to device private memory and no GPU MMU > page table entry exists, the GPU will fault and call hmm_range_fault() > to get the PFN for the page. Since the .dev_private_owner pointer in > struct hmm_range is not set, hmm_range_fault returns an error which > results in the GPU program stopping with a fatal fault. > Fix this by setting .dev_private_owner appropriately. > > Fixes: 08ddddda667b ("mm/hmm: check the device private page owner in hmm_range_fault()") > Signed-off-by: Ralph Campbell <rcampbell at nvidia.com> > --- > > This is based on Linux-5.8.0-rc2 and is for Ben Skeggs nouveau tree. > It doesn't depend on any of the other nouveau/HMM changes I have > recently posted.Maybe cc stable, seeing as how the problem affect Linux 5.7? thanks, -- John Hubbard NVIDIA> > drivers/gpu/drm/nouveau/nouveau_svm.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/gpu/drm/nouveau/nouveau_svm.c b/drivers/gpu/drm/nouveau/nouveau_svm.c > index ba9f9359c30e..6586d9d39874 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_svm.c > +++ b/drivers/gpu/drm/nouveau/nouveau_svm.c > @@ -562,6 +562,7 @@ static int nouveau_range_fault(struct nouveau_svmm *svmm, > .end = notifier->notifier.interval_tree.last + 1, > .pfn_flags_mask = HMM_PFN_REQ_FAULT | HMM_PFN_REQ_WRITE, > .hmm_pfns = hmm_pfns, > + .dev_private_owner = drm->dev, > }; > struct mm_struct *mm = notifier->notifier.mm; > int ret; >
Maybe Matching Threads
- [PATCH v2] nouveau: fix page fault on device private memory
- [PATCH hmm 0/5] Adjust hmm_range_fault() API
- [PATCH hmm v2 0/5] Adjust hmm_range_fault() API
- [PATCH hmm v2 5/5] mm/hmm: remove the customizable pfn format from hmm_range_fault
- [PATCH v2 0/5] mm/hmm/nouveau: add PMD system memory mapping