1. 04 Mar, 2022 4 commits
    • Michael S. Tsirkin's avatar
      virtio_console: break out of buf poll on remove · 0e7174b9
      Michael S. Tsirkin authored
      A common pattern for device reset is currently:
      vdev->config->reset(vdev);
      .. cleanup ..
      
      reset prevents new interrupts from arriving and waits for interrupt
      handlers to finish.
      
      However if - as is common - the handler queues a work request which is
      flushed during the cleanup stage, we have code adding buffers / trying
      to get buffers while device is reset. Not good.
      
      This was reproduced by running
      	modprobe virtio_console
      	modprobe -r virtio_console
      in a loop.
      
      Fix this up by calling virtio_break_device + flush before reset.
      
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1786239Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      0e7174b9
    • Michael S. Tsirkin's avatar
      virtio: document virtio_reset_device · c46eccda
      Michael S. Tsirkin authored
      Looks like most callers get driver/device removal wrong.
      Document what's expected of callers.
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      c46eccda
    • Michael S. Tsirkin's avatar
      virtio: acknowledge all features before access · 4fa59ede
      Michael S. Tsirkin authored
      The feature negotiation was designed in a way that
      makes it possible for devices to know which config
      fields will be accessed by drivers.
      
      This is broken since commit 404123c2 ("virtio: allow drivers to
      validate features") with fallout in at least block and net.  We have a
      partial work-around in commit 2f9a174f ("virtio: write back
      F_VERSION_1 before validate") which at least lets devices find out which
      format should config space have, but this is a partial fix: guests
      should not access config space without acknowledging features since
      otherwise we'll never be able to change the config space format.
      
      To fix, split finalize_features from virtio_finalize_features and
      call finalize_features with all feature bits before validation,
      and then - if validation changed any bits - once again after.
      
      Since virtio_finalize_features no longer writes out features
      rename it to virtio_features_ok - since that is what it does:
      checks that features are ok with the device.
      
      As a side effect, this also reduces the amount of hypervisor accesses -
      we now only acknowledge features once unless we are clearing any
      features when validating (which is uncommon).
      
      IRC I think that this was more or less always the intent in the spec but
      unfortunately the way the spec is worded does not say this explicitly, I
      plan to address this at the spec level, too.
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: 404123c2 ("virtio: allow drivers to validate features")
      Fixes: 2f9a174f ("virtio: write back F_VERSION_1 before validate")
      Cc: "Halil Pasic" <pasic@linux.ibm.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      4fa59ede
    • Michael S. Tsirkin's avatar
      virtio: unexport virtio_finalize_features · 838d6d34
      Michael S. Tsirkin authored
      virtio_finalize_features is only used internally within virtio.
      No reason to export it.
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
      Acked-by: default avatarJason Wang <jasowang@redhat.com>
      838d6d34
  2. 27 Feb, 2022 4 commits
  3. 26 Feb, 2022 22 commits
  4. 25 Feb, 2022 10 commits