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 <[email protected]>
---
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
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 <[email protected]>
---
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
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 <[email protected]>
---
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
Signed-off-by: Mike Frysinger <[email protected]>
---
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
On Wed, 17 Jun 2009 12:22:21 -0400
Mike Frysinger <[email protected]> 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.
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
On Tue, 23 Jun 2009 21:48:03 -0400 Mike Frysinger <[email protected]> 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.