From owner-freebsd-hackers@FreeBSD.ORG Wed Oct 4 21:41:05 2006 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5179F16A407 for ; Wed, 4 Oct 2006 21:41:05 +0000 (UTC) (envelope-from jon@porthos.spock.org) Received: from porthos.spock.org (porthos.spock.org [204.97.176.45]) by mx1.FreeBSD.org (Postfix) with ESMTP id E4B6C43DAC for ; Wed, 4 Oct 2006 21:40:42 +0000 (GMT) (envelope-from jon@porthos.spock.org) Received: from porthos.spock.org (localhost [127.0.0.1]) by porthos.spock.org with ESMTP serial EF600Q3T-B7F8823k94LeeZc008368F7T for ; Wed, 4 Oct 2006 17:40:41 -0400 (EDT) (envelope-from jon@porthos.spock.org) Received: (from jon@localhost) by porthos.spock.org (8.13.6/8.13.6/Submit) id k94LeeAZ008367 for freebsd-hackers@freebsd.org; Wed, 4 Oct 2006 17:40:40 -0400 (EDT) (envelope-from jon) Date: Wed, 4 Oct 2006 17:40:40 -0400 From: Jonathan Chen To: freebsd-hackers@freebsd.org Message-ID: <20061004214040.GA6878@porthos.spock.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.12-2006-07-14 X-Scanned-By: MIMEDefang 2.56 on 204.97.176.45 Subject: running code on all CPUs X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Oct 2006 21:41:05 -0000 Hello, I'm currently writing kernel code to use MCA (machine check architecture) in order to detect things like ECC errors. As part of this, I need to run code on all CPUs periodically to check some status registers. Where is the best place to do this? It doesn't seem that I can use regular kernel threads since I can't specify a CPU binding with that interface. I've thought about hooking a function call to either the beginning of idle_proc() or somewhere in mi_switch(), but neither solution seems optimal since there are no guarantees when idle_proc() is ran and mi_switch() seems like a really bad idea from a performance standpoint. Suggestions? Also, are there any locking pitfalls or other issues I should be aware of when writing code to run in either idle_proc() or mi_switch()? -Jon