MN10300: Discard duplicate PFN_xxx() macros
PATCH 1/5 MN10300: Discard duplicate PFN_xxx() macros
Discard duplicate PFN_xxx() macros from arch code as they're now in the general headers.
---
arch/mn10300/kernel/setup.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
arch/mn10300/kernel/setup.c +0 -4
@@ -136,10 +136,6 @@ void __init setup_arch(char **cmdline_p) data_resource.start =virt_to_bus (&_etext); data_resource.end =virt_to_bus (&_edata)-1 ; -#define PFN_UP (x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) -#define PFN_DOWN (x) ((x) >> PAGE_SHIFT) -#define PFN_PHYS (x) ((x) << PAGE_SHIFT) - start_pfn = (CONFIG_KERNEL_RAM_BASE_ADDRESS >>PAGE_SHIFT ); kstart_pfn =PFN_UP (__pa (&_text)); free_pfn =PFN_UP (__pa (&_end));
PATCH 2/5 MN10300: Wire up missing system calls
Wire up missing system calls preadv() and pwritev().
---
arch/mn10300/include/asm/unistd.h | 2 ++ arch/mn10300/kernel/entry.S | 2 ++ 2 files changed, 4 insertions(+), 0 deletions(-)
arch/mn10300/include/asm/unistd.h +2 -0
@@ -344,6 +344,8 @@#define __NR_dup3 331#define __NR_pipe2 332#define __NR_inotify_init1 333 +#define __NR_preadv 334 +#define __NR_pwritev 335#ifdef __KERNEL__
arch/mn10300/kernel/entry.S +2 -0
@@ -723,6 +723,8 @@ ENTRY(sys_call_table) .long sys_dup3 .long sys_pipe2 .long sys_inotify_init1 + .long sys_preadv + .long sys_pwritev /* 335 */ nr_syscalls=(.-sys_call_table)/4
PATCH 3/5 MN10300: Stop gcc from generating uninitialised variable warnings after BUG()
In reply to David HowellsStop gcc from generating uninitialised variable warnings after BUG(). The problem is that MN10300's implementation of BUG() invokes system call 15 which doesn't return - but there's no way to tell the compiler that and also emit the bug table element with the correct file and line data.
So instead, we make the do...while wrapper in _debug_bug_trap() an endless loop from which there's no escape.
Also, while we're at it, (1) get rid of _debug_bug_trap() and just implement directly as BUG(), and (2) make the implementation of BUG() contingent on CONFIG_BUG=y.
---
arch/mn10300/include/asm/bug.h | 10 ++++++---- 1 files changed, 6 insertions(+), 4 deletions(-)
arch/mn10300/include/asm/bug.h +6 -4
@@ -11,10 +11,12 @@#ifndef _ASM_BUG_H#define _ASM_BUG_H +#ifdef CONFIG_BUG +/* * Tell the user there is some problem. */ -#define _debug_bug_trap () \ +#define BUG () \ do { \ asm volatile( \ " syscall 15 \n" \
@@ -25,11 +27,11 @@ do { \ : \ : "i"(__FILE__), "i"(__LINE__) \ ); \ -} while (0) - -#define BUG () _debug_bug_trap() +} while (1)#define HAVE_ARCH_BUG +#endif /* CONFIG_BUG */ +#include <asm-generic/bug.h> #endif /* _ASM_BUG_H */
PATCH 4/5 The default CONFIG_BUG=n version of BUG() should have an empty do...while
In reply to David HowellsThe default CONFIG_BUG=n version of BUG() must incorporate an empty a do...while statement to avoid compilation weirdness.
---
include/asm-generic/bug.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/asm-generic/bug.h +1 -1
@@ -88,7 +88,7 @@ extern void warn_slowpath(const char *file, const int line,#else /* !CONFIG_BUG */ #ifndef HAVE_ARCH_BUG -#define BUG () +#define BUG () do {} while(0)#endif #ifndef HAVE_ARCH_BUG_ON
PATCH 5/5 RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc
In reply to David HowellsDon't try and predeclare inline funcs like this:
static inline void wait_migrated_callbacks(void)
...
static void _rcu_barrier(enum rcu_barrier type)
{
...
wait_migrated_callbacks();
}
...
static inline void wait_migrated_callbacks(void)
{
wait_event(rcu_migrate_wq, !atomic_read(&rcu_migrate_type_count));
}as it upsets some versions of gcc under some circumstances:
kernel/rcupdate.c: In function `_rcu_barrier':
kernel/rcupdate.c:125: sorry, unimplemented: inlining failed in call to 'wait_migrated_callbacks': function body not available kernel/rcupdate.c:152: sorry, unimplemented: called from here
This can be dealt with by simply putting the static variables (rcu_migrate_*) at the top, and moving the implementation of the function up so that it replaces its forward declaration.
---
kernel/rcupdate.c | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-)
kernel/rcupdate.c +8 -10
@@ -58,6 +58,10 @@ static DEFINE_MUTEX(rcu_barrier_mutex);static struct completion rcu_barrier_completion;int rcu_scheduler_active__read_mostly ; +static atomic_t rcu_migrate_type_count =ATOMIC_INIT (0 ); +static struct rcu_head rcu_migrate_head[3 ]; +static DECLARE_WAIT_QUEUE_HEAD (rcu_migrate_wq); +/* * Awaken the corresponding synchronize_rcu() instance now that a * grace period has elapsed.
@@ -122,7 +126,10 @@ static void rcu_barrier_func(void *type) } } -static inline void wait_migrated_callbacks (void ); +static inline void wait_migrated_callbacks (void ) +{ +wait_event (rcu_migrate_wq, !atomic_read (&rcu_migrate_type_count)); +}/* * Orchestrate the specified type of RCU barrier, waiting for all
@@ -179,21 +186,12 @@ void rcu_barrier_sched(void) }EXPORT_SYMBOL_GPL (rcu_barrier_sched); -static atomic_t rcu_migrate_type_count =ATOMIC_INIT (0 ); -static struct rcu_head rcu_migrate_head[3 ]; -static DECLARE_WAIT_QUEUE_HEAD (rcu_migrate_wq); -static void rcu_migrate_callback (struct rcu_head *notused) {if (atomic_dec_and_test (&rcu_migrate_type_count))wake_up (&rcu_migrate_wq); } -static inline void wait_migrated_callbacks (void ) -{ -wait_event (rcu_migrate_wq, !atomic_read (&rcu_migrate_type_count)); -} -static int __cpuinit rcu_barrier_cpu_hotplug (struct notifier_block *self,unsigned long action,void *hcpu) {
Re: [PATCH 5/5] RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc
Quoted 17 lines · David Howells
Don't try and predeclare inline funcs like this:
static inline void wait_migrated_callbacks(void) ... static void _rcu_barrier(enum rcu_barrier type) { ... wait_migrated_callbacks(); } ... static inline void wait_migrated_callbacks(void) { wait_event(rcu_migrate_wq, !atomic_read(&rcu_migrate_type_count)); }as it upsets some versions of gcc under some circumstances:
Quoted 7 lines
kernel/rcupdate.c: In function `_rcu_barrier':
kernel/rcupdate.c:125: sorry, unimplemented: inlining failed in call to 'wait_migrated_callbacks': function body not availablekernel/rcupdate.c:152: sorry, unimplemented: called from hereThis can be dealt with by simply putting the static variables (rcu_migrate_*) at the top, and moving the implementation of the function up so that it replaces its forward declaration.
Looks good to me!
Quoted 59 lines
Signed-off-by David Howells <[email protected]>Cc Dipankar Sarma <[email protected]>Cc Paul E. McKenney <[email protected]>---
kernel/rcupdate.c | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-)kernel/rcupdate.c +8
-10@@ -58,6 +58,10 @@ static DEFINE_MUTEX(rcu_barrier_mutex);static struct completion rcu_barrier_completion;int rcu_scheduler_active__read_mostly ; +static atomic_t rcu_migrate_type_count =ATOMIC_INIT (0 ); +static struct rcu_head rcu_migrate_head[3 ]; +static DECLARE_WAIT_QUEUE_HEAD (rcu_migrate_wq); +/* * Awaken the corresponding synchronize_rcu() instance now that a * grace period has elapsed. @@ -122,7 +126,10 @@ static void rcu_barrier_func(void *type) } } -static inline void wait_migrated_callbacks (void ); +static inline void wait_migrated_callbacks (void ) +{ +wait_event (rcu_migrate_wq, !atomic_read (&rcu_migrate_type_count)); +}/* * Orchestrate the specified type of RCU barrier, waiting for all @@ -179,21 +186,12 @@ void rcu_barrier_sched(void) }EXPORT_SYMBOL_GPL (rcu_barrier_sched); -static atomic_t rcu_migrate_type_count =ATOMIC_INIT (0 ); -static struct rcu_head rcu_migrate_head[3 ]; -static DECLARE_WAIT_QUEUE_HEAD (rcu_migrate_wq); -static void rcu_migrate_callback (struct rcu_head *notused) {if (atomic_dec_and_test (&rcu_migrate_type_count))wake_up (&rcu_migrate_wq); } -static inline void wait_migrated_callbacks (void ) -{ -wait_event (rcu_migrate_wq, !atomic_read (&rcu_migrate_type_count)); -} -static int __cpuinit rcu_barrier_cpu_hotplug (struct notifier_block *self,unsigned long action,void *hcpu) {