public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Fam Zheng <zhengfeiran@bytedance.com>
Cc: Fei Li <lifei.shirley@bytedance.com>,
	linux-kernel@vger.kernel.org, Jason Wang <jasowang@redhat.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>
Subject: Re: [External Email] Re: [PATCH 1/2] virtio-mmio: Process vrings more proactively
Date: Thu, 25 Jul 2019 10:33:25 -0400	[thread overview]
Message-ID: <20190725103238-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <5b29804b-528b-61bd-1ab6-4e442d360cf9@bytedance.com>

On Mon, Jul 22, 2019 at 10:28:30AM +0800, Fam Zheng wrote:
> 
> On 7/19/19 11:17 PM, Michael S. Tsirkin wrote:
> > On Fri, Jul 19, 2019 at 09:31:34PM +0800, Fei Li wrote:
> > > From: Fam Zheng <zhengfeiran@bytedance.com>
> > > 
> > > This allows the backend to _not_ trap mmio read of the status register
> > > after injecting IRQ in the data path, which can improve the performance
> > > significantly by avoiding a vmexit for each interrupt.
> > > 
> > > More importantly it also makes it possible for Firecracker to hook up
> > > virtio-mmio with vhost-net, in which case there isn't a way to implement
> > > proper status register handling.
> > > 
> > > For a complete backend that does set either INT_CONFIG bit or INT_VRING
> > > bit upon generating irq, what happens hasn't changed.
> > > 
> > > Signed-off-by: Fam Zheng <zhengfeiran@bytedance.com>
> > This has a side effect of skipping vring callbacks
> > if they trigger at the same time with a config
> > interrupt.
> > I don't see why this is safe.
> 
> Good point! I think the block can be moved out from the else block and run
> unconditionally then.
> 
> Fam


Won't same callback run from multiple irq handlers then?
Running multiple vring callbacks at the same time isn't
a good idea either.

> 
> > 
> > 
> > > ---
> > >   drivers/virtio/virtio_mmio.c | 4 +---
> > >   1 file changed, 1 insertion(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
> > > index e09edb5c5e06..9b42502b2204 100644
> > > --- a/drivers/virtio/virtio_mmio.c
> > > +++ b/drivers/virtio/virtio_mmio.c
> > > @@ -295,9 +295,7 @@ static irqreturn_t vm_interrupt(int irq, void *opaque)
> > >   	if (unlikely(status & VIRTIO_MMIO_INT_CONFIG)) {
> > >   		virtio_config_changed(&vm_dev->vdev);
> > >   		ret = IRQ_HANDLED;
> > > -	}
> > > -
> > > -	if (likely(status & VIRTIO_MMIO_INT_VRING)) {
> > > +	} else {
> > >   		spin_lock_irqsave(&vm_dev->lock, flags);
> > >   		list_for_each_entry(info, &vm_dev->virtqueues, node)
> > >   			ret |= vring_interrupt(irq, info->vq);
> > > -- 
> > > 2.11.0

  reply	other threads:[~2019-07-25 14:33 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-19 13:31 [PATCH v1 0/2] virtio-mmio: support multiple interrupt vectors Fei Li
2019-07-19 13:31 ` [PATCH 1/2] virtio-mmio: Process vrings more proactively Fei Li
2019-07-19 15:17   ` Michael S. Tsirkin
2019-07-22  2:28     ` [External Email] " Fam Zheng
2019-07-25 14:33       ` Michael S. Tsirkin [this message]
2019-07-19 13:31 ` [PATCH 2/2] virtio-mmio: support multiple interrupt vectors Fei Li
2019-07-19 15:14 ` [PATCH v1 0/2] " Michael S. Tsirkin
2019-07-22  3:22   ` [External Email] " 李菲
2019-07-22  8:39     ` Michael S. Tsirkin
2019-07-22 13:43       ` 李菲
2019-07-30 20:26         ` Michael S. Tsirkin
2019-07-31  4:04           ` 李菲
2019-08-02 11:01             ` Sergio Lopez
2019-07-31  4:10 ` 李菲

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=20190725103238-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=lifei.shirley@bytedance.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pawel.moll@arm.com \
    --cc=suzuki.poulose@arm.com \
    --cc=zhengfeiran@bytedance.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox