All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] MN10300: Discard duplicate PFN_xxx() macros
@ 2009-04-15 18:34 David Howells
  2009-04-15 18:34 ` [PATCH 2/5] MN10300: Wire up missing system calls David Howells
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: David Howells @ 2009-04-15 18:34 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, David Howells

Discard duplicate PFN_xxx() macros from arch code as they're now in the
general headers.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/mn10300/kernel/setup.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)


diff --git a/arch/mn10300/kernel/setup.c b/arch/mn10300/kernel/setup.c
index 71414e1..79890ed 100644
--- a/arch/mn10300/kernel/setup.c
+++ b/arch/mn10300/kernel/setup.c
@@ -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));


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] MN10300: Wire up missing system calls
  2009-04-15 18:34 [PATCH 1/5] MN10300: Discard duplicate PFN_xxx() macros David Howells
@ 2009-04-15 18:34 ` David Howells
  2009-04-15 18:34 ` [PATCH 3/5] MN10300: Stop gcc from generating uninitialised variable warnings after BUG() David Howells
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2009-04-15 18:34 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, David Howells

Wire up missing system calls preadv() and pwritev().

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/mn10300/include/asm/unistd.h |    2 ++
 arch/mn10300/kernel/entry.S       |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/arch/mn10300/include/asm/unistd.h b/arch/mn10300/include/asm/unistd.h
index 543a4f9..fef5b43 100644
--- a/arch/mn10300/include/asm/unistd.h
+++ b/arch/mn10300/include/asm/unistd.h
@@ -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__
 
diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
index 34ab5a2..3dc3e46 100644
--- a/arch/mn10300/kernel/entry.S
+++ b/arch/mn10300/kernel/entry.S
@@ -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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] MN10300: Stop gcc from generating uninitialised variable warnings after BUG()
  2009-04-15 18:34 [PATCH 1/5] MN10300: Discard duplicate PFN_xxx() macros David Howells
  2009-04-15 18:34 ` [PATCH 2/5] MN10300: Wire up missing system calls David Howells
@ 2009-04-15 18:34 ` David Howells
  2009-04-15 18:34 ` [PATCH 4/5] The default CONFIG_BUG=n version of BUG() should have an empty do...while David Howells
  2009-04-15 18:35 ` [PATCH 5/5] RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc David Howells
  3 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2009-04-15 18:34 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, David Howells

Stop 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.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 arch/mn10300/include/asm/bug.h |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)


diff --git a/arch/mn10300/include/asm/bug.h b/arch/mn10300/include/asm/bug.h
index 4fcf338..aa6a388 100644
--- a/arch/mn10300/include/asm/bug.h
+++ b/arch/mn10300/include/asm/bug.h
@@ -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 */


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] The default CONFIG_BUG=n version of BUG() should have an empty do...while
  2009-04-15 18:34 [PATCH 1/5] MN10300: Discard duplicate PFN_xxx() macros David Howells
  2009-04-15 18:34 ` [PATCH 2/5] MN10300: Wire up missing system calls David Howells
  2009-04-15 18:34 ` [PATCH 3/5] MN10300: Stop gcc from generating uninitialised variable warnings after BUG() David Howells
@ 2009-04-15 18:34 ` David Howells
  2009-04-15 18:35 ` [PATCH 5/5] RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc David Howells
  3 siblings, 0 replies; 6+ messages in thread
From: David Howells @ 2009-04-15 18:34 UTC (permalink / raw)
  To: torvalds, akpm; +Cc: linux-kernel, David Howells

The default CONFIG_BUG=n version of BUG() must incorporate an empty a
do...while statement to avoid compilation weirdness.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/asm-generic/bug.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/include/asm-generic/bug.h b/include/asm-generic/bug.h
index 37b82cb..e727fe0 100644
--- a/include/asm-generic/bug.h
+++ b/include/asm-generic/bug.h
@@ -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


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc
  2009-04-15 18:34 [PATCH 1/5] MN10300: Discard duplicate PFN_xxx() macros David Howells
                   ` (2 preceding siblings ...)
  2009-04-15 18:34 ` [PATCH 4/5] The default CONFIG_BUG=n version of BUG() should have an empty do...while David Howells
@ 2009-04-15 18:35 ` David Howells
  2009-04-17 23:41   ` Paul E. McKenney
  3 siblings, 1 reply; 6+ messages in thread
From: David Howells @ 2009-04-15 18:35 UTC (permalink / raw)
  To: torvalds, akpm
  Cc: linux-kernel, David Howells, Dipankar Sarma, Paul E. McKenney

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:

	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.

Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Dipankar Sarma <dipankar@in.ibm.com>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
---

 kernel/rcupdate.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)


diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
index 2c7b845..a967c9f 100644
--- a/kernel/rcupdate.c
+++ b/kernel/rcupdate.c
@@ -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)
 {


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 5/5] RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc
  2009-04-15 18:35 ` [PATCH 5/5] RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc David Howells
@ 2009-04-17 23:41   ` Paul E. McKenney
  0 siblings, 0 replies; 6+ messages in thread
From: Paul E. McKenney @ 2009-04-17 23:41 UTC (permalink / raw)
  To: David Howells; +Cc: torvalds, akpm, linux-kernel, Dipankar Sarma

On Wed, Apr 15, 2009 at 07:35:01PM +0100, David Howells wrote:
> 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:
> 
> 	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.

Looks good to me!

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>

> Signed-off-by: David Howells <dhowells@redhat.com>
> Cc: Dipankar Sarma <dipankar@in.ibm.com>
> Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> ---
> 
>  kernel/rcupdate.c |   18 ++++++++----------
>  1 files changed, 8 insertions(+), 10 deletions(-)
> 
> 
> diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c
> index 2c7b845..a967c9f 100644
> --- a/kernel/rcupdate.c
> +++ b/kernel/rcupdate.c
> @@ -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)
>  {
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-04-17 23:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-15 18:34 [PATCH 1/5] MN10300: Discard duplicate PFN_xxx() macros David Howells
2009-04-15 18:34 ` [PATCH 2/5] MN10300: Wire up missing system calls David Howells
2009-04-15 18:34 ` [PATCH 3/5] MN10300: Stop gcc from generating uninitialised variable warnings after BUG() David Howells
2009-04-15 18:34 ` [PATCH 4/5] The default CONFIG_BUG=n version of BUG() should have an empty do...while David Howells
2009-04-15 18:35 ` [PATCH 5/5] RCU: Don't try and predeclare inline funcs as it upsets some versions of gcc David Howells
2009-04-17 23:41   ` Paul E. McKenney

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.