Re: [PATCH] move die notifier handling to common code

2007-04-09 Thread Paul Mackerras
Christoph Hellwig writes:

> I tend to agree.  Unfortunately powers higher than me like these
> horrible notifier schemes.  Then again at least the die path is not
> performance critical unlike the page faul path where I still need a
> comment for you on getting rid of the notifier.

Sounds reasonable.  If you posted a patch I missed it. :)

Paul.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] move die notifier handling to common code

2007-04-09 Thread Paul Mackerras
Christoph Hellwig writes:

 I tend to agree.  Unfortunately powers higher than me like these
 horrible notifier schemes.  Then again at least the die path is not
 performance critical unlike the page faul path where I still need a
 comment for you on getting rid of the notifier.

Sounds reasonable.  If you posted a patch I missed it. :)

Paul.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] move die notifier handling to common code fix vmalloc_sync_all in nommu

2007-04-04 Thread Wu, Bryan

Signed-off-by: Bryan Wu <[EMAIL PROTECTED]>
---
 mm/nommu.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index 2d0a82f..0016557 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -261,6 +261,14 @@ void vunmap(void *addr)
 }
 
 /*
+ * Implement a stub for vmalloc_sync_all() if the architecture chose not to
+ * have one.
+ */
+void  __attribute__((weak)) vmalloc_sync_all(void)
+{
+}
+
+/*
  *  sys_brk() for the most part doesn't need the global kernel
  *  lock, except when an application is doing something nasty
  *  like trying to un-brk an area that has already been mapped
-- 
1.5.0.5

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] move die notifier handling to common code fix vmalloc_sync_all in nommu

2007-04-04 Thread Wu, Bryan

Signed-off-by: Bryan Wu [EMAIL PROTECTED]
---
 mm/nommu.c |8 
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/mm/nommu.c b/mm/nommu.c
index 2d0a82f..0016557 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -261,6 +261,14 @@ void vunmap(void *addr)
 }
 
 /*
+ * Implement a stub for vmalloc_sync_all() if the architecture chose not to
+ * have one.
+ */
+void  __attribute__((weak)) vmalloc_sync_all(void)
+{
+}
+
+/*
  *  sys_brk() for the most part doesn't need the global kernel
  *  lock, except when an application is doing something nasty
  *  like trying to un-brk an area that has already been mapped
-- 
1.5.0.5

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] move die notifier handling to common code

2007-03-26 Thread Christoph Hellwig
On Mon, Mar 26, 2007 at 11:32:09AM +1000, Paul Mackerras wrote:
> Seems OK, although I think kprobes should not be using notify_die.
> The set of events that kprobes is interested in has no intersection at
> all with the set that any other consumer of the notify_die events is
> interested in, on any architecture.
> 
> Furthermore, the multiplexing of the kprobes events through notify_die
> really serves no useful purpose.  It just means that
> kprobe_exceptions_notify has to demultiplex the events with a switch
> statement.  There is no significant common code for all events in
> kprobe_exceptions_notify, just a simple check whether the event
> happened in user mode.
> 
> However, all that is in arch code so can be changed per-arch if
> desired.

I tend to agree.  Unfortunately powers higher than me like these
horrible notifier schemes.  Then again at least the die path is not
performance critical unlike the page faul path where I still need a
comment for you on getting rid of the notifier.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] move die notifier handling to common code

2007-03-26 Thread Christoph Hellwig
On Mon, Mar 26, 2007 at 11:32:09AM +1000, Paul Mackerras wrote:
 Seems OK, although I think kprobes should not be using notify_die.
 The set of events that kprobes is interested in has no intersection at
 all with the set that any other consumer of the notify_die events is
 interested in, on any architecture.
 
 Furthermore, the multiplexing of the kprobes events through notify_die
 really serves no useful purpose.  It just means that
 kprobe_exceptions_notify has to demultiplex the events with a switch
 statement.  There is no significant common code for all events in
 kprobe_exceptions_notify, just a simple check whether the event
 happened in user mode.
 
 However, all that is in arch code so can be changed per-arch if
 desired.

I tend to agree.  Unfortunately powers higher than me like these
horrible notifier schemes.  Then again at least the die path is not
performance critical unlike the page faul path where I still need a
comment for you on getting rid of the notifier.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] move die notifier handling to common code

2007-03-25 Thread Paul Mackerras
Christoph Hellwig writes:

> This patch moves the die notifier handling to common code.  Previous
> various architectures had exactly the same code for it.  Note that
> the new code is compiled unconditionally, this should be understood
> as an appel to the other architecture maintainer to implement
> support for it aswell (aka sprinkling a notify_die or two in the
> proper place)

Seems OK, although I think kprobes should not be using notify_die.
The set of events that kprobes is interested in has no intersection at
all with the set that any other consumer of the notify_die events is
interested in, on any architecture.

Furthermore, the multiplexing of the kprobes events through notify_die
really serves no useful purpose.  It just means that
kprobe_exceptions_notify has to demultiplex the events with a switch
statement.  There is no significant common code for all events in
kprobe_exceptions_notify, just a simple check whether the event
happened in user mode.

However, all that is in arch code so can be changed per-arch if
desired.

Paul.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] move die notifier handling to common code

2007-03-25 Thread Paul Mackerras
Christoph Hellwig writes:

 This patch moves the die notifier handling to common code.  Previous
 various architectures had exactly the same code for it.  Note that
 the new code is compiled unconditionally, this should be understood
 as an appel to the other architecture maintainer to implement
 support for it aswell (aka sprinkling a notify_die or two in the
 proper place)

Seems OK, although I think kprobes should not be using notify_die.
The set of events that kprobes is interested in has no intersection at
all with the set that any other consumer of the notify_die events is
interested in, on any architecture.

Furthermore, the multiplexing of the kprobes events through notify_die
really serves no useful purpose.  It just means that
kprobe_exceptions_notify has to demultiplex the events with a switch
statement.  There is no significant common code for all events in
kprobe_exceptions_notify, just a simple check whether the event
happened in user mode.

However, all that is in arch code so can be changed per-arch if
desired.

Paul.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] move die notifier handling to common code

2007-03-19 Thread Christoph Hellwig
This patch moves the die notifier handling to common code.  Previous
various architectures had exactly the same code for it.  Note that
the new code is compiled unconditionally, this should be understood
as an appel to the other architecture maintainer to implement
support for it aswell (aka sprinkling a notify_die or two in the
proper place)

arm had a notifiy_die that did something totally different, I renamed
it to arm_notify_die as part of the patch and made it static to the
file it's declared and used at.  avr32 used to pass slightly less
information through this interface and I brought it into line with
the other architectures.


Signed-off-by: Christoph Hellwig <[EMAIL PROTECTED]>

Index: linux-2.6/arch/arm/kernel/traps.c
===
--- linux-2.6.orig/arch/arm/kernel/traps.c  2007-03-19 16:42:43.0 
+0100
+++ linux-2.6/arch/arm/kernel/traps.c   2007-03-19 16:45:08.0 +0100
@@ -232,8 +232,8 @@ NORET_TYPE void die(const char *str, str
do_exit(SIGSEGV);
 }
 
-void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,
-   unsigned long err, unsigned long trap)
+static void arm_notify_die(const char *str, struct pt_regs *regs,
+   struct siginfo *info, unsigned long err, unsigned long trap)
 {
if (user_mode(regs)) {
current->thread.error_code = err;
@@ -316,7 +316,7 @@ asmlinkage void do_undefinstr(struct pt_
info.si_code  = ILL_ILLOPC;
info.si_addr  = pc;
 
-   notify_die("Oops - undefined instruction", regs, , 0, 6);
+   arm_notify_die("Oops - undefined instruction", regs, , 0, 6);
 }
 
 asmlinkage void do_unexp_fiq (struct pt_regs *regs)
@@ -370,7 +370,7 @@ static int bad_syscall(int n, struct pt_
info.si_addr  = (void __user *)instruction_pointer(regs) -
 (thumb_mode(regs) ? 2 : 4);
 
-   notify_die("Oops - bad syscall", regs, , n, 0);
+   arm_notify_die("Oops - bad syscall", regs, , n, 0);
 
return regs->ARM_r0;
 }
@@ -414,7 +414,7 @@ asmlinkage int arm_syscall(int no, struc
info.si_code  = SEGV_MAPERR;
info.si_addr  = NULL;
 
-   notify_die("branch through zero", regs, , 0, 0);
+   arm_notify_die("branch through zero", regs, , 0, 0);
return 0;
 
case NR(breakpoint): /* SWI BREAK_POINT */
@@ -550,7 +550,7 @@ asmlinkage int arm_syscall(int no, struc
info.si_addr  = (void __user *)instruction_pointer(regs) -
 (thumb_mode(regs) ? 2 : 4);
 
-   notify_die("Oops - bad syscall(2)", regs, , no, 0);
+   arm_notify_die("Oops - bad syscall(2)", regs, , no, 0);
return 0;
 }
 
@@ -624,7 +624,7 @@ baddataabort(int code, unsigned long ins
info.si_code  = ILL_ILLOPC;
info.si_addr  = (void __user *)addr;
 
-   notify_die("unknown data abort code", regs, , instr, 0);
+   arm_notify_die("unknown data abort code", regs, , instr, 0);
 }
 
 void __attribute__((noreturn)) __bug(const char *file, int line)
Index: linux-2.6/arch/avr32/kernel/kprobes.c
===
--- linux-2.6.orig/arch/avr32/kernel/kprobes.c  2007-03-19 16:42:43.0 
+0100
+++ linux-2.6/arch/avr32/kernel/kprobes.c   2007-03-19 16:45:08.0 
+0100
@@ -15,7 +15,7 @@
 #include 
 
 #include 
-#include 
+#include 
 #include 
 
 DEFINE_PER_CPU(struct kprobe *, current_kprobe);
Index: linux-2.6/arch/avr32/kernel/ptrace.c
===
--- linux-2.6.orig/arch/avr32/kernel/ptrace.c   2007-03-19 16:42:43.0 
+0100
+++ linux-2.6/arch/avr32/kernel/ptrace.c2007-03-19 16:46:46.0 
+0100
@@ -21,7 +21,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 
 static struct pt_regs *get_user_regs(struct task_struct *tsk)
 {
@@ -300,7 +300,7 @@ asmlinkage void do_debug_priv(struct pt_
else
die_val = DIE_BREAKPOINT;
 
-   if (notify_die(die_val, regs, 0, SIGTRAP) == NOTIFY_STOP)
+   if (notify_die(die_val, "ptrace", regs, 0, 0, SIGTRAP) == NOTIFY_STOP)
return;
 
if (likely(ds & DS_SSS)) {
Index: linux-2.6/arch/avr32/kernel/traps.c
===
--- linux-2.6.orig/arch/avr32/kernel/traps.c2007-03-19 16:42:43.0 
+0100
+++ linux-2.6/arch/avr32/kernel/traps.c 2007-03-19 16:45:08.0 +0100
@@ -151,22 +151,6 @@ void dump_stack(void)
 }
 EXPORT_SYMBOL(dump_stack);
 
-ATOMIC_NOTIFIER_HEAD(avr32_die_chain);
-
-int register_die_notifier(struct notifier_block *nb)
-{
-   pr_debug("register_die_notifier: %p\n", nb);
-
-   return atomic_notifier_chain_register(_die_chain, nb);
-}
-EXPORT_SYMBOL(register_die_notifier);
-
-int unregister_die_notifier(struct notifier_block *nb)
-{
-   return atomic_notifier_chain_unregister(_die_chain, 

[PATCH] move die notifier handling to common code

2007-03-19 Thread Christoph Hellwig
This patch moves the die notifier handling to common code.  Previous
various architectures had exactly the same code for it.  Note that
the new code is compiled unconditionally, this should be understood
as an appel to the other architecture maintainer to implement
support for it aswell (aka sprinkling a notify_die or two in the
proper place)

arm had a notifiy_die that did something totally different, I renamed
it to arm_notify_die as part of the patch and made it static to the
file it's declared and used at.  avr32 used to pass slightly less
information through this interface and I brought it into line with
the other architectures.


Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]

Index: linux-2.6/arch/arm/kernel/traps.c
===
--- linux-2.6.orig/arch/arm/kernel/traps.c  2007-03-19 16:42:43.0 
+0100
+++ linux-2.6/arch/arm/kernel/traps.c   2007-03-19 16:45:08.0 +0100
@@ -232,8 +232,8 @@ NORET_TYPE void die(const char *str, str
do_exit(SIGSEGV);
 }
 
-void notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,
-   unsigned long err, unsigned long trap)
+static void arm_notify_die(const char *str, struct pt_regs *regs,
+   struct siginfo *info, unsigned long err, unsigned long trap)
 {
if (user_mode(regs)) {
current-thread.error_code = err;
@@ -316,7 +316,7 @@ asmlinkage void do_undefinstr(struct pt_
info.si_code  = ILL_ILLOPC;
info.si_addr  = pc;
 
-   notify_die(Oops - undefined instruction, regs, info, 0, 6);
+   arm_notify_die(Oops - undefined instruction, regs, info, 0, 6);
 }
 
 asmlinkage void do_unexp_fiq (struct pt_regs *regs)
@@ -370,7 +370,7 @@ static int bad_syscall(int n, struct pt_
info.si_addr  = (void __user *)instruction_pointer(regs) -
 (thumb_mode(regs) ? 2 : 4);
 
-   notify_die(Oops - bad syscall, regs, info, n, 0);
+   arm_notify_die(Oops - bad syscall, regs, info, n, 0);
 
return regs-ARM_r0;
 }
@@ -414,7 +414,7 @@ asmlinkage int arm_syscall(int no, struc
info.si_code  = SEGV_MAPERR;
info.si_addr  = NULL;
 
-   notify_die(branch through zero, regs, info, 0, 0);
+   arm_notify_die(branch through zero, regs, info, 0, 0);
return 0;
 
case NR(breakpoint): /* SWI BREAK_POINT */
@@ -550,7 +550,7 @@ asmlinkage int arm_syscall(int no, struc
info.si_addr  = (void __user *)instruction_pointer(regs) -
 (thumb_mode(regs) ? 2 : 4);
 
-   notify_die(Oops - bad syscall(2), regs, info, no, 0);
+   arm_notify_die(Oops - bad syscall(2), regs, info, no, 0);
return 0;
 }
 
@@ -624,7 +624,7 @@ baddataabort(int code, unsigned long ins
info.si_code  = ILL_ILLOPC;
info.si_addr  = (void __user *)addr;
 
-   notify_die(unknown data abort code, regs, info, instr, 0);
+   arm_notify_die(unknown data abort code, regs, info, instr, 0);
 }
 
 void __attribute__((noreturn)) __bug(const char *file, int line)
Index: linux-2.6/arch/avr32/kernel/kprobes.c
===
--- linux-2.6.orig/arch/avr32/kernel/kprobes.c  2007-03-19 16:42:43.0 
+0100
+++ linux-2.6/arch/avr32/kernel/kprobes.c   2007-03-19 16:45:08.0 
+0100
@@ -15,7 +15,7 @@
 #include linux/ptrace.h
 
 #include asm/cacheflush.h
-#include asm/kdebug.h
+#include linux/kdebug.h
 #include asm/ocd.h
 
 DEFINE_PER_CPU(struct kprobe *, current_kprobe);
Index: linux-2.6/arch/avr32/kernel/ptrace.c
===
--- linux-2.6.orig/arch/avr32/kernel/ptrace.c   2007-03-19 16:42:43.0 
+0100
+++ linux-2.6/arch/avr32/kernel/ptrace.c2007-03-19 16:46:46.0 
+0100
@@ -21,7 +21,7 @@
 #include asm/uaccess.h
 #include asm/ocd.h
 #include asm/mmu_context.h
-#include asm/kdebug.h
+#include linux/kdebug.h
 
 static struct pt_regs *get_user_regs(struct task_struct *tsk)
 {
@@ -300,7 +300,7 @@ asmlinkage void do_debug_priv(struct pt_
else
die_val = DIE_BREAKPOINT;
 
-   if (notify_die(die_val, regs, 0, SIGTRAP) == NOTIFY_STOP)
+   if (notify_die(die_val, ptrace, regs, 0, 0, SIGTRAP) == NOTIFY_STOP)
return;
 
if (likely(ds  DS_SSS)) {
Index: linux-2.6/arch/avr32/kernel/traps.c
===
--- linux-2.6.orig/arch/avr32/kernel/traps.c2007-03-19 16:42:43.0 
+0100
+++ linux-2.6/arch/avr32/kernel/traps.c 2007-03-19 16:45:08.0 +0100
@@ -151,22 +151,6 @@ void dump_stack(void)
 }
 EXPORT_SYMBOL(dump_stack);
 
-ATOMIC_NOTIFIER_HEAD(avr32_die_chain);
-
-int register_die_notifier(struct notifier_block *nb)
-{
-   pr_debug(register_die_notifier: %p\n, nb);
-
-   return atomic_notifier_chain_register(avr32_die_chain, nb);
-}