Skip to contentSkip to conversation

xen/balloon: Set pages PageOffline() in balloon_add_region()

PATCH In review David Hildenbrand 2 participants 3 messages Sep 27, 2019 – Sep 28, 2019

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/balloon: Set pages PageOffline() in balloon_add_region()

We are missing a __SetPageOffline(), which is why we can get !PageOffline() pages onto the balloon list, where alloc_xenballooned_pages() will complain:

page:ffffea0003e7ffc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xffffe00001000(reserved)

raw: 000ffffe00001000 dead000000000100 dead000000000200 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: VM_BUG_ON_PAGE(!PageOffline(page))
------------[ cut here ]------------
kernel BUG at include/linux/page-flags.h:744!

invalid opcode: 0000 [#1] SMP NOPTI

Fixes 77c4adf6a6df ("xen/balloon: mark inflated pages PG_offline")
Cc Boris Ostrovsky <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Stefano Stabellini <[email protected]>
---
 drivers/xen/balloon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/xen/balloon.c +1 -0
index 05b1f7e948ef..29f6256363db 100644
@@ -687,6 +687,7 @@ static void __init balloon_add_region(unsigned long start_pfn,
 		/* totalram_pages and totalhigh_pages do not
 		   include the boot-time balloon extension, so
 		   don't subtract from it. */
+		__SetPageOffline(page);
 		__balloon_append(page);
 	}
 
Signature · 1 line
2.21.0
#1 lore raw
Quoted 30 lines · David Hildenbrand

We are missing a __SetPageOffline(), which is why we can get !PageOffline() pages onto the balloon list, where alloc_xenballooned_pages() will complain:

page:ffffea0003e7ffc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xffffe00001000(reserved)

raw: 000ffffe00001000 dead000000000100 dead000000000200 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: VM_BUG_ON_PAGE(!PageOffline(page))
------------[ cut here ]------------
kernel BUG at include/linux/page-flags.h:744!

invalid opcode: 0000 [#1] SMP NOPTI

Fixes 77c4adf6a6df ("xen/balloon: mark inflated pages PG_offline")
Cc Boris Ostrovsky <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Stefano Stabellini <[email protected]>
---
 drivers/xen/balloon.c | 1 +
 1 file changed, 1 insertion(+)
drivers/xen/balloon.c +0 -0
index 05b1f7e948ef..29f6256363db 100644

drivers/xen/balloon.c static void __init balloon_add_region(unsigned long start_pfn, · line 691

Quoted 5 lines
drivers/xen/balloon.c +1 -0
@@ -687,6 +687,7 @@ static void __init balloon_add_region(unsigned long start_pfn,
 		/* totalram_pages and totalhigh_pages do not
 		   include the boot-time balloon extension, so
 		   don't subtract from it. */
+		__SetPageOffline(page);
 		__balloon_append(page);

Given that when a page is appended to balloon list need to be marked offline and, conversely, when a page is retrieved the bit should be cleared I wonder whether it's better to move Set/ClearPageOffline to balloon_append/retrieve().

-boris

#2 lore raw
Quoted 26 lines · Boris Ostrovsky
Quoted 25 lines · David Hildenbrand

We are missing a __SetPageOffline(), which is why we can get !PageOffline() pages onto the balloon list, where alloc_xenballooned_pages() will complain:

page:ffffea0003e7ffc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xffffe00001000(reserved)

raw: 000ffffe00001000 dead000000000100 dead000000000200 0000000000000000
raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
page dumped because: VM_BUG_ON_PAGE(!PageOffline(page))
------------[ cut here ]------------
kernel BUG at include/linux/page-flags.h:744!

invalid opcode: 0000 [#1] SMP NOPTI

Fixes 77c4adf6a6df ("xen/balloon: mark inflated pages PG_offline")
Cc Boris Ostrovsky <[email protected]>
Cc Juergen Gross <[email protected]>
Cc Stefano Stabellini <[email protected]>
---
 drivers/xen/balloon.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 16 lines

drivers/xen/balloon.c static void __init balloon_add_region(unsigned long start_pfn, · line 691

Quoted 10 lines
drivers/xen/balloon.c +1 -0
index 05b1f7e948ef..29f6256363db 100644
@@ -687,6 +687,7 @@ static void __init balloon_add_region(unsigned long start_pfn,
 		/* totalram_pages and totalhigh_pages do not
 		   include the boot-time balloon extension, so
 		   don't subtract from it. */
+		__SetPageOffline(page);
 		__balloon_append(page);

Given that when a page is appended to balloon list need to be marked offline and, conversely, when a page is retrieved the bit should be cleared I wonder whether it's better to move Set/ClearPageOffline to balloon_append/retrieve().

Yes, we can do that as an addon patch (and also get rid of either __balloon_append() or balloon_append() if I remember correctly).

Signature · 3 lines
Thanks,

David / dhildenb