Displaying 7 results from an estimated 7 matches for "mmu_interval_notifier_put".
2020 Jan 13
0
[PATCH v6 2/6] mm/mmu_notifier: add mmu_interval_notifier_put()
...called safely from inside the
invalidate() callback because it sleeps waiting for invalidate callbacks
to finish. Removals might be needed when the invalidate() callback is
for munmap() (i.e., the event type MMU_NOTIFY_UNMAP), and the interval
being tracked is no longer needed.
Add a new function mmu_interval_notifier_put() which is safe to call from
the invalidate() callback. The ops->release() function will be called when
all callbacks are finished and no CPUs are accessing the
mmu_interval_notifier.
Signed-off-by: Ralph Campbell <rcampbell at nvidia.com>
---
include/linux/mmu_notifier.h | 6 +++
mm/mm...
2020 Jan 13
0
[PATCH v6 3/6] mm/notifier: add mmu_interval_notifier_update()
...long invalidate_seq;
+ unsigned long updated_start;
+ unsigned long updated_last;
};
#ifdef CONFIG_MMU_NOTIFIER
@@ -310,6 +312,8 @@ int mmu_interval_notifier_insert_safe(
const struct mmu_interval_notifier_ops *ops);
void mmu_interval_notifier_remove(struct mmu_interval_notifier *mni);
void mmu_interval_notifier_put(struct mmu_interval_notifier *mni);
+void mmu_interval_notifier_update(struct mmu_interval_notifier *mni,
+ unsigned long start, unsigned long last);
/**
* mmu_interval_set_seq - Save the invalidation sequence
diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c
index 40c837ae8d90..47ad9cc8...
2020 Jan 13
9
[PATCH v6 0/6] mm/hmm/test: add self tests for HMM
...le 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 at nvidia.com
Ralph Campbell (6):
mm/mmu_notifier: add mmu_interval_notifier_insert_safe()
mm/mmu_notifier: add mmu_interval_notifier_put()
mm/notifier: add mmu_interval_notifier_update()
mm/mmu_notifier: add mmu_interval_notifier_find()
nouveau: use new mmu interval notifiers
mm/hmm/test: add self tests for HMM
MAINTAINERS | 3 +
drivers/gpu/drm/nouveau/nouveau_svm.c | 313 ++++--
include/li...
2020 Jan 14
2
[PATCH v6 5/6] nouveau: use new mmu interval notifiers
...mm *svmm = *psvmm;
> + struct mmu_interval_notifier *mni;
> +
> if (svmm) {
> mutex_lock(&svmm->mutex);
> + while (true) {
> + mni = mmu_interval_notifier_find(svmm->mm,
> + &nouveau_svm_mni_ops, 0UL, ~0UL);
> + if (!mni)
> + break;
> + mmu_interval_notifier_put(mni);
Oh, now I really don't like the name 'put'. It looks like mni is
refcounted here, and it isn't. put should be called 'remove_deferred'
And then you also need a way to barrier this scheme on driver unload.
> + }
> svmm->vmm = NULL;
> mutex_unlock(&...
2020 Jan 13
0
[PATCH v6 5/6] nouveau: use new mmu interval notifiers
...truct nouveau_svmm **psvmm)
{
struct nouveau_svmm *svmm = *psvmm;
+ struct mmu_interval_notifier *mni;
+
if (svmm) {
mutex_lock(&svmm->mutex);
+ while (true) {
+ mni = mmu_interval_notifier_find(svmm->mm,
+ &nouveau_svm_mni_ops, 0UL, ~0UL);
+ if (!mni)
+ break;
+ mmu_interval_notifier_put(mni);
+ }
svmm->vmm = NULL;
mutex_unlock(&svmm->mutex);
- mmu_notifier_put(&svmm->notifier);
+ mmdrop(svmm->mm);
+ kfree(svmm);
*psvmm = NULL;
}
}
@@ -343,11 +319,12 @@ nouveau_svmm_init(struct drm_device *dev, void *data,
goto out_free;
down_write(&cu...
2020 Jan 13
0
[PATCH v6 4/6] mm/mmu_notifier: add mmu_interval_notifier_find()
..., 48 insertions(+)
diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
index 0ce59b4f22c2..cdbbad13b278 100644
--- a/include/linux/mmu_notifier.h
+++ b/include/linux/mmu_notifier.h
@@ -314,6 +314,21 @@ void mmu_interval_notifier_remove(struct mmu_interval_notifier *mni);
void mmu_interval_notifier_put(struct mmu_interval_notifier *mni);
void mmu_interval_notifier_update(struct mmu_interval_notifier *mni,
unsigned long start, unsigned long last);
+struct mmu_interval_notifier *mmu_interval_notifier_find(struct mm_struct *mm,
+ const struct mmu_interval_notifier_ops *ops,
+ unsigned...
2020 Jan 15
0
[PATCH v6 5/6] nouveau: use new mmu interval notifiers
...nterval_notifier *mni;
>> +
>> if (svmm) {
>> mutex_lock(&svmm->mutex);
>> + while (true) {
>> + mni = mmu_interval_notifier_find(svmm->mm,
>> + &nouveau_svm_mni_ops, 0UL, ~0UL);
>> + if (!mni)
>> + break;
>> + mmu_interval_notifier_put(mni);
>
> Oh, now I really don't like the name 'put'. It looks like mni is
> refcounted here, and it isn't. put should be called 'remove_deferred'
OK.
> And then you also need a way to barrier this scheme on driver unload.
Good point. I can add something like...