search for: nouveau_find_svmm

Displaying 8 results from an estimated 8 matches for "nouveau_find_svmm".

2019 Aug 07
4
[PATCH] nouveau/hmm: map pages after migration
...gs->i.type = NVIF_IOCTL_V0_MTHD; + args->m.method = NVIF_VMM_V0_PFNMAP; + args->p.page = PAGE_SHIFT; + + return args->p.phys; +} + +void +nouveau_pfns_free(u64 *pfns) +{ + struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns); + + kfree(args); +} + +static struct nouveau_svmm * +nouveau_find_svmm(struct nouveau_svm *svm, struct mm_struct *mm) +{ + struct nouveau_ivmm *ivmm; + + list_for_each_entry(ivmm, &svm->inst, head) { + if (ivmm->svmm->mm == mm) + return ivmm->svmm; + } + return NULL; +} + +void +nouveau_pfns_map(struct nouveau_drm *drm, struct mm_struct *mm, + uns...
2020 Mar 03
2
[PATCH v2] nouveau/hmm: map pages after migration
...gs->i.type = NVIF_IOCTL_V0_MTHD; + args->m.method = NVIF_VMM_V0_PFNMAP; + args->p.page = PAGE_SHIFT; + + return args->p.phys; +} + +void +nouveau_pfns_free(u64 *pfns) +{ + struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns); + + kfree(args); +} + +static struct nouveau_svmm * +nouveau_find_svmm(struct nouveau_svm *svm, struct mm_struct *mm) +{ + struct nouveau_ivmm *ivmm; + + list_for_each_entry(ivmm, &svm->inst, head) { + if (ivmm->svmm->notifier.mm == mm) + return ivmm->svmm; + } + return NULL; +} + +void +nouveau_pfns_map(struct nouveau_drm *drm, struct mm_struct *mm...
2019 Aug 08
0
[PATCH] nouveau/hmm: map pages after migration
...unsigned long npages) > +{ > + struct nouveau_pfnmap_args *args; > + > + args = kzalloc(sizeof(*args) + npages * sizeof(args->p.phys[0]), Can we use struct_size here? > + int ret; > + > + if (!svm) > + return; > + > + mutex_lock(&svm->mutex); > + svmm = nouveau_find_svmm(svm, mm); > + if (!svmm) { > + mutex_unlock(&svm->mutex); > + return; > + } > + mutex_unlock(&svm->mutex); Given that nouveau_find_svmm doesn't take any kind of reference, what gurantees svmm doesn't go away after dropping the lock? > @@ -44,5 +49,19 @@ s...
2019 Aug 08
2
[PATCH] nouveau/hmm: map pages after migration
...> + >> + args = kzalloc(sizeof(*args) + npages * sizeof(args->p.phys[0]), > > Can we use struct_size here? Yes, good suggestion. > >> + int ret; >> + >> + if (!svm) >> + return; >> + >> + mutex_lock(&svm->mutex); >> + svmm = nouveau_find_svmm(svm, mm); >> + if (!svmm) { >> + mutex_unlock(&svm->mutex); >> + return; >> + } >> + mutex_unlock(&svm->mutex); > > Given that nouveau_find_svmm doesn't take any kind of reference, what > gurantees svmm doesn't go away after dropping t...
2019 Aug 13
0
[PATCH] nouveau/hmm: map pages after migration
...P; > + args->p.page = PAGE_SHIFT; > + > + return args->p.phys; > +} > + > +void > +nouveau_pfns_free(u64 *pfns) > +{ > + struct nouveau_pfnmap_args *args = nouveau_pfns_to_args(pfns); > + > + kfree(args); > +} > + > +static struct nouveau_svmm * > +nouveau_find_svmm(struct nouveau_svm *svm, struct mm_struct *mm) > +{ > + struct nouveau_ivmm *ivmm; > + > + list_for_each_entry(ivmm, &svm->inst, head) { > + if (ivmm->svmm->mm == mm) > + return ivmm->svmm; > + } > + return NULL; > +} > + > +void > +nouveau_pfn...
2020 Mar 03
0
[PATCH v2] nouveau/hmm: map pages after migration
...; + struct nvif_vmm_pfnmap_v0 *p = > + container_of(pfns, struct nvif_vmm_pfnmap_v0, phys); > + > + return container_of(p, struct nouveau_pfnmap_args, p); And this should just be return container_of(pfns, struct nouveau_pfnmap_args, p.phys); > +static struct nouveau_svmm * > +nouveau_find_svmm(struct nouveau_svm *svm, struct mm_struct *mm) > +{ > + struct nouveau_ivmm *ivmm; > + > + list_for_each_entry(ivmm, &svm->inst, head) { > + if (ivmm->svmm->notifier.mm == mm) > + return ivmm->svmm; > + } > + return NULL; > +} Is this re-implementing m...
2020 Mar 03
1
[PATCH v2] nouveau/hmm: map pages after migration
...s, struct nvif_vmm_pfnmap_v0, phys); >> + >> + return container_of(p, struct nouveau_pfnmap_args, p); > > And this should just be > > return container_of(pfns, struct nouveau_pfnmap_args, p.phys); Much simpler, thanks. >> +static struct nouveau_svmm * >> +nouveau_find_svmm(struct nouveau_svm *svm, struct mm_struct *mm) >> +{ >> + struct nouveau_ivmm *ivmm; >> + >> + list_for_each_entry(ivmm, &svm->inst, head) { >> + if (ivmm->svmm->notifier.mm == mm) >> + return ivmm->svmm; >> + } >> + return NULL; &g...
2020 Mar 04
5
[PATCH v3 0/4] nouveau/hmm: map pages after migration
...ma tree since other HMM related changes were queued there. Now that those have been merged, these patches just contain changes to nouveau so they could go through any tree. I guess Ben Skeggs' tree would be appropriate. Changes since v2: Added patches 1-3 to fix some minor issues. Eliminated nouveau_find_svmm() since it is easily found. Applied Jason Gunthorpe's suggestions for nouveau_pfns_to_args(). Changes since v1: Rebase to linux-5.6.0-rc4 Address Christoph Hellwig's comments Ralph Campbell (4): nouveau/hmm: fix vma range check for migration nouveau/hmm: check for SVM initialized...