Skip to contentSkip to conversation

powerpc/pseries/cmm: fix wrong managed page count when migrating between zones

PATCH Superseded David Hildenbrand 2 participants 4 messages Dec 4, 2019 – Dec 5, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/pseries/cmm: fix wrong managed page count when migrating between zones

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 <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Michael Ellerman <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Richard Fontana <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Arun KS <[email protected]>
Cc Thomas Gleixner <[email protected]>

---

virtio-ballon fix with more details:

https://lkml.kernel.org/r/[email protected]/

---
 arch/powerpc/platforms/pseries/cmm.c | 4 ++++
 1 file changed, 4 insertions(+)
arch/powerpc/platforms/pseries/cmm.c +4 -0
index 91571841df8a..665298fe2990 100644
@@ -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);
 
Signature · 1 line
2.21.0
#1 lore raw

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.

Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 7 lines · David Hildenbrand

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

#3 lore raw
Quoted 13 lines

Am 05.12.2019 um 03:59 schrieb Michael Ellerman <[email protected]>:

Quoted 7 lines · David Hildenbrand

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.

Quoted 7 lines

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!

Quoted 3 lines

cheers