Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1666200 > unrolled thread
| Started by | Jérôme Glisse <jglisse@redhat.com> |
|---|---|
| First post | 2017-06-14 22:20 +0200 |
| Last post | 2017-06-15 01:50 +0200 |
| Articles | 6 — 5 participants |
Back to article view | Back to linux.kernel
[HMM-CDM 0/5] Cache coherent device memory (CDM) with HMM Jérôme Glisse <jglisse@redhat.com> - 2017-06-14 22:20 +0200
Re: [HMM-CDM 0/5] Cache coherent device memory (CDM) with HMM Dave Hansen <dave.hansen@intel.com> - 2017-06-14 23:30 +0200
Re: [HMM-CDM 0/5] Cache coherent device memory (CDM) with HMM Jerome Glisse <jglisse@redhat.com> - 2017-06-14 23:40 +0200
Re: [HMM-CDM 0/5] Cache coherent device memory (CDM) with HMM Dave Hansen <dave.hansen@intel.com> - 2017-06-15 00:00 +0200
Re: [HMM-CDM 0/5] Cache coherent device memory (CDM) with HMM Benjamin Herrenschmidt <benh@kernel.crashing.org> - 2017-06-15 00:10 +0200
Re: [HMM-CDM 0/5] Cache coherent device memory (CDM) with HMM Balbir Singh <bsingharora@gmail.com> - 2017-06-15 01:50 +0200
| From | Jérôme Glisse <jglisse@redhat.com> |
|---|---|
| Date | 2017-06-14 22:20 +0200 |
| Subject | [HMM-CDM 0/5] Cache coherent device memory (CDM) with HMM |
| Message-ID | <tSmVH-1k9-3@gated-at.bofh.it> |
Cache coherent device memory apply to architecture with system bus
like CAPI or CCIX. Device connected to such system bus can expose
their memory to the system and allow cache coherent access to it
from the CPU.
Even if for all intent and purposes device memory behave like regular
memory, we still want to manage it in isolation from regular memory.
Several reasons for that, first and foremost this memory is less
reliable than regular memory if the device hangs because of invalid
commands we can loose access to device memory. Second CPU access to
this memory is expected to be slower than to regular memory. Third
having random memory into device means that some of the bus bandwith
wouldn't be available to the device but would be use by CPU access.
This is why we want to manage such memory in isolation from regular
memory. Kernel should not try to use this memory as last resort
when running out of memory, at least for now.
This patchset add a new type of ZONE_DEVICE memory (DEVICE_PUBLIC)
that is use to represent CDM memory. This patchset build on top of
the HMM patchset that already introduce a new type of ZONE_DEVICE
memory for private device memory (see HMM patchset).
The end result is that with this patch if a device is in use in
a process you might have private anonymous memory or file back
page memory using ZONE_DEVICE (MEMORY_PUBLIC). Thus care must be
taken to not overwritte lru fields of such pages.
Hence all core mm changes are done to address assumption that any
process memory is back by a regular struct page that is part of
the lru. ZONE_DEVICE page are not on the lru and the lru pointer
of struct page are use to store device specific informations.
Thus this patch update all code path that would make assumptions
about lruness of a process page.
patch 01 - deals with all the core mm functions
patch 02 - add an helper to HMM for hotplug of CDM memory
patch 03 - preparatory patch for memory controller changes
patch 04 - update memory controller to properly handle
ZONE_DEVICE pages when uncharging
patch 05 - kernel configuration updates and cleanup
git tree:
https://cgit.freedesktop.org/~glisse/linux/log/?h=hmm-cdm-v2
Cc: cgroups@vger.kernel.org
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Balbir Singh <balbirs@au1.ibm.com>
Cc: Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Jérôme Glisse (5):
mm/device-public-memory: device memory cache coherent with CPU
mm/hmm: add new helper to hotplug CDM memory region
mm/memcontrol: allow to uncharge page without using page->lru field
mm/memcontrol: support MEMORY_DEVICE_PRIVATE and MEMORY_DEVICE_PUBLIC
mm/hmm: simplify kconfig and enable HMM and DEVICE_PUBLIC for ppc64
fs/proc/task_mmu.c | 2 +-
include/linux/hmm.h | 7 +-
include/linux/ioport.h | 1 +
include/linux/memremap.h | 21 +++++
include/linux/mm.h | 16 ++--
kernel/memremap.c | 13 ++-
mm/Kconfig | 30 +++----
mm/gup.c | 7 ++
mm/hmm.c | 89 +++++++++++++++++--
mm/madvise.c | 2 +-
mm/memcontrol.c | 226 ++++++++++++++++++++++++++++++-----------------
mm/memory.c | 46 ++++++++--
mm/migrate.c | 60 ++++++++-----
mm/swap.c | 11 +++
14 files changed, 389 insertions(+), 142 deletions(-)
--
2.9.3
[toc] | [next] | [standalone]
| From | Dave Hansen <dave.hansen@intel.com> |
|---|---|
| Date | 2017-06-14 23:30 +0200 |
| Message-ID | <tSo1r-1Xi-17@gated-at.bofh.it> |
| In reply to | #1666200 |
On 06/14/2017 01:11 PM, Jérôme Glisse wrote: > Cache coherent device memory apply to architecture with system bus > like CAPI or CCIX. Device connected to such system bus can expose > their memory to the system and allow cache coherent access to it > from the CPU. How does this interact with device memory that's enumerated in the new ACPI 6.2 HMAT? That stuff is also in the normal e820 and, by default, treated as normal system RAM. Would this mechanism be used for those devices as well? http://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf
[toc] | [prev] | [next] | [standalone]
| From | Jerome Glisse <jglisse@redhat.com> |
|---|---|
| Date | 2017-06-14 23:40 +0200 |
| Message-ID | <tSob8-22d-17@gated-at.bofh.it> |
| In reply to | #1666244 |
On Wed, Jun 14, 2017 at 02:20:23PM -0700, Dave Hansen wrote: > On 06/14/2017 01:11 PM, Jérôme Glisse wrote: > > Cache coherent device memory apply to architecture with system bus > > like CAPI or CCIX. Device connected to such system bus can expose > > their memory to the system and allow cache coherent access to it > > from the CPU. > > How does this interact with device memory that's enumerated in the new > ACPI 6.2 HMAT? That stuff is also in the normal e820 and, by default, > treated as normal system RAM. Would this mechanism be used for those > devices as well? > > http://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf It doesn't interact with that. HMM-CDM is a set of helper that don't do anything unless instructed so. So for device memory to be presented as HMM-CDM you need to hotplug it as ZONE_DEVICE(DEVICE_PUBLIC) which can be done with the helper introduced in patch 2 of this patchset. I don't think that the HMAT inside ACPI is restricted or even intended for device memory. The kind of memory i am refering too in HMM-CDM is for instance GPU on board memory. On PCIE system the CPU can not access such memory in the same manner as regular memory but on CAPI or CCIX system it can. How such memory is listed is platform/architecture specific and HMM-CDM does not deal with that. So PowerPC CAPI will have its own way of discovering such device memory. So will CCIX platform (thought for CCIX i expect that UEFI/ACPI will be involve through HMAT or something new). Also if HMAT allow represent device memory, the choice to use HMM-CDM would still be with the device driver. For persistent memory is does not make sense and it might not make sense for other devices too. I expect this to be usefull for GPU, FPGA or similar accelerator (like Xeon Phi as add on card if there is ever something like CCIX supported by Intel). Hope this answer your question Jérôme
[toc] | [prev] | [next] | [standalone]
| From | Dave Hansen <dave.hansen@intel.com> |
|---|---|
| Date | 2017-06-15 00:00 +0200 |
| Message-ID | <tSouu-28y-11@gated-at.bofh.it> |
| In reply to | #1666251 |
On 06/14/2017 02:38 PM, Jerome Glisse wrote: > On Wed, Jun 14, 2017 at 02:20:23PM -0700, Dave Hansen wrote: >> On 06/14/2017 01:11 PM, Jérôme Glisse wrote: >>> Cache coherent device memory apply to architecture with system bus >>> like CAPI or CCIX. Device connected to such system bus can expose >>> their memory to the system and allow cache coherent access to it >>> from the CPU. >> How does this interact with device memory that's enumerated in the new >> ACPI 6.2 HMAT? That stuff is also in the normal e820 and, by default, >> treated as normal system RAM. Would this mechanism be used for those >> devices as well? >> >> http://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf > It doesn't interact with that. HMM-CDM is a set of helper that don't > do anything unless instructed so. So for device memory to be presented > as HMM-CDM you need to hotplug it as ZONE_DEVICE(DEVICE_PUBLIC) which > can be done with the helper introduced in patch 2 of this patchset. I guess I'm asking whether we *should* instruct HMM-CDM to manage all coherent device memory. If not, where do we draw the line for what we use HMM-CDM, and for what we use the core MM? > I don't think that the HMAT inside ACPI is restricted or even intended > for device memory. It can definitely describe memory attached to memory controllers which are not directly attached to CPUs. That means either some kind of memory expander, or device memory.
[toc] | [prev] | [next] | [standalone]
| From | Benjamin Herrenschmidt <benh@kernel.crashing.org> |
|---|---|
| Date | 2017-06-15 00:10 +0200 |
| Message-ID | <tSoEa-2rK-11@gated-at.bofh.it> |
| In reply to | #1666254 |
On Wed, 2017-06-14 at 14:58 -0700, Dave Hansen wrote: > > > http://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf > > > > It doesn't interact with that. HMM-CDM is a set of helper that don't > > do anything unless instructed so. So for device memory to be presented > > as HMM-CDM you need to hotplug it as ZONE_DEVICE(DEVICE_PUBLIC) which > > can be done with the helper introduced in patch 2 of this patchset. > > I guess I'm asking whether we *should* instruct HMM-CDM to manage all > coherent device memory. If not, where do we draw the line for what we > use HMM-CDM, and for what we use the core MM? Well, if you want the features of HMM ... It basically boils down to whether you have some kind of coherent processing unit close to that memory and want to manage transparent migration of pages between system and device memory, that sort of thing. Cheers, Ben.
[toc] | [prev] | [next] | [standalone]
| From | Balbir Singh <bsingharora@gmail.com> |
|---|---|
| Date | 2017-06-15 01:50 +0200 |
| Message-ID | <tSqcV-3gS-7@gated-at.bofh.it> |
| In reply to | #1666254 |
On Thu, Jun 15, 2017 at 7:58 AM, Dave Hansen <dave.hansen@intel.com> wrote: > On 06/14/2017 02:38 PM, Jerome Glisse wrote: >> On Wed, Jun 14, 2017 at 02:20:23PM -0700, Dave Hansen wrote: >>> On 06/14/2017 01:11 PM, Jérôme Glisse wrote: >>>> Cache coherent device memory apply to architecture with system bus >>>> like CAPI or CCIX. Device connected to such system bus can expose >>>> their memory to the system and allow cache coherent access to it >>>> from the CPU. >>> How does this interact with device memory that's enumerated in the new >>> ACPI 6.2 HMAT? That stuff is also in the normal e820 and, by default, >>> treated as normal system RAM. Would this mechanism be used for those >>> devices as well? >>> >>> http://www.uefi.org/sites/default/files/resources/ACPI_6_2.pdf >> It doesn't interact with that. HMM-CDM is a set of helper that don't >> do anything unless instructed so. So for device memory to be presented >> as HMM-CDM you need to hotplug it as ZONE_DEVICE(DEVICE_PUBLIC) which >> can be done with the helper introduced in patch 2 of this patchset. > [Removing my cc'd email id and responding from a different address] > I guess I'm asking whether we *should* instruct HMM-CDM to manage all > coherent device memory. If not, where do we draw the line for what we > use HMM-CDM, and for what we use the core MM? > If you believe the memory is managed by the device (and owned by a device driver) I'd suggest using HMM-CDM. The idea behind HMM-CDM was that it enables transparent migration of pages and its preferred when locality of computation and locality of memory access is the preferred model. The other model was N_COHERENT_MEMORY that used the core MM, but there were objections to exposing device memory using that technology. Balbir Singh.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web