qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Andrew Jones <drjones@redhat.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, imammedo@redhat.com,
	Dave.Martin@arm.com, armbru@redhat.com, dgilbert@redhat.com
Subject: Re: [Qemu-devel] How do we do user input bitmap properties?
Date: Fri, 19 Apr 2019 02:07:27 +0200	[thread overview]
Message-ID: <03bb1e26-800c-d788-8051-97c5f59036df@redhat.com> (raw)
In-Reply-To: <20190418092841.fzrcegkbal7dpfcy@kamzik.brq.redhat.com>

On 04/18/19 11:28, Andrew Jones wrote:
> Hi all,
> 
> First some background:
> 
> For the userspace side of AArch64 guest SVE support we need to
> expose KVM's allowed vector lengths bitmap to the user and allow
> the user to choose a subset of that bitmap. Since bitmaps are a
> bit awkward to work with then we'll likely want to expose it as
> an array of vector lengths instead. Also, assuming we want to
> expose the lengths as number-of-quadwords (quadword == 128 bits
> for AArch64 and vector lengths must be multiples of quadwords)
> rather than number-of-bits, then an example array (which will
> always be a sequence) might be
> 
>  [ 8, 16, 32 ]
> 
> The user may choose a subsequence, but only through truncation,
> i.e. [ 8, 32 ] is not valid, but [ 8, 16 ] is.
> 
> Furthermore, different hosts may support different sequences
> which have the same maximum. For example, if the above sequence
> is for Host_A, then Host_B could be
> 
>  [ 8, 16, 24, 32 ]
> 
> The host must support all lengths in the sequence, which means
> that while Host_A supports 32, since it doesn't support 24 and
> we can only truncate sequences, we must use either [ 8 ] or
> [ 8, 16 ] for a compatible sequence if we intend to migrate
> between the hosts.
> 
> Now to the $SUBJECT question:
> 
> My feeling is that we should require the sequence to be
> provided on the command line as a cpu property. Something
> like
> 
>   -cpu host,sve-vl-list=8:16
> 
> (I chose ':' for the delimiter because ',' can't work, but
> if there's a better choice, then that's fine by me.)
> 
> Afaict a property list like this will require a new parser,
> which feels a bit funny since it seems we should already
> have support for this type of thing somewhere in QEMU. So,
> the question is: do we?

I think so. OptsVisitor can parse repeated properties from an option and
turn them into a list that you define in QAPI schema. More precisely,
you'd define the schema first, subject to "rules" and "restrictions",
and then OptsVisitor would allow you to grab that schema from command
line options. A list of integers qualifies.

See for example:

[Qemu-devel] [PATCH v2 0/8] OptsVisitor: support / flatten integer range
https://lists.gnu.org/archive/html/qemu-devel/2013-08/msg02686.html

(this is actually a feature on top of what you seem to need, but this is
what I could find right now).

Although I worked on this stuff in 2012-2013 (and so I remember
basically nothing about it), it should still function, because the qtest
suite exercises it with good coverage.

So, suggestions:
- git show -s eb7ee2cb
- check how "-numa" is parsed, and steal it :)

If OptsVisitor is hard to combine with existent options that are already
parsed in a different manner (and I do think it would be difficult),
then a new option could be introduced. For example:

  -sve-vector-lengths allow=8,allow=16

which should give you an ordered list of lengths, and you could distill
that manually into a single bitmap.

Thanks,
Laszlo
PS: I do mean I don't remember anything about OptsVisitor :/

> I see we have array properties, but
> I don't believe that works with the command line. Should we
> only use QMP for this? We already want some QMP in order to
> query the supported vector lengths. Maybe we should use QMP
> to set the selection too? But then what about command line
> support for developers? And if the property is on the command
> line then we don't have to add it to the migration stream.
> 
> Thanks,
> drew
> 

WARNING: multiple messages have this Message-ID (diff)
From: Laszlo Ersek <lersek@redhat.com>
To: Andrew Jones <drjones@redhat.com>, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, dgilbert@redhat.com,
	Dave.Martin@arm.com, armbru@redhat.com, imammedo@redhat.com
Subject: Re: [Qemu-devel] How do we do user input bitmap properties?
Date: Fri, 19 Apr 2019 02:07:27 +0200	[thread overview]
Message-ID: <03bb1e26-800c-d788-8051-97c5f59036df@redhat.com> (raw)
Message-ID: <20190419000727.3LMbSBq_ZwtR_yGIJGLHTmQ3MVQRcnUsYExXXydvYKg@z> (raw)
In-Reply-To: <20190418092841.fzrcegkbal7dpfcy@kamzik.brq.redhat.com>

On 04/18/19 11:28, Andrew Jones wrote:
> Hi all,
> 
> First some background:
> 
> For the userspace side of AArch64 guest SVE support we need to
> expose KVM's allowed vector lengths bitmap to the user and allow
> the user to choose a subset of that bitmap. Since bitmaps are a
> bit awkward to work with then we'll likely want to expose it as
> an array of vector lengths instead. Also, assuming we want to
> expose the lengths as number-of-quadwords (quadword == 128 bits
> for AArch64 and vector lengths must be multiples of quadwords)
> rather than number-of-bits, then an example array (which will
> always be a sequence) might be
> 
>  [ 8, 16, 32 ]
> 
> The user may choose a subsequence, but only through truncation,
> i.e. [ 8, 32 ] is not valid, but [ 8, 16 ] is.
> 
> Furthermore, different hosts may support different sequences
> which have the same maximum. For example, if the above sequence
> is for Host_A, then Host_B could be
> 
>  [ 8, 16, 24, 32 ]
> 
> The host must support all lengths in the sequence, which means
> that while Host_A supports 32, since it doesn't support 24 and
> we can only truncate sequences, we must use either [ 8 ] or
> [ 8, 16 ] for a compatible sequence if we intend to migrate
> between the hosts.
> 
> Now to the $SUBJECT question:
> 
> My feeling is that we should require the sequence to be
> provided on the command line as a cpu property. Something
> like
> 
>   -cpu host,sve-vl-list=8:16
> 
> (I chose ':' for the delimiter because ',' can't work, but
> if there's a better choice, then that's fine by me.)
> 
> Afaict a property list like this will require a new parser,
> which feels a bit funny since it seems we should already
> have support for this type of thing somewhere in QEMU. So,
> the question is: do we?

I think so. OptsVisitor can parse repeated properties from an option and
turn them into a list that you define in QAPI schema. More precisely,
you'd define the schema first, subject to "rules" and "restrictions",
and then OptsVisitor would allow you to grab that schema from command
line options. A list of integers qualifies.

See for example:

[Qemu-devel] [PATCH v2 0/8] OptsVisitor: support / flatten integer range
https://lists.gnu.org/archive/html/qemu-devel/2013-08/msg02686.html

(this is actually a feature on top of what you seem to need, but this is
what I could find right now).

Although I worked on this stuff in 2012-2013 (and so I remember
basically nothing about it), it should still function, because the qtest
suite exercises it with good coverage.

So, suggestions:
- git show -s eb7ee2cb
- check how "-numa" is parsed, and steal it :)

If OptsVisitor is hard to combine with existent options that are already
parsed in a different manner (and I do think it would be difficult),
then a new option could be introduced. For example:

  -sve-vector-lengths allow=8,allow=16

which should give you an ordered list of lengths, and you could distill
that manually into a single bitmap.

Thanks,
Laszlo
PS: I do mean I don't remember anything about OptsVisitor :/

> I see we have array properties, but
> I don't believe that works with the command line. Should we
> only use QMP for this? We already want some QMP in order to
> query the supported vector lengths. Maybe we should use QMP
> to set the selection too? But then what about command line
> support for developers? And if the property is on the command
> line then we don't have to add it to the migration stream.
> 
> Thanks,
> drew
> 



  parent reply	other threads:[~2019-04-19  0:07 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-18  9:28 [Qemu-devel] How do we do user input bitmap properties? Andrew Jones
2019-04-18  9:28 ` Andrew Jones
2019-04-18  9:46 ` Andrew Jones
2019-04-18  9:46   ` Andrew Jones
2019-04-18 10:52   ` Dave Martin
2019-04-18 10:52     ` Dave Martin
2019-04-18 11:28     ` Andrew Jones
2019-04-18 11:28       ` Andrew Jones
2019-04-18 14:03       ` Dave Martin
2019-04-18 14:03         ` Dave Martin
2019-04-18 14:43         ` Andrew Jones
2019-04-18 14:43           ` Andrew Jones
2019-04-18 14:46           ` Dave Martin
2019-04-18 14:46             ` Dave Martin
2019-04-18 14:57           ` Dr. David Alan Gilbert
2019-04-18 14:57             ` Dr. David Alan Gilbert
2019-04-18 11:26 ` Daniel P. Berrangé
2019-04-18 11:26   ` Daniel P. Berrangé
2019-04-18 15:09   ` Andrew Jones
2019-04-18 15:09     ` Andrew Jones
2019-04-18 17:48   ` Markus Armbruster
2019-04-18 17:48     ` Markus Armbruster
2019-05-13 18:42     ` Andrew Jones
2019-05-14  4:54       ` Markus Armbruster
2019-05-14  9:02         ` Andrew Jones
2019-05-14 13:32           ` Markus Armbruster
2019-05-15  8:15             ` Andrew Jones
2019-05-15 10:53               ` Dave Martin
2019-05-15 10:59                 ` Dr. David Alan Gilbert
2019-05-14 14:48           ` Igor Mammedov
2019-05-15  8:18             ` Andrew Jones
2019-05-15 10:52               ` Igor Mammedov
2019-05-15 11:54                 ` Andrew Jones
2019-05-23  8:35                   ` Andrea Bolognani
2019-05-24 18:24                     ` Eduardo Habkost
2019-05-27 16:29                       ` Andrea Bolognani
2019-05-27 18:59                         ` Eduardo Habkost
2019-05-15 11:00               ` Dave Martin
2019-05-15 11:09                 ` Dr. David Alan Gilbert
2019-05-15 12:51                   ` Dave Martin
2019-05-15 11:42                 ` Andrew Jones
2019-05-15 12:50                   ` Dave Martin
2019-05-14 15:28         ` Dave Martin
2019-04-19  0:07 ` Laszlo Ersek [this message]
2019-04-19  0:07   ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=03bb1e26-800c-d788-8051-97c5f59036df@redhat.com \
    --to=lersek@redhat.com \
    --cc=Dave.Martin@arm.com \
    --cc=armbru@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=drjones@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).