From 56949d414acd30353fdba4b64876a0a7953a7b77 Mon Sep 17 00:00:00 2001 From: Russell King Date: Mon, 10 Jan 2011 23:55:59 +0000 Subject: ARM: udelay: prevent math rounding resulting in short udelays We perform the microseconds to loops calculation using a number of multiplies and shift rights. Each shift right rounds down the resulting value, which can result in delays shorter than requested. Ensure that we always round up. Signed-off-by: Russell King --- arch/arm/lib/delay.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/lib/delay.S b/arch/arm/lib/delay.S index 8d6a876..3c9a05c 100644 --- a/arch/arm/lib/delay.S +++ b/arch/arm/lib/delay.S @@ -25,11 +25,15 @@ ENTRY(__udelay) ldr r2, .LC1 mul r0, r2, r0 ENTRY(__const_udelay) @ 0 <= r0 <= 0x7fffff06 + mov r1, #-1 ldr r2, .LC0 ldr r2, [r2] @ max = 0x01ffffff + add r0, r0, r1, lsr #32-14 mov r0, r0, lsr #14 @ max = 0x0001ffff + add r2, r2, r1, lsr #32-10 mov r2, r2, lsr #10 @ max = 0x00007fff mul r0, r2, r0 @ max = 2^32-1 + add r0, r0, r1, lsr #32-6 movs r0, r0, lsr #6 moveq pc, lr -- cgit v1.1 From 6426d2c2f071e0be50a22052a47b582f2561e5e0 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 11 Jan 2011 12:11:01 +0000 Subject: ARM: twd: fix display of twd frequency The fraction of MHz was not being displayed correctly as the calculation was a factor of 10 out. Fix this. Signed-off-by: Russell King --- arch/arm/kernel/smp_twd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c index dd79074..fd91566 100644 --- a/arch/arm/kernel/smp_twd.c +++ b/arch/arm/kernel/smp_twd.c @@ -114,7 +114,7 @@ static void __cpuinit twd_calibrate_rate(void) twd_timer_rate = (0xFFFFFFFFU - count) * (HZ / 5); printk("%lu.%02luMHz.\n", twd_timer_rate / 1000000, - (twd_timer_rate / 100000) % 100); + (twd_timer_rate / 1000000) % 100); } load = twd_timer_rate / HZ; -- cgit v1.1 From c0fdcfa8e9a994176ff1070dced50eeff5f6f851 Mon Sep 17 00:00:00 2001 From: Ryan Mallon Date: Mon, 10 Jan 2011 20:49:27 +0100 Subject: ARM: 6616/1: Fix ep93xx-fb init/exit annotations Fix section mismatch errors in the ep93xx-fb driver resulting from incorrect init/exit annotations. Reported-by: H Hartley Sweeten Signed-off-by: Ryan Mallon Tested-by: H Hartley Sweeten Signed-off-by: Russell King --- drivers/video/ep93xx-fb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/video/ep93xx-fb.c b/drivers/video/ep93xx-fb.c index 0c99de0..b358d04 100644 --- a/drivers/video/ep93xx-fb.c +++ b/drivers/video/ep93xx-fb.c @@ -483,7 +483,7 @@ static void ep93xxfb_dealloc_videomem(struct fb_info *info) info->screen_base, info->fix.smem_start); } -static int __init ep93xxfb_probe(struct platform_device *pdev) +static int __devinit ep93xxfb_probe(struct platform_device *pdev) { struct ep93xxfb_mach_info *mach_info = pdev->dev.platform_data; struct fb_info *info; @@ -598,7 +598,7 @@ failed: return err; } -static int ep93xxfb_remove(struct platform_device *pdev) +static int __devexit ep93xxfb_remove(struct platform_device *pdev) { struct fb_info *info = platform_get_drvdata(pdev); struct ep93xx_fbi *fbi = info->par; @@ -622,7 +622,7 @@ static int ep93xxfb_remove(struct platform_device *pdev) static struct platform_driver ep93xxfb_driver = { .probe = ep93xxfb_probe, - .remove = ep93xxfb_remove, + .remove = __devexit_p(ep93xxfb_remove), .driver = { .name = "ep93xx-fb", .owner = THIS_MODULE, -- cgit v1.1 From 1aa023b8fda8096caf41c20427a0ef396d88eb0f Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 11 Jan 2011 13:48:17 +0000 Subject: ARM: integrator: fix compile warning in cpu.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix: arch/arm/mach-integrator/cpu.c: In function ■integrator_get■: arch/arm/mach-integrator/cpu.c:164: warning: ■vco.s■ may be used uninitialized in this function Signed-off-by: Russell King --- arch/arm/mach-integrator/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mach-integrator/cpu.c b/arch/arm/mach-integrator/cpu.c index a3fbcb3a..fbb4577 100644 --- a/arch/arm/mach-integrator/cpu.c +++ b/arch/arm/mach-integrator/cpu.c @@ -173,7 +173,7 @@ static unsigned int integrator_get(unsigned int cpu) if (machine_is_integrator()) { vco.s = (cm_osc >> 8) & 7; - } else if (machine_is_cintegrator()) { + } else { vco.s = 1; } vco.v = cm_osc & 255; -- cgit v1.1 From 211baa7016894c02fc18693e21ca479cd08ac0c0 Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 11 Jan 2011 16:23:04 +0000 Subject: ARM: sched_clock: allow init_sched_clock() to be called early sched_clock is supposed to be initialized early - in the recently added init_early platform hook. However, in doing so we end up calling mod_timer() before the timer lists are initialized, resulting in an oops. Split the initialization in two - the part which the platform calls early which starts things off. The addition of the timer can be delayed until after we have more of the kernel initialized - when the normal time sources are initialized. Signed-off-by: Russell King --- arch/arm/include/asm/sched_clock.h | 2 ++ arch/arm/kernel/sched_clock.c | 7 ++++++- arch/arm/kernel/time.c | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/sched_clock.h b/arch/arm/include/asm/sched_clock.h index a84628b..c8e6ddf 100644 --- a/arch/arm/include/asm/sched_clock.h +++ b/arch/arm/include/asm/sched_clock.h @@ -115,4 +115,6 @@ static inline void init_fixed_sched_clock(struct clock_data *cd, } } +extern void sched_clock_postinit(void); + #endif diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c index 2cdcc92..784464a 100644 --- a/arch/arm/kernel/sched_clock.c +++ b/arch/arm/kernel/sched_clock.c @@ -60,10 +60,15 @@ void __init init_sched_clock(struct clock_data *cd, void (*update)(void), * sets the initial epoch. */ sched_clock_timer.data = msecs_to_jiffies(w - (w / 10)); - sched_clock_poll(sched_clock_timer.data); + update(); /* * Ensure that sched_clock() starts off at 0ns */ cd->epoch_ns = 0; } + +void __init sched_clock_postinit(void) +{ + sched_clock_poll(sched_clock_timer.data); +} diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c index f1e2eb1..3d76bf2 100644 --- a/arch/arm/kernel/time.c +++ b/arch/arm/kernel/time.c @@ -29,6 +29,7 @@ #include #include +#include #include #include #include @@ -163,5 +164,8 @@ void __init time_init(void) { system_timer = machine_desc->timer; system_timer->init(); +#ifdef CONFIG_HAVE_SCHED_CLOCK + sched_clock_postinit(); +#endif } -- cgit v1.1 From edc4d272551594729f63ca4cde1612608494091f Mon Sep 17 00:00:00 2001 From: Russell King Date: Tue, 11 Jan 2011 16:44:02 +0000 Subject: ARM: sched_clock: make minsec argument to clocks_calc_mult_shift() zero The purpose of the minsec argument is to prevent 64-bit math overflow when the number of cycles is multiplied up. However, the multipler is 32-bit, and in the sched_clock() case, the cycle counter is up to 32-bit as well. So the math can never overflow. With a value of 60, and clock rates greater than 71MHz, the calculated multiplier is unnecessarily reduced in value, which reduces accuracy by maybe 70ppt. It's almost not worth bothering with as the oscillator driving the counter won't be any more than 1ppm - unless you're using a rubidium lamp or caesium fountain frequency standard. So, set the minsec argument to zero. Signed-off-by: Russell King --- arch/arm/kernel/sched_clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/kernel/sched_clock.c b/arch/arm/kernel/sched_clock.c index 784464a..9a46370 100644 --- a/arch/arm/kernel/sched_clock.c +++ b/arch/arm/kernel/sched_clock.c @@ -34,7 +34,7 @@ void __init init_sched_clock(struct clock_data *cd, void (*update)(void), sched_clock_update_fn = update; /* calculate the mult/shift to convert counter ticks to ns. */ - clocks_calc_mult_shift(&cd->mult, &cd->shift, rate, NSEC_PER_SEC, 60); + clocks_calc_mult_shift(&cd->mult, &cd->shift, rate, NSEC_PER_SEC, 0); r = rate; if (r >= 4000000) { -- cgit v1.1 From 6cde6d4217ff01422c093d3f7ff550b7a324e96e Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Tue, 11 Jan 2011 14:04:36 +0100 Subject: ARM: 6619/1: nommu: avoid mapping vectors page when !CONFIG_MMU When running without an MMU, we do not need to install a mapping for the vectors page. Attempting to do so causes a compile-time error because install_special_mapping is not defined. This patch adds compile-time guards to the vector mapping functions so that we can build nommu configurations once more. Acked-by: Greg Ungerer Signed-off-by: Will Deacon Signed-off-by: Russell King --- arch/arm/kernel/process.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index e76fcaa..94bbedb 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -483,6 +483,7 @@ unsigned long arch_randomize_brk(struct mm_struct *mm) return randomize_range(mm->brk, range_end, 0) ? : mm->brk; } +#ifdef CONFIG_MMU /* * The vectors page is always readable from user space for the * atomic helpers and the signal restart code. Let's declare a mapping @@ -503,3 +504,4 @@ const char *arch_vma_name(struct vm_area_struct *vma) { return (vma->vm_start == 0xffff0000) ? "[vectors]" : NULL; } +#endif -- cgit v1.1 From 22eeb8f6e0214a83ac6958a29a83572137f174bb Mon Sep 17 00:00:00 2001 From: Alexander Holler Date: Wed, 12 Jan 2011 14:08:37 +0100 Subject: ARM: 6620/1: Change misleading warning when CONFIG_CMDLINE_FORCE is used When CONFIG_CMDLINE_FORCE is used, the warning Ignoring unrecognised tag 0x54410009 was displayed. Change this to Ignoring tag cmdline (using the default kernel command line) Signed-off-by: Alexander Holler Signed-off-by: Russell King --- arch/arm/kernel/setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 3455ad3..7c54e11 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -650,15 +650,17 @@ static int __init parse_tag_revision(const struct tag *tag) __tagtable(ATAG_REVISION, parse_tag_revision); -#ifndef CONFIG_CMDLINE_FORCE static int __init parse_tag_cmdline(const struct tag *tag) { +#ifndef CONFIG_CMDLINE_FORCE strlcpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE); +#else + pr_warning("Ignoring tag cmdline (using the default kernel command line)\n"); +#endif /* CONFIG_CMDLINE_FORCE */ return 0; } __tagtable(ATAG_CMDLINE, parse_tag_cmdline); -#endif /* CONFIG_CMDLINE_FORCE */ /* * Scan the tag table for this tag, and call its parse function. -- cgit v1.1 From e163d529ad7ab449db36ee88dab16170de711f34 Mon Sep 17 00:00:00 2001 From: Rabin Vincent Date: Wed, 12 Jan 2011 14:38:52 +0100 Subject: ARM: 6621/1: bitops: remove condition code clobber for CLZ The CLZ instruction does not alter the condition flags, so remove the "cc" clobber from the inline asm for fls(). Acked-by: Nicolas Pitre Signed-off-by: Rabin Vincent Signed-off-by: Russell King --- arch/arm/include/asm/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index 338ff19..7b1bb2b 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -285,7 +285,7 @@ static inline int fls(int x) if (__builtin_constant_p(x)) return constant_fls(x); - asm("clz\t%0, %1" : "=r" (ret) : "r" (x) : "cc"); + asm("clz\t%0, %1" : "=r" (ret) : "r" (x)); ret = 32 - ret; return ret; } -- cgit v1.1 From 0adfca6ff2131c7c67dffe094611097bbc9f5005 Mon Sep 17 00:00:00 2001 From: Linus Walleij Date: Wed, 12 Jan 2011 18:50:37 +0100 Subject: ARM: 6622/1: fix dma_unmap_sg() documentation The kerneldoc for this function is at odds with the DMA-API document, which holds, so fix it. Signed-off-by: Linus Walleij Signed-off-by: Russell King --- arch/arm/mm/dma-mapping.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 6b48e0a..4771dba 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -577,7 +577,7 @@ EXPORT_SYMBOL(dma_map_sg); * dma_unmap_sg - unmap a set of SG buffers mapped by dma_map_sg * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices * @sg: list of buffers - * @nents: number of buffers to unmap (returned from dma_map_sg) + * @nents: number of buffers to unmap (same as was passed to dma_map_sg) * @dir: DMA transfer direction (same as was passed to dma_map_sg) * * Unmap a set of streaming mode DMA translations. Again, CPU access -- cgit v1.1 From 874d5d3ccc04c0659b76b05ee0c761f568062cb1 Mon Sep 17 00:00:00 2001 From: Dave Martin Date: Fri, 14 Jan 2011 00:43:01 +0100 Subject: ARM: 6623/1: Thumb-2: Fix out-of-range offset for Thumb-2 in proc-v7.S Commit d30e45e (ARM: pgtable: switch order of Linux vs hardware page tables) introduced a pre-increment addressing offset which is out of range for Thumb-2. Thumb-2 only permits offsets <256. So split the intruction in two for Thumb-2. Signed-off-by: Dave Martin Signed-off-by: Russell King --- arch/arm/mm/proc-v7.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index b49fab2..0c1172b 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -159,7 +159,9 @@ ENTRY(cpu_v7_set_pte_ext) tstne r1, #L_PTE_PRESENT moveq r3, #0 - str r3, [r0, #2048]! + ARM( str r3, [r0, #2048]! ) + THUMB( add r0, r0, #2048 ) + THUMB( str r3, [r0] ) mcr p15, 0, r0, c7, c10, 1 @ flush_pte #endif mov pc, lr -- cgit v1.1 From 4d2692a736c95240100755ba98b2403e11f12e06 Mon Sep 17 00:00:00 2001 From: Nicolas Pitre Date: Fri, 14 Jan 2011 07:33:24 +0100 Subject: ARM: 6624/1: fix dependency for CONFIG_SMP_ON_UP This depends on !XIP_KERNEL and not !XIP. Signed-off-by: Nicolas Pitre Signed-off-by: Russell King --- arch/arm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a3fb23b..53ea547 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -1275,7 +1275,7 @@ config SMP config SMP_ON_UP bool "Allow booting SMP kernel on uniprocessor systems (EXPERIMENTAL)" depends on EXPERIMENTAL - depends on SMP && !XIP + depends on SMP && !XIP_KERNEL default y help SMP kernels contain instructions which fail on non-SMP processors. -- cgit v1.1 From 30b99d07b7e08d0e6bcc2f0b924828c03e67f881 Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 14 Jan 2011 12:06:26 +0000 Subject: ARM: fix wrongly patched constants e3d9c625 (ARM: CPU hotplug: fix hard-coded control register constants) changed the wrong constants in the hotplug assembly code. Fix this. Reported-by: viresh kumar Signed-off-by: Russell King --- arch/arm/mach-s5pv310/hotplug.c | 4 ++-- arch/arm/mach-tegra/hotplug.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-s5pv310/hotplug.c b/arch/arm/mach-s5pv310/hotplug.c index afa5392..c24235c 100644 --- a/arch/arm/mach-s5pv310/hotplug.c +++ b/arch/arm/mach-s5pv310/hotplug.c @@ -30,10 +30,10 @@ static inline void cpu_enter_lowpower(void) * Turn off coherency */ " mrc p15, 0, %0, c1, c0, 1\n" - " bic %0, %0, %2\n" + " bic %0, %0, #0x20\n" " mcr p15, 0, %0, c1, c0, 1\n" " mrc p15, 0, %0, c1, c0, 0\n" - " bic %0, %0, #0x04\n" + " bic %0, %0, %2\n" " mcr p15, 0, %0, c1, c0, 0\n" : "=&r" (v) : "r" (0), "Ir" (CR_C) diff --git a/arch/arm/mach-tegra/hotplug.c b/arch/arm/mach-tegra/hotplug.c index a5cb1ce..f329404 100644 --- a/arch/arm/mach-tegra/hotplug.c +++ b/arch/arm/mach-tegra/hotplug.c @@ -26,10 +26,10 @@ static inline void cpu_enter_lowpower(void) * Turn off coherency */ " mrc p15, 0, %0, c1, c0, 1\n" - " bic %0, %0, %2\n" + " bic %0, %0, #0x20\n" " mcr p15, 0, %0, c1, c0, 1\n" " mrc p15, 0, %0, c1, c0, 0\n" - " bic %0, %0, #0x04\n" + " bic %0, %0, %2\n" " mcr p15, 0, %0, c1, c0, 0\n" : "=&r" (v) : "r" (0), "Ir" (CR_C) -- cgit v1.1 From 11b9369cbb0a13cabb581aec3e6812a171cf2fd7 Mon Sep 17 00:00:00 2001 From: Dima Zavin Date: Fri, 14 Jan 2011 23:05:14 +0100 Subject: ARM: 6625/1: use memblock memory regions for "System RAM" I/O resources Do not use memory bank info to request the "system ram" resources as they do not track holes created by memblock_remove inside machine's reserve callback. If the removed memory is passed as platform_device's ioresource, then drivers that call request_mem_region would fail due to a conflict with the incorrectly configured system ram resource. Instead, iterate through the regions of memblock.memory and add those as "System RAM" resources. Signed-off-by: Dima Zavin Signed-off-by: Russell King --- arch/arm/kernel/setup.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c index 7c54e11..420b8d6 100644 --- a/arch/arm/kernel/setup.c +++ b/arch/arm/kernel/setup.c @@ -518,25 +518,21 @@ setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz) #endif } -static void __init -request_standard_resources(struct meminfo *mi, struct machine_desc *mdesc) +static void __init request_standard_resources(struct machine_desc *mdesc) { + struct memblock_region *region; struct resource *res; - int i; kernel_code.start = virt_to_phys(_text); kernel_code.end = virt_to_phys(_etext - 1); kernel_data.start = virt_to_phys(_sdata); kernel_data.end = virt_to_phys(_end - 1); - for (i = 0; i < mi->nr_banks; i++) { - if (mi->bank[i].size == 0) - continue; - + for_each_memblock(memory, region) { res = alloc_bootmem_low(sizeof(*res)); res->name = "System RAM"; - res->start = mi->bank[i].start; - res->end = mi->bank[i].start + mi->bank[i].size - 1; + res->start = __pfn_to_phys(memblock_region_memory_base_pfn(region)); + res->end = __pfn_to_phys(memblock_region_memory_end_pfn(region)) - 1; res->flags = IORESOURCE_MEM | IORESOURCE_BUSY; request_resource(&iomem_resource, res); @@ -859,7 +855,7 @@ void __init setup_arch(char **cmdline_p) arm_memblock_init(&meminfo, mdesc); paging_init(mdesc); - request_standard_resources(&meminfo, mdesc); + request_standard_resources(mdesc); #ifdef CONFIG_SMP if (is_smp()) -- cgit v1.1 From 671289c2872cfc050954ac1dd3131429fca30aad Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 15 Jan 2011 00:14:25 +0000 Subject: ARM: Fix build regression on SA11x0, PXA, and H720x targets Build errors similar this appeared in todays kautobuild for the above targets: In file included from arch/arm/include/asm/pgtable.h:461, from arch/arm/mach-pxa/generic.c:26: include/asm-generic/pgtable.h: In function 'ptep_test_and_clear_young': include/asm-generic/pgtable.h:29: error: dereferencing pointer to incomplete type None of the .c files including asm/pgtable.h with this error is using this header, so simply remove the include. Signed-off-by: Russell King --- arch/arm/mach-h720x/h7201-eval.c | 1 - arch/arm/mach-h720x/h7202-eval.c | 1 - arch/arm/mach-pxa/generic.c | 1 - arch/arm/mach-sa1100/generic.c | 1 - 4 files changed, 4 deletions(-) diff --git a/arch/arm/mach-h720x/h7201-eval.c b/arch/arm/mach-h720x/h7201-eval.c index 79f0b89..629454d 100644 --- a/arch/arm/mach-h720x/h7201-eval.c +++ b/arch/arm/mach-h720x/h7201-eval.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include "common.h" diff --git a/arch/arm/mach-h720x/h7202-eval.c b/arch/arm/mach-h720x/h7202-eval.c index cc28b1e..e9f46b6 100644 --- a/arch/arm/mach-h720x/h7202-eval.c +++ b/arch/arm/mach-h720x/h7202-eval.c @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c index d6e15f7..f5d91ef 100644 --- a/arch/arm/mach-pxa/generic.c +++ b/arch/arm/mach-pxa/generic.c @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c index 59d14f0..e21f347 100644 --- a/arch/arm/mach-sa1100/generic.c +++ b/arch/arm/mach-sa1100/generic.c @@ -21,7 +21,6 @@ #include #include #include -#include #include #include #include -- cgit v1.1 From d5996b2ff0e26cf7ed4c103084a2d6fc569e7216 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 15 Jan 2011 09:27:04 +0000 Subject: ARM: fix /proc/$PID/stack on SMP Rabin Vincent reports: | On SMP, this BUG() in save_stack_trace_tsk() can be easily triggered | from user space by reading /proc/$PID/stack, where $PID is any pid but | the current process: | | if (tsk != current) { | #ifdef CONFIG_SMP | /* | * What guarantees do we have here that 'tsk' | * is not running on another CPU? | */ | BUG(); | #else Fix this by replacing the BUG() with an entry to terminate the stack trace, returning an empty trace - I'd rather not expose the dwarf unwinder to a volatile stack of a running thread. Reported-by: Rabin Vincent Tested-by: Rabin Vincent Signed-off-by: Russell King --- arch/arm/kernel/stacktrace.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/arm/kernel/stacktrace.c b/arch/arm/kernel/stacktrace.c index c2e112e..381d23a 100644 --- a/arch/arm/kernel/stacktrace.c +++ b/arch/arm/kernel/stacktrace.c @@ -94,10 +94,13 @@ void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) if (tsk != current) { #ifdef CONFIG_SMP /* - * What guarantees do we have here that 'tsk' - * is not running on another CPU? + * What guarantees do we have here that 'tsk' is not + * running on another CPU? For now, ignore it as we + * can't guarantee we won't explode. */ - BUG(); + if (trace->nr_entries < trace->max_entries) + trace->entries[trace->nr_entries++] = ULONG_MAX; + return; #else data.no_sched_functions = 1; frame.fp = thread_saved_fp(tsk); -- cgit v1.1 From cb4d3eaebb96616085f5a46a7d7e004ddd955b09 Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 15 Jan 2011 11:19:19 +0000 Subject: ARM: fix missing branch in __error_a When DEBUG_LL is not set, we don't want __error_a re-entering __lookup_machine_type - we want it to go to the error function. This used to be the case before we reorganized the layout for hotplug cpu, as we used to fall through to __error. With the changed layout, we need an explicit branch here instead. Signed-off-by: Russell King --- arch/arm/kernel/head-common.S | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/kernel/head-common.S b/arch/arm/kernel/head-common.S index bbecaac..8f57515 100644 --- a/arch/arm/kernel/head-common.S +++ b/arch/arm/kernel/head-common.S @@ -60,6 +60,8 @@ str_a1: .asciz "\nError: unrecognized/unsupported machine ID (r1 = 0x" str_a2: .asciz ").\n\nAvailable machine support:\n\nID (hex)\tNAME\n" str_a3: .asciz "\nPlease check your kernel config and/or bootloader.\n" .align +#else + b __error #endif /* -- cgit v1.1