From owner-svn-src-head@FreeBSD.ORG Fri Jun 20 04:08:07 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AD50D522; Fri, 20 Jun 2014 04:08:07 +0000 (UTC) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2D4802E91; Fri, 20 Jun 2014 04:08:06 +0000 (UTC) Received: from tom.home (kostik@localhost [127.0.0.1]) by kib.kiev.ua (8.14.9/8.14.9) with ESMTP id s5K481YB099219; Fri, 20 Jun 2014 07:08:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.8.3 kib.kiev.ua s5K481YB099219 Received: (from kostik@localhost) by tom.home (8.14.9/8.14.8/Submit) id s5K481rp099218; Fri, 20 Jun 2014 07:08:01 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Fri, 20 Jun 2014 07:08:01 +0300 From: Konstantin Belousov To: Attilio Rao Subject: Re: svn commit: r267651 - in head: share/man/man4 sys/dev/cpuctl sys/sys usr.sbin/cpucontrol Message-ID: <20140620040801.GA3991@kib.kiev.ua> References: <201406192154.s5JLsfed074305@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Bdv4BQVKRoKl8WEC" Content-Disposition: inline In-Reply-To: <201406192154.s5JLsfed074305@svn.freebsd.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on tom.home Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 20 Jun 2014 04:08:07 -0000 --Bdv4BQVKRoKl8WEC Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 19, 2014 at 09:54:41PM +0000, Attilio Rao wrote: > Author: attilio > Date: Thu Jun 19 21:54:41 2014 > New Revision: 267651 > URL: http://svnweb.freebsd.org/changeset/base/267651 >=20 > Log: > Following comments in r242565 add the possibility to specify ecx when > performing cpuid calls. > Add also a new way to specify the level type to cpucontrol(8) as > reported in the manpage. > =20 > Sponsored by: EMC / Isilon storage division > Reviewed by: bdrewery, gcooper > Testerd by: bdrewery > Modified: head/sys/sys/cpuctl.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/sys/cpuctl.h Thu Jun 19 21:05:07 2014 (r267650) > +++ head/sys/sys/cpuctl.h Thu Jun 19 21:54:41 2014 (r267651) > @@ -35,7 +35,8 @@ typedef struct { > } cpuctl_msr_args_t; > =20 > typedef struct { > - int level; /* CPUID level */ > + int level; /* CPUID level */ > + int level_type; /* CPUID level type */ > uint32_t data[4]; > } cpuctl_cpuid_args_t; > =20 > @@ -50,5 +51,6 @@ typedef struct { > #define CPUCTL_UPDATE _IOWR('c', 4, cpuctl_update_args_t) > #define CPUCTL_MSRSBIT _IOWR('c', 5, cpuctl_msr_args_t) > #define CPUCTL_MSRCBIT _IOWR('c', 6, cpuctl_msr_args_t) > +#define CPUCTL_CPUID_COUNT _IOWR('c', 7, cpuctl_cpuid_args_t) > =20 > #endif /* _CPUCTL_H_ */ The cpuctl(4) is used by third-party code, and this change breaks its ABI. The numeric value for CPUCTL_CPUID is changed, which means that old binaries call non-existing ioctl now. This is at least a visible breakage, since the argument for the ioctl changed the layout as well. The following patch restored the CPUCTL_CPUID for me. I considered naming its argument differently, instead of renaming the argument of CPUCTL_CPUID_COUNT (which you tried to do ?), but decided not, to preserve the API as well. Do you agree with the change ? diff --git a/sys/dev/cpuctl/cpuctl.c b/sys/dev/cpuctl/cpuctl.c index 63187bd..9832933 100644 --- a/sys/dev/cpuctl/cpuctl.c +++ b/sys/dev/cpuctl/cpuctl.c @@ -69,7 +69,7 @@ static int cpuctl_do_msr(int cpu, cpuctl_msr_args_t *data= , u_long cmd, struct thread *td); static int cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data, struct thread *td); -static int cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_args_t *data, +static int cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data, struct thread *td); static int cpuctl_do_update(int cpu, cpuctl_update_args_t *data, struct thread *td); @@ -180,8 +180,8 @@ cpuctl_ioctl(struct cdev *dev, u_long cmd, caddr_t data, ret =3D cpuctl_do_update(cpu, (cpuctl_update_args_t *)data, td); break; case CPUCTL_CPUID_COUNT: - ret =3D cpuctl_do_cpuid_count(cpu, (cpuctl_cpuid_args_t *)data, - td); + ret =3D cpuctl_do_cpuid_count(cpu, + (cpuctl_cpuid_count_args_t *)data, td); break; default: ret =3D EINVAL; @@ -195,7 +195,8 @@ fail: * Actually perform cpuid operation. */ static int -cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_args_t *data, struct thread *t= d) +cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_count_args_t *data, + struct thread *td) { int is_bound =3D 0; int oldcpu; @@ -218,10 +219,15 @@ cpuctl_do_cpuid_count(int cpu, cpuctl_cpuid_args_t *d= ata, struct thread *td) static int cpuctl_do_cpuid(int cpu, cpuctl_cpuid_args_t *data, struct thread *td) { + cpuctl_cpuid_count_args_t cdata; + int error; =20 + cdata.level =3D data->level; /* Override the level type. */ - data->level_type =3D 0; - return (cpuctl_do_cpuid_count(cpu, data, td)); + cdata.level_type =3D 0; + error =3D cpuctl_do_cpuid_count(cpu, &cdata, td); + bcopy(cdata.data, data->data, sizeof(data->data)); /* Ignore error */ + return (error); } =20 /* diff --git a/sys/sys/cpuctl.h b/sys/sys/cpuctl.h index 4220dee..30af524 100644 --- a/sys/sys/cpuctl.h +++ b/sys/sys/cpuctl.h @@ -36,11 +36,16 @@ typedef struct { =20 typedef struct { int level; /* CPUID level */ - int level_type; /* CPUID level type */ uint32_t data[4]; } cpuctl_cpuid_args_t; =20 typedef struct { + int level; /* CPUID level */ + int level_type; /* CPUID level type */ + uint32_t data[4]; +} cpuctl_cpuid_count_args_t; + +typedef struct { void *data; size_t size; } cpuctl_update_args_t; @@ -51,6 +56,6 @@ typedef struct { #define CPUCTL_UPDATE _IOWR('c', 4, cpuctl_update_args_t) #define CPUCTL_MSRSBIT _IOWR('c', 5, cpuctl_msr_args_t) #define CPUCTL_MSRCBIT _IOWR('c', 6, cpuctl_msr_args_t) -#define CPUCTL_CPUID_COUNT _IOWR('c', 7, cpuctl_cpuid_args_t) +#define CPUCTL_CPUID_COUNT _IOWR('c', 7, cpuctl_cpuid_count_args_t) =20 #endif /* _CPUCTL_H_ */ --Bdv4BQVKRoKl8WEC Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJTo7OhAAoJEJDCuSvBvK1BTQcP/0aW5LRHF7bbeuhvmbFi021k BAr6TP8njxSAQGkyROODEgJP1VBC+WTmAPwFTGYeC1GwQ65mX6HgBFbJbXtI98Tn dpqgtshD+Fb36fHi2IJld/FPp53cH+VzS78p1e1ldYyeSmkR/xoRu+r8a9HMy/2M 6dyVhDXE8Sj7pGg/5gvRQURm9CW4goHeeUkXLTkGHuwgVi6hm9fTzNcVsNdZYqer YYsXWOMk55DyEtj7Id0UW8T0OyE1pd0T3J9TC25JjBljjy5R5QOgeVg6lo2Skv5J ACzaaq6UbFvu6oOWYHrtvuAOfY8f0DaaVwmLhjHDEWkY6JszW4ZVC9xEcE4e6ZbT aoHJhOhPK+sNscMq5doUtOHQVnLNCkM8ISo4Gw0pZrcRDl1tqTRjEiSG8G0OKVA9 k4NZfwyWcYCIO3OZyinubNqmyOH0MIj7boVNSn4w3YlW7QZt6702HQyN17lvTk1X dwyyitucMOAji59Xn0AbTchd1pucJ7e3mP6wKgo4BQpUMX64dTixUPe+ZhWzXV3z s0ts3OIJ0oQ9NdjvN/ZwHl57oSk5RcPUutLLig1E+3xsgOg73W6FRYlCpK51xqaI 9INLb53Cd7Ua7V+TR6iI2+Mtj6Us1fhwQmjx10QeH9fEFpk6GMJHfDxUItGxZWlC Xec/hv+vu/sfKKkZlpwy =lxoC -----END PGP SIGNATURE----- --Bdv4BQVKRoKl8WEC--