Skip to contentSkip to conversation

Introduce device group and device management

PATCH Superseded Michael S. Tsirkin 9 participants 179 messages Mar 2, 2023 – Mar 31, 2023 11 messages not in the archive Page 2 of 2

v10 of 13 Superseded Latest is v13 →

lore
Share & tools
lore
#109 lore raw

Re: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Max Gurtovoy
Quoted 23 lines · Max Gurtovoy
Quoted 15 lines · Jiri Pirko
Quoted 5 lines · Wed, Mar 08, 2023 at 12:50:48PM CET, [email protected] wrote:
Quoted 4 lines · Jiri Pirko
Quoted 3 lines · Tue, Mar 07, 2023 at 05:30:18PM CET, [email protected] wrote:
Quoted 1 line · Jiri Pirko

Hmm, if not for now, the future exension would not be so simple, I fear.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Without knowing what it is I can't say.

Yep, so basically you say, for other things if they appear, let's introduce another queue type? If yes, sounds fair to me.

Yes. For example I find it likely that live migration/failover support will require a queue where driver pre-adds buffers and then device supplies information as state changes.

Quoted 6 lines

I see. So there would be a queue called for example "child state virtqueue" or something like that for the sole purpose of getting the state of VF? Hmm, wouldn't it make more sense to have this done as a part of "group administrarion queue"? I mean, there is already notion of addresing child/VF here. So from my perspective, it is just another "group administration" command.

Quoted 5 lines

For sure VF Live Migration, MSIX config of VF, VF feature bits config and others should be admin commands on admin vq.
I don't see any reason introducing another type of admin-like vq. Also we don't need to have multiple admin vqs. This AQ is not aimed for performance.

In support of live migration, might we end up moving large amounts of device state through the admin queue?

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

Signature · 17 lines
Tonight I think I'll walk alone, I'll find my soul as I go home.

This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
#189 lore raw
In reply to Cornelia Huck
Quoted 34 lines · Wed, Mar 08, 2023 at 05:30:48PM CET, [email protected] wrote:
Quoted 32 lines · Michael S. Tsirkin
Quoted 22 lines · Jiri Pirko

Thu, Mar 02, 2023 at 02:04:48PM CET, [email protected] wrote:

[...]

Quoted 5 lines

TODO (maybe?) - probably ok to defer until this part is upstream:

Add "all members" member id.

Quoted 8 lines

Add commands for MSI, feature discovery.

Add commands for transport vq.

My intent is to try and support both SR-IOV and SIOV usecases with the same structure and maybe even the same VQ.

Sorry to be late to the party, I'm trying to catch up. Is it common to have cover letter for features this brief? I mean, from the cover letter, I'm totally unable to understand what you are introducing here.

Quoted 6 lines

Could you elaborate about what you are aiming to achive with this? Could you shed some usecases perhaps?

I have to be missing something obvious, but I don't get why any notion of SR-IOV could be beneficial for virtio.

Good point, I'll add a bit of motivation.

Quoted 7 lines
Quoted 4 lines

For SR-IOV, it is not unusual for PFs to excercise control over VFs. There is interest in the community to include an interface to allow this in the virtio spec, when the PF is a virtio device. This is what this patch does.

Unfortunately, information in the cover letter does not make it into git -- should things like that go into the github issue (and into the

Why's that? Can't you have a merge commit to include the cover letter, as we have it in netdev for example?

Quoted 3 lines

ballot?) It's useful both for reviewing (cover letter) and understanding the rationale later (github/ballot).

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#110 lore raw

Re: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to David Edmondson
Quoted 25 lines · Wed, Mar 08, 2023 at 07:01:02PM CET, [email protected] wrote:
Quoted 23 lines · Max Gurtovoy
Quoted 21 lines · Jiri Pirko
Quoted 5 lines · Wed, Mar 08, 2023 at 12:50:48PM CET, [email protected] wrote:
Quoted 4 lines · Jiri Pirko
Quoted 3 lines · Tue, Mar 07, 2023 at 05:30:18PM CET, [email protected] wrote:
Quoted 1 line · Jiri Pirko

Hmm, if not for now, the future exension would not be so simple, I fear.

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Without knowing what it is I can't say.

Yep, so basically you say, for other things if they appear, let's introduce another queue type? If yes, sounds fair to me.

Yes. For example I find it likely that live migration/failover support will require a queue where driver pre-adds buffers and then device supplies information as state changes.

I see. So there would be a queue called for example "child state virtqueue" or something like that for the sole purpose of getting the state of VF? Hmm, wouldn't it make more sense to have this done as a part of "group administrarion queue"? I mean, there is already notion of addresing child/VF here. So from my perspective, it is just another "group administration" command.

Quoted 8 lines
Quoted 5 lines

For sure VF Live Migration, MSIX config of VF, VF feature bits config and others should be admin commands on admin vq.
I don't see any reason introducing another type of admin-like vq. Also we don't need to have multiple admin vqs. This AQ is not aimed for performance.

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Sounds to me that would be the case, yes. Depends on device implementation, but could be potentially big. We should make sure it scales good.

Quoted 3 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

Well, I can imagine when migrating a lots of VFs at the same time (host shutdown), multiqueue might definitelly help.

Quoted 2 lines
Signature · 1 line
Tonight I think I'll walk alone, I'll find my soul as I go home.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#142 lore raw

[virtio-comment] Re: [virtio] Re: [PATCH v10 06/10] mmio: document ADMIN_VQ as reserved

In reply to Michael S. Tsirkin
Quoted 12 lines · Wed, Mar 08, 2023 at 05:30:21PM CET, [email protected] wrote:
Quoted 10 lines · Parav Pandit
Quoted 2 lines

And I wonder whether it's worth it - it definitely makes contributing to Linux harder, and even within Linux it pushes contributors away.

The number of virtio spec contributors are in order of magnitude less than Linux kernel or just the Linux netdev. Patch split up reduces lot of time author and reviewers. For example, interrupt moderation at v10 can be very easily split up where prep patch can have RB tag and v11 doesn't need reviewers and author's time. Your work here with 10 patches is yet another good example of it. I remember Max and I started with 6 patches... and current 10 are more useful way to split them.

Quoted 4 lines

It's a big project though. All I ask is that we try to be gentler than netdev to new contributors. If there's a 10 line patch it is not necessary to be pedantic and ask for it to be split up to a 3 patch series.

One patch per change quite common everywhere. IDK, I don't see why that would be a problem.

Quoted 10 lines
Signature · 8 lines
-- 
MST


---------------------------------------------------------------------
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 

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#94 lore raw

Re: [virtio-comment] Re: [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin
Quoted 7 lines · Max Gurtovoy
Quoted 5 lines
Quoted 3 lines

This would allow pipelining
dependent commands but prevent long-running commands because the virtqueue is blocked while executing a command.

we have multiple vqs for that.

why do we need multiple admin vqs ?

You are literally replying to a discussion with a use-case.

I don't follow.

You are snipping my reply that explaining how to simplify the spec. I don't think that any device will need more than single admin queue.

NVMe specification has a single admin queue, so why do we need to invent the wheel ?
And it has so many admin commands that may take time such as FW upgrade, format a block device, also we have vendor specific LM specification and we never thought in a direction of having multiple admin queues. MQ was invented for increasing performance and not for preventing long running commands. Most of these commands are queued one by one in a sync manner.
For example:
- quiesce a device
- freeze a device
- save state
- load state
- configure msix
- configure feature bits

Virtio has a single cvq as well.

I'm asking if you can re-think please.
We have a non-spec prototypes for LM so please use our experience in this area.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#95 lore raw

Re: [virtio-comment] Re: [PATCH v10 04/10] admin: introduce virtio admin virtqueues

Quoted 2 lines · Max Gurtovoy

We have a non-spec prototypes for LM so please use our experience in this area.

Don't see what the fuss is about. Nothing will prevent your device from using a single queue if that is what you want.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#96 lore raw

RE: [virtio-comment] Re: [PATCH v10 04/10] admin: introduce virtio admin virtqueues

Quoted 10 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Wednesday, March 8, 2023 4:09 PM

Quoted 2 lines · Max Gurtovoy

We have a non-spec prototypes for LM so please use our experience in this area.

Don't see what the fuss is about. Nothing will prevent your device from using a single queue if that is what you want.

I think the use case is not clear in the cover letter on how/when multiple aq are useful or will be used.

I agree with you on this single queue should be enough provided a single queue suffices below design aspects:

The design:
a. to have one aq to support multiple outstanding commands
b. ability to execute unrelated aq commands by device in parallel
c. driver to not issue related commands to the AQ (because they are executed out of order by the device) (Assumption is IN_ORDER is not negotiated).

Above the actual use case requirements/expectations from the AQ.

The current version indicates that the device will execute commands in-order, hence multi-queue is needed to achieve parallelism - is not serving the purpose of "q" notion fully. Or do I miss reading v10?

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#111 lore raw

RE: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to David Edmondson
Quoted 7 lines

From: [email protected] <[email protected] open.org> On Behalf Of David Edmondson

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Correct.

Quoted 2 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

DMA of the data through the proposed AQ is supported.

If I understood Max correctly when Max said " This AQ is not aimed for performance ",
he means that AQ doesn't have performance requirements as io/network queues to complete millions of ops/sec.

it is several hundred to maybe (on the higher side) thousand ops/sec during LM, provisioning use case.

DMA perspective as you mentioned, AQ still has the same perf requirements as that of regular nw/blk io queues.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#123 lore raw

RE: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Jiri Pirko
Quoted 12 lines

From: Jiri Pirko <[email protected]>
Sent: Wednesday, March 8, 2023 5:05 AM

Quoted 2 lines

For example a common feature is to program a vlan and have device put a given VF inside this vlan.

I don't follow entirely. The way how the VF is connected to network should be ouf of the scope of this interface. The eswitch manager should take care. What you say sounds awfully like the "ip vf" legacy interface, which should not be considered here I believe.

Quoted 6 lines

If PF would be the eswitch manager, there are other means to do network programming, using eswitch port representors. But I don't think this is the can of worms we want to open now. I don't think we have a usecase for it currently. Am I wrong Parav?

We want the ability to program/provision the virtio feature bits and virtio config space parameters of the VF through PF. These are host-facing parameters that usually migrate from one to another host when a VF migrates.

A future device may even do this out of band, but we are far from it.
At that point in the future virtio management device can take birth and do things over it.

ip vf was legacy interface and it is not applicable here.
virtio net doesn't implement it either and I don't see any user asking for it either. All users have migrated to using tc mechanism for long time now.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#32 lore raw

Re: [virtio-comment] Re: [PATCH v10 03/10] admin: introduce group administration commands

In reply to Max Gurtovoy
Quoted 72 lines · Max Gurtovoy
Quoted 69 lines · Michael S. Tsirkin
Quoted 68 lines · Max Gurtovoy
Quoted 65 lines · Michael S. Tsirkin
Quoted 63 lines · Stefan Hajnoczi
Quoted 49 lines · Michael S. Tsirkin
Quoted 26 lines · Stefan Hajnoczi
Quoted 11 lines · Parav Pandit

Review

Quoted 8 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, March 2, 2023 8:05 AM

+When \field{status} is VIRTIO_ADMIN_STATUS_OK,
\field{status_qialifier}

(quoted diff) +2 -0
+is reserved and set to zero by the device.
+

s/status_qialifier/status_qualifier
Missed from v10 of Feb.

Quoted 7 lines
Quoted 3 lines

+When \field{status} is VIRTIO_ADMIN_STATUS_EINVAL, the following table
+describes possible \field{status_qialifier} values:

s/status_qialifier/status_qualifier

Can you please add other useful error codes in addition to the EINVAL? Few that we are needed EAGAIN, ENOMEM, EBUSY, ENODEV.

Please define a unique constant for each error condition that can occur instead of sharing catch-all errno constants between multiple error conditions. If a driver wants to squash them together into an errno, that's fine, but I think doing this at the hardware interface level is just propagating the mistakes of errnos.

Quoted 4 lines

Only status_qualifier is needed and the vague status field can be dropped. It's not clear to me why adding EAGAIN, ENOMEM, EBUSY, and ENODEV is useful. They have no meaning to the driver, only the status_qualifier really indicates what is going on.

At a high level at the moment we have only two cases:
- ok
- invalid input supplied by driver

maybe we will have more reasons for a failure - remains to be seen.

Quoted 5 lines

I'm sure you guys have discussed this previously, but please provide rationale in the spec because it looks weird to someone with fresh eyes.

Stefan

Quoted 7 lines

Really most drivers just want to propagate errno to userspace. All the detailed reporting is for sure well intentional but in the end it is at best printed into log - end to end people just end up with a switch statement converting these to errno codes.
So we are passing them from device and this way there will be some uniformity.

Please clarify the rationale in the spec. I don't agree with it, as explained in my earlier email, but as long as its documented, people can try to follow it.

Stefan

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

It's 2:2 for now, you are with Parav, me and Cornelia like it :) Or I will try to document it better.

I don't understand this status_qualifier as well and it wasn't included in my original patch set.

Sounds like you feel I should drop your S.O.B - is this the complaint? I wanted to give attribution since I started with that but sure, no problem.

please use "Co-developed-by:" for this patch in case you stick to the status_qualifier field that I don't agree with.
According to your comment that it was 2:2 between MST/Cornelia and Parav/Stefan, now it's 2:3 with Parav/Stefan/Max (if that can help deciding on this topic in a fair game way).

Quoted 71 lines
Quoted 10 lines
Quoted 10 lines

I vote for "status" that describe generic status codes and "command_specific_error" that should be inspected by the driver only if "status" is set to "VIRTIO_ADMIN_STATUS_COMMAND_SPECIFIC_ERR". We discussed this so many times before (and already agreed IIRC) and adding this new qualifiers mechanism sounds not right to me and not intuitive for device and driver developers.

I suggest:

Quoted 8 lines
Quoted 6 lines

1. VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE
2. VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD
3. VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP
4. VIRTIO_ADMIN_STATUS_Q_INVALID_MEMBER
5. VIRTIO_ADMIN_STATUS_COMMAND_SPECIFIC_ERR (for more info read the command_specific_error field).

I don't think it's a good idea, we'll have to agree to disagree.

Ok.
can you explain why isn't this a good idea please ?
remember that this is very common logic in many specifications and many HW device implementation.

Quoted 8 lines

The point is simple. We can have a detailed virtio specific error. Nice for debugging most drivers won't know what to do with it. This is the status_qualifier.
Very detailed but
generally drivers will just have a giant switch statement translating it to a simple error code for userspace.

how giant is this switch statement ?
NVMe handles fine with this logic. Maybe you can take a look on that to get some more ideas of implementing this kind of things.

Why do we need to add some qualifiers logic into our devices ?

Quoted 3 lines

So to save everyone work, we also added "status"
a generic kind of error class that is easy to pass to userspace with a small switch statement.

if you want something that is easy just pass OK = 0 and not_OK = 1 or != 0. Not need for qualifiers.
In you case the qualifiers is just an extension for the status.

Quoted 3 lines

COMMAND_SPECIFIC_ERR is just way too much detail - commands generally just should not fail it's a quality of implementation issue.

it's the way many specifications work.
And this is the correct way for future extensions IMO. Each new command may have it's own namespace of errors extensions.

why we defer such essential decisions for the future ?
We already introduces 2-3 admin features in the past (MSIX, feature bits config, num_queues config, etc..) - maybe we can learn from it ?

Quoted 7 lines
Quoted 6 lines
Quoted 6 lines

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Quoted 9 lines

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#33 lore raw

Re: [virtio-comment] Re: [PATCH v10 03/10] admin: introduce group administration commands

Quoted 1 line · Max Gurtovoy

please use "Co-developed-by:" for this patch

Sure.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#97 lore raw

[virtio-comment] Re: [virtio-dev] Re: [virtio-comment] Re: [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Michael S. Tsirkin
Quoted 6 lines · Wed, Mar 08, 2023 at 10:09:22PM CET, [email protected] wrote:
Quoted 2 lines · Max Gurtovoy

We have a non-spec prototypes for LM so please use our experience in this area.

Don't see what the fuss is about. Nothing will prevent your device from using a single queue if that is what you want.

Yeah. Plus designing the thing multiq in the spec from start is future proof. I second that.

Quoted 9 lines
Signature · 7 lines
-- 
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#112 lore raw

Re: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Parav Pandit
Quoted 9 lines · Wed, Mar 08, 2023 at 10:25:32PM CET, [email protected] wrote:
Quoted 7 lines

From: [email protected] <[email protected] open.org> On Behalf Of David Edmondson

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Correct.

Quoted 8 lines
Quoted 2 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

DMA of the data through the proposed AQ is supported.

If I understood Max correctly when Max said " This AQ is not aimed for performance ",
he means that AQ doesn't have performance requirements as io/network queues to complete millions of ops/sec.

it is several hundred to maybe (on the higher side) thousand ops/sec during LM, provisioning use case.

But isn't it good to design it for performance from start? I mean, state transfer of thousands of VFs at a time is definitelly performance related, isn't it?

Quoted 2 lines

DMA perspective as you mentioned, AQ still has the same perf requirements as that of regular nw/blk io queues.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#124 lore raw

Re: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Parav Pandit
Quoted 12 lines · Wed, Mar 08, 2023 at 10:45:18PM CET, [email protected] wrote:
Quoted 12 lines

From: Jiri Pirko <[email protected]>
Sent: Wednesday, March 8, 2023 5:05 AM

Quoted 2 lines

For example a common feature is to program a vlan and have device put a given VF inside this vlan.

I don't follow entirely. The way how the VF is connected to network should be ouf of the scope of this interface. The eswitch manager should take care. What you say sounds awfully like the "ip vf" legacy interface, which should not be considered here I believe.

Quoted 8 lines
Quoted 6 lines

If PF would be the eswitch manager, there are other means to do network programming, using eswitch port representors. But I don't think this is the can of worms we want to open now. I don't think we have a usecase for it currently. Am I wrong Parav?

We want the ability to program/provision the virtio feature bits and virtio config space parameters of the VF through PF. These are host-facing parameters that usually migrate from one to another host when a VF migrates.

Here is where we lack to have separate "devlink function" entity, independend of "devlink port" :/ I mean, for MAC config and irq vectors. What other host facing parmeters you have in mind. VLAN of "ip vf" is definitelly one of them, I have to emphasize.

Quoted 5 lines

A future device may even do this out of band, but we are far from it.
At that point in the future virtio management device can take birth and do things over it.

ip vf was legacy interface and it is not applicable here.

Agreed, unacceptable to implement "ip vf" legacy interfaces in virtio_net from my perspective.

Quoted 2 lines

virtio net doesn't implement it either and I don't see any user asking for it either. All users have migrated to using tc mechanism for long time now.

Okay, so the bottom line is, we should take care of host facing config of VF, but we should not care about network plug of VF - that stays out of the scope.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#86 lore raw

Re: [virtio-comment] Re: [virtio] Re: [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Michael S. Tsirkin
Quoted 29 lines · Michael S. Tsirkin
Quoted 17 lines · Stefan Hajnoczi
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

Or we could say that admin commands must complete within bounded time, but I'm not sure that is implementable for some device types like virtio-blk, virtio-scsi, and virtiofs.

No we can't.
Some commands, for example FW upgrade can take 10 minutes and it's perfectly fine. Other commands like setting feature bit will take 1 millisec. Each device implements commands in a different internal logic so we can't expect to complete after X time.

Quoted 3 lines

When I say bounded time, I mean that it finishes in a finite amount of time. I'm not saying there is a specific time X that all device implementations must satisfy. Unbounded means it might never finish.

There might be a chance that any command for any virtio device type will never finish. Nothing new here in the adminq.

Quoted 7 lines
Quoted 4 lines

what one can do is to set a timeout for himself and if this timeout expire - check the device status. If it needs_reset - do a reset. if status is ok, then wait some more time.
After X retries, unmap buffers or reset the adminq.

Michael: What effect does resetting the group owner device have on group member devices?

virtio level reset? It's a good question. I'd expect them all to be reset no?

Quoted 8 lines
Quoted 4 lines

I'm concerned that this approach disrupts all group member devices. For example, you try to add a new device but the command hangs. In order to recover you now have to reset the group owner device and this breaks all the group member devices.

I agree. How about a VQ level reset though? Seems like exactly what's needed here?

Yes, a new virtqueue-level reset feature would take care of this case.

Stefan

#125 lore raw

RE: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Jiri Pirko
Quoted 7 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, March 9, 2023 2:37 AM

Quoted 1 line

We want the ability to program/provision the virtio feature bits and virtio

Quoted 9 lines

config space parameters of the VF through PF.

Quoted 1 line

These are host-facing parameters that usually migrate from one to another

host when a VF migrates.

Here is where we lack to have separate "devlink function" entity, independend of "devlink port" :/ I mean, for MAC config and irq vectors.
What other host facing parmeters you have in mind. VLAN of "ip vf" is definitelly one of them, I have to emphasize.

It is not.

Virtio feature bits defined by the virtio spec.
Virtio config space fields present in the each virtio device specific spec.

Quoted 9 lines
Quoted 4 lines

virtio net doesn't implement it either and I don't see any user asking for it

either.

Quoted 1 line

All users have migrated to using tc mechanism for long time now.

Okay, so the bottom line is, we should take care of host facing config of VF, but we should not care about network plug of VF - that stays out of the scope.

Right.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#113 lore raw

RE: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Jiri Pirko
Quoted 20 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, March 9, 2023 2:31 AM

Quoted 7 lines · Wed, Mar 08, 2023 at 10:25:32PM CET, [email protected] wrote:
Quoted 7 lines

From: [email protected] <[email protected] open.org> On Behalf Of David Edmondson

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Quoted 8 lines

Correct.

Quoted 2 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

DMA of the data through the proposed AQ is supported.

If I understood Max correctly when Max said " This AQ is not aimed for performance ", he means that AQ doesn't have performance requirements as

Quoted 8 lines

io/network queues to complete millions of ops/sec.

Quoted 2 lines

it is several hundred to maybe (on the higher side) thousand ops/sec during

LM, provisioning use case.

But isn't it good to design it for performance from start? I mean, state transfer of thousands of VFs at a time is definitelly performance related, isn't it?

It is. Which part of the proposed AQ doesn't cover this aspect?
The only issue that I see today is, that a given GET family of commands q contains the read-only and write-only descriptors which require multiple dma allocations on driver side.

Quoted 4 lines
Quoted 3 lines

DMA perspective as you mentioned, AQ still has the same perf requirements

as that of regular nw/blk io queues.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#87 lore raw

Re: [virtio-comment] Re: [virtio] Re: [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Stefan Hajnoczi
Quoted 36 lines · Stefan Hajnoczi
Quoted 35 lines · Michael S. Tsirkin
Quoted 17 lines · Stefan Hajnoczi
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

Or we could say that admin commands must complete within bounded time, but I'm not sure that is implementable for some device types like virtio-blk, virtio-scsi, and virtiofs.

No we can't.
Some commands, for example FW upgrade can take 10 minutes and it's perfectly fine. Other commands like setting feature bit will take 1 millisec. Each device implements commands in a different internal logic so we can't expect to complete after X time.

Quoted 3 lines

When I say bounded time, I mean that it finishes in a finite amount of time. I'm not saying there is a specific time X that all device implementations must satisfy. Unbounded means it might never finish.

There might be a chance that any command for any virtio device type will never finish. Nothing new here in the adminq.

Quoted 7 lines
Quoted 4 lines

what one can do is to set a timeout for himself and if this timeout expire - check the device status. If it needs_reset - do a reset. if status is ok, then wait some more time.
After X retries, unmap buffers or reset the adminq.

Michael: What effect does resetting the group owner device have on group member devices?

virtio level reset? It's a good question. I'd expect them all to be reset no?

Quoted 4 lines

I'm concerned that this approach disrupts all group member devices. For example, you try to add a new device but the command hangs. In order to recover you now have to reset the group owner device and this breaks all the group member devices.

Quoted 6 lines
Quoted 2 lines

I agree. How about a VQ level reset though? Seems like exactly what's needed here?

Yes, a new virtqueue-level reset feature would take care of this case.

Stefan

Why would we need a new one? We already have VIRTIO_F_RING_RESET.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#114 lore raw

Re: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Parav Pandit
Quoted 22 lines · Parav Pandit
Quoted 22 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, March 9, 2023 2:31 AM

Quoted 7 lines · Wed, Mar 08, 2023 at 10:25:32PM CET, [email protected] wrote:
Quoted 7 lines

From: [email protected] <[email protected] open.org> On Behalf Of David Edmondson

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Quoted 8 lines

Correct.

Quoted 2 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

DMA of the data through the proposed AQ is supported.

If I understood Max correctly when Max said " This AQ is not aimed for performance ", he means that AQ doesn't have performance requirements as

io/network queues to complete millions of ops/sec.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

it is several hundred to maybe (on the higher side) thousand ops/sec during

LM, provisioning use case.

But isn't it good to design it for performance from start? I mean, state transfer of thousands of VFs at a time is definitelly performance related, isn't it?

It is. Which part of the proposed AQ doesn't cover this aspect?
The only issue that I see today is, that a given GET family of commands q contains the read-only and write-only descriptors which require multiple dma allocations on driver side.

BTW for a while now I wanted to add a descriptor flag that will stick data inline in the descriptor. Perfect for passing small bits of data such as vqn, or the virtio header.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines

DMA perspective as you mentioned, AQ still has the same perf requirements

as that of regular nw/blk io queues.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#115 lore raw

RE: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Parav Pandit
Quoted 21 lines · Parav Pandit
Quoted 21 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, March 9, 2023 2:31 AM

Quoted 7 lines · Wed, Mar 08, 2023 at 10:25:32PM CET, [email protected] wrote:
Quoted 7 lines

From: [email protected] <[email protected] open.org> On Behalf Of David Edmondson

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Quoted 8 lines

Correct.

Quoted 2 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

DMA of the data through the proposed AQ is supported.

If I understood Max correctly when Max said " This AQ is not aimed for performance ", he means that AQ doesn't have performance requirements as

io/network queues to complete millions of ops/sec.

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 1 line

it is several hundred to maybe (on the higher side) thousand ops/sec during

LM, provisioning use case.

But isn't it good to design it for performance from start? I mean, state transfer of thousands of VFs at a time is definitelly performance related, isn't it?

It is. Which part of the proposed AQ doesn't cover this aspect?
The only issue that I see today is, that a given GET family of commands q contains the read-only and write-only descriptors which require multiple dma allocations on driver side.

I don't think that there is any assertion that the current proposal doesn't cover this.

It was intended as an illustration to try and help determine whether multiple AQs for a single device was a requirement given existing anticipated usage, or a safeguard against potential future uses.

Signature · 17 lines
Up eighty flights of stairs to a basement flat.

This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
#116 lore raw

RE: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

Quoted 43 lines

From: David Edmondson <[email protected]>
Sent: Thursday, March 9, 2023 9:03 AM

Quoted 21 lines · Parav Pandit
Quoted 21 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, March 9, 2023 2:31 AM

Quoted 17 lines · Wed, Mar 08, 2023 at 10:25:32PM CET, [email protected] wrote:
Quoted 8 lines

From: [email protected] <[email protected] open.org> On Behalf Of David Edmondson

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Correct.

Quoted 2 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

DMA of the data through the proposed AQ is supported.

If I understood Max correctly when Max said " This AQ is not aimed for performance ", he means that AQ doesn't have performance requirements as

Quoted 8 lines
Quoted 8 lines

io/network queues to complete millions of ops/sec.

Quoted 3 lines

it is several hundred to maybe (on the higher side) thousand ops/sec during

LM, provisioning use case.

But isn't it good to design it for performance from start? I mean, state transfer of thousands of VFs at a time is definitelly performance

related, isn't it?

Quoted 3 lines
Quoted 1 line

It is. Which part of the proposed AQ doesn't cover this aspect? The only issue that I see today is, that a given GET family of commands q

contains the read-only and write-only descriptors which require multiple dma allocations on driver side.

Quoted 6 lines

I don't think that there is any assertion that the current proposal doesn't cover this.

It was intended as an illustration to try and help determine whether multiple AQs for a single device was a requirement given existing anticipated usage, or a safeguard against potential future uses.

Got it.

So far my understanding is:
1. Single AQ is enough for currently cited use cases
2. Having the infrastructure to support multiple AQ is also good.
The extra cost of this infra is only one read-only field = aq count as Michael proposed.

3. Ability to send multiple outstanding commands and execute them out of order by device is/should be supported as long as IN_ORDER is not negotiated. Should it be relaxed for AQ that even if IN_ORDER is negotiated, AQ by default can be out of order queue?

4. Driver is the sole owner to decide if it is modifying an object through AQ, it should synchronize with ongoing AQ command on the same object or not.
5. If the command gets stuck for a very long time, the driver can recover the AQ using the existing Q RESET facility.

Do we agree with the above design thoughts?
Or there is a better design than this discussed, and I missed it?

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#117 lore raw

Re: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

Quoted 46 lines · Parav Pandit
Quoted 46 lines

From: David Edmondson <[email protected]>
Sent: Thursday, March 9, 2023 9:03 AM

Quoted 21 lines · Parav Pandit
Quoted 21 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, March 9, 2023 2:31 AM

Quoted 17 lines · Wed, Mar 08, 2023 at 10:25:32PM CET, [email protected] wrote:
Quoted 8 lines

From: [email protected] <[email protected] open.org> On Behalf Of David Edmondson

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Correct.

Quoted 2 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

DMA of the data through the proposed AQ is supported.

If I understood Max correctly when Max said " This AQ is not aimed for performance ", he means that AQ doesn't have performance requirements as

Quoted 8 lines
Quoted 8 lines

io/network queues to complete millions of ops/sec.

Quoted 3 lines

it is several hundred to maybe (on the higher side) thousand ops/sec during

LM, provisioning use case.

But isn't it good to design it for performance from start? I mean, state transfer of thousands of VFs at a time is definitelly performance

related, isn't it?

Quoted 3 lines
Quoted 1 line

It is. Which part of the proposed AQ doesn't cover this aspect? The only issue that I see today is, that a given GET family of commands q

contains the read-only and write-only descriptors which require multiple dma allocations on driver side.

I don't think that there is any assertion that the current proposal doesn't cover this.

Quoted 8 lines
Quoted 3 lines

It was intended as an illustration to try and help determine whether multiple AQs for a single device was a requirement given existing anticipated usage, or a safeguard against potential future uses.

Got it.

So far my understanding is:
1. Single AQ is enough for currently cited use cases

FYI transport VQ work started off with multiple vqs.

Quoted 5 lines

2. Having the infrastructure to support multiple AQ is also good.
The extra cost of this infra is only one read-only field = aq count as Michael proposed.

3. Ability to send multiple outstanding commands and execute them out of order by device is/should be supported as long as IN_ORDER is not negotiated. Should it be relaxed for AQ that even if IN_ORDER is negotiated, AQ by default can be out of order queue?

I feel there's no need: driver can just avoid negotiating IN_ORDER. Generally I'm not happy with IN_ORDER and have some ideas to replace it with PARTIAL_ORDER, that will also address this.

Quoted 6 lines

4. Driver is the sole owner to decide if it is modifying an object through AQ, it should synchronize with ongoing AQ command on the same object or not.
5. If the command gets stuck for a very long time, the driver can recover the AQ using the existing Q RESET facility.

Do we agree with the above design thoughts?
Or there is a better design than this discussed, and I missed it?

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#118 lore raw

RE: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

Quoted 58 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, March 9, 2023 9:23 AM

Quoted 52 lines · Parav Pandit
Quoted 51 lines

From: David Edmondson <[email protected]>
Sent: Thursday, March 9, 2023 9:03 AM

Quoted 23 lines · Parav Pandit
Quoted 23 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, March 9, 2023 2:31 AM

Quoted 10 lines · Wed, Mar 08, 2023 at 10:25:32PM CET, [email protected] wrote:
Quoted 8 lines

From: [email protected] <[email protected] open.org> On Behalf Of David Edmondson

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Correct.

Quoted 7 lines
Quoted 2 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

DMA of the data through the proposed AQ is supported.

If I understood Max correctly when Max said " This AQ is not aimed for performance ", he means that AQ doesn't have performance requirements as

io/network queues to complete millions of ops/sec.

Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

it is several hundred to maybe (on the higher side) thousand ops/sec during

LM, provisioning use case.

But isn't it good to design it for performance from start? I mean, state transfer of thousands of VFs at a time is definitelly performance

related, isn't it?

Quoted 4 lines
Quoted 1 line

It is. Which part of the proposed AQ doesn't cover this aspect? The only issue that I see today is, that a given GET family of commands q

contains the read-only and write-only descriptors which require multiple dma allocations on driver side.

I don't think that there is any assertion that the current proposal doesn't cover this.

It was intended as an illustration to try and help determine whether multiple AQs for a single device was a requirement given existing anticipated usage, or a safeguard against potential future uses.

Quoted 7 lines
Quoted 4 lines

Got it.

So far my understanding is:
1. Single AQ is enough for currently cited use cases

FYI transport VQ work started off with multiple vqs.

Ok. so there may be some use case for transport VQ.
Worth to mention in the cover letter and things will be fine.
Actual review of the transport VQ and its use will be in the respective patchset.

Quoted 10 lines
Quoted 2 lines

2. Having the infrastructure to support multiple AQ is also good. The extra cost of this infra is only one read-only field = aq count as Michael

proposed.

Quoted 2 lines

3. Ability to send multiple outstanding commands and execute them out of

order by device is/should be supported as long as IN_ORDER is not negotiated.

Quoted 1 line

Should it be relaxed for AQ that even if IN_ORDER is negotiated, AQ by

default can be out of order queue?

I feel there's no need: driver can just avoid negotiating IN_ORDER.

I didn't understand the "no need" part.
Do you mean to make use of out-of-order AQ commands, driver should skip IN_ORDER negotiation for the data path queues? If yes, it may not be a big loss for the PF.

I am considering that since AQ is so fresh, it can keep itself detached from the IN_ORDER from the beginning. This way AQ and data path queues stay on their own course.

Quoted 11 lines

Generally I'm not happy with IN_ORDER and have some ideas to replace it with PARTIAL_ORDER, that will also address this.

Quoted 1 line

4. Driver is the sole owner to decide if it is modifying an object through AQ, it

should synchronize with ongoing AQ command on the same object or not.

Quoted 1 line

5. If the command gets stuck for a very long time, the driver can recover the

AQ using the existing Q RESET facility.

Quoted 4 lines

Do we agree with the above design thoughts?
Or there is a better design than this discussed, and I missed it?

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#119 lore raw

Re: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

Quoted 78 lines · Parav Pandit
Quoted 58 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, March 9, 2023 9:23 AM

Quoted 52 lines · Parav Pandit
Quoted 51 lines

From: David Edmondson <[email protected]>
Sent: Thursday, March 9, 2023 9:03 AM

Quoted 23 lines · Parav Pandit
Quoted 23 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, March 9, 2023 2:31 AM

Quoted 10 lines · Wed, Mar 08, 2023 at 10:25:32PM CET, [email protected] wrote:
Quoted 8 lines

From: [email protected] <[email protected] open.org> On Behalf Of David Edmondson

In support of live migration, might we end up moving large amounts of device state through the admin queue?

Correct.

Quoted 7 lines
Quoted 2 lines

If so, that would seem to have some performance requirements, though I don't know if it would justify multiple admin queues.

DMA of the data through the proposed AQ is supported.

If I understood Max correctly when Max said " This AQ is not aimed for performance ", he means that AQ doesn't have performance requirements as

io/network queues to complete millions of ops/sec.

Quoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

it is several hundred to maybe (on the higher side) thousand ops/sec during

LM, provisioning use case.

But isn't it good to design it for performance from start? I mean, state transfer of thousands of VFs at a time is definitelly performance

related, isn't it?

Quoted 4 lines
Quoted 1 line

It is. Which part of the proposed AQ doesn't cover this aspect? The only issue that I see today is, that a given GET family of commands q

contains the read-only and write-only descriptors which require multiple dma allocations on driver side.

I don't think that there is any assertion that the current proposal doesn't cover this.

It was intended as an illustration to try and help determine whether multiple AQs for a single device was a requirement given existing anticipated usage, or a safeguard against potential future uses.

Quoted 7 lines
Quoted 4 lines

Got it.

So far my understanding is:
1. Single AQ is enough for currently cited use cases

FYI transport VQ work started off with multiple vqs.

Ok. so there may be some use case for transport VQ.
Worth to mention in the cover letter and things will be fine.
Actual review of the transport VQ and its use will be in the respective patchset.

Quoted 9 lines
Quoted 2 lines

2. Having the infrastructure to support multiple AQ is also good. The extra cost of this infra is only one read-only field = aq count as Michael

proposed.

Quoted 2 lines

3. Ability to send multiple outstanding commands and execute them out of

order by device is/should be supported as long as IN_ORDER is not negotiated.

Quoted 1 line

Should it be relaxed for AQ that even if IN_ORDER is negotiated, AQ by

default can be out of order queue?

Quoted 7 lines
Quoted 1 line

I feel there's no need: driver can just avoid negotiating IN_ORDER.

I didn't understand the "no need" part.
Do you mean to make use of out-of-order AQ commands, driver should skip IN_ORDER negotiation for the data path queues? If yes, it may not be a big loss for the PF.

I am considering that since AQ is so fresh, it can keep itself detached from the IN_ORDER from the beginning. This way AQ and data path queues stay on their own course.

You can make this claim for different types of data queues too. I'd rather try to solve it for all queues than special-case AQ.

Quoted 11 lines
Quoted 11 lines

Generally I'm not happy with IN_ORDER and have some ideas to replace it with PARTIAL_ORDER, that will also address this.

Quoted 1 line

4. Driver is the sole owner to decide if it is modifying an object through AQ, it

should synchronize with ongoing AQ command on the same object or not.

Quoted 1 line

5. If the command gets stuck for a very long time, the driver can recover the

AQ using the existing Q RESET facility.

Quoted 4 lines

Do we agree with the above design thoughts?
Or there is a better design than this discussed, and I missed it?

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#88 lore raw

Re: [virtio-comment] Re: [virtio] Re: [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Michael S. Tsirkin
Quoted 37 lines · Michael S. Tsirkin
Quoted 36 lines · Stefan Hajnoczi
Quoted 35 lines · Michael S. Tsirkin
Quoted 17 lines · Stefan Hajnoczi
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

Or we could say that admin commands must complete within bounded time, but I'm not sure that is implementable for some device types like virtio-blk, virtio-scsi, and virtiofs.

No we can't.
Some commands, for example FW upgrade can take 10 minutes and it's perfectly fine. Other commands like setting feature bit will take 1 millisec. Each device implements commands in a different internal logic so we can't expect to complete after X time.

Quoted 3 lines

When I say bounded time, I mean that it finishes in a finite amount of time. I'm not saying there is a specific time X that all device implementations must satisfy. Unbounded means it might never finish.

There might be a chance that any command for any virtio device type will never finish. Nothing new here in the adminq.

Quoted 7 lines
Quoted 4 lines

what one can do is to set a timeout for himself and if this timeout expire - check the device status. If it needs_reset - do a reset. if status is ok, then wait some more time.
After X retries, unmap buffers or reset the adminq.

Michael: What effect does resetting the group owner device have on group member devices?

virtio level reset? It's a good question. I'd expect them all to be reset no?

Quoted 4 lines

I'm concerned that this approach disrupts all group member devices. For example, you try to add a new device but the command hangs. In order to recover you now have to reset the group owner device and this breaks all the group member devices.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

I agree. How about a VQ level reset though? Seems like exactly what's needed here?

Yes, a new virtqueue-level reset feature would take care of this case.

Stefan

Why would we need a new one? We already have VIRTIO_F_RING_RESET.

I was unaware :).

Stefan

#126 lore raw

Re: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Parav Pandit
Quoted 16 lines · Thu, Mar 09, 2023 at 01:36:00PM CET, [email protected] wrote:
Quoted 7 lines

From: Jiri Pirko <[email protected]>
Sent: Thursday, March 9, 2023 2:37 AM

Quoted 1 line

We want the ability to program/provision the virtio feature bits and virtio

Quoted 9 lines

config space parameters of the VF through PF.

Quoted 1 line

These are host-facing parameters that usually migrate from one to another

host when a VF migrates.

Here is where we lack to have separate "devlink function" entity, independend of "devlink port" :/ I mean, for MAC config and irq vectors.
What other host facing parmeters you have in mind. VLAN of "ip vf" is definitelly one of them, I have to emphasize.

Quoted 4 lines

It is not.

Virtio feature bits defined by the virtio spec.
Virtio config space fields present in the each virtio device specific spec.

If those are only virtio-specifig things, I'm good.

Mac is part of Virtio_net config space. Good.

Quoted 11 lines
Quoted 10 lines
Quoted 5 lines

virtio net doesn't implement it either and I don't see any user asking for it

either.

Quoted 1 line

All users have migrated to using tc mechanism for long time now.

Okay, so the bottom line is, we should take care of host facing config of VF, but we should not care about network plug of VF - that stays out of the scope.

Right.

Good.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#120 lore raw

RE: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Michael S. Tsirkin
Quoted 26 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, March 9, 2023 9:43 AM

Quoted 4 lines
Quoted 1 line

Ok. so there may be some use case for transport VQ.
Worth to mention in the cover letter and things will be fine. Actual review of the transport VQ and its use will be in the respective

patchset.

Quoted 9 lines
Quoted 9 lines
Quoted 4 lines

2. Having the infrastructure to support multiple AQ is also good. The extra cost of this infra is only one read-only field = aq count as Michael

proposed.

Quoted 3 lines

3. Ability to send multiple outstanding commands and execute them out of

order by device is/should be supported as long as IN_ORDER is not

negotiated.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Should it be relaxed for AQ that even if IN_ORDER is negotiated, AQ by

default can be out of order queue?

I feel there's no need: driver can just avoid negotiating IN_ORDER.

I didn't understand the "no need" part.
Do you mean to make use of out-of-order AQ commands, driver should skip

Quoted 8 lines

IN_ORDER negotiation for the data path queues?

Quoted 3 lines

If yes, it may not be a big loss for the PF.

I am considering that since AQ is so fresh, it can keep itself detached from

the IN_ORDER from the beginning.

Quoted 1 line

This way AQ and data path queues stay on their own course.

You can make this claim for different types of data queues too.

Those queues are already defined. Without any new feature bit, not sure how can it change.

Quoted 2 lines

I'd rather try to solve it for all queues than special-case AQ.

AQ is newly introduce which has chance of not follow the same limitations as existing queues.

Keeping my inputs aside for moment, what do you propose for v11?

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#121 lore raw

Re: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

Quoted 1 line · Parav Pandit

Keeping my inputs aside for moment, what do you propose for v11?

Following SCSI and relying on driver to worry about ordering.

Signature · 18 lines
MST


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
#122 lore raw

RE: [virtio-comment] Re: [virtio] [PATCH v10 04/10] admin: introduce virtio admin virtqueues

Quoted 9 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, March 9, 2023 12:14 PM

Quoted 1 line · Parav Pandit

Keeping my inputs aside for moment, what do you propose for v11?

Following SCSI and relying on driver to worry about ordering.

Got it. Thanks.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#155 lore raw

[virtio-comment] Re: [PATCH v10 08/10] admin: command list discovery

In reply to Michael S. Tsirkin
Quoted 48 lines · Michael S. Tsirkin

Add commands to find out which commands does each group support, as well as enable their use by driver.
This will be especially useful once we have multiple group types.

An alternative is per-type VQs. This is possible but will require more per-transport work. Discovery through the vq helps keep things contained.

---
  admin.tex | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 96 insertions(+), 1 deletion(-)
admin.tex +18 -1
index 3ffac2e..1172054 100644
@@ -99,7 +99,9 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
  \hline
  opcode & Name & Command Description \\
  \hline \hline
-0x0000 - 0x7FFF & - &  Group administration commands    \\
+0x0000 & VIRTIO_ADMIN_CMD_LIST_QUERY & Provides to driver list of commands supported for this group type    \\
+0x0001 & VIRTIO_ADMIN_CMD_LIST_USE & Provides to device list of commands used for this group type \\
+0x0002 - 0x7FFF & - &  Group administration commands    \\
  \hline
  0x8000 - 0xFFFF & - & Reserved    \\
  \hline
@@ -156,6 +158,99 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
  depends on these structures and is described separately or is
  implicit in the structure description.
 
+Before sending any administration commands to the device, the driver
+needs to communicate to the device which commands it is going to
+use. Initially (after reset), only two commands are assumed to be used:
+VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE.
+
+Before sending any other commands for any member of a specific group to
+the device, the driver queries the supported commands via
+VIRTIO_ADMIN_CMD_LIST_QUERY and sends the commands it will use via
+VIRTIO_ADMIN_CMD_LIST_USE.
+
+Commands VIRTIO_ADMIN_CMD_LIST_QUERY and
+VIRTIO_ADMIN_CMD_LIST_USE
+both use the following structure describing the
+command opcodes:
+

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 185

Quoted 10 lines
admin.tex +10 -0
+\begin{lstlisting}
+struct virtio_admin_cmd_list {
+       /* Indicates which of the below fields were returned
+       le64 device_admin_cmds[];
+};
+\end{lstlisting}
+
+This structure is an array of 64 bit values in little-endian byte
+order, in which a bit is set if the specific command opcode
+is supported. Thus, \field{device_admin_cmds[0]} refers to the first 32-bit value

I think this should be "the first 64-bit"

Quoted 61 lines
admin.tex +61 -0
+in this array corresponding to opcodes 0 to 63,
+\field{device_admin_cmds[1]} is the second 64-bit value
+corresponding to opcodes 64 to 127, etc.
+For example, the array of size 2 including
+the values 0x3 in \field{device_admin_cmds[0]}
+and 0x1 in \field{device_admin_cmds[1]} indicates that only
+opcodes 0, 1 and 64 are supported.
+The length of the array depends on the supported opcodes - it is
+large enough to include bits set for all supported opcodes,
+that is the length can be calculated by starting with the largest
+supported opcode adding one, dividing by 64 and rounding up.
+In other words, for
+VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE the
+length of \field{command_specific_result} and
+\field{command_specific_data} respectively will be
+$DIV_ROUND_UP(max_cmd, 64) * 8$ where DIV_ROUND_UP is integer division
+with round up and \field{max_cmd} is the largest available command opcode.
+
+The array is also allowed to be larger and to additionally
+include an arbitrary number of all-zero entries.
+
+Accordingly, bits 0 and 1 corresponding to opcode 0
+(VIRTIO_ADMIN_CMD_LIST_QUERY) and 1
+(VIRTIO_ADMIN_CMD_LIST_USE) are
+always set in \field{device_admin_cmds[0]} returned by VIRTIO_ADMIN_CMD_LIST_QUERY.
+
+For the command VIRTIO_ADMIN_CMD_LIST_QUERY, \field{opcode} is set to 0x0.
+The \field{group_member_id} is unused. It is set to zero by driver.
+This command has no command specific data.
+The device, upon success, returns a result in
+\field{command_specific_result} in the format
+\field{struct virtio_admin_cmd_list} describing the
+list of administration commands supported for the given group.
+
+
+For the command VIRTIO_ADMIN_CMD_LIST_USE, \field{opcode}
+is set to 0x1.
+The \field{group_member_id} is unused. It is set to zero by driver.
+The \field{command_specific_data} is in the format
+\field{struct virtio_admin_cmd_list} describing the
+list of administration commands used by the driver.
+This command has no command specific result.
+
+The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to
+query the list of commands valid for this group and before sending
+any commands for any member of a group.
+
+The driver then enables use of some of the opcodes by sending to
+the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset
+of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is
+both understood and used by the driver.
+
+If the device supports the command list used by the driver, the
+device completes the command with status VIRTIO_ADMIN_STATUS_OK.
+If the device does not support the command list, the device
+completes the command with status
+VIRTIO_ADMIN_STATUS_INVALID_FIELD.
+
+Note: drivers are assumed not to set bits in device_admin_cmds
+if they are not familiar with how the command opcode
+is used, since devices could have dependencies between

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 256

Quoted 10 lines
admin.tex +7 -0
+command opcodes.
+
+It is assumed that all members in a group support and are used
+with the same list of commands. However, for owner devices
+supporting multiple group types, the list of supported commands
+might differ between different group types.
+
  \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}
 
  An administration virtqueue of an owner device is used to submit

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#185 lore raw
In reply to Parav Pandit
Quoted 19 lines · Parav Pandit
Quoted 2 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Tuesday, March 7, 2023 12:20 PM

[..]

Quoted 8 lines
Quoted 8 lines
Quoted 1 line

For SR-IOV, it is not unusual for PFs to excercise control over VFs.

I understand the concepts of SR-IOV. Yet I fail to see the need of such concept in virtio world. SR-IOV is very specific solution for PCI functions instantiation, and I believe that it is already considered quite limiting in many aspects. Does not make sense to me to introduce it for virtio. But again, I may be missing something crucial, I just would like to see the motivation, needs, usecases for this crystal clear, which is opposite to the current cover letter I'm afraid :/

Quoted 4 lines

First people are asking for it because it's out there, however limiting it is. In fact Nvidia is - why don't you talk to Parav here and tell him that SR-IOV is legacy and there's no need to support.

Jiri and I discussed offline today.
SR-IOV is widely used today and in the coming future up to thousands of devices. Many vendors are building it or already built.

Quoted 8 lines

SIOV as it stands today is still being crafted at various levels iommu, os, device, pci and more. Not there yet fully.

Jiri and I built the Linux kernel interfaces for SFs which are equivalent to SIOVs that overcome some of the SR-IOV limitations. And Jiri's suggestion was to leverage some of the vision and practice from there.

In other words, can AQ command be useful tomorrow for doing SIOV device add/remove, and provisioning from non-owning PF? The way AQ is crafted today is not there yet, but in the future, it can be extended.

I have submitted a series implementing "transport vq" which work for ADIs like SIOV devices, MST required a merge with admin q, so we are here.

Quoted 20 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

There is interest in the community to include an interface to allow this in the virtio spec, when the PF is a virtio device. This is what this patch does.

Yeah, but why? As I asked before, what are the usecases? The fact there is interest in the community does not mean it makes sense to have it :)

Quoted 8 lines

If people want to build such hardware it will need some interface. Far better to have it standard.

But generally e.g. intel already said they will reuse this same structure with a different group type for SIOV support.
I'll mention this in the cover letter.

We have the following already identified use cases of a device agnostic VQ.

1. SR-IOV VF device provisioning at virtio layer (features and config)
2. SR IOV (SR-PCIM interface of the PCI spec) for VF provisioning, for example, MSI-X vectors

Quoted 10 lines

3. SR-IOV VF Live migration
4. Above #1 to #3 for SIOV devices instead of SRIOV devices

5. cmd q interface for PF/VF/SF/SIOV to transport their own features, config command over queue interface without any parent device

#1 to #3 are well described in past. So, It is worth covering them in the cover letter and things will be clear for new eyes. #4 is broad use case and like #1 to #3 that will eventually happen.
#5 likely needs more discussion, we can differ to a later point because AQ needs to progress in spec 1.3.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#165 lore raw

[virtio-comment] Re: [PATCH v10 09/10] admin: conformance clauses

In reply to Michael S. Tsirkin
Quoted 71 lines · Michael S. Tsirkin

Add conformance clauses for admin commands and admin virtqueues.

---
  admin.tex | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 215 insertions(+), 1 deletion(-)
admin.tex +56 -0
index 1172054..6c4f79c 100644
@@ -251,6 +251,145 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
  supporting multiple group types, the list of supported commands
  might differ between different group types.
 
+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands}
+
+The device MUST validate \field{opcode}, \field{group_type} and
+\field{group_member_id}, and if any of these has an invalid or
+unsupported value, set \field{status} to
+VIRTIO_ADMIN_STATUS_EINVAL and set \field{status_qualifier}
+accordingly:
+\begin{itemize}
+\item if \field{group_type} is invalid, \field{status_qualifier}
+	MUST be set to VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP;
+\item otherwise, if \field{opcode} is invalid,
+	\field{status_qualifier} MUST be set to
+	VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE;
+\item otherwise, if \field{group_member_id} is used by the
+	specific command and is invalid, \field{status_qualifier} MUST be
+	set to VIRTIO_ADMIN_STATUS_Q_INVALID_MEMBER.
+\end{itemize}
+
+If a command completes successfully, the device MUST set
+\field{status} to VIRTIO_ADMIN_STATUS_OK.
+
+If a command fails, the device MUST set
+\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK.
+
+If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the
+device state MUST NOT change, that is the command MUST NOT have
+any side effects on the device, in particular the device MUST not
+enter an error state as a result of this command.
+
+If a command fails, the device state generally SHOULD NOT change,
+as far as possible.
+
+The device MAY enforce additional restrictions and dependencies on
+opcodes used by the driver and MAY fail the command
+VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL
+and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD
+if the list of commands used violate internal device dependencies.
+
+If the device supports multiple group types, commands for each group
+type MUST operate independently of each other, in particular,
+the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY
+for different group types.
+
+After reset, if the device supports a given group type
+and before receiving VIRTIO_ADMIN_CMD_LIST_USE for this group type
+the device MUST assume
+that the list of legal commands used by the driver consists of
+the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE.
+
+After completing VIRTIO_ADMIN_CMD_LIST_USE successfully,
+the device MUST set the list of legal commands used by the driver
+to the one supplied in \field{command_specific_data}.
+
+The device MUST set the list of legal commands used by the driver
+to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE.
+

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 319

Quoted 10 lines
admin.tex +10 -0
+The device MUST validate commands against the list used by
+the driver and MUST fail any commands not in the list with
+\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL
+and \field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE.
+
+The list of supported commands MUST NOT shrink (but MAY expand):
+after reporting a given command as supported through
+VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it
+as unsupported.  Further, after a given set of commands has been

Can the driver re-negotiate the command list through QUERY/USE in flight rather than upon a reset? If not, shall forbid this explicitly?

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 323

Quoted 4 lines
admin.tex +4 -0
+used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a
+device or system reset the device SHOULD complete successfully
+any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same
+list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails

I think this requires the device to remember what it had offered even after a power-cycled reset, shall we say: The device should always offer all supported commands in the list?

Thanks,
Zhu Lingshan

Quoted 143 lines
admin.tex +135 -1
+after a device or system reset, the device MUST not fail it
+solely because of the command list used.  Failure to do so would
+interfere with resuming from suspend and error recovery.
+
+When processing a command with the SR-IOV group type,
+if the device does not have an SR-IOV Extended Capability or
+if \field{VF Enable} is clear
+then the device MUST fail all commands with
+\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL and
+\field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP;
+otherwise, if \field{group_member_id} is not
+between $1$ and \field{NumVFs} inclusive,
+the device MUST fail all commands with
+\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL and
+\field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_MEMBER;
+\field{NumVFs}, \field{VF Migration Capable}  and
+\field{VF Enable} refer to registers within the SR-IOV Extended
+Capability as specified by \hyperref[intro:PCIe]{[PCIe]}.
+
+\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands}
+
+The driver MAY discover whether device supports a specific group type
+by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching
+\field{group_type}.
+
+The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE
+and wait for it to be completed with status
+VIRTIO_ADMIN_STATUS_OK before issuing any commands
+(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY
+and VIRTIO_ADMIN_CMD_LIST_USE).
+
+The driver SHOULD NOT set bits in device_admin_cmds
+if it is not familiar with how the command opcode
+is used, as dependencies between command opcodes might exist.
+
+The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE)
+the use of any commands not previously reported as
+supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY.
+
+The driver MUST NOT use any commands for a given group type
+before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct
+list of command opcodes and group type.
+
+The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and
+VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE
+with respective bits cleared in \field{command_specific_data}.
+
+The driver MUST handle a command error with a reserved \field{status}
+value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL
+(except possibly for different error reporting/diagnostic messages).
+
+The driver MUST handle a command error with a reserved
+\field{status_qualifier} value in the same way as
+\field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for
+different error reporting/diagnostic messages).
+
+When sending commands with the SR-IOV group type,
+the driver specify a value for \field{group_member_id}
+between $1$ and \field{NumVFs} inclusive,
+the driver MUST also make sure that as long as any such command
+is outstanding, \field{VF Migration Capable} is clear and
+\field{VF Enable} is set;
+\field{NumVFs}, \field{VF Migration Capable}  and
+\field{VF Enable} refer to registers within the SR-IOV Extended
+Capability as specified by \hyperref[intro:PCIe]{[PCIe]}.
+
  \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}
 
  An administration virtqueue of an owner device is used to submit
@@ -323,4 +462,79 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic
  of the specification are designed, new fields can be added to the
  tail of a structure, with the driver/device using the full
  structure without concern for versioning.
->>>>>>> 0edc690... admin: introduce virtio admin virtqueues
+
+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues}
+
+The device MUST support device-readable and device-writeable buffers
+shorter than described in this specification, by
+\begin{enumerate}
+\item acting as if any data that would be read outside the
+device-readable buffers is set to zero, and
+\item discarding data that would be written outside the
+specified device-writeable buffers.
+\end{enumerate}
+
+The device MUST support device-readable and device-writeable buffers
+longer than described in this specification, by
+\begin{enumerate}
+\item ignoring any data in device-readable buffers outside
+the expected length, and
+\item only writing the expected structure to the device-writeable
+buffers, ignoring any extra buffers, and reporting the
+actual length of data written, in bytes,
+as buffer used length.
+\end{enumerate}
+
+The device SHOULD initialize the device-writeable buffer
+up to the length of the structure described by this specification or
+the length of the buffer supplied by the driver (even if the buffer is
+all set to zero), whichever is shorter.
+
+The device MUST NOT fail a command solely because the buffers
+provided are shorter or longer than described in this
+specification.
+
+The device MUST initialize the device-writeable part of
+\field{struct virtio_admin_cmd} that is a multiple of 64 bit in
+size.
+
+The device MUST initialize \field{status} in \field{struct
+virtio_admin_cmd}.
+
+The device MUST process commands on a given administration virtqueue
+in the order in which they are queued.
+
+If multiple administration virtqueues have been configured,
+device MAY process commands on distinct virtqueues with
+no order constraints.
+
+\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues}
+
+The driver MAY supply device-readable or device-writeable parts
+of \field{struct virtio_admin_cmd} that are longer than described in
+this specification.
+
+The driver SHOULD supply device-readable part of
+\field{struct virtio_admin_cmd} that is at least as
+large as the structure described by this specification
+(even if the structure is all set to zero).
+
+The driver MUST supply both device-readable or device-writeable parts
+of \field{struct virtio_admin_cmd} that are a multiple of 64 bit
+in length.
+
+The device MUST supply both device-readable or device-writeable parts
+of \field{struct virtio_admin_cmd} that are larger than zero in
+length. However, \field{command_specific_data} and
+\field{command_specific_result} MAY be zero in length, unless
+specified otherwise for the command.

admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 540

Quoted 10 lines
admin.tex +10 -0
+
+The driver MUST NOT assume that the device will initialize the whole
+device-writeable part of \field{struct virtio_admin_cmd} as described in the specification; instead,
+the driver MUST act as if the structure
+outside the part of the buffer used by the device
+is set to zero.
+
+If multiple administration virtqueues have been configured,
+the driver MUST ensure ordering for commands
+placed on different administration virtqueues.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#166 lore raw

[virtio-comment] Re: [PATCH v10 09/10] admin: conformance clauses

Quoted 85 lines · Lingshan
Quoted 70 lines · Michael S. Tsirkin

Add conformance clauses for admin commands and admin virtqueues.

---
  admin.tex | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 215 insertions(+), 1 deletion(-)
admin.tex +56 -0
index 1172054..6c4f79c 100644
@@ -251,6 +251,145 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
  supporting multiple group types, the list of supported commands
  might differ between different group types.
+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands}
+
+The device MUST validate \field{opcode}, \field{group_type} and
+\field{group_member_id}, and if any of these has an invalid or
+unsupported value, set \field{status} to
+VIRTIO_ADMIN_STATUS_EINVAL and set \field{status_qualifier}
+accordingly:
+\begin{itemize}
+\item if \field{group_type} is invalid, \field{status_qualifier}
+	MUST be set to VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP;
+\item otherwise, if \field{opcode} is invalid,
+	\field{status_qualifier} MUST be set to
+	VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE;
+\item otherwise, if \field{group_member_id} is used by the
+	specific command and is invalid, \field{status_qualifier} MUST be
+	set to VIRTIO_ADMIN_STATUS_Q_INVALID_MEMBER.
+\end{itemize}
+
+If a command completes successfully, the device MUST set
+\field{status} to VIRTIO_ADMIN_STATUS_OK.
+
+If a command fails, the device MUST set
+\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK.
+
+If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the
+device state MUST NOT change, that is the command MUST NOT have
+any side effects on the device, in particular the device MUST not
+enter an error state as a result of this command.
+
+If a command fails, the device state generally SHOULD NOT change,
+as far as possible.
+
+The device MAY enforce additional restrictions and dependencies on
+opcodes used by the driver and MAY fail the command
+VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL
+and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD
+if the list of commands used violate internal device dependencies.
+
+If the device supports multiple group types, commands for each group
+type MUST operate independently of each other, in particular,
+the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY
+for different group types.
+
+After reset, if the device supports a given group type
+and before receiving VIRTIO_ADMIN_CMD_LIST_USE for this group type
+the device MUST assume
+that the list of legal commands used by the driver consists of
+the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE.
+
+After completing VIRTIO_ADMIN_CMD_LIST_USE successfully,
+the device MUST set the list of legal commands used by the driver
+to the one supplied in \field{command_specific_data}.
+
+The device MUST set the list of legal commands used by the driver
+to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE.
+

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 318

Quoted 10 lines
admin.tex +10 -0
+The device MUST validate commands against the list used by
+the driver and MUST fail any commands not in the list with
+\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL
+and \field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE.
+
+The list of supported commands MUST NOT shrink (but MAY expand):
+after reporting a given command as supported through
+VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it
+as unsupported.  Further, after a given set of commands has been

Can the driver re-negotiate the command list through QUERY/USE in flight rather than upon a reset? If not, shall forbid this explicitly?

Quoted 6 lines

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 323

Quoted 4 lines
admin.tex +4 -0
+used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a
+device or system reset the device SHOULD complete successfully
+any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same
+list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails

I think this requires the device to remember what it had offered even after a power-cycled reset,

It just says always return the same.

Quoted 3 lines

shall we say: The device should always offer all
supported
commands in the list?

I don't see what will it mean.

Quoted 146 lines

Thanks,
Zhu Lingshan

Quoted 144 lines
admin.tex +137 -1
+after a device or system reset, the device MUST not fail it
+solely because of the command list used.  Failure to do so would
+interfere with resuming from suspend and error recovery.
+
+When processing a command with the SR-IOV group type,
+if the device does not have an SR-IOV Extended Capability or
+if \field{VF Enable} is clear
+then the device MUST fail all commands with
+\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL and
+\field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP;
+otherwise, if \field{group_member_id} is not
+between $1$ and \field{NumVFs} inclusive,
+the device MUST fail all commands with
+\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL and
+\field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_MEMBER;
+\field{NumVFs}, \field{VF Migration Capable}  and
+\field{VF Enable} refer to registers within the SR-IOV Extended
+Capability as specified by \hyperref[intro:PCIe]{[PCIe]}.
+
+\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands}
+
+The driver MAY discover whether device supports a specific group type
+by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching
+\field{group_type}.
+
+The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE
+and wait for it to be completed with status
+VIRTIO_ADMIN_STATUS_OK before issuing any commands
+(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY
+and VIRTIO_ADMIN_CMD_LIST_USE).
+
+The driver SHOULD NOT set bits in device_admin_cmds
+if it is not familiar with how the command opcode
+is used, as dependencies between command opcodes might exist.
+
+The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE)
+the use of any commands not previously reported as
+supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY.
+
+The driver MUST NOT use any commands for a given group type
+before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct
+list of command opcodes and group type.
+
+The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and
+VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE
+with respective bits cleared in \field{command_specific_data}.
+
+The driver MUST handle a command error with a reserved \field{status}
+value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL
+(except possibly for different error reporting/diagnostic messages).
+
+The driver MUST handle a command error with a reserved
+\field{status_qualifier} value in the same way as
+\field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for
+different error reporting/diagnostic messages).
+
+When sending commands with the SR-IOV group type,
+the driver specify a value for \field{group_member_id}
+between $1$ and \field{NumVFs} inclusive,
+the driver MUST also make sure that as long as any such command
+is outstanding, \field{VF Migration Capable} is clear and
+\field{VF Enable} is set;
+\field{NumVFs}, \field{VF Migration Capable}  and
+\field{VF Enable} refer to registers within the SR-IOV Extended
+Capability as specified by \hyperref[intro:PCIe]{[PCIe]}.
+
  \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}
  An administration virtqueue of an owner device is used to submit
@@ -323,4 +462,79 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic
  of the specification are designed, new fields can be added to the
  tail of a structure, with the driver/device using the full
  structure without concern for versioning.
->>>>>>> 0edc690... admin: introduce virtio admin virtqueues
+
+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues}
+
+The device MUST support device-readable and device-writeable buffers
+shorter than described in this specification, by
+\begin{enumerate}
+\item acting as if any data that would be read outside the
+device-readable buffers is set to zero, and
+\item discarding data that would be written outside the
+specified device-writeable buffers.
+\end{enumerate}
+
+The device MUST support device-readable and device-writeable buffers
+longer than described in this specification, by
+\begin{enumerate}
+\item ignoring any data in device-readable buffers outside
+the expected length, and
+\item only writing the expected structure to the device-writeable
+buffers, ignoring any extra buffers, and reporting the
+actual length of data written, in bytes,
+as buffer used length.
+\end{enumerate}
+
+The device SHOULD initialize the device-writeable buffer
+up to the length of the structure described by this specification or
+the length of the buffer supplied by the driver (even if the buffer is
+all set to zero), whichever is shorter.
+
+The device MUST NOT fail a command solely because the buffers
+provided are shorter or longer than described in this
+specification.
+
+The device MUST initialize the device-writeable part of
+\field{struct virtio_admin_cmd} that is a multiple of 64 bit in
+size.
+
+The device MUST initialize \field{status} in \field{struct
+virtio_admin_cmd}.
+
+The device MUST process commands on a given administration virtqueue
+in the order in which they are queued.
+
+If multiple administration virtqueues have been configured,
+device MAY process commands on distinct virtqueues with
+no order constraints.
+
+\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues}
+
+The driver MAY supply device-readable or device-writeable parts
+of \field{struct virtio_admin_cmd} that are longer than described in
+this specification.
+
+The driver SHOULD supply device-readable part of
+\field{struct virtio_admin_cmd} that is at least as
+large as the structure described by this specification
+(even if the structure is all set to zero).
+
+The driver MUST supply both device-readable or device-writeable parts
+of \field{struct virtio_admin_cmd} that are a multiple of 64 bit
+in length.
+
+The device MUST supply both device-readable or device-writeable parts
+of \field{struct virtio_admin_cmd} that are larger than zero in
+length. However, \field{command_specific_data} and
+\field{command_specific_result} MAY be zero in length, unless
+specified otherwise for the command.
+
+The driver MUST NOT assume that the device will initialize the whole
Quoted 8 lines

admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 540

Quoted 8 lines
admin.tex +8 -0
+device-writeable part of \field{struct virtio_admin_cmd} as described in the specification; instead,
+the driver MUST act as if the structure
+outside the part of the buffer used by the device
+is set to zero.
+
+If multiple administration virtqueues have been configured,
+the driver MUST ensure ordering for commands
+placed on different administration virtqueues.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

#168 lore raw

[virtio-comment] Re: [PATCH v10 09/10] admin: conformance clauses

In reply to Zhu, Lingshan
Quoted 6 lines · Lingshan

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 319

Quoted 4 lines
admin.tex +4 -0
+The list of supported commands MUST NOT shrink (but MAY expand):
+after reporting a given command as supported through
+VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it
+as unsupported.  Further, after a given set of commands has been

Can the driver re-negotiate the command list through QUERY/USE in flight rather than upon a reset? If not, shall forbid this explicitly?

Probably best to allow this.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#167 lore raw

[virtio-comment] Re: [PATCH v10 09/10] admin: conformance clauses

In reply to Michael S. Tsirkin
Quoted 91 lines · Michael S. Tsirkin
Quoted 84 lines · Lingshan
Quoted 70 lines · Michael S. Tsirkin

Add conformance clauses for admin commands and admin virtqueues.

---
   admin.tex | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
   1 file changed, 215 insertions(+), 1 deletion(-)
admin.tex +56 -0
index 1172054..6c4f79c 100644
@@ -251,6 +251,145 @@ \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti
   supporting multiple group types, the list of supported commands
   might differ between different group types.
+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands}
+
+The device MUST validate \field{opcode}, \field{group_type} and
+\field{group_member_id}, and if any of these has an invalid or
+unsupported value, set \field{status} to
+VIRTIO_ADMIN_STATUS_EINVAL and set \field{status_qualifier}
+accordingly:
+\begin{itemize}
+\item if \field{group_type} is invalid, \field{status_qualifier}
+	MUST be set to VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP;
+\item otherwise, if \field{opcode} is invalid,
+	\field{status_qualifier} MUST be set to
+	VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE;
+\item otherwise, if \field{group_member_id} is used by the
+	specific command and is invalid, \field{status_qualifier} MUST be
+	set to VIRTIO_ADMIN_STATUS_Q_INVALID_MEMBER.
+\end{itemize}
+
+If a command completes successfully, the device MUST set
+\field{status} to VIRTIO_ADMIN_STATUS_OK.
+
+If a command fails, the device MUST set
+\field{status} to a value different from VIRTIO_ADMIN_STATUS_OK.
+
+If \field{status} is set to VIRTIO_ADMIN_STATUS_EINVAL, the
+device state MUST NOT change, that is the command MUST NOT have
+any side effects on the device, in particular the device MUST not
+enter an error state as a result of this command.
+
+If a command fails, the device state generally SHOULD NOT change,
+as far as possible.
+
+The device MAY enforce additional restrictions and dependencies on
+opcodes used by the driver and MAY fail the command
+VIRTIO_ADMIN_CMD_LIST_USE with \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL
+and \field{status_qualifier} set to VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD
+if the list of commands used violate internal device dependencies.
+
+If the device supports multiple group types, commands for each group
+type MUST operate independently of each other, in particular,
+the device MAY return different results for VIRTIO_ADMIN_CMD_LIST_QUERY
+for different group types.
+
+After reset, if the device supports a given group type
+and before receiving VIRTIO_ADMIN_CMD_LIST_USE for this group type
+the device MUST assume
+that the list of legal commands used by the driver consists of
+the two commands VIRTIO_ADMIN_CMD_LIST_QUERY and VIRTIO_ADMIN_CMD_LIST_USE.
+
+After completing VIRTIO_ADMIN_CMD_LIST_USE successfully,
+the device MUST set the list of legal commands used by the driver
+to the one supplied in \field{command_specific_data}.
+
+The device MUST set the list of legal commands used by the driver
+to the one supplied in VIRTIO_ADMIN_CMD_LIST_USE.
+

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 318

Quoted 10 lines
admin.tex +10 -0
+The device MUST validate commands against the list used by
+the driver and MUST fail any commands not in the list with
+\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL
+and \field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE.
+
+The list of supported commands MUST NOT shrink (but MAY expand):
+after reporting a given command as supported through
+VIRTIO_ADMIN_CMD_LIST_QUERY the device MUST NOT later report it
+as unsupported.  Further, after a given set of commands has been

Can the driver re-negotiate the command list through QUERY/USE in flight rather than upon a reset? If not, shall forbid this explicitly?

Quoted 6 lines

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 323

Quoted 4 lines
admin.tex +4 -0
+used (via a successful VIRTIO_ADMIN_CMD_LIST_USE), then after a
+device or system reset the device SHOULD complete successfully
+any following calls to VIRTIO_ADMIN_CMD_LIST_USE with the same
+list of commands; if this command VIRTIO_ADMIN_CMD_LIST_USE fails

I think this requires the device to remember what it had offered even after a power-cycled reset,

Quoted 6 lines

It just says always return the same.

Quoted 3 lines

shall we say: The device should always offer all
supported
commands in the list?

I don't see what will it mean.

For example, a device can support more commands(even can be vendor specific commands) through a firmware upgrade, then after a reset, it should report more supported commands in the list through QEURY,
so maybe not a good idea to report the same command set. The device should report all supported commands after a reset.

Quoted 147 lines
Quoted 147 lines

Thanks,
Zhu Lingshan

Quoted 144 lines
admin.tex +137 -1
+after a device or system reset, the device MUST not fail it
+solely because of the command list used.  Failure to do so would
+interfere with resuming from suspend and error recovery.
+
+When processing a command with the SR-IOV group type,
+if the device does not have an SR-IOV Extended Capability or
+if \field{VF Enable} is clear
+then the device MUST fail all commands with
+\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL and
+\field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP;
+otherwise, if \field{group_member_id} is not
+between $1$ and \field{NumVFs} inclusive,
+the device MUST fail all commands with
+\field{status} set to VIRTIO_ADMIN_STATUS_EINVAL and
+\field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_MEMBER;
+\field{NumVFs}, \field{VF Migration Capable}  and
+\field{VF Enable} refer to registers within the SR-IOV Extended
+Capability as specified by \hyperref[intro:PCIe]{[PCIe]}.
+
+\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Device groups / Group administration commands}
+
+The driver MAY discover whether device supports a specific group type
+by issuing VIRTIO_ADMIN_CMD_LIST_QUERY with the matching
+\field{group_type}.
+
+The driver MUST issue VIRTIO_ADMIN_CMD_LIST_USE
+and wait for it to be completed with status
+VIRTIO_ADMIN_STATUS_OK before issuing any commands
+(except for the initial VIRTIO_ADMIN_CMD_LIST_QUERY
+and VIRTIO_ADMIN_CMD_LIST_USE).
+
+The driver SHOULD NOT set bits in device_admin_cmds
+if it is not familiar with how the command opcode
+is used, as dependencies between command opcodes might exist.
+
+The driver MUST NOT request (via VIRTIO_ADMIN_CMD_LIST_USE)
+the use of any commands not previously reported as
+supported for the same group type by VIRTIO_ADMIN_CMD_LIST_QUERY.
+
+The driver MUST NOT use any commands for a given group type
+before sending VIRTIO_ADMIN_CMD_LIST_USE with the correct
+list of command opcodes and group type.
+
+The driver MAY block use of VIRTIO_ADMIN_CMD_LIST_QUERY and
+VIRTIO_ADMIN_CMD_LIST_USE by issuing VIRTIO_ADMIN_CMD_LIST_USE
+with respective bits cleared in \field{command_specific_data}.
+
+The driver MUST handle a command error with a reserved \field{status}
+value in the same way as \field{status} set to VIRTIO_ADMIN_STATUS_EINVAL
+(except possibly for different error reporting/diagnostic messages).
+
+The driver MUST handle a command error with a reserved
+\field{status_qualifier} value in the same way as
+\field{status_qualifier} set to
+VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND (except possibly for
+different error reporting/diagnostic messages).
+
+When sending commands with the SR-IOV group type,
+the driver specify a value for \field{group_member_id}
+between $1$ and \field{NumVFs} inclusive,
+the driver MUST also make sure that as long as any such command
+is outstanding, \field{VF Migration Capable} is clear and
+\field{VF Enable} is set;
+\field{NumVFs}, \field{VF Migration Capable}  and
+\field{VF Enable} refer to registers within the SR-IOV Extended
+Capability as specified by \hyperref[intro:PCIe]{[PCIe]}.
+
   \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Device / Administration Virtqueues}
   An administration virtqueue of an owner device is used to submit
@@ -323,4 +462,79 @@ \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic
   of the specification are designed, new fields can be added to the
   tail of a structure, with the driver/device using the full
   structure without concern for versioning.
->>>>>>> 0edc690... admin: introduce virtio admin virtqueues
+
+\devicenormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues}
+
+The device MUST support device-readable and device-writeable buffers
+shorter than described in this specification, by
+\begin{enumerate}
+\item acting as if any data that would be read outside the
+device-readable buffers is set to zero, and
+\item discarding data that would be written outside the
+specified device-writeable buffers.
+\end{enumerate}
+
+The device MUST support device-readable and device-writeable buffers
+longer than described in this specification, by
+\begin{enumerate}
+\item ignoring any data in device-readable buffers outside
+the expected length, and
+\item only writing the expected structure to the device-writeable
+buffers, ignoring any extra buffers, and reporting the
+actual length of data written, in bytes,
+as buffer used length.
+\end{enumerate}
+
+The device SHOULD initialize the device-writeable buffer
+up to the length of the structure described by this specification or
+the length of the buffer supplied by the driver (even if the buffer is
+all set to zero), whichever is shorter.
+
+The device MUST NOT fail a command solely because the buffers
+provided are shorter or longer than described in this
+specification.
+
+The device MUST initialize the device-writeable part of
+\field{struct virtio_admin_cmd} that is a multiple of 64 bit in
+size.
+
+The device MUST initialize \field{status} in \field{struct
+virtio_admin_cmd}.
+
+The device MUST process commands on a given administration virtqueue
+in the order in which they are queued.
+
+If multiple administration virtqueues have been configured,
+device MAY process commands on distinct virtqueues with
+no order constraints.
+
+\drivernormative{\paragraph}{Group administration commands}{Basic Facilities of a Virtio Device / Administration virtqueues}
+
+The driver MAY supply device-readable or device-writeable parts
+of \field{struct virtio_admin_cmd} that are longer than described in
+this specification.
+
+The driver SHOULD supply device-readable part of
+\field{struct virtio_admin_cmd} that is at least as
+large as the structure described by this specification
+(even if the structure is all set to zero).
+
+The driver MUST supply both device-readable or device-writeable parts
+of \field{struct virtio_admin_cmd} that are a multiple of 64 bit
+in length.
+
+The device MUST supply both device-readable or device-writeable parts
+of \field{struct virtio_admin_cmd} that are larger than zero in
+length. However, \field{command_specific_data} and
+\field{command_specific_result} MAY be zero in length, unless
+specified otherwise for the command.
+
+The driver MUST NOT assume that the device will initialize the whole
Quoted 8 lines
Quoted 8 lines

admin.tex \section{Administration Virtqueues}\label{sec:Basic Facilities of a Virtio Devic · line 540

Quoted 8 lines
admin.tex +8 -0
+device-writeable part of \field{struct virtio_admin_cmd} as described in the specification; instead,
+the driver MUST act as if the structure
+outside the part of the buffer used by the device
+is set to zero.
+
+If multiple administration virtqueues have been configured,
+the driver MUST ensure ordering for commands
+placed on different administration virtqueues.

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#36 lore raw

[virtio-comment] Re: [PATCH v10 03/10] admin: introduce group administration commands

In reply to Michael S. Tsirkin
Quoted 11 lines · Michael S. Tsirkin
Quoted 10 lines · Parav Pandit

admin.tex \section{Device groups}\label{sec:Basic Facilities of a Virtio Device / Device g · line 132

Quoted 7 lines

From: Michael S. Tsirkin <[email protected]>
Sent: Thursday, March 2, 2023 8:05 AM

admin.tex +3 -0
+When \field{status} is VIRTIO_ADMIN_STATUS_OK, \field{status_qialifier}
+is reserved and set to zero by the device.
+

s/status_qialifier/status_qualifier
Missed from v10 of Feb.

Quoted 8 lines
Quoted 6 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+When \field{status} is VIRTIO_ADMIN_STATUS_EINVAL, the following table
+describes possible \field{status_qialifier} values:

s/status_qialifier/status_qualifier

Can you please add other useful error codes in addition to the EINVAL? Few that we are needed EAGAIN, ENOMEM, EBUSY, ENODEV.

We'll add them when there's a use-case.

Can you please add at least the EAGAIN in v11 ?
HW devices my be in a transitional state in which the command can't succeed in time T but the same command may succeed if it retried in time T'.

This is very common in linux as well and it's will improve the virtio AQ spec.

We as device developers need more that one type of error.

Definition:
VIRTIO_ADMIN_STATUS_EAGAIN - command may succeed if retried

Quoted 32 lines
Quoted 2 lines

And with that, VIRTIO_ADMIN_STATUS_Q_INVALID_MEMBER moves under ENODEV error code.

No I think that belongs in in EINVAL - command is malformed. ENODEV is more "The wrong type of device was given to a function that expects a particular sort of device."

Quoted 22 lines
Quoted 22 lines

+\begin{tabular}{|l|l|l|}
+\hline
+Status & Name & Description \\
+\hline \hline
+0x00 & VIRTIO_ADMIN_STATUS_Q_INVALID_COMMAND & command
error: no additional information \\
+\hline
+0x01 & VIRTIO_ADMIN_STATUS_Q_INVALID_OPCODE & unsupported or
invalid \field{opcode} \\
+\hline
+0x02 & VIRTIO_ADMIN_STATUS_Q_INVALID_FIELD & unsupported or
invalid field within \field{command_specific_data} \\
+\hline
+0x03 & VIRTIO_ADMIN_STATUS_Q_INVALID_GROUP & unsupported or
invalid \field{group_type} \\
+\hline
+0x04 & VIRTIO_ADMIN_STATUS_Q_INVALID_MEMBER & unsupported or
invalid \field{group_member_id} \\
+\hline
+0x05-0xFFFF & - & reserved for future use \\
+\hline
+\end{tabular}

This publicly archived list offers a means to provide input to the OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and to minimize spam in the list archive, subscription is required before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/

#60 lore raw

[virtio-comment] Re: [virtio] Re: [PATCH v10 04/10] admin: introduce virtio admin virtqueues

In reply to Stefan Hajnoczi
Quoted 39 lines · Stefan Hajnoczi
Quoted 29 lines · Michael S. Tsirkin
Quoted 18 lines · Stefan Hajnoczi
Quoted 17 lines · Michael S. Tsirkin
Quoted 15 lines · Stefan Hajnoczi
Quoted 11 lines · Michael S. Tsirkin
Quoted 8 lines · Stefan Hajnoczi

What happens if a command takes 1 second to complete, is the device allowed to process the next command from the virtqueue during this time, possibly completing it before the first command?

This requires additional clarification in the spec because "they are processed by the device in the order in which they are queued" does not explain whether commands block the virtqueue (in order completion) or not (out of order completion).

Oh I begin to see. Hmm how does e.g. virtio scsi handle this?

virtio-scsi, virtio-blk, and NVMe requests may complete out of order. Several may be processed by the device at the same time.

Quoted 7 lines
Quoted 2 lines

Let's say I submit a write followed by read - is read guaranteed to return an up to date info?

In general, no. The driver must wait for the write completion before submitting the read if it wants consistency.

Stefan

I see. I think it's a good design to follow then.

Quoted 8 lines

I'll just copy
The driver queues requests to an arbitrary request queue, and they are used by the device on that same queue. It is the responsibility of the driver to ensure strict request ordering for commands placed on different queues, because they will be consumed with no order constraints.

replacing "request" with "admin".

Quoted 7 lines

That sounds like it's only about multi-queue because it says "... for commands placed on different queues". What I mentioned about a write followed by a read quest also applies within a single queue.

Can you clarify the semantics in the single queue case?

Stefan

This will be addressed in the latest version. However, should not scsi and blk also adjust the wording to make it clear device does not guarantee consistency?

Signature · 18 lines
MST


This publicly archived list offers a means to provide input to the
OASIS Virtual I/O Device (VIRTIO) TC.

In order to verify user consent to the Feedback License terms and
to minimize spam in the list archive, subscription is required
before posting.

Subscribe: [email protected]
Unsubscribe: [email protected]
List help: [email protected]
List archive: https://lists.oasis-open.org/archives/virtio-comment/
Feedback License: https://www.oasis-open.org/who/ipr/feedback_license.pdf
List Guidelines: https://www.oasis-open.org/policies-guidelines/mailing-lists
Committee: https://www.oasis-open.org/committees/virtio/
Join OASIS: https://www.oasis-open.org/join/
#148 lore raw

[virtio-comment] Re: [PATCH v10 08/10] admin: command list discovery

In reply to Stefan Hajnoczi
Quoted 4 lines · Stefan Hajnoczi

Is the purpose of VIRTIO_ADMIN_CMD_LIST_USE so that new commands can be added that are mandatory for device operation. Failure to include them in the VIRTIO_ADMIN_CMD_LIST_USE command terminates device initialization with an error?

Or, switches the device to some legacy mode.

Quoted 5 lines

Are commands evolved by defining flag/version bits in the command specific data struct? For example, if a new field needs to be added to a command and a 0 value carries a meaning (so it cannot simply be added to the end of the existing struct with backwards compatibility).

commands expect to be evolved by extending the command specific structure at the tail. this is why I spent so much time on that in the text. if that does not work a new command will work.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
#153 lore raw

Re: [virtio-comment] Re: [virtio-dev] [PATCH v10 08/10] admin: command list discovery

In reply to Jiri Pirko
Quoted 40 lines · Jiri Pirko
Quoted 31 lines · Wed, Mar 08, 2023 at 12:54:52PM CET, [email protected] wrote:
Quoted 15 lines · Jiri Pirko
Quoted 10 lines · Thu, Mar 02, 2023 at 02:05:22PM CET, [email protected] wrote:

Add commands to find out which commands does each group support, as well as enable their use by driver.
This will be especially useful once we have multiple group types.

An alternative is per-type VQs. This is possible but will require more per-transport work. Discovery through the vq helps keep things contained.

[...]

Quoted 14 lines

admin.tex \subsection{Group administration commands}\label{sec:Basic Facilities of a Virti · line 236

Quoted 9 lines
admin.tex +9 -0
+
+The driver issues the command VIRTIO_ADMIN_CMD_LIST_QUERY to
+query the list of commands valid for this group and before sending
+any commands for any member of a group.
+
+The driver then enables use of some of the opcodes by sending to
+the device the command VIRTIO_ADMIN_CMD_LIST_USE with a subset
+of the list returned by VIRTIO_ADMIN_CMD_LIST_QUERY that is
+both understood and used by the driver.

To my untrained ear, this sounds somewhat similar to the feature negotiantion mechanism. Why the fact that device/driver supports some command can't be covered by just another feature? Looks like unnecassary complexicity to negotiate supported commands like this.

Quoted 7 lines

Absolutely, it is similar. The issue is that a single device can be an owner for multiple group types.
For example, I think an SRIOV PF itself can have subfunctions with SIOV as well as virtual functions with SRIOV.
And the set of supported commands might differ.

We thus need a command that is kind of like features but per group type.

Quoted 8 lines

I see. But that does not mean it can't be done using existing features:

_F_SRIOV_CMD1
_F_SRIOV_CMD2
..
_F_SIOV_CMD1
_F_SIOV_CMD2
...

True. But annoying if each command has to be duplicated.

Quoted 10 lines
Quoted 7 lines

As a small bonus as we are building this from scratch, I added something which was requested for a long time from features which is blocking access to commands not allowed by features. With standard virtio features we trust the driver not to send commands before enabling a feature and this was considered a maintainance/security problem.

I understand. Is it unfixable for features not to break buggy drivers?

I think it is, feature negotiation is hard to evolve since our compat strategy is built around feature negotiation.

Signature · 6 lines
MST


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]