From owner-cvs-src@FreeBSD.ORG Mon Oct 15 09:13:14 2007 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0358816A419 for ; Mon, 15 Oct 2007 09:13:14 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.190]) by mx1.freebsd.org (Postfix) with ESMTP id 7374C13C45A for ; Mon, 15 Oct 2007 09:13:13 +0000 (UTC) (envelope-from rpaulo@gmail.com) Received: by nf-out-0910.google.com with SMTP id b2so1193779nfb for ; Mon, 15 Oct 2007 02:13:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer:sender; bh=19vBIJSo9F6WTkyE6Rz9wRnRyWSdT5mvh0JKNlbLV8U=; b=YvcU0MoOi5t4dZOT1SQEmtsuPvGL+n+wabm14NxCCT+Kbxrg9Tqz3+xAwen1CMeC1w5Uxru9vezKdwJxnT/eO9AjAl91Ld714DPgfpTAuvZmfrFgIH0fivWjUno53OKjmKWtrEdSVMK7J8V2jRTrsEX28oNk1WGKPSx4KG0htkE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:in-reply-to:references:mime-version:content-type:message-id:cc:content-transfer-encoding:from:subject:date:to:x-mailer:sender; b=fKLJfT3lyhFkfcgXKZzht+VBO3H0u30xJSIhQ98pWN5EYMogEt0OrapjJzRvP9EM2ess63MGIoOh3D1oAesjKck++bReJmWtR2/vg8+kl1VEvO0HwXD19Zw2MmfCWLxKvLi5NvXCcJUcDgilMnHIMYFJHgTmq4LWDL/xW/bQUgE= Received: by 10.86.99.9 with SMTP id w9mr4800923fgb.1192439592204; Mon, 15 Oct 2007 02:13:12 -0700 (PDT) Received: from ?172.17.8.222? ( [193.136.24.210]) by mx.google.com with ESMTPS id 31sm7453219fkt.2007.10.15.02.13.10 (version=SSLv3 cipher=OTHER); Mon, 15 Oct 2007 02:13:11 -0700 (PDT) In-Reply-To: <47126474.9010108@root.org> References: <20071014105947.D096C16A57E@hub.freebsd.org> <47126474.9010108@root.org> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: Content-Transfer-Encoding: 7bit From: Rui Paulo Date: Mon, 15 Oct 2007 10:13:01 +0100 To: Nate Lawson X-Mailer: Apple Mail (2.752.3) Sender: Rui Paulo Cc: cvs-src@freebsd.org, src-committers@FreeBSD.org, Alexander Leidinger , cvs-all@freebsd.org Subject: Re: cvs commit: src/share/man/man4 coretemp.4 src/sys/dev/coretemp coretemp.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Oct 2007 09:13:14 -0000 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 >> 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