From owner-svn-src-all@FreeBSD.ORG Wed Oct 27 09:34:00 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EB5541065674; Wed, 27 Oct 2010 09:33:59 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 0F8F88FC13; Wed, 27 Oct 2010 09:33:58 +0000 (UTC) Received: by wwb24 with SMTP id 24so440930wwb.31 for ; Wed, 27 Oct 2010 02:33:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=9XkILs/4XLvbZXQDJc9Ktalfgr3ENzv8gaVYo8KOHNI=; b=chRNYyPBE4hrhpS18+Sq9v4C5nX2rS4gp1GzguA3OiCex0iiMcnNz40wt+TvXu7QVE CxqqYDfrsAmHutuSJNfGpKd0i0l5coHKd6pVWqSbfKRC2DLyAJvMUf13oWvtm04UvewO h+RrZFSudNskMKnCZf3kvWwJWSoT5zdhU99qo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=PXDUDCN39GVuOrnYtUHuNY1Z6R2i9eeQJzjvVycTqheO4+wF+wR5ZvTT68hN+vVuyP Q2kw7OmsV3407c0o5QO6SFt7+ntwDpDy07jHOFqdnsd4FlFby9g3DMVBLBj3DYnHGaDI clsoyWea5BFixCkjvKnC7rgl5HC6mHGKRqOYQ= MIME-Version: 1.0 Received: by 10.216.141.14 with SMTP id f14mr554515wej.22.1288172037937; Wed, 27 Oct 2010 02:33:57 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.216.10.198 with HTTP; Wed, 27 Oct 2010 02:33:57 -0700 (PDT) In-Reply-To: <201010270929.o9R9T4oI097923@svn.freebsd.org> References: <201010270929.o9R9T4oI097923@svn.freebsd.org> Date: Wed, 27 Oct 2010 02:33:57 -0700 X-Google-Sender-Auth: olxstP0f6CgCcQgA8nlcet7JgSY Message-ID: From: Garrett Cooper To: David Xu Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r214412 - in head: lib/libthr/thread sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Oct 2010 09:34:00 -0000 On Wed, Oct 27, 2010 at 2:29 AM, David Xu wrote: > Author: davidxu > Date: Wed Oct 27 09:29:03 2010 > New Revision: 214412 > URL: http://svn.freebsd.org/changeset/base/214412 > > Log: > =A0- Revert r214409. > =A0- Use long word to figure out sizeof kernel cpuset, hope it works. > > Modified: > =A0head/lib/libthr/thread/thr_attr.c > =A0head/sys/kern/kern_cpuset.c > > Modified: head/lib/libthr/thread/thr_attr.c > =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/lib/libthr/thread/thr_attr.c =A0 Wed Oct 27 07:14:46 2010 =A0 = =A0 =A0 =A0(r214411) > +++ head/lib/libthr/thread/thr_attr.c =A0 Wed Oct 27 09:29:03 2010 =A0 = =A0 =A0 =A0(r214412) > @@ -574,13 +574,14 @@ _get_kern_cpuset_size(void) > > =A0 =A0 =A0 =A0if (kern_cpuset_size =3D=3D 0) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0size_t len; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int maxcpus; > > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 len =3D sizeof(kern_cpuset_size); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sysctlbyname("kern.smp.maxcpus", &kern_= cpuset_size, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &len, NULL, 0)) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 len =3D sizeof(maxcpus); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (sysctlbyname("kern.smp.maxcpus", &maxcp= us, &len, NULL, 0)) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0PANIC("failed to get sysct= l kern.smp.maxcpus"); > - > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 kern_cpuset_size =3D (kern_cpuset_size + 7)= / 8; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int nbits_long =3D sizeof(long) * NBBY; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 int num_long =3D (maxcpus + nbits_long - 1)= / nbits_long; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 kern_cpuset_size =3D num_long * sizeof(long= ); > =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0return (kern_cpuset_size); > > Modified: head/sys/kern/kern_cpuset.c > =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/kern/kern_cpuset.c Wed Oct 27 07:14:46 2010 =A0 =A0 =A0 =A0(= r214411) > +++ head/sys/kern/kern_cpuset.c Wed Oct 27 09:29:03 2010 =A0 =A0 =A0 =A0(= r214412) > @@ -889,10 +889,6 @@ cpuset_getaffinity(struct thread *td, st > =A0 =A0 =A0 =A0int error; > =A0 =A0 =A0 =A0size_t size; > > - =A0 =A0 =A0 if (uap->cpusetsize =3D=3D 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 td->td_retval[0] =3D sizeof(cpuset_t); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (0); > - =A0 =A0 =A0 } > =A0 =A0 =A0 =A0if (uap->cpusetsize < sizeof(cpuset_t) || > =A0 =A0 =A0 =A0 =A0 =A0uap->cpusetsize > CPU_MAXSIZE / NBBY) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return (ERANGE); Are you sure this won't break 32-bit on 64-bit architectures, i.e. amd64, mips, powerpc64, sparc64? Thanks, -Garrett