LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v1] virtio: support VIRTIO_F_IO_BARRIER
@ 2018-05-04  4:59 Tiwei Bie
  2018-05-10  9:53 ` [virtio-dev] " Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Tiwei Bie @ 2018-05-04  4:59 UTC (permalink / raw)
  To: mst, jasowang, pbonzini, stefanha, virtualization, linux-kernel,
	virtio-dev
  Cc: dan.daly, cunming.liang, zhihong.wang

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 <tiwei.bie@intel.com>
---
This patch depends on below proposal for virtio-spec:
https://lists.oasis-open.org/archives/virtio-dev/201805/msg00019.html

This patch also depends on below patch:
https://lkml.org/lkml/2018/4/19/789

RFC -> v1:
- Address the changes in the proposal;

 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..9fb519a9df28 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		37
 
 #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		36
 #endif /* _UAPI_LINUX_VIRTIO_CONFIG_H */
-- 
2.11.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [virtio-dev] [PATCH v1] virtio: support VIRTIO_F_IO_BARRIER
  2018-05-04  4:59 [PATCH v1] virtio: support VIRTIO_F_IO_BARRIER Tiwei Bie
@ 2018-05-10  9:53 ` Stefan Hajnoczi
  2018-05-10 10:39   ` Tiwei Bie
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2018-05-10  9:53 UTC (permalink / raw)
  To: Tiwei Bie
  Cc: mst, jasowang, pbonzini, virtualization, linux-kernel,
	virtio-dev, dan.daly, cunming.liang, zhihong.wang

[-- Attachment #1: Type: text/plain, Size: 718 bytes --]

On Fri, May 04, 2018 at 12:59:15PM +0800, Tiwei Bie wrote:
> diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
> index 308e2096291f..9fb519a9df28 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		37

Have you updated "2.2 Feature Bits" in the VIRTIO spec?

In 1.0 it says:

 24 to 32
    Feature bits reserved for extensions to the queue and feature negotiation mechanisms

This information is out-of-date.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1] virtio: support VIRTIO_F_IO_BARRIER
  2018-05-10  9:53 ` [virtio-dev] " Stefan Hajnoczi
@ 2018-05-10 10:39   ` Tiwei Bie
  2018-05-10 15:02     ` [virtio-dev] " Stefan Hajnoczi
  0 siblings, 1 reply; 5+ messages in thread
From: Tiwei Bie @ 2018-05-10 10:39 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: mst, jasowang, pbonzini, virtualization, linux-kernel,
	virtio-dev, dan.daly, cunming.liang, zhihong.wang

On Thu, May 10, 2018 at 10:53:17AM +0100, Stefan Hajnoczi wrote:
> On Fri, May 04, 2018 at 12:59:15PM +0800, Tiwei Bie wrote:
> > diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
> > index 308e2096291f..9fb519a9df28 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		37
> 
> Have you updated "2.2 Feature Bits" in the VIRTIO spec?
> 
> In 1.0 it says:
> 
>  24 to 32
>     Feature bits reserved for extensions to the queue and feature negotiation mechanisms
> 
> This information is out-of-date.
> 

No. In the latest spec draft, it's 24 to 33. And it
becomes out-of-date since VIRTIO_F_RING_PACKED(34)
and VIRTIO_F_IN_ORDER(35) were introduced. Do you
want me to update it in the IO_BARRIER patch or do
you want me to update it in a new patch?

Best regards,
Tiwei Bie

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [virtio-dev] Re: [PATCH v1] virtio: support VIRTIO_F_IO_BARRIER
  2018-05-10 10:39   ` Tiwei Bie
@ 2018-05-10 15:02     ` Stefan Hajnoczi
  2018-05-10 15:36       ` Tiwei Bie
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Hajnoczi @ 2018-05-10 15:02 UTC (permalink / raw)
  To: Tiwei Bie
  Cc: mst, jasowang, pbonzini, virtualization, linux-kernel,
	virtio-dev, dan.daly, cunming.liang, zhihong.wang

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

On Thu, May 10, 2018 at 06:39:41PM +0800, Tiwei Bie wrote:
> On Thu, May 10, 2018 at 10:53:17AM +0100, Stefan Hajnoczi wrote:
> > On Fri, May 04, 2018 at 12:59:15PM +0800, Tiwei Bie wrote:
> > > diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
> > > index 308e2096291f..9fb519a9df28 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		37
> > 
> > Have you updated "2.2 Feature Bits" in the VIRTIO spec?
> > 
> > In 1.0 it says:
> > 
> >  24 to 32
> >     Feature bits reserved for extensions to the queue and feature negotiation mechanisms
> > 
> > This information is out-of-date.
> > 
> 
> No. In the latest spec draft, it's 24 to 33. And it
> becomes out-of-date since VIRTIO_F_RING_PACKED(34)
> and VIRTIO_F_IN_ORDER(35) were introduced. Do you
> want me to update it in the IO_BARRIER patch or do
> you want me to update it in a new patch?

Please update it to 37 in the IO_BARRIER patch.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [virtio-dev] Re: [PATCH v1] virtio: support VIRTIO_F_IO_BARRIER
  2018-05-10 15:02     ` [virtio-dev] " Stefan Hajnoczi
@ 2018-05-10 15:36       ` Tiwei Bie
  0 siblings, 0 replies; 5+ messages in thread
From: Tiwei Bie @ 2018-05-10 15:36 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: mst, jasowang, pbonzini, virtualization, linux-kernel,
	virtio-dev, dan.daly, cunming.liang, zhihong.wang

On Thu, May 10, 2018 at 04:02:58PM +0100, Stefan Hajnoczi wrote:
> On Thu, May 10, 2018 at 06:39:41PM +0800, Tiwei Bie wrote:
> > On Thu, May 10, 2018 at 10:53:17AM +0100, Stefan Hajnoczi wrote:
> > > On Fri, May 04, 2018 at 12:59:15PM +0800, Tiwei Bie wrote:
> > > > diff --git a/include/uapi/linux/virtio_config.h b/include/uapi/linux/virtio_config.h
> > > > index 308e2096291f..9fb519a9df28 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		37
> > > 
> > > Have you updated "2.2 Feature Bits" in the VIRTIO spec?
> > > 
> > > In 1.0 it says:
> > > 
> > >  24 to 32
> > >     Feature bits reserved for extensions to the queue and feature negotiation mechanisms
> > > 
> > > This information is out-of-date.
> > > 
> > 
> > No. In the latest spec draft, it's 24 to 33. And it
> > becomes out-of-date since VIRTIO_F_RING_PACKED(34)
> > and VIRTIO_F_IN_ORDER(35) were introduced. Do you
> > want me to update it in the IO_BARRIER patch or do
> > you want me to update it in a new patch?
> 
> Please update it to 37 in the IO_BARRIER patch.

Will do it! Thanks!

Best regards,
Tiwei Bie

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-05-10 15:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04  4:59 [PATCH v1] virtio: support VIRTIO_F_IO_BARRIER Tiwei Bie
2018-05-10  9:53 ` [virtio-dev] " Stefan Hajnoczi
2018-05-10 10:39   ` Tiwei Bie
2018-05-10 15:02     ` [virtio-dev] " Stefan Hajnoczi
2018-05-10 15:36       ` Tiwei Bie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).