All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Tiwei Bie <tiwei.bie@intel.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	virtio@lists.oasis-open.org, virtio-dev@lists.oasis-open.org,
	cunming.liang@intel.com, kully.dhanoa@intel.com
Subject: [virtio] Re: [virtio-dev] Re: [virtio] [PATCH v7 08/11] packed virtqueues: more efficient virtqueue layout
Date: Thu, 1 Feb 2018 11:11:28 +0100	[thread overview]
Message-ID: <20180201111128.13aead66.cohuck@redhat.com> (raw)
In-Reply-To: <20180201030535.xog5zajata4sohph@debian-xvivbkq.sh.intel.com>

On Thu, 1 Feb 2018 11:05:35 +0800
Tiwei Bie <tiwei.bie@intel.com> wrote:

> On Tue, Jan 30, 2018 at 09:40:35PM +0200, Michael S. Tsirkin wrote:
> > On Tue, Jan 30, 2018 at 02:50:44PM +0100, Cornelia Huck wrote:  
> > > On Tue, 23 Jan 2018 02:01:07 +0200
> > > "Michael S. Tsirkin" <mst@redhat.com> wrote:

> > > > +\subsubsection{Driver notifications}
> > > > +\label{sec:Packed Virtqueues / Driver notifications}
> > > > +Whenever not suppressed by Device Event Suppression,
> > > > +driver is required to notify the device after
> > > > +making changes to the virtqueue.
> > > > +
> > > > +Some devices benefit from ability to find out the number of
> > > > +available descriptors in the ring, and whether to send
> > > > +interrupts to drivers without accessing virtqueue in memory:
> > > > +for efficiency or as a debugging aid.
> > > > +
> > > > +To help with these optimizations, driver notifications
> > > > +to the device include the following information:
> > > > +
> > > > +\begin{itemize}
> > > > +\item VQ number
> > > > +\item Offset (in units of descriptor size) within the ring
> > > > +      where the next available descriptor will be written
> > > > +\item Wrap Counter referring to the next available
> > > > +      descriptor
> > > > +\end{itemize}
> > > > +
> > > > +Note that driver can trigger multiple notifications even without
> > > > +making any more changes to the ring. These would then have
> > > > +identical \field{Offset} and \field{Wrap Counter} values.  
> > > 
> > > (...)
> > >   
> > > > +\subsection{Driver Notification Format}\label{sec:Basic
> > > > +Facilities of a Virtio Device / Packed Virtqueues / Driver Notification Format}
> > > > +
> > > > +The following structure is used to notify device of
> > > > +device events - i.e. available descriptors:
> > > > +
> > > > +\begin{lstlisting}
> > > > +__le16 vqn;
> > > > +__le16 next_off : 15;
> > > > +int    next_wrap : 1;
> > > > +\end{lstlisting}  
> > > 
> > > (...)
> > >   
> > > > +\subsubsection{Notifying The Device}\label{sec:Basic Facilities
> > > > +of a Virtio Device / Packed Virtqueues / Supplying Buffers to The Device / Notifying The Device}
> > > > +
> > > > +The actual method of device notification is bus-specific, but generally
> > > > +it can be expensive.  So the device MAY suppress such notifications if it
> > > > +doesn't need them, using the Driver Event Suppression structure
> > > > +as detailed in section \ref{sec:Basic
> > > > +Facilities of a Virtio Device / Packed Virtqueues / Event
> > > > +Suppression Structure Format}.
> > > > +
> > > > +The driver has to be careful to expose the new \field{flags}
> > > > +value before checking if notifications are suppressed.  
> > > 
> > > This is all I could find regarding notifications, and it leaves me
> > > puzzled how notifications are actually supposed to work; especially,
> > > where that driver notification structure is supposed to be relayed.
> > > 
> > > I'm obviously coming from a ccw perspective, but I don't think that pci
> > > is all that different (well, hopefully).
> > > 
> > > Up to now, we notified for a certain virtqueue -- i.e., the device
> > > driver notified the device that there is something to process for a
> > > certain queue. ccw uses the virtqueue number in a gpr for a hypercall,
> > > pci seems to use a write to the config space IIUC. With the packed
> > > layout, we have more payload per notification. We should be able to put
> > > it in the same gpr than the virtqueue for ccw (if needed, with some
> > > compat magic, or with a new hypercall, which would be ugly but doable).
> > > Not sure how this is supposed to work with pci.
> > > 
> > > Has there been any prototyping done to implement this in qemu + KVM?
> > > I'm unsure how this will work with ioeventfds, which just trigger.  
> > 
> > The PCI MMIO version would just trigger on access to a specific
> > address, ignoring all data in there. PIO would need something
> > like a data mask so it can ignore everything except the vq #.
> > 
> > This is helpful for hardware offloads but I'm open to
> > making this PCI specific or deferring until we have
> > explicit support for hardware offloads.
> > 
> > What do you think?
> >   
> 
> Hi,
> 
> I prefer to keep it (at least for PCI) and refine it if
> necessary.
> 
> Because one of the important goals of packed ring is to
> be hardware friendly. Supporting tail pointer is one of
> the important things to make it hardware friendly. More
> details could be found in Kully's below mail (I've done
> some slight reformatting):
> 
> ----- START -----

<thanks for the explanation>

> ----- END -----

So, my takeaway is here:

- Having this information (or a variant of it) available on
  notification is useful.
- The specifics on how to convey the info are still a bit unsettled.

I think this should be optionally available to any transport (i.e. not
pci-specific). What about the following wording:

"Driver notifications to the device include the virtqueue number. To
help with these optimizations, they also may include the following
information: ..."

(With some MUST/MAY wording in the normative sections, I guess.)

Also, I think the notification structure should not include any
endianness requirements. For ccw, we notify via a hypercall with the
payload in the GPRs, which are big endian. I would like to avoid
conversions in that case. Maybe make the details of how the information
is included entirely transport-specific?

---------------------------------------------------------------------
To unsubscribe from this mail list, you must leave the OASIS TC that 
generates this mail.  Follow this link to all your TCs in OASIS at:
https://www.oasis-open.org/apps/org/workgroup/portal/my_workgroups.php 


  reply	other threads:[~2018-02-01 10:11 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10  9:47 [virtio] [PATCH v6 0/5] packed ring layout spec Michael S. Tsirkin
2018-01-10  9:47 ` [virtio] [PATCH v6 1/5] content: move 1.0 queue format out to a separate section Michael S. Tsirkin
2018-01-10 12:45   ` Cornelia Huck
2018-01-10  9:47 ` [virtio] [PATCH v6 2/5] content: move ring text out to a separate file Michael S. Tsirkin
2018-01-10 12:46   ` Cornelia Huck
2018-01-10  9:47 ` [virtio] [PATCH v6 3/5] content: move virtqueue operation description Michael S. Tsirkin
2018-01-10 12:48   ` Cornelia Huck
2018-01-10  9:47 ` [virtio] [PATCH v6 4/5] packed virtqueues: more efficient virtqueue layout Michael S. Tsirkin
2018-01-10 10:47   ` Cornelia Huck
2018-01-10 13:49   ` [virtio-dev] " Jens Freimann
2018-01-10 14:39     ` [virtio] " Michael S. Tsirkin
2018-01-10 14:08   ` Tiwei Bie
2018-01-10 14:39     ` [virtio] " Michael S. Tsirkin
2018-01-10 14:15   ` [virtio] " Cornelia Huck
2018-01-10 15:37     ` Michael S. Tsirkin
2018-01-10  9:47 ` [virtio] [PATCH v6 5/5] packed-ring: add in order request support Michael S. Tsirkin
2018-01-10 10:33 ` [virtio] [PATCH v6 0/5] packed ring layout spec Cornelia Huck
2018-01-10 11:10   ` Michael S. Tsirkin
2018-01-10 11:14     ` Cornelia Huck
2018-01-10 11:16       ` Michael S. Tsirkin
2018-01-23  0:01 ` [virtio] [PATCH v7 02/11] content: move ring text out to a separate file Michael S. Tsirkin
2018-01-30 10:07   ` Cornelia Huck
2018-01-23  0:01 ` [virtio] [PATCH v7 01/11] content: move 1.0 queue format out to a separate section Michael S. Tsirkin
2018-01-30 10:06   ` Cornelia Huck
2018-02-05 22:54   ` Halil Pasic
2018-02-06  0:05     ` Michael S. Tsirkin
2018-02-06  8:38       ` Cornelia Huck
2018-02-06 11:10       ` [virtio] Re: [virtio-dev] " Halil Pasic
2018-02-06 11:20         ` Cornelia Huck
2018-02-06 12:03           ` Halil Pasic
2018-02-06 22:58         ` Michael S. Tsirkin
2018-01-23  0:01 ` [virtio] [PATCH v7 03/11] content: move virtqueue operation description Michael S. Tsirkin
2018-01-30 10:12   ` Cornelia Huck
2018-01-23  0:01 ` [virtio] [PATCH v7 04/11] content: replace mentions of len with used length Michael S. Tsirkin
2018-01-30 10:16   ` Cornelia Huck
2018-01-30 16:38     ` Michael S. Tsirkin
2018-01-23  0:01 ` [virtio] [PATCH v7 05/11] content: generalize transport ring part naming Michael S. Tsirkin
2018-01-30 10:27   ` Cornelia Huck
2018-01-23  0:01 ` [virtio] [PATCH v7 06/11] content: generalize rest of text Michael S. Tsirkin
2018-01-30 10:31   ` Cornelia Huck
2018-01-30 16:40     ` Michael S. Tsirkin
2018-01-23  0:01 ` [virtio] [PATCH v7 07/11] split-ring: generalize text Michael S. Tsirkin
2018-01-30 10:45   ` Cornelia Huck
2018-01-30 16:42     ` Michael S. Tsirkin
2018-01-23  0:01 ` [virtio] [PATCH v7 08/11] packed virtqueues: more efficient virtqueue layout Michael S. Tsirkin
2018-01-30  7:16   ` [virtio-dev] " Tiwei Bie
2018-01-30 16:45     ` [virtio] " Michael S. Tsirkin
2018-01-30 13:07   ` Jens Freimann
2018-01-30 13:50   ` [virtio] " Cornelia Huck
2018-01-30 19:40     ` Michael S. Tsirkin
2018-02-01  3:05       ` [virtio-dev] " Tiwei Bie
2018-02-01 10:11         ` Cornelia Huck [this message]
2018-02-01 14:43           ` [virtio] " Michael S. Tsirkin
2018-02-05 11:54     ` Halil Pasic
2018-02-05 14:33       ` Michael S. Tsirkin
2018-02-05 16:57         ` Halil Pasic
2018-02-05 17:00           ` Paolo Bonzini
2018-02-05 18:16             ` Cornelia Huck
2018-02-05 18:21               ` Michael S. Tsirkin
2018-02-05 18:26                 ` Cornelia Huck
2018-02-05 17:55           ` Michael S. Tsirkin
2018-02-05 22:57   ` [virtio] Re: [virtio-dev] " Halil Pasic
2018-01-23  0:01 ` [virtio] [PATCH v7 09/11] content: in-order buffer use Michael S. Tsirkin
2018-02-01 11:01   ` Cornelia Huck
2018-02-12 13:18   ` Stefan Hajnoczi
2018-01-23  0:01 ` [virtio] [PATCH v7 11/11] split-ring: in order feature Michael S. Tsirkin
2018-02-02 11:06   ` Cornelia Huck
2018-02-12 13:23   ` Stefan Hajnoczi
2018-01-23  0:01 ` [virtio] [PATCH v7 10/11] packed-ring: add in order support Michael S. Tsirkin
2018-02-02 11:03   ` Cornelia Huck
2018-02-12 13:22   ` Stefan Hajnoczi

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=20180201111128.13aead66.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=cunming.liang@intel.com \
    --cc=kully.dhanoa@intel.com \
    --cc=mst@redhat.com \
    --cc=tiwei.bie@intel.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtio@lists.oasis-open.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.