All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] asm/sections: add text/data checking functions for arches to override
@ 2009-06-17 16:22 Mike Frysinger
  2009-06-17 16:22 ` [PATCH 2/4] kallsyms: use new arch_is_kernel_text() Mike Frysinger
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Mike Frysinger @ 2009-06-17 16:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, rgetz, akpm

Some ports (like the Blackfin arch) have a discontiguous memory map which
means there may be text or data that falls outside of the standard range
of the start/end text/data symbols.  Creating some helper functions allows
these non-standard ports to declare these regions without adversely
affecting anyone else.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 include/asm-generic/sections.h |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h
index 4ce48e8..ee19462 100644
--- a/include/asm-generic/sections.h
+++ b/include/asm-generic/sections.h
@@ -20,4 +20,20 @@ extern char __start_rodata[], __end_rodata[];
 #define dereference_function_descriptor(p) (p)
 #endif
 
+/* random extra sections (if any).  Override
+ * in asm/sections.h */
+#ifndef arch_is_kernel_text
+static inline int arch_is_kernel_text(unsigned long addr)
+{
+	return 0;
+}
+#endif
+
+#ifndef arch_is_kernel_data
+static inline int arch_is_kernel_data(unsigned long addr)
+{
+	return 0;
+}
+#endif
+
 #endif /* _ASM_GENERIC_SECTIONS_H_ */
-- 
1.6.3.1


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

* [PATCH 2/4] kallsyms: use new arch_is_kernel_text()
  2009-06-17 16:22 [PATCH 1/4] asm/sections: add text/data checking functions for arches to override Mike Frysinger
@ 2009-06-17 16:22 ` Mike Frysinger
  2009-06-17 16:22 ` [PATCH 3/4] lockdep: use new arch_is_kernel_data() Mike Frysinger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2009-06-17 16:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, rgetz, akpm

This allows kallsyms to locate symbols that are in arch-specific text
sections (such as text in Blackfin on-chip SRAM regions).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 kernel/kallsyms.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index 3a29dbe..8b6b8b6 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -59,7 +59,8 @@ static inline int is_kernel_inittext(unsigned long addr)
 
 static inline int is_kernel_text(unsigned long addr)
 {
-	if (addr >= (unsigned long)_stext && addr <= (unsigned long)_etext)
+	if ((addr >= (unsigned long)_stext && addr <= (unsigned long)_etext) ||
+	    arch_is_kernel_text(addr))
 		return 1;
 	return in_gate_area_no_task(addr);
 }
-- 
1.6.3.1


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

* [PATCH 3/4] lockdep: use new arch_is_kernel_data()
  2009-06-17 16:22 [PATCH 1/4] asm/sections: add text/data checking functions for arches to override Mike Frysinger
  2009-06-17 16:22 ` [PATCH 2/4] kallsyms: use new arch_is_kernel_text() Mike Frysinger
@ 2009-06-17 16:22 ` Mike Frysinger
  2009-06-17 16:22 ` [PATCH 4/4] Blackfin: override text/data checking functions Mike Frysinger
  2009-06-23 22:40 ` [PATCH 1/4] asm/sections: add text/data checking functions for arches to override Andrew Morton
  3 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2009-06-17 16:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, rgetz, akpm

This allows lockdep to locate symbols that are in arch-specific data
sections (such as data in Blackfin on-chip SRAM regions).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 kernel/lockdep.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 8bbeef9..8dc9b6a 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -636,6 +636,9 @@ static int static_obj(void *obj)
 	if ((addr >= start) && (addr < end))
 		return 1;
 
+	if (arch_is_kernel_data(addr))
+		return 1;
+
 #ifdef CONFIG_SMP
 	/*
 	 * percpu var?
-- 
1.6.3.1


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

* [PATCH 4/4] Blackfin: override text/data checking functions
  2009-06-17 16:22 [PATCH 1/4] asm/sections: add text/data checking functions for arches to override Mike Frysinger
  2009-06-17 16:22 ` [PATCH 2/4] kallsyms: use new arch_is_kernel_text() Mike Frysinger
  2009-06-17 16:22 ` [PATCH 3/4] lockdep: use new arch_is_kernel_data() Mike Frysinger
@ 2009-06-17 16:22 ` Mike Frysinger
  2009-06-23 22:40 ` [PATCH 1/4] asm/sections: add text/data checking functions for arches to override Andrew Morton
  3 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2009-06-17 16:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: mingo, rgetz, akpm

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 arch/blackfin/include/asm/sections.h |   38 +++++++++++++++++++++++++++++++--
 1 files changed, 35 insertions(+), 3 deletions(-)

diff --git a/arch/blackfin/include/asm/sections.h b/arch/blackfin/include/asm/sections.h
index e7fd0ec..ae4dae1 100644
--- a/arch/blackfin/include/asm/sections.h
+++ b/arch/blackfin/include/asm/sections.h
@@ -1,9 +1,6 @@
 #ifndef _BLACKFIN_SECTIONS_H
 #define _BLACKFIN_SECTIONS_H
 
-/* nothing to see, move along */
-#include <asm-generic/sections.h>
-
 /* only used when MTD_UCLINUX */
 extern unsigned long memory_mtd_start, memory_mtd_end, mtd_size;
 
@@ -15,4 +12,39 @@ extern char _stext_l1[], _etext_l1[], _sdata_l1[], _edata_l1[], _sbss_l1[],
 	_stext_l2[], _etext_l2[], _sdata_l2[], _edata_l2[], _sbss_l2[],
 	_ebss_l2[], _l2_lma_start[];
 
+#include <asm/mem_map.h>
+
+/* Blackfin systems have discontinuous memory map and no virtualized memory */
+static inline int arch_is_kernel_text(unsigned long addr)
+{
+	return
+		(L1_CODE_LENGTH &&
+		 addr >= (unsigned long)_stext_l1 &&
+		 addr <  (unsigned long)_etext_l1)
+		||
+		(L2_LENGTH &&
+		 addr >= (unsigned long)_stext_l2 &&
+		 addr <  (unsigned long)_etext_l2);
+}
+#define arch_is_kernel_text(addr) arch_is_kernel_text(addr)
+
+static inline int arch_is_kernel_data(unsigned long addr)
+{
+	return
+		(L1_DATA_A_LENGTH &&
+		 addr >= (unsigned long)_sdata_l1 &&
+		 addr <  (unsigned long)_ebss_l1)
+		||
+		(L1_DATA_B_LENGTH &&
+		 addr >= (unsigned long)_sdata_b_l1 &&
+		 addr <  (unsigned long)_ebss_b_l1)
+		||
+		(L2_LENGTH &&
+		 addr >= (unsigned long)_sdata_l2 &&
+		 addr <  (unsigned long)_ebss_l2);
+}
+#define arch_is_kernel_data(addr) arch_is_kernel_data(addr)
+
+#include <asm-generic/sections.h>
+
 #endif
-- 
1.6.3.1


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

* Re: [PATCH 1/4] asm/sections: add text/data checking functions for arches to override
  2009-06-17 16:22 [PATCH 1/4] asm/sections: add text/data checking functions for arches to override Mike Frysinger
                   ` (2 preceding siblings ...)
  2009-06-17 16:22 ` [PATCH 4/4] Blackfin: override text/data checking functions Mike Frysinger
@ 2009-06-23 22:40 ` Andrew Morton
  2009-06-24  1:48   ` Mike Frysinger
  3 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2009-06-23 22:40 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-kernel, mingo, rgetz

On Wed, 17 Jun 2009 12:22:21 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> Some ports (like the Blackfin arch) have a discontiguous memory map which
> means there may be text or data that falls outside of the standard range
> of the start/end text/data symbols.  Creating some helper functions allows
> these non-standard ports to declare these regions without adversely
> affecting anyone else.
> 

The patches look OK to me.

I assumed they're for 2.6.32.

> index 4ce48e8..ee19462 100644
> --- a/include/asm-generic/sections.h
> +++ b/include/asm-generic/sections.h
> @@ -20,4 +20,20 @@ extern char __start_rodata[], __end_rodata[];
>  #define dereference_function_descriptor(p) (p)
>  #endif
>  
> +/* random extra sections (if any).  Override
> + * in asm/sections.h */
> +#ifndef arch_is_kernel_text
> +static inline int arch_is_kernel_text(unsigned long addr)
> +{
> +	return 0;
> +}
> +#endif
> +
> +#ifndef arch_is_kernel_data
> +static inline int arch_is_kernel_data(unsigned long addr)
> +{
> +	return 0;
> +}
> +#endif

I suppose that for completeness and consistency etc really we should have

#define arch_is_kernel_text arch_is_kernel_text
#define arch_is_kernel_data arch_is_kernel_data

in here.

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

* Re: [PATCH 1/4] asm/sections: add text/data checking functions for  arches to override
  2009-06-23 22:40 ` [PATCH 1/4] asm/sections: add text/data checking functions for arches to override Andrew Morton
@ 2009-06-24  1:48   ` Mike Frysinger
  2009-06-24  2:04     ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2009-06-24  1:48 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, mingo, rgetz

On Tue, Jun 23, 2009 at 18:40, Andrew Morton wrote:
> On Wed, 17 Jun 2009 12:22:21 -0400 Mike Frysinger wrote:
>> Some ports (like the Blackfin arch) have a discontiguous memory map which
>> means there may be text or data that falls outside of the standard range
>> of the start/end text/data symbols.  Creating some helper functions allows
>> these non-standard ports to declare these regions without adversely
>> affecting anyone else.
>
> The patches look OK to me.
>
> I assumed they're for 2.6.32.

it's for whatever is easiest to merge

>> index 4ce48e8..ee19462 100644
>> --- a/include/asm-generic/sections.h
>> +++ b/include/asm-generic/sections.h
>> @@ -20,4 +20,20 @@ extern char __start_rodata[], __end_rodata[];
>>  #define dereference_function_descriptor(p) (p)
>>  #endif
>>
>> +/* random extra sections (if any).  Override
>> + * in asm/sections.h */
>> +#ifndef arch_is_kernel_text
>> +static inline int arch_is_kernel_text(unsigned long addr)
>> +{
>> +     return 0;
>> +}
>> +#endif
>> +
>> +#ifndef arch_is_kernel_data
>> +static inline int arch_is_kernel_data(unsigned long addr)
>> +{
>> +     return 0;
>> +}
>> +#endif
>
> I suppose that for completeness and consistency etc really we should have
>
> #define arch_is_kernel_text arch_is_kernel_text
> #define arch_is_kernel_data arch_is_kernel_data
>
> in here.

*shrug* other places that use this style dont include these defines
for completeness as the define muck is for the header to know about
(arches providing their own version), not any source code -- they
shouldnt know anything about the ifdef stuff.  i dont care much either
way.
-mike

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

* Re: [PATCH 1/4] asm/sections: add text/data checking functions for arches to override
  2009-06-24  1:48   ` Mike Frysinger
@ 2009-06-24  2:04     ` Andrew Morton
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Morton @ 2009-06-24  2:04 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: linux-kernel, mingo, rgetz

On Tue, 23 Jun 2009 21:48:03 -0400 Mike Frysinger <vapier.adi@gmail.com> wrote:

> > I suppose that for completeness and consistency etc really we should have
> >
> > #define arch_is_kernel_text arch_is_kernel_text
> > #define arch_is_kernel_data arch_is_kernel_data
> >
> > in here.
> 
> *shrug* other places that use this style dont include these defines
> for completeness

Examples?

All the ones I can find do things like

#ifndef vmcore_elf_check_arch_cross
#define vmcore_elf_check_arch_cross(x) 0
#endif

> as the define muck is for the header to know about
> (arches providing their own version), not any source code -- they
> shouldnt know anything about the ifdef stuff.

Failing to do the #define will have various tricky failure modes.  But
it's more a question of "what is the _right_ thing to do", then doing
that consistently.

>  i dont care much either way.

Someone has to.

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

end of thread, other threads:[~2009-06-24  2:06 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-17 16:22 [PATCH 1/4] asm/sections: add text/data checking functions for arches to override Mike Frysinger
2009-06-17 16:22 ` [PATCH 2/4] kallsyms: use new arch_is_kernel_text() Mike Frysinger
2009-06-17 16:22 ` [PATCH 3/4] lockdep: use new arch_is_kernel_data() Mike Frysinger
2009-06-17 16:22 ` [PATCH 4/4] Blackfin: override text/data checking functions Mike Frysinger
2009-06-23 22:40 ` [PATCH 1/4] asm/sections: add text/data checking functions for arches to override Andrew Morton
2009-06-24  1:48   ` Mike Frysinger
2009-06-24  2:04     ` Andrew Morton

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.