All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Mirza Ishan Beg <seedandsyntax@gmail.com>
Cc: virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
	"Jason Wang" <jasowangio@gmail.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	"Eugenio Pérez" <eperezma@redhat.com>
Subject: Re: [PATCH] virtio_pci_modern: replace msleep(1) with usleep_range(1000, 2000)
Date: Sun, 16 Aug 2026 17:38:15 -0400	[thread overview]
Message-ID: <20260816173806-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20260816094318.8083-2-seedandsyntax@gmail.com>

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 <seedandsyntax@gmail.com>

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


  reply	other threads:[~2026-08-16 21:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-16  9:43 [PATCH] virtio_pci_modern: replace msleep(1) with usleep_range(1000, 2000) Mirza Ishan Beg
2026-08-16 21:38 ` Michael S. Tsirkin [this message]
2026-08-17 17:03   ` Mirza Ishan Beg
2026-08-17 19:55     ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260816173806-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=eperezma@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seedandsyntax@gmail.com \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.