Skip to contentSkip to conversation

xen/setup: Remove Identity Map Debug Message

PATCH Applied Matt Rushton 4 participants 11 messages Jul 20, 2014 – Aug 26, 2014

Subsystems (2)

v2 of 3 Applied Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 xen/setup: Remove Identity Map Debug Message

Removing a debug message for setting the identity map since it becomes rather noisy after rework of the identity map code.

---
 arch/x86/xen/p2m.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
arch/x86/xen/p2m.c +2 -3
index 9bb3d82..3172692 100644
@@ -841,10 +841,9 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s,
 			pfn = ALIGN(pfn, P2M_PER_PAGE);
 	}
 
-	if (!WARN((pfn - pfn_s) != (pfn_e - pfn_s),
+	WARN((pfn - pfn_s) != (pfn_e - pfn_s),
 		"Identity mapping failed. We are %ld short of 1-1 mappings!\n",
-		(pfn_e - pfn_s) - (pfn - pfn_s)))
-		printk(KERN_DEBUG "1-1 mapping on %lx->%lx\n", pfn_s, pfn);
+		(pfn_e - pfn_s) - (pfn - pfn_s));
 
 	return pfn - pfn_s;
 }
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 2/2 xen/setup: Remap Xen Identity Mapped RAM

Instead of ballooning up and down dom0 memory this remaps the existing mfns that were replaced by the identity map. The reason for this is that the existing implementation ballooned memory up and and down which caused dom0 to have discontiguous pages. In some cases this resulted in the use of bounce buffers which reduced network I/O performance significantly. This change will honor the existing order of the pages with the exception of some boundary conditions.

To do this we need to update both the Linux p2m table and the Xen m2p table. Particular care must be taken when updating the p2m table since it's important to limit table memory consumption and reuse the existing leaf pages which get freed when an entire leaf page is set to the identity map. To implement this, mapping updates are grouped into blocks with table entries getting cached temporarily and then released.

On my test system before:
Total pages: 2105014
Total contiguous: 1640635

After:
Total pages: 2105014
Total contiguous: 2098904

---
 arch/x86/xen/p2m.c   |   23 +---
 arch/x86/xen/p2m.h   |   15 ++
 arch/x86/xen/setup.c |  370 +++++++++++++++++++++++++++++++++++++++-----------
 3 files changed, 314 insertions(+), 94 deletions(-)
 create mode 100644 arch/x86/xen/p2m.h
arch/x86/xen/p2m.c +7 -16
index 3172692..9f5983b 100644
@@ -173,6 +173,7 @@
 #include <xen/balloon.h>
 #include <xen/grant_table.h>
 
+#include "p2m.h"
 #include "multicalls.h"
 #include "xen-ops.h"
 
@@ -180,12 +181,6 @@ static void __init m2p_override_init(void);
 
 unsigned long xen_max_p2m_pfn __read_mostly;
 
-#define P2M_PER_PAGE		(PAGE_SIZE / sizeof(unsigned long))
-#define P2M_MID_PER_PAGE	(PAGE_SIZE / sizeof(unsigned long *))
-#define P2M_TOP_PER_PAGE	(PAGE_SIZE / sizeof(unsigned long **))
-
-#define MAX_P2M_PFN		(P2M_TOP_PER_PAGE * P2M_MID_PER_PAGE * P2M_PER_PAGE)
-
 /* Placeholders for holes in the address space */
 static RESERVE_BRK_ARRAY(unsigned long, p2m_missing, P2M_PER_PAGE);
 static RESERVE_BRK_ARRAY(unsigned long *, p2m_mid_missing, P2M_MID_PER_PAGE);
@@ -202,16 +197,12 @@ static RESERVE_BRK_ARRAY(unsigned long, p2m_mid_identity_mfn, P2M_MID_PER_PAGE);
 RESERVE_BRK(p2m_mid, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE)));
 RESERVE_BRK(p2m_mid_mfn, PAGE_SIZE * (MAX_DOMAIN_PAGES / (P2M_PER_PAGE * P2M_MID_PER_PAGE)));
 
-/* We might hit two boundary violations at the start and end, at max each
- * boundary violation will require three middle nodes. */
-RESERVE_BRK(p2m_mid_extra, PAGE_SIZE * 2 * 3);
-
-/* When we populate back during bootup, the amount of pages can vary. The
- * max we have is seen is 395979, but that does not mean it can't be more.
- * Some machines can have 3GB I/O holes even. With early_can_reuse_p2m_middle
- * it can re-use Xen provided mfn_list array, so we only need to allocate at
- * most three P2M top nodes. */
-RESERVE_BRK(p2m_populated, PAGE_SIZE * 3);
+/* For each I/O range remapped we may lose up to two leaf pages for the boundary
+ * violations and three mid pages to cover up to 3GB. With
+ * early_can_reuse_p2m_middle() most of the leaf pages will be reused by the
+ * remapped region.
+ */
+RESERVE_BRK(p2m_identity_remap, PAGE_SIZE * 2 * 3 * MAX_REMAP_RANGES);
 
 static inline unsigned p2m_top_index(unsigned long pfn)
 {
arch/x86/xen/p2m.h new file +15 -0
new file mode 100644
index 0000000..ad8aee2
@@ -0,0 +1,15 @@
+#ifndef _XEN_P2M_H
+#define _XEN_P2M_H
+
+#define P2M_PER_PAGE        (PAGE_SIZE / sizeof(unsigned long))
+#define P2M_MID_PER_PAGE    (PAGE_SIZE / sizeof(unsigned long *))
+#define P2M_TOP_PER_PAGE    (PAGE_SIZE / sizeof(unsigned long **))
+
+#define MAX_P2M_PFN         (P2M_TOP_PER_PAGE * P2M_MID_PER_PAGE * P2M_PER_PAGE)
+
+#define MAX_REMAP_RANGES    10
+
+extern unsigned long __init set_phys_range_identity(unsigned long pfn_s,
+                                      unsigned long pfn_e);
+
+#endif  /* _XEN_P2M_H */
arch/x86/xen/setup.c +292 -78

460 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v2 2/2] xen/setup: Remap Xen Identity Mapped RAM

Quoted 15 lines · Matt Rushton

Instead of ballooning up and down dom0 memory this remaps the existing mfns that were replaced by the identity map. The reason for this is that the existing implementation ballooned memory up and and down which caused dom0 to have discontiguous pages. In some cases this resulted in the use of bounce buffers which reduced network I/O performance significantly. This change will honor the existing order of the pages with the exception of some boundary conditions.

To do this we need to update both the Linux p2m table and the Xen m2p table. Particular care must be taken when updating the p2m table since it's important to limit table memory consumption and reuse the existing leaf pages which get freed when an entire leaf page is set to the identity map. To implement this, mapping updates are grouped into blocks with table entries getting cached temporarily and then released.

Quoted 7 lines

On my test system before:
Total pages: 2105014
Total contiguous: 1640635

After:
Total pages: 2105014
Total contiguous: 2098904

This looks like a worthwhile improvement but...

Quoted 1 line
 arch/x86/xen/setup.c |  370 +++++++++++++++++++++++++++++++++++++++-----------

... Ew :(

It will take me a bit longer before I can give this a proper review.

David

Applied
#3 lore raw

Re: [PATCH v2 2/2] xen/setup: Remap Xen Identity Mapped RAM

In reply to Matt Rushton
Quoted 15 lines · Matt Rushton

Instead of ballooning up and down dom0 memory this remaps the existing mfns that were replaced by the identity map. The reason for this is that the existing implementation ballooned memory up and and down which caused dom0 to have discontiguous pages. In some cases this resulted in the use of bounce buffers which reduced network I/O performance significantly. This change will honor the existing order of the pages with the exception of some boundary conditions.

To do this we need to update both the Linux p2m table and the Xen m2p table. Particular care must be taken when updating the p2m table since it's important to limit table memory consumption and reuse the existing leaf pages which get freed when an entire leaf page is set to the identity map. To implement this, mapping updates are grouped into blocks with table entries getting cached temporarily and then released.

Quoted 7 lines

On my test system before:
Total pages: 2105014
Total contiguous: 1640635

After:
Total pages: 2105014
Total contiguous: 2098904

Applied to devel/for-linus-3.17

Thanks.

David

#4 lore raw

Re: [PATCH v2 2/2] xen/setup: Remap Xen Identity Mapped RAM

Quoted 20 lines · David Vrabel
Quoted 19 lines · Matt Rushton

Instead of ballooning up and down dom0 memory this remaps the existing mfns that were replaced by the identity map. The reason for this is that the existing implementation ballooned memory up and and down which caused dom0 to have discontiguous pages. In some cases this resulted in the use of bounce buffers which reduced network I/O performance significantly. This change will honor the existing order of the pages with the exception of some boundary conditions.

To do this we need to update both the Linux p2m table and the Xen m2p table. Particular care must be taken when updating the p2m table since it's important to limit table memory consumption and reuse the existing leaf pages which get freed when an entire leaf page is set to the identity map. To implement this, mapping updates are grouped into blocks with table entries getting cached temporarily and then released.

On my test system before:
Total pages: 2105014
Total contiguous: 1640635

Quoted 5 lines
Quoted 3 lines

After:
Total pages: 2105014
Total contiguous: 2098904

Applied to devel/for-linus-3.17

Unfortunately, this produces too many WARNINGs on some boxes or with certain configurations.

I will remove this patch from the queue for 3.17.

[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at /home/build/linux-boris/arch/x86/xen/setup.c:237 xen_update_mem_tables+0xae/0xb8()
[    0.000000] Failed to set m2p mapping for mfn=2302110 pfn=255744
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.16.0-rc5upstream-00266-gf83c52f #1
[    0.000000]  000000ed c17e9d2c c1615056 c1730590 c17e9d5c c109032f c1730618 c17e9d88
[    0.000000]  00000000 c1730590 000000ed c185b4c3 c185b4c3 deadbeef deadbeef 0000009e
[    0.000000]  c17e9d74 c10903ce 00000009 c17e9d6c c1730618 c17e9d88 c17e9db4 c185b4c3
[    0.000000] Call Trace:
[    0.000000]  [<c1615056>] dump_stack+0x48/0x60
[    0.000000]  [<c109032f>] warn_slowpath_common+0x7f/0xa0
[    0.000000]  [<c185b4c3>] ? xen_update_mem_tables+0xae/0xb8
[    0.000000]  [<c185b4c3>] ? xen_update_mem_tables+0xae/0xb8
[    0.000000]  [<c10903ce>] warn_slowpath_fmt+0x2e/0x30
[    0.000000]  [<c185b4c3>] xen_update_mem_tables+0xae/0xb8
[    0.000000]  [<c185bbbf>] xen_memory_setup+0x544/0xb33
[    0.000000]  [<c12de82c>] ? sprintf+0x1c/0x20
[    0.000000]  [<c1861b32>] setup_memory_map+0x19/0x3b
[    0.000000]  [<c185b332>] ? xen_arch_setup+0xad/0xe1
[    0.000000]  [<c185fc33>] setup_arch+0x246/0xe68
[    0.000000]  [<c103bd7e>] ? __raw_callee_save_xen_restore_fl+0x6/0x8
[    0.000000]  [<c10dc5ec>] ? vprintk_emit+0x19c/0x4a0
[    0.000000]  [<c1614efe>] ? printk+0x48/0x4a
[    0.000000]  [<c18569dc>] start_kernel+0x76/0x435
[    0.000000]  [<c103bf77>] ? xen_setup_runstate_info+0x27/0x40
[    0.000000]  [<c1856373>] i386_start_kernel+0x12e/0x131
[    0.000000]  [<c185b106>] xen_start_kernel+0x661/0x66c
[    0.000000] ---[ end trace db4b7fde7786bb07 ]---
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at /home/build/linux-boris/arch/x86/xen/setup.c:350 xen_memory_setup+0x580/0xb33()
[    0.000000] Failed to update mem mapping for pfn=256000 mfn=2302110
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G        W     3.16.0-rc5upstream-00266-gf83c52f #1
[    0.000000]  0000015e c17e9d6c c1615056 c1730590 c17e9d9c c109032f c17306b4 c17e9dc8
[    0.000000]  00000000 c1730590 0000015e c185bbfb c185bbfb 00000062 0003e700 0023209e
[    0.000000]  c17e9db4 c10903ce 00000009 c17e9dac c17306b4 c17e9dc8 c17e9e80 c185bbfb
[    0.000000] Call Trace:
[    0.000000]  [<c1615056>] dump_stack+0x48/0x60
[    0.000000]  [<c109032f>] warn_slowpath_common+0x7f/0xa0
[    0.000000]  [<c185bbfb>] ? xen_memory_setup+0x580/0xb33
[    0.000000]  [<c185bbfb>] ? xen_memory_setup+0x580/0xb33
[    0.000000]  [<c10903ce>] warn_slowpath_fmt+0x2e/0x30
[    0.000000]  [<c185bbfb>] xen_memory_setup+0x580/0xb33
[    0.000000]  [<c12de82c>] ? sprintf+0x1c/0x20
[    0.000000]  [<c1861b32>] setup_memory_map+0x19/0x3b
[    0.000000]  [<c185b332>] ? xen_arch_setup+0xad/0xe1
[    0.000000]  [<c185fc33>] setup_arch+0x246/0xe68
[    0.000000]  [<c103bd7e>] ? __raw_callee_save_xen_restore_fl+0x6/0x8
[    0.000000]  [<c10dc5ec>] ? vprintk_emit+0x19c/0x4a0
[    0.000000]  [<c1614efe>] ? printk+0x48/0x4a
[    0.000000]  [<c18569dc>] start_kernel+0x76/0x435
[    0.000000]  [<c103bf77>] ? xen_setup_runstate_info+0x27/0x40
[    0.000000]  [<c1856373>] i386_start_kernel+0x12e/0x131
[    0.000000]  [<c185b106>] xen_start_kernel+0x661/0x66c
[    0.000000] ---[ end trace db4b7fde7786bb08 ]---
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at /home/build/linux-boris/arch/x86/xen/setup.c:436 xen_memory_setup+0x654/0xb33()
[    0.000000] Failed to remap 1:1 memory cur_pfn=158 size=98 remap_pfn=255744
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G        W     3.16.0-rc5upstream-00266-gf83c52f #1
[    0.000000]  000001b4 c17e9d6c c1615056 c1730590 c17e9d9c c109032f c17306e8 c17e9dc8
[    0.000000]  00000000 c1730590 000001b4 c185bccf c185bccf c17e9e70 0003e700 0023209e
[    0.000000]  c17e9db4 c10903ce 00000009 c17e9dac c17306e8 c17e9dc8 c17e9e80 c185bccf
[    0.000000] Call Trace:
[    0.000000]  [<c1615056>] dump_stack+0x48/0x60
[    0.000000]  [<c109032f>] warn_slowpath_common+0x7f/0xa0
[    0.000000]  [<c185bccf>] ? xen_memory_setup+0x654/0xb33
[    0.000000]  [<c185bccf>] ? xen_memory_setup+0x654/0xb33
[    0.000000]  [<c10903ce>] warn_slowpath_fmt+0x2e/0x30
[    0.000000]  [<c185bccf>] xen_memory_setup+0x654/0xb33
[    0.000000]  [<c1861b32>] setup_memory_map+0x19/0x3b
[    0.000000]  [<c185b332>] ? xen_arch_setup+0xad/0xe1
[    0.000000]  [<c185fc33>] setup_arch+0x246/0xe68
[    0.000000]  [<c103bd7e>] ? __raw_callee_save_xen_restore_fl+0x6/0x8
[    0.000000]  [<c10dc5ec>] ? vprintk_emit+0x19c/0x4a0
[    0.000000]  [<c1614efe>] ? printk+0x48/0x4a
[    0.000000]  [<c18569dc>] start_kernel+0x76/0x435
[    0.000000]  [<c103bf77>] ? xen_setup_runstate_info+0x27/0x40
[    0.000000]  [<c1856373>] i386_start_kernel+0x12e/0x131
[    0.000000]  [<c185b106>] xen_start_kernel+0x661/0x66c
[    0.000000] ---[ end trace db4b7fde7786bb09 ]---
[    0.000000] Freeing 9e-100 pfn range: 98 pages freed
[    0.000000] Set 266437667 page(s) to 1-1 mapping
[    0.000000] Remapped 0 page(s), last_pfn=255744
[    0.000000] Released 98 page(s)
[    0.000000] ------------[ cut here ]------------
[    0.000000] WARNING: CPU: 0 PID: 0 at /home/build/linux-boris/arch/x86/xen/setup.c:95 xen_memory_setup+0x9c4/0xb33()
[    0.000000] Trying to remove 3e700 which has 23209e mfn!
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper Tainted: G        W     3.16.0-rc5upstream-00266-gf83c52f #1
[    0.000000]  0000005f c17e9d6c c1615056 c1730590 c17e9d9c c109032f c17307d0 c17e9dc8
[    0.000000]  00000000 c1730590 0000005f c185c03f c185c03f 3e700000 00000000 00000003
[    0.000000]  c17e9db4 c10903ce 00000009 c17e9dac c17307d0 c17e9dc8 c17e9e80 c185c03f
[    0.000000] Call Trace:
[    0.000000]  [<c1615056>] dump_stack+0x48/0x60
[    0.000000]  [<c109032f>] warn_slowpath_common+0x7f/0xa0
[    0.000000]  [<c185c03f>] ? xen_memory_setup+0x9c4/0xb33
[    0.000000]  [<c185c03f>] ? xen_memory_setup+0x9c4/0xb33
[    0.000000]  [<c10903ce>] warn_slowpath_fmt+0x2e/0x30
[    0.000000]  [<c185c03f>] xen_memory_setup+0x9c4/0xb33
[    0.000000]  [<c1861b32>] setup_memory_map+0x19/0x3b
[    0.000000]  [<c185b332>] ? xen_arch_setup+0xad/0xe1
[    0.000000]  [<c185fc33>] setup_arch+0x246/0xe68
[    0.000000]  [<c103bd7e>] ? __raw_callee_save_xen_restore_fl+0x6/0x8
[    0.000000]  [<c10dc5ec>] ? vprintk_emit+0x19c/0x4a0
[    0.000000]  [<c1614efe>] ? printk+0x48/0x4a
[    0.000000]  [<c18569dc>] start_kernel+0x76/0x435
[    0.000000]  [<c103bf77>] ? xen_setup_runstate_info+0x27/0x40
[    0.000000]  [<c1856373>] i386_start_kernel+0x12e/0x131
[    0.000000]  [<c185b106>] xen_start_kernel+0x661/0x66c
[    0.000000] ---[ end trace db4b7fde7786bb0a ]---
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] Xen: [mem 0x0000000000000000-0x000000000009dfff] usable
[    0.000000] Xen: [mem 0x000000000009ec00-0x00000000000fffff] reserved
[    0.000000] Xen: [mem 0x0000000000100000-0x000000004d061fff] usable
[    0.000000] Xen: [mem 0x000000004d062000-0x00000000a79b7fff] unusable
[    0.000000] Xen: [mem 0x00000000a79b8000-0x00000000a79fefff] ACPI NVS
[    0.000000] Xen: [mem 0x00000000a79ff000-0x00000000a7a08fff] ACPI data
[    0.000000] Xen: [mem 0x00000000a7a09000-0x00000000a7a65fff] reserved
[    0.000000] Xen: [mem 0x00000000a7a66000-0x00000000a7a68fff] ACPI NVS
[    0.000000] Xen: [mem 0x00000000a7a69000-0x00000000a7a6afff] unusable
[    0.000000] Xen: [mem 0x00000000a7a6b000-0x00000000a7a6bfff] reserved
[    0.000000] Xen: [mem 0x00000000a7a6c000-0x00000000a7a6cfff] ACPI NVS
[    0.000000] Xen: [mem 0x00000000a7a6d000-0x00000000a7aa3fff] reserved
[    0.000000] Xen: [mem 0x00000000a7aa4000-0x00000000a7aaafff] ACPI NVS
[    0.000000] Xen: [mem 0x00000000a7aab000-0x00000000a7ad1fff] reserved
[    0.000000] Xen: [mem 0x00000000a7ad2000-0x00000000a7b14fff] ACPI NVS
[    0.000000] Xen: [mem 0x00000000a7b15000-0x00000000a7d91fff] unusable
[    0.000000] Xen: [mem 0x00000000a7d92000-0x00000000a7ef6fff] reserved
[    0.000000] Xen: [mem 0x00000000a7ef7000-0x00000000a7efffff] unusable
[    0.000000] Xen: [mem 0x00000000fec00000-0x00000000fec00fff] reserved
[    0.000000] Xen: [mem 0x00000000fec10000-0x00000000fec10fff] reserved
[    0.000000] Xen: [mem 0x00000000fed00000-0x00000000fed00fff] reserved
[    0.000000] Xen: [mem 0x00000000fed61000-0x00000000fed70fff] reserved
[    0.000000] Xen: [mem 0x00000000fed80000-0x00000000fed8ffff] reserved
[    0.000000] Xen: [mem 0x00000000fee00000-0x00000000ffffffff] reserved
[    0.000000] Xen: [mem 0x0000000100001000-0x000000023fffffff] unusable
[    0.000000] Xen: [mem 0x000000fd00000000-0x000000ffffffffff] reserved

David

#5 lore raw

Re: [PATCH v2 2/2] xen/setup: Remap Xen Identity Mapped RAM

Quoted 21 lines · David Vrabel
Quoted 20 lines · David Vrabel
Quoted 19 lines · Matt Rushton

Instead of ballooning up and down dom0 memory this remaps the existing mfns that were replaced by the identity map. The reason for this is that the existing implementation ballooned memory up and and down which caused dom0 to have discontiguous pages. In some cases this resulted in the use of bounce buffers which reduced network I/O performance significantly. This change will honor the existing order of the pages with the exception of some boundary conditions.

To do this we need to update both the Linux p2m table and the Xen m2p table. Particular care must be taken when updating the p2m table since it's important to limit table memory consumption and reuse the existing leaf pages which get freed when an entire leaf page is set to the identity map. To implement this, mapping updates are grouped into blocks with table entries getting cached temporarily and then released.

On my test system before:
Total pages: 2105014
Total contiguous: 1640635

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

After:
Total pages: 2105014
Total contiguous: 2098904

Applied to devel/for-linus-3.17

Unfortunately, this produces too many WARNINGs on some boxes or with certain configurations.

Hi David,

Do you have more information about the systems or configurations that showed a problem?

--msw

#6 lore raw

Re: [PATCH v2 2/2] xen/setup: Remap Xen Identity Mapped RAM

Quoted 25 lines · Matt Wilson
Quoted 24 lines · David Vrabel
Quoted 23 lines · David Vrabel
Quoted 22 lines · Matt Rushton

Instead of ballooning up and down dom0 memory this remaps the existing mfns that were replaced by the identity map. The reason for this is that the existing implementation ballooned memory up and and down which caused dom0 to have discontiguous pages. In some cases this resulted in the use of bounce buffers which reduced network I/O performance significantly. This change will honor the existing order of the pages with the exception of some boundary conditions.

To do this we need to update both the Linux p2m table and the Xen m2p table. Particular care must be taken when updating the p2m table since it's important to limit table memory consumption and reuse the existing leaf pages which get freed when an entire leaf page is set to the identity map. To implement this, mapping updates are grouped into blocks with table entries getting cached temporarily and then released.

On my test system before:
Total pages: 2105014
Total contiguous: 1640635

After:
Total pages: 2105014
Total contiguous: 2098904

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Applied to devel/for-linus-3.17

Unfortunately, this produces too many WARNINGs on some boxes or with certain configurations.

Hi David,

Do you have more information about the systems or configurations that showed a problem?

This appears to be happening on 32-bit dom0.

-boris

#7 lore raw

Re: [PATCH v2 2/2] xen/setup: Remap Xen Identity Mapped RAM

Quoted 31 lines · Boris Ostrovsky
Quoted 30 lines · Matt Wilson
Quoted 21 lines · David Vrabel
Quoted 20 lines · David Vrabel
Quoted 19 lines · Matt Rushton

Instead of ballooning up and down dom0 memory this remaps the existing mfns that were replaced by the identity map. The reason for this is that the existing implementation ballooned memory up and and down which caused dom0 to have discontiguous pages. In some cases this resulted in the use of bounce buffers which reduced network I/O performance significantly. This change will honor the existing order of the pages with the exception of some boundary conditions.

To do this we need to update both the Linux p2m table and the Xen m2p table. Particular care must be taken when updating the p2m table since it's important to limit table memory consumption and reuse the existing leaf pages which get freed when an entire leaf page is set to the identity map. To implement this, mapping updates are grouped into blocks with table entries getting cached temporarily and then released.

On my test system before:
Total pages: 2105014
Total contiguous: 1640635

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

After:
Total pages: 2105014
Total contiguous: 2098904

Applied to devel/for-linus-3.17

Unfortunately, this produces too many WARNINGs on some boxes or with certain configurations.

Hi David,

Quoted 8 lines
Quoted 3 lines

Do you have more information about the systems or configurations that showed a problem?

This appears to be happening on 32-bit dom0.

-boris

It's unclear to me why the m2p update would be failing in this case (on first attempt) which causes the subsequent errors. I'll try to repro on a 32-bit dom0.

#8 lore raw

Re: [PATCH v2 2/2] xen/setup: Remap Xen Identity Mapped RAM

In reply to Boris Ostrovsky
Quoted 31 lines · Boris Ostrovsky
Quoted 30 lines · Matt Wilson
Quoted 21 lines · David Vrabel
Quoted 20 lines · David Vrabel
Quoted 19 lines · Matt Rushton

Instead of ballooning up and down dom0 memory this remaps the existing mfns that were replaced by the identity map. The reason for this is that the existing implementation ballooned memory up and and down which caused dom0 to have discontiguous pages. In some cases this resulted in the use of bounce buffers which reduced network I/O performance significantly. This change will honor the existing order of the pages with the exception of some boundary conditions.

To do this we need to update both the Linux p2m table and the Xen m2p table. Particular care must be taken when updating the p2m table since it's important to limit table memory consumption and reuse the existing leaf pages which get freed when an entire leaf page is set to the identity map. To implement this, mapping updates are grouped into blocks with table entries getting cached temporarily and then released.

On my test system before:
Total pages: 2105014
Total contiguous: 1640635

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines

After:
Total pages: 2105014
Total contiguous: 2098904

Applied to devel/for-linus-3.17

Unfortunately, this produces too many WARNINGs on some boxes or with certain configurations.

Hi David,

Quoted 8 lines
Quoted 3 lines

Do you have more information about the systems or configurations that showed a problem?

This appears to be happening on 32-bit dom0.

-boris

I just pushed a v3 version of the patch set which should fix the issue. There was casting issue that would affect 32-bit builds.

#9 lore raw

Re: [PATCH v2 2/2] xen/setup: Remap Xen Identity Mapped RAM

In reply to David Vrabel
Quoted 21 lines · David Vrabel
Quoted 20 lines · David Vrabel
Quoted 19 lines · Matt Rushton

Instead of ballooning up and down dom0 memory this remaps the existing mfns that were replaced by the identity map. The reason for this is that the existing implementation ballooned memory up and and down which caused dom0 to have discontiguous pages. In some cases this resulted in the use of bounce buffers which reduced network I/O performance significantly. This change will honor the existing order of the pages with the exception of some boundary conditions.

To do this we need to update both the Linux p2m table and the Xen m2p table. Particular care must be taken when updating the p2m table since it's important to limit table memory consumption and reuse the existing leaf pages which get freed when an entire leaf page is set to the identity map. To implement this, mapping updates are grouped into blocks with table entries getting cached temporarily and then released.

On my test system before:
Total pages: 2105014
Total contiguous: 1640635

Quoted 9 lines
Quoted 4 lines
Quoted 3 lines

After:
Total pages: 2105014
Total contiguous: 2098904

Applied to devel/for-linus-3.17

Unfortunately, this produces too many WARNINGs on some boxes or with certain configurations.

I will remove this patch from the queue for 3.17.

Have you had a chance to try the v3 patch set?

Reviewed-by on v2 1/2
#10 lore raw
In reply to Matt Rushton
Quoted 2 lines · Matt Rushton

Removing a debug message for setting the identity map since it becomes rather noisy after rework of the identity map code.

David

Quoted 16 lines
arch/x86/xen/p2m.c +2 -3
@@ -841,10 +841,9 @@ unsigned long __init set_phys_range_identity(unsigned long pfn_s,
 			pfn = ALIGN(pfn, P2M_PER_PAGE);
 	}
 
-	if (!WARN((pfn - pfn_s) != (pfn_e - pfn_s),
+	WARN((pfn - pfn_s) != (pfn_e - pfn_s),
 		"Identity mapping failed. We are %ld short of 1-1 mappings!\n",
-		(pfn_e - pfn_s) - (pfn - pfn_s)))
-		printk(KERN_DEBUG "1-1 mapping on %lx->%lx\n", pfn_s, pfn);
+		(pfn_e - pfn_s) - (pfn - pfn_s));
 
 	return pfn - pfn_s;
 }