public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Juergen Gross <jgross@suse.com>
Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org,
	boris.ostrovsky@oracle.com, david.vrabel@citrix.com,
	mingo@redhat.com, Douglas_Warzecha@dell.com,
	pali.rohar@gmail.com, jdelvare@suse.com, linux@roeck-us.net,
	tglx@linutronix.de, hpa@zytor.com, jeremy@goop.org,
	chrisw@sous-sol.org, akataria@vmware.com, rusty@rustcorp.com.au,
	virtualization@lists.linux-foundation.org, x86@kernel.org
Subject: Re: [PATCH v4 3/6] smp: add function to execute a function synchronously on a cpu
Date: Tue, 5 Apr 2016 10:11:07 +0200	[thread overview]
Message-ID: <20160405081107.GH3448@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <1459833007-11618-4-git-send-email-jgross@suse.com>

On Tue, Apr 05, 2016 at 07:10:04AM +0200, Juergen Gross wrote:
> +int smp_call_on_cpu(unsigned int cpu, bool pin, int (*func)(void *), void *par)

Why .pin and not .phys? .pin does not (to me) reflect the
hypervisor/physical-cpu thing.

Also, as per smp_call_function_single() would it not be more consistent
to make this the last argument?

> +{
> +	struct smp_call_on_cpu_struct sscs = {
> +		.work = __WORK_INITIALIZER(sscs.work, smp_call_on_cpu_callback),
> +		.done = COMPLETION_INITIALIZER_ONSTACK(sscs.done),
> +		.func = func,
> +		.data = par,
> +		.cpu  = pin ? cpu : -1,
> +	};
> +
> +	if (cpu >= nr_cpu_ids)

You might want to also include cpu_online().

	if (cpu >= nr_cpu_ids || !cpu_online(cpu))
> +		return -ENXIO;

Seeing how its fairly hard to schedule work on a cpu that's not actually
there.

> +
> +	queue_work_on(cpu, system_wq, &sscs.work);
> +	wait_for_completion(&sscs.done);
> +
> +	return sscs.ret;
> +}

  reply	other threads:[~2016-04-05  8:11 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05  5:10 [PATCH v4 0/6] Support calling functions on dedicated physical cpu Juergen Gross
2016-04-05  5:10 ` [PATCH v4 1/6] xen: sync xen header Juergen Gross
2016-04-05  9:34   ` [Xen-devel] " David Vrabel
2016-04-05  5:10 ` [PATCH v4 2/6] virt, sched: add generic vcpu pinning support Juergen Gross
2016-04-05  5:10 ` [PATCH v4 3/6] smp: add function to execute a function synchronously on a cpu Juergen Gross
2016-04-05  8:11   ` Peter Zijlstra [this message]
2016-04-05 10:05     ` Juergen Gross
2016-04-05  5:10 ` [PATCH v4 4/6] xen: add xen_pin_vcpu() to support calling functions on a dedicated pcpu Juergen Gross
2016-04-05  9:45   ` [Xen-devel] " David Vrabel
2016-04-05 10:01     ` Juergen Gross
2016-04-05 10:03       ` David Vrabel
2016-04-05  5:10 ` [PATCH v4 5/6] dcdbas: make use of smp_call_on_cpu() Juergen Gross
2016-04-05  5:10 ` [PATCH v4 6/6] hwmon: use smp_call_on_cpu() for dell-smm i8k Juergen Gross
2016-04-05 14:54   ` Guenter Roeck
2016-04-05 19:31     ` Pali Rohár
2016-04-21 10:57       ` Pali Rohár
2016-04-21 13:12         ` Juergen Gross
2016-04-21 13:27           ` Pali Rohár
2016-05-09 14:37             ` Juergen Gross
2016-05-12  8:51               ` Pali Rohár

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=20160405081107.GH3448@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Douglas_Warzecha@dell.com \
    --cc=akataria@vmware.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=chrisw@sous-sol.org \
    --cc=david.vrabel@citrix.com \
    --cc=hpa@zytor.com \
    --cc=jdelvare@suse.com \
    --cc=jeremy@goop.org \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mingo@redhat.com \
    --cc=pali.rohar@gmail.com \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox