LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] powerpc/pseries/cmm: fix wrong managed page count when migrating between zones
@ 2019-12-04 20:53 David Hildenbrand
  2019-12-04 20:54 ` David Hildenbrand
  0 siblings, 1 reply; 4+ messages in thread
From: David Hildenbrand @ 2019-12-04 20:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: David Hildenbrand, Greg Kroah-Hartman, Richard Fontana, linux-mm,
	Paul Mackerras, Arun KS, Andrew Morton, linuxppc-dev,
	Thomas Gleixner

In case we have to migrate a ballon page to a newpage of another zone, the
managed page count of both zones is wrong. Paired with memory offlining
(which will adjust the managed page count), we can trigger kernel crashes
and all kinds of different symptoms.

Fix it by properly adjusting the managed page count when migrating.

I did not try to reproduce on powerpc, however,I just resolved a long
known issue when ballooning+offlining in virtio-balloon. The same should
apply to powerpc/cmm since it started using the balloon compaction
infrastructure (luckily just recently).

Fixes: fe030c9b85e6 ("powerpc/pseries/cmm: Implement balloon compaction")
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Richard Fontana <rfontana@redhat.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Arun KS <arunks@codeaurora.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: David Hildenbrand <david@redhat.com>
---

virtio-ballon fix with more details:

https://lkml.kernel.org/r/20191204204807.8025-1-david@redhat.com/

---
 arch/powerpc/platforms/pseries/cmm.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c
index 91571841df8a..665298fe2990 100644
--- a/arch/powerpc/platforms/pseries/cmm.c
+++ b/arch/powerpc/platforms/pseries/cmm.c
@@ -551,6 +551,10 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info,
 	 */
 	plpar_page_set_active(page);
 
+	/* fixup the managed page count (esp. of the zone) */
+	adjust_managed_page_count(page, 1);
+	adjust_managed_page_count(newpage, -1);
+
 	/* balloon page list reference */
 	put_page(page);
 
-- 
2.21.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/pseries/cmm: fix wrong managed page count when migrating between zones
  2019-12-04 20:53 [PATCH] powerpc/pseries/cmm: fix wrong managed page count when migrating between zones David Hildenbrand
@ 2019-12-04 20:54 ` David Hildenbrand
  2019-12-05  2:59   ` Michael Ellerman
  0 siblings, 1 reply; 4+ messages in thread
From: David Hildenbrand @ 2019-12-04 20:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-mm, Greg Kroah-Hartman, Richard Fontana, Paul Mackerras,
	Arun KS, Andrew Morton, linuxppc-dev, Thomas Gleixner

Forgot to rename the subject to

"powerpc/pseries/cmm: fix managed page counts when migrating pages
between zones"

If I don't have to resend, would be great if that could be adjusted when
applying.


-- 
Thanks,

David / dhildenb


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/pseries/cmm: fix wrong managed page count when migrating between zones
  2019-12-04 20:54 ` David Hildenbrand
@ 2019-12-05  2:59   ` Michael Ellerman
  2019-12-05  7:45     ` David Hildenbrand
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Ellerman @ 2019-12-05  2:59 UTC (permalink / raw)
  To: David Hildenbrand, linux-kernel
  Cc: linux-mm, Greg Kroah-Hartman, Richard Fontana, Paul Mackerras,
	Arun KS, Andrew Morton, linuxppc-dev, Thomas Gleixner

David Hildenbrand <david@redhat.com> writes:
> Forgot to rename the subject to
>
> "powerpc/pseries/cmm: fix managed page counts when migrating pages
> between zones"
>
> If I don't have to resend, would be great if that could be adjusted when
> applying.

I can do that.

I'm inclined to wait until the virtio_balloon.c change is committed, in
case there's any changes to it during review, and so we can refer to
it's SHA in the change log of this commit.

Do you want to ping me when that happens?

cheers

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] powerpc/pseries/cmm: fix wrong managed page count when migrating between zones
  2019-12-05  2:59   ` Michael Ellerman
@ 2019-12-05  7:45     ` David Hildenbrand
  0 siblings, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2019-12-05  7:45 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: David Hildenbrand, linux-kernel, Richard Fontana, linux-mm,
	Paul Mackerras, Greg Kroah-Hartman, Arun KS, Andrew Morton,
	linuxppc-dev, Thomas Gleixner



> Am 05.12.2019 um 03:59 schrieb Michael Ellerman <mpe@ellerman.id.au>:
> 
> David Hildenbrand <david@redhat.com> writes:
>> Forgot to rename the subject to
>> 
>> "powerpc/pseries/cmm: fix managed page counts when migrating pages
>> between zones"
>> 
>> If I don't have to resend, would be great if that could be adjusted when
>> applying.
> 
> I can do that.
> 
> I'm inclined to wait until the virtio_balloon.c change is committed, in
> case there's any changes to it during review, and so we can refer to
> it's SHA in the change log of this commit.
> 
> Do you want to ping me when that happens?

Sounds like a good idea, we have time until 5.5. I‘ll ping/resend.

Cheers!

> 
> cheers
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 20:53 [PATCH] powerpc/pseries/cmm: fix wrong managed page count when migrating between zones David Hildenbrand
2019-12-04 20:54 ` David Hildenbrand
2019-12-05  2:59   ` Michael Ellerman
2019-12-05  7:45     ` David Hildenbrand

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git