From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dario Faggioli Subject: Re: [PATCH 2 of 3] libxl: allow for specifying the CPU affinity in the config file. Date: Thu, 12 Jan 2012 22:56:37 +0000 Message-ID: <1326408997.4494.11.camel@Abyss> References: <1326304198.2401.6.camel@Abyss> <1326304831.12973.3.camel@Abyss> <1326357782.17210.213.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============6947405300042611861==" Return-path: In-Reply-To: <1326357782.17210.213.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Ian Campbell Cc: xen-devel , Ian Jackson List-Id: xen-devel@lists.xenproject.org --===============6947405300042611861== Content-Type: multipart/signed; micalg="pgp-sha1"; protocol="application/pgp-signature"; boundary="=-JkfLuu4wt0O9PdWyLobS" --=-JkfLuu4wt0O9PdWyLobS Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, 2012-01-12 at 08:43 +0000, Ian Campbell wrote:=20 > > diff -r 9ce68a4036b1 tools/libxl/libxl_create.c > > --- a/tools/libxl/libxl_create.c Wed Jan 11 17:38:04 2012 +0000 > > +++ b/tools/libxl/libxl_create.c Wed Jan 11 17:40:45 2012 +0000 > > @@ -78,6 +78,8 @@ int libxl_init_build_info(libxl_ctx *ctx > > memset(b_info, '\0', sizeof(*b_info)); > > b_info->max_vcpus =3D 1; > > b_info->cur_vcpus =3D 1; > > + if (libxl_cpumap_alloc(ctx, &b_info->cpumap)) > > + return ERROR_NOMEM; >=20 > Should probably set all here since that is the best default? >=20 Having this set to "none" here simplifies a bit the code when we came to config file parsing (if I set it to "any CPU" here, I'll have to reset to "none" before parsing). Also, default is exactly what you're suggesting already, as I set the map to "any CPU" if no "cpus" config option is found. Anyway, I guess I can do as you suggest if you really think it's better. :-) > > +static void print_bitmap(uint8_t *map, int maplen, FILE *stream); > > [..]=20 > =20 > > +static int vcpupin_parse(char *cpu, libxl_cpumap *cpumap); >=20 > Again, maybe just reorder the functions? >=20 Ok, fine, will do that. > > static void parse_config_data(const char *configfile_filename_report, > > const char *configfile_data, > > int configfile_len, > > @@ -661,6 +674,13 @@ static void parse_config_data(const char > > if (!xlu_cfg_get_long (config, "maxvcpus", &l, 0)) > > b_info->max_vcpus =3D l; > > =20 > > + if (!xlu_cfg_get_string (config, "cpus", &buf, 0)) { >=20 > The syntax supported here is different to that in a cpupool cfg? (see > main_cpupoolcreate) Perhaps they should be similar? >=20 It is different, and that was intentional. What I wanted, was the syntax to be exactly the same of `xl vcpu-pin', which is the command line equivalent of this option, much more than cpupool-*. If you want, I think I can easily enable list-like CPU specification as in cpupool config file so that _both_ syntax are allowed. What do you think? > > + char *buf2 =3D strdup(buf); > > + vcpupin_parse(buf2, &b_info->cpumap); > > + } else { > > + memset(b_info->cpumap.map, -1, b_info->cpumap.size); >=20 > This could do with a helper function in libxl_utils.h. >=20 Ok. Thanks, Dario --=20 <> (Raistlin Majere) ------------------------------------------------------------------- Dario Faggioli, http://retis.sssup.it/people/faggioli Senior Software Engineer, Citrix Systems R&D Ltd., Cambridge (UK) PhD Candidate, ReTiS Lab, Scuola Superiore Sant'Anna, Pisa (Italy) --=-JkfLuu4wt0O9PdWyLobS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEABECAAYFAk8PZSUACgkQk4XaBE3IOsTVuQCfXRm4wnPMHS2qu8+CEmIcZizv V0QAn3UhAvQ3PUo+XUSZhjQM3DaE/S7y =uYou -----END PGP SIGNATURE----- --=-JkfLuu4wt0O9PdWyLobS-- --===============6947405300042611861== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============6947405300042611861==--