Date: Fri, 6 Oct 2006 17:45:04 +0400 From: Stanislav Sedov <stas@FreeBSD.org> To: David Xu <davidxu@freebsd.org> Cc: freebsd-hackers@freebsd.org, Jonathan Chen <jon@freebsd.org> Subject: Re: running code on all CPUs Message-ID: <20061006174504.c4af61ba.stas@FreeBSD.org> In-Reply-To: <200610050829.36266.davidxu@freebsd.org> References: <20061004214040.GA6878@porthos.spock.org> <200610050829.36266.davidxu@freebsd.org>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Thu, 5 Oct 2006 08:29:36 +0800 David Xu <davidxu@freebsd.org> wrote: > On Thursday 05 October 2006 05:40, Jonathan Chen wrote: > > 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 > > AFAIK, you can use scheduler API, the sched_bind() moves current thread to > a specific CPU, hope this helps. > You can find examples e.g. in hwpmc driver. Just grep by sched_bin. -- Stanislav Sedov <stas@FreeBSD.org> [[Россия, Москва]] PGP id: 0xEB269581 http://people.freebsd.org/~stas/stas.key.asc [-- Attachment #2 --] -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFFJl3gK/VZk+smlYERAg+SAJ9oqUZGZuFziMyTZ7UsefRj7K5EngCeONWt oqNO3izXovUBpWlPA3xLThY= =EfRp -----END PGP SIGNATURE-----help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061006174504.c4af61ba.stas>
