[patch 11/24] Text Edit Lock - x86_64 standardize debug rodata

2007-12-20 Thread Mathieu Desnoyers
Standardize DEBUG_RODATA, removing special cases for hotplug and kprobes.

Signed-off-by: Mathieu Desnoyers <[EMAIL PROTECTED]>
CC: Andi Kleen <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
CC: Thomas Gleixner <[EMAIL PROTECTED]>
CC: Ingo Molnar <[EMAIL PROTECTED]>
CC: H. Peter Anvin <[EMAIL PROTECTED]>
---
 arch/x86_64/mm/init.c |   23 +--
 1 file changed, 5 insertions(+), 18 deletions(-)

Index: linux-2.6-lttng/arch/x86/mm/init_64.c
===
--- linux-2.6-lttng.orig/arch/x86/mm/init_64.c  2007-09-24 11:00:01.0 
-0400
+++ linux-2.6-lttng/arch/x86/mm/init_64.c   2007-09-24 11:00:02.0 
-0400
@@ -592,25 +592,11 @@ void free_initmem(void)
 
 void mark_rodata_ro(void)
 {
-   unsigned long start = (unsigned long)_stext, end;
+   unsigned long start = PFN_ALIGN(_stext);
+   unsigned long end = PFN_ALIGN(__end_rodata);
 
-#ifdef CONFIG_HOTPLUG_CPU
-   /* It must still be possible to apply SMP alternatives. */
-   if (num_possible_cpus() > 1)
-   start = (unsigned long)_etext;
-#endif
-
-#ifdef CONFIG_KPROBES
-   start = (unsigned long)__start_rodata;
-#endif
-   
-   end = (unsigned long)__end_rodata;
-   start = (start + PAGE_SIZE - 1) & PAGE_MASK;
-   end &= PAGE_MASK;
-   if (end <= start)
-   return;
-
-   change_page_attr_addr(start, (end - start) >> PAGE_SHIFT, 
PAGE_KERNEL_RO);
+   change_page_attr_addr(start, (end - start) >> PAGE_SHIFT,
+   PAGE_KERNEL_RO);
 
printk(KERN_INFO "Write protecting the kernel read-only data: %luk\n",
   (end - start) >> 10);
@@ -623,6 +609,7 @@ void mark_rodata_ro(void)
 */
global_flush_tlb();
 }
+
 #endif
 
 #ifdef CONFIG_BLK_DEV_INITRD

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
--
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 11/24] Text Edit Lock - x86_64 standardize debug rodata

2007-12-20 Thread Mathieu Desnoyers
Standardize DEBUG_RODATA, removing special cases for hotplug and kprobes.

Signed-off-by: Mathieu Desnoyers [EMAIL PROTECTED]
CC: Andi Kleen [EMAIL PROTECTED]
CC: [EMAIL PROTECTED]
CC: Thomas Gleixner [EMAIL PROTECTED]
CC: Ingo Molnar [EMAIL PROTECTED]
CC: H. Peter Anvin [EMAIL PROTECTED]
---
 arch/x86_64/mm/init.c |   23 +--
 1 file changed, 5 insertions(+), 18 deletions(-)

Index: linux-2.6-lttng/arch/x86/mm/init_64.c
===
--- linux-2.6-lttng.orig/arch/x86/mm/init_64.c  2007-09-24 11:00:01.0 
-0400
+++ linux-2.6-lttng/arch/x86/mm/init_64.c   2007-09-24 11:00:02.0 
-0400
@@ -592,25 +592,11 @@ void free_initmem(void)
 
 void mark_rodata_ro(void)
 {
-   unsigned long start = (unsigned long)_stext, end;
+   unsigned long start = PFN_ALIGN(_stext);
+   unsigned long end = PFN_ALIGN(__end_rodata);
 
-#ifdef CONFIG_HOTPLUG_CPU
-   /* It must still be possible to apply SMP alternatives. */
-   if (num_possible_cpus()  1)
-   start = (unsigned long)_etext;
-#endif
-
-#ifdef CONFIG_KPROBES
-   start = (unsigned long)__start_rodata;
-#endif
-   
-   end = (unsigned long)__end_rodata;
-   start = (start + PAGE_SIZE - 1)  PAGE_MASK;
-   end = PAGE_MASK;
-   if (end = start)
-   return;
-
-   change_page_attr_addr(start, (end - start)  PAGE_SHIFT, 
PAGE_KERNEL_RO);
+   change_page_attr_addr(start, (end - start)  PAGE_SHIFT,
+   PAGE_KERNEL_RO);
 
printk(KERN_INFO Write protecting the kernel read-only data: %luk\n,
   (end - start)  10);
@@ -623,6 +609,7 @@ void mark_rodata_ro(void)
 */
global_flush_tlb();
 }
+
 #endif
 
 #ifdef CONFIG_BLK_DEV_INITRD

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
--
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/