All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Freimann <jfreimann@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>,
	"Steven Luong (sluong)" <sluong@cisco.com>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>
Subject: Re: [virtio-dev] packed ring layout proposal v3
Date: Wed, 4 Oct 2017 14:39:01 +0200	[thread overview]
Message-ID: <20171004123901.oomueufqg52uhas4@localhost.localdomain> (raw)
In-Reply-To: <20171001063817-mutt-send-email-mst@kernel.org>

On Sun, Oct 01, 2017 at 04:08:29AM +0000, Michael S. Tsirkin wrote:
>On Thu, Sep 28, 2017 at 09:44:35AM +0000, Liang, Cunming wrote:
>>
>> Get it now. Please correct me if I missing something.
>>
>>
>> Flags status hints,
>>
>> - DESC_DRIVER only: driver owns the descriptor w/o available info ready for device to use
>>
>> - DESC_DRIVER | DESC_WRAP: driver has prepared an available descriptor, device hasn't used it yet
>>
>> - None: device has used the descriptor, and write descriptor out
>>
>> - DESC_WRAP only: shall not happen, device make sure to clear it
>>
>>
>> Polling behavior is,
>>
>> - Device monitor DESC_WRAP bit set or not; If set, go to use descriptor and clear DESC_DRIVER bit in the end (note: always need to clear DESC_WRAP)
>>
>> - Driver monitor DESC_DRIVER bit cleared or not; If cleared, reclaim descriptor(set DESC_DRIVER) and set DESC_WRAP once new available descriptor get ready to go
>>
>>
>> --
>> Steve
>
>
>Hmm no, not what I had in mind.
>
>DESC_DRIVER: used by driver to poll. Driver sets it when writing a
>descriptor.  Device clears it when overwriting a descriptor.
>Thus driver uses DESC_DRIVER to detect that device data in
>descriptor is valid.

Basically DESC_HW from v2 split in two?

>
>DESC_WRAP: used by device to poll. Driver sets it to a *different*
>value every time it overwrites a descriptor. 
>How to achieve it?
>since descriptors are written out in ring order,
>simply maintain the current value internally (start value 1) and flip it
>every time you overwrite the first descriptor.
>Device leaves it intact when overwriting a descriptor.

This is confusing me a bit.

My understanding is: 
1. the internally kept wrap value only flipped when the first
descriptor is overwritten

2. the moment the first descriptor is written the internal wrap value
is flipped 0->1 or 1->0 and this value is written to every descriptor
DESC_WRAP until we reach the first descriptor again

>
>After writing down this explanation, I think the names aren't
>great.
>
>Let me try an alternative explanation.
>
>---------------
>A two-bit field, DRIVER_OWNER, signals the buffer ownership.
>It has 4 possible values:
>values 0x1, 0x11 are written by driver
>values 0x0, 0x10 are written by device

The 0x prefix might add to the confusion here. It is really just two
bits, no?

>each time driver writes out a descriptor, it must make sure
>that the high bit in OWNER changes.
>
>each time device writes out a descriptor, it must make sure
>that the high bit in OWNER does not change.
>
>this is exactly the same functionally, DRIVER is high bit and
>WRAP is the low bit.  Does this make things clearer?

So far it makes sense to me.
>---------------
>
>
>
>Maybe the difference between device and driver
>is confusing. We can fix that by changing the values.
>Here is an alternative. Let me know if you like it better -
>I need to think a bit more to make sure it works,
>but to give you an idea:
>
>
>---------------
>A two-bit field, DRIVER_OWNER, signals the buffer ownership.
>It has 4 possible values:
>values 0x1, 0x10 are written by driver
>values 0x0, 0x11 are written by device
>
>each time driver writes out a descriptor, it must make sure
>that the high bit in OWNER changes. Thus first time
>it writes 0x10, next time 0x1, then 0x10 again.
>
>each time device writes out a descriptor, it must make sure
>that the low bit in OWNER changes.  Thus first time
>it writes 0x11, next time 0x0, then 0x11 again.

DESC_WRAP is changed by the device now, so this would work differently
than in the scenario from above. 
This would mean we don't need the internally kept wrap value, right?


regards,
Jens 

  reply	other threads:[~2017-10-04 12:39 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-10  5:06 [virtio-dev] packed ring layout proposal v3 Michael S. Tsirkin
2017-02-08 13:37 ` packed ring layout proposal v2 Christian Borntraeger
2017-02-09 17:43   ` Michael S. Tsirkin
     [not found]   ` <20170209181955-mutt-send-email-mst@kernel.org>
2017-02-09 18:27     ` Christian Borntraeger
2017-02-08 17:41 ` [virtio-dev] " Paolo Bonzini
2017-02-08 19:59   ` Michael S. Tsirkin
     [not found]   ` <20170208214435-mutt-send-email-mst@kernel.org>
2017-02-09 15:48     ` Paolo Bonzini
2017-02-09 16:11       ` Cornelia Huck
2017-02-09 18:24       ` Michael S. Tsirkin
     [not found]       ` <20170209202203-mutt-send-email-mst@kernel.org>
2017-02-10 11:32         ` Paolo Bonzini
     [not found]         ` <c229269b-1702-ffec-62e8-002c7c142904@redhat.com>
2017-02-10 15:20           ` Michael S. Tsirkin
2017-02-10 16:17             ` Paolo Bonzini
     [not found]       ` <20170209171105.075a9d9c.cornelia.huck@de.ibm.com>
2017-02-22 16:43         ` Michael S. Tsirkin
     [not found]         ` <20170222181333-mutt-send-email-mst@kernel.org>
2017-03-07 15:53           ` Cornelia Huck
2017-03-07 20:33             ` Michael S. Tsirkin
     [not found]             ` <20170307223057-mutt-send-email-mst@kernel.org>
2017-07-10 16:27               ` Amnon Ilan
2017-07-10 16:27               ` Amnon Ilan
2017-02-22  4:27 ` packed ring layout proposal - todo list Michael S. Tsirkin
     [not found] ` <20170222054336-mutt-send-email-mst@kernel.org>
2017-02-22  9:19   ` [virtio-dev] " Gray, Mark D
     [not found]   ` <738D45BC1F695740A983F43CFE1B7EA94E93CA7E@IRSMSX108.ger.corp.intel.com>
2017-02-22 15:13     ` Michael S. Tsirkin
2017-02-28  4:29   ` Yuanhan Liu
     [not found]   ` <20170228042943.GH18844@yliu-dev.sh.intel.com>
2017-03-01  1:07     ` Michael S. Tsirkin
2017-03-08  7:09       ` Yuanhan Liu
     [not found]       ` <20170308070948.GC18844@yliu-dev.sh.intel.com>
2017-03-08  7:56         ` Yuanhan Liu
     [not found]         ` <20170308075624.GF18844@yliu-dev.sh.intel.com>
2017-03-29 12:39           ` Michael S. Tsirkin
2017-04-01  7:30             ` Yuanhan Liu
2017-02-22 14:46 ` [virtio-dev] packed ring layout proposal v2 Chien, Roger S
2017-02-28  5:02 ` Yuanhan Liu
2017-02-28  5:47 ` [RFC] packed (virtio-net) headers Yuanhan Liu
     [not found] ` <20170228050218.GI18844@yliu-dev.sh.intel.com>
2017-03-01  1:02   ` [virtio-dev] packed ring layout proposal v2 Michael S. Tsirkin
     [not found]   ` <20170301024951-mutt-send-email-mst@kernel.org>
2017-03-01  3:57     ` Yuanhan Liu
     [not found]     ` <20170301035715.GP18844@yliu-dev.sh.intel.com>
2017-03-01  4:14       ` Michael S. Tsirkin
2017-03-01  4:57         ` Yuanhan Liu
     [not found] ` <20170228054719.GJ18844@yliu-dev.sh.intel.com>
2017-03-01  1:28   ` [RFC] packed (virtio-net) headers Michael S. Tsirkin
2017-07-16  6:00 ` [virtio-dev] packed ring layout proposal v2 Lior Narkis
2017-07-18 16:23   ` Michael S. Tsirkin
2017-07-18 16:23     ` Michael S. Tsirkin
2017-07-19  7:41     ` Lior Narkis
2017-07-20 13:06       ` Michael S. Tsirkin
2017-07-20 13:06         ` Michael S. Tsirkin
2017-07-19  7:41     ` Lior Narkis
2017-07-16  6:00 ` Lior Narkis
2017-09-11  7:47 ` [virtio-dev] Re: packed ring layout proposal v3 Jason Wang
2017-09-12 16:23   ` Willem de Bruijn
2017-09-13  1:26     ` Jason Wang
2017-09-13  1:26     ` Jason Wang
2017-09-12 16:23   ` Willem de Bruijn
2017-09-11  7:47 ` Jason Wang
2017-09-12 16:20 ` [virtio-dev] " Willem de Bruijn
2017-09-12 16:20 ` Willem de Bruijn
2017-09-14  8:23 ` Ilya Lesokhin
2017-09-20  9:11 ` [virtio-dev] " Liang, Cunming
2017-09-20  9:11   ` Liang, Cunming
2017-09-25 22:24   ` Michael S. Tsirkin
2017-09-25 22:24   ` Michael S. Tsirkin
2017-09-26 23:38     ` Steven Luong (sluong)
2017-09-27 23:49       ` Michael S. Tsirkin
2017-09-27 23:49         ` Michael S. Tsirkin
2017-09-28  9:44         ` Liang, Cunming
2017-10-01  4:08           ` Michael S. Tsirkin
2017-10-01  4:08             ` Michael S. Tsirkin
2017-10-04 12:39             ` Jens Freimann [this message]
2017-10-04 12:58               ` Michael S. Tsirkin
2017-10-04 12:58               ` Michael S. Tsirkin
2017-10-10  9:56                 ` Liang, Cunming
2017-10-10  9:56                 ` Liang, Cunming
2017-10-11 12:22                   ` Jens Freimann
2017-09-28  9:44         ` Liang, Cunming
2017-09-28 21:13         ` Michael S. Tsirkin
2017-09-28 21:13         ` Michael S. Tsirkin
2017-09-26 23:38     ` Steven Luong (sluong)
2017-09-21 13:36 ` Liang, Cunming
2017-09-21 13:36   ` Liang, Cunming
2017-09-28 21:27   ` Michael S. Tsirkin
2017-09-28 21:27   ` Michael S. Tsirkin
2017-10-08  6:16 ` Ilya Lesokhin
2017-10-08  6:16 ` [virtio-dev] " Ilya Lesokhin
2017-10-25 16:20   ` Michael S. Tsirkin
2017-10-25 16:20     ` [virtio-dev] " Michael S. Tsirkin
2017-10-29  9:05     ` Ilya Lesokhin
2017-10-29  9:05     ` [virtio-dev] " Ilya Lesokhin
2017-10-29 14:21       ` Michael S. Tsirkin
2017-10-29 14:21         ` [virtio-dev] " Michael S. Tsirkin
2017-10-29 14:34         ` Ilya Lesokhin
2017-10-29 14:34         ` [virtio-dev] " Ilya Lesokhin
2017-10-30  2:08           ` Michael S. Tsirkin
2017-10-30  2:08             ` [virtio-dev] " Michael S. Tsirkin
2017-10-30  6:30             ` [virtio-dev] " Ilya Lesokhin
2017-10-30 16:30               ` Michael S. Tsirkin
2017-10-30 16:30                 ` [virtio-dev] " Michael S. Tsirkin
2017-10-30  6:30             ` Ilya Lesokhin
2017-10-20  9:50 [virtio-dev] " Lars Ganrot

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=20171004123901.oomueufqg52uhas4@localhost.localdomain \
    --to=jfreimann@redhat.com \
    --cc=mst@redhat.com \
    --cc=sluong@cisco.com \
    --cc=virtio-dev@lists.oasis-open.org \
    --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.