From d2bf98e6fc2612cbd2fc40f75a1e2c5d60262331 Mon Sep 17 00:00:00 2001 From: "Steven J. Magnani" Date: Fri, 2 Apr 2010 13:29:39 -0500 Subject: microblaze: Fix ftrace_update_ftrace_func panic The Microblaze dynamic ftrace code assumes a call ordering that is not met in all scenarios. Specifically, executing a command similar to: echo 105 > /sys/kernel/debug/tracing/set_ftrace_pid before any other tracing-related commands results in a kernel panic: BUG: failure at arch/microblaze/kernel/ftrace.c:198/ftrace_update_ftrace_func()! Recoding ftrace_update_ftrace_func() to use &ftrace_caller directly eliminates the need to capture its address elsewhere (and thus rely on a particular call sequence). Signed-off-by: Steven J. Magnani Signed-off-by: Michal Simek diff --git a/arch/microblaze/kernel/ftrace.c b/arch/microblaze/kernel/ftrace.c index 388b31c..515feb4 100644 --- a/arch/microblaze/kernel/ftrace.c +++ b/arch/microblaze/kernel/ftrace.c @@ -151,13 +151,10 @@ int ftrace_make_nop(struct module *mod, return ret; } -static int ret_addr; /* initialized as 0 by default */ - /* I believe that first is called ftrace_make_nop before this function */ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) { int ret; - ret_addr = addr; /* saving where the barrier jump is */ pr_debug("%s: addr:0x%x, rec->ip: 0x%x, imm:0x%x\n", __func__, (unsigned int)addr, (unsigned int)rec->ip, imm); ret = ftrace_modify_code(rec->ip, imm); @@ -194,12 +191,9 @@ int ftrace_update_ftrace_func(ftrace_func_t func) ret = ftrace_modify_code(ip, upper); ret += ftrace_modify_code(ip + 4, lower); - /* We just need to remove the rtsd r15, 8 by NOP */ - BUG_ON(!ret_addr); - if (ret_addr) - ret += ftrace_modify_code(ret_addr, MICROBLAZE_NOP); - else - ret = 1; /* fault */ + /* We just need to replace the rtsd r15, 8 with NOP */ + ret += ftrace_modify_code((unsigned long)&ftrace_caller, + MICROBLAZE_NOP); /* All changes are done - lets do caches consistent */ flush_icache(); -- cgit v0.10.2 From 4bb30baa6d5e7660c06e3b50d8a8a76d402c7170 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 6 Apr 2010 18:51:37 +0200 Subject: microblaze: Fix futex code Use logical and NOT for ANDN. It was likely type fault. Signed-off-by: Michal Simek diff --git a/arch/microblaze/include/asm/futex.h b/arch/microblaze/include/asm/futex.h index 8dbb6e7..ad3fd61 100644 --- a/arch/microblaze/include/asm/futex.h +++ b/arch/microblaze/include/asm/futex.h @@ -55,7 +55,7 @@ futex_atomic_op_inuser(int encoded_op, int __user *uaddr) __futex_atomic_op("or %1,%0,%4;", ret, oldval, uaddr, oparg); break; case FUTEX_OP_ANDN: - __futex_atomic_op("and %1,%0,%4;", ret, oldval, uaddr, oparg); + __futex_atomic_op("andn %1,%0,%4;", ret, oldval, uaddr, oparg); break; case FUTEX_OP_XOR: __futex_atomic_op("xor %1,%0,%4;", ret, oldval, uaddr, oparg); -- cgit v0.10.2 From 47c4c864af60d14926f4017d23968a8341b8ab9f Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 6 Apr 2010 10:19:30 +0200 Subject: microblaze: Enable memory leak detector Enable DEBUG_KMEMLEAK for microblaze Signed-off-by: Michal Simek diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 1fafb4b..ff01710 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -356,7 +356,7 @@ config SLUB_STATS config DEBUG_KMEMLEAK bool "Kernel memory leak detector" depends on DEBUG_KERNEL && EXPERIMENTAL && !MEMORY_HOTPLUG && \ - (X86 || ARM || PPC || S390 || SUPERH) + (X86 || ARM || PPC || S390 || SUPERH || MICROBLAZE) select DEBUG_FS if SYSFS select STACKTRACE if STACKTRACE_SUPPORT -- cgit v0.10.2 From 7a325aa26cf8eb367b5d8b675a9425bef18d351a Mon Sep 17 00:00:00 2001 From: John Linn Date: Wed, 7 Apr 2010 11:03:15 +0200 Subject: microblaze: io.h: Add io big-endian function Add new io big-endian function. They will be used for uartlite and spi driver. Signed-off-by: John Linn Signed-off-by: Michal Simek diff --git a/arch/microblaze/include/asm/io.h b/arch/microblaze/include/asm/io.h index 32d621a..e45a6ee 100644 --- a/arch/microblaze/include/asm/io.h +++ b/arch/microblaze/include/asm/io.h @@ -108,6 +108,11 @@ static inline void writel(unsigned int v, volatile void __iomem *addr) #define iowrite16(v, addr) __raw_writew((u16)(v), (u16 *)(addr)) #define iowrite32(v, addr) __raw_writel((u32)(v), (u32 *)(addr)) +#define ioread16be(addr) __raw_readw((u16 *)(addr)) +#define ioread32be(addr) __raw_readl((u32 *)(addr)) +#define iowrite16be(v, addr) __raw_writew((u16)(v), (u16 *)(addr)) +#define iowrite32be(v, addr) __raw_writel((u32)(v), (u32 *)(addr)) + /* These are the definitions for the x86 IO instructions * inb/inw/inl/outb/outw/outl, the "string" versions * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions -- cgit v0.10.2 From af2b021fd6dc3e145d20f5eb927af9590c80bc44 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Wed, 7 Apr 2010 11:44:00 +0200 Subject: microblaze: Remove unused variable from ptrace Patch b3c1e01a09d6af2dd7811a066ffcfc5171be2bed should do it. Signed-off-by: Michal Simek diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c index 6d6349a..a4a7770 100644 --- a/arch/microblaze/kernel/ptrace.c +++ b/arch/microblaze/kernel/ptrace.c @@ -75,7 +75,6 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data) { int rval; unsigned long val = 0; - unsigned long copied; switch (request) { /* Read/write the word at location ADDR in the registers. */ -- cgit v0.10.2