public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Christoph Lameter <cl@linux.com>
Cc: Tejun Heo <tj@kernel.org>,
	akpm@linuxfoundation.org, Steven Rostedt <srostedt@redhat.com>,
	linux-kernel@vger.kernel.org,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [pchecks v1 2/4] Use raw cpu ops for calls that would trigger with checks
Date: Tue, 24 Sep 2013 09:28:45 +0200	[thread overview]
Message-ID: <20130924072845.GC28538@gmail.com> (raw)
In-Reply-To: <000001414c3d064a-ebe0610b-6951-4a74-bd33-8480e3e1e364-000000@email.amazonses.com>


* Christoph Lameter <cl@linux.com> wrote:

> These location triggered during testing with KVM.
> 
> These are fetches without preemption off where we judged that
> to be more performance efficient or where other means of
> providing synchronization (BH handling) are available.
> 
> Signed-off-by: Christoph Lameter <cl@linux.com>
> 
> Index: linux/include/linux/topology.h
> ===================================================================
> --- linux.orig/include/linux/topology.h	2013-09-12 13:26:29.216103951 -0500
> +++ linux/include/linux/topology.h	2013-09-12 13:41:30.762358687 -0500
> @@ -182,7 +182,7 @@ DECLARE_PER_CPU(int, numa_node);
>  /* Returns the number of the current Node. */
>  static inline int numa_node_id(void)
>  {
> -	return __this_cpu_read(numa_node);
> +	return raw_cpu_read(numa_node);
>  }
>  #endif
>  
> @@ -239,7 +239,7 @@ static inline void set_numa_mem(int node
>  /* Returns the number of the nearest Node with memory */
>  static inline int numa_mem_id(void)
>  {
> -	return __this_cpu_read(_numa_mem_);
> +	return raw_cpu_read(_numa_mem_);
>  }

These are generic primitives used in quite a few places and it can easily 
be a bug to use numa_node_id() in a preemptible section - and this patch 
would hide that fact.

So the correct way to do it is to have checking in these and to introduce 
raw_numa_node_id()/raw_numa_mem_id() and change eventual KVM (and any 
other) preemptible-section use of numa_node_id() to raw_numa_node_id() and 
explain why it's safe to do it.

Thanks,

	Ingo

  reply	other threads:[~2013-09-24  7:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20130923191256.584672290@linux.com>
2013-09-23 19:12 ` [pchecks v1 1/4] Subject; percpu: Add raw_cpu_ops Christoph Lameter
2013-09-23 19:12 ` [pchecks v1 2/4] Use raw cpu ops for calls that would trigger with checks Christoph Lameter
2013-09-24  7:28   ` Ingo Molnar [this message]
2013-09-24  7:32   ` Ingo Molnar
2013-09-24 12:45     ` Eric Dumazet
2013-09-24  7:34   ` Ingo Molnar
2013-09-23 19:24 ` [pchecks v1 3/4] Use raw_cpu_ops for refresh_cpu_vm_stats() Christoph Lameter
2013-09-24  7:43   ` Ingo Molnar
2013-09-23 19:24 ` [pchecks v1 4/4] percpu: Add preemption checks to __this_cpu ops Christoph Lameter
2013-09-24  8:03   ` Ingo Molnar
2013-09-24 14:24     ` Christoph Lameter
2013-09-24 15:18       ` Ingo Molnar
2013-09-24 15:35         ` Christoph Lameter
2013-09-24 17:26           ` Ingo Molnar
2013-09-25 16:46             ` Christoph Lameter
2013-09-25 18:26               ` Ingo Molnar
2013-09-27 14:36                 ` Christoph Lameter
2013-09-28  8:52                   ` Ingo Molnar

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=20130924072845.GC28538@gmail.com \
    --to=mingo@kernel.org \
    --cc=akpm@linuxfoundation.org \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=srostedt@redhat.com \
    --cc=tj@kernel.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