• Jason Wang's avatar
    vhost_net: re-poll only on EAGAIN or ENOBUFS · dbf34207
    Jason Wang authored
    Currently, we restart tx polling unconditionally when sendmsg()
    fails. This would cause unnecessary wakeups of vhost wokers and waste
    cpu utlization when evil userspace(guest driver) is able to hit EFAULT or
    EINVAL.
    
    The polling is only needed when the socket send buffer were exceeded or not
    enough memory. So fix this by restarting polling only when sendmsg() returns
    EAGAIN/ENOBUFS.
    Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
    Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
    dbf34207
net.c 21.6 KB