Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1526364
| From | Jerome Glisse <jglisse@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [HMM v13 09/18] mm/hmm/mirror: mirror process address space on device with HMM helpers |
| Date | 2016-11-21 06:20 +0100 |
| Message-ID | <sFPbj-5cE-5@gated-at.bofh.it> (permalink) |
| References | <sEUZr-1B7-3@gated-at.bofh.it> <sEV97-1Es-9@gated-at.bofh.it> <sFMQ9-3uc-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Nov 21, 2016 at 01:42:43PM +1100, Balbir Singh wrote:
> On 19/11/16 05:18, Jérôme Glisse wrote:
[...]
> > +/*
> > + * hmm_mirror_register() - register a mirror against an mm
> > + *
> > + * @mirror: new mirror struct to register
> > + * @mm: mm to register against
> > + *
> > + * To start mirroring a process address space device driver must register an
> > + * HMM mirror struct.
> > + */
> > +int hmm_mirror_register(struct hmm_mirror *mirror, struct mm_struct *mm)
> > +{
> > + /* Sanity check */
> > + if (!mm || !mirror || !mirror->ops)
> > + return -EINVAL;
> > +
> > + mirror->hmm = hmm_register(mm);
> > + if (!mirror->hmm)
> > + return -ENOMEM;
> > +
> > + /* Register mmu_notifier if not already, use mmap_sem for locking */
> > + if (!mirror->hmm->mmu_notifier.ops) {
> > + struct hmm *hmm = mirror->hmm;
> > + down_write(&mm->mmap_sem);
> > + if (!hmm->mmu_notifier.ops) {
> > + hmm->mmu_notifier.ops = &hmm_mmu_notifier_ops;
> > + if (__mmu_notifier_register(&hmm->mmu_notifier, mm)) {
> > + hmm->mmu_notifier.ops = NULL;
> > + up_write(&mm->mmap_sem);
> > + return -ENOMEM;
> > + }
> > + }
> > + up_write(&mm->mmap_sem);
> > + }
>
> Does everything get mirrored, every update to the PTE (clear dirty, clear
> accessed bit, etc) or does the driver decide?
Driver decide but only read/write/valid matter for device. Device driver must
report dirtyness on invalidation. Some device do not have access bit and thus
can't provide that information.
The idea here is really to snapshot the CPU page table and duplicate it as
a GPU page table. The only synchronization HMM provide is that each virtual
address point to same memory at that at no point in time the same virtual
address can point to different physical memory on the device and on the CPU.
Cheers,
Jérôme
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[HMM v13 00/18] HMM (Heterogeneous Memory Management) v13 Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:20 +0100
[HMM v13 13/18] mm/hmm/mirror: device page fault handler Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:20 +0100
[HMM v13 12/18] mm/hmm/mirror: helper to snapshot CPU page table Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:30 +0100
[HMM v13 02/18] mm/ZONE_DEVICE/unaddressable: add support for un-addressable device memory Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:30 +0100
Re: [HMM v13 02/18] mm/ZONE_DEVICE/unaddressable: add support for un-addressable device memory Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-21 09:10 +0100
Re: [HMM v13 02/18] mm/ZONE_DEVICE/unaddressable: add support for un-addressable device memory Jerome Glisse <jglisse@redhat.com> - 2016-11-21 13:40 +0100
Re: [HMM v13 02/18] mm/ZONE_DEVICE/unaddressable: add support for un-addressable device memory Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-22 06:20 +0100
[HMM v13 09/18] mm/hmm/mirror: mirror process address space on device with HMM helpers Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:30 +0100
Re: [HMM v13 09/18] mm/hmm/mirror: mirror process address space on device with HMM helpers Balbir Singh <bsingharora@gmail.com> - 2016-11-21 03:50 +0100
Re: [HMM v13 09/18] mm/hmm/mirror: mirror process address space on device with HMM helpers Jerome Glisse <jglisse@redhat.com> - 2016-11-21 06:20 +0100
[HMM v13 05/18] mm/ZONE_DEVICE/devmem_pages_remove: allow early removal of device memory Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:30 +0100
Re: [HMM v13 05/18] mm/ZONE_DEVICE/devmem_pages_remove: allow early removal of device memory Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-21 11:40 +0100
Re: [HMM v13 05/18] mm/ZONE_DEVICE/devmem_pages_remove: allow early removal of device memory Jerome Glisse <jglisse@redhat.com> - 2016-11-21 13:40 +0100
Re: [HMM v13 05/18] mm/ZONE_DEVICE/devmem_pages_remove: allow early removal of device memory Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-22 06:00 +0100
[HMM v13 04/18] mm/ZONE_DEVICE/free-page: callback when page is freed Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:30 +0100
Re: [HMM v13 04/18] mm/ZONE_DEVICE/free-page: callback when page is freed Balbir Singh <bsingharora@gmail.com> - 2016-11-21 03:00 +0100
Re: [HMM v13 04/18] mm/ZONE_DEVICE/free-page: callback when page is freed Jerome Glisse <jglisse@redhat.com> - 2016-11-21 06:00 +0100
Re: [HMM v13 04/18] mm/ZONE_DEVICE/free-page: callback when page is freed Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-21 09:30 +0100
Re: [HMM v13 04/18] mm/ZONE_DEVICE/free-page: callback when page is freed Jerome Glisse <jglisse@redhat.com> - 2016-11-21 13:40 +0100
Re: [HMM v13 04/18] mm/ZONE_DEVICE/free-page: callback when page is freed Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-22 06:10 +0100
[HMM v13 10/18] mm/hmm/mirror: add range lock helper, prevent CPU page table update for the range Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:30 +0100
[HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:30 +0100
Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Balbir Singh <bsingharora@gmail.com> - 2016-11-21 03:10 +0100
Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Jerome Glisse <jglisse@redhat.com> - 2016-11-21 06:10 +0100
Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Balbir Singh <bsingharora@gmail.com> - 2016-11-22 03:30 +0100
Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Jerome Glisse <jglisse@redhat.com> - 2016-11-22 15:00 +0100
Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-21 12:20 +0100
Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-21 12:00 +0100
Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Jerome Glisse <jglisse@redhat.com> - 2016-11-21 13:50 +0100
Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Anshuman Khandual <khandual@linux.vnet.ibm.com> - 2016-11-22 05:50 +0100
Re: [HMM v13 06/18] mm/ZONE_DEVICE/unaddressable: add special swap for unaddressable Jerome Glisse <jglisse@redhat.com> - 2016-11-24 15:00 +0100
[HMM v13 11/18] mm/hmm/mirror: add range monitor helper, to monitor CPU page table update Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:30 +0100
Re: [HMM v13 00/18] HMM (Heterogeneous Memory Management) v13 John Hubbard <jhubbard@nvidia.com> - 2016-11-19 01:50 +0100
Re: [HMM v13 00/18] HMM (Heterogeneous Memory Management) v13 "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> - 2016-11-19 16:00 +0100
csiph-web