All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Andrew Jones <drjones@redhat.com>
Cc: kvm@vger.kernel.org, pbonzini@redhat.com
Subject: Re: [PATCH kvm-unit-tests 2/7] lib/x86/smp: introduce on_cpus
Date: Wed, 7 Jun 2017 16:48:34 +0200	[thread overview]
Message-ID: <20170607144833.GH28750@potion> (raw)
In-Reply-To: <20170601154819.18831-3-drjones@redhat.com>

2017-06-01 17:48+0200, Andrew Jones:
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> 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.

  reply	other threads:[~2017-06-07 14:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 15:48 [PATCH kvm-unit-tests 0/7] x86: introduce and apply on_cpus Andrew Jones
2017-06-01 15:48 ` [PATCH kvm-unit-tests 1/7] x86/unittests.cfg: create hyperv group Andrew Jones
2017-06-01 15:48 ` [PATCH kvm-unit-tests 2/7] lib/x86/smp: introduce on_cpus Andrew Jones
2017-06-07 14:48   ` Radim Krčmář [this message]
2017-06-13  8:14     ` Andrew Jones
2017-06-01 15:48 ` [PATCH kvm-unit-tests 3/7] x86/hyperv_clock: apply on_cpus Andrew Jones
2017-06-01 15:48 ` [PATCH kvm-unit-tests 4/7] x86/hyperv_stimer: " Andrew Jones
2017-06-01 15:48 ` [PATCH kvm-unit-tests 5/7] x86/hyperv_synic: " Andrew Jones
2017-06-01 15:48 ` [PATCH kvm-unit-tests 6/7] x86/kvmclock_test: " Andrew Jones
2017-06-01 15:48 ` [PATCH kvm-unit-tests 7/7] x86/vmexit: " Andrew Jones
2017-06-01 15:49 ` [PATCH kvm-unit-tests 0/7] x86: introduce and " Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170607144833.GH28750@potion \
    --to=rkrcmar@redhat.com \
    --cc=drjones@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.