Skip to contentSkip to conversation

Addons to Synopsys ARC Linux kernel Port

RFC PATCH Superseded [email protected] 9 participants 66 messages Nov 12, 2012 – Jan 17, 2013

Subsystems (7)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Addons to Synopsys ARC Linux kernel Port

From: Vineet Gupta <[email protected]>

Hi,

This is a follow-up on ARC Linux port, whose #1 was posted last week. This is part #2 of the port containing optional features.

Kindly review and provide comments !

The v2 series incorporating the review comments will combine both #1 and #2.

Thx,
-Vineet

Mischa Jonker (1):
ARC: kgdb support

Vineet Gupta (23):
ARC: [optim] Cache "current" in Register r25
ARC: ptrace support
ARC: futex
ARC: oprofile support
ARC: ARCompact 2 levels IRQ (high/low priority) Handling
ARC: dynamic loadable module support
ARC: Low level event capture/logging
ARC: kernel diagnostics: show_regs() etc
ARC: SMP support
ARC: dwarf2 stack unwinder
ARC: stacktracing APIs based on dw2 unwinder
ARC: disassembly (needed by kprobes/kgdb/unaligned-access-emul)
ARC: kprobes support
ARC: unaligned access emulation
ARC: startup #2: Verbose Boot reporting / feature verification
ARC: [plat-arfpga] BVCI Latency Unit setup
perf, ARC: Enable building perf tools for ARC
ARC: perf support (software counters only)
modpost: Ignore ARC specific non-alloc section
ARC: Support for single cycle Close Coupled Mem (CCM)
ARC: Hostlink Pseudo-Driver for Metaware Debugger
ARC: [plat-arcfpga] defconfig
ARC: Add self to MAINTAINERS

 MAINTAINERS                              |    6 +
 arch/arc/Kconfig                         |  136 +++
 arch/arc/Makefile                        |   19 +
 arch/arc/configs/fpga_defconfig          |  137 +++-
 arch/arc/include/asm/Kbuild              |    2 -
 arch/arc/include/asm/arcregs.h           |  122 +++-
 arch/arc/include/asm/current.h           |   32 +
 arch/arc/include/asm/defines.h           |   56 ++
 arch/arc/include/asm/disasm.h            |  116 +++
 arch/arc/include/asm/entry.h             |  189 +++++
 arch/arc/include/asm/event-log-asm.h     |  185 +++++
 arch/arc/include/asm/event-log.h         |  102 +++
 arch/arc/include/asm/futex.h             |  151 ++++
 arch/arc/include/asm/irqflags.h          |    6 +-
 arch/arc/include/asm/kgdb.h              |   61 ++
 arch/arc/include/asm/kprobes.h           |   62 ++
 arch/arc/include/asm/linkage.h           |   33 +
 arch/arc/include/asm/mmu_context.h       |    4 +
 arch/arc/include/asm/module.h            |   11 +
 arch/arc/include/asm/mutex.h             |    9 +
 arch/arc/include/asm/perf_event.h        |   19 +
 arch/arc/include/asm/pgtable.h           |    4 +
 arch/arc/include/asm/processor.h         |   11 +
 arch/arc/include/asm/ptrace.h            |   19 +-
 arch/arc/include/asm/setup.h             |   14 +
 arch/arc/include/asm/smp.h               |  108 +++
 arch/arc/include/asm/unaligned.h         |   29 +
 arch/arc/include/asm/unwind.h            |  163 ++++
 arch/arc/kernel/Makefile                 |   19 +-
 arch/arc/kernel/arc_hostlink.c           |  114 +++
 arch/arc/kernel/asm-offsets.c            |   18 +
 arch/arc/kernel/ctx_sw.c                 |   18 +
 arch/arc/kernel/disasm.c                 |  538 ++++++++++++
 arch/arc/kernel/entry.S                  |  259 ++++++-
 arch/arc/kernel/event-log.c              |  304 +++++++
 arch/arc/kernel/head.S                   |   33 +
 arch/arc/kernel/irq.c                    |  109 +++
 arch/arc/kernel/kgdb.c                   |  205 +++++
 arch/arc/kernel/kprobes.c                |  525 ++++++++++++
 arch/arc/kernel/module.c                 |  159 ++++
 arch/arc/kernel/ptrace.c                 |  164 ++++-
 arch/arc/kernel/setup.c                  |  281 +++++++-
 arch/arc/kernel/signal.c                 |    3 +
 arch/arc/kernel/smp.c                    |  295 +++++++
 arch/arc/kernel/stacktrace.c             |  215 +++++-
 arch/arc/kernel/traps.c                  |   45 +
 arch/arc/kernel/troubleshoot.c           |  304 +++++++
 arch/arc/kernel/unaligned.c              |  225 +++++
 arch/arc/kernel/unwind.c                 | 1329 ++++++++++++++++++++++++++++++
 arch/arc/kernel/vmlinux.lds.S            |   44 +-
 arch/arc/mm/cache_arc700.c               |   46 +
 arch/arc/mm/tlb.c                        |   47 ++
 arch/arc/mm/tlbex.S                      |   70 ++-
 arch/arc/oprofile/Makefile               |    9 +
 arch/arc/oprofile/common.c               |   22 +
 arch/arc/plat-arcfpga/Kconfig            |   57 ++
 arch/arc/plat-arcfpga/Makefile           |    1 +
 arch/arc/plat-arcfpga/include/plat/irq.h |   10 +-
 arch/arc/plat-arcfpga/include/plat/smp.h |  115 +++
 arch/arc/plat-arcfpga/irq.c              |   10 +
 arch/arc/plat-arcfpga/platform.c         |   56 ++
 arch/arc/plat-arcfpga/smp.c              |  192 +++++
 scripts/mod/modpost.c                    |    1 +
 tools/perf/perf.h                        |    6 +
 64 files changed, 7621 insertions(+), 33 deletions(-)
 create mode 100644 arch/arc/include/asm/current.h
 create mode 100644 arch/arc/include/asm/defines.h
 create mode 100644 arch/arc/include/asm/disasm.h
 create mode 100644 arch/arc/include/asm/event-log-asm.h
 create mode 100644 arch/arc/include/asm/event-log.h
 create mode 100644 arch/arc/include/asm/futex.h
 create mode 100644 arch/arc/include/asm/kgdb.h
 create mode 100644 arch/arc/include/asm/kprobes.h
 create mode 100644 arch/arc/include/asm/perf_event.h
 create mode 100644 arch/arc/include/asm/unaligned.h
 create mode 100644 arch/arc/include/asm/unwind.h
 create mode 100644 arch/arc/kernel/arc_hostlink.c
 create mode 100644 arch/arc/kernel/disasm.c
 create mode 100644 arch/arc/kernel/event-log.c
 create mode 100644 arch/arc/kernel/kgdb.c
 create mode 100644 arch/arc/kernel/kprobes.c
 create mode 100644 arch/arc/kernel/module.c
 create mode 100644 arch/arc/kernel/smp.c
 create mode 100644 arch/arc/kernel/unaligned.c
 create mode 100644 arch/arc/kernel/unwind.c
 create mode 100644 arch/arc/oprofile/Makefile
 create mode 100644 arch/arc/oprofile/common.c
 create mode 100644 arch/arc/plat-arcfpga/include/plat/smp.h
 create mode 100644 arch/arc/plat-arcfpga/smp.c
Signature · 1 line
1.7.4.1
#1 lore raw

RFC PATCH 32/55 ARC: [optim] Cache "current" in Register r25

From: Vineet Gupta <[email protected]>

---
 arch/arc/Kconfig                 |    7 ++++++
 arch/arc/Makefile                |    9 +++++++
 arch/arc/include/asm/Kbuild      |    1 -
 arch/arc/include/asm/current.h   |   32 +++++++++++++++++++++++++++
 arch/arc/include/asm/entry.h     |   45 ++++++++++++++++++++++++++++++++++++++
 arch/arc/include/asm/processor.h |    3 ++
 arch/arc/kernel/asm-offsets.c    |    3 ++
 arch/arc/kernel/ctx_sw.c         |    7 ++++++
 arch/arc/kernel/entry.S          |   14 +++++++++++
 9 files changed, 120 insertions(+), 1 deletions(-)
 create mode 100644 arch/arc/include/asm/current.h
arch/arc/Kconfig +7 -0
index f3aacfc..71e55c0 100644
@@ -277,6 +277,13 @@ config ARC_PLAT_SDRAM_SIZE
 
 endmenu # "Platform Board Configuration"
 
+config ARC_CURR_IN_REG
+	bool "Dedicate Register r25 for current_task pointer"
+	default y
+	help
+	  This reserved Register R25 to point to Current Task in
+	  kernel mode. This saves memory access for each such access
+
 config ARC_STACK_NONEXEC
 	bool "Make stack non-executable"
 	default n
arch/arc/Makefile +9 -0
index 4d52a3b..eeb64dd 100644
@@ -20,6 +20,15 @@ export PLATFORM
 cflags-y	+= -Iarch/arc/plat-$(PLATFORM)/include
 cflags-y	+= -mA7 -fno-common -pipe -fno-builtin -D__linux__
 
+ifdef CONFIG_ARC_CURR_IN_REG
+# For a global register defintion, make sure it gets passed to every file
+# We had a customer reported bug where some code built in kernel was NOT using
+# any kernel headers, and missing the r25 global register
+# Can't do unconditionally (like above) because of recursive include issues
+# due to <linux/thread_info.h>
+LINUXINCLUDE	+=  -include ${src}/arch/arc/include/asm/current.h
+endif
+
 atleast_gcc44 :=  $(call cc-ifversion, -gt, 0402, y)
 cflags-$(atleast_gcc44)			+= -fsection-anchors
 
arch/arc/include/asm/Kbuild +0 -1
index 148dfcf..a246390 100644
@@ -11,7 +11,6 @@ generic-y += bugs.h
 generic-y += bitsperlong.h
 generic-y += clkdev.h
 generic-y += cputime.h
-generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += emergency-restart.h
arch/arc/include/asm/current.h new file +32 -0
new file mode 100644
index 0000000..87b9185
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Vineetg: May 16th, 2008
+ *  - Current macro is now implemented as "global register" r25
+ */
+
+#ifndef _ASM_ARC_CURRENT_H
+#define _ASM_ARC_CURRENT_H
+
+#ifdef __KERNEL__
+
+#ifndef __ASSEMBLY__
+
+#ifdef CONFIG_ARC_CURR_IN_REG
+
+register struct task_struct *curr_arc asm("r25");
+#define current (curr_arc)
+
+#else
+#include <asm-generic/current.h>
+#endif /* ! CONFIG_ARC_CURR_IN_REG */
+
+#endif /* ! __ASSEMBLY__ */
+
+#endif	/* __KERNEL__ */
+
+#endif /* _ASM_ARC_CURRENT_H */
arch/arc/include/asm/entry.h +45 -0

109 lines not on this page · raw message

arch/arc/include/asm/processor.h +3 -0
index 38ea5fb..2fe9f22 100644
@@ -29,6 +29,9 @@ struct thread_struct {
 	unsigned long callee_reg;	/* pointer to callee regs */
 	unsigned long fault_address;	/* dbls as brkpt holder as well */
 	unsigned long cause_code;	/* Exception Cause Code (ECR) */
+#ifdef CONFIG_ARC_CURR_IN_REG
+	unsigned long user_r25;
+#endif
 #ifdef CONFIG_ARC_FPU_SAVE_RESTORE
 	struct arc_fpu fpu;
 #endif
arch/arc/kernel/asm-offsets.c +3 -0
index 7f3f611..b0e7254 100644
@@ -23,6 +23,9 @@ int main(void)
 
 	DEFINE(THREAD_KSP, offsetof(struct thread_struct, ksp));
 	DEFINE(THREAD_CALLEE_REG, offsetof(struct thread_struct, callee_reg));
+#ifdef CONFIG_ARC_CURR_IN_REG
+	DEFINE(THREAD_USER_R25, offsetof(struct thread_struct, user_r25));
+#endif
 	DEFINE(THREAD_FAULT_ADDR,
 	       offsetof(struct thread_struct, fault_address));
 
arch/arc/kernel/ctx_sw.c +7 -0
index 647e37a..fbf739c 100644
@@ -24,6 +24,9 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
 	unsigned int prev = (unsigned int)prev_task;
 	unsigned int next = (unsigned int)next_task;
 	int num_words_to_skip = 1;
+#ifdef CONFIG_ARC_CURR_IN_REG
+	num_words_to_skip++;
+#endif
 
 	__asm__ __volatile__(
 		/* FP/BLINK save generated by gcc (standard function prologue */
@@ -39,7 +42,9 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
 		"st.a    r22, [sp, -4]   \n\t"
 		"st.a    r23, [sp, -4]   \n\t"
 		"st.a    r24, [sp, -4]   \n\t"
+#ifndef CONFIG_ARC_CURR_IN_REG
 		"st.a    r25, [sp, -4]   \n\t"
+#endif
 		"sub     sp, sp, %4      \n\t"	/* create gutter at top */
 
 		/* set ksp of outgoing task in tsk->thread.ksp */
@@ -62,7 +67,9 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
 
 		"add    sp, sp, %4     \n\t"	/* skip gutter at top */
 
+#ifndef CONFIG_ARC_CURR_IN_REG
 		"ld.ab   r25, [sp, 4]   \n\t"
+#endif
 		"ld.ab   r24, [sp, 4]   \n\t"
 		"ld.ab   r23, [sp, 4]   \n\t"
 		"ld.ab   r22, [sp, 4]   \n\t"
arch/arc/kernel/entry.S +14 -0
index deb2652..35406da 100644
@@ -36,6 +36,9 @@
  *   was being "CLEARED" rather then "SET". Since it is Loop INHIBIT Bit,
  *   setting it and not clearing it clears ZOL context
  *
+ * Vineetg: May 16th, 2008
+ *  - r25 now contains the Current Task when in kernel
+ *
  * Vineetg: Dec 22, 2007
  *    Minor Surgery of Low Level ISR to make it SMP safe
  *    - MMU_SCRATCH0 Reg used for freeing up r9 in Level 1 ISR
@@ -540,6 +543,17 @@ restore_regs :
 	; XXX can this be optimised out
 	IRQ_DISABLE_SAVE    r9, r10	;@r10 has prisitine (pre-disable) copy
 
+#ifdef CONFIG_ARC_CURR_IN_REG
+	; Restore User R25
+	; Earlier this used to be only for returning to user mode
+	; However with 2 levels of IRQ this can also happen even if
+	; in kernel mode
+	ld r9, [sp, PT_sp]
+	brhs r9, VMALLOC_START, 8f
+	RESTORE_USER_R25
+8:
+#endif
+
 	; Restore REG File. In case multiple Events outstanding,
 	; use the same priorty as rtie: EXCPN, L2 IRQ, L1 IRQ, None
 	; Note that we use realtime STATUS32 (not pt_regs->status32) to
Signature · 1 line
1.7.4.1
maintainer
#2 lore raw

Re: [RFC Patch v1 32/55] ARC: [optim] Cache "current" in Register r25

arch/arc/Kconfig config ARC_PLAT_SDRAM_SIZE · line 286

Quoted 10 lines · On Monday 12 November 2012, [email protected] wrote:

endmenu # "Platform Board Configuration"

arch/arc/Kconfig +7 -0
+config ARC_CURR_IN_REG
+       bool "Dedicate Register r25 for current_task pointer"
+       default y
+       help
+         This reserved Register R25 to point to Current Task in
+         kernel mode. This saves memory access for each such access
+

This looks like a useful feature if you have 32 GPRs, but why make it optional? Are there cases where you would disable it?

Another alternative to caching "current" would be to cache the per-cpu offset, and calculate current from that one.

Arnd

#3 lore raw

Re: [RFC Patch v1 32/55] ARC: [optim] Cache "current" in Register r25

Quoted 12 lines · Arnd Bergmann

arch/arc/Kconfig config ARC_PLAT_SDRAM_SIZE · line 286

Quoted 9 lines · On Monday 12 November 2012, [email protected] wrote:

endmenu # "Platform Board Configuration"

arch/arc/Kconfig +7 -0
+config ARC_CURR_IN_REG
+       bool "Dedicate Register r25 for current_task pointer"
+       default y
+       help
+         This reserved Register R25 to point to Current Task in
+         kernel mode. This saves memory access for each such access
+

This looks like a useful feature if you have 32 GPRs, but why make it optional? Are there cases where you would disable it?

Since it touched the low level guts of port, it made sense to start with a config option in initial implementation. But I've kept it that way since it annotates the code nicely and implicitly documents how to do this for any other register + data structure.

Quoted 2 lines

Another alternative to caching "current" would be to cache the per-cpu offset, and calculate current from that one.

Good tip - I'll add this to my TODO list -

Quoted 1 line

Arnd

#4 lore raw

RFC PATCH 33/55 ARC: ptrace support

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/Kconfig              |    1 +
 arch/arc/include/asm/ptrace.h |   18 ++++-
 arch/arc/kernel/Makefile      |    3 +
 arch/arc/kernel/entry.S       |   69 +++++++++++++++++
 arch/arc/kernel/ptrace.c      |  164 ++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 251 insertions(+), 4 deletions(-)
arch/arc/Kconfig +1 -0
index 71e55c0..198c7d0 100644
@@ -20,6 +20,7 @@ config ARC
 	select GENERIC_KERNEL_THREAD
 	select GENERIC_PENDING_IRQ if SMP
 	select GENERIC_SMP_IDLE_THREAD
+	select HAVE_ARCH_TRACEHOOK
 	select HAVE_GENERIC_HARDIRQS
 	select HOTPLUG if !INITRAMFS_SOURCE=""
 	select MODULES_USE_ELF_RELA
arch/arc/include/asm/ptrace.h +16 -2
index bc2229f..bb621e8 100644
@@ -42,6 +42,8 @@
 #define PT_orig_r0	96
 #define PT_orig_r8	100
 
+#ifdef __KERNEL__
+
 #ifndef __ASSEMBLY__
 
 /* THE pt_regs: Defines how regs are saved during entry into kernel */
@@ -115,7 +117,6 @@ struct user_regs_struct {
 /* return 1 if user mode or 0 if kernel mode */
 #define user_mode(regs) (regs->status32 & STATUS_U_MASK)
 
-
 /* return 1 if in syscall, 0 if Intr or Exception */
 #define in_syscall(regs) (((regs->orig_r8) >= 0 && \
 			   (regs->orig_r8 <= NR_syscalls)) ? 1 : 0)
@@ -128,6 +129,19 @@ struct user_regs_struct {
 	(struct pt_regs *)(pg_start + THREAD_SIZE - 4) - 1;	\
 })
 
-#endif /* __ASSEMBLY__ */
+#define in_brkpt_trap(regs) (((regs->orig_r8) == (NR_syscalls + 2)) ? 1 : 0)
+
+#define user_stack_pointer(regs)\
+({  unsigned int sp;		\
+	if (user_mode(regs))	\
+		sp = (regs)->sp;\
+	else			\
+		sp = -1;	\
+	sp;			\
+})
+
+#endif /* !__ASSEMBLY__ */
+
+#endif	/* __KERNEL__ */
 
 #endif /* __ASM_PTRACE_H */
arch/arc/kernel/Makefile +3 -0
index 47f6b33..4ddef9a 100644
@@ -5,6 +5,9 @@
 # it under the terms of the GNU General Public License version 2 as
 # published by the Free Software Foundation.
 
+# Pass UTS_MACHINE for user_regset definition
+CFLAGS_ptrace.o		+= -DUTS_MACHINE='"$(UTS_MACHINE)"'
+
 obj-y	:= arcksyms.o setup.o irq.o time.o reset.o ptrace.o entry.o process.o \
 	   signal.o traps.o sys.o troubleshoot.o stacktrace.o
 
arch/arc/kernel/entry.S +69 -0

104 lines not on this page · raw message

arch/arc/kernel/ptrace.c +162 -2

179 lines not on this page · raw message

Signature · 1 line
1.7.4.1
maintainer
#5 lore raw

Re: [RFC Patch v1 33/55] ARC: ptrace support

Quoted 14 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/kernel/ptrace.c +14 -0
+       case PTRACE_PEEKUSR:
+               pos = addr;     /* offset in struct user_regs_struct */
+               count = 4;      /* 1 register only */
+               u_addr = (unsigned int __user *)data;
+               kbuf = NULL;
+               ret = genregs_get(child, NULL, pos, count, kbuf, u_addr);
+               break;
+
+       case PTRACE_POKEUSR:
+               pos = addr;     /* offset in struct user_regs_struct */
+               count = 4;      /* 1 register only */
+
+               /* Ideally @data would have abeen a user space buffer, from
+                * where, we do a copy_from_user.

arch/arc/kernel/ptrace.c long arch_ptrace(struct task_struct *child, long request, · line 166

Quoted 10 lines
arch/arc/kernel/ptrace.c +10 -0
+                * However this request only involves one word, which courtesy
+                * our ABI can be passed in a reg.
+                * regset interface however expects some buffer to copyin from
+                */
+               kbuf = &data;
+               u_addr = NULL;
+
+               ret = genregs_set(child, NULL, pos, count, kbuf, u_addr);
+               break;
+

I think these should be moved into regsets, as we have done for all other new architectures. Your arch_ptrace then becomes a trivial wrapper around ptrace_request.

Arnd

#6 lore raw

Re: [RFC Patch v1 33/55] ARC: ptrace support

Quoted 20 lines · Arnd Bergmann
Quoted 19 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/kernel/ptrace.c +19 -0
+       case PTRACE_PEEKUSR:
+               pos = addr;     /* offset in struct user_regs_struct */
+               count = 4;      /* 1 register only */
+               u_addr = (unsigned int __user *)data;
+               kbuf = NULL;
+               ret = genregs_get(child, NULL, pos, count, kbuf, u_addr);
+               break;
+
+       case PTRACE_POKEUSR:
+               pos = addr;     /* offset in struct user_regs_struct */
+               count = 4;      /* 1 register only */
+
+               /* Ideally @data would have abeen a user space buffer, from
+                * where, we do a copy_from_user.
+                * However this request only involves one word, which courtesy
+                * our ABI can be passed in a reg.
+                * regset interface however expects some buffer to copyin from
+                */
+               kbuf = &data;
Quoted 8 lines

arch/arc/kernel/ptrace.c long arch_ptrace(struct task_struct *child, long request, · line 166

Quoted 5 lines
arch/arc/kernel/ptrace.c +5 -0
+               u_addr = NULL;
+
+               ret = genregs_set(child, NULL, pos, count, kbuf, u_addr);
+               break;
+

I think these should be moved into regsets, as we have done for all other new architectures. Your arch_ptrace then becomes a trivial wrapper around ptrace_request.

The regset stuff is already complete - and even this code uses the reget callbacks. It's just that we need to carry on this dual ABI for some time for our legacy gdbserver.

Quoted 2 lines

Arnd

maintainer
#7 lore raw

Re: [RFC Patch v1 33/55] ARC: ptrace support

Quoted 9 lines · Vineet Gupta
Quoted 3 lines · Arnd Bergmann

I think these should be moved into regsets, as we have done for all other new architectures. Your arch_ptrace then becomes a trivial wrapper around ptrace_request.

The regset stuff is already complete - and even this code uses the reget callbacks. It's just that we need to carry on this dual ABI for some time for our legacy gdbserver.

Ok, but please don't submit that patch upstream then. It's ok to keep it in your own tree for the transitional phase, I assume that you have other patches in there as well that are not submitted yet. Once the new gdb is in use everywhere, you can just drop that patch.

The problem with having this upstream is that this would create a precedent for having the interface, and if people start relying on it being there, we can't remove from upstream any more. If you just have it in your private repository, we can just argue that it was never officially supported.

Arnd

#8 lore raw

RFC PATCH 34/55 ARC: futex

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/include/asm/futex.h |  151 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 151 insertions(+), 0 deletions(-)
 create mode 100644 arch/arc/include/asm/futex.h
arch/arc/include/asm/futex.h new file +151 -0
new file mode 100644
index 0000000..4dc64dd
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Vineetg: August 2010: From Android kernel work
+ */
+
+#ifndef _ASM_FUTEX_H
+#define _ASM_FUTEX_H
+
+#include <linux/futex.h>
+#include <linux/preempt.h>
+#include <linux/uaccess.h>
+#include <asm/errno.h>
+
+#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg)\
+							\
+	__asm__ __volatile__(				\
+	"1:	ld  %1, [%2]			\n"	\
+		insn				"\n"	\
+	"2:	st  %0, [%2]			\n"	\
+	"	mov %0, 0			\n"	\
+	"3:					\n"	\
+	"	.section .fixup,\"ax\"		\n"	\
+	"	.align  4			\n"	\
+	"4:	mov %0, %4			\n"	\
+	"	b   3b				\n"	\
+	"	.previous			\n"	\
+	"	.section __ex_table,\"a\"	\n"	\
+	"	.align  4			\n"	\
+	"	.word   1b, 4b			\n"	\
+	"	.word   2b, 4b			\n"	\
+	"	.previous			\n"	\
+							\
+	: "=&r" (ret), "=&r" (oldval)			\
+	: "r" (uaddr), "r" (oparg), "ir" (-EFAULT)	\
+	: "cc", "memory")
+
+static inline int futex_atomic_op_inuser(int encoded_op, u32 __user *uaddr)
+{
+	int op = (encoded_op >> 28) & 7;
+	int cmp = (encoded_op >> 24) & 15;
+	int oparg = (encoded_op << 8) >> 20;
+	int cmparg = (encoded_op << 20) >> 20;
+	int oldval = 0, ret;
+
+	if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
+		oparg = 1 << oparg;
+
+	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
+		return -EFAULT;
+
+	pagefault_disable();	/* implies preempt_disable() */
+
+	switch (op) {
+	case FUTEX_OP_SET:
+		__futex_atomic_op("mov %0, %3", ret, oldval, uaddr, oparg);
+		break;
+	case FUTEX_OP_ADD:
+		__futex_atomic_op("add %0, %1, %3", ret, oldval, uaddr, oparg);
+		break;
+	case FUTEX_OP_OR:
+		__futex_atomic_op("or  %0, %1, %3", ret, oldval, uaddr, oparg);
+		break;
+	case FUTEX_OP_ANDN:
+		__futex_atomic_op("bic %0, %1, %3", ret, oldval, uaddr, oparg);
+		break;
+	case FUTEX_OP_XOR:
+		__futex_atomic_op("xor %0, %1, %3", ret, oldval, uaddr, oparg);
+		break;
+	default:
+		ret = -ENOSYS;
+	}
+
+	pagefault_enable();	/* subsumes preempt_enable() */
+
+	if (!ret) {
+		switch (cmp) {
+		case FUTEX_OP_CMP_EQ:
+			ret = (oldval == cmparg);
+			break;
+		case FUTEX_OP_CMP_NE:
+			ret = (oldval != cmparg);
+			break;
+		case FUTEX_OP_CMP_LT:
+			ret = (oldval < cmparg);
+			break;
+		case FUTEX_OP_CMP_GE:
+			ret = (oldval >= cmparg);
+			break;
+		case FUTEX_OP_CMP_LE:
+			ret = (oldval <= cmparg);
+			break;
+		case FUTEX_OP_CMP_GT:
+			ret = (oldval > cmparg);
+			break;
+		default:
+			ret = -ENOSYS;
+		}
+	}
+	return ret;
+}
+
+/* Compare-xchg with preemption disabled.
+ *  Notes:
+ *      -Best-Effort: Exchg happens only if compare succeeds.
+ *          If compare fails, returns; leaving retry/looping to upper layers
+ *      -successful cmp-xchg: return orig value in @addr (same as cmp val)
+ *      -Compare fails: return orig value in @addr
+ *      -user access r/w fails: return -EFAULT
+ */
+static inline int
+futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval,
+					u32 newval)
+{
+	u32 val;
+
+	if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
+		return -EFAULT;
+
+	pagefault_disable();	/* implies preempt_disable() */
+
+	/* TBD : can use llock/scond */
+	__asm__ __volatile__(
+	"1:	ld    %0, [%3]	\n"
+	"	brne  %0, %1, 3f	\n"
+	"2:	st    %2, [%3]	\n"
+	"3:	\n"
+	"	.section .fixup,\"ax\"	\n"
+	"4:	mov %0, %4	\n"
+	"	b   3b	\n"
+	"	.previous	\n"
+	"	.section __ex_table,\"a\"	\n"
+	"	.align  4	\n"
+	"	.word   1b, 4b	\n"
+	"	.word   2b, 4b	\n"
+	"	.previous\n"
+	: "=&r"(val)
+	: "r"(oldval), "r"(newval), "r"(uaddr), "ir"(-EFAULT)
+	: "cc", "memory");
+
+	pagefault_enable();	/* subsumes preempt_enable() */
+
+	*uval = val;
+	return val;
+}
+
+#endif
Signature · 1 line
1.7.4.1
#9 lore raw

RFC PATCH 35/55 ARC: oprofile support

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/Kconfig           |    1 +
 arch/arc/Makefile          |    2 ++
 arch/arc/oprofile/Makefile |    9 +++++++++
 arch/arc/oprofile/common.c |   22 ++++++++++++++++++++++
 4 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 arch/arc/oprofile/Makefile
 create mode 100644 arch/arc/oprofile/common.c
arch/arc/Kconfig +1 -0
index 198c7d0..4557c8d 100644
@@ -22,6 +22,7 @@ config ARC
 	select GENERIC_SMP_IDLE_THREAD
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_GENERIC_HARDIRQS
+	select HAVE_OPROFILE
 	select HOTPLUG if !INITRAMFS_SOURCE=""
 	select MODULES_USE_ELF_RELA
 
arch/arc/Makefile +2 -0
index eeb64dd..7ef6767 100644
@@ -97,6 +97,8 @@ ifneq ($(platform-y),)
 core-y		+= arch/arc/plat-$(PLATFORM)/
 endif
 
+drivers-$(CONFIG_OPROFILE)	+= arch/arc/oprofile/
+
 libs-y		+= arch/arc/lib/ $(LIBGCC)
 
 #default target for make without any arguements.
arch/arc/oprofile/Makefile new file +9 -0
new file mode 100644
index 0000000..ce417a6
@@ -0,0 +1,9 @@
+obj-$(CONFIG_OPROFILE) += oprofile.o
+
+DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
+		oprof.o cpu_buffer.o buffer_sync.o \
+		event_buffer.o oprofile_files.o \
+		oprofilefs.o oprofile_stats.o \
+		timer_int.o )
+
+oprofile-y	:= $(DRIVER_OBJS) common.o
arch/arc/oprofile/common.c new file +22 -0
new file mode 100644
index 0000000..917ae16
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * Based on orig code from @author John Levon <[email protected]>
+ */
+
+#include <linux/oprofile.h>
+#include <linux/perf_event.h>
+
+int __init oprofile_arch_init(struct oprofile_operations *ops)
+{
+	return oprofile_perf_init(ops);
+}
+
+void oprofile_arch_exit(void)
+{
+	oprofile_perf_exit();
+}
Signature · 1 line
1.7.4.1
#10 lore raw

RFC PATCH 36/55 ARC: ARCompact 2 levels IRQ (high/low priority) Handling

In reply to [email protected]

From: Vineet Gupta <[email protected]>

There is a bit of hack/kludge right now where we disable preemption if a L2 (High prio) IRQ is taken while L1 (Low prio) is active.

Need to revisit this

---
 arch/arc/Kconfig                |   17 ++++++
 arch/arc/include/asm/entry.h    |   95 +++++++++++++++++++++++++++++++
 arch/arc/include/asm/irqflags.h |    6 ++-
 arch/arc/kernel/entry.S         |  117 +++++++++++++++++++++++++++++++++++++++
 arch/arc/kernel/irq.c           |  104 ++++++++++++++++++++++++++++++++++
 arch/arc/plat-arcfpga/Kconfig   |   13 ++++
 6 files changed, 351 insertions(+), 1 deletions(-)
arch/arc/Kconfig +17 -0
index 4557c8d..e096545 100644
@@ -210,6 +210,23 @@ config ARC_PAGE_SIZE_4K
 
 endchoice
 
+config ARC_COMPACT_IRQ_LEVELS
+	bool "ARCompact IRQ Priorities: High(2)/Low(1)"
+	default n
+
+if ARC_COMPACT_IRQ_LEVELS
+
+config ARC_IRQ3_LV2
+	bool
+
+config ARC_IRQ5_LV2
+	bool
+
+config ARC_IRQ6_LV2
+	bool
+
+endif
+
 config ARC_FPU_SAVE_RESTORE
 	bool "Enable FPU state persistence across context switch"
 	default n
arch/arc/include/asm/entry.h +95 -0

119 lines not on this page · raw message

arch/arc/include/asm/irqflags.h +5 -1
index 752e55d..cc8312d 100644
@@ -95,7 +95,11 @@ static inline long arch_local_save_flags(void)
  */
 static inline int arch_irqs_disabled_flags(unsigned long flags)
 {
-	return !(flags & (STATUS_E1_MASK));
+	return !(flags & (STATUS_E1_MASK
+#ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS
+			| STATUS_E2_MASK
+#endif
+		));
 }
 
 static inline int arch_irqs_disabled(void)
arch/arc/kernel/entry.S +117 -0

154 lines not on this page · raw message

arch/arc/kernel/irq.c +104 -0

126 lines not on this page · raw message

arch/arc/plat-arcfpga/Kconfig +13 -0
index 3b41a0e..3b399ca 100644
@@ -30,4 +30,17 @@ config ARC_SERIAL_BAUD
 	help
 	  Baud rate for the ARC UART
 
+# Platform specific IRQ wiring - tied to devices - feeds into ARC arch code
+config ARC_TIMER_LV2
+	bool "High Priority Timer0 IRQ"
+	depends on ARC_COMPACT_IRQ_LEVELS
+	select ARC_IRQ3_LV2
+
+# Timer HAS to be high priority, for any other high priority config
+config ARC_SERIAL_LV2
+	bool "High Priority Serial IRQ"
+	depends on ARC_SERIAL && ARC_TIMER_LV2
+	depends on ARC_COMPACT_IRQ_LEVELS
+	select ARC_IRQ5_LV2
+
 endif
Signature · 1 line
1.7.4.1
#11 lore raw

RFC PATCH 37/55 ARC: dynamic loadable module support

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/include/asm/module.h |    4 ++
 arch/arc/kernel/Makefile      |    1 +
 arch/arc/kernel/module.c      |  117 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 122 insertions(+), 0 deletions(-)
 create mode 100644 arch/arc/kernel/module.c
arch/arc/include/asm/module.h +4 -0
index 165d768..234b435 100644
@@ -14,4 +14,8 @@
 
 #include <asm-generic/module.h>
 
+#define MODULE_PROC_FAMILY "ARC700"
+
+#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
+
 #endif /* _ASM_ARC_MODULE_H */
arch/arc/kernel/Makefile +1 -0
index 4ddef9a..9151bbe 100644
@@ -11,6 +11,7 @@ CFLAGS_ptrace.o		+= -DUTS_MACHINE='"$(UTS_MACHINE)"'
 obj-y	:= arcksyms.o setup.o irq.o time.o reset.o ptrace.o entry.o process.o \
 	   signal.o traps.o sys.o troubleshoot.o stacktrace.o
 
+obj-$(CONFIG_MODULES)			+= arcksyms.o module.o
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)	+= fpu.o
 CFLAGS_fpu.o   += -mdpfp
 
arch/arc/kernel/module.c new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
1.7.4.1
maintainer
#12 lore raw

Re: [RFC Patch v1 37/55] ARC: dynamic loadable module support

Quoted 19 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/kernel/module.c new file +19 -0
+void *module_alloc(unsigned long size)
+{
+       if (size == 0)
+               return NULL;
+
+       return vmalloc(size);
+
+}
+
+void module_free(struct module *module, void *region)
+{
+       vfree(region);
+}
+
+int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
+                             char *secstr, struct module *mod)
+{
+    return 0;
+}

arch/arc/kernel/module.c line 111

Quoted 10 lines
arch/arc/kernel/module.c new file +10 -0
+
+void module_arch_cleanup(struct module *mod)
+{
+}
+
+int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
+                   struct module *mod)
+{
+    return 0;
+} 

All of these are identical to the default implementation in kernel/module.c and you can simply drop your own definitions.

Arnd

#13 lore raw

Re: [RFC Patch v1 37/55] ARC: dynamic loadable module support

Quoted 24 lines · Arnd Bergmann
Quoted 23 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/kernel/module.c new file +23 -0
+void *module_alloc(unsigned long size)
+{
+       if (size == 0)
+               return NULL;
+
+       return vmalloc(size);
+
+}
+
+void module_free(struct module *module, void *region)
+{
+       vfree(region);
+}
+
+int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
+                             char *secstr, struct module *mod)
+{
+    return 0;
+}
+
+void module_arch_cleanup(struct module *mod)
+{
+}
Quoted 8 lines

arch/arc/kernel/module.c line 117

Quoted 6 lines
arch/arc/kernel/module.c new file +6 -0
+
+int module_finalize(const Elf32_Ehdr *hdr, const Elf_Shdr *sechdrs,
+                   struct module *mod)
+{
+    return 0;
+} 

All of these are identical to the default implementation in kernel/module.c and you can simply drop your own definitions.

Alloc/free dropped. Rest 3 needed for ARC specific unwinding out of loadable modules.

Quoted 2 lines

Arnd

#14 lore raw

RFC PATCH 38/55 ARC: Low level event capture/logging

In reply to [email protected]

From: Vineet Gupta <[email protected]>

Poorman's version of LTT

---
 arch/arc/Kconfig                     |    7 +
 arch/arc/Makefile                    |    3 +
 arch/arc/include/asm/event-log-asm.h |  185 +++++++++++++++++++++
 arch/arc/include/asm/event-log.h     |  102 ++++++++++++
 arch/arc/kernel/Makefile             |    1 +
 arch/arc/kernel/asm-offsets.c        |   15 ++
 arch/arc/kernel/entry.S              |   31 ++++
 arch/arc/kernel/event-log.c          |  304 ++++++++++++++++++++++++++++++++++
 arch/arc/kernel/signal.c             |    3 +
 arch/arc/mm/tlb.c                    |    3 +
 arch/arc/mm/tlbex.S                  |    7 +
 11 files changed, 661 insertions(+), 0 deletions(-)
 create mode 100644 arch/arc/include/asm/event-log-asm.h
 create mode 100644 arch/arc/include/asm/event-log.h
 create mode 100644 arch/arc/kernel/event-log.c
arch/arc/Kconfig +7 -0
index e096545..15d740c 100644
@@ -323,6 +323,13 @@ config ARC_DBG_TLB_PARANOIA
 	depends on ARC_DBG
 	default n
 
+config ARC_DBG_EVENT_TIMELINE
+	bool "Low level event capture"
+	depends on ARC_DBG
+	default n
+	help
+	  Capture low level events: IRQ/Trap/Exception
+
 config ARC_DBG_TLB_MISS_COUNT
 	bool "Profile TLB Misses"
 	default n
arch/arc/Makefile +3 -0
index 7ef6767..a533546 100644
@@ -47,6 +47,9 @@ endif
 disable_small_data := y
 cflags-$(disable_small_data)		+= -mno-sdata -fcall-used-gp
 
+# Low level event tracing with Metaware debugger assist needs symbol info
+cflags-$(CONFIG_ARC_DBG_EVENT_TIMELINE) += -g
+
 cflags-$(CONFIG_CPU_BIG_ENDIAN)		+= -mbig-endian
 ldflags-$(CONFIG_CPU_BIG_ENDIAN)	+= -EB
 
arch/arc/include/asm/event-log-asm.h new file +185 -0

185 lines not on this page · raw message

arch/arc/include/asm/event-log.h new file +102 -0

102 lines not on this page · raw message

arch/arc/kernel/Makefile +1 -0
index 9151bbe..ec1f130 100644
@@ -12,6 +12,7 @@ obj-y	:= arcksyms.o setup.o irq.o time.o reset.o ptrace.o entry.o process.o \
 	   signal.o traps.o sys.o troubleshoot.o stacktrace.o
 
 obj-$(CONFIG_MODULES)			+= arcksyms.o module.o
+obj-$(CONFIG_ARC_DBG_EVENT_TIMELINE)	+= event-log.o
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)	+= fpu.o
 CFLAGS_fpu.o   += -mdpfp
 
arch/arc/kernel/asm-offsets.c +15 -0
index b0e7254..0c06b7a 100644
@@ -13,6 +13,7 @@
 #include <linux/thread_info.h>
 #include <asm/page.h>
 #include <linux/kbuild.h>
+#include <asm/event-log.h>
 
 int main(void)
 {
@@ -45,5 +46,19 @@ int main(void)
 
 	DEFINE(MM_CTXT_ASID, offsetof(mm_context_t, asid));
 
+#ifdef CONFIG_ARC_DBG_EVENT_TIMELINE
+	BLANK();
+	DEFINE(EVLOG_FIELD_EXTRA, offsetof(timeline_log_t, extra));
+	DEFINE(EVLOG_FIELD_EFA, offsetof(timeline_log_t, fault_addr));
+	DEFINE(EVLOG_FIELD_CAUSE, offsetof(timeline_log_t, cause));
+	DEFINE(EVLOG_FIELD_TASK, offsetof(timeline_log_t, task));
+	DEFINE(EVLOG_FIELD_TIME, offsetof(timeline_log_t, time));
+	DEFINE(EVLOG_FIELD_EVENT_ID, offsetof(timeline_log_t, event));
+	DEFINE(EVLOG_FIELD_SP, offsetof(timeline_log_t, sp));
+	DEFINE(EVLOG_RECORD_SZ, sizeof(timeline_log_t));
+	DEFINE(EVLOG_FIELD_EXTRA2, offsetof(timeline_log_t, extra2));
+	DEFINE(EVLOG_FIELD_EXTRA3, offsetof(timeline_log_t, extra3));
+#endif
+
 	return 0;
 }
arch/arc/kernel/entry.S +31 -0
index 13a0052..5babb8a 100644
@@ -148,6 +148,7 @@ VECTOR   reserved                ; Reserved Exceptions
 #include <asm/errno.h>
 #include <asm/arcregs.h>
 #include <asm/irqflags.h>
+#include <asm/event-log-asm.h>
 
 ;##################### Scratch Mem for IRQ stack switching #############
 
@@ -213,6 +214,8 @@ ARC_ENTRY handle_interrupt_level2
 	st      r9, [r10, THREAD_INFO_PREEMPT_COUNT]
 
 1:
+	TAKE_SNAP_C_FROM_ASM  SNAP_INTR_IN2
+
 	;------------------------------------------------------
 	; setup params for Linux common ISR and invoke it
 	;------------------------------------------------------
@@ -245,6 +248,9 @@ ARC_ENTRY handle_interrupt_level1
 	SWITCH_TO_KERNEL_STK
 	SAVE_ALL_INT1
 
+	; snapshot routine takes care of disabling nested intr
+	TAKE_SNAP_C_FROM_ASM  SNAP_INTR_IN
+
 	lr  r0, [icause1]
 	and r0, r0, 0x1f
 
@@ -267,6 +273,8 @@ ARC_ENTRY instr_service
 
 	EXCPN_PROLOG_FREEUP_REG r9
 
+	TAKE_SNAP_ASM r8, r9, SNAP_EXCP_IN
+
 	lr  r9, [erstatus]
 
 	SWITCH_TO_KERNEL_STK
@@ -291,6 +299,8 @@ ARC_ENTRY mem_service
 
 	EXCPN_PROLOG_FREEUP_REG r9
 
+	TAKE_SNAP_ASM r8, r9, SNAP_EXCP_IN
+
 	lr  r9, [erstatus]
 
 	SWITCH_TO_KERNEL_STK
@@ -342,6 +352,8 @@ ARC_ENTRY EV_TLBProtV
 
 	EXCPN_PROLOG_FREEUP_REG r9
 
+	TAKE_SNAP_ASM r8, r9, SNAP_EXCP_IN
+
 	;Which mode (user/kernel) was the system in when Exception occured
 	lr  r9, [erstatus]
 
@@ -400,6 +412,8 @@ ARC_ENTRY EV_PrivilegeV
 
 	EXCPN_PROLOG_FREEUP_REG r9
 
+	TAKE_SNAP_ASM r8, r9, SNAP_EXCP_IN
+
 	lr  r9, [erstatus]
 
 	SWITCH_TO_KERNEL_STK
@@ -526,6 +540,8 @@ ARC_ENTRY EV_Trap
 	; Need at least 1 reg to code the early exception prolog
 	EXCPN_PROLOG_FREEUP_REG r9
 
+	TAKE_SNAP_ASM r10, r9,  SNAP_TRAP_IN
+
 	;Which mode (user/kernel) was the system in when intr occured
 	lr  r9, [erstatus]
 
@@ -733,6 +749,7 @@ not_exception:
 	st      r9, [r10, THREAD_INFO_PREEMPT_COUNT]
 
 149:
+	TAKE_SNAP_C_FROM_ASM SNAP_INTR_OUT2
 	;return from level 2
 	RESTORE_ALL_INT2
 debug_marker_l2:
@@ -745,6 +762,7 @@ not_level2_interrupt:
 	bbit0  r10, STATUS_A1_BIT, not_level1_interrupt
 
 	;return from level 1
+	TAKE_SNAP_C_FROM_ASM SNAP_INTR_OUT
 
 	RESTORE_ALL_INT1
 debug_marker_l1:
@@ -754,6 +772,19 @@ not_level1_interrupt:
 
 	;this case is for syscalls or Exceptions (with fake rtie)
 
+#ifdef CONFIG_ARC_DBG_EVENT_TIMELINE
+	ld r8, [sp, PT_orig_r8]
+	cmp r8, NR_syscalls+1
+	jeq  149f
+	TAKE_SNAP_ASM r9, r10, SNAP_TRAP_OUT
+	j 150f
+
+149:
+	TAKE_SNAP_ASM r9, r10, SNAP_EXCP_OUT
+150:
+
+#endif
+
 	RESTORE_ALL_SYS
 debug_marker_syscall:
 	rtie
arch/arc/kernel/event-log.c new file +304 -0

304 lines not on this page · raw message

arch/arc/kernel/signal.c +3 -0
index bc834da..2ec908b 100644
@@ -54,6 +54,7 @@
 #include <linux/syscalls.h>
 #include <linux/tracehook.h>
 #include <asm/ucontext.h>
+#include <asm/event-log.h>
 
 #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
 
@@ -137,6 +138,8 @@ SYSCALL_DEFINE0(rt_sigreturn)
 		if (do_sigaltstack(&sf->uc.uc_stack, NULL, regs->sp) == -EFAULT)
 			goto badframe;
 
+	take_snap(SNAP_SIGRETURN, 0, 0);
+
 	return regs->r0;
 
 badframe:
arch/arc/mm/tlb.c +3 -0
index c10111d..0e5cb9f 100644
@@ -56,6 +56,7 @@
 #include <asm/setup.h>
 #include <asm/mmu_context.h>
 #include <asm/tlb.h>
+#include <asm/event-log.h>
 
 /*			Need for ARC MMU v2
  *
@@ -191,6 +192,8 @@ noinline void local_flush_tlb_all(void)
 	unsigned int entry;
 	struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
 
+	take_snap(SNAP_TLB_FLUSH_ALL, 0, 0);
+
 	local_irq_save(flags);
 
 	/* Load PD0 and PD1 with template for a Blank Entry */
arch/arc/mm/tlbex.S +7 -0
index fc5b971..86804d3 100644
@@ -41,6 +41,7 @@
 #include <asm/entry.h>
 #include <asm/tlb.h>
 #include <asm/pgtable.h>
+#include <asm/event-log-asm.h>
 #include <asm/arcregs.h>
 #include <asm/cache.h>
 #include <asm/processor.h>
@@ -194,6 +195,9 @@ ex_saved_reg1:
 	st_s  r2, [r0, 8]
 	st_s  r3, [r0, 12]
 
+	; take a snapshot of upon entering FAST Path TLB Hdlr
+	TAKE_SNAP_ASM r0, r1, SNAP_EXCP_IN
+
 	; VERIFY if the ASID in MMU-PID Reg is same as
 	; one in Linux data structures
 
@@ -317,6 +321,9 @@ do_slow_path_pf:
 	; That requires freeing up r9
 	EXCPN_PROLOG_FREEUP_REG r9
 
+	; take a snapshot of upon entering SLOW Path TLB Hdlr
+	TAKE_SNAP_ASM r8, r9, SNAP_DO_PF_ENTER
+
 	lr  r9, [erstatus]
 
 	SWITCH_TO_KERNEL_STK
Signature · 1 line
1.7.4.1
maintainer
#15 lore raw

Re: [RFC Patch v1 38/55] ARC: Low level event capture/logging

arch/arc/kernel/event-log.c line 147

Quoted 4 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/kernel/event-log.c new file +3 -0
+EXPORT_SYMBOL(take_snap);
+
...
+EXPORT_SYMBOL(take_snap2);

Where are these functions called?

Shouldn't this all just be part of the perf module?

If not, can you make the exports GPL-only?

Arnd

#16 lore raw

Re: [RFC Patch v1 38/55] ARC: Low level event capture/logging

Quoted 6 lines · Arnd Bergmann

arch/arc/kernel/event-log.c line 147

Quoted 4 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/kernel/event-log.c new file +3 -0
+EXPORT_SYMBOL(take_snap);
+
...
+EXPORT_SYMBOL(take_snap2);

Where are these functions called?

These are called from various parts of ARCH code, such as before handling signal or TLB flush etc.

Quoted 1 line

Shouldn't this all just be part of the perf module?

These are for low level ARCH specific event snapshotting. Maybe perf/ftrace already have some of these in the generic code which eventually call the ARCH APIs. Our current perf support is just husk of an implementation. Once we have the full perf / ftrace support this module - except for the even t capture part could just go away. OTOH, I've not seen much usage of this from loadable modules - so if you deem correct, I can even remove the export.

Quoted 1 line

If not, can you make the exports GPL-only?

Am I right in understanding that this is more related to discouraging non GPL modules "in general" than having to do with port itself.

Quoted 2 lines

Arnd

maintainer
#17 lore raw

Re: [RFC Patch v1 38/55] ARC: Low level event capture/logging

Quoted 21 lines · Vineet Gupta
Quoted 6 lines · Arnd Bergmann

arch/arc/kernel/event-log.c line 147

Quoted 4 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/kernel/event-log.c new file +3 -0
+EXPORT_SYMBOL(take_snap);
+
...
+EXPORT_SYMBOL(take_snap2);

Where are these functions called?

These are called from various parts of ARCH code, such as before handling signal or TLB flush etc.

Quoted 1 line

Shouldn't this all just be part of the perf module?

These are for low level ARCH specific event snapshotting. Maybe perf/ftrace already have some of these in the generic code which eventually call the ARCH APIs. Our current perf support is just husk of an implementation. Once we have the full perf / ftrace support this module - except for the even t capture part could just go away. OTOH, I've not seen much usage of this from loadable modules - so if you deem correct, I can even remove the export.

Quoted 4 lines
Quoted 1 line

If not, can you make the exports GPL-only?

Am I right in understanding that this is more related to discouraging non GPL modules "in general" than having to do with port itself.

Mostly yes. I understand that there are some reasons why people want to mark symbols as generally available, e.g. for standard interfaces that have traditionally been available to every module. My rule is usually that any newly introduced symbols should be EXPORT_SYMBOL_GPL by default, unless there is a (documented) reason to use EXPORT_SYMBOL instead. This is particularly true for low-level interfaces like the one here.

If you can just remove the export, that is probably the best solution.

On a related note, any global symbol (exported or not) should normally have a prefix that identifies the subsystem it belongs to. A global identifier like "take_snap" can potentially conflict with symbols in other parts of the kernel.

Arnd

#18 lore raw

Re: [RFC Patch v1 38/55] ARC: Low level event capture/logging

Quoted 31 lines · Arnd Bergmann
Quoted 19 lines · Vineet Gupta
Quoted 6 lines · Arnd Bergmann

arch/arc/kernel/event-log.c line 147

Quoted 4 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/kernel/event-log.c new file +3 -0
+EXPORT_SYMBOL(take_snap);
+
...
+EXPORT_SYMBOL(take_snap2);

Where are these functions called?

These are called from various parts of ARCH code, such as before handling signal or TLB flush etc.

Quoted 1 line

Shouldn't this all just be part of the perf module?

These are for low level ARCH specific event snapshotting. Maybe perf/ftrace already have some of these in the generic code which eventually call the ARCH APIs. Our current perf support is just husk of an implementation. Once we have the full perf / ftrace support this module - except for the even t capture part could just go away. OTOH, I've not seen much usage of this from loadable modules - so if you deem correct, I can even remove the export.

Quoted 3 lines
Quoted 1 line

If not, can you make the exports GPL-only?

Am I right in understanding that this is more related to discouraging non GPL modules "in general" than having to do with port itself.

Mostly yes. I understand that there are some reasons why people want to mark symbols as generally available, e.g. for standard interfaces that have traditionally been available to every module. My rule is usually that any newly introduced symbols should be EXPORT_SYMBOL_GPL by default, unless there is a (documented) reason to use EXPORT_SYMBOL instead. This is particularly true for low-level interfaces like the one here.

Quoted 1 line

If you can just remove the export, that is probably the best solution.

Will do !

Quoted 4 lines

On a related note, any global symbol (exported or not) should normally have a prefix that identifies the subsystem it belongs to. A global identifier like "take_snap" can potentially conflict with symbols in other parts of the kernel.

Agreed - this contraption anyways was a quick hack to debug the "rooky" issues we had initially - things are pretty stable now - so I'm planning to drop this patch entirely. When we do something like LTTng etc we'll revisit the low level instrumentation.

Thx,
-Vineet

#19 lore raw

RFC PATCH 39/55 ARC: kernel diagnostics: show_regs() etc

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/kernel/troubleshoot.c |  304 ++++++++++++++++++++++++++++++++++++++++
 arch/arc/mm/tlbex.S            |   20 +++
 2 files changed, 324 insertions(+), 0 deletions(-)
arch/arc/kernel/troubleshoot.c +304 -0
index 80bfe2a..8a816f2 100644
@@ -6,12 +6,316 @@
  */
 
 #include <linux/ptrace.h>
+#include <linux/module.h>
+#include <linux/mm.h>
+#include <linux/fs.h>
+#include <linux/kdev_t.h>
+#include <linux/fs_struct.h>
+#include <linux/proc_fs.h>
+#include <linux/file.h>
+#include <asm/arcregs.h>
+#include <asm/event-log.h>
+
+/*
+ * Common routine to print scratch regs (r0-r12) or callee regs (r13-r25)
+ *   -Prints 3 regs per line and a CR.
+ *   -To continue, callee regs right after scratch, special handling of CR
+ */
+static noinline void print_reg_file(long *reg_rev, int start_num)
+{
+	unsigned int i;
+	char buf[512];
+	int n = 0, len = sizeof(buf);
+
+	/* weird loop because pt_regs regs rev r12..r0, r25..r13 */
+	for (i = start_num; i < start_num + 13; i++) {
+		n += scnprintf(buf + n, len - n, "r%02u: 0x%08lx\t",
+			       i, (unsigned long)*reg_rev);
+
+		if (((i + 1) % 3) == 0)
+			n += scnprintf(buf + n, len - n, "\n");
+
+		reg_rev--;
+	}
+
+	if (start_num != 0)
+		n += scnprintf(buf + n, len - n, "\n\n");
+
+	pr_info("%s", buf);
+}
+
+static void show_callee_regs(struct callee_regs *cregs)
+{
+	print_reg_file(&(cregs->r13), 13);
+}
+
+void print_task_path_n_nm(struct task_struct *task, char *buf)
+{
+	struct path path;
+	char *nm = NULL;
+	struct mm_struct *mm;
+	struct file *exe_file;
+	char comm_buf[TASK_COMM_LEN];
+
+	mm = get_task_mm(task);
+	if (!mm)
+		goto done;
+
+	exe_file = get_mm_exe_file(mm);
+	mmput(mm);
+
+	if (exe_file) {
+		path = exe_file->f_path;
+		path_get(&exe_file->f_path);
+		fput(exe_file);
+		nm = d_path(&path, buf, 255);
+		path_put(&path);
+	}
+
+done:
+	pr_info("task = %s '%s', TGID %u PID = %u\n", nm,
+		get_task_comm(comm_buf, task), task->tgid, task->pid);
+}
+EXPORT_SYMBOL(print_task_path_n_nm);
+
+static void show_faulting_vma(unsigned long address, char *buf)
+{
+	struct vm_area_struct *vma;
+	struct inode *inode;
+	unsigned long ino = 0;
+	dev_t dev = 0;
+	char *nm = buf;
+
+	vma = find_vma(current->active_mm, address);
+
+	/* check against the find_vma( ) behaviour which returns the next VMA
+	 * if the container VMA is not found
+	 */
+	if (vma && (vma->vm_start <= address)) {
+		struct file *file = vma->vm_file;
+		if (file) {
+			struct path *path = &file->f_path;
+			nm = d_path(path, buf, PAGE_SIZE - 1);
+			inode = vma->vm_file->f_path.dentry->d_inode;
+			dev = inode->i_sb->s_dev;
+			ino = inode->i_ino;
+		}
+		pr_info("    @off 0x%lx in [%s]\n"
+			"    VMA: 0x%08lx to 0x%08lx\n\n",
+		       address - vma->vm_start, nm, vma->vm_start, vma->vm_end);
+	} else
+		pr_info("    @No matching VMA found\n");
+}
+
+static void show_ecr_verbose(struct pt_regs *regs)
+{
+	unsigned int vec, cause_code, cause_reg;
+	unsigned long address;
+
+	cause_reg = current->thread.cause_code;
+	pr_info("\n[ECR]: 0x%08x => ", cause_reg);
+
+	/* For Data fault, this is data address not instruction addr */
+	address = current->thread.fault_address;
+
+	vec = cause_reg >> 16;
+	cause_code = (cause_reg >> 8) & 0xFF;
+
+	/* For DTLB Miss or ProtV, display the memory involved too */
+	if (vec == ECR_V_DTLB_MISS) {
+		pr_cont("Invalid (%s) @ 0x%08lx by insn @ 0x%08lx\n",
+		       (cause_code == 0x01) ? "Read From" :
+		       ((cause_code == 0x02) ? "Write to" : "EX"),
+		       address, regs->ret);
+	} else if (vec == ECR_V_ITLB_MISS) {
+		pr_cont("Insn could not be fetched\n");
+	} else if (vec == ECR_V_MACH_CHK) {
+		pr_cont("%s\n", (cause_code == 0x0) ?
+					"Double Fault" : "Other Fatal Err");
+
+	} else if (vec == ECR_V_PROTV) {
+		if (cause_code == ECR_C_PROTV_INST_FETCH)
+			pr_cont("Execute from Non-exec Page\n");
+		else if (cause_code == ECR_C_PROTV_LOAD)
+			pr_cont("Read from Non-readable Page\n");
+		else if (cause_code == ECR_C_PROTV_STORE)
+			pr_cont("Write to Non-writable Page\n");
+		else if (cause_code == ECR_C_PROTV_XCHG)
+			pr_cont("Data exchange protection violation\n");
+		else if (cause_code == ECR_C_PROTV_MISALIG_DATA)
+			pr_cont("Misaligned r/w from 0x%08lx\n", address);
+	} else {
+		pr_cont("Check Programmer's Manual\n");
+	}
+}
+
+/************************************************************************
+ *  API called by rest of kernel
+ ***********************************************************************/
 
 void show_regs(struct pt_regs *regs)
 {
+	struct task_struct *tsk = current;
+	struct callee_regs *cregs;
+	char *buf;
+
+	buf = (char *)__get_free_page(GFP_TEMPORARY);
+	if (!buf)
+		return;
+
+	print_task_path_n_nm(tsk, buf);
+
+	if (current->thread.cause_code)
+		show_ecr_verbose(regs);
+
+	pr_info("[EFA]: 0x%08lx\n", current->thread.fault_address);
+	pr_info("[ERET]: 0x%08lx (PC of Faulting Instr)\n", regs->ret);
+
+	show_faulting_vma(regs->ret, buf);	/* faulting code, not data */
+
+	/* can't use print_vma_addr() yet as it doesn't check for
+	 * non-inclusive vma
+	 */
+
+	/* print special regs */
+	pr_info("status32: 0x%08lx\n", regs->status32);
+	pr_info(" SP: 0x%08lx\tFP: 0x%08lx\n", regs->sp, regs->fp);
+	pr_info("BTA: 0x%08lx\tBLINK: 0x%08lx\n",
+		regs->bta, regs->blink);
+	pr_info("LPS: 0x%08lx\tLPE: 0x%08lx\tLPC: 0x%08lx\n",
+	       regs->lp_start, regs->lp_end, regs->lp_count);
+
+	/* print regs->r0 thru regs->r12
+	 * Sequential printing was generating horrible code
+	 */
+	print_reg_file(&(regs->r0), 0);
+
+	/* If Callee regs were saved, display them too */
+	cregs = (struct callee_regs *)current->thread.callee_reg;
+	if (cregs)
+		show_callee_regs(cregs);
+
+	free_page((unsigned long)buf);
 }
 
 void show_kernel_fault_diag(const char *str, struct pt_regs *regs,
 			    unsigned long address, unsigned long cause_reg)
 {
+	current->thread.fault_address = address;
+	current->thread.cause_code = cause_reg;
+
+	/* Caller and Callee regs */
+	show_regs(regs);
+
+	/* Show stack trace if this Fatality happened in kernel mode */
+	if (!user_mode(regs))
+		show_stacktrace(current, regs);
+
+	sort_snaps(1);
 }
+
+#ifdef CONFIG_DEBUG_FS
+
+#include <linux/module.h>
+#include <linux/fs.h>
+#include <linux/mount.h>
+#include <linux/pagemap.h>
+#include <linux/init.h>
+#include <linux/namei.h>
+#include <linux/debugfs.h>
+
+static struct dentry *test_dentry;
+static struct dentry *test_dir;
+static struct dentry *test_u32_dentry;
+
+static u32 clr_on_read = 1;
+
+#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
+u32 numitlb, numdtlb, num_pte_not_present;
+
+static int fill_display_data(char *kbuf)
+{
+	size_t num = 0;
+	num += sprintf(kbuf + num, "I-TLB Miss %x\n", numitlb);
+	num += sprintf(kbuf + num, "D-TLB Miss %x\n", numdtlb);
+	num += sprintf(kbuf + num, "PTE not present %x\n", num_pte_not_present);
+
+	if (clr_on_read)
+		numitlb = numdtlb = num_pte_not_present = 0;
+
+	return num;
+}
+
+static int tlb_stats_open(struct inode *inode, struct file *file)
+{
+	file->private_data = (void *)__get_free_page(GFP_KERNEL);
+	return 0;
+}
+
+/* called on user read(): display the couters */
+static ssize_t tlb_stats_output(struct file *file,	/* file descriptor */
+				char __user *user_buf,	/* user buffer */
+				size_t len,		/* length of buffer */
+				loff_t *offset)		/* offset in the file */
+{
+	size_t num;
+	char *kbuf = (char *)file->private_data;
+
+	num = fill_display_data(kbuf);
+
+	/* simple_read_from_buffer() is helper for copy to user space
+	   It copies up to @2 (num) bytes from kernel buffer @4 (kbuf) at offset
+	   @3 (offset) into the user space address starting at @1 (user_buf).
+	   @5 (len) is max size of user buffer
+	 */
+	return simple_read_from_buffer(user_buf, num, offset, kbuf, len);
+}
+
+/* called on user write : clears the counters */
+static ssize_t tlb_stats_clear(struct file *file, const char __user *user_buf,
+			       size_t length, loff_t *offset)
+{
+	numitlb = numdtlb = num_pte_not_present = 0;
+	return length;
+}
+
+static int tlb_stats_close(struct inode *inode, struct file *file)
+{
+	free_page((unsigned long)(file->private_data));
+	return 0;
+}
+
+static const struct file_operations tlb_stats_file_ops = {
+	.read = tlb_stats_output,
+	.write = tlb_stats_clear,
+	.open = tlb_stats_open,
+	.release = tlb_stats_close
+};
+#endif
+
+static int __init arc_debugfs_init(void)
+{
+	test_dir = debugfs_create_dir("arc", NULL);
+
+#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
+	test_dentry = debugfs_create_file("tlb_stats", 0444, test_dir, NULL,
+					  &tlb_stats_file_ops);
+#endif
+
+	test_u32_dentry =
+	    debugfs_create_u32("clr_on_read", 0444, test_dir, &clr_on_read);
+
+	return 0;
+}
+
+module_init(arc_debugfs_init);
+
+static void __exit arc_debugfs_exit(void)
+{
+	debugfs_remove(test_u32_dentry);
+	debugfs_remove(test_dentry);
+	debugfs_remove(test_dir);
+}
+module_exit(arc_debugfs_exit);
+
+#endif
arch/arc/mm/tlbex.S +20 -0
index 86804d3..a95d0f7 100644
@@ -134,6 +134,14 @@ ex_saved_reg1:
 	lsr     r0, r2, (PAGE_SHIFT - 2)
 	and     r0, r0, ( (PTRS_PER_PTE - 1) << 2)
 	ld.aw   r0, [r1, r0]            ; get PTE and PTE ptr for fault addr
+#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
+	and.f 0, r0, _PAGE_PRESENT
+	bz   1f
+	ld   r2, [num_pte_not_present]
+	add  r2, r2, 1
+	st   r2, [num_pte_not_present]
+1:
+#endif
 
 .endm
 
@@ -223,6 +231,12 @@ ARC_ENTRY EV_TLBMissI
 
 	TLBMISS_FREEUP_REGS
 
+#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
+	ld  r0, [@numitlb]
+	add r0, r0, 1
+	st  r0, [@numitlb]
+#endif
+
 	;----------------------------------------------------------------
 	; Get the PTE corresponding to V-addr accessed
 	LOAD_FAULT_PTE
@@ -256,6 +270,12 @@ ARC_ENTRY EV_TLBMissD
 
 	TLBMISS_FREEUP_REGS
 
+#ifdef CONFIG_ARC_DBG_TLB_MISS_COUNT
+	ld  r0, [@numdtlb]
+	add r0, r0, 1
+	st  r0, [@numdtlb]
+#endif
+
 	;----------------------------------------------------------------
 	; Get the PTE corresponding to V-addr accessed
 	; If PTE exists, it will setup, r0 = PTE, r1 = Ptr to PTE
Signature · 1 line
1.7.4.1
#20 lore raw

RFC PATCH 40/55 ARC: SMP support

In reply to [email protected]

From: Vineet Gupta <[email protected]>

I would like to acknowledge people who have contributed to SMP port -Rajeshwar Ranga <[email protected]> for orig 2.6.19 SMP port -Noam Camus <[email protected]> for help with resurrecting 3.2 SMP port

---
 arch/arc/Kconfig                         |   39 ++++-
 arch/arc/Makefile                        |    3 +
 arch/arc/include/asm/entry.h             |   49 +++++
 arch/arc/include/asm/mmu_context.h       |    4 +
 arch/arc/include/asm/mutex.h             |    9 +
 arch/arc/include/asm/pgtable.h           |    4 +
 arch/arc/include/asm/processor.h         |    8 +
 arch/arc/include/asm/smp.h               |  108 +++++++++++
 arch/arc/kernel/Makefile                 |    1 +
 arch/arc/kernel/ctx_sw.c                 |   11 +
 arch/arc/kernel/entry.S                  |    4 +
 arch/arc/kernel/head.S                   |   33 ++++
 arch/arc/kernel/irq.c                    |    5 +
 arch/arc/kernel/setup.c                  |    4 +
 arch/arc/kernel/smp.c                    |  295 ++++++++++++++++++++++++++++++
 arch/arc/mm/tlb.c                        |    6 +
 arch/arc/mm/tlbex.S                      |   38 ++++
 arch/arc/plat-arcfpga/Kconfig            |   12 ++
 arch/arc/plat-arcfpga/Makefile           |    1 +
 arch/arc/plat-arcfpga/include/plat/irq.h |   10 +-
 arch/arc/plat-arcfpga/include/plat/smp.h |  115 ++++++++++++
 arch/arc/plat-arcfpga/irq.c              |   10 +
 arch/arc/plat-arcfpga/smp.c              |  192 +++++++++++++++++++
 23 files changed, 959 insertions(+), 2 deletions(-)
 create mode 100644 arch/arc/kernel/smp.c
 create mode 100644 arch/arc/plat-arcfpga/include/plat/smp.h
 create mode 100644 arch/arc/plat-arcfpga/smp.c
arch/arc/Kconfig +38 -1
index 15d740c..8d72ada 100644
@@ -118,9 +118,44 @@ config CPU_BIG_ENDIAN
 	help
 	  Build kernel for Big Endian Mode of ARC CPU
 
+# If a plat can do IPI, same core(s) can do minimal SMP
+config ARC_HAS_IPI
+	bool
+
+config SMP
+	bool "Symmetric Multi-Processing (Incomplete)"
+	default y
+	depends on ARC_HAS_IPI
+	select USE_GENERIC_SMP_HELPERS
+	help
+	  This enables support for systems with more than one CPU. If you have
+	  a system with only one CPU, like most personal computers, say N. If
+	  you have a system with more than one CPU, say Y.
+
+if SMP
+
+config ARC_HAS_COH_CACHES
+	def_bool n
+
+config ARC_HAS_COH_LLSC
+	def_bool n
+
+config ARC_HAS_REENTRANT_IRQ_LV2
+	def_bool n
+
+endif
+
+config NR_CPUS
+	int "Maximum number of CPUs (2-32)"
+	range 2 32
+	depends on SMP
+	default "2"
+
 menuconfig ARC_CACHE
 	bool "Enable Cache Support"
 	default y
+	# if SMP, cache enabled ONLY if ARC implementation has cache coherency
+	depends on !SMP || ARC_HAS_COH_CACHES
 
 if ARC_CACHE
 
@@ -213,6 +248,8 @@ endchoice
 config ARC_COMPACT_IRQ_LEVELS
 	bool "ARCompact IRQ Priorities: High(2)/Low(1)"
 	default n
+	# if SMP, LV2 enabled ONLY if ARC implementation has LV2 re-entrancy
+	depends on !SMP || ARC_HAS_REENTRANT_IRQ_LV2
 
 if ARC_COMPACT_IRQ_LEVELS
 
@@ -320,7 +357,7 @@ menuconfig ARC_DBG
 
 config ARC_DBG_TLB_PARANOIA
 	bool "Paranoia Checks in Low Level TLB Handlers"
-	depends on ARC_DBG
+	depends on ARC_DBG && !SMP
 	default n
 
 config ARC_DBG_EVENT_TIMELINE
arch/arc/Makefile +3 -0
index a533546..a86e284 100644
@@ -127,3 +127,6 @@ archclean:
 # Thus forcing all exten calls in this file to be long calls
 export CFLAGS_decompress_inflate.o = -mmedium-calls
 export CFLAGS_initramfs.o = -mmedium-calls
+ifdef CONFIG_SMP
+export CFLAGS_core.o = -mmedium-calls
+endif
arch/arc/include/asm/entry.h +49 -0

79 lines not on this page · raw message

arch/arc/include/asm/mmu_context.h +4 -0
index d12f3de..0d71fb1 100644
@@ -147,8 +147,10 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next,
 			     struct task_struct *tsk)
 {
+#ifndef CONFIG_SMP
 	/* PGD cached in MMU reg to avoid 3 mem lookups: task->mm->pgd */
 	write_aux_reg(ARC_REG_SCRATCH_DATA0, next->pgd);
+#endif
 
 	/*
 	 * Get a new ASID if task doesn't have a valid one. Possible when
@@ -197,7 +199,9 @@ static inline void destroy_context(struct mm_struct *mm)
 
 static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
 {
+#ifndef CONFIG_SMP
 	write_aux_reg(ARC_REG_SCRATCH_DATA0, next->pgd);
+#endif
 
 	/* Unconditionally get a new ASID */
 	get_new_mmu_context(next);
arch/arc/include/asm/mutex.h +9 -0
index 3be5e64..a2f88ff 100644
@@ -6,4 +6,13 @@
  * published by the Free Software Foundation.
  */
 
+/*
+ * xchg() based mutex fast path maintains a state of 0 or 1, as opposed to
+ * atomic dec based which can "count" any number of lock contenders.
+ * This ideally needs to be fixed in core, but for now switching to dec ver.
+ */
+#if defined(CONFIG_SMP) && (CONFIG_NR_CPUS > 2)
+#include <asm-generic/mutex-dec.h>
+#else
 #include <asm-generic/mutex-xchg.h>
+#endif
arch/arc/include/asm/pgtable.h +4 -0
index dcb07015..b7e3668 100644
@@ -354,11 +354,15 @@ static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
  * Thus use this macro only when you are certain that "current" is current
  * e.g. when dealing with signal frame setup code etc
  */
+#ifndef CONFIG_SMP
 #define pgd_offset_fast(mm, addr)	\
 ({					\
 	pgd_t *pgd_base = (pgd_t *) read_aux_reg(ARC_REG_SCRATCH_DATA0);  \
 	pgd_base + pgd_index(addr);	\
 })
+#else
+#define pgd_offset_fast(mm, addr)	pgd_offset(mm, addr)
+#endif
 
 extern void paging_init(void);
 extern pgd_t swapper_pg_dir[] __aligned(PAGE_SIZE);
arch/arc/include/asm/processor.h +8 -0
index 2fe9f22..dccef68 100644
@@ -58,7 +58,15 @@ unsigned long thread_saved_pc(struct task_struct *t);
 /* Prepare to copy thread state - unlazy all lazy status */
 #define prepare_to_copy(tsk)    do { } while (0)
 
+/*
+ * A lot of busy-wait loops in SMP are based off of non-volatile data otherwise
+ * get optimised away by gcc
+ */
+#ifdef CONFIG_SMP
+#define cpu_relax()	__asm__ __volatile__ ("" : : : "memory")
+#else
 #define cpu_relax()	do { } while (0)
+#endif
 
 /*
  * Create a new kernel thread
arch/arc/include/asm/smp.h +108 -0

130 lines not on this page · raw message

arch/arc/kernel/Makefile +1 -0
index ec1f130..b2cf444 100644
@@ -13,6 +13,7 @@ obj-y	:= arcksyms.o setup.o irq.o time.o reset.o ptrace.o entry.o process.o \
 
 obj-$(CONFIG_MODULES)			+= arcksyms.o module.o
 obj-$(CONFIG_ARC_DBG_EVENT_TIMELINE)	+= event-log.o
+obj-$(CONFIG_SMP) 			+= smp.o
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)	+= fpu.o
 CFLAGS_fpu.o   += -mdpfp
 
arch/arc/kernel/ctx_sw.c +11 -0
index fbf739c..60844da 100644
@@ -58,7 +58,18 @@ __switch_to(struct task_struct *prev_task, struct task_struct *next_task)
 		 * For SMP extra work to get to &_current_task[cpu]
 		 * (open coded SET_CURR_TASK_ON_CPU)
 		 */
+#ifndef CONFIG_SMP
 		"st  %2, [@_current_task]	\n\t"
+#else
+		"lr   r24, [identity]		\n\t"
+		"lsr  r24, r24, 8		\n\t"
+		"bmsk r24, r24, 7		\n\t"
+		"add2 r24, @_current_task, r24	\n\t"
+		"st   %2,  [r24]		\n\t"
+#endif
+#ifdef CONFIG_ARC_CURR_IN_REG
+		"mov r25, %2   \n\t"
+#endif
 
 		/* get ksp of incoming task from tsk->thread.ksp */
 		"ld.as  sp, [%2, %1]   \n\t"
arch/arc/kernel/entry.S +4 -0
index 5babb8a..7b24a5a 100644
@@ -240,7 +240,11 @@ ARC_EXIT handle_interrupt_level2
 ARC_ENTRY handle_interrupt_level1
 
 	/* free up r9 as scratchpad */
+#ifdef CONFIG_SMP
+	sr  r9, [ARC_REG_SCRATCH_DATA0]
+#else
 	st   r9, [@int1_saved_reg]
+#endif
 
 	;Which mode (user/kernel) was the system in when intr occured
 	lr  r9, [status32_l1]
arch/arc/kernel/head.S +33 -0
index e63f6a4..006dec3 100644
@@ -27,6 +27,15 @@ stext:
 	; Don't clobber r0-r4 yet. It might have bootloader provided info
 	;-------------------------------------------------------------------
 
+#ifdef CONFIG_SMP
+	; Only Boot (Master) proceeds. Others wait in platform dependent way
+	;	IDENTITY Reg [ 3  2  1  0 ]
+	;	(cpu-id)             ^^^	=> Zero for UP ARC700
+	;					=> #Core-ID if SMP (Master 0)
+	GET_CPU_ID  r5
+	cmp	r5, 0
+	jnz	arc_platform_smp_wait_to_boot
+#endif
 	; Clear BSS before updating any globals
 	; XXX: use ZOL here
 	mov	r5, __bss_start
@@ -76,3 +85,27 @@ stext:
 	GET_TSK_STACK_BASE r9, sp	; r9 = tsk, sp = stack base(output)
 
 	j	start_kernel	; "C" entry point
+
+#ifdef CONFIG_SMP
+;----------------------------------------------------------------
+;     First lines of code run by secondary before jumping to 'C'
+;----------------------------------------------------------------
+	.section .init.text, "ax",@progbits
+	.type first_lines_of_secondary, @function
+	.globl first_lines_of_secondary
+
+first_lines_of_secondary:
+
+	; setup per-cpu idle task as "current" on this CPU
+	ld	r0, [@secondary_idle_tsk]
+	SET_CURR_TASK_ON_CPU  r0, r1
+
+	; setup stack (fp, sp)
+	mov	fp, 0
+
+	; set it's stack base to tsk->thread_info bottom
+	GET_TSK_STACK_BASE r0, sp
+
+	j	start_kernel_secondary
+
+#endif
arch/arc/kernel/irq.c +5 -0
index afde5a7..32af2ee 100644
@@ -73,6 +73,11 @@ void __init init_IRQ(void)
 	irq_modify_status(irq, IRQ_NOAUTOEN, 0);
 
 	plat_init_IRQ();
+
+#ifdef CONFIG_SMP
+	/* Master CPU to initialize the IPI framework */
+	arc_platform_smp_init_cpu();
+#endif
 }
 
 /*
arch/arc/kernel/setup.c +4 -0
index 82ac206..258b9ee 100644
@@ -79,6 +79,10 @@ void __init setup_arch(char **cmdline_p)
 
 	setup_processor();
 
+#ifdef CONFIG_SMP
+	smp_init_cpus();
+#endif
+
 	setup_arch_memory();
 
 	/* Can be issue if someone passes cmd line arg "ro"
arch/arc/kernel/smp.c new file +295 -0

295 lines not on this page · raw message

arch/arc/mm/tlb.c +6 -0
index 0e5cb9f..defa0c0 100644
@@ -462,6 +462,12 @@ void __init arc_mmu_init(void)
 
 	/* Enable the MMU */
 	write_aux_reg(ARC_REG_PID, MMU_ENABLE);
+
+	/* In smp we use this reg for interrupt 1 scratch */
+#ifndef CONFIG_SMP
+	/* swapper_pg_dir is the pgd for the kernel, used by vmalloc */
+	write_aux_reg(ARC_REG_SCRATCH_DATA0, swapper_pg_dir);
+#endif
 }
 
 /*
arch/arc/mm/tlbex.S +38 -0
index a95d0f7..e933e4c 100644
@@ -58,9 +58,15 @@
 	.global ex_saved_reg1
 	.align 1 << L1_CACHE_SHIFT	; IMP: Must be Cache Line aligned
 	.type   ex_saved_reg1, @object
+#ifdef CONFIG_SMP
+	.size   ex_saved_reg1, (CONFIG_NR_CPUS << L1_CACHE_SHIFT)
+ex_saved_reg1:
+	.zero (CONFIG_NR_CPUS << L1_CACHE_SHIFT)
+#else
 	.size   ex_saved_reg1, 16
 ex_saved_reg1:
 	.zero 16
+#endif
 
 ;============================================================================
 ;  Troubleshooting Stuff
@@ -117,7 +123,13 @@ ex_saved_reg1:
 
 	lr  r2, [efa]
 
+#ifndef CONFIG_SMP
 	lr  r1, [ARC_REG_SCRATCH_DATA0] ; current pgd
+#else
+	GET_CURR_TASK_ON_CPU  r1
+	ld  r1, [r1, TASK_ACT_MM]
+	ld  r1, [r1, MM_PGD]
+#endif
 
 	lsr     r0, r2, PGDIR_SHIFT     ; Bits for indexing into PGD
 	ld.as   r1, [r1, r0]            ; PGD entry corresp to faulting addr
@@ -193,12 +205,28 @@ ex_saved_reg1:
 ;	".size   ex_saved_reg1, 16"
 ; [All of this dance is to avoid stack switching for each TLB Miss, since we
 ; only need to save only a handful of regs, as opposed to complete reg file]
+;
+; For ARC700 SMP, the "global" obviously can't be used for free up the FIRST
+; core reg as it will not be SMP safe.
+; Thus scratch AUX reg is used (and no longer used to cache task PGD).
+; To save the rest of 3 regs - per cpu, the global is made "per-cpu".
+; Epilogue thus has to locate the "per-cpu" storage for regs.
+; To avoid cache line bouncing the per-cpu global is aligned/sized per
+; L1_CACHE_SHIFT, despite fundamentally needing to be 12 bytes only. Hence
+;	".size   ex_saved_reg1, (CONFIG_NR_CPUS << L1_CACHE_SHIFT)"
 
 ; As simple as that....
 
 .macro TLBMISS_FREEUP_REGS
+#ifdef CONFIG_SMP
+	sr  r0, [ARC_REG_SCRATCH_DATA0]	; freeup r0 to code with
+	GET_CPU_ID  r0			; get to per cpu scratch mem,
+	lsl r0, r0, L1_CACHE_SHIFT	; cache line wide per cpu
+	add r0, @ex_saved_reg1, r0
+#else
 	st    r0, [@ex_saved_reg1]
 	mov_s r0, @ex_saved_reg1
+#endif
 	st_s  r1, [r0, 4]
 	st_s  r2, [r0, 8]
 	st_s  r3, [r0, 12]
@@ -214,11 +242,21 @@ ex_saved_reg1:
 
 ;-----------------------------------------------------------------
 .macro TLBMISS_RESTORE_REGS
+#ifdef CONFIG_SMP
+	GET_CPU_ID  r0			; get to per cpu scratch mem
+	lsl r0, r0, L1_CACHE_SHIFT	; each is cache line wide
+	add r0, @ex_saved_reg1, r0
+	ld_s  r3, [r0,12]
+	ld_s  r2, [r0, 8]
+	ld_s  r1, [r0, 4]
+	lr    r0, [ARC_REG_SCRATCH_DATA0]
+#else
 	mov_s r0, @ex_saved_reg1
 	ld_s  r3, [r0,12]
 	ld_s  r2, [r0, 8]
 	ld_s  r1, [r0, 4]
 	ld_s  r0, [r0]
+#endif
 .endm
 
 .section .text, "ax",@progbits	;Fast Path Code, candidate for ICCM
arch/arc/plat-arcfpga/Kconfig +12 -0
index 3b399ca..1b65644 100644
@@ -23,6 +23,18 @@ config ARC_BOARD_ML509
 
 endchoice
 
+config ISS_SMP_EXTN
+	bool "ARC SMP Extensions (ISS Models only)"
+	default n
+	select ARC_HAS_IPI
+	help
+	  SMP Extensions to ARC700, in a "simulation only" Model, supported in
+	  ARC ISS (Instruction Set Simulator).
+	  The SMP extensions include:
+	  -IDU (Interrupt Distribution Unit)
+	  -XTL (To enable CPU start/stop/set-PC for another CPU)
+	  It doesn't provide coherent Caches and/or Atomic Ops (LLOCK/SCOND)
+
 config ARC_SERIAL_BAUD
 	int "UART Baud rate"
 	default "115200"
arch/arc/plat-arcfpga/Makefile +1 -0
index 385eb9d..7b97445 100644
@@ -7,3 +7,4 @@
 #
 
 obj-y := platform.o irq.o
+obj-$(CONFIG_ISS_SMP_EXTN)		+= smp.o
\ No newline at end of file
arch/arc/plat-arcfpga/include/plat/irq.h +9 -1
index b34e087..255b90e 100644
@@ -12,7 +12,11 @@
 #ifndef __PLAT_IRQ_H
 #define __PLAT_IRQ_H
 
-#define NR_IRQS		16
+#ifdef CONFIG_SMP
+#define NR_IRQS 32
+#else
+#define NR_IRQS 16
+#endif
 
 #define UART0_IRQ	5
 #define UART1_IRQ	10
@@ -24,4 +28,8 @@
 #define PCI_IRQ		14
 #define PS2_IRQ		15
 
+#ifdef CONFIG_SMP
+#define IDU_INTERRUPT_0 16
+#endif
+
 #endif
arch/arc/plat-arcfpga/include/plat/smp.h new file +115 -0

115 lines not on this page · raw message

arch/arc/plat-arcfpga/irq.c +10 -0
index a308057..ddb7d2a 100644
@@ -38,4 +38,14 @@ void __init plat_init_IRQ(void)
 
 	for (i = 0; i < NR_IRQS; i++)
 		irq_set_chip_and_handler(i, &fpga_chip, handle_level_irq);
+
+	/*
+	 * SMP Hack because UART IRQ hardwired to cpu0 (boot-cpu) but if the
+	 * request_irq() comes from any other CPU, the low level IRQ unamsking
+	 * essential for getting Interrupts won't be enabled on cpu0, locking
+	 * up the UART state machine.
+	 */
+#ifdef CONFIG_SMP
+	arch_unmask_irq(UART0_IRQ);
+#endif
 }
arch/arc/plat-arcfpga/smp.c new file +192 -0

192 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#21 lore raw

RFC PATCH 41/55 ARC: dwarf2 stack unwinder

In reply to [email protected]

From: Vineet Gupta <[email protected]>

-Originally controbuted by Rajeshwar Range <rajeshwar.ranga> -Derived off of generic unwinder in 2.6.19 and adapted to ARC

---
 arch/arc/Kconfig              |   15 +
 arch/arc/include/asm/module.h |    7 +
 arch/arc/include/asm/unwind.h |  163 +++++
 arch/arc/kernel/Makefile      |    6 +
 arch/arc/kernel/entry.S       |    9 +
 arch/arc/kernel/module.c      |   42 ++
 arch/arc/kernel/setup.c       |    3 +
 arch/arc/kernel/unwind.c      | 1329 +++++++++++++++++++++++++++++++++++++++++
 arch/arc/kernel/vmlinux.lds.S |   23 +-
 9 files changed, 1596 insertions(+), 1 deletions(-)
 create mode 100644 arch/arc/include/asm/unwind.h
 create mode 100644 arch/arc/kernel/unwind.c
arch/arc/Kconfig +15 -0
index 8d72ada..26609d6 100644
@@ -22,6 +22,7 @@ config ARC
 	select GENERIC_SMP_IDLE_THREAD
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_GENERIC_HARDIRQS
+	select HAVE_MOD_ARCH_SPECIFIC if ARC_DW2_UNWIND
 	select HAVE_OPROFILE
 	select HOTPLUG if !INITRAMFS_SOURCE=""
 	select MODULES_USE_ELF_RELA
@@ -355,6 +356,20 @@ menuconfig ARC_DBG
 	bool "ARC debugging"
 	default y
 
+config ARC_DW2_UNWIND
+	bool "Enable DWARF specific kernel stack unwind"
+	depends on ARC_DBG
+	default y
+	select KALLSYMS
+	help
+	  Compiles the kernel with DWARF unwind information and can be used
+	  to get stack backtraces.
+
+	  If you say Y here the resulting kernel image will be slightly larger
+	  but not slower, and it will give very useful debugging information.
+	  If you don't debug the kernel, you can say N, but we may not be able
+	  to solve problems without frame unwind information
+
 config ARC_DBG_TLB_PARANOIA
 	bool "Paranoia Checks in Low Level TLB Handlers"
 	depends on ARC_DBG && !SMP
arch/arc/include/asm/module.h +7 -0
index 234b435..518222b 100644
@@ -14,6 +14,13 @@
 
 #include <asm-generic/module.h>
 
+#ifdef CONFIG_ARC_DW2_UNWIND
+struct mod_arch_specific {
+	void *unw_info;
+	int unw_sec_idx;
+};
+#endif
+
 #define MODULE_PROC_FAMILY "ARC700"
 
 #define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
arch/arc/include/asm/unwind.h new file +163 -0

163 lines not on this page · raw message

arch/arc/kernel/Makefile +6 -0
index b2cf444..86b159f 100644
@@ -14,9 +14,15 @@ obj-y	:= arcksyms.o setup.o irq.o time.o reset.o ptrace.o entry.o process.o \
 obj-$(CONFIG_MODULES)			+= arcksyms.o module.o
 obj-$(CONFIG_ARC_DBG_EVENT_TIMELINE)	+= event-log.o
 obj-$(CONFIG_SMP) 			+= smp.o
+obj-$(CONFIG_ARC_DW2_UNWIND)		+= unwind.o
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)	+= fpu.o
 CFLAGS_fpu.o   += -mdpfp
 
+ifdef CONFIG_ARC_DW2_UNWIND
+CFLAGS_ctx_sw.o += -fno-omit-frame-pointer
+obj-y += ctx_sw.o
+else
 obj-y += ctx_sw_asm.o
+endif
 
 extra-y := vmlinux.lds head.o
arch/arc/kernel/entry.S +9 -0
index 7b24a5a..13d6feb 100644
@@ -868,3 +868,12 @@ ARC_ENTRY sys_clone_wrapper
 
 	b ret_from_system_call
 ARC_EXIT sys_clone_wrapper
+
+#ifdef CONFIG_ARC_DW2_UNWIND
+; Workaround for bug 94179 (STAR ):
+; Despite -fasynchronous-unwind-tables, linker is not making dwarf2 unwinder
+; section (.debug_frame) as loadable. So we force it here.
+; This also fixes STAR 9000487933 where the prev-workaround (objcopy --setflag)
+; would not work after a clean build due to kernel build system dependencies.
+.section .debug_frame, "wa",@progbits
+#endif
arch/arc/kernel/module.c +42 -0

70 lines not on this page · raw message

arch/arc/kernel/setup.c +3 -0
index 258b9ee..34a2ff5 100644
@@ -20,6 +20,7 @@
 #include <asm/page.h>
 #include <asm/irq.h>
 #include <asm/arcregs.h>
+#include <asm/unwind.h>
 
 #define FIX_PTR(x)  __asm__ __volatile__(";" : "+r"(x))
 
@@ -96,6 +97,8 @@ void __init setup_arch(char **cmdline_p)
 	conswitchp = &dummy_con;
 #endif
 
+	arc_unwind_init();
+	arc_unwind_setup();
 }
 
 /*
arch/arc/kernel/unwind.c new file +1329 -0

1,329 lines not on this page · raw message

arch/arc/kernel/vmlinux.lds.S +22 -1
index 67c35bd..56c074e 100644
@@ -101,17 +101,38 @@ SECTIONS
 
 	BSS_SECTION(0, 0, 0)
 
+#ifdef CONFIG_ARC_DW2_UNWIND
+	. = ALIGN(PAGE_SIZE);
+	.debug_frame  : {
+		__start_unwind = .;
+		*(.debug_frame)
+		__end_unwind = .;
+	}
+#else
+	/DISCARD/ : {	*(.debug_frame) }
+#endif
+
 	NOTES
 
 	. = ALIGN(PAGE_SIZE);
 	_end = . ;
 
 	STABS_DEBUG
-	DWARF_DEBUG
 	DISCARDS
 
 	.arcextmap 0 : {
 		*(.gnu.linkonce.arcextmap.*)
 		*(.arcextmap.*)
 	}
+
+	/* open-coded because we need .debug_frame seperately for unwinding */
+	.debug_aranges 0 : { *(.debug_aranges) }
+	.debug_pubnames 0 : { *(.debug_pubnames) }
+	.debug_info 0 : { *(.debug_info) }
+	.debug_abbrev 0 : { *(.debug_abbrev) }
+	.debug_line 0 : { *(.debug_line) }
+	.debug_str 0 : { *(.debug_str) }
+	.debug_loc 0 : { *(.debug_loc) }
+	.debug_macinfo 0 : { *(.debug_macinfo) }
+
 }
Signature · 1 line
1.7.4.1
#22 lore raw

RFC PATCH 42/55 ARC: stacktracing APIs based on dw2 unwinder

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/kernel/stacktrace.c |  215 +++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 213 insertions(+), 2 deletions(-)
arch/arc/kernel/stacktrace.c +213 -2
index b9d1646..a63ff84 100644
@@ -1,13 +1,206 @@
 /*
+ *	stacktrace.c : stacktracing APIs needed by rest of kernel
+ *			(wrappers over ARC dwarf based unwinder)
+ *
  * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
+ *
+ *  vineetg: aug 2009
+ *  -Implemented CONFIG_STACKTRACE APIs, primarily save_stack_trace_tsk( )
+ *   for displaying task's kernel mode call stack in /proc/<pid>/stack
+ *  -Iterator based approach to have single copy of unwinding core and APIs
+ *   needing unwinding, implement the logic in iterator regarding:
+ *      = which frame onwards to start capture
+ *      = which frame to stop capturing (wchan)
+ *      = specifics of data structs where trace is saved(CONFIG_STACKTRACE etc)
+ *
+ *  vineetg: March 2009
+ *  -Implemented correct versions of thread_saved_pc() and get_wchan()
+ *
+ *  rajeshwarr: 2008
+ *  -Initial implementation
  */
 
 #include <linux/ptrace.h>
 #include <linux/export.h>
+#include <linux/stacktrace.h>
+#include <linux/kallsyms.h>
+#include <asm/arcregs.h>
+#include <asm/unwind.h>
+#include <asm/switch_to.h>
+
+/*-------------------------------------------------------------------------
+ *              Unwinder Iterator
+ *-------------------------------------------------------------------------
+ */
+
+#ifdef CONFIG_ARC_DW2_UNWIND
+
+static void seed_unwind_frame_info(struct task_struct *tsk,
+				   struct pt_regs *regs,
+				   struct unwind_frame_info *frame_info)
+{
+	if (tsk == NULL && regs == NULL) {
+		unsigned long fp, sp, blink, ret;
+		frame_info->task = current;
+
+		__asm__ __volatile__(
+			"mov %0,r27\n\t"
+			"mov %1,r28\n\t"
+			"mov %2,r31\n\t"
+			"mov %3,r63\n\t"
+			: "=r"(fp), "=r"(sp), "=r"(blink), "=r"(ret)
+		);
+
+		frame_info->regs.r27 = fp;
+		frame_info->regs.r28 = sp;
+		frame_info->regs.r31 = blink;
+		frame_info->regs.r63 = ret;
+		frame_info->call_frame = 0;
+	} else if (regs == NULL) {
+
+		frame_info->task = tsk;
+
+		frame_info->regs.r27 = KSTK_FP(tsk);
+		frame_info->regs.r28 = KSTK_ESP(tsk);
+		frame_info->regs.r31 = KSTK_BLINK(tsk);
+		frame_info->regs.r63 = (unsigned int)__switch_to;
+
+		/* In the prologue of __switch_to, first FP is saved on stack
+		 * and then SP is copied to FP. Dwarf assumes cfa as FP based
+		 * but we didn't save FP. The value retrieved above is FP's
+		 * state in previous frame.
+		 * As a work around for this, we unwind from __switch_to start
+		 * and adjust SP accordingly. The other limitation is that
+		 * __switch_to macro is dwarf rules are not generated for inline
+		 * assembly code
+		 */
+		frame_info->regs.r27 = 0;
+		frame_info->regs.r28 += 64;
+		frame_info->call_frame = 0;
+
+	} else {
+		frame_info->task = tsk;
+
+		frame_info->regs.r27 = regs->fp;
+		frame_info->regs.r28 = regs->sp;
+		frame_info->regs.r31 = regs->blink;
+		frame_info->regs.r63 = regs->ret;
+		frame_info->call_frame = 0;
+	}
+}
+
+#endif
+
+static noinline unsigned int
+arc_unwind_core(struct task_struct *tsk, struct pt_regs *regs,
+		int (*consumer_fn) (unsigned int, void *), void *arg)
+{
+#ifdef CONFIG_ARC_DW2_UNWIND
+	int ret = 0;
+	unsigned int address;
+	struct unwind_frame_info frame_info;
+
+	seed_unwind_frame_info(tsk, regs, &frame_info);
+
+	while (1) {
+		address = UNW_PC(&frame_info);
+
+		if (address && __kernel_text_address(address)) {
+			if (consumer_fn(address, arg) == -1)
+				break;
+		}
+
+		ret = arc_unwind(&frame_info);
+
+		if (ret == 0) {
+			frame_info.regs.r63 = frame_info.regs.r31;
+			continue;
+		} else {
+			break;
+		}
+	}
+
+	return address;		/* return the last address it saw */
+#else
+	/* On ARC, only Dward based unwinder works. fp based backtracing is
+	 * not possible (-fno-omit-frame-pointer) because of the way function
+	 * prelogue is setup (callee regs saved and then fp set and not other
+	 * way around
+	 */
+	pr_warn("CONFIG_ARC_DW2_UNWIND needs to be enabled\n");
+	return 0;
+
+#endif
+}
+
+/*-------------------------------------------------------------------------
+ * callbacks called by unwinder iterator to implement kernel APIs
+ *
+ * The callback can return -1 to force the iterator to stop, which by default
+ * keeps going till the bottom-most frame.
+ *-------------------------------------------------------------------------
+ */
+
+/* Call-back which plugs into unwinding core to dump the stack in
+ * case of panic/OOPs/BUG etc
+ */
+static int __print_sym(unsigned int address, void *unused)
+{
+	__print_symbol("  %s\n", address);
+	return 0;
+}
+
+#ifdef CONFIG_STACKTRACE
+
+/* Call-back which plugs into unwinding core to capture the
+ * traces needed by kernel on /proc/<pid>/stack
+ */
+static int __collect_all(unsigned int address, void *arg)
+{
+	struct stack_trace *trace = arg;
+
+	if (trace->skip > 0)
+		trace->skip--;
+	else
+		trace->entries[trace->nr_entries++] = address;
+
+	if (trace->nr_entries >= trace->max_entries)
+		return -1;
+
+	return 0;
+}
+
+static int __collect_all_but_sched(unsigned int address, void *arg)
+{
+	struct stack_trace *trace = arg;
+
+	if (in_sched_functions(address))
+		return 0;
+
+	if (trace->skip > 0)
+		trace->skip--;
+	else
+		trace->entries[trace->nr_entries++] = address;
+
+	if (trace->nr_entries >= trace->max_entries)
+		return -1;
+
+	return 0;
+}
+
+#endif
+
+static int __get_first_nonsched(unsigned int address, void *unused)
+{
+	if (in_sched_functions(address))
+		return 0;
+
+	return -1;
+}
 
 /*-------------------------------------------------------------------------
  *              APIs expected by various kernel sub-systems
@@ -16,7 +209,8 @@
 
 noinline void show_stacktrace(struct task_struct *tsk, struct pt_regs *regs)
 {
-	pr_info("\nStack Trace: NOT Available\n");
+	pr_info("\nStack Trace:\n");
+	arc_unwind_core(tsk, regs, __print_sym, NULL);
 }
 EXPORT_SYMBOL(show_stacktrace);
 
@@ -39,5 +233,22 @@ EXPORT_SYMBOL(dump_stack);
  */
 unsigned int get_wchan(struct task_struct *tsk)
 {
-	return 0;
+	return arc_unwind_core(tsk, NULL, __get_first_nonsched, NULL);
+}
+
+#ifdef CONFIG_STACKTRACE
+
+/*
+ * API required by CONFIG_STACKTRACE, CONFIG_LATENCYTOP.
+ * A typical use is when /proc/<pid>/stack is queried by userland
+ */
+void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
+{
+	arc_unwind_core(tsk, NULL, __collect_all_but_sched, trace);
+}
+
+void save_stack_trace(struct stack_trace *trace)
+{
+	arc_unwind_core(current, NULL, __collect_all, trace);
 }
+#endif
Signature · 1 line
1.7.4.1
#23 lore raw

RFC PATCH 43/55 ARC: disassembly (needed by kprobes/kgdb/unaligned-access-emul)

In reply to [email protected]

From: Vineet Gupta <[email protected]>

Orig written by Rajeshwar Ranga <[email protected]>

Consolidation/cleanups by Mischa Jonker <[email protected]>

---
 arch/arc/include/asm/disasm.h |  116 +++++++++
 arch/arc/kernel/Makefile      |    2 +-
 arch/arc/kernel/disasm.c      |  539 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 656 insertions(+), 1 deletions(-)
 create mode 100644 arch/arc/include/asm/disasm.h
 create mode 100644 arch/arc/kernel/disasm.c
arch/arc/include/asm/disasm.h new file +116 -0
new file mode 100644
index 0000000..f1cce3d
@@ -0,0 +1,116 @@
+/*
+ * several functions that help interpret ARC instructions
+ * used for unaligned accesses, kprobes and kgdb
+ *
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ARC_DISASM_H__
+#define __ARC_DISASM_H__
+
+enum {
+	op_Bcc = 0, op_BLcc = 1, op_LD = 2, op_ST = 3, op_MAJOR_4 = 4,
+	op_MAJOR_5 = 5, op_LD_ADD = 12, op_ADD_SUB_SHIFT = 13,
+	op_ADD_MOV_CMP = 14, op_S = 15, op_LD_S = 16, op_LDB_S = 17,
+	op_LDW_S = 18, op_LDWX_S = 19, op_ST_S = 20, op_STB_S = 21,
+	op_STW_S = 22, op_Su5 = 23, op_SP = 24, op_GP = 25,
+	op_Pcl = 26, op_MOV_S = 27, op_ADD_CMP = 28, op_BR_S = 29,
+	op_B_S = 30, op_BL_S = 31
+};
+
+enum flow {
+	noflow,
+	direct_jump,
+	direct_call,
+	indirect_jump,
+	indirect_call,
+	invalid_instr
+};
+
+#define IS_BIT(word, n)		((word) & (1<<n))
+#define BITS(word, s, e)	(((word) >> (s)) & (~((-2) << ((e) - (s)))))
+
+#define MAJOR_OPCODE(word)	(BITS((word), 27, 31))
+#define MINOR_OPCODE(word)	(BITS((word), 16, 21))
+#define FIELD_A(word)		(BITS((word), 0, 5))
+#define FIELD_B(word)		((BITS((word), 12, 14)<<3) | \
+				(BITS((word), 24, 26)))
+#define FIELD_C(word)		(BITS((word), 6, 11))
+#define FIELD_u6(word)		FIELDC(word)
+#define FIELD_s12(word)		sign_extend(((BITS((word), 0, 5) << 6) | \
+					BITS((word), 6, 11)), 12)
+
+/* note that for BL/BRcc these two macro's need another AND statement to mask
+ * out bit 1 (make the result a multiple of 4) */
+#define FIELD_s9(word)		sign_extend(((BITS(word, 15, 15) << 8) | \
+					BITS(word, 16, 23)), 9)
+#define FIELD_s21(word)		sign_extend(((BITS(word, 6, 15) << 11) | \
+					(BITS(word, 17, 26) << 1)), 12)
+#define FIELD_s25(word)		sign_extend(((BITS(word, 0, 3) << 21) | \
+					(BITS(word, 6, 15) << 11) | \
+					(BITS(word, 17, 26) << 1)), 12)
+
+/* note: these operate on 16 bits! */
+#define FIELD_S_A(word)		((BITS((word), 2, 2)<<3) | BITS((word), 0, 2))
+#define FIELD_S_B(word)		((BITS((word), 10, 10)<<3) | \
+				BITS((word), 8, 10))
+#define FIELD_S_C(word)		((BITS((word), 7, 7)<<3) | BITS((word), 5, 7))
+#define FIELD_S_H(word)		((BITS((word), 0, 2)<<3) | BITS((word), 5, 8))
+#define FIELD_S_u5(word)	(BITS((word), 0, 4))
+#define FIELD_S_u6(word)	(BITS((word), 0, 4) << 1)
+#define FIELD_S_u7(word)	(BITS((word), 0, 4) << 2)
+#define FIELD_S_u10(word)	(BITS((word), 0, 7) << 2)
+#define FIELD_S_s7(word)	sign_extend(BITS((word), 0, 5) << 1, 9)
+#define FIELD_S_s8(word)	sign_extend(BITS((word), 0, 7) << 1, 9)
+#define FIELD_S_s9(word)	sign_extend(BITS((word), 0, 8), 9)
+#define FIELD_S_s10(word)	sign_extend(BITS((word), 0, 8) << 1, 10)
+#define FIELD_S_s11(word)	sign_extend(BITS((word), 0, 8) << 2, 11)
+#define FIELD_S_s13(word)	sign_extend(BITS((word), 0, 10) << 2, 13)
+
+#define STATUS32_L		0x00000100
+#define REG_LIMM		62
+
+struct disasm_state {
+	/* generic info */
+	unsigned long words[2];
+	int instr_len;
+	int major_opcode;
+	/* info for branch/jump */
+	int is_branch;
+	int target;
+	int delay_slot;
+	enum flow flow;
+	/* info for load/store */
+	int src1, src2, src3, dest, wb_reg;
+	int zz, aa, x, pref, di;
+	int fault, write;
+};
+
+static inline int sign_extend(int value, int bits)
+{
+	if (IS_BIT(value, (bits - 1)))
+		value |= (0xffffffff << bits);
+
+	return value;
+}
+
+static inline int is_short_instr(unsigned long addr)
+{
+	uint16_t word = *((uint16_t *)addr);
+	int opcode = (word >> 11) & 0x1F;
+	return (opcode >= 0x0B);
+}
+
+void disasm_instr(unsigned long addr, struct disasm_state *state,
+	int userspace, struct pt_regs *regs, struct callee_regs *cregs);
+int disasm_next_pc(unsigned long pc, struct pt_regs *regs, struct callee_regs
+	*cregs, unsigned long *fall_thru, unsigned long *target);
+long get_reg(int reg, struct pt_regs *regs, struct callee_regs *cregs);
+void set_reg(int reg, long val, struct pt_regs *regs,
+		struct callee_regs *cregs);
+
+#endif	/* __ARC_DISASM_H__ */
arch/arc/kernel/Makefile +1 -1
index 86b159f..1fc0461 100644
@@ -9,7 +9,7 @@
 CFLAGS_ptrace.o		+= -DUTS_MACHINE='"$(UTS_MACHINE)"'
 
 obj-y	:= arcksyms.o setup.o irq.o time.o reset.o ptrace.o entry.o process.o \
-	   signal.o traps.o sys.o troubleshoot.o stacktrace.o
+	   signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.c
 
 obj-$(CONFIG_MODULES)			+= arcksyms.o module.o
 obj-$(CONFIG_ARC_DBG_EVENT_TIMELINE)	+= event-log.o
arch/arc/kernel/disasm.c new file +539 -0

539 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#24 lore raw

RFC PATCH 44/55 ARC: kprobes support

In reply to [email protected]

From: Vineet Gupta <[email protected]>

Origin port done by Rajeshwar Ranga <[email protected]>

---
 arch/arc/Kconfig               |    2 +
 arch/arc/include/asm/kprobes.h |   62 +++++
 arch/arc/kernel/Makefile       |    1 +
 arch/arc/kernel/disasm.c       |    5 +-
 arch/arc/kernel/kprobes.c      |  525 ++++++++++++++++++++++++++++++++++++++++
 arch/arc/kernel/traps.c        |   13 +
 6 files changed, 605 insertions(+), 3 deletions(-)
 create mode 100644 arch/arc/include/asm/kprobes.h
 create mode 100644 arch/arc/kernel/kprobes.c
arch/arc/Kconfig +2 -0
index 26609d6..3ef21be 100644
@@ -22,6 +22,8 @@ config ARC
 	select GENERIC_SMP_IDLE_THREAD
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_GENERIC_HARDIRQS
+	select HAVE_KPROBES
+	select HAVE_KRETPROBES
 	select HAVE_MOD_ARCH_SPECIFIC if ARC_DW2_UNWIND
 	select HAVE_OPROFILE
 	select HOTPLUG if !INITRAMFS_SOURCE=""
arch/arc/include/asm/kprobes.h new file +62 -0

62 lines not on this page · raw message

arch/arc/kernel/Makefile +1 -0
index 1fc0461..442d024 100644
@@ -15,6 +15,7 @@ obj-$(CONFIG_MODULES)			+= arcksyms.o module.o
 obj-$(CONFIG_ARC_DBG_EVENT_TIMELINE)	+= event-log.o
 obj-$(CONFIG_SMP) 			+= smp.o
 obj-$(CONFIG_ARC_DW2_UNWIND)		+= unwind.o
+obj-$(CONFIG_KPROBES)      		+= kprobes.o
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)	+= fpu.o
 CFLAGS_fpu.o   += -mdpfp
 
arch/arc/kernel/disasm.c +2 -3
index 254d11a..51bad8f 100644
@@ -497,9 +497,8 @@ void __kprobes set_reg(int reg, long val, struct pt_regs *regs,
  * @pc +2/4/6 (ARCompact ISA allows free intermixing of 16/32 bit insns).
  *
  * If @pc is a branch
- * 	-@tgt_if_br is set to branch target.
- * 	-If branch has delay slot, @next_pc updated with actual next PC.
- *
+ *	-@tgt_if_br is set to branch target.
+ *	-If branch has delay slot, @next_pc updated with actual next PC.
  */
 int __kprobes disasm_next_pc(unsigned long pc, struct pt_regs *regs,
 			     struct callee_regs *cregs,
arch/arc/kernel/kprobes.c new file +525 -0

525 lines not on this page · raw message

arch/arc/kernel/traps.c +13 -0
index fd2457c..c6396b4 100644
@@ -15,6 +15,7 @@
 #include <linux/uaccess.h>
 #include <asm/ptrace.h>
 #include <asm/setup.h>
+#include <asm/kprobes.h>
 
 void __init trap_init(void)
 {
@@ -90,6 +91,7 @@ void do_machine_check_fault(unsigned long cause, unsigned long address,
 	die("Machine Check Exception", regs, address, cause);
 }
 
+
 /*
  * Entry point for traps induced by ARCompact TRAP_S <n> insn
  * This is same family as TRAP0/SWI insn (use the same vector).
@@ -109,6 +111,10 @@ void do_non_swi_trap(unsigned long cause, unsigned long address,
 		trap_is_brkpt(cause, address, regs);
 		break;
 
+	case 2:
+		trap_is_kprobe(param, address, regs);
+		break;
+
 	default:
 		break;
 	}
@@ -116,10 +122,17 @@ void do_non_swi_trap(unsigned long cause, unsigned long address,
 
 /*
  * Entry point for Instruction Error Exception
+ *  -For a corner case, ARC kprobes implementation resorts to using
+ *   this exception, hence the check
  */
 void do_insterror_or_kprobe(unsigned long cause,
 				       unsigned long address,
 				       struct pt_regs *regs)
 {
+	/* Check if this exception is caused by kprobes */
+	if (notify_die(DIE_IERR, "kprobe_ierr", regs, address,
+		       cause, SIGILL) == NOTIFY_STOP)
+		return;
+
 	insterror_is_error(cause, address, regs);
 }
Signature · 1 line
1.7.4.1
#25 lore raw

RFC PATCH 45/55 ARC: unaligned access emulation

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/Kconfig                 |    9 ++
 arch/arc/include/asm/Kbuild      |    1 -
 arch/arc/include/asm/ptrace.h    |    3 +
 arch/arc/include/asm/unaligned.h |   29 +++++
 arch/arc/kernel/Makefile         |    3 +-
 arch/arc/kernel/disasm.c         |    2 +-
 arch/arc/kernel/entry.S          |   13 ++
 arch/arc/kernel/traps.c          |   26 +++++
 arch/arc/kernel/unaligned.c      |  225 ++++++++++++++++++++++++++++++++++++++
 9 files changed, 308 insertions(+), 3 deletions(-)
 create mode 100644 arch/arc/include/asm/unaligned.h
 create mode 100644 arch/arc/kernel/unaligned.c
arch/arc/Kconfig +9 -0
index 3ef21be..81d78fc 100644
@@ -343,6 +343,15 @@ config ARC_CURR_IN_REG
 	  This reserved Register R25 to point to Current Task in
 	  kernel mode. This saves memory access for each such access
 
+
+config ARC_MISALIGN_ACCESS
+	bool "Emulate unaligned memory access (userspace only)"
+	default N
+	help
+	  This enables misaligned 16 & 32 bit memory access from user space.
+	  Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide
+	  potential bugs in code
+
 config ARC_STACK_NONEXEC
 	bool "Make stack non-executable"
 	default n
arch/arc/include/asm/Kbuild +0 -1
index a246390..06ca702 100644
@@ -51,7 +51,6 @@ generic-y += termios.h
 generic-y += topology.h
 generic-y += types.h
 generic-y += ucontext.h
-generic-y += unaligned.h
 generic-y += user.h
 generic-y += vga.h
 generic-y += xor.h
arch/arc/include/asm/ptrace.h +3 -0
index bb621e8..2843dd4 100644
@@ -117,6 +117,9 @@ struct user_regs_struct {
 /* return 1 if user mode or 0 if kernel mode */
 #define user_mode(regs) (regs->status32 & STATUS_U_MASK)
 
+/* return 1 if PC in delay slot */
+#define delay_mode(regs) ((regs->status32 & STATUS_DE_MASK) == STATUS_DE_MASK)
+
 /* return 1 if in syscall, 0 if Intr or Exception */
 #define in_syscall(regs) (((regs->orig_r8) >= 0 && \
 			   (regs->orig_r8 <= NR_syscalls)) ? 1 : 0)
arch/arc/include/asm/unaligned.h new file +29 -0
new file mode 100644
index 0000000..5dbe63f
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_ARC_UNALIGNED_H
+#define _ASM_ARC_UNALIGNED_H
+
+/* ARC700 can't handle unaligned Data accesses. */
+
+#include <asm-generic/unaligned.h>
+#include <asm/ptrace.h>
+
+#ifdef CONFIG_ARC_MISALIGN_ACCESS
+int misaligned_fixup(unsigned long address, struct pt_regs *regs,
+		     unsigned long cause, struct callee_regs *cregs);
+#else
+static inline int
+misaligned_fixup(unsigned long address, struct pt_regs *regs,
+		 unsigned long cause, struct callee_regs *cregs)
+{
+	return 0;
+}
+#endif
+
+#endif /* _ASM_ARC_UNALIGNED_H */
arch/arc/kernel/Makefile +2 -1
index 442d024..52ef6ce 100644
@@ -9,13 +9,14 @@
 CFLAGS_ptrace.o		+= -DUTS_MACHINE='"$(UTS_MACHINE)"'
 
 obj-y	:= arcksyms.o setup.o irq.o time.o reset.o ptrace.o entry.o process.o \
-	   signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.c
+	   signal.o traps.o sys.o troubleshoot.o stacktrace.o disasm.o
 
 obj-$(CONFIG_MODULES)			+= arcksyms.o module.o
 obj-$(CONFIG_ARC_DBG_EVENT_TIMELINE)	+= event-log.o
 obj-$(CONFIG_SMP) 			+= smp.o
 obj-$(CONFIG_ARC_DW2_UNWIND)		+= unwind.o
 obj-$(CONFIG_KPROBES)      		+= kprobes.o
+obj-$(CONFIG_ARC_MISALIGN_ACCESS) 	+= unaligned.o
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)	+= fpu.o
 CFLAGS_fpu.o   += -mdpfp
 
arch/arc/kernel/disasm.c +1 -1
index 51bad8f..2f39028 100644
@@ -15,7 +15,7 @@
 #include <asm/disasm.h>
 #include <asm/uaccess.h>
 
-#if defined(CONFIG_KGDB) || defined(CONFIG_MISALIGN_ACCESS) || \
+#if defined(CONFIG_KGDB) || defined(CONFIG_ARC_MISALIGN_ACCESS) || \
 	defined(CONFIG_KPROBES)
 
 /* disasm_instr: Analyses instruction at addr, stores
arch/arc/kernel/entry.S +13 -0
index 13d6feb..2ff15e0 100644
@@ -12,6 +12,9 @@
  *   needed before task_pt_regs was invented. This saves a branch per call
  *   and more importantly allows clean invocation of post-syscall ptrace hook
  *
+ * vineetg: May 2011
+ *  -Userspace unaligned access emulation
+ *
  * vineetg: Feb 2011 (ptrace low level code fixes)
  *  -traced syscall return code (r0) was not saved into pt_regs for restoring
  *   into user reg-file when traded task rets to user space.
@@ -404,7 +407,17 @@ ARC_ENTRY EV_TLBProtV
 	mov r1, r4              ; faulting address
 	mov r2, sp              ; pt_regs
 
+#ifdef  CONFIG_ARC_MISALIGN_ACCESS
+	SAVE_CALLEE_SAVED_USER
+	mov r3, sp              ; callee_regs
+#endif
+
 	bl  do_misaligned_access
+
+#ifdef  CONFIG_ARC_MISALIGN_ACCESS
+	DISCARD_CALLEE_SAVED_USER
+#endif
+
 	b   ret_from_exception
 
 ARC_EXIT EV_TLBProtV
arch/arc/kernel/traps.c +26 -0
index c6396b4..d2bc5bd 100644
@@ -7,6 +7,9 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  *
+ * vineetg: May 2011
+ *  -user-space unaligned access emulation
+ *
  * Rahul Trivedi: Codito Technologies 2004
  */
 
@@ -16,6 +19,7 @@
 #include <asm/ptrace.h>
 #include <asm/setup.h>
 #include <asm/kprobes.h>
+#include <asm/unaligned.h>
 
 void __init trap_init(void)
 {
@@ -79,7 +83,29 @@ DO_ERROR_INFO(SIGILL, "Illegal Insn (or Seq)", insterror_is_error, ILL_ILLOPC)
 DO_ERROR_INFO(SIGBUS, "Invalid Mem Access", do_memory_error, BUS_ADRERR)
 DO_ERROR_INFO(SIGTRAP, "Breakpoint Set", trap_is_brkpt, TRAP_BRKPT)
 
+#ifdef CONFIG_ARC_MISALIGN_ACCESS
+/*
+ * Entry Point for Misaligned Data access Exception, for emulating in software
+ */
+int do_misaligned_access(unsigned long cause, unsigned long address,
+			 struct pt_regs *regs, struct callee_regs *cregs)
+{
+	if (misaligned_fixup(address, regs, cause, cregs) != 0) {
+		siginfo_t info;
+
+		info.si_signo = SIGSEGV;
+		info.si_errno = 0;
+		info.si_code = SEGV_ACCERR;
+		info.si_addr = (void __user *)address;
+		return handle_exception(cause, "Misaligned Access", regs,
+					  &info);
+	}
+	return 0;
+}
+
+#else
 DO_ERROR_INFO(SIGSEGV, "Misaligned Access", do_misaligned_access, SEGV_ACCERR)
+#endif
 
 /*
  * Entry point for miscll errors such as Nested Exceptions
arch/arc/kernel/unaligned.c new file +225 -0

225 lines not on this page · raw message

Signature · 1 line
1.7.4.1
maintainer
#26 lore raw

Re: [RFC Patch v1 45/55] ARC: unaligned access emulation

arch/arc/Kconfig config ARC_CURR_IN_REG · line 353

Quoted 8 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/Kconfig +8 -0
+
+config ARC_MISALIGN_ACCESS
+       bool "Emulate unaligned memory access (userspace only)"
+       default N
+       help
+         This enables misaligned 16 & 32 bit memory access from user space.
+         Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide
+         potential bugs in code

parisc and ia64 both have the same feature, and they use sysctl to configure it at run-time. Maybe you should pick one of the two sysctl implementations and hook that up to your implementation as well.

Arnd

#27 lore raw

Re: [RFC Patch v1 45/55] ARC: unaligned access emulation

Quoted 13 lines · Arnd Bergmann

arch/arc/Kconfig config ARC_CURR_IN_REG · line 353

Quoted 8 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/Kconfig +8 -0
+
+config ARC_MISALIGN_ACCESS
+       bool "Emulate unaligned memory access (userspace only)"
+       default N
+       help
+         This enables misaligned 16 & 32 bit memory access from user space.
+         Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide
+         potential bugs in code

parisc and ia64 both have the same feature, and they use sysctl to configure it at run-time. Maybe you should pick one of the two sysctl implementations and hook that up to your implementation as well.

Sounds like a good idea.

Looking at your suggestion, the sysctl interface in both of those is for slightly different semantics and ARC would possibly need a bit from both. So to avoid duplication, I'm proposing following changes to kernel/sysctl.c and the generic options selected by respective arches.

* no_unaligned_warning:CONFIG_IA64 => CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN *unaligned_enabled: __hppa__ => CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW

If you can think of better(smaller) names, please do let me know :-)

If we agree in principle, I'll cookup the patches and seek the ACKs from ARCH maintainers (assuming my CC list above is right). And to keep things simple, we can route the kernel/sysctl.c changes via the ARC submission tree.

Thx,
Vineet

#28 lore raw

Re: [RFC Patch v1 45/55] ARC: unaligned access emulation

Quoted 27 lines · Vineet Gupta
Quoted 13 lines · Arnd Bergmann

arch/arc/Kconfig config ARC_CURR_IN_REG · line 353

Quoted 8 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/Kconfig +8 -0
+
+config ARC_MISALIGN_ACCESS
+       bool "Emulate unaligned memory access (userspace only)"
+       default N
+       help
+         This enables misaligned 16 & 32 bit memory access from user space.
+         Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide
+         potential bugs in code

parisc and ia64 both have the same feature, and they use sysctl to configure it at run-time. Maybe you should pick one of the two sysctl implementations and hook that up to your implementation as well.

Sounds like a good idea.

Looking at your suggestion, the sysctl interface in both of those is for slightly different semantics and ARC would possibly need a bit from both. So to avoid duplication, I'm proposing following changes to kernel/sysctl.c and the generic options selected by respective arches.

* no_unaligned_warning:CONFIG_IA64 => CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN *unaligned_enabled: __hppa__ => CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW

If you can think of better(smaller) names, please do let me know :-)

Quoted 8 lines

If we agree in principle, I'll cookup the patches and seek the ACKs from ARCH maintainers (assuming my CC list above is right). And to keep things simple, we can route the kernel/sysctl.c changes via the ARC submission tree.

Thx,
Vineet

Sorry for a naive patch submitter question (yes I've already read SubmittingPatches and googled much already). A lot of times, I see the "Cc: ..." lines, just below the "Signed-off-by:" lines in the patch - e.g. https://lkml.org/lkml/2012/10/4/318
Are those added manually - because none of the xxx-cc options to format-patch or send-email seem to be doing that - unless I missed some.

Context: I have the patch which touches ia64/parisc which I want to send out and at the same time have those "Cc: lines for the maintainers too"

Thx,
-Vineet

* It's OK to "look" fool once - rather than actually "being" a fool rest of your life !

#29 lore raw

Re: [RFC Patch v1 45/55] ARC: unaligned access emulation

Quoted 9 lines · Vineet Gupta

Sorry for a naive patch submitter question (yes I've already read SubmittingPatches and googled much already). A lot of times, I see the "Cc: ..." lines, just below the "Signed-off-by:" lines in the patch - e.g. https://lkml.org/lkml/2012/10/4/318
Are those added manually - because none of the xxx-cc options to format-patch or send-email seem to be doing that - unless I missed some.

Context: I have the patch which touches ia64/parisc which I want to send out and at the same time have those "Cc: lines for the maintainers too"

I add them manually, either while committing, or by editing the patch after running "git format-patch".

"git send-email" will pick them up and add the appropriate CCs when sending out the emails.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#30 lore raw

PATCH 1/1 sysctl: some arch specific unaligned access knobs made generic

In reply to Vineet Gupta

From: Vineet Gupta <[email protected]>

This came out ARC Port's review by Arnd where he suggested using the existing sysctl knobs in parisc and/or ia64 for runtime controlling unaligned access emulation.

Turns out that ARC port needs bit of both.

The two common sysctl knobs are now #ifdef based on init/Kconfig options which the corresponding arches now select in their Kconfigs. No other arch code is touched.

P.S. I've deliberately NOT added the new items at the end of arch/*/Kconfig, to avoid any merge conflicts going further - anyhow both the ia64/parisc Kconfigs are not sorted either.

Vineet Gupta (1):
sysctl: convert arch specific unaligned access regulators to generic
ones

 arch/ia64/Kconfig   |    1 +
 arch/parisc/Kconfig |    1 +
 init/Kconfig        |   16 ++++++++++++++++
 kernel/sysctl.c     |   16 +++++++++++++---
 4 files changed, 31 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.4.1
#31 lore raw

PATCH 1/1 sysctl: convert arch specific unaligned access regulators to generic ones

From: Vineet Gupta <[email protected]>

* parisc: /proc/sys/kernel/unaligned-trap => SYSCTL_ARCH_UNALIGN_ALLOW

* ia64: /proc/sys/kernel/ignore-unaligned-usertrap => SYSCTL_ARCH_UNALIGN_NO_WARN

This allows other architectures, specifically ARC to reuse these sysctl knobs.

Cc Tony Luck <[email protected]>
Cc Fenghua Yu <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Eric W. Biederman" <[email protected]>
Cc Serge Hallyn <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc "Paul E. McKenney" <[email protected]>
---
 arch/ia64/Kconfig   |    1 +
 arch/parisc/Kconfig |    1 +
 init/Kconfig        |   16 ++++++++++++++++
 kernel/sysctl.c     |   16 +++++++++++++---
 4 files changed, 31 insertions(+), 3 deletions(-)
arch/ia64/Kconfig +1 -0
index 3279646..5fb1064 100644
@@ -40,6 +40,7 @@ config IA64
 	select ARCH_THREAD_INFO_ALLOCATOR
 	select ARCH_CLOCKSOURCE_DATA
 	select GENERIC_TIME_VSYSCALL_OLD
+	select SYSCTL_ARCH_UNALIGN_NO_WARN
 	select HAVE_MOD_ARCH_SPECIFIC
 	select MODULES_USE_ELF_RELA
 	default y
arch/parisc/Kconfig +1 -0
index 11def45..7d9de54 100644
@@ -20,6 +20,7 @@ config PARISC
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_STRNCPY_FROM_USER
+	select SYSCTL_ARCH_UNALIGN_ALLOW
 	select HAVE_MOD_ARCH_SPECIFIC
 	select MODULES_USE_ELF_RELA
 
init/Kconfig +16 -0
index 6fdd6e3..de4b184 100644
@@ -1169,6 +1169,22 @@ config SYSCTL_EXCEPTION_TRACE
 	help
 	  Enable support for /proc/sys/debug/exception-trace.
 
+config SYSCTL_ARCH_UNALIGN_NO_WARN
+	bool
+	help
+	  Enable support for /proc/sys/kernel/ignore-unaligned-usertrap
+	  Allows arch to define/use @no_unaligned_warning to possbly warn about
+	  unaligned access emulation going on under the hood.
+	  see arch/ia64/kernel/unaligned.c for reference
+
+config SYSCTL_ARCH_UNALIGN_ALLOW
+	bool
+	help
+	  Enable support for /proc/sys/kernel/unaligned-trap
+	  Allows arches to define/use @unaligned_enabled to runtime toggle
+	  the unaligned access emulation.
+	  see arch/parisc/kernel/unaligned.c for reference
+
 config KALLSYMS
 	 bool "Load all symbols for debugging/ksymoops" if EXPERT
 	 default y
kernel/sysctl.c +13 -3
index 26f65ea..9c618bf 100644
@@ -157,14 +157,20 @@ extern int sysctl_tsb_ratio;
 
 #ifdef __hppa__
 extern int pwrsw_enabled;
-extern int unaligned_enabled;
 #endif
 
 #ifdef CONFIG_IA64
-extern int no_unaligned_warning;
 extern int unaligned_dump_stack;
 #endif
 
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
+extern int unaligned_enabled;
+#endif
+
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
+extern int no_unaligned_warning;
+#endif
+
 #ifdef CONFIG_PROC_SYSCTL
 static int proc_do_cad_pid(struct ctl_table *table, int write,
 		  void __user *buffer, size_t *lenp, loff_t *ppos);
@@ -504,6 +510,8 @@ static struct ctl_table kern_table[] = {
 	 	.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+#endif
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
 	{
 		.procname	= "unaligned-trap",
 		.data		= &unaligned_enabled,
@@ -870,7 +878,7 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= proc_doulongvec_minmax,
 	},
 #endif
-#ifdef CONFIG_IA64
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
 	{
 		.procname	= "ignore-unaligned-usertrap",
 		.data		= &no_unaligned_warning,
@@ -878,6 +886,8 @@ static struct ctl_table kern_table[] = {
 	 	.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+#endif
+#ifdef CONFIG_IA64
 	{
 		.procname	= "unaligned-dump-stack",
 		.data		= &unaligned_dump_stack,
Signature · 1 line
1.7.4.1
#32 lore raw

PATCH RESEND 1/1 Convert IA64 sysctl to generic

In reply to Vineet Gupta

Hi,

This came out ARC Port's review by Arnd where he suggested using the existing sysctl knobs in parisc and/or ia64 for runtime controlling unaligned access emulation.

Turns out that ARC port needs bit of both.

The common sysctl knobs are now #ifdef based on init/Kconfig options which the corresponding arches now select in their Kconfigs.
No other arch code is touched (although code has not been compile tested).

If this patch is ACKable, I would request you to please take this patch via your arch tree - to avoid any merge-hassles and other interdependencies later.

P.S. I've deliberately NOT added the new items at the end of arch/*/Kconfig, to avoid any merge conflicts going further - anyhow both the ia64/parisc Kconfigs are not sorted either.

Thx,
-Vineet

Vineet Gupta (1):
sysctl: Enable IA64 "ignore-unaligned-usertrap" to be used cross-arch

 arch/ia64/Kconfig |    1 +
 init/Kconfig      |    8 ++++++++
 kernel/sysctl.c   |    9 +++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.4.1
#33 lore raw

PATCH RESEND 1/1 sysctl: Enable IA64 "ignore-unaligned-usertrap" to be used cross-arch

IA64 defines /proc/sys/kernel/ignore-unaligned-usertrap to control verbosw warnings on unaligned access emaultion.

While the exact menchaincs (ignore/shout) are still arch specific, we can make the sysctl usable by other arches.

Cc Tony Luck <[email protected]>
Cc Fenghua Yu <[email protected]>
Cc "Eric W. Biederman" <[email protected]>
Cc Serge Hallyn <[email protected]>
---
 arch/ia64/Kconfig |    1 +
 init/Kconfig      |    8 ++++++++
 kernel/sysctl.c   |    9 +++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)
arch/ia64/Kconfig +1 -0
index 3279646..5fb1064 100644
@@ -40,6 +40,7 @@ config IA64
 	select ARCH_THREAD_INFO_ALLOCATOR
 	select ARCH_CLOCKSOURCE_DATA
 	select GENERIC_TIME_VSYSCALL_OLD
+	select SYSCTL_ARCH_UNALIGN_NO_WARN
 	select HAVE_MOD_ARCH_SPECIFIC
 	select MODULES_USE_ELF_RELA
 	default y
init/Kconfig +8 -0
index 7d30240..e188f9f 100644
@@ -1232,6 +1232,14 @@ config SYSCTL_EXCEPTION_TRACE
 	help
 	  Enable support for /proc/sys/debug/exception-trace.
 
+config SYSCTL_ARCH_UNALIGN_NO_WARN
+	bool
+	help
+	  Enable support for /proc/sys/kernel/ignore-unaligned-usertrap
+	  Allows arch to define/use @no_unaligned_warning to possbly warn about
+	  unaligned access emulation going on under the hood.
+	  see arch/ia64/kernel/unaligned.c for reference
+
 config KALLSYMS
 	 bool "Load all symbols for debugging/ksymoops" if EXPERT
 	 default y
kernel/sysctl.c +7 -2
index c88878d..840fd5e 100644
@@ -161,10 +161,13 @@ extern int unaligned_enabled;
 #endif
 
 #ifdef CONFIG_IA64
-extern int no_unaligned_warning;
 extern int unaligned_dump_stack;
 #endif
 
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
+extern int no_unaligned_warning;
+#endif
+
 #ifdef CONFIG_PROC_SYSCTL
 static int proc_do_cad_pid(struct ctl_table *table, int write,
 		  void __user *buffer, size_t *lenp, loff_t *ppos);
@@ -911,7 +914,7 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= proc_doulongvec_minmax,
 	},
 #endif
-#ifdef CONFIG_IA64
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
 	{
 		.procname	= "ignore-unaligned-usertrap",
 		.data		= &no_unaligned_warning,
@@ -919,6 +922,8 @@ static struct ctl_table kern_table[] = {
 	 	.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+#endif
+#ifdef CONFIG_IA64
 	{
 		.procname	= "unaligned-dump-stack",
 		.data		= &unaligned_dump_stack,
Signature · 1 line
1.7.4.1
#34 lore raw

Re: [RESEND PATCH] sysctl: Enable IA64 "ignore-unaligned-usertrap" to be used cross-arch

Quoted 1 line · Vineet Gupta

verbosw warnings on unaligned access emaultion.

"verbose", "emulation"

Quoted 1 line

While the exact menchaincs (ignore/shout) are still arch specific, we

"mechanics"

init/Kconfig config SYSCTL_EXCEPTION_TRACE · line 1239

Quoted 5 lines
init/Kconfig +5 -0
+config SYSCTL_ARCH_UNALIGN_NO_WARN
+       bool
+       help
+         Enable support for /proc/sys/kernel/ignore-unaligned-usertrap
+         Allows arch to define/use @no_unaligned_warning to possbly warn about

"possibly"

init/Kconfig config SYSCTL_EXCEPTION_TRACE · line 1241

Quoted 2 lines
init/Kconfig +2 -0
+         unaligned access emulation going on under the hood.
+         see arch/ia64/kernel/unaligned.c for reference

It doesn't seem right to point users at an ia64 specific file now that you are making this available to all arches.

-Tony

#35 lore raw

Re: [RESEND PATCH] sysctl: Enable IA64 "ignore-unaligned-usertrap" to be used cross-arch

Quoted 9 lines · Tony Luck

init/Kconfig config SYSCTL_EXCEPTION_TRACE · line 1239

Quoted 5 lines · Vineet Gupta
init/Kconfig +5 -0
+config SYSCTL_ARCH_UNALIGN_NO_WARN
+       bool
+       help
+         Enable support for /proc/sys/kernel/ignore-unaligned-usertrap
+         Allows arch to define/use @no_unaligned_warning to possbly warn about
Quoted 5 lines

"possibly"

init/Kconfig config SYSCTL_EXCEPTION_TRACE · line 1241

Quoted 2 lines
init/Kconfig +2 -0
+         unaligned access emulation going on under the hood.
+         see arch/ia64/kernel/unaligned.c for reference

It doesn't seem right to point users at an ia64 specific file now that you are making this available to all arches.

The ia64 "reference" is for how the sysctl knob is used - since all we are doing is moving just the sysctl out of #ifdef ARCH_XYZ.
At any rate, I've removed the line from help. Revised patch to follow. And as initially requested this will need to go thru IA64-next tree to avoid any merge dependencies.

TIA,
-Vineet

#36 lore raw

PATCH v2 1/1 sysctl: Enable IA64 "ignore-unaligned-usertrap" to be used cross-arch

IA64 defines /proc/sys/kernel/ignore-unaligned-usertrap to control verbose warnings on unaligned access emulation.

The exact mechanics of what to do with sysctl (ignore/shout) are arch specific, this change enables the sysctl to be usable cross-arch.

---
 arch/ia64/Kconfig |    1 +
 init/Kconfig      |    7 +++++++
 kernel/sysctl.c   |    9 +++++++--
 3 files changed, 15 insertions(+), 2 deletions(-)
arch/ia64/Kconfig +1 -0
index 3279646..5fb1064 100644
@@ -40,6 +40,7 @@ config IA64
 	select ARCH_THREAD_INFO_ALLOCATOR
 	select ARCH_CLOCKSOURCE_DATA
 	select GENERIC_TIME_VSYSCALL_OLD
+	select SYSCTL_ARCH_UNALIGN_NO_WARN
 	select HAVE_MOD_ARCH_SPECIFIC
 	select MODULES_USE_ELF_RELA
 	default y
init/Kconfig +7 -0
index 7d30240..523bee1 100644
@@ -1232,6 +1232,13 @@ config SYSCTL_EXCEPTION_TRACE
 	help
 	  Enable support for /proc/sys/debug/exception-trace.
 
+config SYSCTL_ARCH_UNALIGN_NO_WARN
+	bool
+	help
+	  Enable support for /proc/sys/kernel/ignore-unaligned-usertrap
+	  Allows arch to define/use @no_unaligned_warning to possibly warn
+	  about unaligned access emulation going on under the hood.
+
 config KALLSYMS
 	 bool "Load all symbols for debugging/ksymoops" if EXPERT
 	 default y
kernel/sysctl.c +7 -2
index c88878d..840fd5e 100644
@@ -161,10 +161,13 @@ extern int unaligned_enabled;
 #endif
 
 #ifdef CONFIG_IA64
-extern int no_unaligned_warning;
 extern int unaligned_dump_stack;
 #endif
 
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
+extern int no_unaligned_warning;
+#endif
+
 #ifdef CONFIG_PROC_SYSCTL
 static int proc_do_cad_pid(struct ctl_table *table, int write,
 		  void __user *buffer, size_t *lenp, loff_t *ppos);
@@ -911,7 +914,7 @@ static struct ctl_table kern_table[] = {
 		.proc_handler	= proc_doulongvec_minmax,
 	},
 #endif
-#ifdef CONFIG_IA64
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
 	{
 		.procname	= "ignore-unaligned-usertrap",
 		.data		= &no_unaligned_warning,
@@ -919,6 +922,8 @@ static struct ctl_table kern_table[] = {
 	 	.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+#endif
+#ifdef CONFIG_IA64
 	{
 		.procname	= "unaligned-dump-stack",
 		.data		= &unaligned_dump_stack,
Signature · 1 line
1.7.4.1
#37 lore raw

Re: [PATCH v2] sysctl: Enable IA64 "ignore-unaligned-usertrap" to be used cross-arch

Ok. Queued for 3.9 merge window. It should show up in linux-next in the next day or two. We'll see if anyone complains about the name SYSCTL_ARCH_UNALIGN_NO_WARN (every time I touch the Kconfig bits it seems that there is some other, better way that we do this now).

-Tony

#38 lore raw

Re: [PATCH v2] sysctl: Enable IA64 "ignore-unaligned-usertrap" to be used cross-arch

Quoted 5 lines · Tony Luck

Ok. Queued for 3.9 merge window. It should show up in linux-next in the next day or two. We'll see if anyone complains about the name SYSCTL_ARCH_UNALIGN_NO_WARN (every time I touch the Kconfig bits it seems that there is some other, better way that we do this now).

The other semi-sane way I could see to do this would be to break the code out of kernel/sysctl.c into it's own sysctl table and have the arches that want this sysctl just register it themselves.

Shrug. It probably isn't worth the effor right now.

Eric

#39 lore raw

Re: [PATCH v2] sysctl: Enable IA64 "ignore-unaligned-usertrap" to be used cross-arch

In reply to Tony Luck
Quoted 6 lines · Tony Luck

Ok. Queued for 3.9 merge window. It should show up in linux-next in the next day or two. We'll see if anyone complains about the name SYSCTL_ARCH_UNALIGN_NO_WARN (every time I touch the Kconfig bits it seems that there is some other, better way that we do this now).

-Tony

Thanks a bunch.
-Vineet

#40 lore raw

PATCH RESEND 1/1 Convert PARISC sysctl to be generic

In reply to Vineet Gupta

Hi,

This came out ARC Port's review by Arnd where he suggested using the existing sysctl knobs in parisc and/or ia64 for runtime controlling unaligned access emulation.

Turns out that ARC port needs bit of both.

The common sysctl knobs are now #ifdef based on init/Kconfig options which the corresponding arches now select in their Kconfigs.
No other arch code is touched (although code has not been compile tested).

If this patch is ACKable, I would request you to please take this patch via your arch tree - to avoid any merge-hassles and other interdependencies later.

P.S. I've deliberately NOT added the new items at the end of arch/*/Kconfig, to avoid any merge conflicts going further - anyhow both the ia64/parisc Kconfigs are not sorted either.

Thx,
-Vineet

Vineet Gupta (1):
sysctl: Enable PARISC "unaligned-trap" to be used cross-arch

 arch/parisc/Kconfig |    1 +
 init/Kconfig        |    8 ++++++++
 kernel/sysctl.c     |    7 ++++++-
 3 files changed, 15 insertions(+), 1 deletions(-)
Signature · 1 line
1.7.4.1
#41 lore raw

PATCH RESEND 1/1 sysctl: Enable PARISC "unaligned-trap" to be used cross-arch

PARISC defines /proc/sys/kernel/unaligned-trap to runtime toggle unaligned access emulation.

The exact mechanics of enablig/disabling are still arch specific, we can make the sysctl usable by other arches.

Cc "James E.J. Bottomley" <[email protected]>
Cc Helge Deller <[email protected]>
Cc "Eric W. Biederman" <[email protected]>
Cc Serge Hallyn <[email protected]>
---
 arch/parisc/Kconfig |    1 +
 init/Kconfig        |    8 ++++++++
 kernel/sysctl.c     |    7 ++++++-
 3 files changed, 15 insertions(+), 1 deletions(-)
arch/parisc/Kconfig +1 -0
index b77feff..8c76095 100644
@@ -20,6 +20,7 @@ config PARISC
 	select ARCH_HAVE_NMI_SAFE_CMPXCHG
 	select GENERIC_SMP_IDLE_THREAD
 	select GENERIC_STRNCPY_FROM_USER
+	select SYSCTL_ARCH_UNALIGN_ALLOW
 	select HAVE_MOD_ARCH_SPECIFIC
 	select MODULES_USE_ELF_RELA
 	select CLONE_BACKWARDS
init/Kconfig +8 -0
index e188f9f..e64bb18 100644
@@ -1240,6 +1240,14 @@ config SYSCTL_ARCH_UNALIGN_NO_WARN
 	  unaligned access emulation going on under the hood.
 	  see arch/ia64/kernel/unaligned.c for reference
 
+config SYSCTL_ARCH_UNALIGN_ALLOW
+	bool
+	help
+	  Enable support for /proc/sys/kernel/unaligned-trap
+	  Allows arches to define/use @unaligned_enabled to runtime toggle
+	  the unaligned access emulation.
+	  see arch/parisc/kernel/unaligned.c for reference
+
 config KALLSYMS
 	 bool "Load all symbols for debugging/ksymoops" if EXPERT
 	 default y
kernel/sysctl.c +6 -1
index 840fd5e..c4cd655 100644
@@ -157,13 +157,16 @@ extern int sysctl_tsb_ratio;
 
 #ifdef __hppa__
 extern int pwrsw_enabled;
-extern int unaligned_enabled;
 #endif
 
 #ifdef CONFIG_IA64
 extern int unaligned_dump_stack;
 #endif
 
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
+extern int unaligned_enabled;
+#endif
+
 #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
 extern int no_unaligned_warning;
 #endif
@@ -548,6 +551,8 @@ static struct ctl_table kern_table[] = {
 	 	.mode		= 0644,
 		.proc_handler	= proc_dointvec,
 	},
+#endif
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
 	{
 		.procname	= "unaligned-trap",
 		.data		= &unaligned_enabled,
Signature · 1 line
1.7.4.1
maintainer Acked-by on v1 1/1
#42 lore raw

Re: [RESEND PATCH] sysctl: Enable PARISC "unaligned-trap" to be used cross-arch

Quoted 11 lines · Vineet Gupta

PARISC defines /proc/sys/kernel/unaligned-trap to runtime toggle unaligned access emulation.

The exact mechanics of enablig/disabling are still arch specific, we can make the sysctl usable by other arches.

Cc "James E.J. Bottomley"<[email protected]>
Cc Helge Deller<[email protected]>
Cc "Eric W. Biederman"<[email protected]>
Cc Serge Hallyn<[email protected]>

Vineet, as discussed, please push it through the ARC architecture tree...

Helge

Quoted 68 lines
---
  arch/parisc/Kconfig |    1 +
  init/Kconfig        |    8 ++++++++
  kernel/sysctl.c     |    7 ++++++-
  3 files changed, 15 insertions(+), 1 deletions(-)
arch/parisc/Kconfig +1 -0
index b77feff..8c76095 100644
@@ -20,6 +20,7 @@ config PARISC
  	select ARCH_HAVE_NMI_SAFE_CMPXCHG
  	select GENERIC_SMP_IDLE_THREAD
  	select GENERIC_STRNCPY_FROM_USER
+	select SYSCTL_ARCH_UNALIGN_ALLOW
  	select HAVE_MOD_ARCH_SPECIFIC
  	select MODULES_USE_ELF_RELA
  	select CLONE_BACKWARDS
init/Kconfig +8 -0
index e188f9f..e64bb18 100644
@@ -1240,6 +1240,14 @@ config SYSCTL_ARCH_UNALIGN_NO_WARN
  	  unaligned access emulation going on under the hood.
  	  see arch/ia64/kernel/unaligned.c for reference
 
+config SYSCTL_ARCH_UNALIGN_ALLOW
+	bool
+	help
+	  Enable support for /proc/sys/kernel/unaligned-trap
+	  Allows arches to define/use @unaligned_enabled to runtime toggle
+	  the unaligned access emulation.
+	  see arch/parisc/kernel/unaligned.c for reference
+
  config KALLSYMS
  	 bool "Load all symbols for debugging/ksymoops" if EXPERT
  	 default y
kernel/sysctl.c +6 -1
index 840fd5e..c4cd655 100644
@@ -157,13 +157,16 @@ extern int sysctl_tsb_ratio;
 
  #ifdef __hppa__
  extern int pwrsw_enabled;
-extern int unaligned_enabled;
  #endif
 
  #ifdef CONFIG_IA64
  extern int unaligned_dump_stack;
  #endif
 
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
+extern int unaligned_enabled;
+#endif
+
  #ifdef CONFIG_SYSCTL_ARCH_UNALIGN_NO_WARN
  extern int no_unaligned_warning;
  #endif
@@ -548,6 +551,8 @@ static struct ctl_table kern_table[] = {
  	 	.mode		= 0644,
  		.proc_handler	= proc_dointvec,
  	},
+#endif
+#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
  	{
  		.procname	= "unaligned-trap",
  		.data		=&unaligned_enabled,
#43 lore raw

Re: [RFC Patch v1 45/55] ARC: unaligned access emulation

In reply to Arnd Bergmann
Quoted 13 lines · Arnd Bergmann

arch/arc/Kconfig config ARC_CURR_IN_REG · line 353

Quoted 8 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/Kconfig +8 -0
+
+config ARC_MISALIGN_ACCESS
+       bool "Emulate unaligned memory access (userspace only)"
+       default N
+       help
+         This enables misaligned 16 & 32 bit memory access from user space.
+         Use ONLY-IF-ABS-NECESSARY as it will be very slow and also can hide
+         potential bugs in code

parisc and ia64 both have the same feature, and they use sysctl to configure it at run-time. Maybe you should pick one of the two sysctl implementations and hook that up to your implementation as well.

Spoke too soon ! The only caveat to removing the Kconfig option is that it will pull-in unaligned emulation code as well as the dependent in-kernel disassembler unconditionally into the build.

Are you OK if we keep this support build time - provided that once it is build time enabled - we have the additional runtime sysctl based toggle-ability as you suggested.

Only one of our customers need this feature and this gives people reasons to moan about the kernel .text size and such.

Thanks,
Vineet

maintainer
#44 lore raw

Re: [RFC Patch v1 45/55] ARC: unaligned access emulation

Quoted 3 lines · Vineet Gupta

Are you OK if we keep this support build time - provided that once it is build time enabled - we have the additional runtime sysctl based toggle-ability as you suggested.

Yes, sounds good.

Quoted 2 lines

Only one of our customers need this feature and this gives people reasons to moan about the kernel .text size and such.

Ok.

Arnd

#45 lore raw

RFC PATCH 46/55 ARC: kgdb support

In reply to [email protected]

From: Mischa Jonker <[email protected]>

---
 arch/arc/Kconfig            |    5 +-
 arch/arc/include/asm/kgdb.h |   61 +++++++++++++
 arch/arc/kernel/Makefile    |    2 +
 arch/arc/kernel/kgdb.c      |  205 +++++++++++++++++++++++++++++++++++++++++++
 arch/arc/kernel/traps.c     |    6 ++
 5 files changed, 277 insertions(+), 2 deletions(-)
 create mode 100644 arch/arc/include/asm/kgdb.h
 create mode 100644 arch/arc/kernel/kgdb.c
arch/arc/Kconfig +3 -2
index 81d78fc..b878d3e 100644
@@ -20,6 +20,7 @@ config ARC
 	select GENERIC_KERNEL_THREAD
 	select GENERIC_PENDING_IRQ if SMP
 	select GENERIC_SMP_IDLE_THREAD
+	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_GENERIC_HARDIRQS
 	select HAVE_KPROBES
@@ -383,12 +384,12 @@ config ARC_DW2_UNWIND
 
 config ARC_DBG_TLB_PARANOIA
 	bool "Paranoia Checks in Low Level TLB Handlers"
-	depends on ARC_DBG && !SMP
+	depends on ARC_DBG
 	default n
 
 config ARC_DBG_EVENT_TIMELINE
 	bool "Low level event capture"
-	depends on ARC_DBG
+	depends on ARC_DBG && !SMP
 	default n
 	help
 	  Capture low level events: IRQ/Trap/Exception
arch/arc/include/asm/kgdb.h new file +61 -0

61 lines not on this page · raw message

arch/arc/kernel/Makefile +2 -0
index 52ef6ce..a2b7493 100644
@@ -17,6 +17,8 @@ obj-$(CONFIG_SMP) 			+= smp.o
 obj-$(CONFIG_ARC_DW2_UNWIND)		+= unwind.o
 obj-$(CONFIG_KPROBES)      		+= kprobes.o
 obj-$(CONFIG_ARC_MISALIGN_ACCESS) 	+= unaligned.o
+obj-$(CONFIG_KGDB)			+= kgdb.o
+
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)	+= fpu.o
 CFLAGS_fpu.o   += -mdpfp
 
arch/arc/kernel/kgdb.c new file +205 -0

205 lines not on this page · raw message

arch/arc/kernel/traps.c +6 -0
index d2bc5bd..689c3fb 100644
@@ -20,6 +20,7 @@
 #include <asm/setup.h>
 #include <asm/kprobes.h>
 #include <asm/unaligned.h>
+#include <asm/kgdb.h>
 
 void __init trap_init(void)
 {
@@ -141,6 +142,11 @@ void do_non_swi_trap(unsigned long cause, unsigned long address,
 		trap_is_kprobe(param, address, regs);
 		break;
 
+	case 3:
+	case 4:
+		kgdb_trap(regs, param);
+		break;
+
 	default:
 		break;
 	}
Signature · 1 line
1.7.4.1
#46 lore raw

RFC PATCH 47/55 ARC: startup #2: Verbose Boot reporting / feature verification

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/Makefile              |    2 +
 arch/arc/include/asm/arcregs.h |  122 ++++++++++++++++++++--
 arch/arc/include/asm/defines.h |   56 ++++++++++
 arch/arc/include/asm/setup.h   |   14 +++
 arch/arc/kernel/setup.c        |  223 +++++++++++++++++++++++++++++++++++++++-
 arch/arc/mm/cache_arc700.c     |   46 ++++++++
 arch/arc/mm/tlb.c              |   38 +++++++
 7 files changed, 490 insertions(+), 11 deletions(-)
 create mode 100644 arch/arc/include/asm/defines.h
arch/arc/Makefile +2 -0
index a86e284..3de315e 100644
@@ -20,6 +20,8 @@ export PLATFORM
 cflags-y	+= -Iarch/arc/plat-$(PLATFORM)/include
 cflags-y	+= -mA7 -fno-common -pipe -fno-builtin -D__linux__
 
+LINUXINCLUDE	+=  -include ${src}/arch/arc/include/asm/defines.h
+
 ifdef CONFIG_ARC_CURR_IN_REG
 # For a global register defintion, make sure it gets passed to every file
 # We had a customer reported bug where some code built in kernel was NOT using
arch/arc/include/asm/arcregs.h +112 -10

163 lines not on this page · raw message

arch/arc/include/asm/defines.h new file +56 -0

56 lines not on this page · raw message

arch/arc/include/asm/setup.h +14 -0
index ab427e6..fc97411 100644
@@ -13,6 +13,20 @@
 
 #define COMMAND_LINE_SIZE 256
 
+/*
+ * Data structure to map a ID to string
+ * Used a lot for bootup reporting of hardware diversity
+ */
+struct id_to_str {
+	int id;
+	const char *str;
+};
+
+struct cpuinfo_data {
+	struct id_to_str info;
+	int up_range;
+};
+
 extern int root_mountflags, end_mem;
 extern int running_on_hw;
 
arch/arc/kernel/setup.c +222 -1

260 lines not on this page · raw message

arch/arc/mm/cache_arc700.c +46 -0

68 lines not on this page · raw message

arch/arc/mm/tlb.c +38 -0
index defa0c0..36bae47 100644
@@ -451,8 +451,46 @@ void __init read_decode_mmu_bcr(void)
 	mmu->num_tlb = mmu->sets * mmu->ways;
 }
 
+char *arc_mmu_mumbojumbo(int cpu_id, char *buf, int len)
+{
+	int n = 0;
+	struct cpuinfo_arc_mmu *p_mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
+
+	n += scnprintf(buf + n, len - n, "ARC700 MMU [v%x]\t: %dk PAGE, ",
+		       p_mmu->ver, TO_KB(p_mmu->pg_sz));
+
+	n += scnprintf(buf + n, len - n,
+		       "J-TLB %d (%dx%d), uDTLB %d, uITLB %d, %s\n",
+		       p_mmu->num_tlb, p_mmu->sets, p_mmu->ways,
+		       p_mmu->u_dtlb, p_mmu->u_itlb,
+		       __CONFIG_ARC_MMU_SASID_VAL ? "SASID" : "");
+
+	return buf;
+}
+
 void __init arc_mmu_init(void)
 {
+	char str[256];
+	struct cpuinfo_arc_mmu *mmu = &cpuinfo_arc700[smp_processor_id()].mmu;
+
+	printk(arc_mmu_mumbojumbo(0, str, sizeof(str)));
+
+	/* For efficiency sake, kernel is compile time built for a MMU ver
+	 * This must match the hardware it is running on.
+	 * Linux built for MMU V2, if run on MMU V1 will break down because V1
+	 *  hardware doesn't understand cmds such as WriteNI, or IVUTLB
+	 * On the other hand, Linux built for V1 if run on MMU V2 will do
+	 *   un-needed workarounds to prevent memcpy thrashing.
+	 * Similarly MMU V3 has new features which won't work on older MMU
+	 */
+	if (mmu->ver != CONFIG_ARC_MMU_VER) {
+		panic("MMU ver %d doesn't match kernel built for %d...\n",
+		      mmu->ver, CONFIG_ARC_MMU_VER);
+	}
+
+	if (mmu->pg_sz != PAGE_SIZE)
+		panic("MMU pg size != PAGE_SIZE (%luk)\n", TO_KB(PAGE_SIZE));
+
 	/*
 	 * ASID mgmt data structures are compile time init
 	 *  asid_cache = FIRST_ASID and asid_mm_map[] all zeroes
Signature · 1 line
1.7.4.1
#47 lore raw

RFC PATCH 48/55 ARC: [plat-arfpga] BVCI Latency Unit setup

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/plat-arcfpga/Kconfig    |   32 +++++++++++++++++++++
 arch/arc/plat-arcfpga/platform.c |   56 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 0 deletions(-)
arch/arc/plat-arcfpga/Kconfig +32 -0
index 1b65644..6bc1149 100644
@@ -55,4 +55,36 @@ config ARC_SERIAL_LV2
 	depends on ARC_COMPACT_IRQ_LEVELS
 	select ARC_IRQ5_LV2
 
+menuconfig ARC_HAS_BVCI_LAT_UNIT
+	bool "BVCI Bus Latency Unit"
+	depends on ARC_BOARD_ML509 || ARC_BOARD_ANGEL4
+	help
+	  IP to add artifical latency to BVCI Bus Based FPGA builds.
+	  The default latency (even worst case) for FPGA is non-realistic
+	  (~10 SDRAM, ~5 SSRAM).
+
+config BVCI_LAT_UNITS
+	hex "Latency Unit(s) Bitmap"
+	default "0x0"
+	depends on ARC_HAS_BVCI_LAT_UNIT
+	help
+	  There are multiple Latency Units corresponding to the many
+	  interfaces of the system bus arbiter (both CPU side as well as
+	  the peripheral side).
+	  To add latency to ALL memory transaction, choose Unit 0, otherwise
+	  for finer grainer - interface wise latency, specify a bitmap (1 bit
+	  per unit) of all units. e.g. 1,2,12 will be 0x1003
+
+	  Unit  0 - System Arb and Mem Controller
+	  Unit  1 - I$ and System Bus
+	  Unit  2 - D$ and System Bus
+	  ..
+	  Unit 12 - IDE Disk controller and System Bus
+
+config BVCI_LAT_CYCLES
+	int "Latency Value in cycles"
+	range 0 63
+	default "30"
+	depends on ARC_HAS_BVCI_LAT_UNIT
+
 endif
arch/arc/plat-arcfpga/platform.c +56 -0

68 lines not on this page · raw message

Signature · 1 line
1.7.4.1
maintainer
#48 lore raw

Re: [RFC Patch v1 48/55] ARC: [plat-arfpga] BVCI Latency Unit setup

arch/arc/plat-arcfpga/platform.c line 34

Quoted 4 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/plat-arcfpga/platform.c +4 -0
+       /* TBD: rewrite this using I/O macros */
+       volatile unsigned int *base = (unsigned int *)BVCI_LAT_UNIT_BASE;
+       volatile unsigned int *lat_unit = (unsigned int *)base + 21;
+       volatile unsigned int *lat_val = (unsigned int *)base + 22;

Yes, you should do as the comment says.

Arnd

#49 lore raw

Re: [RFC Patch v1 48/55] ARC: [plat-arfpga] BVCI Latency Unit setup

Quoted 10 lines · Arnd Bergmann

arch/arc/plat-arcfpga/platform.c line 34

Quoted 4 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/plat-arcfpga/platform.c +4 -0
+       /* TBD: rewrite this using I/O macros */
+       volatile unsigned int *base = (unsigned int *)BVCI_LAT_UNIT_BASE;
+       volatile unsigned int *lat_unit = (unsigned int *)base + 21;
+       volatile unsigned int *lat_val = (unsigned int *)base + 22;

Yes, you should do as the comment says.

Arnd

Done.

Thx,
-Vineet

#50 lore raw

RFC PATCH 49/55 perf, ARC: Enable building perf tools for ARC

In reply to [email protected]

From: Vineet Gupta <[email protected]>

Although with uClibc there's more we need to do

---
 tools/perf/perf.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
tools/perf/perf.h +6 -0
index c50985e..1006b17 100644
@@ -107,6 +107,12 @@ void get_term_dimensions(struct winsize *ws);
 #define CPUINFO_PROC	"cpu model"
 #endif
 
+#ifdef __arc__
+#define rmb()		asm volatile("" ::: "memory")
+#define cpu_relax()	rmb()
+#define CPUINFO_PROC	"Processor"
+#endif
+
 #include <time.h>
 #include <unistd.h>
 #include <sys/types.h>
Signature · 1 line
1.7.4.1
#51 lore raw

RFC PATCH 50/55 ARC: perf support (software counters only)

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/Kconfig                  |    3 +++
 arch/arc/include/asm/perf_event.h |   19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 create mode 100644 arch/arc/include/asm/perf_event.h
arch/arc/Kconfig +3 -0
index b878d3e..9882ce0c 100644
@@ -23,12 +23,15 @@ config ARC
 	select HAVE_ARCH_KGDB
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_GENERIC_HARDIRQS
+	select HAVE_IRQ_WORK
 	select HAVE_KPROBES
 	select HAVE_KRETPROBES
 	select HAVE_MOD_ARCH_SPECIFIC if ARC_DW2_UNWIND
 	select HAVE_OPROFILE
+	select HAVE_PERF_EVENTS
 	select HOTPLUG if !INITRAMFS_SOURCE=""
 	select MODULES_USE_ELF_RELA
+	select PERF_USE_VMALLOC
 
 config SCHED_OMIT_FRAME_POINTER
 	def_bool y
arch/arc/include/asm/perf_event.h new file +19 -0
new file mode 100644
index 0000000..a10eb78
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2011-2012 Synopsys, Inc. (www.synopsys.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#ifndef __ASM_PERF_EVENT_H
+#define __ASM_PERF_EVENT_H
+
+#define PERF_EVENT_INDEX_OFFSET	0
+
+static inline void set_perf_event_pending(void)
+{
+}
+
+#endif /* __ASM_PERF_EVENT_H */
Signature · 1 line
1.7.4.1
#52 lore raw

RFC PATCH 51/55 modpost: Ignore ARC specific non-alloc section

In reply to [email protected]

From: Vineet Gupta <[email protected]>

ARC relocatable object files contain one/more .gnu.linkonce.arcextmap.* sections (collated into .arcextmap in final link). These sections are used by debuggers to display the extension instructions and need-not be loaded by target (hence !SHF_ALLOC)

This patch adds the section to modpost's ignore list to avoid the following

======================>8========================
WARNING: vmlinux.o (.gnu.linkonce.arcextmap.inst.3.5.8): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files. ======================>8========================

---
 scripts/mod/modpost.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
scripts/mod/modpost.c +1 -0
index 0d93856..fbbdb8e 100644
@@ -830,6 +830,7 @@ static const char *section_white_list[] =
 	".toc*",
 	".xt.prop",				 /* xtensa */
 	".xt.lit",         /* xtensa */
+	".arcextmap*",     /* arc */
 	NULL
 };
 
Signature · 1 line
1.7.4.1
#53 lore raw

PATCH RESEND 1/1 modpost: For ARC Port submission

Hi,

This is following up on ARC Linux Port submission bits:

Basic Port: https://lkml.org/lkml/2012/11/7/114
Addons:     https://lkml.org/lkml/2012/11/12/121

I'm resending this single patch to hopefully get ACK on simple modpost change.

Thx,
-Vineet

Vineet Gupta (1):
modpost: Ignore ARC specific non-alloc sections

 scripts/mod/modpost.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
Signature · 1 line
1.7.4.1
#54 lore raw

PATCH 1/1 modpost: Ignore ARC specific non-alloc sections

ARC relocatable object files contain one/more .gnu.linkonce.arcextmap.* sections (collated by kernel/vmlinux.lds into .arcextmap in final link). This section is used by debuggers to display the extension instructions and need-not be loaded by target (hence !SHF_ALLOC)

The final kernel binary only needs .arcextmap entry in modpost's ignore list (section_white_list[]). However when building modules, modpost scans each object file individually, hence tripping on non-aggregated .gnu.linkonce.arcextmap.* entries as well.

Thus need for the 2 entires !

---
 scripts/mod/modpost.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
scripts/mod/modpost.c +2 -0
index 0d93856..f6f1030 100644
@@ -830,6 +830,8 @@ static const char *section_white_list[] =
 	".toc*",
 	".xt.prop",				 /* xtensa */
 	".xt.lit",         /* xtensa */
+	".arcextmap*",			/* arc */
+	".gnu.linkonce.arcext*",	/* arc : modules */
 	NULL
 };
 
Signature · 1 line
1.7.4.1
Acked-by on v1 1/1
#55 lore raw

Re: [PATCH] modpost: Ignore ARC specific non-alloc sections

Quoted 9 lines · Vineet Gupta

ARC relocatable object files contain one/more .gnu.linkonce.arcextmap.* sections (collated by kernel/vmlinux.lds into .arcextmap in final link). This section is used by debuggers to display the extension instructions and need-not be loaded by target (hence !SHF_ALLOC)

The final kernel binary only needs .arcextmap entry in modpost's ignore list (section_white_list[]). However when building modules, modpost scans each object file individually, hence tripping on non-aggregated .gnu.linkonce.arcextmap.* entries as well.

The list exist for this particular purpose.
So acked.

Quoted 4 lines

Thus need for the 2 entires !

Sam

#56 lore raw

Re: [PATCH] modpost: Ignore ARC specific non-alloc sections

Quoted 15 lines · Sam Ravnborg
Quoted 9 lines · Vineet Gupta

ARC relocatable object files contain one/more .gnu.linkonce.arcextmap.* sections (collated by kernel/vmlinux.lds into .arcextmap in final link). This section is used by debuggers to display the extension instructions and need-not be loaded by target (hence !SHF_ALLOC)

The final kernel binary only needs .arcextmap entry in modpost's ignore list (section_white_list[]). However when building modules, modpost scans each object file individually, hence tripping on non-aggregated .gnu.linkonce.arcextmap.* entries as well.

The list exist for this particular purpose.
So acked.

Quoted 1 line
Quoted 8 lines
Quoted 3 lines

Thus need for the 2 entires !

Sam

Thx,
-Vineet

#57 lore raw

Re: [PATCH] modpost: Ignore ARC specific non-alloc sections

In reply to Sam Ravnborg
Quoted 6 lines · Sam Ravnborg
Quoted 5 lines · Vineet Gupta

ARC relocatable object files contain one/more .gnu.linkonce.arcextmap.* sections (collated by kernel/vmlinux.lds into .arcextmap in final link). This section is used by debuggers to display the extension instructions and need-not be loaded by target (hence !SHF_ALLOC)

Quoted 7 lines
Quoted 4 lines

The final kernel binary only needs .arcextmap entry in modpost's ignore list (section_white_list[]). However when building modules, modpost scans each object file individually, hence tripping on non-aggregated .gnu.linkonce.arcextmap.* entries as well.

The list exist for this particular purpose.
So acked.

Applied, thanks!

Cheers,
Rusty.

#58 lore raw

Re: [PATCH] modpost: Ignore ARC specific non-alloc sections

Quoted 12 lines · Rusty Russell
Quoted 10 lines · Sam Ravnborg
Quoted 9 lines · Vineet Gupta

ARC relocatable object files contain one/more .gnu.linkonce.arcextmap.* sections (collated by kernel/vmlinux.lds into .arcextmap in final link). This section is used by debuggers to display the extension instructions and need-not be loaded by target (hence !SHF_ALLOC)

The final kernel binary only needs .arcextmap entry in modpost's ignore list (section_white_list[]). However when building modules, modpost scans each object file individually, hence tripping on non-aggregated .gnu.linkonce.arcextmap.* entries as well.

Quoted 6 lines
Quoted 2 lines

The list exist for this particular purpose.
So acked.

Applied, thanks!

Cheers,
Rusty.

Thanks Rusty.
I'll drop this patch from my series.

-Vineet

#59 lore raw

RFC PATCH 52/55 ARC: Support for single cycle Close Coupled Mem (CCM)

In reply to [email protected]

From: Vineet Gupta <[email protected]>

* Includes mapping of CCMs in address space
* Annotations to move arbitrary code/data into CCM
* Moving some of the critical code/data into CCM
* Runtime detection/reporting

---
 arch/arc/Kconfig               |   27 ++++++++++++++++++++
 arch/arc/include/asm/linkage.h |   33 +++++++++++++++++++++++++
 arch/arc/kernel/entry.S        |    4 +-
 arch/arc/kernel/setup.c        |   53 +++++++++++++++++++++++++++++++++++++++-
 arch/arc/kernel/vmlinux.lds.S  |   21 ++++++++++++++++
 arch/arc/mm/tlbex.S            |    5 +--
 6 files changed, 137 insertions(+), 6 deletions(-)
arch/arc/Kconfig +27 -0
index 9882ce0c..79e8f2f 100644
@@ -198,6 +198,33 @@ config ARC_CACHE_PAGES
 
 endif	#ARC_CACHE
 
+config ARC_HAS_ICCM
+	bool "Use ICCM"
+	help
+	  Single Cycle RAMS to store Fast Path Code
+	default n
+
+config ARC_ICCM_SZ
+	int "ICCM Size in KB"
+	default "64"
+	depends on ARC_HAS_ICCM
+
+config ARC_HAS_DCCM
+	bool "Use DCCM"
+	help
+	  Single Cycle RAMS to store Fast Path Data
+	default n
+
+config ARC_DCCM_SZ
+	int "DCCM Size in KB"
+	default "64"
+	depends on ARC_HAS_DCCM
+
+config ARC_DCCM_BASE
+	hex "DCCM map address"
+	default "0xA0000000"
+	depends on ARC_HAS_DCCM
+
 config ARC_HAS_HW_MPY
 	bool "Use Hardware Multiplier (Normal or Faster XMAC)"
 	default y
arch/arc/include/asm/linkage.h +33 -0
index a45d1bb..0283e9e 100644
@@ -25,6 +25,39 @@
 	.size \ name, ASM_PREV_SYM_ADDR(\name)
 .endm
 
+/* annotation for data we want in DCCM - if enabled in .config */
+.macro ARCFP_DATA nm
+#ifdef CONFIG_ARC_HAS_DCCM
+	.section .data.arcfp
+#else
+	.section .data
+#endif
+	.global \nm
+.endm
+
+/* annotation for data we want in DCCM - if enabled in .config */
+.macro ARCFP_CODE
+#ifdef CONFIG_ARC_HAS_ICCM
+	.section .text.arcfp, "ax",@progbits
+#else
+	.section .text, "ax",@progbits
+#endif
+.endm
+
+#else	/* !__ASSEMBLY__ */
+
+#ifdef CONFIG_ARC_HAS_ICCM
+#define __arcfp_code __attribute__((__section__(".text.arcfp")))
+#else
+#define __arcfp_code __attribute__((__section__(".text")))
+#endif
+
+#ifdef CONFIG_ARC_HAS_DCCM
+#define __arcfp_data __attribute__((__section__(".data.arcfp")))
+#else
+#define __arcfp_data __attribute__((__section__(".data")))
+#endif
+
 #endif /* __ASSEMBLY__ */
 
 #endif
arch/arc/kernel/entry.S +2 -2
index 2ff15e0..873588e 100644
@@ -155,7 +155,7 @@ VECTOR   reserved                ; Reserved Exceptions
 
 ;##################### Scratch Mem for IRQ stack switching #############
 
-	.section .data		; NOT .global
+ARCFP_DATA int1_saved_reg
 	.align 32
 	.type   int1_saved_reg, @object
 	.size   int1_saved_reg, 4
@@ -165,7 +165,7 @@ int1_saved_reg:
 /* Each Interrupt level needs it's own scratch */
 #ifdef CONFIG_ARC_COMPACT_IRQ_LEVELS
 
-	.section .data		; NOT .global
+ARCFP_DATA int2_saved_reg
 	.type   int2_saved_reg, @object
 	.size   int2_saved_reg, 4
 int2_saved_reg:
arch/arc/kernel/setup.c +52 -1

71 lines not on this page · raw message

arch/arc/kernel/vmlinux.lds.S +21 -0
index 56c074e..3b6a21a 100644
@@ -24,6 +24,12 @@ jiffies = jiffies_64;
 
 SECTIONS
 {
+	/*
+	 * ICCM starts at 0x8000_0000. So if kernel is relocated to some other
+	 * address, make sure peripheral at 0x8z doesn't clash with ICCM
+	 * Essentially vector is also in ICCM.
+	 */
+
 	. = CONFIG_LINUX_LINK_BASE;
 
 	_int_vec_base_lds = .;
@@ -32,6 +38,13 @@ SECTIONS
 		. = ALIGN(PAGE_SIZE);
 	}
 
+#ifdef CONFIG_ARC_HAS_ICCM
+	.text.arcfp : {
+		*(.text.arcfp)
+		. = ALIGN(CONFIG_ARC_ICCM_SZ * 1024);
+	}
+#endif
+
 	/*
 	 * The reason for having a seperate subsection .init.ramfs is to
 	 * prevent objump from including it in kernel dumps
@@ -135,4 +148,12 @@ SECTIONS
 	.debug_loc 0 : { *(.debug_loc) }
 	.debug_macinfo 0 : { *(.debug_macinfo) }
 
+#ifdef CONFIG_ARC_HAS_DCCM
+	. = CONFIG_ARC_DCCM_BASE;
+	__arc_dccm_base = .;
+	.data.arcfp : {
+		*(.data.arcfp)
+	}
+	. = ALIGN(CONFIG_ARC_DCCM_SZ * 1024);
+#endif
 }
arch/arc/mm/tlbex.S +2 -3
index e933e4c..d7631d2 100644
@@ -54,8 +54,7 @@
 ; For details refer to comments before TLBMISS_FREEUP_REGS below
 ;--------------------------------------------------------------------------
 
-	.section .data
-	.global ex_saved_reg1
+ARCFP_DATA ex_saved_reg1
 	.align 1 << L1_CACHE_SHIFT	; IMP: Must be Cache Line aligned
 	.type   ex_saved_reg1, @object
 #ifdef CONFIG_SMP
@@ -259,7 +258,7 @@ ex_saved_reg1:
 #endif
 .endm
 
-.section .text, "ax",@progbits	;Fast Path Code, candidate for ICCM
+ARCFP_CODE	;Fast Path Code, candidate for ICCM
 
 ;-----------------------------------------------------------------------------
 ; I-TLB Miss Exception Handler
Signature · 1 line
1.7.4.1
maintainer
#60 lore raw

Re: [RFC Patch v1 52/55] ARC: Support for single cycle Close Coupled Mem (CCM)

arch/arc/Kconfig config ARC_CACHE_PAGES · line 227

Quoted 10 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/Kconfig +10 -0
+config ARC_DCCM_SZ
+       int "DCCM Size in KB"
+       default "64"
+       depends on ARC_HAS_DCCM
+
+config ARC_DCCM_BASE
+       hex "DCCM map address"
+       default "0xA0000000"
+       depends on ARC_HAS_DCCM
+

I suppose these should be configured from the device tree at boot time, not during the build process.

I also wonder if the interface should be unified with what we use for accessing the sram on some of the ARM platforms.

Arnd

#61 lore raw

Re: [RFC Patch v1 52/55] ARC: Support for single cycle Close Coupled Mem (CCM)

Quoted 15 lines · Arnd Bergmann

arch/arc/Kconfig config ARC_CACHE_PAGES · line 227

Quoted 10 lines · On Monday 12 November 2012, [email protected] wrote:
arch/arc/Kconfig +10 -0
+config ARC_DCCM_SZ
+       int "DCCM Size in KB"
+       default "64"
+       depends on ARC_HAS_DCCM
+
+config ARC_DCCM_BASE
+       hex "DCCM map address"
+       default "0xA0000000"
+       depends on ARC_HAS_DCCM
+

I suppose these should be configured from the device tree at boot time, not during the build process.

Quoted 5 lines

I also wonder if the interface should be unified with what we use for accessing the sram on some of the ARM platforms.

Arnd

Actually in ARC Port these are used in Linker script to layout the kernel code/data at the addr where these hardware blocks are wired up. So can't be done at runtime.

-Vineet

maintainer
#62 lore raw

Re: [RFC Patch v1 52/55] ARC: Support for single cycle Close Coupled Mem (CCM)

Quoted 3 lines · Vineet Gupta

Actually in ARC Port these are used in Linker script to layout the kernel code/data at the addr where these hardware blocks are wired up. So can't be done at runtime.

Ok, makes sense.

Arnd

#63 lore raw

RFC PATCH 53/55 ARC: Hostlink Pseudo-Driver for Metaware Debugger

In reply to [email protected]

From: Vineet Gupta <[email protected]>

This allows ARC Target to do I/O to host in absence of any peripherals whatsoever, assisted by Metaware Hostlink facility.

Further we have a FUSE based filesystem which makes us mount/access host filesystem on target and do fops.

---
 arch/arc/Kconfig               |    9 +++
 arch/arc/kernel/Makefile       |    1 +
 arch/arc/kernel/arc_hostlink.c |  114 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 124 insertions(+), 0 deletions(-)
 create mode 100644 arch/arc/kernel/arc_hostlink.c
arch/arc/Kconfig +9 -0
index 79e8f2f..4653070 100644
@@ -394,6 +394,15 @@ config HZ
 	int "Timer Frequency"
 	default 100
 
+config ARC_METAWARE_HLINK
+	bool "Support for Metaware debugger assisted Host access"
+	default n
+	help
+	  This options allows a Linux userland apps to directly access
+	  host file system (open/creat/read/write etc) with help from
+	  Metaware Debugger. This can come in handy for Linux-host communication
+	  when there is no real usable peripheral such as EMAC.
+
 menuconfig ARC_DBG
 	bool "ARC debugging"
 	default y
arch/arc/kernel/Makefile +1 -0
index a2b7493..ce14b45 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_ARC_DW2_UNWIND)		+= unwind.o
 obj-$(CONFIG_KPROBES)      		+= kprobes.o
 obj-$(CONFIG_ARC_MISALIGN_ACCESS) 	+= unaligned.o
 obj-$(CONFIG_KGDB)			+= kgdb.o
+obj-$(CONFIG_ARC_METAWARE_HLINK)	+= arc_hostlink.o
 
 obj-$(CONFIG_ARC_FPU_SAVE_RESTORE)	+= fpu.o
 CFLAGS_fpu.o   += -mdpfp
arch/arc/kernel/arc_hostlink.c new file +114 -0

114 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#64 lore raw

RFC PATCH 54/55 ARC: [plat-arcfpga] defconfig

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 arch/arc/configs/fpga_defconfig |  137 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 130 insertions(+), 7 deletions(-)
arch/arc/configs/fpga_defconfig +130 -7
index cfdca3c..d43e738 100644
@@ -17,6 +17,7 @@ CONFIG_STACKTRACE_SUPPORT=y
 CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 # CONFIG_NO_DMA is not set
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_HAVE_IRQ_WORK=y
 
 #
 # General setup
@@ -31,6 +32,7 @@ CONFIG_DEFAULT_HOSTNAME="(none)"
 # CONFIG_SWAP is not set
 # CONFIG_SYSVIPC is not set
 # CONFIG_FHANDLE is not set
+# CONFIG_AUDIT is not set
 CONFIG_HAVE_GENERIC_HARDIRQS=y
 
 #
@@ -53,6 +55,7 @@ CONFIG_HIGH_RES_TIMERS=y
 #
 CONFIG_TICK_CPU_ACCOUNTING=y
 # CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
 
 #
 # RCU Subsystem
@@ -66,8 +69,7 @@ CONFIG_LOG_BUF_SHIFT=17
 CONFIG_NAMESPACES=y
 # CONFIG_UTS_NS is not set
 # CONFIG_PID_NS is not set
-CONFIG_UIDGID_CONVERTED=y
-# CONFIG_UIDGID_STRICT_TYPE_CHECKS is not set
+CONFIG_NET_NS=y
 # CONFIG_SCHED_AUTOGROUP is not set
 # CONFIG_SYSFS_DEPRECATED is not set
 # CONFIG_RELAY is not set
@@ -97,13 +99,16 @@ CONFIG_BUG=y
 # CONFIG_SIGNALFD is not set
 # CONFIG_TIMERFD is not set
 # CONFIG_EVENTFD is not set
-# CONFIG_SHMEM is not set
+CONFIG_SHMEM=y
 # CONFIG_AIO is not set
 CONFIG_EMBEDDED=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_PERF_USE_VMALLOC=y
 
 #
 # Kernel Performance Events And Counters
 #
+# CONFIG_PERF_EVENTS is not set
 # CONFIG_VM_EVENT_COUNTERS is not set
 # CONFIG_SLUB_DEBUG is not set
 # CONFIG_COMPAT_BRK is not set
@@ -111,6 +116,11 @@ CONFIG_EMBEDDED=y
 CONFIG_SLUB=y
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
 CONFIG_ARCH_WANT_IPC_PARSE_VERSION=y
 CONFIG_GENERIC_KERNEL_THREAD=y
@@ -121,7 +131,12 @@ CONFIG_MODULES_USE_ELF_RELA=y
 #
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_BASE_SMALL=1
-# CONFIG_MODULES is not set
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+# CONFIG_MODULE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_MODULE_SIG is not set
 CONFIG_BLOCK=y
 # CONFIG_LBDAF is not set
 # CONFIG_BLK_DEV_BSG is not set
@@ -165,6 +180,8 @@ CONFIG_ARC_CACHE_LINE_SHIFT=6
 CONFIG_ARC_HAS_ICACHE=y
 CONFIG_ARC_HAS_DCACHE=y
 CONFIG_ARC_CACHE_PAGES=y
+# CONFIG_ARC_HAS_ICCM is not set
+# CONFIG_ARC_HAS_DCCM is not set
 CONFIG_ARC_HAS_HW_MPY=y
 # CONFIG_ARC_MMU_V1 is not set
 # CONFIG_ARC_MMU_V2 is not set
@@ -172,6 +189,7 @@ CONFIG_ARC_MMU_V3=y
 CONFIG_ARC_PAGE_SIZE_8K=y
 # CONFIG_ARC_PAGE_SIZE_16K is not set
 # CONFIG_ARC_PAGE_SIZE_4K is not set
+# CONFIG_ARC_COMPACT_IRQ_LEVELS is not set
 # CONFIG_ARC_FPU_SAVE_RESTORE is not set
 CONFIG_ARC_CPU_REL_4_10=y
 CONFIG_ARC_HAS_LLSC=y
@@ -183,12 +201,17 @@ CONFIG_ARC_HAS_RTSC=y
 #
 CONFIG_ARC_BOARD_ANGEL4=y
 # CONFIG_ARC_BOARD_ML509 is not set
+# CONFIG_ISS_SMP_EXTN is not set
 CONFIG_ARC_SERIAL_BAUD=115200
+# CONFIG_ARC_HAS_BVCI_LAT_UNIT is not set
 CONFIG_ARC_PLAT_CLK=80000000
 CONFIG_LINUX_LINK_BASE=0x80000000
 CONFIG_ARC_PLAT_SDRAM_SIZE=0x10000000
+CONFIG_ARC_CURR_IN_REG=y
+# CONFIG_ARC_MISALIGN_ACCESS is not set
 # CONFIG_ARC_STACK_NONEXEC is not set
 CONFIG_HZ=100
+# CONFIG_ARC_METAWARE_HLINK is not set
 # CONFIG_ARC_DBG is not set
 CONFIG_CMDLINE="print-fatal-signals=1"
 # CONFIG_CMDLINE_UBOOT is not set
@@ -208,7 +231,71 @@ CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
 # CONFIG_CROSS_MEMORY_ATTACH is not set
 CONFIG_NEED_PER_CPU_KM=y
 # CONFIG_CLEANCACHE is not set
-# CONFIG_NET is not set
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_DIAG is not set
+CONFIG_UNIX=y
+# CONFIG_UNIX_DIAG is not set
+# CONFIG_XFRM_USER is not set
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+# CONFIG_IP_PNP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE_DEMUX is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_UDP_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_IPV6 is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_ATM is not set
+# CONFIG_L2TP is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_PHONET is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+# CONFIG_BATMAN_ADV is not set
+# CONFIG_OPENVSWITCH is not set
+CONFIG_BQL=y
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+# CONFIG_CAIF is not set
 
 #
 # Device Drivers
@@ -234,6 +321,7 @@ CONFIG_EXTRA_FIRMWARE=""
 # Bus devices
 #
 # CONFIG_OMAP_OCP2SCP is not set
+# CONFIG_CONNECTOR is not set
 # CONFIG_MTD is not set
 # CONFIG_PARPORT is not set
 # CONFIG_BLK_DEV is not set
@@ -268,6 +356,8 @@ CONFIG_SCSI_MOD=y
 # CONFIG_SCSI_NETLINK is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
+# CONFIG_NETDEVICES is not set
+# CONFIG_ISDN is not set
 
 #
 # Input device support
@@ -314,6 +404,7 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 # CONFIG_LEGACY_PTYS is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
+# CONFIG_N_GSM is not set
 # CONFIG_TRACE_SINK is not set
 # CONFIG_DEVKMEM is not set
 
@@ -461,8 +552,16 @@ CONFIG_DUMMY_CONSOLE=y
 #
 # File systems
 #
-# CONFIG_EXT2_FS is not set
-# CONFIG_EXT3_FS is not set
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+# CONFIG_EXT2_FS_POSIX_ACL is not set
+# CONFIG_EXT2_FS_SECURITY is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_DEFAULTS_TO_ORDERED=y
+CONFIG_EXT3_FS_XATTR=y
+# CONFIG_EXT3_FS_POSIX_ACL is not set
+# CONFIG_EXT3_FS_SECURITY is not set
 # CONFIG_EXT4_FS is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
@@ -504,9 +603,28 @@ CONFIG_PROC_FS=y
 CONFIG_PROC_SYSCTL=y
 CONFIG_PROC_PAGE_MONITOR=y
 CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_TMPFS_XATTR is not set
 # CONFIG_HUGETLB_PAGE is not set
 # CONFIG_CONFIGFS_FS is not set
 # CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+# CONFIG_NFS_V2 is not set
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V3_ACL is not set
+# CONFIG_NFS_V4 is not set
+# CONFIG_NFS_SWAP is not set
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+# CONFIG_SUNRPC_DEBUG is not set
+# CONFIG_CIFS is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
 # CONFIG_NLS is not set
 
 #
@@ -562,8 +680,11 @@ CONFIG_STACKTRACE=y
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 # CONFIG_DEBUG_PAGEALLOC is not set
+# CONFIG_RBTREE_TEST is not set
+# CONFIG_INTERVAL_TREE_TEST is not set
 # CONFIG_ATOMIC64_SELFTEST is not set
 # CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
 # CONFIG_TEST_KSTRTOX is not set
 CONFIG_EARLY_PRINTK=y
 # CONFIG_DEBUG_STACKOVERFLOW is not set
@@ -600,6 +721,8 @@ CONFIG_ZLIB_INFLATE=y
 CONFIG_DECOMPRESS_GZIP=y
 CONFIG_HAS_IOMEM=y
 CONFIG_HAS_DMA=y
+CONFIG_DQL=y
+CONFIG_NLATTR=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE=y
 # CONFIG_AVERAGE is not set
Signature · 1 line
1.7.4.1
#65 lore raw

RFC PATCH 55/55 ARC: Add self to MAINTAINERS

In reply to [email protected]

From: Vineet Gupta <[email protected]>

---
 MAINTAINERS |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
MAINTAINERS +6 -0
index 1fa9074..e933489 100644
@@ -7073,6 +7073,12 @@ F:	lib/swiotlb.c
 F:	arch/*/kernel/pci-swiotlb.c
 F:	include/linux/swiotlb.h
 
+SYNOPSYS ARC ARCHITECTURE
+M:	Vineet Gupta <[email protected]>
+L:	[email protected]
+S:	Supported
+F:	arch/arc/
+
 SYSV FILESYSTEM
 M:	Christoph Hellwig <[email protected]>
 S:	Maintained
Signature · 1 line
1.7.4.1