From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id C8C971B1A4 for ; Mon, 8 Jan 2018 15:07:07 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 31ED420680; Mon, 8 Jan 2018 09:07:07 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Mon, 08 Jan 2018 09:07:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=nIj6gf6RGakDxSqVsQe8qCFG3dlfxTTu8pEqKycw590=; b=UIiujyds T+7Y82Odc1uZbD5xlYQ1IG1hyqKZlyLt1v5k5ro8QWCx6SFBDymUGilsZbtNNX27 COVWPhphuIgs5Xc0TKJJKCDI9k9sBB9GvJ9f9TAA8EJOsABP2eTocXDyfmUqhr07 lGWsv80Jrd/0uxIppJZzjjqlzFoQVtasM3jWEumk84Mib+X5HEi4tW9FpYVR8pSz SEMX1jAwpgyiUikaG2grXqxMVRZvx6xbeSA1dH1Sd18lkfQff4+64xpGHvZWm/F5 AitIblQ/rHIJnpmTMfJUmZDxTmQQ9Ne4RsI1ZPQgIqfmYakXmG+m7dh0OGH8SjV9 YsUtBZwu5FWA6g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=nIj6gf6RGakDxSqVsQe8qCFG3dlfx TTu8pEqKycw590=; b=R7kYK3GnO/wE26wj4WsxldeyTvZPvLMMfp1wg+3CJ/avw UkSxNmUHCrQo6EgpiQJH8TXIniObqx91Owgh/tsrWrvt/+c8odDajAW0cOKa1a6N G3zOlOtoCnPyODrKwsOeyxIVkpRyIOqw+/0fvxsQDCm2uksZrUmUTUJZ+6QG7Cm4 eCaqOhKqCprvHLjYKvL6YTdFVJ/sHx5xi+3zMtvcUFobQR4UoVEKPSz1BAGfICvS ki/64mvs1Nw16hQ/pu5vfzxm455vSDFOqO49gg+DfVtUqoPOhcNMKuGLcWWzLCl1 pWH1Zlq8MhABXI8C2sKLG3QPXstk1iqlAmrkt1m4g== X-ME-Sender: Received: from yliu-mob (unknown [115.150.10.63]) by mail.messagingengine.com (Postfix) with ESMTPA id 8201C24736; Mon, 8 Jan 2018 09:07:05 -0500 (EST) Date: Mon, 8 Jan 2018 22:06:59 +0800 From: Yuanhan Liu To: Junjie Chen Cc: xiao.w.wang@intel.com, maxime.coquelin@redhat.com, tiwei.bie@intel.com, dev@dpdk.org, "Yao, Lei A" Message-ID: <20180108140659.GA29540@yliu-mob> References: <1514048153-82959-1-git-send-email-junjie.j.chen@intel.com> <1514310190-140916-1-git-send-email-junjie.j.chen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1514310190-140916-1-git-send-email-junjie.j.chen@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [dpdk-dev] [PATCH v6] vhost: support virtqueue interrupt/notification suppression X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jan 2018 14:07:08 -0000 On Tue, Dec 26, 2017 at 12:43:10PM -0500, Junjie Chen wrote: > The driver can suppress interrupt when VIRTIO_F_EVENT_IDX feature bit is > negotiated. The driver set vring flags to 0, and MAY use used_event in > available ring to advise device interrupt util reach an index specified > by used_event. The device ignore the lower bit of vring flags, and send > an interrupt when index reach used_event. > > The device can suppress notification in a manner analogous to the ways > driver suppress interrupt. The device manipulates flags or avail_event in > the used ring in the same way the driver manipulates flags or used_event in > available ring. > > This patch is to enable this feature in vhost. > > Signed-off-by: Junjie Chen You need put "---" before the change log. Otherwise, it will be tracked in the commit log. > +#define vhost_used_event(vr) \ > + (*(volatile uint16_t*)&(vr)->avail->ring[(vr)->size]) > + > +static __rte_always_inline void > +vhost_notify(struct virtio_net *dev, struct vhost_virtqueue *vq) > +{ > + /* Don't notify guest if we don't reach index specified by guest. */ > + if (dev->features & (1ULL << VIRTIO_RING_F_EVENT_IDX)) { > + uint16_t old = vq->signalled_used; > + uint16_t new = vq->last_used_idx; > + > + LOG_DEBUG(VHOST_DATA, "%s: used_event_idx=%d, old=%d, new=%d\n", > + __func__, > + vhost_used_event(vq), > + old, new); > + if (vring_need_event(vhost_used_event(vq), new, old) It's a bit weird that you use one from the standard linux header file (vring_need_event), while you define you own one (vhost_used_event). Note that the system header file also has "vring_used_event()" defined. Besides that, I have few more comments (and some requirements): - It'd be much better if there is a Tested-by tag. Expeclitly, I'm asking a test with Linux kernel virtio-net driver in guest. - I also hope you could have done a build test on some old distributions. AFAIK, the two macros (vring_need_event and vring_used_event) come from kernel 3.0 (or above). Any kernel older than that would fail the build. - I'd be great if you could make a new one based on top of my latest tree: I have just applied a patchset that should conflict with this one. --yliu