Date: Fri, 19 Nov 2010 03:10:15 GMT From: Garrett Cooper <gcooper@FreeBSD.org> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/145385: [cpu] Logical processor cannot be disabled for some SMT-enabled Intel procs Message-ID: <201011190310.oAJ3AFng082563@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/145385; it has been noted by GNATS. From: Garrett Cooper <gcooper@FreeBSD.org> To: Andriy Gapon <avg@freebsd.org> Cc: bug-followup@freebsd.org Subject: Re: kern/145385: [cpu] Logical processor cannot be disabled for some SMT-enabled Intel procs Date: Thu, 18 Nov 2010 19:01:08 -0800 --0016e6567d28366ef604955f1e9a Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, Nov 18, 2010 at 4:09 PM, Garrett Cooper <gcooper@freebsd.org> wrote= : > On Wed, Nov 17, 2010 at 4:34 PM, Garrett Cooper <gcooper@freebsd.org> wro= te: >> On Thu, Oct 7, 2010 at 10:03 AM, Andriy Gapon <avg@freebsd.org> wrote: >>> >>> Here's a patch to remove halted logical processors from root cpu set (c= puset >>> number zero) and consequently all child sets: >>> http://people.freebsd.org/~avg/cpu-halt.diff >>> >>> Please note that unhalting CPUs will add them to cpuset zero, but will = not >>> (re-)add them cpusets of the running processes. =A0So additional action= will be >>> required from system administrator if e would like existing processes t= o make use >>> of unhalted CPUs. >>> >>> Also, interrupts that are bound to halted CPUs are not rebound on halt,= and so >>> will be delivered to halted CPUs. =A0This should not be a problem for t= ypical >>> environments, but would be nice to fix anyway. >> >> =A0 =A0Sorry for taking so long to get back on this item. The patch look= s >> ok as far as setting the CPUSET is concerned (setting >> machdep.hlt_logical_cpus=3D1 works on an r710 with 8 logical procs as >> SCHED_ULE schedules all of the tasks on the non-logical SMT cores, not >> the logical ones, and the patch properly detects that there aren't any >> logical processors on a Core2 Quad I have at home), but it's missing a >> key case where I go from... >> >> machdep.hlt_logical_cpus: 1 -> 0 >> >> =A0 =A0... it should reset CPUSETZERO. >> =A0 =A0The overall CPU topology should probably be cached and restored >> when reset, or at least CPUSETZERO should be reset (probably the >> simpler and cleaner route to go). >> =A0 =A0After that all that's required is work for i386 and I'd vote for = a >> commit of the patch. >> Thanks for the hard work Andriy :)! > > Just to illustrate, here's how I reproduced the successful behavior > (and the problem): > > 1. Execute the following script: > > #!/bin/sh > i=3D0 > ncpus=3D`sysctl -n kern.smp.cpus` > while [ $i -lt $ncpus ] ; do > =A0 =A0while : ; do : ; done & > =A0 =A0: $(( i +=3D 1 )) > done > > 2. Execute sysctl machdep.hlt_logical_cpus=3D1 . > 3. Look at cpuset info; example: > > Before: > > # for i in `ps aux | grep gcooper | grep -v grep | awk '{ print $2 }'` > ; do cpuset -g -p $i ; done > pid 2179 mask: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 > pid 2180 mask: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 > > After: > > # for i in `ps aux | grep gcooper | grep -v grep | awk '{ print $2 }'` > ; do cpuset -g -p $i ; done > pid 2179 mask: 0, 2, 4, 6, 8, 10, 12, 14 > pid 2180 mask: 0, 2, 4, 6, 8, 10, 12, 14 > # sysctl machdep.hlt_logical_cpus=3D0 > machdep.hlt_logical_cpus: 1 -> 0 > # for i in `ps aux | grep gcooper | grep -v grep | awk '{ print $2 }'` > ; do cpuset -g -p $i ; done > pid 2179 mask: 0, 2, 4, 6, 8, 10, 12, 14 > pid 2180 mask: 0, 2, 4, 6, 8, 10, 12, 14 > > I'm taking the patch and running with it now to try and get it working 10= 0%. This output was from a patch in progress based on Andriy's work, that seems to get the bits in place properly: test-26# sysctl machdep.hlt_logical_cpus=3D1 sysctl_hlt_logical_cpus: mask: 43690 cpuset_zero_modify (before): cpuset_zero: 65535, mask: 21845 cpuset_update (after): set: 21845, mask: 21845 cpuset_update (after): set: 21845, mask: 21845 cpuset_zero_modify (after): cpuset_zero: 21845, mask: 21845 machdep.hlt_logical_cpus: 0 -> 1 test-26# sysctl machdep.hlt_logical_cpus=3D0 sysctl_hlt_logical_cpus: mask: 0 cpuset_zero_modify (before): cpuset_zero: 21845, mask: 65535 cpuset_update (after): set: 21845, mask: 65535 cpuset_update (after): set: 21845, mask: 21845 cpuset_zero_modify (after): cpuset_zero: 65535, mask: 65535 machdep.hlt_logical_cpus: 1 -> 0 test-26# Weird thing is that the CPU affinity isn't adjusted even though cpuset_zero appears to be modified. I think this is the problem: static int cpuset_testupdate(struct cpuset *set, cpuset_t *mask) { struct cpuset *nset; cpuset_t newmask; int error; mtx_assert(&cpuset_lock, MA_OWNED); if (set->cs_flags & CPU_SET_RDONLY) return (EPERM); if (!CPU_OVERLAP(&set->cs_mask, mask)) return (EDEADLK); CPU_COPY(&set->cs_mask, &newmask); CPU_AND(&newmask, mask); error =3D 0; LIST_FOREACH(nset, &set->cs_children, cs_siblings) if ((error =3D cpuset_testupdate(nset, &newmask)) !=3D 0) break; return (error); } ... /* * Applies the mask 'mask' without checking for empty sets or permissions. */ static void cpuset_update(struct cpuset *set, cpuset_t *mask) { struct cpuset *nset; mtx_assert(&cpuset_lock, MA_OWNED); CPU_AND(&set->cs_mask, mask); LIST_FOREACH(nset, &set->cs_children, cs_siblings) cpuset_update(nset, &set->cs_mask); return; } Note that it's doing CPU_AND, not CPU_OR, in both routines that get called from cpuset_modify. This makes sense to reject bad input (because scheduling on non-existent CPUs is a bad thing :/), but sucks in our case because it means that we can't use cpuset_modify [easily]... Thanks! -Garrett --0016e6567d28366ef604955f1e9a Content-Type: text/x-patch; charset=US-ASCII; name="kern.145385.patch" Content-Disposition: attachment; filename="kern.145385.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_ggohebzt1 SW5kZXg6IHN5cy9hbWQ2NC9hbWQ2NC9tcF9tYWNoZGVwLmMKPT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gc3lzL2Ft ZDY0L2FtZD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9fY3B1c2V0X21hc2sobikpCisjZGVmaW5lCUNQVV9TRVRN QVNLKG1hc2ssIHApCSgocCktPl9fYml0c1swXSA9IChtYXNrKSkKICNkZWZpbmUJQ1BVX1pFUk8o cCkgZG8gewkJCQlcCiAJX19zaXplX3QgX19pOwkJCQkJXAogCWZvciAoX19pID0gMDsgX19pIDwg X05DUFVXT1JEUzsgX19pKyspCQlcCkBAIC0xNzgsNiArMTc5LDcgQEAKIHN0cnVjdCBwcmlzb247 CiBzdHJ1Y3QgcHJvYzsKIAoraW50CWNwdXNldF96ZXJvX21vZGlmeShjcHVzZXRfdCAqbWFzayk7 CiBzdHJ1Y3QgY3B1c2V0ICpjcHVzZXRfdGhyZWFkMCh2b2lkKTsKIHN0cnVjdCBjcHVzZXQgKmNw dXNldF9yZWYoc3RydWN0IGNwdXNldCAqKTsKIHZvaWQJY3B1c2V0X3JlbChzdHJ1Y3QgY3B1c2V0 ICopOwo= --0016e6567d28366ef604955f1e9a--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201011190310.oAJ3AFng082563>