Re: [PATCH] virtio_pci_modern: replace msleep(1) with usleep_range(1000, 2000)

"Michael S. Tsirkin" <[email protected]>
Newsgroups dev.linux.lists.virtualization,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Sun, Aug 16, 2026 at 03:13:19PM +0530, Mirza Ishan Beg wrote:
> Replace msleep(1) with usleep_range(1000, 2000) in the queue reset
> loops.
> msleep(1) relies on jiffies and can sleep up to 4-10 ms depending on HZ,
> whereas usleep_range provides predictable microsecond-level delay.
> 
> Signed-off-by: Mirza Ishan Beg <[email protected]>

why do we care?

> ---
>  drivers/virtio/virtio_pci_modern_dev.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/virtio/virtio_pci_modern_dev.c b/drivers/virtio/virtio_pci_modern_dev.c
> index 413a8c353463..8e74a813ca97 100644
> --- a/drivers/virtio/virtio_pci_modern_dev.c
> +++ b/drivers/virtio/virtio_pci_modern_dev.c
> @@ -535,10 +535,10 @@ void vp_modern_set_queue_reset(struct virtio_pci_modern_device *mdev, u16 index)
>  	vp_iowrite16(1, &cfg->queue_reset);
>  
>  	while (vp_ioread16(&cfg->queue_reset))
> -		msleep(1);
> +		usleep_range(1000, 2000);
>  
>  	while (vp_ioread16(&cfg->cfg.queue_enable))
> -		msleep(1);
> +		usleep_range(1000, 2000);
>  }
>  EXPORT_SYMBOL_GPL(vp_modern_set_queue_reset);
>  
> -- 
> 2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.