mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00

Notifier set when vhost-user backend asks qemu to mmap an FD and
offset. When vhost-user backend restart or getting killed, VQ notifier
FD and mmap addresses become invalid. After backend restart, MR contains
the invalid address will be restored and fail on notifier access.
On the other hand, qemu should munmap the notifier, release underlying
hardware resources to enable backend restart and allocate hardware
notifier resources correctly.
Qemu shouldn't reference and use resources of disconnected backend.
This patch removes VQ notifier restore, uses the default vhost-user
notifier to avoid invalid address access.
After backend restart, the backend should ask qemu to install a hardware
notifier if needed.
Fixes: 44866521bd
("vhost-user: support registering external host notifiers")
Cc: qemu-stable@nongnu.org
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Message-Id: <20220207071929.527149-2-xuemingl@nvidia.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
28 lines
681 B
C
28 lines
681 B
C
/*
|
|
* Copyright (c) 2017-2018 Intel Corporation
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef HW_VIRTIO_VHOST_USER_H
|
|
#define HW_VIRTIO_VHOST_USER_H
|
|
|
|
#include "chardev/char-fe.h"
|
|
#include "hw/virtio/virtio.h"
|
|
|
|
typedef struct VhostUserHostNotifier {
|
|
MemoryRegion mr;
|
|
void *addr;
|
|
} VhostUserHostNotifier;
|
|
|
|
typedef struct VhostUserState {
|
|
CharBackend *chr;
|
|
VhostUserHostNotifier notifier[VIRTIO_QUEUE_MAX];
|
|
int memory_slots;
|
|
} VhostUserState;
|
|
|
|
bool vhost_user_init(VhostUserState *user, CharBackend *chr, Error **errp);
|
|
void vhost_user_cleanup(VhostUserState *user);
|
|
|
|
#endif
|