virtio-mem: keep retrying on offline_and_remove_memory() errors in Sub Block Mode...
authorDavid Hildenbrand <david@redhat.com>
Thu, 13 Jul 2023 14:55:50 +0000 (16:55 +0200)
committerMichael S. Tsirkin <mst@redhat.com>
Thu, 10 Aug 2023 19:51:46 +0000 (15:51 -0400)
commita31648fd4f96fbe0a4d0aeb16b57a2405c6943c0
tree94343593e5a7762e4bf9c415e52f1dd824caf947
parentddf409851461f515cc32974714b73efe2e012bde
virtio-mem: keep retrying on offline_and_remove_memory() errors in Sub Block Mode (SBM)

In case offline_and_remove_memory() fails in SBM, we leave a completely
unplugged Linux memory block stick around until we try plugging memory
again. We won't try removing that memory block again.

offline_and_remove_memory() may, for example, fail if we're racing with
another alloc_contig_range() user, if allocating temporary memory fails,
or if some memory notifier rejected the offlining request.

Let's handle that case better, by simple retrying to offline and remove
such memory.

Tested using CONFIG_MEMORY_NOTIFIER_ERROR_INJECT.

Signed-off-by: David Hildenbrand <david@redhat.com>
Message-Id: <20230713145551.2824980-4-david@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
drivers/virtio/virtio_mem.c