On Wed, Sep 02, 2020 at 04:41:49PM +0200, Klemens Nanni wrote:
> They way strides work is everything but intuitive and the manual doesn't
> really help;  I've had multiple hackers/users ask me how to use them.
> 
> `vcpu 8' assigns eight virtual CPUs to a domain.
> 
> `vcpu 8:2' allocates eight VCPUs two times but assigns eight VCPUs
> only once, leaving the other eight allocated (read: unusable) but not
> assigned to any domain.
> 
> `vcpu 8:3' would allocate 24 VCPUs and assign eight to a domain.
> 
> This multiplicative property is not obvious from the manual; the way I
> read the current wording is `vcpu 8:2' allocating ten VCPUs and assign
> eight, i.e. the stride being an additive count.
> 
> stsp brought this up and we came up with the following diff.
> Feedback? OK?

My problem with the existing wording is that it says a "stride" exists
but semantics are not specified. I ended up assuming stride corresponded
to the amount of unused CPUs (e.g. 8:4 would mean allocate 8 CPUs, and
leave 4 of those CPUs unused).
I could only find out how it actually works by reading code.

I would like to suggest an example for the EXAMPLES section which
illustrates how a suitable stride factor can be determined (divide the
number of desired "unused" cpus by the number of desired "used" cpus):

diff f2b93fb3c1fc6097f79ea2bfd28de3a4ab8b938b /usr/src
blob - 1d72ee44a4ab333146b004907e240dfd939f11c5
file + usr.sbin/ldomctl/ldom.conf.5
--- usr.sbin/ldomctl/ldom.conf.5
+++ usr.sbin/ldomctl/ldom.conf.5
@@ -112,6 +112,12 @@ domain "salmah" {
 .Pp
 On a machine with 32 cores and 64GB physical memory, this leaves 12 cores and
 58GB memory to the primary domain.
+.Pp
+In order to use 2 CPUs out of 8, leaving 6 CPUs allocated but unused,
+a stride factor of 3 must be used (6 divided by 2):
+.Bd -literal -offset indent
+       vcpu 2:3
+.Ed
 .Sh SEE ALSO
 .Xr eeprom 8 ,
 .Xr ldomctl 8 ,

Reply via email to