David Hildenbrand 1d33c2caa8 virtio-mem: don't always trigger the workqueue when offlining memory
Let's trigger from offlining code only when we're not allowed to unplug
online memory. Handle the other case (memmap possibly freeing up another
memory block) when actually removing memory. We now also properly handle
the case when removing already offline memory blocks via
virtio_mem_mb_remove(). When removing via virtio_mem_remove(), when
unloading the driver, virtio_mem_retry() is a NOP and safe to use.

While at it, move retry handling when offlining out of
virtio_mem_notify_offline(), to share it with Big Block Mode (BBM)
soon.

This is a preparation for Big Block Mode (BBM), whereby we can see some
temporary offlining of memory blocks without actually making progress.
Imagine you have a Big Block that spans to Linux memory blocks. Assume
the first Linux memory blocks has no unmovable data on it. When we would
call offline_and_remove_memory() on the big block, we would
	1. Try to offline the first block. Works, notifiers triggered.
	   virtio_mem_retry() called.
	2. Try to offline the second block. Does not work.
	3. Re-online first block.
	4. Exit to main loop, exit workqueue.
	5. Retry immediately (due to virtio_mem_retry()), go to 1.
The result are endless retries.

Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Pankaj Gupta <pankaj.gupta.linux@gmail.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
Link: https://lore.kernel.org/r/20201112133815.13332-16-david@redhat.com
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2020-12-18 16:14:26 -05:00
..
2020-11-27 10:44:59 -08:00
2020-10-30 14:51:01 -07:00
2020-11-18 16:42:07 -08:00
2020-11-15 10:15:17 -08:00
2020-11-20 10:23:49 -08:00
2020-10-15 14:43:29 -07:00
2020-10-12 13:26:49 -07:00
2020-11-16 15:02:33 -08:00
2020-10-13 12:12:44 -07:00
2020-12-03 10:00:23 +01:00
2020-12-09 09:59:14 -08:00
2020-10-16 12:21:15 -07:00
2020-10-24 10:39:22 -07:00
2020-12-13 10:36:23 -08:00
2020-12-08 08:15:49 +01:00
2020-10-24 10:39:22 -07:00
2020-09-28 12:17:36 +02:00
2020-10-14 15:56:58 -07:00
2020-12-11 23:23:30 +01:00
2020-10-25 11:12:31 -07:00
2020-09-25 06:12:15 +02:00
2020-10-27 19:23:04 +01:00
2020-10-24 10:33:08 -07:00
2020-10-22 12:56:33 -07:00
2020-10-24 10:39:22 -07:00
2020-10-22 12:58:21 -07:00
2020-10-21 11:22:08 -07:00
2020-12-12 12:57:12 -08:00
2020-11-26 22:07:22 +01:00
2020-10-01 22:59:55 +02:00
2020-11-25 10:35:44 -08:00
2020-11-20 16:24:28 -08:00
2020-11-27 14:48:03 -08:00
2020-12-04 17:39:58 +01:00
2020-11-23 15:29:03 -08:00
2020-10-24 10:33:08 -07:00