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 <[EMAIL PROTECTED]>
  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

_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to