Date: Tue, 29 Apr 2014 20:57:00 +0400 From: Roman Bogorodskiy <novel@FreeBSD.org> To: Neel Natu <neelnatu@gmail.com> Cc: "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org> Subject: Re: [PATCH] Flexible vcpu pinning configuration Message-ID: <20140429165659.GB2170@kloomba> In-Reply-To: <CAFgRE9FUHEXbnkTSVmpyOP7EMzQh7QEFeNJikVWw6xHRWbvQSw@mail.gmail.com> References: <20140427104511.GA7804@kloomba> <CAFgRE9FUHEXbnkTSVmpyOP7EMzQh7QEFeNJikVWw6xHRWbvQSw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--tsOsTdHNUZQcU9Ye Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Neel Natu wrote: > Hi Roman, >=20 > On Sun, Apr 27, 2014 at 3:45 AM, Roman Bogorodskiy <novel@freebsd.org> wr= ote: > > I've created an initial version of the patch which allows more flexible > > vcpu pinning configuration. > > > > Current schema is: > > > > bhyve -p N > > > > pins vcpu i to hostcpu N + i. > > > > The propsed extension is: > > > > bhyve -p N:M .... -p 0:1 -p 3:5 > > > > which pins vcpu N to host pcpu M. Option needs to be specified > > individually for each vcpu. > > > > So it works like that for me: > > > > sudo /usr/sbin/bhyve -p 0:0 -p 1:3 -c 2 ... > > > > # sudo cpuset -g -t 100262 > > tid 100262 mask: 0 > > # sudo cpuset -g -t 100264 > > tid 100264 mask: 3 > > > > PS I used cpumat_t* array to store these values instead of int, because > > if the idea is OK, I'll extend it to support ranges like e.g. cpuset(1) > > supports, e.g.: "1:2-5". > > > > The questions are: > > > > - Is it OK to chance '-p' arg syntax or it's better to introduce a new > > one? > > >=20 > I think we can reuse the "-p" option unless anybody objects vociferously. >=20 > > - Is the syntax OK (currently: 'vcpu:pcpu', later > > 'vcpu:pcpuN-pcpuM,pcpuX")? >=20 > Yup, I think that works fine. >=20 > The patch looks good in general but I have a few comments: >=20 > - Scope of 'vcpupmap[]' should be restricted to 'static'. >=20 > - usage() and man page need to be updated. >=20 > - pincpu_parse(): > The option parsing can be made much easier by using: >=20 > if (sscanf(str, "%d:%d", &vcpu, &pcpu) =3D=3D 2) { > /* success */ > } else { > return (-1); > } >=20 > If the same vcpu is specified multiple times then we should > malloc(sizeof(cpuset_t)) only the first time: >=20 > if (vcpumap[vcpu] !=3D NULL) > mask =3D vcpumap[vcpu]; > else > mask =3D malloc(sizeof(cpuset_t)); >=20 > We need to range-check 'vcpu' before using it as an index into the > 'vcpumap[]' array. Thanks for the comments, I'll make the fixes you pointed and re-send the patch. Roman Bogorodskiy --tsOsTdHNUZQcU9Ye Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.13 (FreeBSD) iQEcBAEBAgAGBQJTX9nbAAoJEMltX/4IwiJqJmsH/0/KxxVBn8stW50t2RBgUEgV g7ojE9yKGICuuOr/iFvjf+wRdvzqGbniU+jMA2/KtlRRSRdodgwxuOkjiLHagENn IF82sT6tWqaqx0QqclnHeW0Bj4YUYpP6n0sm719Nk5BPIIsAmip8jtRE6eYTy2md 8kC4FRTXFIGIR9eLQWvxzPLhAOM3o9b2IzdqwcBdQWZ9cSZlruXcL2vUPJ0Rftjm PYSKqodYa0RYBzdilBJ0HsfHy7ONPqx4EdDURUvTu5Ynp38Q+ks7OrzYRsSd36uQ mO230JeUTpNMukYd4mRkrtpxuTaC3yr3taj8xQNlKZpR5MUCxets+NRmyIfq5uY= =ZTHI -----END PGP SIGNATURE----- --tsOsTdHNUZQcU9Ye--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140429165659.GB2170>