public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: pjohn@mvista.com, Ralf Baechle <ralf@linux-mips.org>
Cc: linux-kernel@vger.kernel.org,
	Christoph Lameter <cl@linux-foundation.org>,
	Tejun Heo <tj@kernel.org>
Subject: Re: [PATCH] MIPS: Fix compile error implicit declaration of function cpu_local_wrap
Date: Thu, 11 Mar 2010 12:09:48 -0800	[thread overview]
Message-ID: <4B994E0C.1010503@caviumnetworks.com> (raw)
In-Reply-To: <1268337816.29250.3.camel@localhost.localdomain>

On 03/11/2010 12:03 PM, Philby John wrote:
> The commit 38b7827fc removed cpu_local_xx macros that lead to
> a compile error: implicit declaration of function 'cpu_local_wrap',
> when compiled for the MIPS Cavium Octeon processors. Revert back
> to old code.
>
> CC: Christoph Lameter<cl@linux-foundation.org>
> CC: Tejun Heo<tj@kernel.org>
> CC: David Daney<ddaney@caviumnetworks.com>
> Signed-off-by: Philby John<pjohn@mvista.com>

Ralf is testing a different patch for this problem.

David Daney


> ---
>   arch/mips/include/asm/local.h |   25 +++++++++++++++++++++++++
>   1 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/arch/mips/include/asm/local.h b/arch/mips/include/asm/local.h
> index bdcdef0..65ec69d 100644
> --- a/arch/mips/include/asm/local.h
> +++ b/arch/mips/include/asm/local.h
> @@ -193,4 +193,29 @@ static __inline__ long local_sub_return(long i, local_t * l)
>   #define __local_add(i, l)	((l)->a.counter+=(i))
>   #define __local_sub(i, l)	((l)->a.counter-=(i))
>
> +/* Need to disable preemption for the cpu local counters otherwise we could
> +   still access a variable of a previous CPU in a non atomic way. */
> +#define cpu_local_wrap_v(l)             \
> +	({ local_t res__;               \
> +	   preempt_disable();           \
> +	   res__ = (l);                 \
> +	   preempt_enable();            \
> +	   res__; })
> +#define cpu_local_wrap(l)               \
> +	({ preempt_disable();           \
> +	   l;                           \
> +	   preempt_enable(); })         \
> +
> +#define cpu_local_read(l)    cpu_local_wrap_v(local_read(&__get_cpu_var(l)))
> +#define cpu_local_set(l, i)  cpu_local_wrap(local_set(&__get_cpu_var(l), (i)))
> +#define cpu_local_inc(l)     cpu_local_wrap(local_inc(&__get_cpu_var(l)))
> +#define cpu_local_dec(l)     cpu_local_wrap(local_dec(&__get_cpu_var(l)))
> +#define cpu_local_add(i, l)  cpu_local_wrap(local_add((i),&__get_cpu_var(l)))
> +#define cpu_local_sub(i, l)  cpu_local_wrap(local_sub((i),&__get_cpu_var(l)))
> +
> +#define __cpu_local_inc(l)      cpu_local_inc(l)
> +#define __cpu_local_dec(l)      cpu_local_dec(l)
> +#define __cpu_local_add(i, l)   cpu_local_add((i), (l))
> +#define __cpu_local_sub(i, l)   cpu_local_sub((i), (l))
> +
>   #endif /* _ARCH_MIPS_LOCAL_H */


  reply	other threads:[~2010-03-11 20:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-11 20:03 [PATCH] MIPS: Fix compile error implicit declaration of function cpu_local_wrap Philby John
2010-03-11 20:09 ` David Daney [this message]
2010-03-12 10:02   ` Ralf Baechle
2010-03-12 14:40 ` Christoph Lameter

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=4B994E0C.1010503@caviumnetworks.com \
    --to=ddaney@caviumnetworks.com \
    --cc=cl@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pjohn@mvista.com \
    --cc=ralf@linux-mips.org \
    --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