mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 00/19] virtio: alignment issues
Date: Tue, 7 Apr 2020 05:48:55 -0400	[thread overview]
Message-ID: <20200407054619-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <146472340.20929248.1586230892042.JavaMail.zimbra@redhat.com>

On Mon, Apr 06, 2020 at 11:41:32PM -0400, Jason Wang wrote:
> ----- Original Message -----
> > 
> > This is an alternative to
> > 	vhost: force spec specified alignment on types
> > which is a bit safer as it does not change UAPI.
> > I still think it's best to change the UAPI header as well,
> > we can do that as a follow-up cleanup.
> > 
> > changes from v6:
> > 	add missing header includes all over the place
> > changes from v5:
> > 	ack for mellanox patch
> > 	fixup to remoteproc
> > changes from v4:
> > 	fixup to issues reported by kbuild
> > changes from v3:
> > 	tools/virtio fixes
> > 	a bunch more cleanups that now become possible
> > 
> > Changes from v2:
> > 	don't change struct name, instead add ifndef
> > 	so kernel does not see the legacy UAPI version.
> > 
> > Jason, can you pls ack one of the approaches?
> 
> I prefer this approach but it looks a little bit risky for 5.7. Can we
> do this in 5.8?

It's not rc1 even yet, I think it's fine.

> Instead of using Kconfig, could we simply fail the initalization of
> vhost like:
> 
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 0395229486a9..e9f6a008ed12 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -2636,6 +2636,11 @@ EXPORT_SYMBOL_GPL(vhost_dequeue_msg);
>  
>  static int __init vhost_init(void)
>  {
> +	struct vhost_virtqueue *vq;
> +
> +	if (__alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE)
> +		return -ENOTSUPP;
> +
>  	return 0;
>  }
> 
> Thanks

It's not just vhost, vringh is also broken.

It's not even rc1 yet, and I really like the resulting cleanup.
So I pushed this to next and it all seems to work pretty well,
I think I'll go with this.

> > 
> > 
> > Matej Genci (1):
> >   virtio: add VIRTIO_RING_NO_LEGACY
> > 
> > Michael S. Tsirkin (18):
> >   tools/virtio: define aligned attribute
> >   tools/virtio: make asm/barrier.h self contained
> >   tools/virtio: define __KERNEL__
> >   virtgpu: pull in uaccess.h
> >   virtio-rng: pull in slab.h
> >   remoteproc: pull in slab.h
> >   virtio_input: pull in slab.h
> >   virtio: stop using legacy struct vring in kernel
> >   vhost: force spec specified alignment on types
> >   virtio: add legacy init/size APIs
> >   virtio_ring: switch to virtio_legacy_init/size
> >   tools/virtio: switch to virtio_legacy_init/size
> >   vop: switch to virtio_legacy_init/size
> >   remoteproc: switch to virtio_legacy_init/size
> >   mellanox: switch to virtio_legacy_init/size
> >   vhost: option to fetch descriptors through an independent struct
> >   vhost: use batched version by default
> >   vhost: batching fetches
> > 
> >  drivers/block/virtio_blk.c               |   1 +
> >  drivers/char/hw_random/virtio-rng.c      |   1 +
> >  drivers/gpu/drm/virtio/virtgpu_ioctl.c   |   1 +
> >  drivers/misc/mic/vop/vop_main.c          |   5 +-
> >  drivers/misc/mic/vop/vop_vringh.c        |   8 +-
> >  drivers/platform/mellanox/mlxbf-tmfifo.c |   6 +-
> >  drivers/remoteproc/remoteproc_core.c     |   2 +-
> >  drivers/remoteproc/remoteproc_sysfs.c    |   1 +
> >  drivers/remoteproc/remoteproc_virtio.c   |   2 +-
> >  drivers/vhost/test.c                     |   2 +-
> >  drivers/vhost/vhost.c                    | 271 +++++++++++++++--------
> >  drivers/vhost/vhost.h                    |  23 +-
> >  drivers/virtio/virtio_input.c            |   1 +
> >  drivers/virtio/virtio_pci_modern.c       |   1 +
> >  drivers/virtio/virtio_ring.c             |  15 +-
> >  include/linux/virtio.h                   |   1 -
> >  include/linux/virtio_ring.h              |  46 ++++
> >  include/linux/vringh.h                   |   1 +
> >  include/uapi/linux/virtio_ring.h         |  30 ++-
> >  tools/virtio/Makefile                    |   2 +-
> >  tools/virtio/asm/barrier.h               |   1 +
> >  tools/virtio/linux/compiler.h            |   1 +
> >  tools/virtio/ringtest/virtio_ring_0_9.c  |   6 +-
> >  tools/virtio/virtio_test.c               |   6 +-
> >  tools/virtio/vringh_test.c               |  18 +-
> >  25 files changed, 311 insertions(+), 141 deletions(-)
> > 
> > --
> > MST
> > 
> > 
> 
> > 


      reply	other threads:[~2020-04-07  9:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-07  1:07 Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 01/19] tools/virtio: define aligned attribute Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 02/19] tools/virtio: make asm/barrier.h self contained Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 03/19] tools/virtio: define __KERNEL__ Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 04/19] virtio: add VIRTIO_RING_NO_LEGACY Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 05/19] virtgpu: pull in uaccess.h Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 06/19] virtio-rng: pull in slab.h Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 07/19] remoteproc: " Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 08/19] virtio_input: " Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 09/19] virtio: stop using legacy struct vring in kernel Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 10/19] vhost: force spec specified alignment on types Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 11/19] virtio: add legacy init/size APIs Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 12/19] virtio_ring: switch to virtio_legacy_init/size Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 13/19] tools/virtio: " Michael S. Tsirkin
2020-04-07  1:07 ` [PATCH v7 14/19] vop: " Michael S. Tsirkin
2020-04-07  1:08 ` [PATCH v7 15/19] remoteproc: " Michael S. Tsirkin
2020-04-07  1:08 ` [PATCH v7 16/19] mellanox: " Michael S. Tsirkin
2020-04-07  1:08 ` [PATCH v7 17/19] vhost: option to fetch descriptors through an independent struct Michael S. Tsirkin
2020-04-07  1:08 ` [PATCH v7 18/19] vhost: use batched version by default Michael S. Tsirkin
2020-04-07  1:08 ` [PATCH v7 19/19] vhost: batching fetches Michael S. Tsirkin
2020-04-07  3:41 ` [PATCH v7 00/19] virtio: alignment issues Jason Wang
2020-04-07  9:48   ` Michael S. Tsirkin [this message]

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=20200407054619-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®