Kernel code: executing once on each CPU?

View: New views
3 Messages — Rating Filter:   Alert me  

Kernel code: executing once on each CPU?

by Martin Cracauer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Is there a facility in FreeBSD that allows me to have a piece of code
executed on each processor, then return to the original thread when
that has been completed?

I need to collect some data that's local to the individual CPUs/cores.

In Linux there is/was smp_call_function(func, ...).

Martin
--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Martin Cracauer <cracauer@...>   http://www.cons.org/cracauer/
FreeBSD - where you want to go, today.      http://www.freebsd.org/
_______________________________________________
freebsd-smp@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-smp
To unsubscribe, send any mail to "freebsd-smp-unsubscribe@..."

Re: Kernel code: executing once on each CPU?

by Julian Elischer :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Martin Cracauer wrote:
> Is there a facility in FreeBSD that allows me to have a piece of code
> executed on each processor, then return to the original thread when
> that has been completed?
>
> I need to collect some data that's local to the individual CPUs/cores.
>
> In Linux there is/was smp_call_function(func, ...).

no, though it might  be useful.

the rmlock facility does this in order to do its work (from memory)
and it would be a useful thing..
I'd even suggest that it take a bitmask of required CPUs.
that can be used in conjuction with the cpu set stuff.


>
> Martin

_______________________________________________
freebsd-smp@... mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-smp
To unsubscribe, send any mail to "freebsd-smp-unsubscribe@..."

Re: Kernel code: executing once on each CPU?

by Kostik Belousov :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Feb 03, 2009 at 12:57:28PM -0500, Martin Cracauer wrote:
> Is there a facility in FreeBSD that allows me to have a piece of code
> executed on each processor, then return to the original thread when
> that has been completed?
>
> I need to collect some data that's local to the individual CPUs/cores.
>
> In Linux there is/was smp_call_function(func, ...).

Look at the smp_rendezvous() in the subr_smp.c. Note that the functions
are called in quite restricted context.


attachment0 (202 bytes) Download Attachment