From: Rusty Russell <rusty@rustcorp.com.au>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Krishna Kumar <krkumar2@in.ibm.com>,
kvm@vger.kernel.org, Pawel Moll <pawel.moll@arm.com>,
Wang Sheng-Hui <shhuiw@gmail.com>,
Alexey Kardashevskiy <aik@ozlabs.ru>,
lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
virtualization@lists.linux-foundation.org,
Christian Borntraeger <borntraeger@de.ibm.com>,
Sasha Levin <levinsasha928@gmail.com>,
Amit Shah <amit.shah@redhat.com>
Subject: Re: [PATCHv3 RFC] virtio-pci: flexible configuration layout
Date: Thu, 24 Nov 2011 11:06:44 +1030 [thread overview]
Message-ID: <87ty5uxso3.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20111123084640.GE22734@redhat.com>
On Wed, 23 Nov 2011 10:46:41 +0200, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Wed, Nov 23, 2011 at 01:02:22PM +1030, Rusty Russell wrote:
> > On Tue, 22 Nov 2011 20:36:22 +0200, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > Here's an updated vesion.
> > > I'm alternating between updating the spec and the driver,
> > > spec update to follow.
> >
> > Don't touch the spec yet, we have a long way to go :(
> >
> > I want the ability for driver to set the ring size, and the device to
> > set the alignment.
>
> Did you mean driver to be able to set the alignment? This
> is what BIOS guys want - after BIOS completes, guest driver gets handed
> control and sets its own alignment to save memory.
Yep, sorry.
But we really do want the guest to set the ring size. Because it has to
be guest-physical-contiguous, the host currently sets a very small ring,
because the guest is useless if it can't allocate.
Either way, it's now the driver's responsibility to write those fields.
> > That's a bigger change than you have here.
>
> Why can't we just add the new registers at the end?
> With the new capability, we have as much space as we like for that.
We could, for sure.
> > I imagine it almost rips the driver into two completely different drivers.
>
> If you insist on moving all the rest of registers around, certainly. But
> why do this?
Because I suspect we'll be different enough anyway, once we change the
way we allocate the ring, and write the alignment. It'll be *clearer*
to have two completely separate paths than to fill with if() statements.
And a rewrite won't hurt the driver.
But to be honest I don't really care about the Linux driver: we're
steeped in this stuff and we'll get it right. But I'm *terrified* of
making the spec more complex; implementations will get it wrong. I
*really* want to banish the legacy stuff to an appendix where noone will
ever know it's there :)
> Renaming constants in exported headers will break userspace builds.
> Do we care? Why not?
As the patch shows, I decided not to do that. It's a nice heads-up, but
breaking older versions of the code is just mean. Hence this:
> > +#ifndef __KERNEL__
> > +/* Don't break compile of old userspace code. These will go away. */
> > +#define VIRTIO_PCI_HOST_FEATURES VIRTIO_PCI_LEGACY_HOST_FEATURES
> > +#define VIRTIO_PCI_GUEST_FEATURES VIRTIO_PCI_LEGACY_GUEST_FEATURES
> > +#define VIRTIO_PCI_LEGACY_QUEUE_PFN VIRTIO_PCI_QUEUE_PFN
> > +#define VIRTIO_PCI_LEGACY_QUEUE_NUM VIRTIO_PCI_QUEUE_NUM
> > +#define VIRTIO_PCI_LEGACY_QUEUE_SEL VIRTIO_PCI_QUEUE_SEL
> > +#define VIRTIO_PCI_LEGACY_QUEUE_NOTIFY VIRTIO_PCI_QUEUE_NOTIFY
> > +#define VIRTIO_PCI_LEGACY_STATUS VIRTIO_PCI_STATUS
> > +#define VIRTIO_PCI_LEGACY_ISR VIRTIO_PCI_ISR
> > +#define VIRTIO_MSI_LEGACY_CONFIG_VECTOR VIRTIO_MSI_CONFIG_VECTOR
> > +#define VIRTIO_MSI_LEGACY_QUEUE_VECTOR VIRTIO_MSI_QUEUE_VECTOR
> > +#define VIRTIO_PCI_LEGACY_CONFIG(dev) VIRTIO_PCI_CONFIG(dev)
> > +#define VIRTIO_PCI_LEGACY_QUEUE_ADDR_SHIFT VIRTIO_PCI_QUEUE_ADDR_SHIFT
> > +#define VIRTIO_PCI_LEGACY_VRING_ALIGN VIRTIO_PCI_VRING_ALIGN
> > +#endif /* ...!KERNEL */
...
> > +/* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */
> > +struct virtio_pci_common_cfg {
> > + /* About the whole device. */
> > + __u64 device_features; /* read-only */
> > + __u64 guest_features; /* read-write */
> > + __u64 queue_address; /* read-write */
> > + __u16 msix_config; /* read-write */
> > + __u8 device_status; /* read-write */
> > + __u8 unused;
> > +
> > + /* About a specific virtqueue. */
> > + __u16 queue_select; /* read-write */
> > + __u16 queue_align; /* read-write, power of 2. */
> > + __u16 queue_size; /* read-write, power of 2. */
> > + __u16 queue_msix_vector;/* read-write */
> > +};
>
> Slightly confusing as the registers are in fact little endian ...
Good point, should mark them appropriately with __le16. That makes it
even clearer.
Thanks,
Rusty.
WARNING: multiple messages have this Message-ID (diff)
From: Rusty Russell <rusty@rustcorp.com.au>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Sasha Levin <levinsasha928@gmail.com>,
lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>,
Alexey Kardashevskiy <aik@ozlabs.ru>,
Amit Shah <amit.shah@redhat.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Krishna Kumar <krkumar2@in.ibm.com>,
Pawel Moll <pawel.moll@arm.com>,
Wang Sheng-Hui <shhuiw@gmail.com>,
virtualization@lists.linux-foundation.org, kvm@vger.kernel.org
Subject: Re: [PATCHv3 RFC] virtio-pci: flexible configuration layout
Date: Thu, 24 Nov 2011 11:06:44 +1030 [thread overview]
Message-ID: <87ty5uxso3.fsf@rustcorp.com.au> (raw)
In-Reply-To: <20111123084640.GE22734@redhat.com>
On Wed, 23 Nov 2011 10:46:41 +0200, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Wed, Nov 23, 2011 at 01:02:22PM +1030, Rusty Russell wrote:
> > On Tue, 22 Nov 2011 20:36:22 +0200, "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > Here's an updated vesion.
> > > I'm alternating between updating the spec and the driver,
> > > spec update to follow.
> >
> > Don't touch the spec yet, we have a long way to go :(
> >
> > I want the ability for driver to set the ring size, and the device to
> > set the alignment.
>
> Did you mean driver to be able to set the alignment? This
> is what BIOS guys want - after BIOS completes, guest driver gets handed
> control and sets its own alignment to save memory.
Yep, sorry.
But we really do want the guest to set the ring size. Because it has to
be guest-physical-contiguous, the host currently sets a very small ring,
because the guest is useless if it can't allocate.
Either way, it's now the driver's responsibility to write those fields.
> > That's a bigger change than you have here.
>
> Why can't we just add the new registers at the end?
> With the new capability, we have as much space as we like for that.
We could, for sure.
> > I imagine it almost rips the driver into two completely different drivers.
>
> If you insist on moving all the rest of registers around, certainly. But
> why do this?
Because I suspect we'll be different enough anyway, once we change the
way we allocate the ring, and write the alignment. It'll be *clearer*
to have two completely separate paths than to fill with if() statements.
And a rewrite won't hurt the driver.
But to be honest I don't really care about the Linux driver: we're
steeped in this stuff and we'll get it right. But I'm *terrified* of
making the spec more complex; implementations will get it wrong. I
*really* want to banish the legacy stuff to an appendix where noone will
ever know it's there :)
> Renaming constants in exported headers will break userspace builds.
> Do we care? Why not?
As the patch shows, I decided not to do that. It's a nice heads-up, but
breaking older versions of the code is just mean. Hence this:
> > +#ifndef __KERNEL__
> > +/* Don't break compile of old userspace code. These will go away. */
> > +#define VIRTIO_PCI_HOST_FEATURES VIRTIO_PCI_LEGACY_HOST_FEATURES
> > +#define VIRTIO_PCI_GUEST_FEATURES VIRTIO_PCI_LEGACY_GUEST_FEATURES
> > +#define VIRTIO_PCI_LEGACY_QUEUE_PFN VIRTIO_PCI_QUEUE_PFN
> > +#define VIRTIO_PCI_LEGACY_QUEUE_NUM VIRTIO_PCI_QUEUE_NUM
> > +#define VIRTIO_PCI_LEGACY_QUEUE_SEL VIRTIO_PCI_QUEUE_SEL
> > +#define VIRTIO_PCI_LEGACY_QUEUE_NOTIFY VIRTIO_PCI_QUEUE_NOTIFY
> > +#define VIRTIO_PCI_LEGACY_STATUS VIRTIO_PCI_STATUS
> > +#define VIRTIO_PCI_LEGACY_ISR VIRTIO_PCI_ISR
> > +#define VIRTIO_MSI_LEGACY_CONFIG_VECTOR VIRTIO_MSI_CONFIG_VECTOR
> > +#define VIRTIO_MSI_LEGACY_QUEUE_VECTOR VIRTIO_MSI_QUEUE_VECTOR
> > +#define VIRTIO_PCI_LEGACY_CONFIG(dev) VIRTIO_PCI_CONFIG(dev)
> > +#define VIRTIO_PCI_LEGACY_QUEUE_ADDR_SHIFT VIRTIO_PCI_QUEUE_ADDR_SHIFT
> > +#define VIRTIO_PCI_LEGACY_VRING_ALIGN VIRTIO_PCI_VRING_ALIGN
> > +#endif /* ...!KERNEL */
...
> > +/* Fields in VIRTIO_PCI_CAP_COMMON_CFG: */
> > +struct virtio_pci_common_cfg {
> > + /* About the whole device. */
> > + __u64 device_features; /* read-only */
> > + __u64 guest_features; /* read-write */
> > + __u64 queue_address; /* read-write */
> > + __u16 msix_config; /* read-write */
> > + __u8 device_status; /* read-write */
> > + __u8 unused;
> > +
> > + /* About a specific virtqueue. */
> > + __u16 queue_select; /* read-write */
> > + __u16 queue_align; /* read-write, power of 2. */
> > + __u16 queue_size; /* read-write, power of 2. */
> > + __u16 queue_msix_vector;/* read-write */
> > +};
>
> Slightly confusing as the registers are in fact little endian ...
Good point, should mark them appropriately with __le16. That makes it
even clearer.
Thanks,
Rusty.
next prev parent reply other threads:[~2011-11-24 0:36 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 18:36 [PATCHv3 RFC] virtio-pci: flexible configuration layout Michael S. Tsirkin
2011-11-22 18:36 ` Michael S. Tsirkin
2011-11-23 2:32 ` Rusty Russell
2011-11-23 2:32 ` Rusty Russell
2011-11-23 8:46 ` Michael S. Tsirkin
2011-11-23 8:46 ` Michael S. Tsirkin
2011-11-23 15:34 ` Michael S. Tsirkin
2011-11-23 15:34 ` Michael S. Tsirkin
2011-11-24 0:36 ` Rusty Russell [this message]
2011-11-24 0:36 ` Rusty Russell
2011-11-24 6:24 ` Michael S. Tsirkin
2011-11-24 6:24 ` Michael S. Tsirkin
2011-11-24 7:11 ` Michael S. Tsirkin
2011-11-24 7:11 ` Michael S. Tsirkin
2011-11-28 0:55 ` Rusty Russell
2011-11-28 0:55 ` Rusty Russell
2011-11-28 8:41 ` Michael S. Tsirkin
2011-11-28 8:41 ` Michael S. Tsirkin
2011-11-29 23:28 ` Rusty Russell
2011-11-29 23:28 ` Rusty Russell
2011-11-30 7:18 ` Michael S. Tsirkin
2011-11-30 7:18 ` Michael S. Tsirkin
2011-11-28 9:15 ` Sasha Levin
2011-11-28 9:15 ` Sasha Levin
2011-11-29 23:40 ` Rusty Russell
2011-11-29 23:40 ` Rusty Russell
2011-11-30 8:14 ` Michael S. Tsirkin
2011-11-30 8:14 ` Michael S. Tsirkin
2011-11-30 13:12 ` Sasha Levin
2011-11-30 13:12 ` Sasha Levin
2011-12-01 2:42 ` Rusty Russell
2011-12-01 2:42 ` Rusty Russell
2011-11-23 8:49 ` Michael S. Tsirkin
2011-11-23 8:49 ` Michael S. Tsirkin
2011-11-23 9:38 ` Sasha Levin
2011-11-23 9:38 ` Sasha Levin
2011-11-24 1:07 ` Rusty Russell
2011-11-24 1:07 ` Rusty Russell
2011-11-23 9:44 ` Sasha Levin
2011-11-23 9:44 ` Sasha Levin
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=87ty5uxso3.fsf@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=aik@ozlabs.ru \
--cc=amit.shah@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=krkumar2@in.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=levinsasha928@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=pawel.moll@arm.com \
--cc=shhuiw@gmail.com \
--cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.