[libvirt] [PATCH] nodedev_udev: Fix missing events when kernel report lots of udev events within a short time

ZhiPeng Lu lu.zhipeng at zte.com.cn
Tue May 9 02:09:07 UTC 2017

From: "ning.bo" <ning.bo9 at zte.com.cn>

When create Virtual Function for Inter XL710 use below commands:
for i in `seq 0 1`; do
        echo 63 > /sys/devices/pci0000:00/0000:00:03.2/0000:07:00.$i/sriov_numvfs
for i in `seq 0 3`; do
        echo 31 > /sys/devices/pci0000:80/0000:80:02.2/0000:82:00.$i/sriov_numvfs

The libvirtd will missing some udev events, the result of libvirt-python API
listDevices('pci') will not list all pci devices.
The reason is that the buffer of udev monitor default size cann't save all udev
events reported by kernel.
So we need change buffer size so that we can receive as much events as possible
whitin a short time.

Signed-off-by: ning.bo <ning.bo9 at zte.com.cn>
 src/node_device/node_device_udev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c
index 6e706a1..d813206 100644
--- a/src/node_device/node_device_udev.c
+++ b/src/node_device/node_device_udev.c
@@ -1564,6 +1564,7 @@ static int nodeStateInitialize(bool privileged,
+    udev_monitor_set_receive_buffer_size(priv->udev_monitor, 128 * 1024 * 1024);
     /* We register the monitor with the event callback so we are
      * notified by udev of device changes before we enumerate existing

More information about the libvir-list mailing list