linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Cc: benh@kernel.crashing.org, mpe@ellerman.id.au, anton@samba.org,
	paulus@samba.org, linuxppc-dev@lists.ozlabs.org
Subject: Re: [RFC PATCH v4 12/12] powerpc: rewrite local_t using soft_irq
Date: Mon, 29 Aug 2016 11:15:07 +1000	[thread overview]
Message-ID: <20160829111507.1434e07c@roar.ozlabs.ibm.com> (raw)
In-Reply-To: <1472409448-18172-13-git-send-email-maddy@linux.vnet.ibm.com>

On Mon, 29 Aug 2016 00:07:28 +0530
Madhavan Srinivasan <maddy@linux.vnet.ibm.com> wrote:

> diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
> index b8da91363864..e3f5fa77476c 100644
> --- a/arch/powerpc/include/asm/local.h
> +++ b/arch/powerpc/include/asm/local.h
> @@ -4,6 +4,8 @@
>  #include <linux/percpu.h>
>  #include <linux/atomic.h>
>  
> +#include <asm/hw_irq.h>
> +
>  typedef struct
>  {
>  	atomic_long_t a;
> @@ -14,24 +16,50 @@ typedef struct
>  #define local_read(l)	atomic_long_read(&(l)->a)
>  #define local_set(l,i)	atomic_long_set(&(l)->a, (i))
>  
> -#define local_add(i,l)	atomic_long_add((i),(&(l)->a))
> -#define local_sub(i,l)	atomic_long_sub((i),(&(l)->a))
> -#define local_inc(l)	atomic_long_inc(&(l)->a)
> -#define local_dec(l)	atomic_long_dec(&(l)->a)
> +static __inline__ void local_add(long i, local_t *l)
> +{
> +	long t;
> +	unsigned long flags;
> +
> +	flags = soft_irq_set_mask(IRQ_DISABLE_MASK_PMU | IRQ_DISABLE_MASK_LINUX);
> +	__asm__ __volatile__(
> +	PPC_LL" %0,0(%2)\n\
> +	add     %0,%1,%0\n"
> +	PPC_STL" %0,0(%2)\n"
> +	: "=&r" (t)
> +	: "r" (i), "r" (&(l->a.counter)));
> +	arch_local_irq_restore(flags);
> +}

I wonder about the API.

So all code outside arch/powerpc just implicitly uses the "LINUX" mask
level, and the normal local_irq_disable(), etc. functions, which is
the same as we have today. That's fine.

The new functionality being provided here is PMU disabling which
arch/powerpc code may now use. I wonder if we should give an API that's
slightly more like the existing generic irq one? For example:

local_irq_and_pmu_save(flags);
local_irq_and_pmu_restore(flags);

And it *might* also be kind of nice to make CONFIG_TRACE_IRQFLAGS work
with these, which would mean putting trace_hardirqs_on|off() in there.

      reply	other threads:[~2016-08-29  1:15 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-28 18:37 [RFC PATCH v4 00/12] powerpc: "paca->soft_enabled" based local atomic operation implementation Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 01/12] powerpc: Add #defs for paca->soft_enabled flags Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 02/12] powerpc: Cleanup to use IRQ_DISABLE_MASK_* macros for paca->soft_enabled update Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 03/12] powerpc: move set_soft_enabled() Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 04/12] powerpc: Use set_soft_enabled api to update paca->soft_enabled Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 05/12] powerpc: reverse the soft_enable logic Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 06/12] powerpc: Avoid using EXCEPTION_PROLOG_1 macro in MASKABLE_* Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 07/12] powerpc: Add new _EXCEPTION_PROLOG_1 macro Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 08/12] powerpc: Introduce new mask bit for soft_enabled Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 09/12] powerpc: Add "bitmask" paramater to MASKABLE_* macros Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 10/12] powerpc: Add support to mask perf interrupts and replay Madhavan Srinivasan
2016-08-28 18:37 ` [RFC PATCH v4 11/12] powerpc: Add a Kconfig and a function to set new soft_enabled mask Madhavan Srinivasan
2016-08-29  0:23   ` Nicholas Piggin
2016-08-29  1:41   ` Nicholas Piggin
2016-08-29  5:58     ` Madhavan Srinivasan
2016-09-05 17:18     ` Madhavan Srinivasan
2016-09-05 18:01       ` Madhavan Srinivasan
2016-09-07 12:39       ` Nicholas Piggin
2016-08-28 18:37 ` [RFC PATCH v4 12/12] powerpc: rewrite local_t using soft_irq Madhavan Srinivasan
2016-08-29  1:15   ` Nicholas Piggin [this message]

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=20160829111507.1434e07c@roar.ozlabs.ibm.com \
    --to=npiggin@gmail.com \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).