Re: [PATCH kvm-unit-tests 2/7] lib/x86/smp: introduce on_cpus

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2017-06-01 17:48+0200, Andrew Jones:
> Signed-off-by: Andrew Jones <drjones@xxxxxxxxxx>
> ---
> diff --git a/lib/x86/smp.c b/lib/x86/smp.c
> @@ -1,5 +1,6 @@
> @@ -91,6 +95,21 @@ void on_cpu_async(int cpu, void (*function)(void *data), void *data)
>      __on_cpu(cpu, function, data, 0);
>  }
>  

(I'm sorry the review took so long.)

> +void on_cpus(void (*func)(void))
> +{
> +    int cpu;
> +
> +    for (cpu = cpu_count() - 1; cpu >= 0; --cpu)
> +        on_cpu_async(cpu, (ipi_function_type)func, NULL);

Calling a casted function pointer is undefined behavior in C and I think
that keeping the argument is better anyway -- the API is consistent that
way and you don't need to introduce a global in some patches.

> +
> +    while (cpus_active())
> +        ;

Add a pause() here,

Thanks.



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux