mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Baron <jbaron@akamai.com>
To: Peter Zijlstra <peterz@infradead.org>,
	rostedt@goodmis.org, tglx@linutronix.de, mingo@kernel.org,
	bigeasy@linutronix.de
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] jump_label: Pull get_online_cpus() into generic code
Date: Fri, 21 Apr 2017 12:08:26 -0400	[thread overview]
Message-ID: <2bc2af64-e014-b56a-4a01-d8d9ea732504@akamai.com> (raw)
In-Reply-To: <20170418103422.590118425@infradead.org>

On 04/18/2017 06:32 AM, Peter Zijlstra wrote:
> This change does two things; it moves the get_online_cpus() call into
> generic code, with the aim of later providing some static_key ops that
> avoid it.
>
> And as a side effect it inverts the relation between cpu_hotplug_lock
> and jump_label_mutex.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---

...

> @@ -146,6 +154,7 @@ static void __static_key_slow_dec(struct
>  	 * returns is unbalanced, because all other static_key_slow_inc()
>  	 * instances block while the update is in progress.
>  	 */
> +	get_online_cpus();
>  	if (!atomic_dec_and_mutex_lock(&key->enabled, &jump_label_mutex)) {
>  		WARN(atomic_read(&key->enabled) < 0,
>  		     "jump label: negative count!\n");

So the get and put can be unbalanced here since the above:

'if (!atomic_dec_and_mutex_lock(&key->enabled, &jump_label_mutex))'

is followed by 'return;'. However, I see that the next patch removes 
this and so things are balanced again...


> @@ -159,6 +168,7 @@ static void __static_key_slow_dec(struct
>  		jump_label_update(key);
>  	}
>  	jump_label_unlock();
> +	put_online_cpus();
>  }
>
>  static void jump_label_update_timeout(struct work_struct *work)
> @@ -592,6 +602,10 @@ jump_label_module_notify(struct notifier
>
>  	switch (val) {
>  	case MODULE_STATE_COMING:
> +		/*
> +		 * XXX do we need get_online_cpus() ?  the module isn't
> +		 * executable yet, so nothing should be looking at our code.
> +		 */

Since we're just updating the table of places we potentially need to 
patch, but not actually doing any patching, we should not need 
get_online_cpus() here...so in attempt to reduce confusion I would 
remove this.

Thanks,

-Jason

  parent reply	other threads:[~2017-04-21 16:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18 10:32 [PATCH 0/3] more cpu hotplug fail Peter Zijlstra
2017-04-18 10:32 ` [PATCH 1/3] jump_label: Pull get_online_cpus() into generic code Peter Zijlstra
2017-04-20 11:29   ` [tip:smp/hotplug] " tip-bot for Peter Zijlstra (Intel)
2017-04-21 16:08   ` Jason Baron [this message]
2017-04-21 16:20     ` [PATCH 1/3] " Peter Zijlstra
2017-04-18 10:32 ` [PATCH 2/3] jump_label: Provide static_key_slow_inc_nohp() Peter Zijlstra
2017-04-18 13:03   ` Peter Zijlstra
2017-04-18 16:46     ` Steven Rostedt
2017-04-18 20:27       ` Peter Zijlstra
2017-04-18 20:50         ` Thomas Gleixner
2017-04-19  6:39           ` Peter Zijlstra
2017-04-19  9:08             ` Thomas Gleixner
2017-04-19 12:49               ` Steven Rostedt
2017-04-19 14:08                 ` Peter Zijlstra
2017-04-19 14:21                   ` Steven Rostedt
2017-04-20 11:29   ` [tip:smp/hotplug] jump_label: Provide static_key_slow_inc_cpuslocked() tip-bot for Peter Zijlstra (Intel)
2017-04-18 10:32 ` [PATCH 3/3] perf: Avoid cpu_hotplug_lock r-r recursion Peter Zijlstra
2017-04-20 11:30   ` [tip:smp/hotplug] " tip-bot for Peter Zijlstra (Intel)

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=2bc2af64-e014-b56a-4a01-d8d9ea732504@akamai.com \
    --to=jbaron@akamai.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®