Received: by 10.192.165.148 with SMTP id m20csp1639073imm; Thu, 3 May 2018 02:58:35 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoaq61I9l0SJcPod3kYnqGXrg25mu6nvoVxJxm0o3HTSamz/LV3MPSVcYFgjcFqk3ugPY1h X-Received: by 2002:a17:902:b492:: with SMTP id y18-v6mr23220367plr.2.1525341515556; Thu, 03 May 2018 02:58:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525341515; cv=none; d=google.com; s=arc-20160816; b=d8RQ7iJih1QodNRTnFbaopRzSDE6qcYktxh62AKXyFersN96lN06c6ETGMuL68YBQT KHU4DIsmcvrsTh23KDo/Z+9lTJVWuZVJsOXr9TKgQ3dthWmmzPUKLbHJeRTd6EhJqaCX 2DzrWWjGDCewubBzqNyis57TYIYUuOBt6h2x878Lyt+1Hni+H30WjHxRBRietW7/ZLZz u1VFKHTFlEgUzoHo97Ocel53k7SgZrc8UIS0q779fmrQrxSFXML7lTCxDoQJmQxwNPkn o+7yODfJ6jTjFA1cEP/iRPqn2Tonr0HFZToYiQsXFxtxur3Gw+T/iPKlM4H2LQKDhBDa G09A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=X6CSokL+tlCsxDeByodhWOUVqaBLONMpwoVFPjMBGxw=; b=cvZ1Uc4Oqj3Yqo3FJXxm1tqDvRcj/r269iSVC2J0nhdI8w9DG5H47u5OAitd8qJAMc jwZnV4Epj3KFizdGBZRSLpmvgIxuaSmW7Zy1/gyB9ulQXWDs4zQtgFDeQRFPUOt5ESBh xEbY8/cF6sLwmRzNqQV1m0t0jCKx1ozyq88HmeayZtuw16QzgIus+TjpuY+zxnPK2Kxj Wuyq5OFlPnxbiK0e4wpU+3U5JdBVCZOTPbbeSvIeE1AmDQBPl7FmyT8zxuYTSsm4HdzZ xPWiPoHGdZrOrtJ/lBIxpUIBEhZ54qdR0eetP3pGFmXVYM58haV0yFTBqInlOSj0+wbE CRSw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d1-v6si14019930plr.410.2018.05.03.02.58.21; Thu, 03 May 2018 02:58:35 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751355AbeECJ5m (ORCPT + 99 others); Thu, 3 May 2018 05:57:42 -0400 Received: from mga04.intel.com ([192.55.52.120]:51315 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751050AbeECJ5k (ORCPT ); Thu, 3 May 2018 05:57:40 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 May 2018 02:57:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,358,1520924400"; d="scan'208";a="36542217" Received: from debian.sh.intel.com (HELO debian) ([10.67.104.164]) by fmsmga007.fm.intel.com with ESMTP; 03 May 2018 02:57:37 -0700 Date: Thu, 3 May 2018 17:58:23 +0800 From: Tiwei Bie To: Jason Wang Cc: mst@redhat.com, pbonzini@redhat.com, stefanha@redhat.com, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, dan.daly@intel.com, cunming.liang@intel.com, zhihong.wang@intel.com Subject: Re: [RFC] virtio: support VIRTIO_F_IO_BARRIER Message-ID: <20180503095823.zpxskdts7etpwl6x@debian> References: <20180503025955.28816-1-tiwei.bie@intel.com> <20180503083015.kb7po26ga46g66tc@debian> <1292c46c-34ad-ea21-1f05-164044a5f35a@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1292c46c-34ad-ea21-1f05-164044a5f35a@redhat.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 03, 2018 at 05:09:44PM +0800, Jason Wang wrote: > On 2018年05月03日 16:30, Tiwei Bie wrote: > > On Thu, May 03, 2018 at 03:30:03PM +0800, Jason Wang wrote: > > > On 2018年05月03日 10:59, Tiwei Bie wrote: > > > > This patch introduces the support for VIRTIO_F_IO_BARRIER. > > > > When this feature is negotiated, driver will use the barriers > > > > suitable for hardware devices. > > > > > > > > Signed-off-by: Tiwei Bie > > > > --- > > > > drivers/virtio/virtio_ring.c | 5 +++++ > > > > include/uapi/linux/virtio_config.h | 8 +++++++- > > > > 2 files changed, 12 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c > > > > index 21d464a29cf8..edb565643bf4 100644 > > > > --- a/drivers/virtio/virtio_ring.c > > > > +++ b/drivers/virtio/virtio_ring.c > > > > @@ -996,6 +996,9 @@ struct virtqueue *__vring_new_virtqueue(unsigned int index, > > > > !context; > > > > vq->event = virtio_has_feature(vdev, VIRTIO_RING_F_EVENT_IDX); > > > > + if (virtio_has_feature(vdev, VIRTIO_F_IO_BARRIER)) > > > > + vq->weak_barriers = false; > > > > + > > > > /* No callback? Tell other side not to bother us. */ > > > > if (!callback) { > > > > vq->avail_flags_shadow |= VRING_AVAIL_F_NO_INTERRUPT; > > > > @@ -1164,6 +1167,8 @@ void vring_transport_features(struct virtio_device *vdev) > > > > break; > > > > case VIRTIO_F_IOMMU_PLATFORM: > > > > break; > > > > + case VIRTIO_F_IO_BARRIER: > > > > + break; > > > > default: > > > > /* We don't understand this bit. */ > > > > __virtio_clear_bit(vdev, i); > > > > diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h > > > > index 308e2096291f..6ca8d24bf468 100644 > > > > --- a/include/uapi/linux/virtio_config.h > > > > +++ b/include/uapi/linux/virtio_config.h > > > > @@ -49,7 +49,7 @@ > > > > * transport being used (eg. virtio_ring), the rest are per-device feature > > > > * bits. */ > > > > #define VIRTIO_TRANSPORT_F_START 28 > > > > -#define VIRTIO_TRANSPORT_F_END 34 > > > > +#define VIRTIO_TRANSPORT_F_END 38 > > > > #ifndef VIRTIO_CONFIG_NO_LEGACY > > > > /* Do we get callbacks when the ring is completely used, even if we've > > > > @@ -71,4 +71,10 @@ > > > > * this is for compatibility with legacy systems. > > > > */ > > > > #define VIRTIO_F_IOMMU_PLATFORM 33 > > > > + > > > > +/* > > > > + * If clear - driver may use barriers suitable for CPU cores. > > > > + * If set - driver must use barriers suitable for hardware devices. > > > > + */ > > > > +#define VIRTIO_F_IO_BARRIER 37 > > > > #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */ > > > Hi: > > > > > > I believe this depends on Michael's patch of > > > > > > "[PATCH] virtio_ring: switch to dma_XX barriers for rpmsg" > > > > > > ? > > > > > > Thanks > > We already have below commit and some other related commits > > in the tree: > > > > 7b21e34fd1c2 ("virtio: harsher barriers for rpmsg.") > > > > They should have already guaranteed that virtio_Xmb() will > > be OK for hardware devices when vq->weak_barriers is false. > > If my understanding is correct, the barriers used in this > > case are overkill. So Michael's patch is to make the barriers > > weaker (or better). > > > > Best regards, > > Tiwei Bie > > Well, I think we need dma barriers for some platforms according to previous > discussion? Without Michael's patch, we won't use any dma barriers in fact > for virtio. You are right. Thanks! Are you suggesting to add a reference to Michael's patch in this patch to make sure that it won't be applied before that patch? Best regards, Tiwei Bie > > Thanks