qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] How do we do user input bitmap properties?


From: Dave Martin
Subject: Re: [Qemu-devel] How do we do user input bitmap properties?
Date: Thu, 18 Apr 2019 11:52:04 +0100
User-agent: Mutt/1.5.23 (2014-03-12)

On Thu, Apr 18, 2019 at 10:46:34AM +0100, Andrew Jones wrote:
> On Thu, Apr 18, 2019 at 11:28:41AM +0200, 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 ]
> 
> It doesn't really matter for this discussion, but I just realized
> that I picked bogus numbers for these examples. 32 would be too
> big. The largest supported is 16. I probably should have just used
> the simple [ 1, 2, 4 ] and [ 1, 2, 3, 4 ] arrays, corresponding to
> vector lengths (in bits) 128, 256, 512 and 128, 256, 384, 512.

I'd argue differently from the ABI perspective.

If the host supports vq = [ 1,2,3,4 ], then it is entirely valid to ask
for [ 1,2,4 ].  KVM will fail the KVM_REG_ARM64_SVE_VLS write with
EINVAL, but I don't distinguish between a set that is not satisfiable on
this hardware and a set that is not valid at all.  The kernel basically
doesn't check for the latter: an architecturally invalid set will always
not be satisfiable on the hardware.

Ideally, userspace should not preempt this decision, in case the
architecture becomes more flexible someday in what it can virtualise.

> > 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 can't decide whether it's more or less user-friendly to denote VL in
terms of bytes in this kind of context.

Usually when I say "VL" in the kernel ABI I try to mean this.
(KVM_REG_ARM64_SVE_VLS is a special case: here the lengths are fancily
encoded rather than being passed as integers, so the precise unit used
is a more abstract concept here ... or anyway, that's my excuse.
_SVE_VQS felt odd here.)

For kvmtool I went with quadwords on the command line, but only as a
quick hack to simplify the parser slightly.

OTOH, specifying 1,2,4 on the command line is clearly less annoying and
error-prone than 16,32,64.

Naming the option with "vq" instead of "vl" is another option, though
"vq" is Linux terminology not endorsed by the architecture.

For kvmtool I've considered a range / filtering syntax, but I didn't
implement it yet.

[...]

Cheers
---Dave



reply via email to

[Prev in Thread] Current Thread [Next in Thread]