All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kamal Mostafa <kamal@canonical.com>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	kernel-team@lists.ubuntu.com
Cc: David Vrabel <david.vrabel@citrix.com>,
	Tim Gardner <tim.gardner@canonical.com>,
	Kamal Mostafa <kamal@canonical.com>
Subject: [PATCH 3.19.y-ckt 01/47] x86/xen/p2m: hint at the last populated P2M entry
Date: Tue,  9 Feb 2016 14:44:15 -0800	[thread overview]
Message-ID: <1455057901-7468-2-git-send-email-kamal@canonical.com> (raw)
In-Reply-To: <1455057901-7468-1-git-send-email-kamal@canonical.com>

3.19.8-ckt15 -stable review patch.  If anyone has any objections, please let me know.

---8<------------------------------------------------------------

From: David Vrabel <david.vrabel@citrix.com>

commit 98dd166ea3a3c3b57919e20d9b0d1237fcd0349d upstream.

With commit 633d6f17cd91ad5bf2370265946f716e42d388c6 (x86/xen: prepare
p2m list for memory hotplug) the P2M may be sized to accomdate a much
larger amount of memory than the domain currently has.

When saving a domain, the toolstack must scan all the P2M looking for
populated pages.  This results in a performance regression due to the
unnecessary scanning.

Instead of reporting (via shared_info) the maximum possible size of
the P2M, hint at the last PFN which might be populated.  This hint is
increased as new leaves are added to the P2M (in the expectation that
they will be used for populated entries).

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
[ tim.gardner: backport to 4.2-stable ]
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
---
 arch/x86/xen/p2m.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 0537a09..66a395b7 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -109,6 +109,15 @@ static unsigned long *p2m_identity;
 static pte_t *p2m_missing_pte;
 static pte_t *p2m_identity_pte;
 
+/*
+ * Hint at last populated PFN.
+ *
+ * Used to set HYPERVISOR_shared_info->arch.max_pfn so the toolstack
+ * can avoid scanning the whole P2M (which may be sized to account for
+ * hotplugged memory).
+ */
+static unsigned long xen_p2m_last_pfn;
+
 static inline unsigned p2m_top_index(unsigned long pfn)
 {
 	BUG_ON(pfn >= MAX_P2M_PFN);
@@ -263,7 +272,7 @@ void xen_setup_mfn_list_list(void)
 
 	HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
 		virt_to_mfn(p2m_top_mfn);
-	HYPERVISOR_shared_info->arch.max_pfn = xen_max_p2m_pfn;
+	HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn;
 }
 
 /* Set up p2m_top to point to the domain-builder provided p2m pages */
@@ -395,6 +404,8 @@ void __init xen_vmalloc_p2m_tree(void)
 	static struct vm_struct vm;
 	unsigned long p2m_limit;
 
+	xen_p2m_last_pfn = xen_max_p2m_pfn;
+
 	p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE;
 	vm.flags = VM_ALLOC;
 	vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit),
@@ -593,6 +604,12 @@ static bool alloc_p2m(unsigned long pfn)
 			free_p2m_page(p2m);
 	}
 
+	/* Expanded the p2m? */
+	if (pfn > xen_p2m_last_pfn) {
+		xen_p2m_last_pfn = pfn;
+		HYPERVISOR_shared_info->arch.max_pfn = xen_p2m_last_pfn;
+	}
+
 	return true;
 }
 
-- 
1.9.1

  reply	other threads:[~2016-02-09 22:45 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 22:44 [3.19.y-ckt stable] Linux 3.19.8-ckt15 stable review Kamal Mostafa
2016-02-09 22:44 ` Kamal Mostafa [this message]
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 02/47] iio: adis_buffer: Fix out-of-bounds memory access Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 03/47] KVM: PPC: Fix emulation of H_SET_DABR/X on POWER8 Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 04/47] KVM: PPC: Fix ONE_REG AltiVec support Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 05/47] x86/irq: Call chip->irq_set_affinity in proper context Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 06/47] powerpc: Simplify module TOC handling Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 07/47] ACPI: Revert "ACPI / video: Add Dell Inspiron 5737 to the blacklist" Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 08/47] ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot() Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 09/47] usb: cdc-acm: handle unlinked urb in acm read callback Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 10/47] usb: cdc-acm: send zero packet for intel 7260 modem Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 11/47] cdc-acm:exclude Samsung phone 04e8:685d Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 12/47] usb: hub: do not clear BOS field during reset device Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 13/47] USB: cp210x: add ID for IAI USB to RS485 adaptor Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 14/47] USB: visor: fix null-deref at probe Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 15/47] USB: serial: visor: fix crash on detecting device without write_urbs Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 16/47] USB: serial: option: Adding support for Telit LE922 Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 17/47] ALSA: seq: Fix incorrect sanity check at snd_seq_oss_synth_cleanup() Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 18/47] ALSA: seq: Degrade the error message for too many opens Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 19/47] USB: serial: ftdi_sio: add support for Yaesu SCU-18 cable Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 20/47] arm64: kernel: fix architected PMU registers unconditional access Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 21/47] USB: option: fix Cinterion AHxx enumeration Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 22/47] ALSA: compress: Disable GET_CODEC_CAPS ioctl for some architectures Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 23/47] ALSA: usb-audio: Fix TEAC UD-501/UD-503/NT-503 usb delay Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 24/47] ALSA: bebob: Use a signed return type for get_formation_index Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 25/47] arm64: errata: Add -mpc-relative-literal-loads to build flags Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 26/47] arm64: mm: avoid calling apply_to_page_range on empty range Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 27/47] x86/mm: Fix types used in pgprot cacheability flags translations Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 28/47] powerpc/eeh: Fix PE location code Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 29/47] SCSI: fix crashes in sd and sr runtime PM Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 30/47] tty: Fix unsafe ldisc reference via ioctl(TIOCGETD) Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 31/47] n_tty: Fix unsafe reference to "other" ldisc Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 32/47] staging/speakup: Use tty_ldisc_ref() for paste kworker Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 33/47] irqchip/atmel-aic: Fix wrong bit operation for IRQ priority Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 34/47] seccomp: always propagate NO_NEW_PRIVS on tsync Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 35/47] ALSA: dummy: Disable switching timer backend via sysfs Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 36/47] drm/vmwgfx: respect 'nomodeset' Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 37/47] Staging: speakup: Fix getting port information Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 38/47] x86/mm/pat: Avoid truncation when converting cpa->numpages to address Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 39/47] serial: 8250_pci: Add Intel Broadwell ports Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 40/47] perf annotate browser: Fix behaviour of Shift-Tab with nothing focussed Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 41/47] perf hists: Fix HISTC_MEM_DCACHELINE width setting Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 42/47] powerpc/perf: Remove PPMU_HAS_SSLOT flag for Power8 Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 43/47] [media] usbvision fix overflow of interfaces array Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 44/47] [media] usbvision: fix leak of usb_dev on failure paths in usbvision_probe() Kamal Mostafa
2016-02-09 22:44 ` [PATCH 3.19.y-ckt 45/47] [media] usbvision: fix crash on detecting device with invalid configuration Kamal Mostafa
2016-02-09 22:45 ` [PATCH 3.19.y-ckt 46/47] ASN.1: Fix non-match detection failure on data overrun Kamal Mostafa
2016-02-09 22:45 ` [PATCH 3.19.y-ckt 47/47] KEYS: Fix keyring ref leak in join_session_keyring() Kamal Mostafa

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=1455057901-7468-2-git-send-email-kamal@canonical.com \
    --to=kamal@canonical.com \
    --cc=david.vrabel@citrix.com \
    --cc=kernel-team@lists.ubuntu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tim.gardner@canonical.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.