LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2.5 16/20] mm: remove early_pfn_in_nid() and CONFIG_NODES_SPAN_OTHER_NODES
From: Mike Rapoport @ 2020-04-29 16:29 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Mike Rapoport, Greg Ungerer, linux-arch, linux-s390,
	linux-snps-arc, linux-c6x-dev, Baoquan He, Jonathan Corbet,
	linux-sh, Helge Deller, x86, Russell King, Ley Foon Tan,
	Yoshinori Sato, Geert Uytterhoeven, linux-arm-kernel, Mark Salter,
	Matt Turner, linux-mips, uclinux-h8-devel, linux-xtensa,
	linux-alpha, linux-um, linux-m68k, Tony Luck, Qian Cai,
	Greentime Hu, Paul Walmsley, Stafford Horne, Guan Xuetao,
	Hoan Tran, Michal Simek, Thomas Bogendoerfer, Brian Cain, Nick Hu,
	linux-mm, Vineet Gupta, linux-kernel, openrisc,
	Richard Weinberger, linuxppc-dev, David S. Miller
In-Reply-To: <20200429121126.17989-17-rppt@kernel.org>

On Wed, Apr 29, 2020 at 03:11:22PM +0300, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> The commit f47ac088c406 ("mm: memmap_init: iterate over memblock regions
> rather that check each PFN") made early_pfn_in_nid() obsolete and since
> CONFIG_NODES_SPAN_OTHER_NODES is only used to pick a stub or a real
> implementation of early_pfn_in_nid() it is also not needed anymore.
> 
> Remove both early_pfn_in_nid() and the CONFIG_NODES_SPAN_OTHER_NODES.
> 
> Co-developed-by: Hoan Tran <Hoan@os.amperecomputing.com>
> Signed-off-by: Hoan Tran <Hoan@os.amperecomputing.com>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---

Here's the version with the updated changelog:

From 7415d1a9b7000c6eecd9f63770592e4d4a8d2463 Mon Sep 17 00:00:00 2001
From: Mike Rapoport <rppt@linux.ibm.com>
Date: Sat, 11 Apr 2020 11:26:49 +0300
Subject: [PATCH v2.5] mm: remove early_pfn_in_nid() and CONFIG_NODES_SPAN_OTHER_NODES

The memmap_init() function was made to iterate over memblock regions and as
the result the early_pfn_in_nid() function became obsolete.
Since CONFIG_NODES_SPAN_OTHER_NODES is only used to pick a stub or a real
implementation of early_pfn_in_nid(), it is also not needed anymore.

Remove both early_pfn_in_nid() and the CONFIG_NODES_SPAN_OTHER_NODES.

Co-developed-by: Hoan Tran <Hoan@os.amperecomputing.com>
Signed-off-by: Hoan Tran <Hoan@os.amperecomputing.com>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/powerpc/Kconfig |  9 ---------
 arch/sparc/Kconfig   |  9 ---------
 arch/x86/Kconfig     |  9 ---------
 mm/page_alloc.c      | 20 --------------------
 4 files changed, 47 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 5f86b22b7d2c..74f316deeae1 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -685,15 +685,6 @@ config ARCH_MEMORY_PROBE
 	def_bool y
 	depends on MEMORY_HOTPLUG
 
-# Some NUMA nodes have memory ranges that span
-# other nodes.  Even though a pfn is valid and
-# between a node's start and end pfns, it may not
-# reside on that node.  See memmap_init_zone()
-# for details.
-config NODES_SPAN_OTHER_NODES
-	def_bool y
-	depends on NEED_MULTIPLE_NODES
-
 config STDBINUTILS
 	bool "Using standard binutils settings"
 	depends on 44x
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 795206b7b552..0e4f3891b904 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -286,15 +286,6 @@ config NODES_SHIFT
 	  Specify the maximum number of NUMA Nodes available on the target
 	  system.  Increases memory reserved to accommodate various tables.
 
-# Some NUMA nodes have memory ranges that span
-# other nodes.  Even though a pfn is valid and
-# between a node's start and end pfns, it may not
-# reside on that node.  See memmap_init_zone()
-# for details.
-config NODES_SPAN_OTHER_NODES
-	def_bool y
-	depends on NEED_MULTIPLE_NODES
-
 config ARCH_SPARSEMEM_ENABLE
 	def_bool y if SPARC64
 	select SPARSEMEM_VMEMMAP_ENABLE
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f8bf218a169c..1ec2a5e2fef6 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1581,15 +1581,6 @@ config X86_64_ACPI_NUMA
 	---help---
 	  Enable ACPI SRAT based node topology detection.
 
-# Some NUMA nodes have memory ranges that span
-# other nodes.  Even though a pfn is valid and
-# between a node's start and end pfns, it may not
-# reside on that node.  See memmap_init_zone()
-# for details.
-config NODES_SPAN_OTHER_NODES
-	def_bool y
-	depends on X86_64_ACPI_NUMA
-
 config NUMA_EMU
 	bool "NUMA emulation"
 	depends on NUMA
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 8d112defaead..d35ca0996a09 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1541,26 +1541,6 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
 }
 #endif /* CONFIG_NEED_MULTIPLE_NODES */
 
-#ifdef CONFIG_NODES_SPAN_OTHER_NODES
-/* Only safe to use early in boot when initialisation is single-threaded */
-static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
-{
-	int nid;
-
-	nid = __early_pfn_to_nid(pfn, &early_pfnnid_cache);
-	if (nid >= 0 && nid != node)
-		return false;
-	return true;
-}
-
-#else
-static inline bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
-{
-	return true;
-}
-#endif
-
-
 void __init memblock_free_pages(struct page *page, unsigned long pfn,
 							unsigned int order)
 {
-- 
2.26.1


^ permalink raw reply related

* Re: [PATCH] ASoC: fsl_easrc: Check NULL pinter before dereference
From: Mark Brown @ 2020-04-29 16:26 UTC (permalink / raw)
  To: nicoleotsuka, festevam, alsa-devel, tiwai, timur, Xiubo.Lee,
	Shengjiu Wang, lgirdwood, perex
  Cc: linuxppc-dev, linux-kernel
In-Reply-To: <1587731404-29750-1-git-send-email-shengjiu.wang@nxp.com>

On Fri, 24 Apr 2020 20:30:04 +0800, Shengjiu Wang wrote:
> The patch 955ac624058f: "ASoC: fsl_easrc: Add EASRC ASoC CPU DAI
> drivers" from Apr 16, 2020, leads to the following Smatch complaint:
> 
> sound/soc/fsl/fsl_easrc.c:1529 fsl_easrc_hw_free()
> warn: variable dereferenced before check 'ctx' (see line 1527)
> 
> sound/soc/fsl/fsl_easrc.c
>   1526          struct fsl_asrc_pair *ctx = runtime->private_data;
>   1527          struct fsl_easrc_ctx_priv *ctx_priv = ctx->private;
>                                                       ^^^^^
> Dereference
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.8

Thanks!

[1/1] ASoC: fsl_easrc: Check for null pointer before dereferencing "ctx" in fsl_easrc_hw_free()
      commit: f3fc1ea011f09156886e8f4beb240ea814f2197a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply

* [PATCH v1 3/3] virtio-mem: Add memory with MHP_DRIVER_MANAGED
From: David Hildenbrand @ 2020-04-29 16:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: virtio-dev, linux-hyperv, Michal Hocko, linux-acpi, linux-nvdimm,
	linux-s390, Jason Wang, Michael S . Tsirkin, David Hildenbrand,
	virtualization, linux-mm, Eric Biederman, xen-devel,
	Andrew Morton, Michal Hocko, linuxppc-dev
In-Reply-To: <20200429160803.109056-1-david@redhat.com>

We don't want /sys/firmware/memmap entries and we want to indicate
our memory as "System RAM (driver managed)" in /proc/iomem. This is
especially relevant for kexec-tools, which have to be updated to
support dumping virtio-mem memory after this patch. Expected behavior in
kexec-tools:
- Don't use this memory when creating a fixed-up firmware memmap. Works
  now out of the box on x86-64.
- Don't use this memory for placing kexec segments. Works now out of the
  box on x86-64.
- Consider "System RAM (driver managed)" when creating the elfcorehdr
  for kdump. This memory has to be dumped. Needs update of kexec-tools.

With this patch on x86-64:

/proc/iomem:
	00000000-00000fff : Reserved
	00001000-0009fbff : System RAM
	[...]
	fffc0000-ffffffff : Reserved
	100000000-13fffffff : System RAM
	140000000-147ffffff : System RAM (driver managed)
	340000000-347ffffff : System RAM (driver managed)
	348000000-34fffffff : System RAM (driver managed)
	[..]
	3280000000-32ffffffff : PCI Bus 0000:00

/sys/firmware/memmap:
	0000000000000000-000000000009fc00 (System RAM)
	000000000009fc00-00000000000a0000 (Reserved)
	00000000000f0000-0000000000100000 (Reserved)
	0000000000100000-00000000bffe0000 (System RAM)
	00000000bffe0000-00000000c0000000 (Reserved)
	00000000feffc000-00000000ff000000 (Reserved)
	00000000fffc0000-0000000100000000 (Reserved)
	0000000100000000-0000000140000000 (System RAM)

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 drivers/virtio/virtio_mem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
index 3101cbf9e59d..6f658d1aeac4 100644
--- a/drivers/virtio/virtio_mem.c
+++ b/drivers/virtio/virtio_mem.c
@@ -421,7 +421,8 @@ static int virtio_mem_mb_add(struct virtio_mem *vm, unsigned long mb_id)
 		nid = memory_add_physaddr_to_nid(addr);
 
 	dev_dbg(&vm->vdev->dev, "adding memory block: %lu\n", mb_id);
-	return add_memory(nid, addr, memory_block_size_bytes(), 0);
+	return add_memory(nid, addr, memory_block_size_bytes(),
+			  MHP_DRIVER_MANAGED);
 }
 
 /*
-- 
2.25.3


^ permalink raw reply related

* [PATCH v1 2/3] mm/memory_hotplug: Introduce MHP_DRIVER_MANAGED
From: David Hildenbrand @ 2020-04-29 16:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: virtio-dev, linux-hyperv, Michal Hocko, linux-acpi, Baoquan He,
	linux-nvdimm, linux-s390, Michael S . Tsirkin, David Hildenbrand,
	virtualization, linux-mm, Wei Yang, Eric Biederman, Pankaj Gupta,
	xen-devel, Andrew Morton, Michal Hocko, linuxppc-dev
In-Reply-To: <20200429160803.109056-1-david@redhat.com>

Some paravirtualized devices that add memory via add_memory() and
friends (esp. virtio-mem) don't want to create entries in
/sys/firmware/memmap/ - primarily to hinder kexec from adding this
memory to the boot memmap of the kexec kernel.

In fact, such memory is never exposed via the firmware (e.g., e820), but
only via the device, so exposing this memory via /sys/firmware/memmap/ is
wrong:
 "kexec needs the raw firmware-provided memory map to setup the
  parameter segment of the kernel that should be booted with
  kexec. Also, the raw memory map is useful for debugging. For
  that reason, /sys/firmware/memmap is an interface that provides
  the raw memory map to userspace." [1]

We want to let user space know that memory which is always detected,
added, and managed via a (device) driver - like memory managed by
virtio-mem - is special. It cannot be used for placing kexec segments
and the (device) driver is responsible for re-adding memory that
(eventually shrunk/grown/defragmented) memory after a reboot/kexec. It
should e.g., not be added to a fixed up firmware memmap. However, it should
be dumped by kdump.

Also, such memory could behave differently than an ordinary DIMM - e.g.,
memory managed by virtio-mem can have holes inside added memory resource,
which should not be touched, especially for writing.

Let's expose that memory as "System RAM (driver managed)" e.g., via
/pro/iomem.

We don't have to worry about firmware_map_remove() on the removal path.
If there is no entry, it will simply return with -EINVAL.

[1] https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-memmap

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 include/linux/memory_hotplug.h |  8 ++++++++
 mm/memory_hotplug.c            | 20 ++++++++++++++++----
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index bf0e3edb8688..cc538584b39e 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -68,6 +68,14 @@ struct mhp_params {
 	pgprot_t pgprot;
 };
 
+/* Flags used for add_memory() and friends. */
+
+/*
+ * Don't create entries in /sys/firmware/memmap/ and expose memory as
+ * "System RAM (driver managed)" in e.g., /proc/iomem
+ */
+#define MHP_DRIVER_MANAGED		1
+
 /*
  * Zone resizing functions
  *
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index ebdf6541d074..cfa0721280aa 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -98,11 +98,11 @@ void mem_hotplug_done(void)
 u64 max_mem_size = U64_MAX;
 
 /* add this memory to iomem resource */
-static struct resource *register_memory_resource(u64 start, u64 size)
+static struct resource *register_memory_resource(u64 start, u64 size,
+						 const char *resource_name)
 {
 	struct resource *res;
 	unsigned long flags =  IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
-	char *resource_name = "System RAM";
 
 	/*
 	 * Make sure value parsed from 'mem=' only restricts memory adding
@@ -1058,7 +1058,8 @@ int __ref add_memory_resource(int nid, struct resource *res,
 	BUG_ON(ret);
 
 	/* create new memmap entry */
-	firmware_map_add_hotplug(start, start + size, "System RAM");
+	if (!(flags & MHP_DRIVER_MANAGED))
+		firmware_map_add_hotplug(start, start + size, "System RAM");
 
 	/* device_online() will take the lock when calling online_pages() */
 	mem_hotplug_done();
@@ -1081,10 +1082,21 @@ int __ref add_memory_resource(int nid, struct resource *res,
 /* requires device_hotplug_lock, see add_memory_resource() */
 int __ref __add_memory(int nid, u64 start, u64 size, unsigned long flags)
 {
+	const char *resource_name = "System RAM";
 	struct resource *res;
 	int ret;
 
-	res = register_memory_resource(start, size);
+	/*
+	 * Indicate that memory managed by a driver is special. It's always
+	 * detected and added via a driver, should not be given to the kexec
+	 * kernel for booting when manually crafting the firmware memmap, and
+	 * no kexec segments should be placed on it. However, kdump should
+	 * dump this memory.
+	 */
+	if (flags & MHP_DRIVER_MANAGED)
+		resource_name = "System RAM (driver managed)";
+
+	res = register_memory_resource(start, size, resource_name);
 	if (IS_ERR(res))
 		return PTR_ERR(res);
 
-- 
2.25.3


^ permalink raw reply related

* [PATCH v1 1/3] mm/memory_hotplug: Prepare passing flags to add_memory() and friends
From: David Hildenbrand @ 2020-04-29 16:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-hyperv, Michal Hocko, Michael S . Tsirkin, Jason Wang,
	Heiko Carstens, Pingfan Liu, virtualization, linux-mm,
	Paul Mackerras, K. Y. Srinivasan, Boris Ostrovsky, virtio-dev,
	Wei Liu, Stefano Stabellini, Dave Jiang, Baoquan He, linux-nvdimm,
	Vishal Verma, David Hildenbrand, linux-acpi, Wei Yang, xen-devel,
	Len Brown, Nathan Lynch, Vasily Gorbik, linux-s390, Haiyang Zhang,
	Leonardo Bras, Stephen Hemminger, Dan Williams, Michal Hocko,
	Christian Borntraeger, Oscar Salvador, Juergen Gross,
	Pankaj Gupta, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Eric Biederman, Andrew Morton, linuxppc-dev
In-Reply-To: <20200429160803.109056-1-david@redhat.com>

We soon want to pass flags - prepare for that.

This patch is based on a similar patch by Oscar Salvador:

https://lkml.kernel.org/r/20190625075227.15193-3-osalvador@suse.de

Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Vishal Verma <vishal.l.verma@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Pingfan Liu <kernelfans@gmail.com>
Cc: Leonardo Bras <leobras.c@gmail.com>
Cc: Nathan Lynch <nathanl@linux.ibm.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Baoquan He <bhe@redhat.com>
Cc: Wei Yang <richard.weiyang@gmail.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Cc: Eric Biederman <ebiederm@xmission.com>
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-acpi@vger.kernel.org
Cc: linux-nvdimm@lists.01.org
Cc: linux-hyperv@vger.kernel.org
Cc: linux-s390@vger.kernel.org
Cc: virtualization@lists.linux-foundation.org
Cc: xen-devel@lists.xenproject.org
Signed-off-by: David Hildenbrand <david@redhat.com>
---
 arch/powerpc/platforms/powernv/memtrace.c       |  2 +-
 arch/powerpc/platforms/pseries/hotplug-memory.c |  2 +-
 drivers/acpi/acpi_memhotplug.c                  |  2 +-
 drivers/base/memory.c                           |  2 +-
 drivers/dax/kmem.c                              |  2 +-
 drivers/hv/hv_balloon.c                         |  2 +-
 drivers/s390/char/sclp_cmd.c                    |  2 +-
 drivers/virtio/virtio_mem.c                     |  2 +-
 drivers/xen/balloon.c                           |  2 +-
 include/linux/memory_hotplug.h                  |  7 ++++---
 mm/memory_hotplug.c                             | 11 ++++++-----
 11 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
index 13b369d2cc45..a7475d18c671 100644
--- a/arch/powerpc/platforms/powernv/memtrace.c
+++ b/arch/powerpc/platforms/powernv/memtrace.c
@@ -224,7 +224,7 @@ static int memtrace_online(void)
 			ent->mem = 0;
 		}
 
-		if (add_memory(ent->nid, ent->start, ent->size)) {
+		if (add_memory(ent->nid, ent->start, ent->size, 0)) {
 			pr_err("Failed to add trace memory to node %d\n",
 				ent->nid);
 			ret += 1;
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 5ace2f9a277e..ae44eba46ca0 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -646,7 +646,7 @@ static int dlpar_add_lmb(struct drmem_lmb *lmb)
 	block_sz = memory_block_size_bytes();
 
 	/* Add the memory */
-	rc = __add_memory(lmb->nid, lmb->base_addr, block_sz);
+	rc = __add_memory(lmb->nid, lmb->base_addr, block_sz, 0);
 	if (rc) {
 		invalidate_lmb_associativity_index(lmb);
 		return rc;
diff --git a/drivers/acpi/acpi_memhotplug.c b/drivers/acpi/acpi_memhotplug.c
index e294f44a7850..d91b3584d4b2 100644
--- a/drivers/acpi/acpi_memhotplug.c
+++ b/drivers/acpi/acpi_memhotplug.c
@@ -207,7 +207,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
 		if (node < 0)
 			node = memory_add_physaddr_to_nid(info->start_addr);
 
-		result = __add_memory(node, info->start_addr, info->length);
+		result = __add_memory(node, info->start_addr, info->length, 0);
 
 		/*
 		 * If the memory block has been used by the kernel, add_memory()
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 2b09b68b9f78..c0ef7d9e310a 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -432,7 +432,7 @@ static ssize_t probe_store(struct device *dev, struct device_attribute *attr,
 
 	nid = memory_add_physaddr_to_nid(phys_addr);
 	ret = __add_memory(nid, phys_addr,
-			   MIN_MEMORY_BLOCK_SIZE * sections_per_block);
+			   MIN_MEMORY_BLOCK_SIZE * sections_per_block, 0);
 
 	if (ret)
 		goto out;
diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c
index 3d0a7e702c94..e159184e0ba0 100644
--- a/drivers/dax/kmem.c
+++ b/drivers/dax/kmem.c
@@ -65,7 +65,7 @@ int dev_dax_kmem_probe(struct device *dev)
 	new_res->flags = IORESOURCE_SYSTEM_RAM;
 	new_res->name = dev_name(dev);
 
-	rc = add_memory(numa_node, new_res->start, resource_size(new_res));
+	rc = add_memory(numa_node, new_res->start, resource_size(new_res), 0);
 	if (rc) {
 		release_resource(new_res);
 		kfree(new_res);
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index 32e3bc0aa665..0194bed1a573 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -726,7 +726,7 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size,
 
 		nid = memory_add_physaddr_to_nid(PFN_PHYS(start_pfn));
 		ret = add_memory(nid, PFN_PHYS((start_pfn)),
-				(HA_CHUNK << PAGE_SHIFT));
+				(HA_CHUNK << PAGE_SHIFT), 0);
 
 		if (ret) {
 			pr_err("hot_add memory failed error is %d\n", ret);
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index a864b21af602..a6a908244c74 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -406,7 +406,7 @@ static void __init add_memory_merged(u16 rn)
 	if (!size)
 		goto skip_add;
 	for (addr = start; addr < start + size; addr += block_size)
-		add_memory(0, addr, block_size);
+		add_memory(0, addr, block_size, 0);
 skip_add:
 	first_rn = rn;
 	num = 1;
diff --git a/drivers/virtio/virtio_mem.c b/drivers/virtio/virtio_mem.c
index 96e687531933..3101cbf9e59d 100644
--- a/drivers/virtio/virtio_mem.c
+++ b/drivers/virtio/virtio_mem.c
@@ -421,7 +421,7 @@ static int virtio_mem_mb_add(struct virtio_mem *vm, unsigned long mb_id)
 		nid = memory_add_physaddr_to_nid(addr);
 
 	dev_dbg(&vm->vdev->dev, "adding memory block: %lu\n", mb_id);
-	return add_memory(nid, addr, memory_block_size_bytes());
+	return add_memory(nid, addr, memory_block_size_bytes(), 0);
 }
 
 /*
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
index 0c142bcab79d..6ec0373fa624 100644
--- a/drivers/xen/balloon.c
+++ b/drivers/xen/balloon.c
@@ -347,7 +347,7 @@ static enum bp_state reserve_additional_memory(void)
 	mutex_unlock(&balloon_mutex);
 	/* add_memory_resource() requires the device_hotplug lock */
 	lock_device_hotplug();
-	rc = add_memory_resource(nid, resource);
+	rc = add_memory_resource(nid, resource, 0);
 	unlock_device_hotplug();
 	mutex_lock(&balloon_mutex);
 
diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h
index d641828e5596..bf0e3edb8688 100644
--- a/include/linux/memory_hotplug.h
+++ b/include/linux/memory_hotplug.h
@@ -340,9 +340,10 @@ extern void set_zone_contiguous(struct zone *zone);
 extern void clear_zone_contiguous(struct zone *zone);
 
 extern void __ref free_area_init_core_hotplug(int nid);
-extern int __add_memory(int nid, u64 start, u64 size);
-extern int add_memory(int nid, u64 start, u64 size);
-extern int add_memory_resource(int nid, struct resource *resource);
+extern int __add_memory(int nid, u64 start, u64 size, unsigned long flags);
+extern int add_memory(int nid, u64 start, u64 size, unsigned long flags);
+extern int add_memory_resource(int nid, struct resource *resource,
+			       unsigned long flags);
 extern void move_pfn_range_to_zone(struct zone *zone, unsigned long start_pfn,
 		unsigned long nr_pages, struct vmem_altmap *altmap);
 extern void remove_pfn_range_from_zone(struct zone *zone,
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 4ac6395ee2fc..ebdf6541d074 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1000,7 +1000,8 @@ static int online_memory_block(struct memory_block *mem, void *arg)
  *
  * we are OK calling __meminit stuff here - we have CONFIG_MEMORY_HOTPLUG
  */
-int __ref add_memory_resource(int nid, struct resource *res)
+int __ref add_memory_resource(int nid, struct resource *res,
+			      unsigned long flags)
 {
 	struct mhp_params params = { .pgprot = PAGE_KERNEL };
 	u64 start, size;
@@ -1078,7 +1079,7 @@ int __ref add_memory_resource(int nid, struct resource *res)
 }
 
 /* requires device_hotplug_lock, see add_memory_resource() */
-int __ref __add_memory(int nid, u64 start, u64 size)
+int __ref __add_memory(int nid, u64 start, u64 size, unsigned long flags)
 {
 	struct resource *res;
 	int ret;
@@ -1087,18 +1088,18 @@ int __ref __add_memory(int nid, u64 start, u64 size)
 	if (IS_ERR(res))
 		return PTR_ERR(res);
 
-	ret = add_memory_resource(nid, res);
+	ret = add_memory_resource(nid, res, flags);
 	if (ret < 0)
 		release_memory_resource(res);
 	return ret;
 }
 
-int add_memory(int nid, u64 start, u64 size)
+int add_memory(int nid, u64 start, u64 size, unsigned long flags)
 {
 	int rc;
 
 	lock_device_hotplug();
-	rc = __add_memory(nid, start, size);
+	rc = __add_memory(nid, start, size, flags);
 	unlock_device_hotplug();
 
 	return rc;
-- 
2.25.3


^ permalink raw reply related

* [PATCH v1 0/3] mm/memory_hotplug: Make virtio-mem play nicely with kexec-tools
From: David Hildenbrand @ 2020-04-29 16:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-hyperv, Michal Hocko, Michael S . Tsirkin, Jason Wang,
	Heiko Carstens, Pingfan Liu, virtualization, linux-mm,
	Paul Mackerras, K. Y. Srinivasan, Dan Williams, virtio-dev,
	Wei Liu, Stefano Stabellini, Dave Jiang, Baoquan He, linux-nvdimm,
	David Hildenbrand, linux-acpi, Wei Yang, xen-devel, Len Brown,
	Nathan Lynch, Stephen Hemminger, Vasily Gorbik, linux-s390,
	Haiyang Zhang, Leonardo Bras, Boris Ostrovsky, Michal Hocko,
	Christian Borntraeger, Oscar Salvador, Juergen Gross,
	Pankaj Gupta, Greg Kroah-Hartman, Rafael J. Wysocki,
	Thomas Gleixner, Eric Biederman, Vishal Verma, Andrew Morton,
	linuxppc-dev

This series is based on [1]:
	[PATCH v2 00/10] virtio-mem: paravirtualized memory
That will hopefull get picked up soon, rebased to -next.

The following patches were reverted from -next [2]:
	[PATCH 0/3] kexec/memory_hotplug: Prevent removal and accidental use
As discussed in that thread, they should be reverted from -next already.

In theory, if people agree, we could take the first two patches via the
-mm tree now and the last (virtio-mem) patch via MST's tree once picking up
virtio-mem. No strong feelings.


Memory added by virtio-mem is special and might contain logical holes,
especially after memory unplug, but also when adding memory in
sub-section size. While memory in these holes can usually be read, that
memory should not be touched. virtio-mem managed device memory is never
exposed via any firmware memmap (esp., e820). The device driver will
request to plug memory from the hypervisor and add it to Linux.

On a cold start, all memory is unplugged, and the guest driver will first
request to plug memory from the hypervisor, to then add it to Linux. After
a reboot, all memory will get unplugged (except in rare, special cases). In
case the device driver comes up and detects that some memory is still
plugged after a reboot, it will manually request to unplug all memory from
the hypervisor first - to then request to plug memory from the hypervisor
and add to Linux. This is essentially a defragmentation step, where all
logical holes are removed.

As the device driver is responsible for detecting, adding and managing that
memory, also kexec should treat it like that. It is special. We need a way
to teach kexec-tools to not add that memory to the fixed-up firmware
memmap, to not place kexec images onto this memory, but still allow kdump
to dump it. Add a flag to tell memory hotplug code to
not create /sys/firmware/memmap entries and to indicate it via
"System RAM (driver managed)" in /proc/iomem.

Before this series, kexec_file_load() already did the right thing (for
virtio-mem) by not adding that memory to the fixed-up firmware memmap and
letting the device driver handle it. With this series, also kexec_load() -
which relies on user space to provide a fixed up firmware memmap - does
the right thing with virtio-mem memory.

When the virtio-mem device driver(s) come up, they will request to unplug
all memory from the hypervisor first (esp. defragment), to then request to
plug consecutive memory ranges from the hypervisor, and add them to Linux
- just like on a reboot where we still have memory plugged.

[1] https://lore.kernel.org/r/20200311171422.10484-1-david@redhat.com/
[2] https://lore.kernel.org/r/20200326180730.4754-1-james.morse@arm.com

David Hildenbrand (3):
  mm/memory_hotplug: Prepare passing flags to add_memory() and friends
  mm/memory_hotplug: Introduce MHP_DRIVER_MANAGED
  virtio-mem: Add memory with MHP_DRIVER_MANAGED

 arch/powerpc/platforms/powernv/memtrace.c     |  2 +-
 .../platforms/pseries/hotplug-memory.c        |  2 +-
 drivers/acpi/acpi_memhotplug.c                |  2 +-
 drivers/base/memory.c                         |  2 +-
 drivers/dax/kmem.c                            |  2 +-
 drivers/hv/hv_balloon.c                       |  2 +-
 drivers/s390/char/sclp_cmd.c                  |  2 +-
 drivers/virtio/virtio_mem.c                   |  3 +-
 drivers/xen/balloon.c                         |  2 +-
 include/linux/memory_hotplug.h                | 15 +++++++--
 mm/memory_hotplug.c                           | 31 +++++++++++++------
 11 files changed, 44 insertions(+), 21 deletions(-)

-- 
2.25.3


^ permalink raw reply

* Re: [RFC PATCH dpss_eth] Don't initialise ports with no PHY
From: Christian Zigotzky @ 2020-04-29 15:42 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: madalin.bacur, R.T.Dickinson, netdev, oss, Darren Stevens,
	contact@a-eon.com, mad skateman, linuxppc-dev
In-Reply-To: <20200429152224.GA66424@lunn.ch>



> On 29. Apr 2020, at 17:22, Andrew Lunn <andrew@lunn.ch> wrote:
> 
> On Wed, Apr 29, 2020 at 03:55:28PM +0200, Christian Zigotzky wrote:
>> Hi Andrew,
>> 
>> You can find some dtb and source files in our kernel package.
>> 
>> Download: http://www.xenosoft.de/linux-image-5.7-rc3-X1000_X5000.tar.gz
> 
> I have the tarball. Are we talking about
> linux-image-5.7-rc3-X1000_X5000/X5000_and_QEMU_e5500/dtbs/X5000_20/cyrus.eth.dtb
> 
> I don't see any status = "disabled"; in the blob. So i would expect
> the driver to probe.
> 
>    Andrew
> 
> 

Yes, that’s correct but maybe Darren uses another dtb file.

@Darren
Which dtb file do you use?

^ permalink raw reply

* Re: [RFC PATCH dpss_eth] Don't initialise ports with no PHY
From: Andrew Lunn @ 2020-04-29 15:22 UTC (permalink / raw)
  To: Christian Zigotzky
  Cc: madalin.bacur, R.T.Dickinson, netdev, oss, Darren Stevens,
	contact@a-eon.com, mad skateman, linuxppc-dev
In-Reply-To: <77E4A243-F90A-45A9-B8D3-0F7785C158C7@xenosoft.de>

On Wed, Apr 29, 2020 at 03:55:28PM +0200, Christian Zigotzky wrote:
> Hi Andrew,
> 
> You can find some dtb and source files in our kernel package.
> 
> Download: http://www.xenosoft.de/linux-image-5.7-rc3-X1000_X5000.tar.gz

I have the tarball. Are we talking about
linux-image-5.7-rc3-X1000_X5000/X5000_and_QEMU_e5500/dtbs/X5000_20/cyrus.eth.dtb

I don't see any status = "disabled"; in the blob. So i would expect
the driver to probe.

    Andrew



^ permalink raw reply

* Re: [PATCH 2/2] powerpc/spufs: stop using access_ok
From: Christophe Leroy @ 2020-04-29 15:00 UTC (permalink / raw)
  To: Jeremy Kerr, linuxppc-dev; +Cc: Christoph Hellwig, Arnd Bergmann
In-Reply-To: <20200429070303.17599-2-jk@ozlabs.org>



Le 29/04/2020 à 09:03, Jeremy Kerr a écrit :
> From: Christoph Hellwig <hch@lst.de>
> 
> Just use the proper non __-prefixed get/put_user variants where that is
> not done yet.

But it means you are doing the access_ok() check everytime, which is 
what is to be avoided by doing the access_ok() once then using the 
__-prefixed variant.

Christophe

> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
> ---
>   arch/powerpc/platforms/cell/spufs/file.c | 42 +++++-------------------
>   1 file changed, 8 insertions(+), 34 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
> index b4e1ef650b40..cd7d10f27fad 100644
> --- a/arch/powerpc/platforms/cell/spufs/file.c
> +++ b/arch/powerpc/platforms/cell/spufs/file.c
> @@ -590,17 +590,12 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
>   			size_t len, loff_t *pos)
>   {
>   	struct spu_context *ctx = file->private_data;
> -	u32 mbox_data, __user *udata;
> +	u32 mbox_data, __user *udata = (void __user *)buf;
>   	ssize_t count;
>   
>   	if (len < 4)
>   		return -EINVAL;
>   
> -	if (!access_ok(buf, len))
> -		return -EFAULT;
> -
> -	udata = (void __user *)buf;
> -
>   	count = spu_acquire(ctx);
>   	if (count)
>   		return count;
> @@ -616,7 +611,7 @@ static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
>   		 * but still need to return the data we have
>   		 * read successfully so far.
>   		 */
> -		ret = __put_user(mbox_data, udata);
> +		ret = put_user(mbox_data, udata);
>   		if (ret) {
>   			if (!count)
>   				count = -EFAULT;
> @@ -698,17 +693,12 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
>   			size_t len, loff_t *pos)
>   {
>   	struct spu_context *ctx = file->private_data;
> -	u32 ibox_data, __user *udata;
> +	u32 ibox_data, __user *udata = (void __user *)buf;
>   	ssize_t count;
>   
>   	if (len < 4)
>   		return -EINVAL;
>   
> -	if (!access_ok(buf, len))
> -		return -EFAULT;
> -
> -	udata = (void __user *)buf;
> -
>   	count = spu_acquire(ctx);
>   	if (count)
>   		goto out;
> @@ -727,7 +717,7 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
>   	}
>   
>   	/* if we can't write at all, return -EFAULT */
> -	count = __put_user(ibox_data, udata);
> +	count = put_user(ibox_data, udata);
>   	if (count)
>   		goto out_unlock;
>   
> @@ -741,7 +731,7 @@ static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
>   		 * but still need to return the data we have
>   		 * read successfully so far.
>   		 */
> -		ret = __put_user(ibox_data, udata);
> +		ret = put_user(ibox_data, udata);
>   		if (ret)
>   			break;
>   	}
> @@ -836,17 +826,13 @@ static ssize_t spufs_wbox_write(struct file *file, const char __user *buf,
>   			size_t len, loff_t *pos)
>   {
>   	struct spu_context *ctx = file->private_data;
> -	u32 wbox_data, __user *udata;
> +	u32 wbox_data, __user *udata = (void __user *)buf;
>   	ssize_t count;
>   
>   	if (len < 4)
>   		return -EINVAL;
>   
> -	udata = (void __user *)buf;
> -	if (!access_ok(buf, len))
> -		return -EFAULT;
> -
> -	if (__get_user(wbox_data, udata))
> +	if (get_user(wbox_data, udata))
>   		return -EFAULT;
>   
>   	count = spu_acquire(ctx);
> @@ -873,7 +859,7 @@ static ssize_t spufs_wbox_write(struct file *file, const char __user *buf,
>   	/* write as much as possible */
>   	for (count = 4, udata++; (count + 4) <= len; count += 4, udata++) {
>   		int ret;
> -		ret = __get_user(wbox_data, udata);
> +		ret = get_user(wbox_data, udata);
>   		if (ret)
>   			break;
>   
> @@ -1982,9 +1968,6 @@ static ssize_t spufs_mbox_info_read(struct file *file, char __user *buf,
>   	u32 stat, data;
>   	int ret;
>   
> -	if (!access_ok(buf, len))
> -		return -EFAULT;
> -
>   	ret = spu_acquire_saved(ctx);
>   	if (ret)
>   		return ret;
> @@ -2028,9 +2011,6 @@ static ssize_t spufs_ibox_info_read(struct file *file, char __user *buf,
>   	u32 stat, data;
>   	int ret;
>   
> -	if (!access_ok(buf, len))
> -		return -EFAULT;
> -
>   	ret = spu_acquire_saved(ctx);
>   	if (ret)
>   		return ret;
> @@ -2082,9 +2062,6 @@ static ssize_t spufs_wbox_info_read(struct file *file, char __user *buf,
>   	u32 data[ARRAY_SIZE(ctx->csa.spu_mailbox_data)];
>   	int ret, count;
>   
> -	if (!access_ok(buf, len))
> -		return -EFAULT;
> -
>   	ret = spu_acquire_saved(ctx);
>   	if (ret)
>   		return ret;
> @@ -2143,9 +2120,6 @@ static ssize_t spufs_dma_info_read(struct file *file, char __user *buf,
>   	struct spu_dma_info info;
>   	int ret;
>   
> -	if (!access_ok(buf, len))
> -		return -EFAULT;
> -
>   	ret = spu_acquire_saved(ctx);
>   	if (ret)
>   		return ret;
> 

^ permalink raw reply

* Re: [PATCH v8 0/7] powerpc/perf: Add json file metric support for the hv_24x7 socket/chip level events
From: Arnaldo Carvalho de Melo @ 2020-04-29 14:46 UTC (permalink / raw)
  To: kajoljain
  Cc: mark.rutland, maddy, peterz, yao.jin, mingo, kan.liang, ak,
	alexander.shishkin, anju, mamatha4, sukadev, ravi.bangoria,
	jmario, namhyung, tglx, mpetlan, gregkh, linux-kernel,
	linux-perf-users, jolsa, linuxppc-dev
In-Reply-To: <fa31bc42-d34c-c788-0109-350d769b51ce@linux.ibm.com>

Em Tue, Apr 28, 2020 at 12:02:42PM +0530, kajoljain escreveu:
> Hi Arnaldo,
> 	Please let me know if there any changes required in this patchset,
> as some of its patches are still not part of your perf/core tree.

Thanks, I checked and all seems ok, added Jiri's Acked-by, appreciated,
thanks,

- Arnaldo
 
> Thanks,
> Kajol Jain
> 
> On 4/2/20 2:03 AM, Kajol Jain wrote:
> > Patchset adds json file metric support for the hv_24x7 socket/chip level
> > events. "hv_24x7" pmu interface events needs system dependent parameter
> > like socket/chip/core. For example, hv_24x7 chip level events needs
> > specific chip-id to which the data is requested should be added as part
> > of pmu events.
> > 
> > So to enable JSON file support to "hv_24x7" interface, patchset reads
> > total number of sockets details in sysfs under 
> > "/sys/devices/hv_24x7/interface/".
> > 
> > Second patch of the patchset adds expr_scanner_ctx object to hold user
> > data for the expr scanner, which can be used to hold runtime parameter.
> > 
> > Patch 4 & 6 of the patchset handles perf tool plumbing needed to replace
> > the "?" character in the metric expression to proper value and hv_24x7
> > json metric file for different Socket/chip resources.
> > 
> > Patch set also enable Hz/hz prinitg for --metric-only option to print
> > metric data for bus frequency.
> > 
> > Applied and tested all these patches cleanly on top of jiri's flex changes
> > with the changes done by Kan Liang for "Support metric group constraint"
> > patchset and made required changes.
> > 
> > Also apply this patch on top of the fix patch send earlier
> > for printing metric name incase overlapping events.
> > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=perf/core&id=37cd7f65bf71a48f25eeb6d9be5dacb20d008ea6
> > 
> > Changelog:
> > v7 -> v8
> > - Add test case for testing parsing of "?" in metric expression
> > - Reaname variables name to runtime
> > 
> > v6 -> v7
> > - Spit patchset into two patch series one for kernel changes and other
> >   for tool side changes.
> > - Made changes Suggested by Jiri, including rather then reading runtime
> >   parameter from metric name, actually add it in structure egroup and
> >   metric_expr.
> > - As we don't need to read runtime parameter from metric name,
> >   now I am not appending it and rather just printing it in
> >   generic_metric function.
> > 
> > Kernel Side changes patch series: https://lkml.org/lkml/2020/3/27/58
> > 
> > v5 -> v6
> > - resolve compilation issue due to rearranging patch series.
> > - Rather then adding new function to take careof case for runtime param
> >   in metricgroup__add_metric, using metricgroup__add_metric_param itself
> >   for that work.
> > - Address some optimization suggested like using directly file path
> >   rather then adding new macro in header.c
> > - Change commit message on patch where we are adding "?" support
> >   by adding simple example.
> > 
> > v4 -> v5
> > - Using sysfs__read_int instead of sysfs__read_ull while reading
> >   parameter value in powerpc/util/header.c file.
> > 
> > - Using asprintf rather then malloc and sprintf 
> >   Suggested by Arnaldo Carvalho de Melo
> > 
> > - Break patch 6 from previous version to two patch,
> >   - One to add refactor current "metricgroup__add_metric" function
> >     and another where actually "?" handling infra added.
> > 
> > - Add expr__runtimeparam as part of 'expr_scanner_ctx' struct
> >   rather then making it global variable. Thanks Jiri for
> >   adding this structure to hold user data for the expr scanner.
> > 
> > - Add runtime param as agrugement to function 'expr__find_other'
> >   and 'expr__parse' and made changes on references accordingly.
> > 
> > v3 -> v4
> > - Apply these patch on top of Kan liang changes.
> >   As suggested by Jiri.
> > 
> > v2 -> v3
> > - Remove setting  event_count to 0 part in function 'h_24x7_event_read'
> >   with comment rather then adding 0 to event_count value.
> >   Suggested by: Sukadev Bhattiprolu
> > 
> > - Apply tool side changes require to replace "?" on Jiri's flex patch
> >   series and made all require changes to make it compatible with added
> >   flex change.
> > 
> > v1 -> v2
> > - Rename hv-24x7 metric json file as nest_metrics.json
> > 
> > Jiri Olsa (2):
> >   perf expr: Add expr_ prefix for parse_ctx and parse_id
> >   perf expr: Add expr_scanner_ctx object
> > 
> > Kajol Jain (5):
> >   perf/tools: Refactoring metricgroup__add_metric function
> >   perf/tools: Enhance JSON/metric infrastructure to handle "?"
> >   perf/tests/expr: Added test for runtime param in metric expression
> >   tools/perf: Enable Hz/hz prinitg for --metric-only option
> >   perf/tools/pmu-events/powerpc: Add hv_24x7 socket/chip level metric
> >     events
> > 
> >  tools/perf/arch/powerpc/util/header.c         |  8 ++
> >  .../arch/powerpc/power9/nest_metrics.json     | 19 +++++
> >  tools/perf/tests/expr.c                       | 20 +++--
> >  tools/perf/util/expr.c                        | 25 +++---
> >  tools/perf/util/expr.h                        | 19 +++--
> >  tools/perf/util/expr.l                        | 37 ++++++---
> >  tools/perf/util/expr.y                        |  6 +-
> >  tools/perf/util/metricgroup.c                 | 78 +++++++++++++------
> >  tools/perf/util/metricgroup.h                 |  2 +
> >  tools/perf/util/stat-display.c                |  2 -
> >  tools/perf/util/stat-shadow.c                 | 19 +++--
> >  11 files changed, 164 insertions(+), 71 deletions(-)
> >  create mode 100644 tools/perf/pmu-events/arch/powerpc/power9/nest_metrics.json
> > 

-- 

- Arnaldo

^ permalink raw reply

* Re: [PATCH v2 16/20] mm: remove early_pfn_in_nid() and CONFIG_NODES_SPAN_OTHER_NODES
From: Mike Rapoport @ 2020-04-29 14:33 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, x86, Michal Hocko, James E.J. Bottomley,
	Max Filippov, Guo Ren, Ley Foon Tan, sparclinux, linux-riscv,
	Greg Ungerer, linux-arch, linux-s390, linux-c6x-dev, Baoquan He,
	Jonathan Corbet, linux-hexagon, Helge Deller, linux-sh,
	Russell King, linux-csky, Mike Rapoport, Geert Uytterhoeven,
	Hoan Tran, Mark Salter, Matt Turner, linux-snps-arc,
	uclinux-h8-devel, linux-xtensa, Nick Hu, linux-um, linux-mips,
	Richard Weinberger, linux-m68k, Thomas Bogendoerfer, Qian Cai,
	Greentime Hu, Paul Walmsley, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Yoshinori Sato,
	linux-parisc, linux-mm, Vineet Gupta, Brian Cain, linux-kernel,
	openrisc, linux-alpha, Andrew Morton, linuxppc-dev,
	David S. Miller
In-Reply-To: <20200429141706.GA25142@infradead.org>

On Wed, Apr 29, 2020 at 07:17:06AM -0700, Christoph Hellwig wrote:
> On Wed, Apr 29, 2020 at 03:11:22PM +0300, Mike Rapoport wrote:
> > From: Mike Rapoport <rppt@linux.ibm.com>
> > 
> > The commit f47ac088c406 ("mm: memmap_init: iterate over memblock regions
> > rather that check each PFN") made early_pfn_in_nid() obsolete and since
> > CONFIG_NODES_SPAN_OTHER_NODES is only used to pick a stub or a real
> > implementation of early_pfn_in_nid() it is also not needed anymore.
> 
> I don't think you can quote a commit id for something that hasn't been
> commited to mainline yet.i

Ouch, that was one of the things I've indented to fix in v2...

> Then again I would have just merged this
> patch into the one that obsoleted early_pfn_in_nid anyway.

I've kept these commits separate to preserve the authorship.
I'll update the changelog so that it won't mention commit id.

-- 
Sincerely yours,
Mike.

^ permalink raw reply

* Re: [PATCH v2 16/20] mm: remove early_pfn_in_nid() and CONFIG_NODES_SPAN_OTHER_NODES
From: Christoph Hellwig @ 2020-04-29 14:17 UTC (permalink / raw)
  To: Mike Rapoport
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, x86, Michal Hocko, James E.J. Bottomley,
	Max Filippov, Guo Ren, Ley Foon Tan, sparclinux, linux-riscv,
	Greg Ungerer, linux-arch, linux-s390, linux-c6x-dev, Baoquan He,
	Jonathan Corbet, linux-hexagon, Helge Deller, linux-sh,
	Russell King, linux-csky, Mike Rapoport, Geert Uytterhoeven,
	Hoan Tran, Mark Salter, Matt Turner, linux-snps-arc,
	uclinux-h8-devel, linux-xtensa, Nick Hu, linux-um, linux-mips,
	Richard Weinberger, linux-m68k, Thomas Bogendoerfer, Qian Cai,
	Greentime Hu, Paul Walmsley, Stafford Horne, Guan Xuetao,
	linux-arm-kernel, Michal Simek, Tony Luck, Yoshinori Sato,
	linux-parisc, linux-mm, Vineet Gupta, Brian Cain, linux-kernel,
	openrisc, linux-alpha, Andrew Morton, linuxppc-dev,
	David S. Miller
In-Reply-To: <20200429121126.17989-17-rppt@kernel.org>

On Wed, Apr 29, 2020 at 03:11:22PM +0300, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
> 
> The commit f47ac088c406 ("mm: memmap_init: iterate over memblock regions
> rather that check each PFN") made early_pfn_in_nid() obsolete and since
> CONFIG_NODES_SPAN_OTHER_NODES is only used to pick a stub or a real
> implementation of early_pfn_in_nid() it is also not needed anymore.

I don't think you can quote a commit id for something that hasn't been
commited to mainline yet.  Then again I would have just merged this
patch into the one that obsoleted early_pfn_in_nid anyway.

^ permalink raw reply

* Re: [RFC PATCH v2 7/7] powerpc/selftest: reuse ppc-opcode macros to avoid redundancy
From: Naveen N. Rao @ 2020-04-29 14:17 UTC (permalink / raw)
  To: Balamuruhan S, Michael Ellerman
  Cc: ravi.bangoria, jniethe5, paulus, sandipan, linuxppc-dev
In-Reply-To: <87k11yfvxu.fsf@mpe.ellerman.id.au>

Michael Ellerman wrote:
> Balamuruhan S <bala24@linux.ibm.com> writes:
>> Avoid redefining macros to encode ppc instructions instead reuse it from
>> ppc-opcode.h, Makefile changes are necessary to compile memcmp_64.S with
>> __ASSEMBLY__ defined from selftests.
>>
>> Signed-off-by: Balamuruhan S <bala24@linux.ibm.com>
>> ---
>>  .../selftests/powerpc/stringloops/Makefile    | 34 ++++++++++++++----
>>  .../powerpc/stringloops/asm/asm-const.h       |  1 +
>>  .../powerpc/stringloops/asm/ppc-opcode.h      | 36 +------------------
>>  3 files changed, 29 insertions(+), 42 deletions(-)
>>  create mode 120000 tools/testing/selftests/powerpc/stringloops/asm/asm-const.h
>>  mode change 100644 => 120000 tools/testing/selftests/powerpc/stringloops/asm/ppc-opcode.h
>>
>> diff --git a/tools/testing/selftests/powerpc/stringloops/Makefile b/tools/testing/selftests/powerpc/stringloops/Makefile
>> index 7fc0623d85c3..efe76c5a5b94 100644
>> --- a/tools/testing/selftests/powerpc/stringloops/Makefile
>> +++ b/tools/testing/selftests/powerpc/stringloops/Makefile
>> @@ -1,26 +1,44 @@
>>  # SPDX-License-Identifier: GPL-2.0
>>  # The loops are all 64-bit code
>> -CFLAGS += -I$(CURDIR)
>> +GIT_VERSION = $(shell git describe --always --long --dirty || echo "unknown")
>> +CFLAGS += -DGIT_VERSION='"$(GIT_VERSION)"' -I$(CURDIR) -I$(CURDIR)/../include
>>  
>>  EXTRA_SOURCES := ../harness.c
>>  
>>  build_32bit = $(shell if ($(CC) $(CFLAGS) -m32 -o /dev/null memcmp.c >/dev/null 2>&1) then echo "1"; fi)
>>  
>> +ifneq ($(build_32bit),1)
>>  TEST_GEN_PROGS := memcmp_64 strlen
>> +TEST_GEN_FILES := memcmp.o memcmp_64.o memcmp_64
>> +MEMCMP := $(OUTPUT)/memcmp.o
>> +MEMCMP_64 := $(OUTPUT)/memcmp_64.o
>> +HARNESS :=  $(OUTPUT)/../harness.o
>> +CFLAGS += -m64 -maltivec
>>  
>> -$(OUTPUT)/memcmp_64: memcmp.c
>> -$(OUTPUT)/memcmp_64: CFLAGS += -m64 -maltivec
>> +OVERRIDE_TARGETS := 1
>> +include ../../lib.mk
>>  
>> -ifeq ($(build_32bit),1)
>> +$(OUTPUT)/memcmp_64: $(MEMCMP_64) $(MEMCMP) $(HARNESS)
>> +	$(CC) $(CFLAGS) memcmp.o memcmp_64.o ../harness.o -o memcmp_64
>> +
>> +$(MEMCMP_64): memcmp_64.S
>> +	$(CC) $(CFLAGS) -D__ASSEMBLY__ -o memcmp_64.o -c memcmp_64.S
>> +
>> +$(MEMCMP): memcmp.c
>> +	$(CC) $(CFLAGS) -o memcmp.o -c memcmp.c
>> +
>> +$(HARNESS): $(EXTRA_SOURCES)
>> +	$(CC) $(CFLAGS) -DGIT_VERSION='"$(GIT_VERSION)"' -o ../harness.o -c $(EXTRA_SOURCES)
> 
> What are you actually trying to do here? Is it just that you need to
> define __ASSEMBLY__ for memcmp_64.S?

Adding __ASSEMBLY__ while building memcmp_64.S would be the goal, so as 
to reuse ppc-opcode.h. However, asm/ppc-opcode.h under stringloops test 
is tiny and doesn't seem to justify the change.

> 
> What you have breaks the build, it's not respecting $(OUTPUT).

I think we should just drop this patch from the series.

Bala,
Can you re-post this series without the RFC tag, with the last patch 
dropped?


- Naveen


^ permalink raw reply

* Re: [PATCH] ASoC: fsl_easrc: Check NULL pinter before dereference
From: Mark Brown @ 2020-04-29 14:14 UTC (permalink / raw)
  To: Shengjiu Wang
  Cc: alsa-devel, timur, Xiubo.Lee, linuxppc-dev, tiwai, lgirdwood,
	perex, nicoleotsuka, festevam, linux-kernel
In-Reply-To: <1587731404-29750-1-git-send-email-shengjiu.wang@nxp.com>

[-- Attachment #1: Type: text/plain, Size: 268 bytes --]

On Fri, Apr 24, 2020 at 08:30:04PM +0800, Shengjiu Wang wrote:
> The patch 955ac624058f: "ASoC: fsl_easrc: Add EASRC ASoC CPU DAI
> drivers" from Apr 16, 2020, leads to the following Smatch complaint:

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply

* Re: [Skiboot] [PATCH v8 3/3] Self save API integration
From: Vaidyanathan Srinivasan @ 2020-04-29 14:08 UTC (permalink / raw)
  To: Pratik Rajesh Sampat
  Cc: ego, pratik.r.sampat, linuxram, linux-kernel, linuxppc-dev,
	oohall, skiboot
In-Reply-To: <20200423105438.29034-4-psampat@linux.ibm.com>

* Pratik Rajesh Sampat <psampat@linux.ibm.com> [2020-04-23 16:24:38]:

> The commit makes the self save API available outside the firmware by defining
> an OPAL wrapper.
> This wrapper has a similar interface to that of self restore and expects the
> cpu pir, SPR number, minus the value of that SPR to be passed in its
> paramters and returns OPAL_SUCCESS on success. It adds a device-tree
> node signifying support for self-save after verifying the stop API
> version compatibility.
> 
> The commit also documents both the self-save and the self-restore API
> calls along with their working and usage.
> 
> Signed-off-by: Pratik Rajesh Sampat <psampat@linux.ibm.com>

Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.ibm.com>

> ---
>  doc/opal-api/opal-slw-self-save-reg-181.rst |  51 ++++++++++
>  doc/opal-api/opal-slw-set-reg-100.rst       |   5 +
>  doc/power-management.rst                    |  48 +++++++++
>  hw/slw.c                                    | 106 ++++++++++++++++++++
>  include/opal-api.h                          |   3 +-
>  include/p9_stop_api.H                       |  18 ++++
>  include/skiboot.h                           |   3 +
>  7 files changed, 233 insertions(+), 1 deletion(-)
>  create mode 100644 doc/opal-api/opal-slw-self-save-reg-181.rst

This patch enables OPAL interface to call stop-api and set self-save.
Basically completes the infrastructure required to use the new
self-save function provided by the microcode.

--Vaidy

^ permalink raw reply

* Re: [PATCH v8 2/3] API to verify the STOP API and image compatibility
From: Vaidyanathan Srinivasan @ 2020-04-29 14:05 UTC (permalink / raw)
  To: Pratik Rajesh Sampat
  Cc: ego, pratik.r.sampat, linuxram, linux-kernel, linuxppc-dev,
	oohall, skiboot
In-Reply-To: <20200423105438.29034-3-psampat@linux.ibm.com>

* Pratik Rajesh Sampat <psampat@linux.ibm.com> [2020-04-23 16:24:37]:

> From: Prem Shanker Jha <premjha2@in.ibm.com>
> 
> Commit defines a new API primarily intended for OPAL to determine
> cpu register save API's compatibility with HOMER layout and
> self save restore. It can help OPAL determine if version of
> API integrated with OPAL is different from hostboot.
> 
> Change-Id: Ic0de45a336cfb8b6b6096a10ac1cd3ffbaa44fc0
> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77612
> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
> Reviewed-by: RANGANATHPRASAD G. BRAHMASAMUDRA <prasadbgr@in.ibm.com>
> Reviewed-by: Gregory S Still <stillgs@us.ibm.com>
> Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/77614
> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
> Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
> Signed-off-by: Pratik Rajesh Sampat <psampat@linux.ibm.com>

Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.ibm.com>

> ---
>  include/p9_stop_api.H                    | 25 ++++++++++
>  libpore/p9_cpu_reg_restore_instruction.H |  7 ++-
>  libpore/p9_hcd_memmap_base.H             |  7 +++
>  libpore/p9_stop_api.C                    | 58 +++++++++++++++++++++++-
>  libpore/p9_stop_api.H                    | 26 ++++++++++-
>  libpore/p9_stop_util.H                   | 20 ++++----
>  6 files changed, 130 insertions(+), 13 deletions(-)

This stop-api code will help OPAL check and use self-save functions so
that different versions of OPAL can be loaded and run with different
versions of low level firmware stack.

--Vaidy

^ permalink raw reply

* Re: [Skiboot] [PATCH v8 1/3] Self Save: Introducing Support for SPR Self Save
From: Vaidyanathan Srinivasan @ 2020-04-29 14:02 UTC (permalink / raw)
  To: Pratik Rajesh Sampat
  Cc: ego, pratik.r.sampat, linuxram, linux-kernel, linuxppc-dev,
	oohall, skiboot
In-Reply-To: <20200423105438.29034-2-psampat@linux.ibm.com>

* Pratik Rajesh Sampat <psampat@linux.ibm.com> [2020-04-23 16:24:36]:

> From: Prem Shanker Jha <premjha2@in.ibm.com>
> 
> The commit is a merger of commits that makes the following changes:
> 1. Commit fixes some issues with code found during integration test
>   -  replacement of addi with xor instruction during self save API.
>   -  fixing instruction generation for MFMSR during self save
>   -  data struct updates in STOP API
>   -  error RC updates for hcode image build
>   -  HOMER parser updates.
>   -  removed self save support for URMOR and HRMOR
>   -  code changes for compilation with OPAL
>   -  populating CME Image header with unsecure HOMER address.
> 
> Key_Cronus_Test=PM_REGRESS
> 
> Change-Id: I7cedcc466267c4245255d8d75c01ed695e316720
> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66580
> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
> Tested-by: HWSV CI <hwsv-ci+hostboot@us.ibm.com>
> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com>
> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
> Tested-by: Cronus HW CI <cronushw-ci+hostboot@us.ibm.com>
> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
> Reviewed-by: RAHUL BATRA <rbatra@us.ibm.com>
> Reviewed-by: Jennifer A. Stofer <stofer@us.ibm.com>
> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/66587
> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
> Signed-off-by: Prem Shanker Jha <premjha2@in.ibm.com>
> Signed-off-by: Akshay Adiga <akshay.adiga@linux.vnet.ibm.com>
> Signed-off-by: Pratik Rajesh Sampat <psampat@linux.ibm.com>

Reviewed-by: Vaidyanathan Srinivasan <svaidy@linux.ibm.com>

> 2. The commit also incorporates changes that make STOP API project
> agnostic changes include defining wrapper functions which call legacy
> API. It also adds duplicate enum members which start with prefix PROC
> instead of P9.
> 
> Key_Cronus_Test=PM_REGRESS
> 
> Change-Id: If87970f3e8cf9b507f33eb1be249e03eb3836a5e
> RTC: 201128
> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71307
> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
> Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
> Tested-by: Hostboot CI <hostboot-ci+hostboot@us.ibm.com>
> Tested-by: Cronus HW CI <cronushw-ci+hostboot@us.ibm.com>
> Reviewed-by: RANGANATHPRASAD G. BRAHMASAMUDRA <prasadbgr@in.ibm.com>
> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com>
> Reviewed-by: Jennifer A Stofer <stofer@us.ibm.com>
> Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/71314
> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
> Signed-off-by: Prem Shanker Jha <premjha2@in.ibm.com>
> Signed-off-by: Pratik Rajesh Sampat <psampat@linux.ibm.com>
> ---
>  include/p9_stop_api.H                    |  79 +-
>  libpore/p9_cpu_reg_restore_instruction.H |   4 +
>  libpore/p9_stop_api.C                    | 954 +++++++++++++----------
>  libpore/p9_stop_api.H                    | 115 ++-
>  libpore/p9_stop_data_struct.H            |   4 +-
>  libpore/p9_stop_util.H                   |   7 +-
>  6 files changed, 721 insertions(+), 442 deletions(-)


These code changes are from hcode component copied as is into OPAL
project for integration and use of stop-api.

Hcode component in cooperation with hostboot would be loaded in memory
before OPAL is loaded. This code will allow runtime changes and usage
of various power management save restore functions.

This patch specifically enables self-save feature by the microcode.

--Vaidy


^ permalink raw reply

* Re: [RFC PATCH dpss_eth] Don't initialise ports with no PHY
From: Andrew Lunn @ 2020-04-29 13:12 UTC (permalink / raw)
  To: Christian Zigotzky
  Cc: madalin.bacur, R.T.Dickinson, netdev, oss, Darren Stevens,
	contact@a-eon.com, mad skateman, linuxppc-dev
In-Reply-To: <ca95a1b2-1b16-008c-18ba-2cbd79f240e6@xenosoft.de>

> Maybe we have to modify the dtb file.

Hi Christian

Could you point me at the DT file.

      Thanks
	Andrew

^ permalink raw reply

* Re: [PATCH] fixup! signal: factor copy_siginfo_to_external32 from copy_siginfo_to_user32
From: Arnd Bergmann @ 2020-04-29 12:34 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Jeremy Kerr, linux-kernel@vger.kernel.org, Eric W . Biederman,
	Linux FS-devel Mailing List, Andrew Morton, linuxppc-dev,
	Alexander Viro
In-Reply-To: <20200429115316.GA7886@lst.de>

On Wed, Apr 29, 2020 at 1:53 PM Christoph Hellwig <hch@lst.de> wrote:
>
> I did another pass at this, reducing the overhead of the x32 magic
> in common code down to renaming copy_siginfo_to_user32 to
> copy_siginfo_to_user32 and having a conditional #define to give it
> the old name back:

Nice! I guess this is about as good as it gets, so we can stop
spending more time on it now ;-)

       Arnd

^ permalink raw reply

* Re: [PATCH v4 4/7] KVM: PPC: clean up redundant 'kvm_run' parameters
From: Vitaly Kuznetsov @ 2020-04-29 12:32 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: christoffer.dall, wanpengli, kvm, david, heiko.carstens, peterx,
	linux-kernel, hpa, kvmarm, linux-s390, frankja, chenhuacai, joro,
	x86, borntraeger, mingo, julien.thierry.kdev, thuth, gor,
	suzuki.poulose, kvm-ppc, bp, tglx, linux-arm-kernel, jmattson,
	tsbogend, tianjia.zhang, cohuck, linux-mips,
	sean.j.christopherson, james.morse, maz, pbonzini, linuxppc-dev
In-Reply-To: <20200427043514.16144-5-tianjia.zhang@linux.alibaba.com>

Tianjia Zhang <tianjia.zhang@linux.alibaba.com> writes:

> In the current kvm version, 'kvm_run' has been included in the 'kvm_vcpu'
> structure. For historical reasons, many kvm-related function parameters
> retain the 'kvm_run' and 'kvm_vcpu' parameters at the same time. This
> patch does a unified cleanup of these remaining redundant parameters.
>
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>  arch/powerpc/include/asm/kvm_book3s.h    | 16 +++---
>  arch/powerpc/include/asm/kvm_ppc.h       | 27 +++++----
>  arch/powerpc/kvm/book3s.c                |  4 +-
>  arch/powerpc/kvm/book3s.h                |  2 +-
>  arch/powerpc/kvm/book3s_64_mmu_hv.c      | 12 ++--
>  arch/powerpc/kvm/book3s_64_mmu_radix.c   |  4 +-
>  arch/powerpc/kvm/book3s_emulate.c        | 10 ++--
>  arch/powerpc/kvm/book3s_hv.c             | 60 ++++++++++----------
>  arch/powerpc/kvm/book3s_hv_nested.c      | 11 ++--
>  arch/powerpc/kvm/book3s_paired_singles.c | 72 ++++++++++++------------
>  arch/powerpc/kvm/book3s_pr.c             | 30 +++++-----
>  arch/powerpc/kvm/booke.c                 | 36 ++++++------
>  arch/powerpc/kvm/booke.h                 |  8 +--
>  arch/powerpc/kvm/booke_emulate.c         |  2 +-
>  arch/powerpc/kvm/e500_emulate.c          | 15 +++--
>  arch/powerpc/kvm/emulate.c               | 10 ++--
>  arch/powerpc/kvm/emulate_loadstore.c     | 32 +++++------
>  arch/powerpc/kvm/powerpc.c               | 72 ++++++++++++------------
>  arch/powerpc/kvm/trace_hv.h              |  6 +-
>  19 files changed, 212 insertions(+), 217 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
> index 506e4df2d730..66dbb1f85d59 100644
> --- a/arch/powerpc/include/asm/kvm_book3s.h
> +++ b/arch/powerpc/include/asm/kvm_book3s.h
> @@ -155,12 +155,11 @@ extern void kvmppc_mmu_unmap_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte)
>  extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr);
>  extern void kvmppc_mmu_flush_segment(struct kvm_vcpu *vcpu, ulong eaddr, ulong seg_size);
>  extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu);
> -extern int kvmppc_book3s_hv_page_fault(struct kvm_run *run,
> -			struct kvm_vcpu *vcpu, unsigned long addr,
> -			unsigned long status);
> +extern int kvmppc_book3s_hv_page_fault(struct kvm_vcpu *vcpu,
> +			unsigned long addr, unsigned long status);
>  extern long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr,
>  			unsigned long slb_v, unsigned long valid);
> -extern int kvmppc_hv_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +extern int kvmppc_hv_emulate_mmio(struct kvm_vcpu *vcpu,
>  			unsigned long gpa, gva_t ea, int is_store);
>  
>  extern void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte);
> @@ -174,8 +173,7 @@ extern void kvmppc_mmu_hpte_sysexit(void);
>  extern int kvmppc_mmu_hv_init(void);
>  extern int kvmppc_book3s_hcall_implemented(struct kvm *kvm, unsigned long hc);
>  
> -extern int kvmppc_book3s_radix_page_fault(struct kvm_run *run,
> -			struct kvm_vcpu *vcpu,
> +extern int kvmppc_book3s_radix_page_fault(struct kvm_vcpu *vcpu,
>  			unsigned long ea, unsigned long dsisr);
>  extern unsigned long __kvmhv_copy_tofrom_guest_radix(int lpid, int pid,
>  					gva_t eaddr, void *to, void *from,
> @@ -234,7 +232,7 @@ extern void kvmppc_trigger_fac_interrupt(struct kvm_vcpu *vcpu, ulong fac);
>  extern void kvmppc_set_bat(struct kvm_vcpu *vcpu, struct kvmppc_bat *bat,
>  			   bool upper, u32 val);
>  extern void kvmppc_giveup_ext(struct kvm_vcpu *vcpu, ulong msr);
> -extern int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu);
> +extern int kvmppc_emulate_paired_single(struct kvm_vcpu *vcpu);
>  extern kvm_pfn_t kvmppc_gpa_to_pfn(struct kvm_vcpu *vcpu, gpa_t gpa,
>  			bool writing, bool *writable);
>  extern void kvmppc_add_revmap_chain(struct kvm *kvm, struct revmap_entry *rev,
> @@ -300,12 +298,12 @@ void kvmhv_set_ptbl_entry(unsigned int lpid, u64 dw0, u64 dw1);
>  void kvmhv_release_all_nested(struct kvm *kvm);
>  long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu);
>  long kvmhv_do_nested_tlbie(struct kvm_vcpu *vcpu);
> -int kvmhv_run_single_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu,
> +int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu,
>  			  u64 time_limit, unsigned long lpcr);
>  void kvmhv_save_hv_regs(struct kvm_vcpu *vcpu, struct hv_guest_state *hr);
>  void kvmhv_restore_hv_return_state(struct kvm_vcpu *vcpu,
>  				   struct hv_guest_state *hr);
> -long int kvmhv_nested_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu);
> +long int kvmhv_nested_page_fault(struct kvm_vcpu *vcpu);
>  
>  void kvmppc_giveup_fac(struct kvm_vcpu *vcpu, ulong fac);
>  
> diff --git a/arch/powerpc/include/asm/kvm_ppc.h b/arch/powerpc/include/asm/kvm_ppc.h
> index 94f5a32acaf1..ccf66b3a4c1d 100644
> --- a/arch/powerpc/include/asm/kvm_ppc.h
> +++ b/arch/powerpc/include/asm/kvm_ppc.h
> @@ -58,28 +58,28 @@ enum xlate_readwrite {
>  	XLATE_WRITE		/* check for write permissions */
>  };
>  
> -extern int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
> -extern int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
> +extern int kvmppc_vcpu_run(struct kvm_vcpu *vcpu);
> +extern int __kvmppc_vcpu_run(struct kvm_run *run, struct kvm_vcpu *vcpu);
>  extern void kvmppc_handler_highmem(void);
>  
>  extern void kvmppc_dump_vcpu(struct kvm_vcpu *vcpu);
> -extern int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +extern int kvmppc_handle_load(struct kvm_vcpu *vcpu,
>                                unsigned int rt, unsigned int bytes,
>  			      int is_default_endian);
> -extern int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +extern int kvmppc_handle_loads(struct kvm_vcpu *vcpu,
>                                 unsigned int rt, unsigned int bytes,
>  			       int is_default_endian);
> -extern int kvmppc_handle_vsx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +extern int kvmppc_handle_vsx_load(struct kvm_vcpu *vcpu,
>  				unsigned int rt, unsigned int bytes,
>  			int is_default_endian, int mmio_sign_extend);
> -extern int kvmppc_handle_vmx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +extern int kvmppc_handle_vmx_load(struct kvm_vcpu *vcpu,
>  		unsigned int rt, unsigned int bytes, int is_default_endian);
> -extern int kvmppc_handle_vmx_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +extern int kvmppc_handle_vmx_store(struct kvm_vcpu *vcpu,
>  		unsigned int rs, unsigned int bytes, int is_default_endian);
> -extern int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +extern int kvmppc_handle_store(struct kvm_vcpu *vcpu,
>  			       u64 val, unsigned int bytes,
>  			       int is_default_endian);
> -extern int kvmppc_handle_vsx_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +extern int kvmppc_handle_vsx_store(struct kvm_vcpu *vcpu,
>  				int rs, unsigned int bytes,
>  				int is_default_endian);
>  
> @@ -90,10 +90,9 @@ extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
>  		     bool data);
>  extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr,
>  		     bool data);
> -extern int kvmppc_emulate_instruction(struct kvm_run *run,
> -                                      struct kvm_vcpu *vcpu);
> +extern int kvmppc_emulate_instruction(struct kvm_vcpu *vcpu);
>  extern int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu);
> -extern int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu);
> +extern int kvmppc_emulate_mmio(struct kvm_vcpu *vcpu);
>  extern void kvmppc_emulate_dec(struct kvm_vcpu *vcpu);
>  extern u32 kvmppc_get_dec(struct kvm_vcpu *vcpu, u64 tb);
>  extern void kvmppc_decrementer_func(struct kvm_vcpu *vcpu);
> @@ -267,7 +266,7 @@ struct kvmppc_ops {
>  	void (*vcpu_put)(struct kvm_vcpu *vcpu);
>  	void (*inject_interrupt)(struct kvm_vcpu *vcpu, int vec, u64 srr1_flags);
>  	void (*set_msr)(struct kvm_vcpu *vcpu, u64 msr);
> -	int (*vcpu_run)(struct kvm_run *run, struct kvm_vcpu *vcpu);
> +	int (*vcpu_run)(struct kvm_vcpu *vcpu);
>  	int (*vcpu_create)(struct kvm_vcpu *vcpu);
>  	void (*vcpu_free)(struct kvm_vcpu *vcpu);
>  	int (*check_requests)(struct kvm_vcpu *vcpu);
> @@ -291,7 +290,7 @@ struct kvmppc_ops {
>  	int (*init_vm)(struct kvm *kvm);
>  	void (*destroy_vm)(struct kvm *kvm);
>  	int (*get_smmu_info)(struct kvm *kvm, struct kvm_ppc_smmu_info *info);
> -	int (*emulate_op)(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +	int (*emulate_op)(struct kvm_vcpu *vcpu,
>  			  unsigned int inst, int *advance);
>  	int (*emulate_mtspr)(struct kvm_vcpu *vcpu, int sprn, ulong spr_val);
>  	int (*emulate_mfspr)(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val);
> diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
> index 5690a1f9b976..345d22de213b 100644
> --- a/arch/powerpc/kvm/book3s.c
> +++ b/arch/powerpc/kvm/book3s.c
> @@ -758,9 +758,9 @@ void kvmppc_set_msr(struct kvm_vcpu *vcpu, u64 msr)
>  }
>  EXPORT_SYMBOL_GPL(kvmppc_set_msr);
>  
> -int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
> +int kvmppc_vcpu_run(struct kvm_vcpu *vcpu)
>  {
> -	return vcpu->kvm->arch.kvm_ops->vcpu_run(kvm_run, vcpu);
> +	return vcpu->kvm->arch.kvm_ops->vcpu_run(vcpu);
>  }
>  
>  int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
> diff --git a/arch/powerpc/kvm/book3s.h b/arch/powerpc/kvm/book3s.h
> index eae259ee49af..9b6323ec8e60 100644
> --- a/arch/powerpc/kvm/book3s.h
> +++ b/arch/powerpc/kvm/book3s.h
> @@ -18,7 +18,7 @@ extern void kvm_set_spte_hva_hv(struct kvm *kvm, unsigned long hva, pte_t pte);
>  
>  extern int kvmppc_mmu_init_pr(struct kvm_vcpu *vcpu);
>  extern void kvmppc_mmu_destroy_pr(struct kvm_vcpu *vcpu);
> -extern int kvmppc_core_emulate_op_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +extern int kvmppc_core_emulate_op_pr(struct kvm_vcpu *vcpu,
>  				     unsigned int inst, int *advance);
>  extern int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu,
>  					int sprn, ulong spr_val);
> diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> index 2b35f9bcf892..36a07656ebbb 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
> +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
> @@ -413,7 +413,7 @@ static int instruction_is_store(unsigned int instr)
>  	return (instr & mask) != 0;
>  }
>  
> -int kvmppc_hv_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_hv_emulate_mmio(struct kvm_vcpu *vcpu,
>  			   unsigned long gpa, gva_t ea, int is_store)
>  {
>  	u32 last_inst;
> @@ -473,10 +473,10 @@ int kvmppc_hv_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  
>  	vcpu->arch.paddr_accessed = gpa;
>  	vcpu->arch.vaddr_accessed = ea;
> -	return kvmppc_emulate_mmio(run, vcpu);
> +	return kvmppc_emulate_mmio(vcpu);
>  }
>  
> -int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_book3s_hv_page_fault(struct kvm_vcpu *vcpu,
>  				unsigned long ea, unsigned long dsisr)
>  {
>  	struct kvm *kvm = vcpu->kvm;
> @@ -499,7 +499,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	pte_t pte, *ptep;
>  
>  	if (kvm_is_radix(kvm))
> -		return kvmppc_book3s_radix_page_fault(run, vcpu, ea, dsisr);
> +		return kvmppc_book3s_radix_page_fault(vcpu, ea, dsisr);
>  
>  	/*
>  	 * Real-mode code has already searched the HPT and found the
> @@ -519,7 +519,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  			gpa_base = r & HPTE_R_RPN & ~(psize - 1);
>  			gfn_base = gpa_base >> PAGE_SHIFT;
>  			gpa = gpa_base | (ea & (psize - 1));
> -			return kvmppc_hv_emulate_mmio(run, vcpu, gpa, ea,
> +			return kvmppc_hv_emulate_mmio(vcpu, gpa, ea,
>  						dsisr & DSISR_ISSTORE);
>  		}
>  	}
> @@ -555,7 +555,7 @@ int kvmppc_book3s_hv_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  
>  	/* No memslot means it's an emulated MMIO region */
>  	if (!memslot || (memslot->flags & KVM_MEMSLOT_INVALID))
> -		return kvmppc_hv_emulate_mmio(run, vcpu, gpa, ea,
> +		return kvmppc_hv_emulate_mmio(vcpu, gpa, ea,
>  					      dsisr & DSISR_ISSTORE);
>  
>  	/*
> diff --git a/arch/powerpc/kvm/book3s_64_mmu_radix.c b/arch/powerpc/kvm/book3s_64_mmu_radix.c
> index aa12cd4078b3..16c947bd5e87 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu_radix.c
> +++ b/arch/powerpc/kvm/book3s_64_mmu_radix.c
> @@ -887,7 +887,7 @@ int kvmppc_book3s_instantiate_page(struct kvm_vcpu *vcpu,
>  	return ret;
>  }
>  
> -int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_book3s_radix_page_fault(struct kvm_vcpu *vcpu,
>  				   unsigned long ea, unsigned long dsisr)
>  {
>  	struct kvm *kvm = vcpu->kvm;
> @@ -933,7 +933,7 @@ int kvmppc_book3s_radix_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  			kvmppc_core_queue_data_storage(vcpu, ea, dsisr);
>  			return RESUME_GUEST;
>  		}
> -		return kvmppc_hv_emulate_mmio(run, vcpu, gpa, ea, writing);
> +		return kvmppc_hv_emulate_mmio(vcpu, gpa, ea, writing);
>  	}
>  
>  	if (memslot->flags & KVM_MEM_READONLY) {
> diff --git a/arch/powerpc/kvm/book3s_emulate.c b/arch/powerpc/kvm/book3s_emulate.c
> index dad71d276b91..0effd48c8f4d 100644
> --- a/arch/powerpc/kvm/book3s_emulate.c
> +++ b/arch/powerpc/kvm/book3s_emulate.c
> @@ -235,7 +235,7 @@ void kvmppc_emulate_tabort(struct kvm_vcpu *vcpu, int ra_val)
>  
>  #endif
>  
> -int kvmppc_core_emulate_op_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_core_emulate_op_pr(struct kvm_vcpu *vcpu,
>  			      unsigned int inst, int *advance)
>  {
>  	int emulated = EMULATE_DONE;
> @@ -371,13 +371,13 @@ int kvmppc_core_emulate_op_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  			if (kvmppc_h_pr(vcpu, cmd) == EMULATE_DONE)
>  				break;
>  
> -			run->papr_hcall.nr = cmd;
> +			vcpu->run->papr_hcall.nr = cmd;
>  			for (i = 0; i < 9; ++i) {
>  				ulong gpr = kvmppc_get_gpr(vcpu, 4 + i);
> -				run->papr_hcall.args[i] = gpr;
> +				vcpu->run->papr_hcall.args[i] = gpr;
>  			}
>  
> -			run->exit_reason = KVM_EXIT_PAPR_HCALL;
> +			vcpu->run->exit_reason = KVM_EXIT_PAPR_HCALL;
>  			vcpu->arch.hcall_needed = 1;
>  			emulated = EMULATE_EXIT_USER;
>  			break;
> @@ -629,7 +629,7 @@ int kvmppc_core_emulate_op_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	}
>  
>  	if (emulated == EMULATE_FAIL)
> -		emulated = kvmppc_emulate_paired_single(run, vcpu);
> +		emulated = kvmppc_emulate_paired_single(vcpu);
>  
>  	return emulated;
>  }
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 413ea2dcb10c..296bc6fb4eb1 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -1156,8 +1156,7 @@ static int kvmppc_hcall_impl_hv(unsigned long cmd)
>  	return kvmppc_hcall_impl_hv_realmode(cmd);
>  }
>  
> -static int kvmppc_emulate_debug_inst(struct kvm_run *run,
> -					struct kvm_vcpu *vcpu)
> +static int kvmppc_emulate_debug_inst(struct kvm_vcpu *vcpu)
>  {
>  	u32 last_inst;
>  
> @@ -1171,8 +1170,8 @@ static int kvmppc_emulate_debug_inst(struct kvm_run *run,
>  	}
>  
>  	if (last_inst == KVMPPC_INST_SW_BREAKPOINT) {
> -		run->exit_reason = KVM_EXIT_DEBUG;
> -		run->debug.arch.address = kvmppc_get_pc(vcpu);
> +		vcpu->run->exit_reason = KVM_EXIT_DEBUG;
> +		vcpu->run->debug.arch.address = kvmppc_get_pc(vcpu);
>  		return RESUME_HOST;
>  	} else {
>  		kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
> @@ -1273,9 +1272,10 @@ static int kvmppc_emulate_doorbell_instr(struct kvm_vcpu *vcpu)
>  	return RESUME_GUEST;
>  }
>  
> -static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int kvmppc_handle_exit_hv(struct kvm_vcpu *vcpu,
>  				 struct task_struct *tsk)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	int r = RESUME_HOST;
>  
>  	vcpu->stat.sum_exits++;
> @@ -1410,7 +1410,7 @@ static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  				swab32(vcpu->arch.emul_inst) :
>  				vcpu->arch.emul_inst;
>  		if (vcpu->guest_debug & KVM_GUESTDBG_USE_SW_BP) {
> -			r = kvmppc_emulate_debug_inst(run, vcpu);
> +			r = kvmppc_emulate_debug_inst(vcpu);
>  		} else {
>  			kvmppc_core_queue_program(vcpu, SRR1_PROGILL);
>  			r = RESUME_GUEST;
> @@ -1462,7 +1462,7 @@ static int kvmppc_handle_exit_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	return r;
>  }
>  
> -static int kvmppc_handle_nested_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
> +static int kvmppc_handle_nested_exit(struct kvm_vcpu *vcpu)
>  {
>  	int r;
>  	int srcu_idx;
> @@ -1520,7 +1520,7 @@ static int kvmppc_handle_nested_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	 */
>  	case BOOK3S_INTERRUPT_H_DATA_STORAGE:
>  		srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
> -		r = kvmhv_nested_page_fault(run, vcpu);
> +		r = kvmhv_nested_page_fault(vcpu);
>  		srcu_read_unlock(&vcpu->kvm->srcu, srcu_idx);
>  		break;
>  	case BOOK3S_INTERRUPT_H_INST_STORAGE:
> @@ -1530,7 +1530,7 @@ static int kvmppc_handle_nested_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  		if (vcpu->arch.shregs.msr & HSRR1_HISI_WRITE)
>  			vcpu->arch.fault_dsisr |= DSISR_ISSTORE;
>  		srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
> -		r = kvmhv_nested_page_fault(run, vcpu);
> +		r = kvmhv_nested_page_fault(vcpu);
>  		srcu_read_unlock(&vcpu->kvm->srcu, srcu_idx);
>  		break;
>  
> @@ -2934,7 +2934,7 @@ static void post_guest_process(struct kvmppc_vcore *vc, bool is_master)
>  
>  		ret = RESUME_GUEST;
>  		if (vcpu->arch.trap)
> -			ret = kvmppc_handle_exit_hv(vcpu->run, vcpu,
> +			ret = kvmppc_handle_exit_hv(vcpu,
>  						    vcpu->arch.run_task);
>  
>  		vcpu->arch.ret = ret;
> @@ -3900,15 +3900,16 @@ static int kvmhv_setup_mmu(struct kvm_vcpu *vcpu)
>  	return r;
>  }
>  
> -static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
> +static int kvmppc_run_vcpu(struct kvm_vcpu *vcpu)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	int n_ceded, i, r;
>  	struct kvmppc_vcore *vc;
>  	struct kvm_vcpu *v;
>  
>  	trace_kvmppc_run_vcpu_enter(vcpu);
>  
> -	kvm_run->exit_reason = 0;
> +	run->exit_reason = 0;
>  	vcpu->arch.ret = RESUME_GUEST;
>  	vcpu->arch.trap = 0;
>  	kvmppc_update_vpas(vcpu);
> @@ -3952,8 +3953,8 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  			r = kvmhv_setup_mmu(vcpu);
>  			spin_lock(&vc->lock);
>  			if (r) {
> -				kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
> -				kvm_run->fail_entry.
> +				run->exit_reason = KVM_EXIT_FAIL_ENTRY;
> +				run->fail_entry.
>  					hardware_entry_failure_reason = 0;
>  				vcpu->arch.ret = r;
>  				break;
> @@ -4013,7 +4014,7 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  	if (vcpu->arch.state == KVMPPC_VCPU_RUNNABLE) {
>  		kvmppc_remove_runnable(vc, vcpu);
>  		vcpu->stat.signal_exits++;
> -		kvm_run->exit_reason = KVM_EXIT_INTR;
> +		run->exit_reason = KVM_EXIT_INTR;
>  		vcpu->arch.ret = -EINTR;
>  	}
>  
> @@ -4024,15 +4025,15 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  		wake_up(&v->arch.cpu_run);
>  	}
>  
> -	trace_kvmppc_run_vcpu_exit(vcpu, kvm_run);
> +	trace_kvmppc_run_vcpu_exit(vcpu);
>  	spin_unlock(&vc->lock);
>  	return vcpu->arch.ret;
>  }
>  
> -int kvmhv_run_single_vcpu(struct kvm_run *kvm_run,
> -			  struct kvm_vcpu *vcpu, u64 time_limit,
> +int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
>  			  unsigned long lpcr)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	int trap, r, pcpu;
>  	int srcu_idx, lpid;
>  	struct kvmppc_vcore *vc;
> @@ -4041,7 +4042,7 @@ int kvmhv_run_single_vcpu(struct kvm_run *kvm_run,
>  
>  	trace_kvmppc_run_vcpu_enter(vcpu);
>  
> -	kvm_run->exit_reason = 0;
> +	run->exit_reason = 0;
>  	vcpu->arch.ret = RESUME_GUEST;
>  	vcpu->arch.trap = 0;
>  
> @@ -4165,9 +4166,9 @@ int kvmhv_run_single_vcpu(struct kvm_run *kvm_run,
>  	r = RESUME_GUEST;
>  	if (trap) {
>  		if (!nested)
> -			r = kvmppc_handle_exit_hv(kvm_run, vcpu, current);
> +			r = kvmppc_handle_exit_hv(vcpu, current);
>  		else
> -			r = kvmppc_handle_nested_exit(kvm_run, vcpu);
> +			r = kvmppc_handle_nested_exit(vcpu);
>  	}
>  	vcpu->arch.ret = r;
>  
> @@ -4177,7 +4178,7 @@ int kvmhv_run_single_vcpu(struct kvm_run *kvm_run,
>  		while (vcpu->arch.ceded && !kvmppc_vcpu_woken(vcpu)) {
>  			if (signal_pending(current)) {
>  				vcpu->stat.signal_exits++;
> -				kvm_run->exit_reason = KVM_EXIT_INTR;
> +				run->exit_reason = KVM_EXIT_INTR;
>  				vcpu->arch.ret = -EINTR;
>  				break;
>  			}
> @@ -4193,13 +4194,13 @@ int kvmhv_run_single_vcpu(struct kvm_run *kvm_run,
>  
>   done:
>  	kvmppc_remove_runnable(vc, vcpu);
> -	trace_kvmppc_run_vcpu_exit(vcpu, kvm_run);
> +	trace_kvmppc_run_vcpu_exit(vcpu);
>  
>  	return vcpu->arch.ret;
>  
>   sigpend:
>  	vcpu->stat.signal_exits++;
> -	kvm_run->exit_reason = KVM_EXIT_INTR;
> +	run->exit_reason = KVM_EXIT_INTR;
>  	vcpu->arch.ret = -EINTR;
>   out:
>  	local_irq_enable();
> @@ -4207,8 +4208,9 @@ int kvmhv_run_single_vcpu(struct kvm_run *kvm_run,
>  	goto done;
>  }
>  
> -static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu)
> +static int kvmppc_vcpu_run_hv(struct kvm_vcpu *vcpu)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	int r;
>  	int srcu_idx;
>  	unsigned long ebb_regs[3] = {};	/* shut up GCC */
> @@ -4292,10 +4294,10 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  		 */
>  		if (kvm->arch.threads_indep && kvm_is_radix(kvm) &&
>  		    !no_mixing_hpt_and_radix)
> -			r = kvmhv_run_single_vcpu(run, vcpu, ~(u64)0,
> +			r = kvmhv_run_single_vcpu(vcpu, ~(u64)0,
>  						  vcpu->arch.vcore->lpcr);
>  		else
> -			r = kvmppc_run_vcpu(run, vcpu);
> +			r = kvmppc_run_vcpu(vcpu);
>  
>  		if (run->exit_reason == KVM_EXIT_PAPR_HCALL &&
>  		    !(vcpu->arch.shregs.msr & MSR_PR)) {
> @@ -4305,7 +4307,7 @@ static int kvmppc_vcpu_run_hv(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			kvmppc_core_prepare_to_enter(vcpu);
>  		} else if (r == RESUME_PAGE_FAULT) {
>  			srcu_idx = srcu_read_lock(&kvm->srcu);
> -			r = kvmppc_book3s_hv_page_fault(run, vcpu,
> +			r = kvmppc_book3s_hv_page_fault(vcpu,
>  				vcpu->arch.fault_dar, vcpu->arch.fault_dsisr);
>  			srcu_read_unlock(&kvm->srcu, srcu_idx);
>  		} else if (r == RESUME_PASSTHROUGH) {
> @@ -4979,7 +4981,7 @@ static void kvmppc_core_destroy_vm_hv(struct kvm *kvm)
>  }
>  
>  /* We don't need to emulate any privileged instructions or dcbz */
> -static int kvmppc_core_emulate_op_hv(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int kvmppc_core_emulate_op_hv(struct kvm_vcpu *vcpu,
>  				     unsigned int inst, int *advance)
>  {
>  	return EMULATE_FAIL;
> diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c
> index 5a3987f3ebf3..fe4c535882e6 100644
> --- a/arch/powerpc/kvm/book3s_hv_nested.c
> +++ b/arch/powerpc/kvm/book3s_hv_nested.c
> @@ -290,7 +290,7 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu)
>  			r = RESUME_HOST;
>  			break;
>  		}
> -		r = kvmhv_run_single_vcpu(vcpu->run, vcpu, hdec_exp, lpcr);
> +		r = kvmhv_run_single_vcpu(vcpu, hdec_exp, lpcr);
>  	} while (is_kvmppc_resume_guest(r));
>  
>  	/* save L2 state for return */
> @@ -1256,8 +1256,7 @@ static inline int kvmppc_radix_shift_to_level(int shift)
>  }
>  
>  /* called with gp->tlb_lock held */
> -static long int __kvmhv_nested_page_fault(struct kvm_run *run,
> -					  struct kvm_vcpu *vcpu,
> +static long int __kvmhv_nested_page_fault(struct kvm_vcpu *vcpu,
>  					  struct kvm_nested_guest *gp)
>  {
>  	struct kvm *kvm = vcpu->kvm;
> @@ -1340,7 +1339,7 @@ static long int __kvmhv_nested_page_fault(struct kvm_run *run,
>  		}
>  
>  		/* passthrough of emulated MMIO case */
> -		return kvmppc_hv_emulate_mmio(run, vcpu, gpa, ea, writing);
> +		return kvmppc_hv_emulate_mmio(vcpu, gpa, ea, writing);
>  	}
>  	if (memslot->flags & KVM_MEM_READONLY) {
>  		if (writing) {
> @@ -1427,13 +1426,13 @@ static long int __kvmhv_nested_page_fault(struct kvm_run *run,
>  	return RESUME_GUEST;
>  }
>  
> -long int kvmhv_nested_page_fault(struct kvm_run *run, struct kvm_vcpu *vcpu)
> +long int kvmhv_nested_page_fault(struct kvm_vcpu *vcpu)
>  {
>  	struct kvm_nested_guest *gp = vcpu->arch.nested;
>  	long int ret;
>  
>  	mutex_lock(&gp->tlb_lock);
> -	ret = __kvmhv_nested_page_fault(run, vcpu, gp);
> +	ret = __kvmhv_nested_page_fault(vcpu, gp);
>  	mutex_unlock(&gp->tlb_lock);
>  	return ret;
>  }
> diff --git a/arch/powerpc/kvm/book3s_paired_singles.c b/arch/powerpc/kvm/book3s_paired_singles.c
> index bf0282775e37..a11436720a8c 100644
> --- a/arch/powerpc/kvm/book3s_paired_singles.c
> +++ b/arch/powerpc/kvm/book3s_paired_singles.c
> @@ -169,7 +169,7 @@ static void kvmppc_inject_pf(struct kvm_vcpu *vcpu, ulong eaddr, bool is_store)
>  	kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_DATA_STORAGE);
>  }
>  
> -static int kvmppc_emulate_fpr_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int kvmppc_emulate_fpr_load(struct kvm_vcpu *vcpu,
>  				   int rs, ulong addr, int ls_type)
>  {
>  	int emulated = EMULATE_FAIL;
> @@ -188,7 +188,7 @@ static int kvmppc_emulate_fpr_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		kvmppc_inject_pf(vcpu, addr, false);
>  		goto done_load;
>  	} else if (r == EMULATE_DO_MMIO) {
> -		emulated = kvmppc_handle_load(run, vcpu, KVM_MMIO_REG_FPR | rs,
> +		emulated = kvmppc_handle_load(vcpu, KVM_MMIO_REG_FPR | rs,
>  					      len, 1);
>  		goto done_load;
>  	}
> @@ -213,7 +213,7 @@ static int kvmppc_emulate_fpr_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	return emulated;
>  }
>  
> -static int kvmppc_emulate_fpr_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int kvmppc_emulate_fpr_store(struct kvm_vcpu *vcpu,
>  				    int rs, ulong addr, int ls_type)
>  {
>  	int emulated = EMULATE_FAIL;
> @@ -248,7 +248,7 @@ static int kvmppc_emulate_fpr_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	if (r < 0) {
>  		kvmppc_inject_pf(vcpu, addr, true);
>  	} else if (r == EMULATE_DO_MMIO) {
> -		emulated = kvmppc_handle_store(run, vcpu, val, len, 1);
> +		emulated = kvmppc_handle_store(vcpu, val, len, 1);
>  	} else {
>  		emulated = EMULATE_DONE;
>  	}
> @@ -259,7 +259,7 @@ static int kvmppc_emulate_fpr_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	return emulated;
>  }
>  
> -static int kvmppc_emulate_psq_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int kvmppc_emulate_psq_load(struct kvm_vcpu *vcpu,
>  				   int rs, ulong addr, bool w, int i)
>  {
>  	int emulated = EMULATE_FAIL;
> @@ -279,12 +279,12 @@ static int kvmppc_emulate_psq_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		kvmppc_inject_pf(vcpu, addr, false);
>  		goto done_load;
>  	} else if ((r == EMULATE_DO_MMIO) && w) {
> -		emulated = kvmppc_handle_load(run, vcpu, KVM_MMIO_REG_FPR | rs,
> +		emulated = kvmppc_handle_load(vcpu, KVM_MMIO_REG_FPR | rs,
>  					      4, 1);
>  		vcpu->arch.qpr[rs] = tmp[1];
>  		goto done_load;
>  	} else if (r == EMULATE_DO_MMIO) {
> -		emulated = kvmppc_handle_load(run, vcpu, KVM_MMIO_REG_FQPR | rs,
> +		emulated = kvmppc_handle_load(vcpu, KVM_MMIO_REG_FQPR | rs,
>  					      8, 1);
>  		goto done_load;
>  	}
> @@ -302,7 +302,7 @@ static int kvmppc_emulate_psq_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	return emulated;
>  }
>  
> -static int kvmppc_emulate_psq_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int kvmppc_emulate_psq_store(struct kvm_vcpu *vcpu,
>  				    int rs, ulong addr, bool w, int i)
>  {
>  	int emulated = EMULATE_FAIL;
> @@ -318,10 +318,10 @@ static int kvmppc_emulate_psq_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	if (r < 0) {
>  		kvmppc_inject_pf(vcpu, addr, true);
>  	} else if ((r == EMULATE_DO_MMIO) && w) {
> -		emulated = kvmppc_handle_store(run, vcpu, tmp[0], 4, 1);
> +		emulated = kvmppc_handle_store(vcpu, tmp[0], 4, 1);
>  	} else if (r == EMULATE_DO_MMIO) {
>  		u64 val = ((u64)tmp[0] << 32) | tmp[1];
> -		emulated = kvmppc_handle_store(run, vcpu, val, 8, 1);
> +		emulated = kvmppc_handle_store(vcpu, val, 8, 1);
>  	} else {
>  		emulated = EMULATE_DONE;
>  	}
> @@ -618,7 +618,7 @@ static int kvmppc_ps_one_in(struct kvm_vcpu *vcpu, bool rc,
>  	return EMULATE_DONE;
>  }
>  
> -int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
> +int kvmppc_emulate_paired_single(struct kvm_vcpu *vcpu)
>  {
>  	u32 inst;
>  	enum emulation_result emulated = EMULATE_DONE;
> @@ -680,7 +680,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  		int i = inst_get_field(inst, 17, 19);
>  
>  		addr += get_d_signext(inst);
> -		emulated = kvmppc_emulate_psq_load(run, vcpu, ax_rd, addr, w, i);
> +		emulated = kvmppc_emulate_psq_load(vcpu, ax_rd, addr, w, i);
>  		break;
>  	}
>  	case OP_PSQ_LU:
> @@ -690,7 +690,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  		int i = inst_get_field(inst, 17, 19);
>  
>  		addr += get_d_signext(inst);
> -		emulated = kvmppc_emulate_psq_load(run, vcpu, ax_rd, addr, w, i);
> +		emulated = kvmppc_emulate_psq_load(vcpu, ax_rd, addr, w, i);
>  
>  		if (emulated == EMULATE_DONE)
>  			kvmppc_set_gpr(vcpu, ax_ra, addr);
> @@ -703,7 +703,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  		int i = inst_get_field(inst, 17, 19);
>  
>  		addr += get_d_signext(inst);
> -		emulated = kvmppc_emulate_psq_store(run, vcpu, ax_rd, addr, w, i);
> +		emulated = kvmppc_emulate_psq_store(vcpu, ax_rd, addr, w, i);
>  		break;
>  	}
>  	case OP_PSQ_STU:
> @@ -713,7 +713,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  		int i = inst_get_field(inst, 17, 19);
>  
>  		addr += get_d_signext(inst);
> -		emulated = kvmppc_emulate_psq_store(run, vcpu, ax_rd, addr, w, i);
> +		emulated = kvmppc_emulate_psq_store(vcpu, ax_rd, addr, w, i);
>  
>  		if (emulated == EMULATE_DONE)
>  			kvmppc_set_gpr(vcpu, ax_ra, addr);
> @@ -733,7 +733,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			int i = inst_get_field(inst, 22, 24);
>  
>  			addr += kvmppc_get_gpr(vcpu, ax_rb);
> -			emulated = kvmppc_emulate_psq_load(run, vcpu, ax_rd, addr, w, i);
> +			emulated = kvmppc_emulate_psq_load(vcpu, ax_rd, addr, w, i);
>  			break;
>  		}
>  		case OP_4X_PS_CMPO0:
> @@ -747,7 +747,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			int i = inst_get_field(inst, 22, 24);
>  
>  			addr += kvmppc_get_gpr(vcpu, ax_rb);
> -			emulated = kvmppc_emulate_psq_load(run, vcpu, ax_rd, addr, w, i);
> +			emulated = kvmppc_emulate_psq_load(vcpu, ax_rd, addr, w, i);
>  
>  			if (emulated == EMULATE_DONE)
>  				kvmppc_set_gpr(vcpu, ax_ra, addr);
> @@ -824,7 +824,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			int i = inst_get_field(inst, 22, 24);
>  
>  			addr += kvmppc_get_gpr(vcpu, ax_rb);
> -			emulated = kvmppc_emulate_psq_store(run, vcpu, ax_rd, addr, w, i);
> +			emulated = kvmppc_emulate_psq_store(vcpu, ax_rd, addr, w, i);
>  			break;
>  		}
>  		case OP_4XW_PSQ_STUX:
> @@ -834,7 +834,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			int i = inst_get_field(inst, 22, 24);
>  
>  			addr += kvmppc_get_gpr(vcpu, ax_rb);
> -			emulated = kvmppc_emulate_psq_store(run, vcpu, ax_rd, addr, w, i);
> +			emulated = kvmppc_emulate_psq_store(vcpu, ax_rd, addr, w, i);
>  
>  			if (emulated == EMULATE_DONE)
>  				kvmppc_set_gpr(vcpu, ax_ra, addr);
> @@ -922,7 +922,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	{
>  		ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) + full_d;
>  
> -		emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd, addr,
> +		emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd, addr,
>  						   FPU_LS_SINGLE);
>  		break;
>  	}
> @@ -930,7 +930,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	{
>  		ulong addr = kvmppc_get_gpr(vcpu, ax_ra) + full_d;
>  
> -		emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd, addr,
> +		emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd, addr,
>  						   FPU_LS_SINGLE);
>  
>  		if (emulated == EMULATE_DONE)
> @@ -941,7 +941,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	{
>  		ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) + full_d;
>  
> -		emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd, addr,
> +		emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd, addr,
>  						   FPU_LS_DOUBLE);
>  		break;
>  	}
> @@ -949,7 +949,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	{
>  		ulong addr = kvmppc_get_gpr(vcpu, ax_ra) + full_d;
>  
> -		emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd, addr,
> +		emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd, addr,
>  						   FPU_LS_DOUBLE);
>  
>  		if (emulated == EMULATE_DONE)
> @@ -960,7 +960,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	{
>  		ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) + full_d;
>  
> -		emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd, addr,
> +		emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd, addr,
>  						    FPU_LS_SINGLE);
>  		break;
>  	}
> @@ -968,7 +968,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	{
>  		ulong addr = kvmppc_get_gpr(vcpu, ax_ra) + full_d;
>  
> -		emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd, addr,
> +		emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd, addr,
>  						    FPU_LS_SINGLE);
>  
>  		if (emulated == EMULATE_DONE)
> @@ -979,7 +979,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	{
>  		ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) + full_d;
>  
> -		emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd, addr,
> +		emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd, addr,
>  						    FPU_LS_DOUBLE);
>  		break;
>  	}
> @@ -987,7 +987,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	{
>  		ulong addr = kvmppc_get_gpr(vcpu, ax_ra) + full_d;
>  
> -		emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd, addr,
> +		emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd, addr,
>  						    FPU_LS_DOUBLE);
>  
>  		if (emulated == EMULATE_DONE)
> @@ -1001,7 +1001,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			ulong addr = ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0;
>  
>  			addr += kvmppc_get_gpr(vcpu, ax_rb);
> -			emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd,
> +			emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd,
>  							   addr, FPU_LS_SINGLE);
>  			break;
>  		}
> @@ -1010,7 +1010,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			ulong addr = kvmppc_get_gpr(vcpu, ax_ra) +
>  				     kvmppc_get_gpr(vcpu, ax_rb);
>  
> -			emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd,
> +			emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd,
>  							   addr, FPU_LS_SINGLE);
>  
>  			if (emulated == EMULATE_DONE)
> @@ -1022,7 +1022,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) +
>  				     kvmppc_get_gpr(vcpu, ax_rb);
>  
> -			emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd,
> +			emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd,
>  							   addr, FPU_LS_DOUBLE);
>  			break;
>  		}
> @@ -1031,7 +1031,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			ulong addr = kvmppc_get_gpr(vcpu, ax_ra) +
>  				     kvmppc_get_gpr(vcpu, ax_rb);
>  
> -			emulated = kvmppc_emulate_fpr_load(run, vcpu, ax_rd,
> +			emulated = kvmppc_emulate_fpr_load(vcpu, ax_rd,
>  							   addr, FPU_LS_DOUBLE);
>  
>  			if (emulated == EMULATE_DONE)
> @@ -1043,7 +1043,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) +
>  				     kvmppc_get_gpr(vcpu, ax_rb);
>  
> -			emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
> +			emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
>  							    addr, FPU_LS_SINGLE);
>  			break;
>  		}
> @@ -1052,7 +1052,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			ulong addr = kvmppc_get_gpr(vcpu, ax_ra) +
>  				     kvmppc_get_gpr(vcpu, ax_rb);
>  
> -			emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
> +			emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
>  							    addr, FPU_LS_SINGLE);
>  
>  			if (emulated == EMULATE_DONE)
> @@ -1064,7 +1064,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) +
>  				     kvmppc_get_gpr(vcpu, ax_rb);
>  
> -			emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
> +			emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
>  							    addr, FPU_LS_DOUBLE);
>  			break;
>  		}
> @@ -1073,7 +1073,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			ulong addr = kvmppc_get_gpr(vcpu, ax_ra) +
>  				     kvmppc_get_gpr(vcpu, ax_rb);
>  
> -			emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
> +			emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
>  							    addr, FPU_LS_DOUBLE);
>  
>  			if (emulated == EMULATE_DONE)
> @@ -1085,7 +1085,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  			ulong addr = (ax_ra ? kvmppc_get_gpr(vcpu, ax_ra) : 0) +
>  				     kvmppc_get_gpr(vcpu, ax_rb);
>  
> -			emulated = kvmppc_emulate_fpr_store(run, vcpu, ax_rd,
> +			emulated = kvmppc_emulate_fpr_store(vcpu, ax_rd,
>  							    addr,
>  							    FPU_LS_SINGLE_LOW);
>  			break;
> diff --git a/arch/powerpc/kvm/book3s_pr.c b/arch/powerpc/kvm/book3s_pr.c
> index a0f6813f4560..ef54f917bdaf 100644
> --- a/arch/powerpc/kvm/book3s_pr.c
> +++ b/arch/powerpc/kvm/book3s_pr.c
> @@ -700,7 +700,7 @@ static bool kvmppc_visible_gpa(struct kvm_vcpu *vcpu, gpa_t gpa)
>  	return kvm_is_visible_gfn(vcpu->kvm, gpa >> PAGE_SHIFT);
>  }
>  
> -int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int kvmppc_handle_pagefault(struct kvm_vcpu *vcpu,
>  			    ulong eaddr, int vec)
>  {
>  	bool data = (vec == BOOK3S_INTERRUPT_DATA_STORAGE);
> @@ -795,7 +795,7 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		/* The guest's PTE is not mapped yet. Map on the host */
>  		if (kvmppc_mmu_map_page(vcpu, &pte, iswrite) == -EIO) {
>  			/* Exit KVM if mapping failed */
> -			run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
> +			vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
>  			return RESUME_HOST;
>  		}
>  		if (data)
> @@ -808,7 +808,7 @@ int kvmppc_handle_pagefault(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		vcpu->stat.mmio_exits++;
>  		vcpu->arch.paddr_accessed = pte.raddr;
>  		vcpu->arch.vaddr_accessed = pte.eaddr;
> -		r = kvmppc_emulate_mmio(run, vcpu);
> +		r = kvmppc_emulate_mmio(vcpu);
>  		if ( r == RESUME_HOST_NV )
>  			r = RESUME_HOST;
>  	}
> @@ -992,7 +992,7 @@ static void kvmppc_emulate_fac(struct kvm_vcpu *vcpu, ulong fac)
>  	enum emulation_result er = EMULATE_FAIL;
>  
>  	if (!(kvmppc_get_msr(vcpu) & MSR_PR))
> -		er = kvmppc_emulate_instruction(vcpu->run, vcpu);
> +		er = kvmppc_emulate_instruction(vcpu);
>  
>  	if ((er != EMULATE_DONE) && (er != EMULATE_AGAIN)) {
>  		/* Couldn't emulate, trigger interrupt in guest */
> @@ -1089,8 +1089,7 @@ static void kvmppc_clear_debug(struct kvm_vcpu *vcpu)
>  	}
>  }
>  
> -static int kvmppc_exit_pr_progint(struct kvm_run *run, struct kvm_vcpu *vcpu,
> -				  unsigned int exit_nr)
> +static int kvmppc_exit_pr_progint(struct kvm_vcpu *vcpu, unsigned int exit_nr)
>  {
>  	enum emulation_result er;
>  	ulong flags;
> @@ -1124,7 +1123,7 @@ static int kvmppc_exit_pr_progint(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	}
>  
>  	vcpu->stat.emulated_inst_exits++;
> -	er = kvmppc_emulate_instruction(run, vcpu);
> +	er = kvmppc_emulate_instruction(vcpu);
>  	switch (er) {
>  	case EMULATE_DONE:
>  		r = RESUME_GUEST_NV;
> @@ -1139,7 +1138,7 @@ static int kvmppc_exit_pr_progint(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		r = RESUME_GUEST;
>  		break;
>  	case EMULATE_DO_MMIO:
> -		run->exit_reason = KVM_EXIT_MMIO;
> +		vcpu->run->exit_reason = KVM_EXIT_MMIO;
>  		r = RESUME_HOST_NV;
>  		break;
>  	case EMULATE_EXIT_USER:
> @@ -1198,7 +1197,7 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		/* only care about PTEG not found errors, but leave NX alone */
>  		if (shadow_srr1 & 0x40000000) {
>  			int idx = srcu_read_lock(&vcpu->kvm->srcu);
> -			r = kvmppc_handle_pagefault(run, vcpu, kvmppc_get_pc(vcpu), exit_nr);
> +			r = kvmppc_handle_pagefault(vcpu, kvmppc_get_pc(vcpu), exit_nr);
>  			srcu_read_unlock(&vcpu->kvm->srcu, idx);
>  			vcpu->stat.sp_instruc++;
>  		} else if (vcpu->arch.mmu.is_dcbz32(vcpu) &&
> @@ -1248,7 +1247,7 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		 */
>  		if (fault_dsisr & (DSISR_NOHPTE | DSISR_PROTFAULT)) {
>  			int idx = srcu_read_lock(&vcpu->kvm->srcu);
> -			r = kvmppc_handle_pagefault(run, vcpu, dar, exit_nr);
> +			r = kvmppc_handle_pagefault(vcpu, dar, exit_nr);
>  			srcu_read_unlock(&vcpu->kvm->srcu, idx);
>  		} else {
>  			kvmppc_core_queue_data_storage(vcpu, dar, fault_dsisr);
> @@ -1292,7 +1291,7 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		break;
>  	case BOOK3S_INTERRUPT_PROGRAM:
>  	case BOOK3S_INTERRUPT_H_EMUL_ASSIST:
> -		r = kvmppc_exit_pr_progint(run, vcpu, exit_nr);
> +		r = kvmppc_exit_pr_progint(vcpu, exit_nr);
>  		break;
>  	case BOOK3S_INTERRUPT_SYSCALL:
>  	{
> @@ -1370,7 +1369,7 @@ int kvmppc_handle_exit_pr(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  			emul = kvmppc_get_last_inst(vcpu, INST_GENERIC,
>  						    &last_inst);
>  			if (emul == EMULATE_DONE)
> -				r = kvmppc_exit_pr_progint(run, vcpu, exit_nr);
> +				r = kvmppc_exit_pr_progint(vcpu, exit_nr);
>  			else
>  				r = RESUME_GUEST;
>  
> @@ -1825,8 +1824,9 @@ static void kvmppc_core_vcpu_free_pr(struct kvm_vcpu *vcpu)
>  	vfree(vcpu_book3s);
>  }
>  
> -static int kvmppc_vcpu_run_pr(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
> +static int kvmppc_vcpu_run_pr(struct kvm_vcpu *vcpu)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	int ret;
>  #ifdef CONFIG_ALTIVEC
>  	unsigned long uninitialized_var(vrsave);
> @@ -1834,7 +1834,7 @@ static int kvmppc_vcpu_run_pr(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  
>  	/* Check if we can run the vcpu at all */
>  	if (!vcpu->arch.sane) {
> -		kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
> +		run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
>  		ret = -EINVAL;
>  		goto out;
>  	}
> @@ -1861,7 +1861,7 @@ static int kvmppc_vcpu_run_pr(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  
>  	kvmppc_fix_ee_before_entry();
>  
> -	ret = __kvmppc_vcpu_run(kvm_run, vcpu);
> +	ret = __kvmppc_vcpu_run(run, vcpu);
>  
>  	kvmppc_clear_debug(vcpu);
>  
> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
> index 6c18ea88fd25..26b3f5900b72 100644
> --- a/arch/powerpc/kvm/booke.c
> +++ b/arch/powerpc/kvm/booke.c
> @@ -730,13 +730,14 @@ int kvmppc_core_check_requests(struct kvm_vcpu *vcpu)
>  	return r;
>  }
>  
> -int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
> +int kvmppc_vcpu_run(struct kvm_vcpu *vcpu)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	int ret, s;
>  	struct debug_reg debug;
>  
>  	if (!vcpu->arch.sane) {
> -		kvm_run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
> +		run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
>  		return -EINVAL;
>  	}
>  
> @@ -778,7 +779,7 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  	vcpu->arch.pgdir = vcpu->kvm->mm->pgd;
>  	kvmppc_fix_ee_before_entry();
>  
> -	ret = __kvmppc_vcpu_run(kvm_run, vcpu);
> +	ret = __kvmppc_vcpu_run(run, vcpu);
>  
>  	/* No need for guest_exit. It's done in handle_exit.
>  	   We also get here with interrupts enabled. */
> @@ -800,11 +801,11 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  	return ret;
>  }
>  
> -static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
> +static int emulation_exit(struct kvm_vcpu *vcpu)
>  {
>  	enum emulation_result er;
>  
> -	er = kvmppc_emulate_instruction(run, vcpu);
> +	er = kvmppc_emulate_instruction(vcpu);
>  	switch (er) {
>  	case EMULATE_DONE:
>  		/* don't overwrite subtypes, just account kvm_stats */
> @@ -821,8 +822,8 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  		       __func__, vcpu->arch.regs.nip, vcpu->arch.last_inst);
>  		/* For debugging, encode the failing instruction and
>  		 * report it to userspace. */
> -		run->hw.hardware_exit_reason = ~0ULL << 32;
> -		run->hw.hardware_exit_reason |= vcpu->arch.last_inst;
> +		vcpu->run->hw.hardware_exit_reason = ~0ULL << 32;
> +		vcpu->run->hw.hardware_exit_reason |= vcpu->arch.last_inst;
>  		kvmppc_core_queue_program(vcpu, ESR_PIL);
>  		return RESUME_HOST;
>  
> @@ -834,8 +835,9 @@ static int emulation_exit(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	}
>  }
>  
> -static int kvmppc_handle_debug(struct kvm_run *run, struct kvm_vcpu *vcpu)
> +static int kvmppc_handle_debug(struct kvm_vcpu *vcpu)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	struct debug_reg *dbg_reg = &(vcpu->arch.dbg_reg);
>  	u32 dbsr = vcpu->arch.dbsr;
>  
> @@ -954,7 +956,7 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu,
>  	}
>  }
>  
> -static int kvmppc_resume_inst_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int kvmppc_resume_inst_load(struct kvm_vcpu *vcpu,
>  				  enum emulation_result emulated, u32 last_inst)
>  {
>  	switch (emulated) {
> @@ -966,8 +968,8 @@ static int kvmppc_resume_inst_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		       __func__, vcpu->arch.regs.nip);
>  		/* For debugging, encode the failing instruction and
>  		 * report it to userspace. */
> -		run->hw.hardware_exit_reason = ~0ULL << 32;
> -		run->hw.hardware_exit_reason |= last_inst;
> +		vcpu->run->hw.hardware_exit_reason = ~0ULL << 32;
> +		vcpu->run->hw.hardware_exit_reason |= last_inst;
>  		kvmppc_core_queue_program(vcpu, ESR_PIL);
>  		return RESUME_HOST;
>  
> @@ -1024,7 +1026,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	run->ready_for_interrupt_injection = 1;
>  
>  	if (emulated != EMULATE_DONE) {
> -		r = kvmppc_resume_inst_load(run, vcpu, emulated, last_inst);
> +		r = kvmppc_resume_inst_load(vcpu, emulated, last_inst);
>  		goto out;
>  	}
>  
> @@ -1084,7 +1086,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		break;
>  
>  	case BOOKE_INTERRUPT_HV_PRIV:
> -		r = emulation_exit(run, vcpu);
> +		r = emulation_exit(vcpu);
>  		break;
>  
>  	case BOOKE_INTERRUPT_PROGRAM:
> @@ -1094,7 +1096,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  			 * We are here because of an SW breakpoint instr,
>  			 * so lets return to host to handle.
>  			 */
> -			r = kvmppc_handle_debug(run, vcpu);
> +			r = kvmppc_handle_debug(vcpu);
>  			run->exit_reason = KVM_EXIT_DEBUG;
>  			kvmppc_account_exit(vcpu, DEBUG_EXITS);
>  			break;
> @@ -1115,7 +1117,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  			break;
>  		}
>  
> -		r = emulation_exit(run, vcpu);
> +		r = emulation_exit(vcpu);
>  		break;
>  
>  	case BOOKE_INTERRUPT_FP_UNAVAIL:
> @@ -1282,7 +1284,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  			 * actually RAM. */
>  			vcpu->arch.paddr_accessed = gpaddr;
>  			vcpu->arch.vaddr_accessed = eaddr;
> -			r = kvmppc_emulate_mmio(run, vcpu);
> +			r = kvmppc_emulate_mmio(vcpu);
>  			kvmppc_account_exit(vcpu, MMIO_EXITS);
>  		}
>  
> @@ -1333,7 +1335,7 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	}
>  
>  	case BOOKE_INTERRUPT_DEBUG: {
> -		r = kvmppc_handle_debug(run, vcpu);
> +		r = kvmppc_handle_debug(vcpu);
>  		if (r == RESUME_HOST)
>  			run->exit_reason = KVM_EXIT_DEBUG;
>  		kvmppc_account_exit(vcpu, DEBUG_EXITS);
> diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h
> index 65b4d337d337..be9da96d9f06 100644
> --- a/arch/powerpc/kvm/booke.h
> +++ b/arch/powerpc/kvm/booke.h
> @@ -70,7 +70,7 @@ void kvmppc_set_tcr(struct kvm_vcpu *vcpu, u32 new_tcr);
>  void kvmppc_set_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);
>  void kvmppc_clr_tsr_bits(struct kvm_vcpu *vcpu, u32 tsr_bits);
>  
> -int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_booke_emulate_op(struct kvm_vcpu *vcpu,
>                              unsigned int inst, int *advance);
>  int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_val);
>  int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val);
> @@ -94,16 +94,12 @@ enum int_class {
>  
>  void kvmppc_set_pending_interrupt(struct kvm_vcpu *vcpu, enum int_class type);
>  
> -extern int kvmppc_core_emulate_op_e500(struct kvm_run *run,
> -				       struct kvm_vcpu *vcpu,
> +extern int kvmppc_core_emulate_op_e500(struct kvm_vcpu *vcpu,
>  				       unsigned int inst, int *advance);
>  extern int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn,
>  					  ulong spr_val);
>  extern int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn,
>  					  ulong *spr_val);
> -extern int kvmppc_core_emulate_op_e500(struct kvm_run *run,
> -				       struct kvm_vcpu *vcpu,
> -				       unsigned int inst, int *advance);
>  extern int kvmppc_core_emulate_mtspr_e500(struct kvm_vcpu *vcpu, int sprn,
>  					  ulong spr_val);
>  extern int kvmppc_core_emulate_mfspr_e500(struct kvm_vcpu *vcpu, int sprn,
> diff --git a/arch/powerpc/kvm/booke_emulate.c b/arch/powerpc/kvm/booke_emulate.c
> index 689ff5f90e9e..d8d38aca71bd 100644
> --- a/arch/powerpc/kvm/booke_emulate.c
> +++ b/arch/powerpc/kvm/booke_emulate.c
> @@ -39,7 +39,7 @@ static void kvmppc_emul_rfci(struct kvm_vcpu *vcpu)
>  	kvmppc_set_msr(vcpu, vcpu->arch.csrr1);
>  }
>  
> -int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_booke_emulate_op(struct kvm_vcpu *vcpu,
>                              unsigned int inst, int *advance)
>  {
>  	int emulated = EMULATE_DONE;
> diff --git a/arch/powerpc/kvm/e500_emulate.c b/arch/powerpc/kvm/e500_emulate.c
> index 3d0d3ec5be96..64eb833e9f02 100644
> --- a/arch/powerpc/kvm/e500_emulate.c
> +++ b/arch/powerpc/kvm/e500_emulate.c
> @@ -83,16 +83,16 @@ static int kvmppc_e500_emul_msgsnd(struct kvm_vcpu *vcpu, int rb)
>  }
>  #endif
>  
> -static int kvmppc_e500_emul_ehpriv(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int kvmppc_e500_emul_ehpriv(struct kvm_vcpu *vcpu,
>  				   unsigned int inst, int *advance)
>  {
>  	int emulated = EMULATE_DONE;
>  
>  	switch (get_oc(inst)) {
>  	case EHPRIV_OC_DEBUG:
> -		run->exit_reason = KVM_EXIT_DEBUG;
> -		run->debug.arch.address = vcpu->arch.regs.nip;
> -		run->debug.arch.status = 0;
> +		vcpu->run->exit_reason = KVM_EXIT_DEBUG;
> +		vcpu->run->debug.arch.address = vcpu->arch.regs.nip;
> +		vcpu->run->debug.arch.status = 0;
>  		kvmppc_account_exit(vcpu, DEBUG_EXITS);
>  		emulated = EMULATE_EXIT_USER;
>  		*advance = 0;
> @@ -125,7 +125,7 @@ static int kvmppc_e500_emul_mftmr(struct kvm_vcpu *vcpu, unsigned int inst,
>  	return EMULATE_FAIL;
>  }
>  
> -int kvmppc_core_emulate_op_e500(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_core_emulate_op_e500(struct kvm_vcpu *vcpu,
>  				unsigned int inst, int *advance)
>  {
>  	int emulated = EMULATE_DONE;
> @@ -182,8 +182,7 @@ int kvmppc_core_emulate_op_e500(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  			break;
>  
>  		case XOP_EHPRIV:
> -			emulated = kvmppc_e500_emul_ehpriv(run, vcpu, inst,
> -							   advance);
> +			emulated = kvmppc_e500_emul_ehpriv(vcpu, inst, advance);
>  			break;
>  
>  		default:
> @@ -197,7 +196,7 @@ int kvmppc_core_emulate_op_e500(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	}
>  
>  	if (emulated == EMULATE_FAIL)
> -		emulated = kvmppc_booke_emulate_op(run, vcpu, inst, advance);
> +		emulated = kvmppc_booke_emulate_op(vcpu, inst, advance);
>  
>  	return emulated;
>  }
> diff --git a/arch/powerpc/kvm/emulate.c b/arch/powerpc/kvm/emulate.c
> index 6fca38ca791f..ee1147c98cd8 100644
> --- a/arch/powerpc/kvm/emulate.c
> +++ b/arch/powerpc/kvm/emulate.c
> @@ -191,7 +191,7 @@ static int kvmppc_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt)
>  
>  /* XXX Should probably auto-generate instruction decoding for a particular core
>   * from opcode tables in the future. */
> -int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
> +int kvmppc_emulate_instruction(struct kvm_vcpu *vcpu)
>  {
>  	u32 inst;
>  	int rs, rt, sprn;
> @@ -270,9 +270,9 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  		 * these are illegal instructions.
>  		 */
>  		if (inst == KVMPPC_INST_SW_BREAKPOINT) {
> -			run->exit_reason = KVM_EXIT_DEBUG;
> -			run->debug.arch.status = 0;
> -			run->debug.arch.address = kvmppc_get_pc(vcpu);
> +			vcpu->run->exit_reason = KVM_EXIT_DEBUG;
> +			vcpu->run->debug.arch.status = 0;
> +			vcpu->run->debug.arch.address = kvmppc_get_pc(vcpu);
>  			emulated = EMULATE_EXIT_USER;
>  			advance = 0;
>  		} else
> @@ -285,7 +285,7 @@ int kvmppc_emulate_instruction(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  	}
>  
>  	if (emulated == EMULATE_FAIL) {
> -		emulated = vcpu->kvm->arch.kvm_ops->emulate_op(run, vcpu, inst,
> +		emulated = vcpu->kvm->arch.kvm_ops->emulate_op(vcpu, inst,
>  							       &advance);
>  		if (emulated == EMULATE_AGAIN) {
>  			advance = 0;
> diff --git a/arch/powerpc/kvm/emulate_loadstore.c b/arch/powerpc/kvm/emulate_loadstore.c
> index 1139bc56e004..e8a47c84d77d 100644
> --- a/arch/powerpc/kvm/emulate_loadstore.c
> +++ b/arch/powerpc/kvm/emulate_loadstore.c
> @@ -71,7 +71,6 @@ static bool kvmppc_check_altivec_disabled(struct kvm_vcpu *vcpu)
>   */
>  int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
>  {
> -	struct kvm_run *run = vcpu->run;
>  	u32 inst;
>  	enum emulation_result emulated = EMULATE_FAIL;
>  	int advance = 1;
> @@ -104,10 +103,10 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
>  			int instr_byte_swap = op.type & BYTEREV;
>  
>  			if (op.type & SIGNEXT)
> -				emulated = kvmppc_handle_loads(run, vcpu,
> +				emulated = kvmppc_handle_loads(vcpu,
>  						op.reg, size, !instr_byte_swap);
>  			else
> -				emulated = kvmppc_handle_load(run, vcpu,
> +				emulated = kvmppc_handle_load(vcpu,
>  						op.reg, size, !instr_byte_swap);
>  
>  			if ((op.type & UPDATE) && (emulated != EMULATE_FAIL))
> @@ -124,10 +123,10 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
>  				vcpu->arch.mmio_sp64_extend = 1;
>  
>  			if (op.type & SIGNEXT)
> -				emulated = kvmppc_handle_loads(run, vcpu,
> +				emulated = kvmppc_handle_loads(vcpu,
>  					     KVM_MMIO_REG_FPR|op.reg, size, 1);
>  			else
> -				emulated = kvmppc_handle_load(run, vcpu,
> +				emulated = kvmppc_handle_load(vcpu,
>  					     KVM_MMIO_REG_FPR|op.reg, size, 1);
>  
>  			if ((op.type & UPDATE) && (emulated != EMULATE_FAIL))
> @@ -164,12 +163,12 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
>  
>  			if (size == 16) {
>  				vcpu->arch.mmio_vmx_copy_nums = 2;
> -				emulated = kvmppc_handle_vmx_load(run,
> -						vcpu, KVM_MMIO_REG_VMX|op.reg,
> +				emulated = kvmppc_handle_vmx_load(vcpu,
> +						KVM_MMIO_REG_VMX|op.reg,
>  						8, 1);
>  			} else {
>  				vcpu->arch.mmio_vmx_copy_nums = 1;
> -				emulated = kvmppc_handle_vmx_load(run, vcpu,
> +				emulated = kvmppc_handle_vmx_load(vcpu,
>  						KVM_MMIO_REG_VMX|op.reg,
>  						size, 1);
>  			}
> @@ -217,7 +216,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
>  				io_size_each = op.element_size;
>  			}
>  
> -			emulated = kvmppc_handle_vsx_load(run, vcpu,
> +			emulated = kvmppc_handle_vsx_load(vcpu,
>  					KVM_MMIO_REG_VSX|op.reg, io_size_each,
>  					1, op.type & SIGNEXT);
>  			break;
> @@ -227,8 +226,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
>  			/* if need byte reverse, op.val has been reversed by
>  			 * analyse_instr().
>  			 */
> -			emulated = kvmppc_handle_store(run, vcpu, op.val,
> -					size, 1);
> +			emulated = kvmppc_handle_store(vcpu, op.val, size, 1);
>  
>  			if ((op.type & UPDATE) && (emulated != EMULATE_FAIL))
>  				kvmppc_set_gpr(vcpu, op.update_reg, op.ea);
> @@ -250,7 +248,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
>  			if (op.type & FPCONV)
>  				vcpu->arch.mmio_sp64_extend = 1;
>  
> -			emulated = kvmppc_handle_store(run, vcpu,
> +			emulated = kvmppc_handle_store(vcpu,
>  					VCPU_FPR(vcpu, op.reg), size, 1);
>  
>  			if ((op.type & UPDATE) && (emulated != EMULATE_FAIL))
> @@ -290,12 +288,12 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
>  
>  			if (size == 16) {
>  				vcpu->arch.mmio_vmx_copy_nums = 2;
> -				emulated = kvmppc_handle_vmx_store(run,
> -						vcpu, op.reg, 8, 1);
> +				emulated = kvmppc_handle_vmx_store(vcpu,
> +						op.reg, 8, 1);
>  			} else {
>  				vcpu->arch.mmio_vmx_copy_nums = 1;
> -				emulated = kvmppc_handle_vmx_store(run,
> -						vcpu, op.reg, size, 1);
> +				emulated = kvmppc_handle_vmx_store(vcpu,
> +						op.reg, size, 1);
>  			}
>  
>  			break;
> @@ -338,7 +336,7 @@ int kvmppc_emulate_loadstore(struct kvm_vcpu *vcpu)
>  				io_size_each = op.element_size;
>  			}
>  
> -			emulated = kvmppc_handle_vsx_store(run, vcpu,
> +			emulated = kvmppc_handle_vsx_store(vcpu,
>  					op.reg, io_size_each, 1);
>  			break;
>  		}
> diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
> index 7e24691e138a..de4c317ad5f1 100644
> --- a/arch/powerpc/kvm/powerpc.c
> +++ b/arch/powerpc/kvm/powerpc.c
> @@ -279,7 +279,7 @@ int kvmppc_sanity_check(struct kvm_vcpu *vcpu)
>  }
>  EXPORT_SYMBOL_GPL(kvmppc_sanity_check);
>  
> -int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
> +int kvmppc_emulate_mmio(struct kvm_vcpu *vcpu)
>  {
>  	enum emulation_result er;
>  	int r;
> @@ -295,7 +295,7 @@ int kvmppc_emulate_mmio(struct kvm_run *run, struct kvm_vcpu *vcpu)
>  		r = RESUME_GUEST;
>  		break;
>  	case EMULATE_DO_MMIO:
> -		run->exit_reason = KVM_EXIT_MMIO;
> +		vcpu->run->exit_reason = KVM_EXIT_MMIO;
>  		/* We must reload nonvolatiles because "update" load/store
>  		 * instructions modify register state. */
>  		/* Future optimization: only reload non-volatiles if they were
> @@ -1106,9 +1106,9 @@ static inline u32 dp_to_sp(u64 fprd)
>  #define dp_to_sp(x)	(x)
>  #endif /* CONFIG_PPC_FPU */
>  
> -static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
> -                                      struct kvm_run *run)
> +static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	u64 uninitialized_var(gpr);
>  
>  	if (run->mmio.len > sizeof(gpr)) {
> @@ -1218,10 +1218,11 @@ static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
>  	}
>  }
>  
> -static int __kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +static int __kvmppc_handle_load(struct kvm_vcpu *vcpu,
>  				unsigned int rt, unsigned int bytes,
>  				int is_default_endian, int sign_extend)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	int idx, ret;
>  	bool host_swabbed;
>  
> @@ -1255,7 +1256,7 @@ static int __kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	srcu_read_unlock(&vcpu->kvm->srcu, idx);
>  
>  	if (!ret) {
> -		kvmppc_complete_mmio_load(vcpu, run);
> +		kvmppc_complete_mmio_load(vcpu);
>  		vcpu->mmio_needed = 0;
>  		return EMULATE_DONE;
>  	}
> @@ -1263,24 +1264,24 @@ static int __kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	return EMULATE_DO_MMIO;
>  }
>  
> -int kvmppc_handle_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_handle_load(struct kvm_vcpu *vcpu,
>  		       unsigned int rt, unsigned int bytes,
>  		       int is_default_endian)
>  {
> -	return __kvmppc_handle_load(run, vcpu, rt, bytes, is_default_endian, 0);
> +	return __kvmppc_handle_load(vcpu, rt, bytes, is_default_endian, 0);
>  }
>  EXPORT_SYMBOL_GPL(kvmppc_handle_load);
>  
>  /* Same as above, but sign extends */
> -int kvmppc_handle_loads(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_handle_loads(struct kvm_vcpu *vcpu,
>  			unsigned int rt, unsigned int bytes,
>  			int is_default_endian)
>  {
> -	return __kvmppc_handle_load(run, vcpu, rt, bytes, is_default_endian, 1);
> +	return __kvmppc_handle_load(vcpu, rt, bytes, is_default_endian, 1);
>  }
>  
>  #ifdef CONFIG_VSX
> -int kvmppc_handle_vsx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_handle_vsx_load(struct kvm_vcpu *vcpu,
>  			unsigned int rt, unsigned int bytes,
>  			int is_default_endian, int mmio_sign_extend)
>  {
> @@ -1291,13 +1292,13 @@ int kvmppc_handle_vsx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		return EMULATE_FAIL;
>  
>  	while (vcpu->arch.mmio_vsx_copy_nums) {
> -		emulated = __kvmppc_handle_load(run, vcpu, rt, bytes,
> +		emulated = __kvmppc_handle_load(vcpu, rt, bytes,
>  			is_default_endian, mmio_sign_extend);
>  
>  		if (emulated != EMULATE_DONE)
>  			break;
>  
> -		vcpu->arch.paddr_accessed += run->mmio.len;
> +		vcpu->arch.paddr_accessed += vcpu->run->mmio.len;
>  
>  		vcpu->arch.mmio_vsx_copy_nums--;
>  		vcpu->arch.mmio_vsx_offset++;
> @@ -1306,9 +1307,10 @@ int kvmppc_handle_vsx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  }
>  #endif /* CONFIG_VSX */
>  
> -int kvmppc_handle_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_handle_store(struct kvm_vcpu *vcpu,
>  			u64 val, unsigned int bytes, int is_default_endian)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	void *data = run->mmio.data;
>  	int idx, ret;
>  	bool host_swabbed;
> @@ -1422,7 +1424,7 @@ static inline int kvmppc_get_vsr_data(struct kvm_vcpu *vcpu, int rs, u64 *val)
>  	return result;
>  }
>  
> -int kvmppc_handle_vsx_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_handle_vsx_store(struct kvm_vcpu *vcpu,
>  			int rs, unsigned int bytes, int is_default_endian)
>  {
>  	u64 val;
> @@ -1438,13 +1440,13 @@ int kvmppc_handle_vsx_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		if (kvmppc_get_vsr_data(vcpu, rs, &val) == -1)
>  			return EMULATE_FAIL;
>  
> -		emulated = kvmppc_handle_store(run, vcpu,
> +		emulated = kvmppc_handle_store(vcpu,
>  			 val, bytes, is_default_endian);
>  
>  		if (emulated != EMULATE_DONE)
>  			break;
>  
> -		vcpu->arch.paddr_accessed += run->mmio.len;
> +		vcpu->arch.paddr_accessed += vcpu->run->mmio.len;
>  
>  		vcpu->arch.mmio_vsx_copy_nums--;
>  		vcpu->arch.mmio_vsx_offset++;
> @@ -1453,19 +1455,19 @@ int kvmppc_handle_vsx_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	return emulated;
>  }
>  
> -static int kvmppc_emulate_mmio_vsx_loadstore(struct kvm_vcpu *vcpu,
> -			struct kvm_run *run)
> +static int kvmppc_emulate_mmio_vsx_loadstore(struct kvm_vcpu *vcpu)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	enum emulation_result emulated = EMULATE_FAIL;
>  	int r;
>  
>  	vcpu->arch.paddr_accessed += run->mmio.len;
>  
>  	if (!vcpu->mmio_is_write) {
> -		emulated = kvmppc_handle_vsx_load(run, vcpu, vcpu->arch.io_gpr,
> +		emulated = kvmppc_handle_vsx_load(vcpu, vcpu->arch.io_gpr,
>  			 run->mmio.len, 1, vcpu->arch.mmio_sign_extend);
>  	} else {
> -		emulated = kvmppc_handle_vsx_store(run, vcpu,
> +		emulated = kvmppc_handle_vsx_store(vcpu,
>  			 vcpu->arch.io_gpr, run->mmio.len, 1);
>  	}
>  
> @@ -1489,7 +1491,7 @@ static int kvmppc_emulate_mmio_vsx_loadstore(struct kvm_vcpu *vcpu,
>  #endif /* CONFIG_VSX */
>  
>  #ifdef CONFIG_ALTIVEC
> -int kvmppc_handle_vmx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_handle_vmx_load(struct kvm_vcpu *vcpu,
>  		unsigned int rt, unsigned int bytes, int is_default_endian)
>  {
>  	enum emulation_result emulated = EMULATE_DONE;
> @@ -1498,13 +1500,13 @@ int kvmppc_handle_vmx_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  		return EMULATE_FAIL;
>  
>  	while (vcpu->arch.mmio_vmx_copy_nums) {
> -		emulated = __kvmppc_handle_load(run, vcpu, rt, bytes,
> +		emulated = __kvmppc_handle_load(vcpu, rt, bytes,
>  				is_default_endian, 0);
>  
>  		if (emulated != EMULATE_DONE)
>  			break;
>  
> -		vcpu->arch.paddr_accessed += run->mmio.len;
> +		vcpu->arch.paddr_accessed += vcpu->run->mmio.len;
>  		vcpu->arch.mmio_vmx_copy_nums--;
>  		vcpu->arch.mmio_vmx_offset++;
>  	}
> @@ -1584,7 +1586,7 @@ int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val)
>  	return result;
>  }
>  
> -int kvmppc_handle_vmx_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
> +int kvmppc_handle_vmx_store(struct kvm_vcpu *vcpu,
>  		unsigned int rs, unsigned int bytes, int is_default_endian)
>  {
>  	u64 val = 0;
> @@ -1619,12 +1621,12 @@ int kvmppc_handle_vmx_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  			return EMULATE_FAIL;
>  		}
>  
> -		emulated = kvmppc_handle_store(run, vcpu, val, bytes,
> +		emulated = kvmppc_handle_store(vcpu, val, bytes,
>  				is_default_endian);
>  		if (emulated != EMULATE_DONE)
>  			break;
>  
> -		vcpu->arch.paddr_accessed += run->mmio.len;
> +		vcpu->arch.paddr_accessed += vcpu->run->mmio.len;
>  		vcpu->arch.mmio_vmx_copy_nums--;
>  		vcpu->arch.mmio_vmx_offset++;
>  	}
> @@ -1632,19 +1634,19 @@ int kvmppc_handle_vmx_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
>  	return emulated;
>  }
>  
> -static int kvmppc_emulate_mmio_vmx_loadstore(struct kvm_vcpu *vcpu,
> -		struct kvm_run *run)
> +static int kvmppc_emulate_mmio_vmx_loadstore(struct kvm_vcpu *vcpu)
>  {
> +	struct kvm_run *run = vcpu->run;
>  	enum emulation_result emulated = EMULATE_FAIL;
>  	int r;
>  
>  	vcpu->arch.paddr_accessed += run->mmio.len;
>  
>  	if (!vcpu->mmio_is_write) {
> -		emulated = kvmppc_handle_vmx_load(run, vcpu,
> +		emulated = kvmppc_handle_vmx_load(vcpu,
>  				vcpu->arch.io_gpr, run->mmio.len, 1);
>  	} else {
> -		emulated = kvmppc_handle_vmx_store(run, vcpu,
> +		emulated = kvmppc_handle_vmx_store(vcpu,
>  				vcpu->arch.io_gpr, run->mmio.len, 1);
>  	}
>  
> @@ -1774,7 +1776,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
>  	if (vcpu->mmio_needed) {
>  		vcpu->mmio_needed = 0;
>  		if (!vcpu->mmio_is_write)
> -			kvmppc_complete_mmio_load(vcpu, run);
> +			kvmppc_complete_mmio_load(vcpu);
>  #ifdef CONFIG_VSX
>  		if (vcpu->arch.mmio_vsx_copy_nums > 0) {
>  			vcpu->arch.mmio_vsx_copy_nums--;
> @@ -1782,7 +1784,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
>  		}
>  
>  		if (vcpu->arch.mmio_vsx_copy_nums > 0) {
> -			r = kvmppc_emulate_mmio_vsx_loadstore(vcpu, run);
> +			r = kvmppc_emulate_mmio_vsx_loadstore(vcpu);
>  			if (r == RESUME_HOST) {
>  				vcpu->mmio_needed = 1;
>  				goto out;
> @@ -1796,7 +1798,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
>  		}
>  
>  		if (vcpu->arch.mmio_vmx_copy_nums > 0) {
> -			r = kvmppc_emulate_mmio_vmx_loadstore(vcpu, run);
> +			r = kvmppc_emulate_mmio_vmx_loadstore(vcpu);
>  			if (r == RESUME_HOST) {
>  				vcpu->mmio_needed = 1;
>  				goto out;
> @@ -1829,7 +1831,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu)
>  	if (run->immediate_exit)
>  		r = -EINTR;
>  	else
> -		r = kvmppc_vcpu_run(run, vcpu);
> +		r = kvmppc_vcpu_run(vcpu);
>  
>  	kvm_sigset_deactivate(vcpu);
>  
> diff --git a/arch/powerpc/kvm/trace_hv.h b/arch/powerpc/kvm/trace_hv.h
> index 8a1e3b0047f1..4a61a971c34e 100644
> --- a/arch/powerpc/kvm/trace_hv.h
> +++ b/arch/powerpc/kvm/trace_hv.h
> @@ -472,9 +472,9 @@ TRACE_EVENT(kvmppc_run_vcpu_enter,
>  );
>  
>  TRACE_EVENT(kvmppc_run_vcpu_exit,
> -	TP_PROTO(struct kvm_vcpu *vcpu, struct kvm_run *run),
> +	TP_PROTO(struct kvm_vcpu *vcpu),
>  
> -	TP_ARGS(vcpu, run),
> +	TP_ARGS(vcpu),
>  
>  	TP_STRUCT__entry(
>  		__field(int,		vcpu_id)
> @@ -484,7 +484,7 @@ TRACE_EVENT(kvmppc_run_vcpu_exit,
>  
>  	TP_fast_assign(
>  		__entry->vcpu_id  = vcpu->vcpu_id;
> -		__entry->exit     = run->exit_reason;
> +		__entry->exit     = vcpu->run->exit_reason;
>  		__entry->ret      = vcpu->arch.ret;
>  	),

'git grep kvm_run arch/powerpc/kvm/' tells me the result is correct so
in case this even compiles, feel free to add

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

-- 
Vitaly


^ permalink raw reply

* Re: [PATCH v4 3/7] KVM: PPC: Remove redundant kvm_run from vcpu_arch
From: Vitaly Kuznetsov @ 2020-04-29 12:23 UTC (permalink / raw)
  To: Tianjia Zhang
  Cc: christoffer.dall, wanpengli, kvm, david, heiko.carstens, peterx,
	linux-kernel, hpa, kvmarm, linux-s390, frankja, chenhuacai, joro,
	x86, borntraeger, mingo, julien.thierry.kdev, thuth, gor,
	suzuki.poulose, kvm-ppc, bp, tglx, linux-arm-kernel, jmattson,
	tsbogend, tianjia.zhang, cohuck, linux-mips,
	sean.j.christopherson, james.morse, maz, pbonzini, linuxppc-dev
In-Reply-To: <20200427043514.16144-4-tianjia.zhang@linux.alibaba.com>

Tianjia Zhang <tianjia.zhang@linux.alibaba.com> writes:

> The 'kvm_run' field already exists in the 'vcpu' structure, which
> is the same structure as the 'kvm_run' in the 'vcpu_arch' and
> should be deleted.
>
> Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
> ---
>  arch/powerpc/include/asm/kvm_host.h | 1 -
>  arch/powerpc/kvm/book3s_hv.c        | 6 ++----
>  arch/powerpc/kvm/book3s_hv_nested.c | 3 +--
>  3 files changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
> index 1dc63101ffe1..2745ff8faa01 100644
> --- a/arch/powerpc/include/asm/kvm_host.h
> +++ b/arch/powerpc/include/asm/kvm_host.h
> @@ -795,7 +795,6 @@ struct kvm_vcpu_arch {
>  	struct mmio_hpte_cache_entry *pgfault_cache;
>  
>  	struct task_struct *run_task;
> -	struct kvm_run *kvm_run;
>  
>  	spinlock_t vpa_update_lock;
>  	struct kvmppc_vpa vpa;
> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
> index 93493f0cbfe8..413ea2dcb10c 100644
> --- a/arch/powerpc/kvm/book3s_hv.c
> +++ b/arch/powerpc/kvm/book3s_hv.c
> @@ -2934,7 +2934,7 @@ static void post_guest_process(struct kvmppc_vcore *vc, bool is_master)
>  
>  		ret = RESUME_GUEST;
>  		if (vcpu->arch.trap)
> -			ret = kvmppc_handle_exit_hv(vcpu->arch.kvm_run, vcpu,
> +			ret = kvmppc_handle_exit_hv(vcpu->run, vcpu,
>  						    vcpu->arch.run_task);
>  
>  		vcpu->arch.ret = ret;
> @@ -3920,7 +3920,6 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  	spin_lock(&vc->lock);
>  	vcpu->arch.ceded = 0;
>  	vcpu->arch.run_task = current;
> -	vcpu->arch.kvm_run = kvm_run;
>  	vcpu->arch.stolen_logged = vcore_stolen_time(vc, mftb());
>  	vcpu->arch.state = KVMPPC_VCPU_RUNNABLE;
>  	vcpu->arch.busy_preempt = TB_NIL;
> @@ -3973,7 +3972,7 @@ static int kvmppc_run_vcpu(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
>  			if (signal_pending(v->arch.run_task)) {
>  				kvmppc_remove_runnable(vc, v);
>  				v->stat.signal_exits++;
> -				v->arch.kvm_run->exit_reason = KVM_EXIT_INTR;
> +				v->run->exit_reason = KVM_EXIT_INTR;
>  				v->arch.ret = -EINTR;
>  				wake_up(&v->arch.cpu_run);
>  			}
> @@ -4049,7 +4048,6 @@ int kvmhv_run_single_vcpu(struct kvm_run *kvm_run,
>  	vc = vcpu->arch.vcore;
>  	vcpu->arch.ceded = 0;
>  	vcpu->arch.run_task = current;
> -	vcpu->arch.kvm_run = kvm_run;
>  	vcpu->arch.stolen_logged = vcore_stolen_time(vc, mftb());
>  	vcpu->arch.state = KVMPPC_VCPU_RUNNABLE;
>  	vcpu->arch.busy_preempt = TB_NIL;
> diff --git a/arch/powerpc/kvm/book3s_hv_nested.c b/arch/powerpc/kvm/book3s_hv_nested.c
> index dc97e5be76f6..5a3987f3ebf3 100644
> --- a/arch/powerpc/kvm/book3s_hv_nested.c
> +++ b/arch/powerpc/kvm/book3s_hv_nested.c
> @@ -290,8 +290,7 @@ long kvmhv_enter_nested_guest(struct kvm_vcpu *vcpu)
>  			r = RESUME_HOST;
>  			break;
>  		}
> -		r = kvmhv_run_single_vcpu(vcpu->arch.kvm_run, vcpu, hdec_exp,
> -					  lpcr);
> +		r = kvmhv_run_single_vcpu(vcpu->run, vcpu, hdec_exp, lpcr);
>  	} while (is_kvmppc_resume_guest(r));
>  
>  	/* save L2 state for return */

FWIW,

Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>

-- 
Vitaly


^ permalink raw reply

* Re: [PATCH v2 3/3] mm/page_alloc: Keep memoryless cpuless node 0 offline
From: Michal Hocko @ 2020-04-29 12:22 UTC (permalink / raw)
  To: Srikar Dronamraju
  Cc: Linus Torvalds, linux-kernel, linux-mm, Mel Gorman,
	Kirill A. Shutemov, Andrew Morton, linuxppc-dev,
	Christopher Lameter, Vlastimil Babka
In-Reply-To: <20200429014145.GD19958@linux.vnet.ibm.com>

On Wed 29-04-20 07:11:45, Srikar Dronamraju wrote:
> > > 
> > > By marking, N_ONLINE as NODE_MASK_NONE, lets stop assuming that Node 0 is
> > > always online.
> > > 
> > > ...
> > >
> > > --- a/mm/page_alloc.c
> > > +++ b/mm/page_alloc.c
> > > @@ -116,8 +116,10 @@ EXPORT_SYMBOL(latent_entropy);
> > >   */
> > >  nodemask_t node_states[NR_NODE_STATES] __read_mostly = {
> > >  	[N_POSSIBLE] = NODE_MASK_ALL,
> > > +#ifdef CONFIG_NUMA
> > > +	[N_ONLINE] = NODE_MASK_NONE,
> > > +#else
> > >  	[N_ONLINE] = { { [0] = 1UL } },
> > > -#ifndef CONFIG_NUMA
> > >  	[N_NORMAL_MEMORY] = { { [0] = 1UL } },
> > >  #ifdef CONFIG_HIGHMEM
> > >  	[N_HIGH_MEMORY] = { { [0] = 1UL } },
> > 
> > So on all other NUMA machines, when does node 0 get marked online?
> > 
> > This change means that for some time during boot, such machines will
> > now be running with node 0 marked as offline.  What are the
> > implications of this?  Will something break?
> 
> Till the nodes are detected, marking Node 0 as online tends to be redundant.
> Because the system doesn't know if its a NUMA or a non-NUMA system.
> Once we detect the nodes, we online them immediately. Hence I don't see any
> side-effects or negative implications of this change.
> 
> However if I am missing anything, please do let me know.
> 
> >From my part, I have tested this on
> 1. Non-NUMA Single node but CPUs and memory coming from zero node.
> 2. Non-NUMA Single node but CPUs and memory coming from non-zero node.
> 3. NUMA Multi node but with CPUs and memory from node 0.
> 4. NUMA Multi node but with no CPUs and memory from node 0.

Have you tested on something else than ppc? Each arch does the NUMA
setup separately and this is a big mess. E.g. x86 marks even memory less
nodes (see init_memory_less_node) as online.

Honestly I have hard time to evaluate the effect of this patch. It makes
some sense to assume all nodes offline before they get online but this
is a land mine territory.

I am also not sure what kind of problem this is going to address. You
have mentioned numa balancing without many details.
-- 
Michal Hocko
SUSE Labs

^ permalink raw reply

* [PATCH v2 20/20] docs/vm: update memory-models documentation
From: Mike Rapoport @ 2020-04-29 12:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Mike Rapoport, Greg Ungerer, linux-arch, linux-s390,
	linux-c6x-dev, Baoquan He, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Yoshinori Sato,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-snps-arc, uclinux-h8-devel, linux-xtensa, linux-alpha,
	linux-um, linux-m68k, Tony Luck, Qian Cai, Greentime Hu,
	Paul Walmsley, Stafford Horne, Guan Xuetao, Hoan Tran,
	Michal Simek, Thomas Bogendoerfer, Brian Cain, Nick Hu, linux-mm,
	Vineet Gupta, linux-mips, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200429121126.17989-1-rppt@kernel.org>

From: Mike Rapoport <rppt@linux.ibm.com>

to reflect the updates to free_area_init() family of functions.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 Documentation/vm/memory-model.rst | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/Documentation/vm/memory-model.rst b/Documentation/vm/memory-model.rst
index 58a12376b7df..91228044ed16 100644
--- a/Documentation/vm/memory-model.rst
+++ b/Documentation/vm/memory-model.rst
@@ -46,11 +46,10 @@ maps the entire physical memory. For most architectures, the holes
 have entries in the `mem_map` array. The `struct page` objects
 corresponding to the holes are never fully initialized.
 
-To allocate the `mem_map` array, architecture specific setup code
-should call :c:func:`free_area_init_node` function or its convenience
-wrapper :c:func:`free_area_init`. Yet, the mappings array is not
-usable until the call to :c:func:`memblock_free_all` that hands all
-the memory to the page allocator.
+To allocate the `mem_map` array, architecture specific setup code should
+call :c:func:`free_area_init` function. Yet, the mappings array is not
+usable until the call to :c:func:`memblock_free_all` that hands all the
+memory to the page allocator.
 
 If an architecture enables `CONFIG_ARCH_HAS_HOLES_MEMORYMODEL` option,
 it may free parts of the `mem_map` array that do not cover the
-- 
2.26.1


^ permalink raw reply related

* [PATCH v2 19/20] mm: simplify find_min_pfn_with_active_regions()
From: Mike Rapoport @ 2020-04-29 12:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Mike Rapoport, Greg Ungerer, linux-arch, linux-s390,
	linux-c6x-dev, Baoquan He, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Yoshinori Sato,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-snps-arc, uclinux-h8-devel, linux-xtensa, linux-alpha,
	linux-um, linux-m68k, Tony Luck, Qian Cai, Greentime Hu,
	Paul Walmsley, Stafford Horne, Guan Xuetao, Hoan Tran,
	Michal Simek, Thomas Bogendoerfer, Brian Cain, Nick Hu, linux-mm,
	Vineet Gupta, linux-mips, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200429121126.17989-1-rppt@kernel.org>

From: Mike Rapoport <rppt@linux.ibm.com>

The find_min_pfn_with_active_regions() calls find_min_pfn_for_node() with
nid parameter set to MAX_NUMNODES. This makes the find_min_pfn_for_node()
traverse all memblock memory regions although the first PFN in the system
can be easily found with memblock_start_of_DRAM().

Use memblock_start_of_DRAM() in find_min_pfn_with_active_regions() and drop
now unused find_min_pfn_for_node().

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 mm/page_alloc.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 30d171451d4c..b990e9734474 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7045,24 +7045,6 @@ unsigned long __init node_map_pfn_alignment(void)
 	return ~accl_mask + 1;
 }
 
-/* Find the lowest pfn for a node */
-static unsigned long __init find_min_pfn_for_node(int nid)
-{
-	unsigned long min_pfn = ULONG_MAX;
-	unsigned long start_pfn;
-	int i;
-
-	for_each_mem_pfn_range(i, nid, &start_pfn, NULL, NULL)
-		min_pfn = min(min_pfn, start_pfn);
-
-	if (min_pfn == ULONG_MAX) {
-		pr_warn("Could not find start_pfn for node %d\n", nid);
-		return 0;
-	}
-
-	return min_pfn;
-}
-
 /**
  * find_min_pfn_with_active_regions - Find the minimum PFN registered
  *
@@ -7071,7 +7053,7 @@ static unsigned long __init find_min_pfn_for_node(int nid)
  */
 unsigned long __init find_min_pfn_with_active_regions(void)
 {
-	return find_min_pfn_for_node(MAX_NUMNODES);
+	return PHYS_PFN(memblock_start_of_DRAM());
 }
 
 /*
-- 
2.26.1


^ permalink raw reply related

* [PATCH v2 18/20] mm: clean up free_area_init_node() and its helpers
From: Mike Rapoport @ 2020-04-29 12:11 UTC (permalink / raw)
  To: linux-kernel
  Cc: Rich Felker, linux-ia64, linux-doc, Catalin Marinas,
	Heiko Carstens, Michal Hocko, James E.J. Bottomley, Max Filippov,
	Guo Ren, linux-csky, linux-parisc, sparclinux, linux-hexagon,
	linux-riscv, Mike Rapoport, Greg Ungerer, linux-arch, linux-s390,
	linux-c6x-dev, Baoquan He, Jonathan Corbet, linux-sh,
	Helge Deller, x86, Russell King, Ley Foon Tan, Yoshinori Sato,
	Geert Uytterhoeven, linux-arm-kernel, Mark Salter, Matt Turner,
	linux-snps-arc, uclinux-h8-devel, linux-xtensa, linux-alpha,
	linux-um, linux-m68k, Tony Luck, Qian Cai, Greentime Hu,
	Paul Walmsley, Stafford Horne, Guan Xuetao, Hoan Tran,
	Michal Simek, Thomas Bogendoerfer, Brian Cain, Nick Hu, linux-mm,
	Vineet Gupta, linux-mips, openrisc, Richard Weinberger,
	Andrew Morton, linuxppc-dev, David S. Miller
In-Reply-To: <20200429121126.17989-1-rppt@kernel.org>

From: Mike Rapoport <rppt@linux.ibm.com>

The free_area_init_node() now always uses memblock info and the zone PFN
limits so it does not need the backwards compatibility functions to
calculate the zone spanned and absent pages. The removal of the compat_
versions of zone_{abscent,spanned}_pages_in_node() in turn, makes zone_size
and zhole_size parameters unused.

The node_start_pfn is determined by get_pfn_range_for_nid(), so there is no
need to pass it to free_area_init_node().

As the result, the only required parameter to free_area_init_node() is the
node ID, all the rest are removed along with no longer used
compat_zone_{abscent,spanned}_pages_in_node() helpers.

Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
 arch/x86/mm/numa.c |   2 +-
 include/linux/mm.h |   7 +--
 mm/page_alloc.c    | 110 +++++++++------------------------------------
 3 files changed, 24 insertions(+), 95 deletions(-)

diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index fe024b2ac796..0e1b99f491e4 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -742,7 +742,7 @@ static void __init init_memory_less_node(int nid)
 
 	/* Allocate and initialize node data. Memory-less node is now online.*/
 	alloc_node_data(nid);
-	free_area_init_node(nid, zones_size, 0, zholes_size);
+	free_area_init_node(nid);
 
 	/*
 	 * All zonelists will be built later in start_kernel() after per cpu
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 1c2ecb42e043..2c0d42b11f3c 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2272,8 +2272,7 @@ static inline spinlock_t *pud_lock(struct mm_struct *mm, pud_t *pud)
 }
 
 extern void __init pagecache_init(void);
-extern void __init free_area_init_node(int nid, unsigned long * zones_size,
-		unsigned long zone_start_pfn, unsigned long *zholes_size);
+extern void __init free_area_init_node(int nid);
 extern void free_initmem(void);
 
 /*
@@ -2346,9 +2345,7 @@ static inline unsigned long get_num_physpages(void)
 /*
  * Using memblock node mappings, an architecture may initialise its
  * zones, allocate the backing mem_map and account for memory holes in a more
- * architecture independent manner. This is a substitute for creating the
- * zone_sizes[] and zholes_size[] arrays and passing them to
- * free_area_init_node()
+ * architecture independent manner.
  *
  * An architecture is expected to register range of page frames backed by
  * physical memory with memblock_add[_node]() before calling
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 98a47f90065a..30d171451d4c 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -6420,8 +6420,7 @@ static unsigned long __init zone_spanned_pages_in_node(int nid,
 					unsigned long node_start_pfn,
 					unsigned long node_end_pfn,
 					unsigned long *zone_start_pfn,
-					unsigned long *zone_end_pfn,
-					unsigned long *ignored)
+					unsigned long *zone_end_pfn)
 {
 	unsigned long zone_low = arch_zone_lowest_possible_pfn[zone_type];
 	unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type];
@@ -6485,8 +6484,7 @@ unsigned long __init absent_pages_in_range(unsigned long start_pfn,
 static unsigned long __init zone_absent_pages_in_node(int nid,
 					unsigned long zone_type,
 					unsigned long node_start_pfn,
-					unsigned long node_end_pfn,
-					unsigned long *ignored)
+					unsigned long node_end_pfn)
 {
 	unsigned long zone_low = arch_zone_lowest_possible_pfn[zone_type];
 	unsigned long zone_high = arch_zone_highest_possible_pfn[zone_type];
@@ -6533,43 +6531,9 @@ static unsigned long __init zone_absent_pages_in_node(int nid,
 	return nr_absent;
 }
 
-static inline unsigned long __init compat_zone_spanned_pages_in_node(int nid,
-					unsigned long zone_type,
-					unsigned long node_start_pfn,
-					unsigned long node_end_pfn,
-					unsigned long *zone_start_pfn,
-					unsigned long *zone_end_pfn,
-					unsigned long *zones_size)
-{
-	unsigned int zone;
-
-	*zone_start_pfn = node_start_pfn;
-	for (zone = 0; zone < zone_type; zone++)
-		*zone_start_pfn += zones_size[zone];
-
-	*zone_end_pfn = *zone_start_pfn + zones_size[zone_type];
-
-	return zones_size[zone_type];
-}
-
-static inline unsigned long __init compat_zone_absent_pages_in_node(int nid,
-						unsigned long zone_type,
-						unsigned long node_start_pfn,
-						unsigned long node_end_pfn,
-						unsigned long *zholes_size)
-{
-	if (!zholes_size)
-		return 0;
-
-	return zholes_size[zone_type];
-}
-
 static void __init calculate_node_totalpages(struct pglist_data *pgdat,
 						unsigned long node_start_pfn,
-						unsigned long node_end_pfn,
-						unsigned long *zones_size,
-						unsigned long *zholes_size,
-						bool compat)
+						unsigned long node_end_pfn)
 {
 	unsigned long realtotalpages = 0, totalpages = 0;
 	enum zone_type i;
@@ -6580,31 +6544,14 @@ static void __init calculate_node_totalpages(struct pglist_data *pgdat,
 		unsigned long spanned, absent;
 		unsigned long size, real_size;
 
-		if (compat) {
-			spanned = compat_zone_spanned_pages_in_node(
-						pgdat->node_id, i,
-						node_start_pfn,
-						node_end_pfn,
-						&zone_start_pfn,
-						&zone_end_pfn,
-						zones_size);
-			absent = compat_zone_absent_pages_in_node(
-						pgdat->node_id, i,
-						node_start_pfn,
-						node_end_pfn,
-						zholes_size);
-		} else {
-			spanned = zone_spanned_pages_in_node(pgdat->node_id, i,
-						node_start_pfn,
-						node_end_pfn,
-						&zone_start_pfn,
-						&zone_end_pfn,
-						zones_size);
-			absent = zone_absent_pages_in_node(pgdat->node_id, i,
-						node_start_pfn,
-						node_end_pfn,
-						zholes_size);
-		}
+		spanned = zone_spanned_pages_in_node(pgdat->node_id, i,
+						     node_start_pfn,
+						     node_end_pfn,
+						     &zone_start_pfn,
+						     &zone_end_pfn);
+		absent = zone_absent_pages_in_node(pgdat->node_id, i,
+						   node_start_pfn,
+						   node_end_pfn);
 
 		size = spanned;
 		real_size = size - absent;
@@ -6926,10 +6873,7 @@ static inline void pgdat_set_deferred_range(pg_data_t *pgdat)
 static inline void pgdat_set_deferred_range(pg_data_t *pgdat) {}
 #endif
 
-static void __init __free_area_init_node(int nid, unsigned long *zones_size,
-					 unsigned long node_start_pfn,
-					 unsigned long *zholes_size,
-					 bool compat)
+void __init free_area_init_node(int nid)
 {
 	pg_data_t *pgdat = NODE_DATA(nid);
 	unsigned long start_pfn = 0;
@@ -6938,19 +6882,16 @@ static void __init __free_area_init_node(int nid, unsigned long *zones_size,
 	/* pg_data_t should be reset to zero when it's allocated */
 	WARN_ON(pgdat->nr_zones || pgdat->kswapd_classzone_idx);
 
+	get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
+
 	pgdat->node_id = nid;
-	pgdat->node_start_pfn = node_start_pfn;
+	pgdat->node_start_pfn = start_pfn;
 	pgdat->per_cpu_nodestats = NULL;
-	if (!compat) {
-		get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
-		pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,
-			(u64)start_pfn << PAGE_SHIFT,
-			end_pfn ? ((u64)end_pfn << PAGE_SHIFT) - 1 : 0);
-	} else {
-		start_pfn = node_start_pfn;
-	}
-	calculate_node_totalpages(pgdat, start_pfn, end_pfn,
-				  zones_size, zholes_size, compat);
+
+	pr_info("Initmem setup node %d [mem %#018Lx-%#018Lx]\n", nid,
+		(u64)start_pfn << PAGE_SHIFT,
+		end_pfn ? ((u64)end_pfn << PAGE_SHIFT) - 1 : 0);
+	calculate_node_totalpages(pgdat, start_pfn, end_pfn);
 
 	alloc_node_mem_map(pgdat);
 	pgdat_set_deferred_range(pgdat);
@@ -6958,14 +6899,6 @@ static void __init __free_area_init_node(int nid, unsigned long *zones_size,
 	free_area_init_core(pgdat);
 }
 
-void __init free_area_init_node(int nid, unsigned long *zones_size,
-				unsigned long node_start_pfn,
-				unsigned long *zholes_size)
-{
-	__free_area_init_node(nid, zones_size, node_start_pfn, zholes_size,
-			      true);
-}
-
 #if !defined(CONFIG_FLAT_NODE_MEM_MAP)
 /*
  * Initialize all valid struct pages in the range [spfn, epfn) and mark them
@@ -7491,8 +7424,7 @@ void __init free_area_init(unsigned long *max_zone_pfn)
 	init_unavailable_mem();
 	for_each_online_node(nid) {
 		pg_data_t *pgdat = NODE_DATA(nid);
-		__free_area_init_node(nid, NULL,
-				      find_min_pfn_for_node(nid), NULL, false);
+		free_area_init_node(nid);
 
 		/* Any memory on that node */
 		if (pgdat->node_present_pages)
-- 
2.26.1


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox