linux-stable/drivers/hv
Vitaly Kuznetsov bba072d162 hv_balloon: fix bugs in num_pages_onlined accounting
Our num_pages_onlined accounting is buggy:
1) In case we're offlining a memory block which was present at boot (e.g.
   when there was no hotplug at all) we subtract 32k from 0 and as
   num_pages_onlined is unsigned get a very big positive number.

2) Commit 6df8d9aaf3 ("Drivers: hv: balloon: Correctly update onlined
   page count") made num_pages_onlined counter accurate on onlining but
   totally incorrect on offlining for partly populated regions: no matter
   how many pages were onlined and what was actually added to
   num_pages_onlined counter we always subtract the full region (32k) so
   again, num_pages_onlined can wrap around zero. By onlining/offlining
   the same partly populated region multiple times we can make the
   situation worse.

Solve these issues by doing accurate accounting on offlining: walk HAS
list, check for covered range and gaps.

Fixes: 6df8d9aaf3 ("Drivers: hv: balloon: Correctly update onlined page count")
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-06 09:57:17 -08:00
..
channel.c Drivers: hv: vmbus: Fix a rescind issue 2017-11-28 16:56:26 +01:00
channel_mgmt.c hv_vmbus: Correct the stale comments regarding cpu affinity 2018-03-06 09:57:16 -08:00
connection.c hyper-v: trace channel events 2017-11-04 12:04:26 +01:00
hv.c Drivers: hv: vmbus: Implement Direct Mode for stimer0 2018-03-06 09:57:17 -08:00
hv_balloon.c hv_balloon: fix bugs in num_pages_onlined accounting 2018-03-06 09:57:17 -08:00
hv_fcopy.c Drivers: hv: fcopy: restore correct transfer length 2017-09-22 10:29:54 +02:00
hv_kvp.c Drivers: hv: kvp: Use MAX_ADAPTER_ID_SIZE for translating adapter id 2017-08-16 09:14:43 -07:00
hv_snapshot.c Merge 4.11-rc4 into char-misc-next 2017-03-27 09:13:04 +02:00
hv_trace.c hyper-v: trace vmbus_on_msg_dpc() 2017-11-04 12:04:24 +01:00
hv_trace.h hyper-v: trace channel events 2017-11-04 12:04:26 +01:00
hv_util.c hv_utils: fix TimeSync work on pre-TimeSync-v4 hosts 2017-05-25 15:42:42 +02: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
hyperv_vmbus.h Drivers: hv: vmbus: Implement Direct Mode for stimer0 2018-03-06 09:57:17 -08:00
Kconfig x86/hyper-v: Use hypercall for remote TLB flush 2017-08-10 20:16:44 +02:00
Makefile Char/Misc patches for 4.15-rc1 2017-11-16 09:10:59 -08:00
ring_buffer.c vmbus: make hv_get_ringbuffer_availbytes local 2017-12-03 10:10:02 -05:00
vmbus_drv.c vmbus: add monitor_id and subchannel_id to sysfs per channel 2018-01-09 19:50:42 +01:00