* [RFC PATCH v3 1/5] powerpc: Syscall hooks for context tracking subsystem
From: Li Zhong @ 2013-05-13 5:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368422493-9831-1-git-send-email-zhong@linux.vnet.ibm.com>
This is the syscall slow path hooks for context tracking subsystem,
corresponding to
[PATCH] x86: Syscall hooks for userspace RCU extended QS
commit bf5a3c13b939813d28ce26c01425054c740d6731
TIF_MEMDIE is moved to the second 16-bits (with value 17), as it seems there
is no asm code using it. TIF_NOHZ is added to _TIF_SYCALL_T_OR_A, so it is
better for it to be in the same 16 bits with others in the group, so in the
asm code, andi. with this group could work.
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
---
arch/powerpc/include/asm/thread_info.h | 7 +++++--
arch/powerpc/kernel/ptrace.c | 5 +++++
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 8ceea14..ba7b197 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -97,7 +97,7 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_PERFMON_CTXSW 6 /* perfmon needs ctxsw calls */
#define TIF_SYSCALL_AUDIT 7 /* syscall auditing active */
#define TIF_SINGLESTEP 8 /* singlestepping active */
-#define TIF_MEMDIE 9 /* is terminating due to OOM killer */
+#define TIF_NOHZ 9 /* in adaptive nohz mode */
#define TIF_SECCOMP 10 /* secure computing */
#define TIF_RESTOREALL 11 /* Restore all regs (implies NOERROR) */
#define TIF_NOERROR 12 /* Force successful syscall return */
@@ -106,6 +106,7 @@ static inline struct thread_info *current_thread_info(void)
#define TIF_SYSCALL_TRACEPOINT 15 /* syscall tracepoint instrumentation */
#define TIF_EMULATE_STACK_STORE 16 /* Is an instruction emulation
for stack store? */
+#define TIF_MEMDIE 17 /* is terminating due to OOM killer */
/* as above, but as bit values */
#define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
@@ -124,8 +125,10 @@ static inline struct thread_info *current_thread_info(void)
#define _TIF_UPROBE (1<<TIF_UPROBE)
#define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT)
#define _TIF_EMULATE_STACK_STORE (1<<TIF_EMULATE_STACK_STORE)
+#define _TIF_NOHZ (1<<TIF_NOHZ)
#define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
- _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT)
+ _TIF_SECCOMP | _TIF_SYSCALL_TRACEPOINT | \
+ _TIF_NOHZ)
#define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
_TIF_NOTIFY_RESUME | _TIF_UPROBE)
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 3b14d32..98c2fc1 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -32,6 +32,7 @@
#include <trace/syscall.h>
#include <linux/hw_breakpoint.h>
#include <linux/perf_event.h>
+#include <linux/context_tracking.h>
#include <asm/uaccess.h>
#include <asm/page.h>
@@ -1788,6 +1789,8 @@ long do_syscall_trace_enter(struct pt_regs *regs)
{
long ret = 0;
+ user_exit();
+
secure_computing_strict(regs->gpr[0]);
if (test_thread_flag(TIF_SYSCALL_TRACE) &&
@@ -1832,4 +1835,6 @@ void do_syscall_trace_leave(struct pt_regs *regs)
step = test_thread_flag(TIF_SINGLESTEP);
if (step || test_thread_flag(TIF_SYSCALL_TRACE))
tracehook_report_syscall_exit(regs, step);
+
+ user_enter();
}
--
1.7.9.5
^ permalink raw reply related
* [RFC PATCH v3 2/5] powerpc: Exception hooks for context tracking subsystem
From: Li Zhong @ 2013-05-13 5:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368422493-9831-1-git-send-email-zhong@linux.vnet.ibm.com>
This is the exception hooks for context tracking subsystem, including
data access, program check, single step, instruction breakpoint, machine check,
alignment, fp unavailable, altivec assist, unknown exception, whose handlers
might use RCU.
This patch corresponds to
[PATCH] x86: Exception hooks for userspace RCU extended QS
commit 6ba3c97a38803883c2eee489505796cb0a727122
But after the exception handling moved to generic code, and some changes in
following two commits:
56dd9470d7c8734f055da2a6bac553caf4a468eb
context_tracking: Move exception handling to generic code
6c1e0256fad84a843d915414e4b5973b7443d48d
context_tracking: Restore correct previous context state on exception exit
it is able for exception hooks to use the generic code above instead of a
redundant arch implementation.
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
arch/powerpc/kernel/traps.c | 91 +++++++++++++++++++++++++++++----------
arch/powerpc/mm/fault.c | 16 ++++++-
arch/powerpc/mm/hash_utils_64.c | 38 ++++++++++++----
3 files changed, 112 insertions(+), 33 deletions(-)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 83efa2f..9d3c000 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -35,6 +35,7 @@
#include <linux/kdebug.h>
#include <linux/debugfs.h>
#include <linux/ratelimit.h>
+#include <linux/context_tracking.h>
#include <asm/emulated_ops.h>
#include <asm/pgtable.h>
@@ -668,6 +669,9 @@ int machine_check_generic(struct pt_regs *regs)
void machine_check_exception(struct pt_regs *regs)
{
int recover = 0;
+ enum ctx_state prev_state;
+
+ prev_state = exception_enter();
__get_cpu_var(irq_stat).mce_exceptions++;
@@ -683,7 +687,7 @@ void machine_check_exception(struct pt_regs *regs)
recover = cur_cpu_spec->machine_check(regs);
if (recover > 0)
- return;
+ goto exit;
#if defined(CONFIG_8xx) && defined(CONFIG_PCI)
/* the qspan pci read routines can cause machine checks -- Cort
@@ -693,20 +697,23 @@ void machine_check_exception(struct pt_regs *regs)
* -- BenH
*/
bad_page_fault(regs, regs->dar, SIGBUS);
- return;
+ goto exit;
#endif
if (debugger_fault_handler(regs))
- return;
+ goto exit;
if (check_io_access(regs))
- return;
+ goto exit;
die("Machine check", regs, SIGBUS);
/* Must die if the interrupt is not recoverable */
if (!(regs->msr & MSR_RI))
panic("Unrecoverable Machine check");
+
+exit:
+ exception_exit(prev_state);
}
void SMIException(struct pt_regs *regs)
@@ -716,20 +723,31 @@ void SMIException(struct pt_regs *regs)
void unknown_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state;
+ prev_state = exception_enter();
+
printk("Bad trap at PC: %lx, SR: %lx, vector=%lx\n",
regs->nip, regs->msr, regs->trap);
_exception(SIGTRAP, regs, 0, 0);
+
+ exception_exit(prev_state);
}
void instruction_breakpoint_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state;
+ prev_state = exception_enter();
+
if (notify_die(DIE_IABR_MATCH, "iabr_match", regs, 5,
5, SIGTRAP) == NOTIFY_STOP)
- return;
+ goto exit;
if (debugger_iabr_match(regs))
- return;
+ goto exit;
_exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
+
+exit:
+ exception_exit(prev_state);
}
void RunModeException(struct pt_regs *regs)
@@ -739,15 +757,21 @@ void RunModeException(struct pt_regs *regs)
void __kprobes single_step_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state;
+ prev_state = exception_enter();
+
clear_single_step(regs);
if (notify_die(DIE_SSTEP, "single_step", regs, 5,
5, SIGTRAP) == NOTIFY_STOP)
- return;
+ goto exit;
if (debugger_sstep(regs))
- return;
+ goto exit;
_exception(SIGTRAP, regs, TRAP_TRACE, regs->nip);
+
+exit:
+ exception_exit(prev_state);
}
/*
@@ -1006,34 +1030,37 @@ int is_valid_bugaddr(unsigned long addr)
void __kprobes program_check_exception(struct pt_regs *regs)
{
unsigned int reason = get_reason(regs);
+ enum ctx_state prev_state;
extern int do_mathemu(struct pt_regs *regs);
+ prev_state = exception_enter();
+
/* We can now get here via a FP Unavailable exception if the core
* has no FPU, in that case the reason flags will be 0 */
if (reason & REASON_FP) {
/* IEEE FP exception */
parse_fpe(regs);
- return;
+ goto exit;
}
if (reason & REASON_TRAP) {
/* Debugger is first in line to stop recursive faults in
* rcu_lock, notify_die, or atomic_notifier_call_chain */
if (debugger_bpt(regs))
- return;
+ goto exit;
/* trap exception */
if (notify_die(DIE_BPT, "breakpoint", regs, 5, 5, SIGTRAP)
== NOTIFY_STOP)
- return;
+ goto exit;
if (!(regs->msr & MSR_PR) && /* not user-mode */
report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) {
regs->nip += 4;
- return;
+ goto exit;
}
_exception(SIGTRAP, regs, TRAP_BRKPT, regs->nip);
- return;
+ goto exit;
}
#ifdef CONFIG_PPC_TRANSACTIONAL_MEM
if (reason & REASON_TM) {
@@ -1049,7 +1076,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
if (!user_mode(regs) &&
report_bug(regs->nip, regs) == BUG_TRAP_TYPE_WARN) {
regs->nip += 4;
- return;
+ goto exit;
}
/* If usermode caused this, it's done something illegal and
* gets a SIGILL slap on the wrist. We call it an illegal
@@ -1059,7 +1086,7 @@ void __kprobes program_check_exception(struct pt_regs *regs)
*/
if (user_mode(regs)) {
_exception(SIGILL, regs, ILL_ILLOPN, regs->nip);
- return;
+ goto exit;
} else {
printk(KERN_EMERG "Unexpected TM Bad Thing exception "
"at %lx (msr 0x%x)\n", regs->nip, reason);
@@ -1083,16 +1110,16 @@ void __kprobes program_check_exception(struct pt_regs *regs)
switch (do_mathemu(regs)) {
case 0:
emulate_single_step(regs);
- return;
+ goto exit;
case 1: {
int code = 0;
code = __parse_fpscr(current->thread.fpscr.val);
_exception(SIGFPE, regs, code, regs->nip);
- return;
+ goto exit;
}
case -EFAULT:
_exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
- return;
+ goto exit;
}
/* fall through on any other errors */
#endif /* CONFIG_MATH_EMULATION */
@@ -1103,10 +1130,10 @@ void __kprobes program_check_exception(struct pt_regs *regs)
case 0:
regs->nip += 4;
emulate_single_step(regs);
- return;
+ goto exit;
case -EFAULT:
_exception(SIGSEGV, regs, SEGV_MAPERR, regs->nip);
- return;
+ goto exit;
}
}
@@ -1114,11 +1141,17 @@ void __kprobes program_check_exception(struct pt_regs *regs)
_exception(SIGILL, regs, ILL_PRVOPC, regs->nip);
else
_exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
+
+exit:
+ exception_exit(prev_state);
}
void alignment_exception(struct pt_regs *regs)
{
int sig, code, fixed = 0;
+ enum ctx_state prev_state;
+
+ prev_state = exception_enter();
/* We restore the interrupt state now */
if (!arch_irq_disabled_regs(regs))
@@ -1131,7 +1164,7 @@ void alignment_exception(struct pt_regs *regs)
if (fixed == 1) {
regs->nip += 4; /* skip over emulated instruction */
emulate_single_step(regs);
- return;
+ goto exit;
}
/* Operand address was bad */
@@ -1146,6 +1179,9 @@ void alignment_exception(struct pt_regs *regs)
_exception(sig, regs, code, regs->dar);
else
bad_page_fault(regs, regs->dar, sig);
+
+exit:
+ exception_exit(prev_state);
}
void StackOverflow(struct pt_regs *regs)
@@ -1174,23 +1210,34 @@ void trace_syscall(struct pt_regs *regs)
void kernel_fp_unavailable_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state;
+ prev_state = exception_enter();
+
printk(KERN_EMERG "Unrecoverable FP Unavailable Exception "
"%lx at %lx\n", regs->trap, regs->nip);
die("Unrecoverable FP Unavailable Exception", regs, SIGABRT);
+
+ exception_exit(prev_state);
}
void altivec_unavailable_exception(struct pt_regs *regs)
{
+ enum ctx_state prev_state;
+ prev_state = exception_enter();
+
if (user_mode(regs)) {
/* A user program has executed an altivec instruction,
but this kernel doesn't support altivec. */
_exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
- return;
+ goto exit;
}
printk(KERN_EMERG "Unrecoverable VMX/Altivec Unavailable Exception "
"%lx at %lx\n", regs->trap, regs->nip);
die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT);
+
+exit:
+ exception_exit(prev_state);
}
void vsx_unavailable_exception(struct pt_regs *regs)
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 229951f..141835b 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -32,6 +32,7 @@
#include <linux/perf_event.h>
#include <linux/magic.h>
#include <linux/ratelimit.h>
+#include <linux/context_tracking.h>
#include <asm/firmware.h>
#include <asm/page.h>
@@ -193,8 +194,8 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
* The return value is 0 if the fault was handled, or the signal
* number if this is a kernel fault that can't be handled here.
*/
-int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
- unsigned long error_code)
+static int __kprobes __do_page_fault(struct pt_regs *regs,
+ unsigned long address, unsigned long error_code)
{
struct vm_area_struct * vma;
struct mm_struct *mm = current->mm;
@@ -475,6 +476,17 @@ bad_area_nosemaphore:
}
+int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
+ unsigned long error_code)
+{
+ int ret;
+ enum ctx_state prev_state;
+ prev_state = exception_enter();
+ ret = __do_page_fault(regs, address, error_code);
+ exception_exit(prev_state);
+ return ret;
+}
+
/*
* bad_page_fault is called when we have a bad access from the kernel.
* It is called from the DSI and ISI handlers in head.S and from some
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 88ac0ee..d92fb26 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -33,6 +33,7 @@
#include <linux/init.h>
#include <linux/signal.h>
#include <linux/memblock.h>
+#include <linux/context_tracking.h>
#include <asm/processor.h>
#include <asm/pgtable.h>
@@ -962,6 +963,9 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
const struct cpumask *tmp;
int rc, user_region = 0, local = 0;
int psize, ssize;
+ enum ctx_state prev_state;
+
+ prev_state = exception_enter();
DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n",
ea, access, trap);
@@ -973,7 +977,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
mm = current->mm;
if (! mm) {
DBG_LOW(" user region with no mm !\n");
- return 1;
+ rc = 1;
+ goto exit;
}
psize = get_slice_psize(mm, ea);
ssize = user_segment_size(ea);
@@ -992,19 +997,23 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
/* Not a valid range
* Send the problem up to do_page_fault
*/
- return 1;
+ rc = 1;
+ goto exit;
}
DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid);
/* Bad address. */
if (!vsid) {
DBG_LOW("Bad address!\n");
- return 1;
+ rc = 1;
+ goto exit;
}
/* Get pgdir */
pgdir = mm->pgd;
- if (pgdir == NULL)
- return 1;
+ if (pgdir == NULL) {
+ rc = 1;
+ goto exit;
+ }
/* Check CPU locality */
tmp = cpumask_of(smp_processor_id());
@@ -1027,7 +1036,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
ptep = find_linux_pte_or_hugepte(pgdir, ea, &hugeshift);
if (ptep == NULL || !pte_present(*ptep)) {
DBG_LOW(" no PTE !\n");
- return 1;
+ rc = 1;
+ goto exit;
}
/* Add _PAGE_PRESENT to the required access perm */
@@ -1038,13 +1048,16 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
*/
if (access & ~pte_val(*ptep)) {
DBG_LOW(" no access !\n");
- return 1;
+ rc = 1;
+ goto exit;
}
#ifdef CONFIG_HUGETLB_PAGE
- if (hugeshift)
- return __hash_page_huge(ea, access, vsid, ptep, trap, local,
+ if (hugeshift) {
+ rc = __hash_page_huge(ea, access, vsid, ptep, trap, local,
ssize, hugeshift, psize);
+ goto exit;
+ }
#endif /* CONFIG_HUGETLB_PAGE */
#ifndef CONFIG_PPC_64K_PAGES
@@ -1124,6 +1137,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
pte_val(*(ptep + PTRS_PER_PTE)));
#endif
DBG_LOW(" -> rc=%d\n", rc);
+exit:
+ exception_exit(prev_state);
return rc;
}
EXPORT_SYMBOL_GPL(hash_page);
@@ -1259,6 +1274,9 @@ void flush_hash_range(unsigned long number, int local)
*/
void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc)
{
+ enum ctx_state prev_state;
+ prev_state = exception_enter();
+
if (user_mode(regs)) {
#ifdef CONFIG_PPC_SUBPAGE_PROT
if (rc == -2)
@@ -1268,6 +1286,8 @@ void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc)
_exception(SIGBUS, regs, BUS_ADRERR, address);
} else
bad_page_fault(regs, address, SIGBUS);
+
+ exception_exit(prev_state);
}
long hpte_insert_repeating(unsigned long hash, unsigned long vpn,
--
1.7.9.5
^ permalink raw reply related
* [RFC PATCH v3 3/5] powerpc: Exit user context on notify resume
From: Li Zhong @ 2013-05-13 5:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368422493-9831-1-git-send-email-zhong@linux.vnet.ibm.com>
This patch allows RCU usage in do_notify_resume, e.g. signal handling.
It corresponds to
[PATCH] x86: Exit RCU extended QS on notify resume
commit edf55fda35c7dc7f2d9241c3abaddaf759b457c6
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
arch/powerpc/kernel/signal.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index cf12eae..d63b502 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -13,6 +13,7 @@
#include <linux/signal.h>
#include <linux/uprobes.h>
#include <linux/key.h>
+#include <linux/context_tracking.h>
#include <asm/hw_breakpoint.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
@@ -159,6 +160,8 @@ static int do_signal(struct pt_regs *regs)
void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
{
+ user_exit();
+
if (thread_info_flags & _TIF_UPROBE)
uprobe_notify_resume(regs);
@@ -169,4 +172,6 @@ void do_notify_resume(struct pt_regs *regs, unsigned long thread_info_flags)
clear_thread_flag(TIF_NOTIFY_RESUME);
tracehook_notify_resume(regs);
}
+
+ user_enter();
}
--
1.7.9.5
^ permalink raw reply related
* [RFC PATCH v3 4/5] powerpc: Use the new schedule_user API on userspace preemption
From: Li Zhong @ 2013-05-13 5:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368422493-9831-1-git-send-email-zhong@linux.vnet.ibm.com>
This patch corresponds to
[PATCH] x86: Use the new schedule_user API on userspace preemption
commit 0430499ce9d78691f3985962021b16bf8f8a8048
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
arch/powerpc/include/asm/context_tracking.h | 10 ++++++++++
arch/powerpc/kernel/entry_64.S | 3 ++-
2 files changed, 12 insertions(+), 1 deletion(-)
create mode 100644 arch/powerpc/include/asm/context_tracking.h
diff --git a/arch/powerpc/include/asm/context_tracking.h b/arch/powerpc/include/asm/context_tracking.h
new file mode 100644
index 0000000..b6f5a33
--- /dev/null
+++ b/arch/powerpc/include/asm/context_tracking.h
@@ -0,0 +1,10 @@
+#ifndef _ASM_POWERPC_CONTEXT_TRACKING_H
+#define _ASM_POWERPC_CONTEXT_TRACKING_H
+
+#ifdef CONFIG_CONTEXT_TRACKING
+#define SCHEDULE_USER bl .schedule_user
+#else
+#define SCHEDULE_USER bl .schedule
+#endif
+
+#endif
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 915fbb4..d418977 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -33,6 +33,7 @@
#include <asm/irqflags.h>
#include <asm/ftrace.h>
#include <asm/hw_irq.h>
+#include <asm/context_tracking.h>
/*
* System calls.
@@ -634,7 +635,7 @@ _GLOBAL(ret_from_except_lite)
andi. r0,r4,_TIF_NEED_RESCHED
beq 1f
bl .restore_interrupts
- bl .schedule
+ SCHEDULE_USER
b .ret_from_except_lite
1: bl .save_nvgprs
--
1.7.9.5
^ permalink raw reply related
* [RFC PATCH v3 5/5] powerpc: select HAVE_CONTEXT_TRACKING for pSeries
From: Li Zhong @ 2013-05-13 5:21 UTC (permalink / raw)
To: linux-kernel; +Cc: Li Zhong, fweisbec, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368422493-9831-1-git-send-email-zhong@linux.vnet.ibm.com>
Start context tracking support from pSeries.
Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
arch/powerpc/platforms/pseries/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/pseries/Kconfig b/arch/powerpc/platforms/pseries/Kconfig
index 9a0941b..023b288 100644
--- a/arch/powerpc/platforms/pseries/Kconfig
+++ b/arch/powerpc/platforms/pseries/Kconfig
@@ -18,6 +18,7 @@ config PPC_PSERIES
select PPC_PCI_CHOICE if EXPERT
select ZLIB_DEFLATE
select PPC_DOORBELL
+ select HAVE_CONTEXT_TRACKING
default y
config PPC_SPLPAR
--
1.7.9.5
^ permalink raw reply related
* Re: [RFC PATCH v3 0/5] powerpc: Support context tracking for Power pSeries
From: Benjamin Herrenschmidt @ 2013-05-13 5:51 UTC (permalink / raw)
To: Li Zhong
Cc: fweisbec, Anton Blanchard, linux-kernel, paulus, paulmck,
linuxppc-dev
In-Reply-To: <1368422493-9831-1-git-send-email-zhong@linux.vnet.ibm.com>
On Mon, 2013-05-13 at 13:21 +0800, Li Zhong wrote:
> These patches try to support context tracking for Power arch, beginning with
> 64-bit pSeries. The codes are ported from that of the x86_64, and in each
> patch, I listed the corresponding patch for x86.
So that's yet another pile of bloat on all syscall entry/exit and
exception entry/exit. What is it used for ? (I haven't followed on
x86_64 side).
Cheers,
Ben.
> v3:
>
> This version is mainly a rebasing, against 3.10-rc1, also as the common code
> to handle the exception are pulled into 3.10, so there is no dependency on
> tip tree. So patch #2 and #6 in previous version_2 is merged together.
>
> Li Zhong (5):
> powerpc: Syscall hooks for context tracking subsystem
> powerpc: Exception hooks for context tracking subsystem
> powerpc: Exit user context on notify resume
> powerpc: Use the new schedule_user API on userspace preemption
> powerpc: select HAVE_CONTEXT_TRACKING for pSeries
>
> arch/powerpc/include/asm/context_tracking.h | 10 +++
> arch/powerpc/include/asm/thread_info.h | 7 ++-
> arch/powerpc/kernel/entry_64.S | 3 +-
> arch/powerpc/kernel/ptrace.c | 5 ++
> arch/powerpc/kernel/signal.c | 5 ++
> arch/powerpc/kernel/traps.c | 91 ++++++++++++++++++++-------
> arch/powerpc/mm/fault.c | 16 ++++-
> arch/powerpc/mm/hash_utils_64.c | 38 ++++++++---
> arch/powerpc/platforms/pseries/Kconfig | 1 +
> 9 files changed, 140 insertions(+), 36 deletions(-)
> create mode 100644 arch/powerpc/include/asm/context_tracking.h
>
^ permalink raw reply
* Re: [RFC PATCH v3 2/5] powerpc: Exception hooks for context tracking subsystem
From: Benjamin Herrenschmidt @ 2013-05-13 5:57 UTC (permalink / raw)
To: Li Zhong; +Cc: fweisbec, linux-kernel, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368422493-9831-3-git-send-email-zhong@linux.vnet.ibm.com>
On Mon, 2013-05-13 at 13:21 +0800, Li Zhong wrote:
> int recover = 0;
> + enum ctx_state prev_state;
> +
> + prev_state = exception_enter();
Please make it nicer:
enum ctx_state prev_state = exception_enter();
int recover = 0;
> __get_cpu_var(irq_stat).mce_exceptions++;
>
> @@ -683,7 +687,7 @@ void machine_check_exception(struct pt_regs *regs)
> recover = cur_cpu_spec->machine_check(regs);
>
> if (recover > 0)
> - return;
> + goto exit;
I'm no fan of "exit" as a label as it's otherwise a libc function (I
know there is no relationship here but I just find that annoying).
I usually use "bail"
> #if defined(CONFIG_8xx) && defined(CONFIG_PCI)
> /* the qspan pci read routines can cause machine checks -- Cort
> @@ -693,20 +697,23 @@ void machine_check_exception(struct pt_regs *regs)
> * -- BenH
> */
> bad_page_fault(regs, regs->dar, SIGBUS);
> - return;
> + goto exit;
> #endif
>
> if (debugger_fault_handler(regs))
> - return;
> + goto exit;
>
> if (check_io_access(regs))
> - return;
> + goto exit;
>
> die("Machine check", regs, SIGBUS);
>
> /* Must die if the interrupt is not recoverable */
> if (!(regs->msr & MSR_RI))
> panic("Unrecoverable Machine check");
> +
> +exit:
> + exception_exit(prev_state);
> }
>
> void SMIException(struct pt_regs *regs)
> @@ -716,20 +723,31 @@ void SMIException(struct pt_regs *regs)
>
> void unknown_exception(struct pt_regs *regs)
> {
> + enum ctx_state prev_state;
> + prev_state = exception_enter();
> +
Same cosmetic comment for all other cases
..../...
> #include <asm/firmware.h>
> #include <asm/page.h>
> @@ -193,8 +194,8 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
> * The return value is 0 if the fault was handled, or the signal
> * number if this is a kernel fault that can't be handled here.
> */
> -int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
> - unsigned long error_code)
> +static int __kprobes __do_page_fault(struct pt_regs *regs,
> + unsigned long address, unsigned long error_code)
> {
> struct vm_area_struct * vma;
> struct mm_struct *mm = current->mm;
> @@ -475,6 +476,17 @@ bad_area_nosemaphore:
>
> }
>
> +int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
> + unsigned long error_code)
> +{
> + int ret;
> + enum ctx_state prev_state;
> + prev_state = exception_enter();
> + ret = __do_page_fault(regs, address, error_code);
> + exception_exit(prev_state);
> + return ret;
> +}
Any reason why you didn't use the same wrapping trick in traps.c ? I'd
rather we stay consistent in the way we do things between the two files.
> /*
> * bad_page_fault is called when we have a bad access from the kernel.
> * It is called from the DSI and ISI handlers in head.S and from some
> diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> index 88ac0ee..d92fb26 100644
> --- a/arch/powerpc/mm/hash_utils_64.c
> +++ b/arch/powerpc/mm/hash_utils_64.c
> @@ -33,6 +33,7 @@
> #include <linux/init.h>
> #include <linux/signal.h>
> #include <linux/memblock.h>
> +#include <linux/context_tracking.h>
>
> #include <asm/processor.h>
> #include <asm/pgtable.h>
> @@ -962,6 +963,9 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> const struct cpumask *tmp;
> int rc, user_region = 0, local = 0;
> int psize, ssize;
> + enum ctx_state prev_state;
> +
> + prev_state = exception_enter();
>
> DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n",
> ea, access, trap);
> @@ -973,7 +977,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> mm = current->mm;
> if (! mm) {
> DBG_LOW(" user region with no mm !\n");
> - return 1;
> + rc = 1;
> + goto exit;
> }
> psize = get_slice_psize(mm, ea);
> ssize = user_segment_size(ea);
> @@ -992,19 +997,23 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> /* Not a valid range
> * Send the problem up to do_page_fault
> */
> - return 1;
> + rc = 1;
> + goto exit;
> }
> DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid);
>
> /* Bad address. */
> if (!vsid) {
> DBG_LOW("Bad address!\n");
> - return 1;
> + rc = 1;
> + goto exit;
> }
> /* Get pgdir */
> pgdir = mm->pgd;
> - if (pgdir == NULL)
> - return 1;
> + if (pgdir == NULL) {
> + rc = 1;
> + goto exit;
> + }
>
> /* Check CPU locality */
> tmp = cpumask_of(smp_processor_id());
> @@ -1027,7 +1036,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> ptep = find_linux_pte_or_hugepte(pgdir, ea, &hugeshift);
> if (ptep == NULL || !pte_present(*ptep)) {
> DBG_LOW(" no PTE !\n");
> - return 1;
> + rc = 1;
> + goto exit;
> }
>
> /* Add _PAGE_PRESENT to the required access perm */
> @@ -1038,13 +1048,16 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> */
> if (access & ~pte_val(*ptep)) {
> DBG_LOW(" no access !\n");
> - return 1;
> + rc = 1;
> + goto exit;
> }
>
> #ifdef CONFIG_HUGETLB_PAGE
> - if (hugeshift)
> - return __hash_page_huge(ea, access, vsid, ptep, trap, local,
> + if (hugeshift) {
> + rc = __hash_page_huge(ea, access, vsid, ptep, trap, local,
> ssize, hugeshift, psize);
> + goto exit;
> + }
> #endif /* CONFIG_HUGETLB_PAGE */
>
> #ifndef CONFIG_PPC_64K_PAGES
> @@ -1124,6 +1137,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> pte_val(*(ptep + PTRS_PER_PTE)));
> #endif
> DBG_LOW(" -> rc=%d\n", rc);
> +exit:
> + exception_exit(prev_state);
> return rc;
> }
> EXPORT_SYMBOL_GPL(hash_page);
> @@ -1259,6 +1274,9 @@ void flush_hash_range(unsigned long number, int local)
> */
> void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc)
> {
> + enum ctx_state prev_state;
> + prev_state = exception_enter();
> +
> if (user_mode(regs)) {
> #ifdef CONFIG_PPC_SUBPAGE_PROT
> if (rc == -2)
> @@ -1268,6 +1286,8 @@ void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc)
> _exception(SIGBUS, regs, BUS_ADRERR, address);
> } else
> bad_page_fault(regs, address, SIGBUS);
> +
> + exception_exit(prev_state);
> }
So the above comes from the return of hash page following an error, it's
technically the same exception. I don't know if that matters however.
Also some exceptions are directly handled in asm such as SLB misses,
again I don't know if that matters as I'm not familiar with what the
context tracing code is actually doing.
> long hpte_insert_repeating(unsigned long hash, unsigned long vpn,
Cheers,
Ben.
^ permalink raw reply
* Re: [PATCH 17/18] cpufreq: powerpc: move cpufreq driver to drivers/cpufreq
From: Viresh Kumar @ 2013-05-13 6:04 UTC (permalink / raw)
To: Benjamin Herrenschmidt, deepthi
Cc: robin.randhawa, linux-pm, Viresh Kumar, patches, Liviu.Dudau,
linux-kernel, cpufreq, rjw, Steve.Bannister, Paul Mackerras,
Olof Johansson, arvind.chauhan, linuxppc-dev, linaro-kernel,
charles.garcia-tobin
In-Reply-To: <CAKohpo=SFauMyczEnxO_p_KQVQeznL+0V-FmLDtGmzL1Uv2iuA@mail.gmail.com>
On 22 April 2013 12:19, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> On 9 April 2013 14:05, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>> On 5 April 2013 12:16, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>>> On 4 April 2013 18:24, Viresh Kumar <viresh.kumar@linaro.org> wrote:
>>>> This patch moves cpufreq driver of powerpc platform to drivers/cpufreq.
>>>>
>>>> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>>>> Cc: Paul Mackerras <paulus@samba.org>
>>>> Cc: Olof Johansson <olof@lixom.net>
>>>> Cc: linuxppc-dev@lists.ozlabs.org
>>>> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
>>>> ---
>>>> Compile Tested only.
>>>>
>>>> arch/powerpc/platforms/Kconfig | 31 ----------------------
>>>> arch/powerpc/platforms/pasemi/Makefile | 1 -
>>>> arch/powerpc/platforms/powermac/Makefile | 2 --
>>>> drivers/cpufreq/Kconfig.powerpc | 26 ++++++++++++++++++
>>>> drivers/cpufreq/Makefile | 3 +++
>>>> .../cpufreq.c => drivers/cpufreq/pasemi-cpufreq.c | 0
>>>> .../cpufreq/pmac32-cpufreq.c | 0
>>>> .../cpufreq/pmac64-cpufreq.c | 0
>>>> 8 files changed, 29 insertions(+), 34 deletions(-)
>>>> rename arch/powerpc/platforms/pasemi/cpufreq.c => drivers/cpufreq/pasemi-cpufreq.c (100%)
>>>> rename arch/powerpc/platforms/powermac/cpufreq_32.c => drivers/cpufreq/pmac32-cpufreq.c (100%)
>>>> rename arch/powerpc/platforms/powermac/cpufreq_64.c => drivers/cpufreq/pmac64-cpufreq.c (100%)
>>>
>>> Hi Deepthi,
>>>
>>> Can you help testing this please?
>>
>> Ping!!
>
> Ping!!
Hi Benjamin,
Hope you are back from your vacations. Can you give it a try now?
^ permalink raw reply
* RE: [PATCH 2/2 V8] powerpc/85xx: Add machine check handler to fix PCIe erratum on mpc85xx
From: Jia Hongtao-B38951 @ 2013-05-13 6:20 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: Wood Scott-B07421, Jia Hongtao-B38951,
linuxppc-dev@lists.ozlabs.org, Li Yang-R58472
In-Reply-To: <412C8208B4A0464FA894C5F0C278CD5D01C5BCAA@039-SN1MPN1-002.039d.mgd.msft.net>
Hi Ben,
These four patches have been reviewed for a long time
and look good to Scott Wood.
It seems Kumar have no enough time for further review.
Could you please help me to review them?
http://patchwork.ozlabs.org/patch/233211/
http://patchwork.ozlabs.org/patch/235276/
http://patchwork.ozlabs.org/patch/240238/
http://patchwork.ozlabs.org/patch/240239/
Thanks.
-Hongtao
> -----Original Message-----
> From: Jia Hongtao-B38951
> Sent: Friday, May 10, 2013 12:01 PM
> To: galak@kernel.crashing.org
> Cc: linuxppc-dev@lists.ozlabs.org; Li Yang-R58472; Jia Hongtao-B38951
> Subject: RE: [PATCH 2/2 V8] powerpc/85xx: Add machine check handler to
> fix PCIe erratum on mpc85xx
>=20
> > > -----Original Message-----
> > > From: Wood Scott-B07421
> > > Sent: Friday, May 03, 2013 1:04 AM
> > > To: Jia Hongtao-B38951
> > > Cc: linuxppc-dev@lists.ozlabs.org; galak@kernel.crashing.org; Wood
> > > Scott- B07421; segher@kernel.crashing.org; Li Yang-R58472; Jia
> > > Hongtao-B38951
> > > Subject: Re: [PATCH 2/2 V8] powerpc/85xx: Add machine check handler
> > > to fix PCIe erratum on mpc85xx
> > >
> > > On 04/28/2013 12:20:08 AM, Jia Hongtao wrote:
> > > > A PCIe erratum of mpc85xx may causes a core hang when a link of
> > > > PCIe goes down. when the link goes down, Non-posted transactions
> > > > issued via the ATMU requiring completion result in an instruction
> stall.
> > > > At the same time a machine-check exception is generated to the
> > > > core to allow further processing by the handler. We implements the
> > > > handler which skips the instruction caused the stall.
> > > >
> > > > This patch depends on patch:
> > > > powerpc/85xx: Add platform_device declaration to fsl_pci.h
> > > >
> > > > Signed-off-by: Zhao Chenhui <b35336@freescale.com>
> > > > Signed-off-by: Li Yang <leoli@freescale.com>
> > > > Signed-off-by: Liu Shuo <soniccat.liu@gmail.com>
> > > > Signed-off-by: Jia Hongtao <hongtao.jia@freescale.com>
> > > > ---
> > > > V8:
> > > > * Add A variant load instruction emulation.
> > >
> > > ACK
> > >
> > > -Scott
> >
> > Thanks for the review.
> >
> > Hi Kumar,
> >
> > Could you please review these MSI and PCI hang errata patches?
> > http://patchwork.ozlabs.org/patch/233211/
> > http://patchwork.ozlabs.org/patch/235276/
> > http://patchwork.ozlabs.org/patch/240238/
> > http://patchwork.ozlabs.org/patch/240239/ (This patch)
> >
> > Thanks.
> > -Hongtao
>=20
> Hi Kumar,
>=20
> I'm really appreciated if you have time to review these patches?
>=20
> Thanks.
> -Hongtao
^ permalink raw reply
* Re: [PATCH] powerpc: provide __bswapdi2
From: Anton Blanchard @ 2013-05-13 6:48 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, viro, amodra
In-Reply-To: <1368220707.3378.57.camel@shinybook.infradead.org>
On Fri, 10 May 2013 22:18:27 +0100
David Woodhouse <dwmw2@infradead.org> wrote:
> From: David Woodhouse <David.Woodhouse@intel.com>
>
> Some versions of GCC apparently expect this to be provided by libgcc.
Thanks Dave. We were discussing this with Alan Modra and he doesn't
think the 64bit target should ever emit a call to __bswapdi2. Did you
only see it on 32bit, or 64bit as well?
Alan: I notice Dave is adding calls to __builtin_bswap, perhaps some
versions of the 64bit compiler did emit __bswapdi2 calls for that.
Anton
>
> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
> ---
> Untested.
>
> diff --git a/arch/powerpc/kernel/misc_32.S
> b/arch/powerpc/kernel/misc_32.S index 19e096b..f077dc2 100644
> --- a/arch/powerpc/kernel/misc_32.S
> +++ b/arch/powerpc/kernel/misc_32.S
> @@ -657,6 +657,17 @@ _GLOBAL(__ucmpdi2)
> li r3,2
> blr
>
> +_GLOBAL(__bswapdi2)
> + rlwinm 10,4,8,0xffffffff
> + rlwinm 11,3,8,0xffffffff
> + rlwimi 10,4,24,0,7
> + rlwimi 11,3,24,0,7
> + rlwimi 10,4,24,16,23
> + rlwimi 11,3,24,16,23
> + mr 4,11
> + mr 3,10
> + blr
> +
> _GLOBAL(abs)
> srawi r4,r3,31
> xor r3,r3,r4
> diff --git a/arch/powerpc/kernel/misc_64.S
> b/arch/powerpc/kernel/misc_64.S index 5cfa800..3b2e6e8 100644
> --- a/arch/powerpc/kernel/misc_64.S
> +++ b/arch/powerpc/kernel/misc_64.S
> @@ -234,6 +234,18 @@ _GLOBAL(__flush_dcache_icache)
> isync
> blr
>
> +_GLOBAL(__bswapdi2)
> + srdi 8,3,32
> + rlwinm 7,3,8,0xffffffff
> + rlwimi 7,3,24,0,7
> + rlwinm 9,8,8,0xffffffff
> + rlwimi 7,3,24,16,23
> + rlwimi 9,8,24,0,7
> + rlwimi 9,8,24,16,23
> + sldi 7,7,32
> + or 7,7,9
> + mr 3,7
> + blr
>
> #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
> /*
> diff --git a/arch/powerpc/kernel/ppc_ksyms.c
> b/arch/powerpc/kernel/ppc_ksyms.c index 78b8766..c296665 100644
> --- a/arch/powerpc/kernel/ppc_ksyms.c
> +++ b/arch/powerpc/kernel/ppc_ksyms.c
> @@ -143,7 +143,8 @@ EXPORT_SYMBOL(__lshrdi3);
> int __ucmpdi2(unsigned long long, unsigned long long);
> EXPORT_SYMBOL(__ucmpdi2);
> #endif
> -
> +long long __bswapdi2(long long);
> +EXPORT_SYMBOL(__bswapdi2);
> EXPORT_SYMBOL(memcpy);
> EXPORT_SYMBOL(memset);
> EXPORT_SYMBOL(memmove);
>
^ permalink raw reply
* Re: [RFC] device-tree.git automatic sync from linux.git
From: Michal Simek @ 2013-05-13 7:02 UTC (permalink / raw)
To: Ian Campbell
Cc: linux-mips, linux-c6x-dev, Arnd Bergmann, linux-xtensa,
microblaze-uclinux, x86, linux-kernel, Rob Herring, linux,
Olof Johansson, linuxppc-dev, linux-arm-kernel
In-Reply-To: <1366800525.20256.266.camel@zakaz.uk.xensource.com>
[-- Attachment #1: Type: text/plain, Size: 6127 bytes --]
Hi Ian,
On 04/24/2013 12:48 PM, Ian Campbell wrote:
> Hi,
>
> First off apologies for the large CC list -- I think this catches the
> arch list for all the arches with device tree source in the tree.
>
> Various folks have expressed an interest in eventually splitting the
> device tree bindings out of the Linux git repository into a separate
> tree. This should help reduce the cross talk between the code and the
> bindings and to make it difficult to accidentally "co-evolve" the
> bindings and the code (i.e. break compatibility) etc. There are also
> other projects (such as Xen) which would also like to use device-tree as
> an OS agnostic description of the hardware.
>
> I was talking to Grant about this at this Spring's LinaroConnect in Hong
> Kong and as a first step he was interested in a device-tree.git
> repository which is automatically kept insync with the main Linux tree.
> Somehow I found myself volunteering to set up that tree.
>
> An RFC repository can be found at:
> http://xenbits.xen.org/gitweb/?p=people/ianc/device-tree-rebasing.git
>
> This is created using git filter-branch and retains the full history for
> the device tree source files up to v3.9-rc8.
>
> The master branch contains everything including the required build
> infrastructure while upstream/master and upstream/dts contain the most
> recently converted upstream master branch and the pristine converted
> version respectively. Each upstream tag T is paired with a tag T-dts
> which is the converted version of that tag.
>
> Note that the tree will be potentially rebasing (hence the name) for the
> time being while I'm still smoothing out the conversion process.
>
> The paths to include in the conversion are described in
> scripts/rewrite-paths.sed. The generic cases are:
> arch/ARCH/boot/dts/*.dts and *.dts? (for dtsi and dtsp etc)
> arch/ARCH/boot/*.dts and *.dts?
> arch/ARCH/include/dts/* (currently unused?)
> which become src/ARCH/*.dts and *.dts? plus src/ARCH/include/*
>
> There are also some special cases for some arches which don't follow
> this pattern and for older versions of the kernel which were less
> consistent. The paths were gleaned from git ls-tree + grep on every tag
> in the tree, so if a file was added and moved between two rcs then the
> original path may not be covered (so the move will look like it just
> adds the files).
>
> In principal this supports the new .dtsp files and includes the required
> include paths in the conversion but none of them seem to be in mainline
> yet, so we'll have to see!
>
> The initial conversion took in excess of 40 hours (running out of a
> ramdisk) so even if the result is stable in terms of commit ids etc a
> fresh conversion every time isn't an option for a ~daily sync so I had
> to create a slightly hacked around git-filter-branch (found in
> scripts/git-filter-branch) to support incremental filtering, which I
> intend to send to the git folks soon.
>
> Please let me know what you think.
I have seen that discussion on youtube about this and connection
to arm dtses in the kernel.
Let me describe Microblaze case because probably Microblaze was the first
architecture in the Linux kernel which was DT only from the beginning.
Just small overview it is a Xilinx soft core cpu where you can even setup
some parameters for core itself - multiplier, divider, BS, fpu, cache sizes, etc.
You have to also compose the whole system and every platform/configuration is different
because you can setup addresses, IP on the bus, IRQs, etc.
Based on this configuration we have created tcl script which is able to generate
DTS directly from Xilinx design tool and it is working quite well for several years
and everybody just use it without any problem.
As you see in your repo there is only one microblaze DTS which is for one of mine
ancient configuration which none used.
It means from microblaze point of view we can simple remove it from mainline kernel
because it is useless.
I also care about arm zynq platform where situation is partially different because
zynq is fixed block but you can add others thing to programmable logic.
It means for zynq case we are almost in the same situation where every zynq based
platform is using different configuration and that's why fpgas are so great.
It means for zynq case everybody will need different DTS but will be just good
to describe or show binding.
Currently we have just one dts for zc702 xilinx reference board.
Let's move to my point.
Based on our experience all xilinx boards don't depend on any dts in the linux kernel
and our users just understand the reason why they should use our tcl script for
DTS generation.
Back to your point about moving DTSes out of the kernel. For microblaze - no problem
just do it. For arm zynq this is more problematic because there is weird binding
for ARM. For example PMU which is out of bus and should be probably in cpu node.
Also scu devices, scutimers, watchdog which lie on the bus for our case and we
need to use PPI interrupt cpu mask. Different clock binding, maybe pinmux binding, etc.
It means from my point of view if binding is correct, no problem to move it
out of the kernel. If a kernel patch change binding, it is worth for me to change
dts in the kernel too to reflect this change and track this change too.
My proposal is, let's clean all DTSes in the arm kernel that all platform use
the same binding where all platforms are just correctly described.
The reaching this point I would suggest that for arm, arm-soc maintainers should
keep eyes on any dts binding change and all these changes require ACK from Rob or Grant
(like device-tree maintainers).
Thanks,
Michal
--
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/
Maintainer of Linux kernel - Xilinx Zynq ARM architecture
Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
^ permalink raw reply
* Re: [PATCH] powerpc: provide __bswapdi2
From: Michael Neuling @ 2013-05-13 7:09 UTC (permalink / raw)
To: David Woodhouse; +Cc: linuxppc-dev, viro
In-Reply-To: <1368220707.3378.57.camel@shinybook.infradead.org>
David Woodhouse <dwmw2@infradead.org> wrote:
> From: David Woodhouse <David.Woodhouse@intel.com>
>
> Some versions of GCC apparently expect this to be provided by libgcc.
>
> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
> ---
> Untested.
>
> diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
> index 19e096b..f077dc2 100644
> --- a/arch/powerpc/kernel/misc_32.S
> +++ b/arch/powerpc/kernel/misc_32.S
> @@ -657,6 +657,17 @@ _GLOBAL(__ucmpdi2)
> li r3,2
> blr
>
> +_GLOBAL(__bswapdi2)
> + rlwinm 10,4,8,0xffffffff
> + rlwinm 11,3,8,0xffffffff
> + rlwimi 10,4,24,0,7
> + rlwimi 11,3,24,0,7
> + rlwimi 10,4,24,16,23
> + rlwimi 11,3,24,16,23
> + mr 4,11
> + mr 3,10
> + blr
> +
This doesn't work for me but the below does:
_GLOBAL(__bswapdi2)
rotlwi r9,r4,8
rotlwi r10,r3,8
rlwimi r9,r4,24,0,7
rlwimi r10,r3,24,0,7
rlwimi r9,r4,24,16,23
rlwimi r10,r3,24,16,23
mr r4,r10
mr r3,r9
blr
stolen from GCC -02 output of:
unsigned long long __bswapdi2(unsigned long long x)
{
return ((x & 0x00000000000000ffULL) << 56) |
((x & 0x000000000000ff00ULL) << 40) |
((x & 0x0000000000ff0000ULL) << 24) |
((x & 0x00000000ff000000ULL) << 8) |
((x & 0x000000ff00000000ULL) >> 8) |
((x & 0x0000ff0000000000ULL) >> 24) |
((x & 0x00ff000000000000ULL) >> 40) |
((x & 0xff00000000000000ULL) >> 56);
}
> _GLOBAL(abs)
> srawi r4,r3,31
> xor r3,r3,r4
> diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
> index 5cfa800..3b2e6e8 100644
> --- a/arch/powerpc/kernel/misc_64.S
> +++ b/arch/powerpc/kernel/misc_64.S
> @@ -234,6 +234,18 @@ _GLOBAL(__flush_dcache_icache)
> isync
> blr
>
> +_GLOBAL(__bswapdi2)
> + srdi 8,3,32
> + rlwinm 7,3,8,0xffffffff
> + rlwimi 7,3,24,0,7
> + rlwinm 9,8,8,0xffffffff
> + rlwimi 7,3,24,16,23
> + rlwimi 9,8,24,0,7
> + rlwimi 9,8,24,16,23
> + sldi 7,7,32
> + or 7,7,9
> + mr 3,7
> + blr
This works but we should add "r" to the register names.
I'll repost
Mikey
>
> #if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
> /*
> diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
> index 78b8766..c296665 100644
> --- a/arch/powerpc/kernel/ppc_ksyms.c
> +++ b/arch/powerpc/kernel/ppc_ksyms.c
> @@ -143,7 +143,8 @@ EXPORT_SYMBOL(__lshrdi3);
> int __ucmpdi2(unsigned long long, unsigned long long);
> EXPORT_SYMBOL(__ucmpdi2);
> #endif
> -
> +long long __bswapdi2(long long);
> +EXPORT_SYMBOL(__bswapdi2);
> EXPORT_SYMBOL(memcpy);
> EXPORT_SYMBOL(memset);
> EXPORT_SYMBOL(memmove);
>
> --
> dwmw2
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
^ permalink raw reply
* [PATCH v2] powerpc: provide __bswapdi2
From: Michael Neuling @ 2013-05-13 7:20 UTC (permalink / raw)
To: benh, David Woodhouse; +Cc: linuxppc-dev, viro
In-Reply-To: <9813.1368428999@ale.ozlabs.ibm.com>
From: David Woodhouse <David.Woodhouse@intel.com>
Some versions of GCC apparently expect this to be provided by libgcc.
Updates from Mikey to fix 32 bit version and adding "r" to registers.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 19e096b..3bcaa7ee 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -657,6 +657,17 @@ _GLOBAL(__ucmpdi2)
li r3,2
blr
+_GLOBAL(__bswapdi2)
+ rotlwi r9,r4,8
+ rotlwi r10,r3,8
+ rlwimi r9,r4,24,0,7
+ rlwimi r10,r3,24,0,7
+ rlwimi r9,r4,24,16,23
+ rlwimi r10,r3,24,16,23
+ mr r4,r10
+ mr r3,r9
+ blr
+
_GLOBAL(abs)
srawi r4,r3,31
xor r3,r3,r4
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 5cfa800..637bd82 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -234,6 +234,18 @@ _GLOBAL(__flush_dcache_icache)
isync
blr
+_GLOBAL(__bswapdi2)
+ srdi r8,r3,32
+ rlwinm r7,r3,8,0xffffffff
+ rlwimi r7,r3,24,0,7
+ rlwinm r9,r8,8,0xffffffff
+ rlwimi r7,r3,24,16,23
+ rlwimi r9,r8,24,0,7
+ rlwimi r9,r8,24,16,23
+ sldi r7,r7,32
+ or r7,r7,r9
+ mr r3,r7
+ blr
#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
/*
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 78b8766..c296665 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -143,7 +143,8 @@ EXPORT_SYMBOL(__lshrdi3);
int __ucmpdi2(unsigned long long, unsigned long long);
EXPORT_SYMBOL(__ucmpdi2);
#endif
-
+long long __bswapdi2(long long);
+EXPORT_SYMBOL(__bswapdi2);
EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(memmove);
^ permalink raw reply related
* Re: [PATCH] powerpc: provide __bswapdi2
From: Alan Modra @ 2013-05-13 7:20 UTC (permalink / raw)
To: Anton Blanchard; +Cc: linuxppc-dev, David Woodhouse, viro
In-Reply-To: <20130513164819.1c9331b9@kryten>
On Mon, May 13, 2013 at 04:48:19PM +1000, Anton Blanchard wrote:
> On Fri, 10 May 2013 22:18:27 +0100
> David Woodhouse <dwmw2@infradead.org> wrote:
>
> > From: David Woodhouse <David.Woodhouse@intel.com>
> >
> > Some versions of GCC apparently expect this to be provided by libgcc.
>
> Thanks Dave. We were discussing this with Alan Modra and he doesn't
> think the 64bit target should ever emit a call to __bswapdi2. Did you
> only see it on 32bit, or 64bit as well?
>
> Alan: I notice Dave is adding calls to __builtin_bswap, perhaps some
> versions of the 64bit compiler did emit __bswapdi2 calls for that.
I did a little digging, and it looks like gcc-4.4 will emit __bswapdi2
calls. Support in rs6000.md appeared 2009-06-25.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply
* Re: [RFC PATCH v3 0/5] powerpc: Support context tracking for Power pSeries
From: Li Zhong @ 2013-05-13 8:03 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: fweisbec, Anton Blanchard, linux-kernel, paulus, paulmck,
linuxppc-dev
In-Reply-To: <1368424306.19924.20.camel@pasglop>
On Mon, 2013-05-13 at 15:51 +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2013-05-13 at 13:21 +0800, Li Zhong wrote:
> > These patches try to support context tracking for Power arch, beginning with
> > 64-bit pSeries. The codes are ported from that of the x86_64, and in each
> > patch, I listed the corresponding patch for x86.
>
> So that's yet another pile of bloat on all syscall entry/exit and
> exception entry/exit. What is it used for ? (I haven't followed on
> x86_64 side).
To my understanding, it is used to enable RCU user extended quiescent
state, so RCU on that cpu doesn't need scheduler ticks. And together
with some other code(already in 3.10), we are able to remove the ticks
in some cases (e.g. only 1 task running on the cpu, with some other
limitations).
Maybe Paul, or Frederic could give some better descriptions.
Thanks, Zhong
>
> Cheers,
> Ben.
>
> > v3:
> >
> > This version is mainly a rebasing, against 3.10-rc1, also as the common code
> > to handle the exception are pulled into 3.10, so there is no dependency on
> > tip tree. So patch #2 and #6 in previous version_2 is merged together.
> >
> > Li Zhong (5):
> > powerpc: Syscall hooks for context tracking subsystem
> > powerpc: Exception hooks for context tracking subsystem
> > powerpc: Exit user context on notify resume
> > powerpc: Use the new schedule_user API on userspace preemption
> > powerpc: select HAVE_CONTEXT_TRACKING for pSeries
> >
> > arch/powerpc/include/asm/context_tracking.h | 10 +++
> > arch/powerpc/include/asm/thread_info.h | 7 ++-
> > arch/powerpc/kernel/entry_64.S | 3 +-
> > arch/powerpc/kernel/ptrace.c | 5 ++
> > arch/powerpc/kernel/signal.c | 5 ++
> > arch/powerpc/kernel/traps.c | 91 ++++++++++++++++++++-------
> > arch/powerpc/mm/fault.c | 16 ++++-
> > arch/powerpc/mm/hash_utils_64.c | 38 ++++++++---
> > arch/powerpc/platforms/pseries/Kconfig | 1 +
> > 9 files changed, 140 insertions(+), 36 deletions(-)
> > create mode 100644 arch/powerpc/include/asm/context_tracking.h
> >
>
>
^ permalink raw reply
* Re: [PATCH] powerpc: provide __bswapdi2
From: Gabriel Paubert @ 2013-05-13 7:33 UTC (permalink / raw)
To: Michael Neuling; +Cc: linuxppc-dev, David Woodhouse, viro
In-Reply-To: <9813.1368428999@ale.ozlabs.ibm.com>
On Mon, May 13, 2013 at 05:09:59PM +1000, Michael Neuling wrote:
> David Woodhouse <dwmw2@infradead.org> wrote:
>
> > From: David Woodhouse <David.Woodhouse@intel.com>
> >
> > Some versions of GCC apparently expect this to be provided by libgcc.
> >
> > Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
> > ---
> > Untested.
> >
> > diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
> > index 19e096b..f077dc2 100644
> > --- a/arch/powerpc/kernel/misc_32.S
> > +++ b/arch/powerpc/kernel/misc_32.S
> > @@ -657,6 +657,17 @@ _GLOBAL(__ucmpdi2)
> > li r3,2
> > blr
> >
> > +_GLOBAL(__bswapdi2)
> > + rlwinm 10,4,8,0xffffffff
> > + rlwinm 11,3,8,0xffffffff
> > + rlwimi 10,4,24,0,7
> > + rlwimi 11,3,24,0,7
> > + rlwimi 10,4,24,16,23
> > + rlwimi 11,3,24,16,23
> > + mr 4,11
> > + mr 3,10
> > + blr
> > +
>
> This doesn't work for me but the below does:
>
> _GLOBAL(__bswapdi2)
> rotlwi r9,r4,8
> rotlwi r10,r3,8
> rlwimi r9,r4,24,0,7
> rlwimi r10,r3,24,0,7
> rlwimi r9,r4,24,16,23
> rlwimi r10,r3,24,16,23
> mr r4,r10
> mr r3,r9
> blr
>
Actually, I'd swap the two mr instructions to never
have an instruction that uses the result from the
previous one.
> stolen from GCC -02 output of:
> unsigned long long __bswapdi2(unsigned long long x)
> {
> return ((x & 0x00000000000000ffULL) << 56) |
> ((x & 0x000000000000ff00ULL) << 40) |
> ((x & 0x0000000000ff0000ULL) << 24) |
> ((x & 0x00000000ff000000ULL) << 8) |
> ((x & 0x000000ff00000000ULL) >> 8) |
> ((x & 0x0000ff0000000000ULL) >> 24) |
> ((x & 0x00ff000000000000ULL) >> 40) |
> ((x & 0xff00000000000000ULL) >> 56);
> }
>
> > _GLOBAL(abs)
> > srawi r4,r3,31
> > xor r3,r3,r4
> > diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
> > index 5cfa800..3b2e6e8 100644
> > --- a/arch/powerpc/kernel/misc_64.S
> > +++ b/arch/powerpc/kernel/misc_64.S
> > @@ -234,6 +234,18 @@ _GLOBAL(__flush_dcache_icache)
> > isync
> > blr
> >
> > +_GLOBAL(__bswapdi2)
> > + srdi 8,3,32
> > + rlwinm 7,3,8,0xffffffff
> > + rlwimi 7,3,24,0,7
> > + rlwinm 9,8,8,0xffffffff
> > + rlwimi 7,3,24,16,23
> > + rlwimi 9,8,24,0,7
> > + rlwimi 9,8,24,16,23
> > + sldi 7,7,32
> > + or 7,7,9
> > + mr 3,7
> > + blr
>
> This works but we should add "r" to the register names.
>
And merge the last two instructions as a single "or r3,r7,r9".
Gabriel
^ permalink raw reply
* Re: [RFC PATCH v3 2/5] powerpc: Exception hooks for context tracking subsystem
From: Li Zhong @ 2013-05-13 8:44 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: fweisbec, linux-kernel, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368424667.19924.26.camel@pasglop>
On Mon, 2013-05-13 at 15:57 +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2013-05-13 at 13:21 +0800, Li Zhong wrote:
> > int recover = 0;
> > + enum ctx_state prev_state;
> > +
> > + prev_state = exception_enter();
>
> Please make it nicer:
>
> enum ctx_state prev_state = exception_enter();
> int recover = 0;
OK, I'll fix it, and all the others.
> > __get_cpu_var(irq_stat).mce_exceptions++;
> >
> > @@ -683,7 +687,7 @@ void machine_check_exception(struct pt_regs *regs)
> > recover = cur_cpu_spec->machine_check(regs);
> >
> > if (recover > 0)
> > - return;
> > + goto exit;
>
> I'm no fan of "exit" as a label as it's otherwise a libc function (I
> know there is no relationship here but I just find that annoying).
>
> I usually use "bail"
OK, I'll fix it, and all the others.
>
> > #if defined(CONFIG_8xx) && defined(CONFIG_PCI)
> > /* the qspan pci read routines can cause machine checks -- Cort
> > @@ -693,20 +697,23 @@ void machine_check_exception(struct pt_regs *regs)
> > * -- BenH
> > */
> > bad_page_fault(regs, regs->dar, SIGBUS);
> > - return;
> > + goto exit;
> > #endif
> >
> > if (debugger_fault_handler(regs))
> > - return;
> > + goto exit;
> >
> > if (check_io_access(regs))
> > - return;
> > + goto exit;
> >
> > die("Machine check", regs, SIGBUS);
> >
> > /* Must die if the interrupt is not recoverable */
> > if (!(regs->msr & MSR_RI))
> > panic("Unrecoverable Machine check");
> > +
> > +exit:
> > + exception_exit(prev_state);
> > }
> >
> > void SMIException(struct pt_regs *regs)
> > @@ -716,20 +723,31 @@ void SMIException(struct pt_regs *regs)
> >
> > void unknown_exception(struct pt_regs *regs)
> > {
> > + enum ctx_state prev_state;
> > + prev_state = exception_enter();
> > +
>
> Same cosmetic comment for all other cases
>
> ..../...
>
> > #include <asm/firmware.h>
> > #include <asm/page.h>
> > @@ -193,8 +194,8 @@ static int mm_fault_error(struct pt_regs *regs, unsigned long addr, int fault)
> > * The return value is 0 if the fault was handled, or the signal
> > * number if this is a kernel fault that can't be handled here.
> > */
> > -int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
> > - unsigned long error_code)
> > +static int __kprobes __do_page_fault(struct pt_regs *regs,
> > + unsigned long address, unsigned long error_code)
> > {
> > struct vm_area_struct * vma;
> > struct mm_struct *mm = current->mm;
> > @@ -475,6 +476,17 @@ bad_area_nosemaphore:
> >
> > }
> >
> > +int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
> > + unsigned long error_code)
> > +{
> > + int ret;
> > + enum ctx_state prev_state;
> > + prev_state = exception_enter();
> > + ret = __do_page_fault(regs, address, error_code);
> > + exception_exit(prev_state);
> > + return ret;
> > +}
>
> Any reason why you didn't use the same wrapping trick in traps.c ? I'd
> rather we stay consistent in the way we do things between the two files.
OK, I'll make it consistent with those in traps.c
>
> > /*
> > * bad_page_fault is called when we have a bad access from the kernel.
> > * It is called from the DSI and ISI handlers in head.S and from some
> > diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
> > index 88ac0ee..d92fb26 100644
> > --- a/arch/powerpc/mm/hash_utils_64.c
> > +++ b/arch/powerpc/mm/hash_utils_64.c
> > @@ -33,6 +33,7 @@
> > #include <linux/init.h>
> > #include <linux/signal.h>
> > #include <linux/memblock.h>
> > +#include <linux/context_tracking.h>
> >
> > #include <asm/processor.h>
> > #include <asm/pgtable.h>
> > @@ -962,6 +963,9 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> > const struct cpumask *tmp;
> > int rc, user_region = 0, local = 0;
> > int psize, ssize;
> > + enum ctx_state prev_state;
> > +
> > + prev_state = exception_enter();
> >
> > DBG_LOW("hash_page(ea=%016lx, access=%lx, trap=%lx\n",
> > ea, access, trap);
> > @@ -973,7 +977,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> > mm = current->mm;
> > if (! mm) {
> > DBG_LOW(" user region with no mm !\n");
> > - return 1;
> > + rc = 1;
> > + goto exit;
> > }
> > psize = get_slice_psize(mm, ea);
> > ssize = user_segment_size(ea);
> > @@ -992,19 +997,23 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> > /* Not a valid range
> > * Send the problem up to do_page_fault
> > */
> > - return 1;
> > + rc = 1;
> > + goto exit;
> > }
> > DBG_LOW(" mm=%p, mm->pgdir=%p, vsid=%016lx\n", mm, mm->pgd, vsid);
> >
> > /* Bad address. */
> > if (!vsid) {
> > DBG_LOW("Bad address!\n");
> > - return 1;
> > + rc = 1;
> > + goto exit;
> > }
> > /* Get pgdir */
> > pgdir = mm->pgd;
> > - if (pgdir == NULL)
> > - return 1;
> > + if (pgdir == NULL) {
> > + rc = 1;
> > + goto exit;
> > + }
> >
> > /* Check CPU locality */
> > tmp = cpumask_of(smp_processor_id());
> > @@ -1027,7 +1036,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> > ptep = find_linux_pte_or_hugepte(pgdir, ea, &hugeshift);
> > if (ptep == NULL || !pte_present(*ptep)) {
> > DBG_LOW(" no PTE !\n");
> > - return 1;
> > + rc = 1;
> > + goto exit;
> > }
> >
> > /* Add _PAGE_PRESENT to the required access perm */
> > @@ -1038,13 +1048,16 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> > */
> > if (access & ~pte_val(*ptep)) {
> > DBG_LOW(" no access !\n");
> > - return 1;
> > + rc = 1;
> > + goto exit;
> > }
> >
> > #ifdef CONFIG_HUGETLB_PAGE
> > - if (hugeshift)
> > - return __hash_page_huge(ea, access, vsid, ptep, trap, local,
> > + if (hugeshift) {
> > + rc = __hash_page_huge(ea, access, vsid, ptep, trap, local,
> > ssize, hugeshift, psize);
> > + goto exit;
> > + }
> > #endif /* CONFIG_HUGETLB_PAGE */
> >
> > #ifndef CONFIG_PPC_64K_PAGES
> > @@ -1124,6 +1137,8 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
> > pte_val(*(ptep + PTRS_PER_PTE)));
> > #endif
> > DBG_LOW(" -> rc=%d\n", rc);
> > +exit:
> > + exception_exit(prev_state);
> > return rc;
> > }
> > EXPORT_SYMBOL_GPL(hash_page);
> > @@ -1259,6 +1274,9 @@ void flush_hash_range(unsigned long number, int local)
> > */
> > void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc)
> > {
> > + enum ctx_state prev_state;
> > + prev_state = exception_enter();
> > +
> > if (user_mode(regs)) {
> > #ifdef CONFIG_PPC_SUBPAGE_PROT
> > if (rc == -2)
> > @@ -1268,6 +1286,8 @@ void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc)
> > _exception(SIGBUS, regs, BUS_ADRERR, address);
> > } else
> > bad_page_fault(regs, address, SIGBUS);
> > +
> > + exception_exit(prev_state);
> > }
>
> So the above comes from the return of hash page following an error, it's
> technically the same exception. I don't know if that matters however.
> Also some exceptions are directly handled in asm such as SLB misses,
> again I don't know if that matters as I'm not familiar with what the
> context tracing code is actually doing.
Yes, the above and hash_page() are two C functions for a same exception.
And the exception hooks enable RCU usage in those C codes. But for asm
codes, I think we could assume that there would be no RCU usage there,
so we don't need wrap them in the hooks.
Thanks, Zhong
>
> > long hpte_insert_repeating(unsigned long hash, unsigned long vpn,
>
> Cheers,
> Ben.
>
>
^ permalink raw reply
* Re: [RFC PATCH v3 0/5] powerpc: Support context tracking for Power pSeries
From: Benjamin Herrenschmidt @ 2013-05-13 8:59 UTC (permalink / raw)
To: Li Zhong
Cc: fweisbec, Anton Blanchard, linux-kernel, paulus, paulmck,
linuxppc-dev
In-Reply-To: <1368432193.2618.30.camel@ThinkPad-T5421>
On Mon, 2013-05-13 at 16:03 +0800, Li Zhong wrote:
>
> To my understanding, it is used to enable RCU user extended quiescent
> state, so RCU on that cpu doesn't need scheduler ticks. And together
> with some other code(already in 3.10), we are able to remove the ticks
> in some cases (e.g. only 1 task running on the cpu, with some other
> limitations).
Ok, sounds interesting. Once you fix the little cosmetic issue, I don't
see any reason not to merge them as it's basically wiring up an existing
feature (in that regard the patches are pretty straightforward) and I
assume the overhead is only there when you enable it.
Cheers,
Ben.
^ permalink raw reply
* Re: [RFC PATCH v3 2/5] powerpc: Exception hooks for context tracking subsystem
From: Benjamin Herrenschmidt @ 2013-05-13 9:06 UTC (permalink / raw)
To: Li Zhong; +Cc: fweisbec, linux-kernel, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368434680.2618.33.camel@ThinkPad-T5421>
On Mon, 2013-05-13 at 16:44 +0800, Li Zhong wrote:
> Yes, the above and hash_page() are two C functions for a same exception.
> And the exception hooks enable RCU usage in those C codes. But for asm
> codes, I think we could assume that there would be no RCU usage there,
> so we don't need wrap them in the hooks.
hash_page() won't start a new RCU, at least not in its current incarnation,
the only thing I can see it ever doing would be to take some RCU read locks one
day (it doesn't today).
low_hash_fault() is a different beast. It will typically kill things, thus
involving sending signals etc... RCU might well be involved.
Cheers,
Ben.
^ permalink raw reply
* Re: [RFC PATCH v3 0/5] powerpc: Support context tracking for Power pSeries
From: Li Zhong @ 2013-05-13 9:22 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: fweisbec, Anton Blanchard, linux-kernel, paulus, paulmck,
linuxppc-dev
In-Reply-To: <1368435563.19924.28.camel@pasglop>
On Mon, 2013-05-13 at 18:59 +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2013-05-13 at 16:03 +0800, Li Zhong wrote:
> >
> > To my understanding, it is used to enable RCU user extended quiescent
> > state, so RCU on that cpu doesn't need scheduler ticks. And together
> > with some other code(already in 3.10), we are able to remove the ticks
> > in some cases (e.g. only 1 task running on the cpu, with some other
> > limitations).
>
> Ok, sounds interesting. Once you fix the little cosmetic issue, I don't
> see any reason not to merge them as it's basically wiring up an existing
> feature (in that regard the patches are pretty straightforward) and I
> assume the overhead is only there when you enable it.
Thanks for your support, Ben.
Yes, there should be no overhead if not enabled.
Thanks, Zhong
>
> Cheers,
> Ben.
>
>
^ permalink raw reply
* Re: [RFC PATCH v3 2/5] powerpc: Exception hooks for context tracking subsystem
From: Li Zhong @ 2013-05-13 9:46 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: fweisbec, linux-kernel, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368435991.19924.35.camel@pasglop>
On Mon, 2013-05-13 at 19:06 +1000, Benjamin Herrenschmidt wrote:
> On Mon, 2013-05-13 at 16:44 +0800, Li Zhong wrote:
> > Yes, the above and hash_page() are two C functions for a same exception.
> > And the exception hooks enable RCU usage in those C codes. But for asm
> > codes, I think we could assume that there would be no RCU usage there,
> > so we don't need wrap them in the hooks.
>
> hash_page() won't start a new RCU, at least not in its current incarnation,
> the only thing I can see it ever doing would be to take some RCU read locks one
> day (it doesn't today).
Seems I added the hooks because of the trace point of hcall
entry/exit ...
Thanks, Zhong
>
> low_hash_fault() is a different beast. It will typically kill things, thus
> involving sending signals etc... RCU might well be involved.
>
> Cheers,
> Ben.
>
>
^ permalink raw reply
* Re: [RFC PATCH v3 2/5] powerpc: Exception hooks for context tracking subsystem
From: Benjamin Herrenschmidt @ 2013-05-13 10:01 UTC (permalink / raw)
To: Li Zhong; +Cc: fweisbec, linux-kernel, paulus, paulmck, linuxppc-dev
In-Reply-To: <1368438380.2618.52.camel@ThinkPad-T5421>
On Mon, 2013-05-13 at 17:46 +0800, Li Zhong wrote:
> > hash_page() won't start a new RCU, at least not in its current incarnation,
> > the only thing I can see it ever doing would be to take some RCU read locks one
> > day (it doesn't today).
>
> Seems I added the hooks because of the trace point of hcall
> entry/exit ...
Oh I see, and trace points use RCU ... ok, leave it there then.
Cheers,
Ben.
^ permalink raw reply
* [PATCH v3] powerpc: provide __bswapdi2
From: Michael Neuling @ 2013-05-13 10:23 UTC (permalink / raw)
To: Benjamin Herrenschmidt
Cc: mikey, David Woodhouse, linuxppc-dev, viro, David Woodhouse
In-Reply-To: <20130513073319.GA5886@visitor2.iram.es>
From: David Woodhouse <David.Woodhouse@intel.com>
Some versions of GCC apparently expect this to be provided by libgcc.
Updates from Mikey to fix 32 bit version and adding "r" to registers.
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
---
Fixes from Gabriel.
arch/powerpc/kernel/misc_32.S | 11 +++++++++++
arch/powerpc/kernel/misc_64.S | 11 +++++++++++
arch/powerpc/kernel/ppc_ksyms.c | 3 ++-
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 19e096b..e469f30 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -657,6 +657,17 @@ _GLOBAL(__ucmpdi2)
li r3,2
blr
+_GLOBAL(__bswapdi2)
+ rotlwi r9,r4,8
+ rotlwi r10,r3,8
+ rlwimi r9,r4,24,0,7
+ rlwimi r10,r3,24,0,7
+ rlwimi r9,r4,24,16,23
+ rlwimi r10,r3,24,16,23
+ mr r3,r9
+ mr r4,r10
+ blr
+
_GLOBAL(abs)
srawi r4,r3,31
xor r3,r3,r4
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index 5cfa800..6820e45 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -234,6 +234,17 @@ _GLOBAL(__flush_dcache_icache)
isync
blr
+_GLOBAL(__bswapdi2)
+ srdi r8,r3,32
+ rlwinm r7,r3,8,0xffffffff
+ rlwimi r7,r3,24,0,7
+ rlwinm r9,r8,8,0xffffffff
+ rlwimi r7,r3,24,16,23
+ rlwimi r9,r8,24,0,7
+ rlwimi r9,r8,24,16,23
+ sldi r7,r7,32
+ or r3,r7,r9
+ blr
#if defined(CONFIG_PPC_PMAC) || defined(CONFIG_PPC_MAPLE)
/*
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 78b8766..c296665 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -143,7 +143,8 @@ EXPORT_SYMBOL(__lshrdi3);
int __ucmpdi2(unsigned long long, unsigned long long);
EXPORT_SYMBOL(__ucmpdi2);
#endif
-
+long long __bswapdi2(long long);
+EXPORT_SYMBOL(__bswapdi2);
EXPORT_SYMBOL(memcpy);
EXPORT_SYMBOL(memset);
EXPORT_SYMBOL(memmove);
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH] powerpc: provide __bswapdi2
From: David Woodhouse @ 2013-05-13 10:27 UTC (permalink / raw)
To: Alan Modra; +Cc: linuxppc-dev, Anton Blanchard, viro
In-Reply-To: <20130513072013.GD5221@bubble.grove.modra.org>
[-- Attachment #1: Type: text/plain, Size: 480 bytes --]
On Mon, 2013-05-13 at 16:50 +0930, Alan Modra wrote:
> I did a little digging, and it looks like gcc-4.4 will emit __bswapdi2
> calls. Support in rs6000.md appeared 2009-06-25.
That's where it was seen. I don't have anything that ancient any more so
it didn't show up in my testing, but Al saw it on a Debian system.
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5745 bytes --]
^ permalink raw reply
* Re: [PATCH] powerpc: provide __bswapdi2
From: David Woodhouse @ 2013-05-13 10:33 UTC (permalink / raw)
To: Michael Neuling; +Cc: linuxppc-dev, viro
In-Reply-To: <9813.1368428999@ale.ozlabs.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1092 bytes --]
On Mon, 2013-05-13 at 17:09 +1000, Michael Neuling wrote:
>
> This doesn't work for me but the below does:
...
>
> stolen from GCC -02 output of:
> unsigned long long __bswapdi2(unsigned long long x)
Hm, so was mine:
[dwmw2@i7 ~]$ powerpc64-linux-gnu-gcc -O2 -S -o- bswapdi2.c -m32
.file "bswapdi2.c"
.section ".text"
.align 2
.p2align 4,,15
.globl __bswapdi2
.type __bswapdi2, @function
__bswapdi2:
rlwinm 10,4,8,0xffffffff
rlwinm 11,3,8,0xffffffff
rlwimi 10,4,24,0,7
rlwimi 11,3,24,0,7
rlwimi 10,4,24,16,23
rlwimi 11,3,24,16,23
mr 4,11
mr 3,10
blr
.size __bswapdi2,.-__bswapdi2
.ident "GCC: (GNU) 4.7.2 20121105 (Red Hat 4.7.2-2.aa.20121114svn)"
On Mon, 2013-05-13 at 09:33 +0200, Gabriel Paubert wrote:
> Actually, I'd swap the two mr instructions to never
> have an instruction that uses the result from the
> previous one.
Bad GCC. No biscuit.
Should we file a PR?
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
[-- Attachment #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5745 bytes --]
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox