On Wed, Jan 30, 2019 at 06:43:41AM -0500, Jintack Lim wrote: > On Wed, Jan 30, 2019 at 5:51 AM Andrew Jones <drjones@xxxxxxxxxx> wrote: > > > > On Wed, Jan 30, 2019 at 12:03:58AM -0500, Jintack Lim wrote: > > > Hi, > > > > > > I wonder if there's a way to run some job on the secondary cpus on > > > x86. ARM code has a function smp_boot_secondary() for that purpose. I > > > don't seem to find a counterpart on x86. I only see that the secondary > > > cpus on x86 do nothing but handling interrupts. > > > > > Hi Jintack, > > > > Check out the on_cpu* API which x86 supports (see lib/x86/smp.h) > > Thanks, drew. But I thought it was mostly to run a function on a cpu > as an ipi interrupt handler. What I would like to do is to run some > job on a cpu in the background (e.g. while loop) while it can also > receive IPI and handle it. Can I do that with on_cpu*() APIs? > Use on_cpu_async() to start your background function that doesn't return. Ensure you reenable interrupts (irq_enable()) in that function if you want it to handle IPIs. Use atomics to synchronize with the other code if necessary. It should all work. Thanks, drew