Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3942017ybi; Fri, 19 Jul 2019 11:47:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxq2LyjSeBX8sxC253JVI+yfP1x8Ap5ZvnCujdZ+CyUfmAA1saO2X5Zc1QKyc6/vqeIm9cb X-Received: by 2002:a17:90a:9a95:: with SMTP id e21mr1038122pjp.98.1563562035767; Fri, 19 Jul 2019 11:47:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563562035; cv=none; d=google.com; s=arc-20160816; b=t4oeHnrgrch4KILL/CejWw9bx1s2b1ThcDBELz5kq+tJEkGRDyFvlKh+KYNz5dkDnu mRA4QIr9O/2t6JUDwa4oLnhtJrcMqbSv+66h5XFdy9pS/jduKmRI9ygLfNX28P3o00Lo NfbR5nX4ACtndNALuA21daU7gXum0TypOeCnOilQhBRWZQ/ctathuEcujWT3TsNCdL+k OZcdPMwh6xpUkqxlzHPOHIdA/KOCajGP4KmPP1BAdI77ZZIHaeAXvO2fiFMgYJ0XUd1q 8UeOPS42NPgbrxy9PINFkFac1vzDnt1Cht68tMl4olr3tJqvkyZ9UcI3DbtI0ET3egaI DhGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=6C32NzBxjNiwjAdILw/TyPVBuGXTljEUPPDov992se8=; b=pa1t3DxZnRB04inJ6KGsjbndsScXaQsT3TdrNgXiZvq17RVQt4icPFj9PDsypCw9ro OcVJtPwZIRG8DaTfKUTTTpfwgy2lRdt7NczWplmKGv6HhCdLqdezfSAGdhaT5IgLVoQw T80ZCF+8E2rB6pBZhWgFpulu2BrdEoUgGOMJ3dcfrX9yz/jB7wzpQunyYS+5QS3CQctj HX3ry8tsX8DOr4m/Mvt4q4E1QylOHjNXhCOLanNcIkfzJjajheQ8rthpR7Q/pT4X8cUa QgpzLcq6cQkDoLg1OqfO+I0C2jeqXyZMVyhvk1E+npbFD7lxHreBSb8GNaAHpkVNoUGw f1Lg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14si2734386pju.64.2019.07.19.11.46.59; Fri, 19 Jul 2019 11:47:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728412AbfGSPRE (ORCPT + 99 others); Fri, 19 Jul 2019 11:17:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42484 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbfGSPRE (ORCPT ); Fri, 19 Jul 2019 11:17:04 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E743D307154A; Fri, 19 Jul 2019 15:17:03 +0000 (UTC) Received: from redhat.com (ovpn-124-174.rdu2.redhat.com [10.10.124.174]) by smtp.corp.redhat.com (Postfix) with SMTP id D7C3262660; Fri, 19 Jul 2019 15:17:01 +0000 (UTC) Date: Fri, 19 Jul 2019 11:17:00 -0400 From: "Michael S. Tsirkin" To: Fei Li Cc: linux-kernel@vger.kernel.org, Jason Wang , Pawel Moll , Suzuki K Poulose , Fam Zheng Subject: Re: [PATCH 1/2] virtio-mmio: Process vrings more proactively Message-ID: <20190719111440-mutt-send-email-mst@kernel.org> References: <20190719133135.32418-1-lifei.shirley@bytedance.com> <20190719133135.32418-2-lifei.shirley@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190719133135.32418-2-lifei.shirley@bytedance.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Fri, 19 Jul 2019 15:17:04 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 19, 2019 at 09:31:34PM +0800, Fei Li wrote: > From: Fam Zheng > > 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 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. > --- > 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