linux/drivers/hv
Vitaly Kuznetsov da8ced360c hv_balloon: avoid touching uninitialized struct page during tail onlining
Hyper-V memory hotplug protocol has 2M granularity and in Linux x86 we use
128M. To deal with it we implement partial section onlining by registering
custom page onlining callback (hv_online_page()). Later, when more memory
arrives we try to online the 'tail' (see hv_bring_pgs_online()).

It was found that in some cases this 'tail' onlining causes issues:

 BUG: Bad page state in process kworker/0:2  pfn:109e3a
 page:ffffe08344278e80 count:0 mapcount:1 mapping:0000000000000000 index:0x0
 flags: 0xfffff80000000()
 raw: 000fffff80000000 dead000000000100 dead000000000200 0000000000000000
 raw: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
 page dumped because: nonzero mapcount
 ...
 Workqueue: events hot_add_req [hv_balloon]
 Call Trace:
  dump_stack+0x5c/0x80
  bad_page.cold.112+0x7f/0xb2
  free_pcppages_bulk+0x4b8/0x690
  free_unref_page+0x54/0x70
  hv_page_online_one+0x5c/0x80 [hv_balloon]
  hot_add_req.cold.24+0x182/0x835 [hv_balloon]
  ...

Turns out that we now have deferred struct page initialization for memory
hotplug so e.g. memory_block_action() in drivers/base/memory.c does
pages_correctly_probed() check and in that check it avoids inspecting
struct pages and checks sections instead. But in Hyper-V balloon driver we
do PageReserved(pfn_to_page()) check and this is now wrong.

Switch to checking online_section_nr() instead.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: stable@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-01-09 14:20:47 -05:00
..
channel_mgmt.c Merge 4.20-rc6 into char-misc-next 2018-12-10 09:22:34 +01:00
channel.c Merge 4.20-rc5 into char-misc-next 2018-12-03 07:56:15 +01:00
connection.c Drivers: hv: vmbus: Offload the handling of channels to two workqueues 2018-12-03 08:01:01 +01:00
hv_balloon.c hv_balloon: avoid touching uninitialized struct page during tail onlining 2019-01-09 14:20:47 -05:00
hv_fcopy.c Drivers: hv: fcopy: restore correct transfer length 2017-09-22 10:29:54 +02:00
hv_kvp.c Merge 4.20-rc4 into char-misc-next 2018-11-26 07:50:56 +01:00
hv_snapshot.c Merge 4.11-rc4 into char-misc-next 2017-03-27 09:13:04 +02:00
hv_trace_balloon.h hv_balloon: trace post_status 2018-03-06 09:57:17 -08:00
hv_trace.c hv: add SPDX license to trace 2018-03-28 13:24:56 +02:00
hv_trace.h hv: add SPDX license to trace 2018-03-28 13:24:56 +02:00
hv_util.c hv_utils: update name in struct hv_driver util_drv 2018-11-11 12:58:26 -08:00
hv_utils_transport.c vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
hv_utils_transport.h Drivers: hv: util: move waiting for release to hv_utils_transport itself 2017-03-16 16:42:00 +09:00
hv.c Char/Misc driver patches for 4.21-rc1 2018-12-28 20:54:57 -08:00
hyperv_vmbus.h Char/Misc driver patches for 4.21-rc1 2018-12-28 20:54:57 -08:00
Kconfig x86, hyperv: remove PCI dependency 2018-12-13 14:55:57 -05:00
Makefile hv_balloon: trace post_status 2018-03-06 09:57:17 -08:00
ring_buffer.c Drivers: hv: vmbus: Check for ring when getting debug info 2019-01-09 14:20:47 -05:00
vmbus_drv.c Drivers: hv: vmbus: Check for ring when getting debug info 2019-01-09 14:20:47 -05:00