/* * @fn VOID CONTROL_Invoke_Parallel_Service(func, ctx, blocking, exclude) * * @param func - function to be invoked by each core in the system * @param ctx - pointer to the parameter block for each function invocation * @param blocking - Wait for invoked function to complete * @param exclude - exclude the current core from executing the code * * @returns None * * @brief Service routine to handle all kinds of parallel invoke on all CPU calls * * <I>Special Notes:</I> * Invoke the function provided in parallel in either a blocking or * non-blocking mode. The current core may be excluded if desired. * NOTE - Do not call this function directly from source code. * Use the aliases CONTROL_Invoke_Parallel(), CONTROL_Invoke_Parallel_NB(), * or CONTROL_Invoke_Parallel_XS(). * */ extern VOID CONTROL_Invoke_Parallel_Service(VOID(*func) (PVOID), PVOID ctx, int blocking, int exclude) { GLOBAL_STATE_cpu_count(driver_state) = 0; GLOBAL_STATE_dpc_count(driver_state) = 0; preempt_disable(); SMP_CALL_FUNCTION(func, ctx, 0, blocking); if (!exclude) { func(ctx); } preempt_enable(); return; }
void orig_dtrace_xcall(processorid_t cpu, dtrace_xcall_t func, void *arg) { //dtrace_printf("orig_dtrace_xcall %lu\n", cnt_xcall1); cnt_xcall1++; if (cpu == DTRACE_CPUALL) { cnt_xcall2++; /***********************************************/ /* Avoid calling local_irq_disable, since */ /* we will likely be called from the */ /* hrtimer callback. */ /***********************************************/ preempt_disable(); SMP_CALL_FUNCTION(func, arg, TRUE); func(arg); preempt_enable(); } else { #if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26) /***********************************************/ /* 20090710 Special case where we are */ /* trying to call ourselves, since */ /* smp_call_function_single doesnt like us */ /* doing this. Patch provided by */ /* [email protected] */ /***********************************************/ int me = get_cpu(); put_cpu(); if (me == cpu) { local_irq_disable(); func(arg); local_irq_enable(); return; } SMP_CALL_FUNCTION_SINGLE(cpu, func, arg, TRUE); #else SMP_CALL_FUNCTION_SINGLE(cpu, func, arg, TRUE); #endif } }