Date: Mon, 15 Oct 2007 10:13:01 +0100 From: Rui Paulo <rpaulo@fnop.net> To: Nate Lawson <nate@root.org> Cc: cvs-src@freebsd.org, src-committers@FreeBSD.org, Alexander Leidinger <netchild@FreeBSD.org>, cvs-all@freebsd.org Subject: Re: cvs commit: src/share/man/man4 coretemp.4 src/sys/dev/coretemp coretemp.c Message-ID: <C8F0AA13-554D-4529-AA50-E0EEC6CFF937@fnop.net> In-Reply-To: <47126474.9010108@root.org> References: <20071014105947.D096C16A57E@hub.freebsd.org> <47126474.9010108@root.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 14 Oct 2007, at 19:48, Nate Lawson wrote: > Alexander Leidinger wrote: >> netchild 2007-10-14 10:59:44 UTC >> >> FreeBSD src repository >> >> Modified files: >> share/man/man4 coretemp.4 >> sys/dev/coretemp coretemp.c >> Log: >> Convert coretemp(4) to the hardware sensors framework and >> make sure to never call sched_bind() for uninitialised CPUs. >> >> Submitted by: Constantine A. Murenin <cnst@FreeBSD.org> >> Sponsored by: Google Summer of Code 2007 (GSoC2007/cnst-sensors) >> Mentored by: syrinx >> Tested by: many >> OKed by: kensmith >> >> Revision Changes Path >> 1.2 +14 -6 src/share/man/man4/coretemp.4 >> 1.3 +46 -35 src/sys/dev/coretemp/coretemp.c > >> - thread_lock(curthread); >> - sched_unbind(curthread); >> - thread_unlock(curthread); >> + * Bind to specific CPU to read the correct temperature. >> + * If not all CPUs are initialised, then only read from >> + * cpu0, returning -1 on all other CPUs. >> + */ >> + if (smp_cpus > 1) { >> + thread_lock(curthread); >> + sched_bind(curthread, cpu); >> + msr = rdmsr(MSR_THERM_STATUS); >> + sched_unbind(curthread); >> + thread_unlock(curthread); >> + } else if (cpu != 0) >> + return (-1); >> + else >> + msr = rdmsr(MSR_THERM_STATUS); > > I reviewed this part of the patch for Rui Paulo and told him to use > smp_active instead of smp_cpus > 1. Sorry, for not getting back to you sooner, but there's a better way than that. I briefly chatted with jhb and the proper way is to use SYSINIT(9). This way the module works on UP and SMP machines. I have a patch, but my devel machine has panic()ed. Regards. -- Rui Paulo
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C8F0AA13-554D-4529-AA50-E0EEC6CFF937>