Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1525558 > unrolled thread
| Started by | Jérôme Glisse <jglisse@redhat.com> |
|---|---|
| First post | 2016-11-18 18:20 +0100 |
| Last post | 2016-11-21 06:10 +0100 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[HMM v13 07/18] mm/ZONE_DEVICE/x86: add support for un-addressable device memory Jérôme Glisse <jglisse@redhat.com> - 2016-11-18 18:20 +0100
Re: [HMM v13 07/18] mm/ZONE_DEVICE/x86: add support for un-addressable device memory Balbir Singh <bsingharora@gmail.com> - 2016-11-21 03:10 +0100
Re: [HMM v13 07/18] mm/ZONE_DEVICE/x86: add support for un-addressable device memory Jerome Glisse <jglisse@redhat.com> - 2016-11-21 06:10 +0100
| From | Jérôme Glisse <jglisse@redhat.com> |
|---|---|
| Date | 2016-11-18 18:20 +0100 |
| Subject | [HMM v13 07/18] mm/ZONE_DEVICE/x86: add support for un-addressable device memory |
| Message-ID | <sEUZr-1B7-17@gated-at.bofh.it> |
It does not need much, just skip populating kernel linear mapping
for range of un-addressable device memory (it is pick so that there
is no physical memory resource overlapping it). All the logic is in
share mm code.
Only support x86-64 as this feature doesn't make much sense with
constrained virtual address space of 32bits architecture.
Signed-off-by: Jérôme Glisse <jglisse@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
---
arch/x86/mm/init_64.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 8c4abb0..556f7bb 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -661,13 +661,17 @@ int arch_add_memory(int nid, u64 start, u64 size, int flags)
unsigned long nr_pages = size >> PAGE_SHIFT;
int ret;
- /* Need to add support for device and unaddressable memory if needed */
- if (flags & MEMORY_UNADDRESSABLE) {
- BUG();
- return -EINVAL;
- }
-
- init_memory_mapping(start, start + size);
+ /*
+ * We get un-addressable memory when some one is adding a ZONE_DEVICE
+ * to have struct page for a device memory which is not accessible by
+ * the CPU so it is pointless to have a linear kernel mapping of such
+ * memory.
+ *
+ * Core mm should make sure it never set a pte pointing to such fake
+ * physical range.
+ */
+ if (!(flags & MEMORY_UNADDRESSABLE))
+ init_memory_mapping(start, start + size);
ret = __add_pages(nid, zone, start_pfn, nr_pages);
WARN_ON_ONCE(ret);
@@ -972,12 +976,6 @@ int __ref arch_remove_memory(u64 start, u64 size, int flags)
struct zone *zone;
int ret;
- /* Need to add support for device and unaddressable memory if needed */
- if (flags & MEMORY_UNADDRESSABLE) {
- BUG();
- return -EINVAL;
- }
-
/* With altmap the first mapped page is offset from @start */
altmap = to_vmem_altmap((unsigned long) page);
if (altmap)
@@ -985,7 +983,9 @@ int __ref arch_remove_memory(u64 start, u64 size, int flags)
zone = page_zone(page);
ret = __remove_pages(zone, start_pfn, nr_pages);
WARN_ON_ONCE(ret);
- kernel_physical_mapping_remove(start, start + size);
+
+ if (!(flags & MEMORY_UNADDRESSABLE))
+ kernel_physical_mapping_remove(start, start + size);
return ret;
}
--
2.4.3
[toc] | [next] | [standalone]
| From | Balbir Singh <bsingharora@gmail.com> |
|---|---|
| Date | 2016-11-21 03:10 +0100 |
| Subject | Re: [HMM v13 07/18] mm/ZONE_DEVICE/x86: add support for un-addressable device memory |
| Message-ID | <sFMdr-3fW-3@gated-at.bofh.it> |
| In reply to | #1525558 |
On 19/11/16 05:18, Jérôme Glisse wrote: > It does not need much, just skip populating kernel linear mapping > for range of un-addressable device memory (it is pick so that there > is no physical memory resource overlapping it). All the logic is in > share mm code. > > Only support x86-64 as this feature doesn't make much sense with > constrained virtual address space of 32bits architecture. > Is there a reason this would not work on powerpc64 for example? Could you document the limitations -- testing/APIs/missing features? Balbir Singh.
[toc] | [prev] | [next] | [standalone]
| From | Jerome Glisse <jglisse@redhat.com> |
|---|---|
| Date | 2016-11-21 06:10 +0100 |
| Subject | Re: [HMM v13 07/18] mm/ZONE_DEVICE/x86: add support for un-addressable device memory |
| Message-ID | <sFP1D-59B-5@gated-at.bofh.it> |
| In reply to | #1526330 |
On Mon, Nov 21, 2016 at 01:08:56PM +1100, Balbir Singh wrote: > > > On 19/11/16 05:18, Jérôme Glisse wrote: > > It does not need much, just skip populating kernel linear mapping > > for range of un-addressable device memory (it is pick so that there > > is no physical memory resource overlapping it). All the logic is in > > share mm code. > > > > Only support x86-64 as this feature doesn't make much sense with > > constrained virtual address space of 32bits architecture. > > > > Is there a reason this would not work on powerpc64 for example? > Could you document the limitations -- testing/APIs/missing features? It should be straight forward for powerpc64, i haven't done it but i certainly can try to get access to some powerpc64 and add support for it. The only thing to do is to avoid creating kernel linear mapping for the un-addressable memory (just for safety reasons we do not want any read/ write to invalid physical address). Cheers, Jérôme
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web