linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Thorlton <athorlton@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: Alex Thorlton <athorlton@sgi.com>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Juergen Gross <jgross@suse.com>, Russ Anderson <rja@sgi.com>,
	David Vrabel <david.vrabel@citrix.com>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	x86@kernel.org, xen-devel@lists.xenproject.org
Subject: [PATCH 2/2] xen/x86: Increase xen_e820_map to E820_X_MAX possible entries
Date: Mon,  5 Dec 2016 11:49:14 -0600	[thread overview]
Message-ID: <1480960154-211541-3-git-send-email-athorlton@sgi.com> (raw)
In-Reply-To: <1480960154-211541-1-git-send-email-athorlton@sgi.com>

On systems with sufficiently large e820 tables, and several IOAPICs, it
is possible for the XENMEM_machine_memory_map callback (and its
counterpart, XENMEM_memory_map) to attempt to return an e820 table with
more than 128 entries.  This callback adds entries to the BIOS-provided
e820 table to account for IOAPIC registers, which, on sufficiently large
systems, can result in an e820 table that is too large to copy back into
xen_e820_map.

This change simply increases the size of xen_e820_map to E820_X_MAX to
ensure that there is enough room to store the entire e820 map returned
from this callback.

Signed-off-by: Alex Thorlton <athorlton@sgi.com>
Suggested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Cc: Russ Anderson <rja@sgi.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: x86@kernel.org
Cc: xen-devel@lists.xenproject.org
---
 arch/x86/xen/setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index f8960fc..8c394e3 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -41,7 +41,7 @@
 unsigned long xen_released_pages;
 
 /* E820 map used during setting up memory. */
-static struct e820entry xen_e820_map[E820MAX] __initdata;
+static struct e820entry xen_e820_map[E820_X_MAX] __initdata;
 static u32 xen_e820_map_entries __initdata;
 
 /*
@@ -750,7 +750,7 @@ char * __init xen_memory_setup(void)
 	max_pfn = min(max_pfn, xen_start_info->nr_pages);
 	mem_end = PFN_PHYS(max_pfn);
 
-	memmap.nr_entries = E820MAX;
+	memmap.nr_entries = ARRAY_SIZE(xen_e820_map);
 	set_xen_guest_handle(memmap.buffer, xen_e820_map);
 
 	op = xen_initial_domain() ?
@@ -923,7 +923,7 @@ char * __init xen_auto_xlated_memory_setup(void)
 	int i;
 	int rc;
 
-	memmap.nr_entries = E820MAX;
+	memmap.nr_entries = ARRAY_SIZE(xen_e820_map);
 	set_xen_guest_handle(memmap.buffer, xen_e820_map);
 
 	rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
-- 
1.8.5.6

  parent reply	other threads:[~2016-12-05 17:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-15  0:11 [RFC PATCH] xen/x86: Increase xen_e820_map to E820_X_MAX possible entries Alex Thorlton
2016-11-15  6:33 ` Juergen Gross
2016-11-15  7:15   ` Jan Beulich
     [not found]   ` <582AC427020000780011EA7E@suse.com>
2016-11-15  7:36     ` Juergen Gross
2016-11-15  8:01       ` Jan Beulich
     [not found]       ` <582ACEDE020000780011EAC9@suse.com>
2016-11-15  8:42         ` Juergen Gross
2016-11-15  9:45           ` Jan Beulich
     [not found]           ` <582AE72D020000780011EBB2@suse.com>
2016-11-15  9:55             ` Juergen Gross
2016-11-15 10:44               ` Jan Beulich
     [not found]               ` <582AF51F020000780011ECB4@suse.com>
2016-11-15 11:07                 ` Juergen Gross
2016-11-15 11:12                   ` Jan Beulich
2016-11-15 15:22               ` Alex Thorlton
2016-11-16  6:06                 ` Juergen Gross
2016-11-30  3:24 ` [RFC PATCH v2] " Alex Thorlton
2016-11-30  3:24   ` [PATCH 1/2] x86: Make E820_X_MAX unconditionally larger than E820MAX Alex Thorlton
2016-11-30  6:21     ` Ingo Molnar
2016-12-01 18:37       ` Alex Thorlton
2016-11-30  3:24   ` [PATCH 2/2] xen/x86: Increase xen_e820_map to E820_X_MAX possible entries Alex Thorlton
2016-11-30  5:18     ` Juergen Gross
2016-12-05 17:49 ` [RFC PATCH v3] " Alex Thorlton
2016-12-05 17:49   ` [PATCH 1/2] x86: Make E820_X_MAX unconditionally larger than E820MAX Alex Thorlton
2016-12-09 10:12     ` Juergen Gross
2016-12-05 17:49   ` Alex Thorlton [this message]
2016-12-09 10:12     ` [PATCH 2/2] xen/x86: Increase xen_e820_map to E820_X_MAX possible entries Juergen Gross
2016-12-08  5:50   ` [RFC PATCH v3] " Juergen Gross
2016-12-09  3:46     ` Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1480960154-211541-3-git-send-email-athorlton@sgi.com \
    --to=athorlton@sgi.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=dvlasenk@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rja@sgi.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).