Re: NMI for ARC

2016-09-30 Thread Peter Zijlstra
On Thu, Sep 29, 2016 at 12:48:03PM -0700, Vineet Gupta wrote:
> > [1] There's an exception on 64-bit AMD CPUs because AMD blew it.
> > Also, x86 NMI return is itself severely overcomplicated because we don't
> > have good control over NMI nesting.
> 
> For ARC (HS38 cores), there are 16 interrupt priorities (0-high, 15-lowest) 
> and
> each active interrupt has a bit in AUX_IRQ_ACTIVE. If a prio X is active, 
> another
> prio X can't be taken (you can only take higher prio). In that sense nmi (aka 
> prio
> 0) can't nest for us.

Forget you ever read this; the reason for the nested NMIs on x86 is
horrid, but here goes:

The problem is that IRET, the only instruction capable of returning from
_any_ trap/fault/interrupt context automagically unmasks NMIs. And we
'want' to take debug-traps and page-faults from NMI context.

We use debug-traps to synchronize against self-modifying code without
halting the entire machine.

We 'need' page-faults for vmalloc backed memory, the vmalloc page tables
are not globally propagated and we need (minor) faults to populate the
page-tables on demand. And we need page-faults to do user-space access
from NMI context (for the fixup_exception stuff).

Returning from either trap or fault is done through IRET, which then
unmasks NMIs, allowing another NMI to come in while we're still
servicing one.

We have quite the horror cabinet for dealing with this ;-)

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH] ARCv2: fix local_save_flags

2016-09-30 Thread Vineet Gupta
Commit d9676fa152c83b ("ARCv2: Enable LOCKDEP"), changed
local_save_flags() to not return raw STATUS32 but encoded in the form
such that it could be fed directly to CLRI/SETI instructions.
However the STATUS32.E[] was not captured correctly as it corresponds to
bits [4:1] in the register and not [3:0]

Fixes: d9676fa152c83b ("ARCv2: Enable LOCKDEP")
Cc: Evgeny Voevodin 
Signed-off-by: Vineet Gupta 
---
 arch/arc/include/asm/irqflags-arcv2.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arc/include/asm/irqflags-arcv2.h 
b/arch/arc/include/asm/irqflags-arcv2.h
index d1ec7f6b31e0..e880dfa3fcd3 100644
--- a/arch/arc/include/asm/irqflags-arcv2.h
+++ b/arch/arc/include/asm/irqflags-arcv2.h
@@ -112,7 +112,7 @@ static inline long arch_local_save_flags(void)
 */
temp = (1 << 5) |
((!!(temp & STATUS_IE_MASK)) << CLRI_STATUS_IE_BIT) |
-   (temp & CLRI_STATUS_E_MASK);
+   ((temp >> 1) & CLRI_STATUS_E_MASK);
return temp;
 }
 
-- 
2.7.4


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH] ARCv2: intc: Use kflag if STATUS32.IE must be reset

2016-09-30 Thread Vineet Gupta
On 09/12/2016 08:55 AM, Yuriy Kolerov wrote:
> In the end of "arc_init_IRQ" STATUS32.IE flag is going to be affected by
> "flag" instruction but "flag" never touches IE flag on ARCv2. So "kflag"
> instruction must be used instead of "flag".
> 
> Signed-off-by: Yuriy Kolerov 
> ---
>  arch/arc/kernel/intc-arcv2.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arc/kernel/intc-arcv2.c b/arch/arc/kernel/intc-arcv2.c
> index 6c24faf..62b59409 100644
> --- a/arch/arc/kernel/intc-arcv2.c
> +++ b/arch/arc/kernel/intc-arcv2.c
> @@ -74,7 +74,7 @@ void arc_init_IRQ(void)
>   tmp = read_aux_reg(0xa);
>   tmp |= STATUS_AD_MASK | (irq_prio << 1);
>   tmp &= ~STATUS_IE_MASK;
> - asm volatile("flag %0   \n"::"r"(tmp));
> + asm volatile("kflag %0  \n"::"r"(tmp));

Revisiting this in light of ongoing 2 priority interrupt support for HS38 cores.

It seems there is no need to fiddle with interrupt bits here at all.

init/main.c now has well known checkpoints where it explicitly disables the
interrupts in early boot code and enables them when time is right. So when we 
land
in arc_init_IRQ() interrupts have already been disabled.

So I'm dropping this patch and instead adding another one which removes the intr
bits touching part !

OK ?

-Vineet


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


kisskb: OK linus/axs101_defconfig/arcompact Sat Oct 01, 15:56

2016-09-30 Thread noreply
OK linus/axs101_defconfig/arcompact Sat Oct 01, 15:56

http://kisskb.ellerman.id.au/kisskb/buildresult/12818575/

Commit:   Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
  2161a2a644a6d33a29d68395518d103ed805758f
Compiler: arc-buildroot-linux-uclibc-gcc (Buildroot 2015.08.1) 4.8.4

No errors found in log

Possible warnings (17)
--

net/core/ethtool.c:300:1: warning: control reaches end of non-void function 
[-Wreturn-type]
block/cfq-iosched.c:3819:1: warning: control reaches end of non-void function 
[-Wreturn-type]
include/linux/kernel.h:742:17: warning: comparison of distinct pointer types 
lacks a cast [enabled by default]
net/ipv4/tcp_input.c:4286:49: warning: array subscript is above array bounds 
[-Warray-bounds]
kernel/sched/core.c:3277:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
include/linux/sunrpc/svc_xprt.h:176:1: warning: control reaches end of non-void 
function [-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
drivers/scsi/sd.c:1154:1: warning: control reaches end of non-void function 
[-Wreturn-type]
arch/arc/include/asm/elf.h:58:29: warning: integer overflow in expression 
[-Woverflow]


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc