* [PATCH 0/5] metag: second set of misc patches for v3.9
@ 2013-02-13 12:03 James Hogan
2013-02-13 12:03 ` [PATCH 1/5] metag: export metag_code_cache_flush_all James Hogan
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: James Hogan @ 2013-02-13 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, James Hogan
Here is the second set of miscellaneous metag patches that I'll be
adding to the tip of the metag tree for v3.9.
James Hogan (5):
metag: export metag_code_cache_flush_all
metag: export clear_page and copy_page
metag: hugetlb: convert to vm_unmapped_area()
genksyms: fix metag symbol prefix on crc symbols
metag: move irq enable out of irqflags.h on SMP
arch/metag/include/asm/irqflags.h | 11 +++----
arch/metag/kernel/metag_ksyms.c | 2 +
arch/metag/kernel/traps.c | 15 ++++++++++-
arch/metag/mm/cache.c | 1 +
arch/metag/mm/hugetlbpage.c | 52 +++++++-----------------------------
scripts/genksyms/genksyms.c | 3 +-
6 files changed, 34 insertions(+), 50 deletions(-)
--
1.7.7.6
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/5] metag: export metag_code_cache_flush_all
2013-02-13 12:03 [PATCH 0/5] metag: second set of misc patches for v3.9 James Hogan
@ 2013-02-13 12:03 ` James Hogan
2013-02-13 12:03 ` [PATCH 2/5] metag: export clear_page and copy_page James Hogan
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: James Hogan @ 2013-02-13 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, James Hogan
Various file systems indirectly use metag_code_cache_flush_all(), so
when they're built as modules we get build errors like the following:
ERROR: "metag_code_cache_flush_all" [fs/xfs/xfs.ko] undefined!
Therefore export this function to modules to fix the errors. This was
hit by a randconfig build.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/mm/cache.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/metag/mm/cache.c b/arch/metag/mm/cache.c
index 4dd96e4..b5d3b2e 100644
--- a/arch/metag/mm/cache.c
+++ b/arch/metag/mm/cache.c
@@ -460,6 +460,7 @@ void metag_code_cache_flush_all(const void *start)
metag_phys_code_cache_flush(start, 4096);
}
+EXPORT_SYMBOL(metag_code_cache_flush_all);
void metag_code_cache_flush(const void *start, int bytes)
{
--
1.7.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/5] metag: export clear_page and copy_page
2013-02-13 12:03 [PATCH 0/5] metag: second set of misc patches for v3.9 James Hogan
2013-02-13 12:03 ` [PATCH 1/5] metag: export metag_code_cache_flush_all James Hogan
@ 2013-02-13 12:03 ` James Hogan
2013-02-13 12:03 ` [PATCH 3/5] metag: hugetlb: convert to vm_unmapped_area() James Hogan
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: James Hogan @ 2013-02-13 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, James Hogan
Various file systems use clear_page() and copy_page(), so when they're
built as modules we get build errors like the following:
ERROR: "clear_page" [fs/ntfs/ntfs.ko] undefined!
ERROR: "copy_page" [fs/nilfs2/nilfs2.ko] undefined!
Therefore export these functions to modules from metag_ksyms.c to fix
the errors. This was hit by a randconfig build.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/kernel/metag_ksyms.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/metag/kernel/metag_ksyms.c b/arch/metag/kernel/metag_ksyms.c
index 5381514..1b27bea 100644
--- a/arch/metag/kernel/metag_ksyms.c
+++ b/arch/metag/kernel/metag_ksyms.c
@@ -37,6 +37,8 @@ EXPORT_SYMBOL(get_trigger_mask);
EXPORT_SYMBOL(global_trigger_mask);
#endif
+EXPORT_SYMBOL(clear_page);
+EXPORT_SYMBOL(copy_page);
EXPORT_SYMBOL(empty_zero_page);
EXPORT_SYMBOL(pfn_base);
--
1.7.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/5] metag: hugetlb: convert to vm_unmapped_area()
2013-02-13 12:03 [PATCH 0/5] metag: second set of misc patches for v3.9 James Hogan
2013-02-13 12:03 ` [PATCH 1/5] metag: export metag_code_cache_flush_all James Hogan
2013-02-13 12:03 ` [PATCH 2/5] metag: export clear_page and copy_page James Hogan
@ 2013-02-13 12:03 ` James Hogan
2013-02-15 8:04 ` Michel Lespinasse
2013-02-13 12:03 ` [PATCH 4/5] genksyms: fix metag symbol prefix on crc symbols James Hogan
2013-02-13 12:03 ` [PATCH 5/5] metag: move irq enable out of irqflags.h on SMP James Hogan
4 siblings, 1 reply; 8+ messages in thread
From: James Hogan @ 2013-02-13 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, James Hogan, Michel Lespinasse
Convert hugetlb_get_unmapped_area_new_pmd() to use vm_unmapped_area()
rather than searching the virtual address space itself. This fixes the
following errors in linux-next due to the specified members being
removed after other architectures have already been converted:
arch/metag/mm/hugetlbpage.c: In function 'hugetlb_get_unmapped_area_new_pmd':
arch/metag/mm/hugetlbpage.c:199: error: 'struct mm_struct' has no member named 'cached_hole_size'
arch/metag/mm/hugetlbpage.c:200: error: 'struct mm_struct' has no member named 'free_area_cache'
arch/metag/mm/hugetlbpage.c:215: error: 'struct mm_struct' has no member named 'cached_hole_size'
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Michel Lespinasse <walken@google.com>
---
arch/metag/mm/hugetlbpage.c | 52 ++++++++----------------------------------
1 files changed, 10 insertions(+), 42 deletions(-)
diff --git a/arch/metag/mm/hugetlbpage.c b/arch/metag/mm/hugetlbpage.c
index 24ceed4..3c52fa6 100644
--- a/arch/metag/mm/hugetlbpage.c
+++ b/arch/metag/mm/hugetlbpage.c
@@ -192,43 +192,15 @@ new_search:
static unsigned long
hugetlb_get_unmapped_area_new_pmd(unsigned long len)
{
- struct mm_struct *mm = current->mm;
- struct vm_area_struct *vma;
- unsigned long start_addr, addr;
-
- if (ALIGN_HUGEPT(len) > mm->cached_hole_size)
- start_addr = mm->free_area_cache;
- else
- start_addr = TASK_UNMAPPED_BASE;
-
-new_search:
- addr = ALIGN_HUGEPT(start_addr);
-
- for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
- if (TASK_SIZE - len < addr) {
- /*
- * Start a new search - just in case we missed
- * some holes.
- */
- if (start_addr != TASK_UNMAPPED_BASE) {
- start_addr = TASK_UNMAPPED_BASE;
- mm->cached_hole_size = 0;
- goto new_search;
- }
- return 0;
- }
- /* skip ahead if we've aligned right over some vmas */
- if (vma && vma->vm_end <= addr)
- continue;
- if (!vma || ALIGN_HUGEPT(addr + len) <= vma->vm_start) {
-#if HPAGE_SHIFT < HUGEPT_SHIFT
- if (len & HUGEPT_MASK)
- mm->context.part_huge = addr + len;
-#endif
- return addr;
- }
- addr = ALIGN_HUGEPT(vma->vm_end);
- }
+ struct vm_unmapped_area_info info;
+
+ info.flags = 0;
+ info.length = len;
+ info.low_limit = TASK_UNMAPPED_BASE;
+ info.high_limit = TASK_SIZE;
+ info.align_mask = PAGE_MASK & HUGEPT_MASK;
+ info.align_offset = 0;
+ return vm_unmapped_area(&info);
}
unsigned long
@@ -266,11 +238,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
* Find an unmapped naturally aligned set of 4MB blocks that we can use
* for huge pages.
*/
- addr = hugetlb_get_unmapped_area_new_pmd(len);
- if (likely(addr))
- return addr;
-
- return -EINVAL;
+ return hugetlb_get_unmapped_area_new_pmd(len);
}
#endif /*HAVE_ARCH_HUGETLB_UNMAPPED_AREA*/
--
1.7.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/5] genksyms: fix metag symbol prefix on crc symbols
2013-02-13 12:03 [PATCH 0/5] metag: second set of misc patches for v3.9 James Hogan
` (2 preceding siblings ...)
2013-02-13 12:03 ` [PATCH 3/5] metag: hugetlb: convert to vm_unmapped_area() James Hogan
@ 2013-02-13 12:03 ` James Hogan
2013-02-13 12:03 ` [PATCH 5/5] metag: move irq enable out of irqflags.h on SMP James Hogan
4 siblings, 0 replies; 8+ messages in thread
From: James Hogan @ 2013-02-13 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, James Hogan
Meta uses symbol prefixes, so add "metag" to the list of architectures
to set the mod_prefix to "_" for. This fixes __crc_* symbols to add the
extra underscore to match _CRC_SYMBOL macro in <linux/export.h> and so
that modpost finds them.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
scripts/genksyms/genksyms.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c
index 8a10649..d25e4a1 100644
--- a/scripts/genksyms/genksyms.c
+++ b/scripts/genksyms/genksyms.c
@@ -826,7 +826,8 @@ int main(int argc, char **argv)
genksyms_usage();
return 1;
}
- if ((strcmp(arch, "h8300") == 0) || (strcmp(arch, "blackfin") == 0))
+ if ((strcmp(arch, "h8300") == 0) || (strcmp(arch, "blackfin") == 0) ||
+ (strcmp(arch, "metag") == 0))
mod_prefix = "_";
{
extern int yydebug;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/5] metag: move irq enable out of irqflags.h on SMP
2013-02-13 12:03 [PATCH 0/5] metag: second set of misc patches for v3.9 James Hogan
` (3 preceding siblings ...)
2013-02-13 12:03 ` [PATCH 4/5] genksyms: fix metag symbol prefix on crc symbols James Hogan
@ 2013-02-13 12:03 ` James Hogan
4 siblings, 0 replies; 8+ messages in thread
From: James Hogan @ 2013-02-13 12:03 UTC (permalink / raw)
To: linux-kernel; +Cc: Arnd Bergmann, James Hogan
The SMP version of arch_local_irq_enable() uses preempt_disable(), but
<asm/irqflags.h> doesn't include <linux/preempt.h> causing the following
errors on SMP when pstore/ftrace is enabled (caught by buildbot smp
allyesconfig):
In file included from include/linux/irqflags.h:15,
from fs/pstore/ftrace.c:16:
arch/metag/include/asm/irqflags.h: In function 'arch_local_irq_enable':
arch/metag/include/asm/irqflags.h:84: error: implicit declaration of function 'preempt_disable'
arch/metag/include/asm/irqflags.h:86: error: implicit declaration of function 'preempt_enable_no_resched'
However <linux/preempt.h> cannot be easily included from
<asm/irqflags.h> as it can cause circular include dependencies in the
!SMP case, and potentially in the SMP case in the future. Therefore move
the SMP implementation of arch_local_irq_enable() into traps.c and use
an inline version of get_trigger_mask() which is also defined in traps.c
for SMP.
This adds an extra layer of function call / stack push when
preempt_disable needs to call other functions, however in the
non-preemptive SMP case it should be about as fast, as it was already
calling the get_trigger_mask() function which is now used inline.
Signed-off-by: James Hogan <james.hogan@imgtec.com>
---
arch/metag/include/asm/irqflags.h | 11 +++++------
arch/metag/kernel/traps.c | 15 ++++++++++++++-
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/arch/metag/include/asm/irqflags.h b/arch/metag/include/asm/irqflags.h
index cba5e13..339b16f 100644
--- a/arch/metag/include/asm/irqflags.h
+++ b/arch/metag/include/asm/irqflags.h
@@ -78,16 +78,15 @@ static inline void arch_local_irq_disable(void)
asm volatile("MOV TXMASKI,%0\n" : : "r" (flags) : "memory");
}
-static inline void arch_local_irq_enable(void)
-{
#ifdef CONFIG_SMP
- preempt_disable();
- arch_local_irq_restore(get_trigger_mask());
- preempt_enable_no_resched();
+/* Avoid circular include dependencies through <linux/preempt.h> */
+void arch_local_irq_enable(void);
#else
+static inline void arch_local_irq_enable(void)
+{
arch_local_irq_restore(get_trigger_mask());
-#endif
}
+#endif
#endif /* (__ASSEMBLY__) */
diff --git a/arch/metag/kernel/traps.c b/arch/metag/kernel/traps.c
index 2808042..3f7764b 100644
--- a/arch/metag/kernel/traps.c
+++ b/arch/metag/kernel/traps.c
@@ -15,6 +15,7 @@
#include <linux/types.h>
#include <linux/init.h>
#include <linux/interrupt.h>
+#include <linux/preempt.h>
#include <linux/ptrace.h>
#include <linux/module.h>
#include <linux/kallsyms.h>
@@ -776,17 +777,29 @@ int traps_restore_context(void)
#endif
#ifdef CONFIG_SMP
-unsigned int get_trigger_mask(void)
+static inline unsigned int _get_trigger_mask(void)
{
unsigned long cpu = smp_processor_id();
return per_cpu(trigger_mask, cpu);
}
+unsigned int get_trigger_mask(void)
+{
+ return _get_trigger_mask();
+}
+
static void set_trigger_mask(unsigned int mask)
{
unsigned long cpu = smp_processor_id();
per_cpu(trigger_mask, cpu) = mask;
}
+
+void arch_local_irq_enable(void)
+{
+ preempt_disable();
+ arch_local_irq_restore(_get_trigger_mask());
+ preempt_enable_no_resched();
+}
#else
static void set_trigger_mask(unsigned int mask)
{
--
1.7.7.6
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/5] metag: hugetlb: convert to vm_unmapped_area()
2013-02-13 12:03 ` [PATCH 3/5] metag: hugetlb: convert to vm_unmapped_area() James Hogan
@ 2013-02-15 8:04 ` Michel Lespinasse
2013-02-15 9:26 ` James Hogan
0 siblings, 1 reply; 8+ messages in thread
From: Michel Lespinasse @ 2013-02-15 8:04 UTC (permalink / raw)
To: James Hogan; +Cc: linux-kernel, Arnd Bergmann
On Wed, Feb 13, 2013 at 4:03 AM, James Hogan <james.hogan@imgtec.com> wrote:
> Convert hugetlb_get_unmapped_area_new_pmd() to use vm_unmapped_area()
> rather than searching the virtual address space itself. This fixes the
> following errors in linux-next due to the specified members being
> removed after other architectures have already been converted:
>
> arch/metag/mm/hugetlbpage.c: In function 'hugetlb_get_unmapped_area_new_pmd':
> arch/metag/mm/hugetlbpage.c:199: error: 'struct mm_struct' has no member named 'cached_hole_size'
> arch/metag/mm/hugetlbpage.c:200: error: 'struct mm_struct' has no member named 'free_area_cache'
> arch/metag/mm/hugetlbpage.c:215: error: 'struct mm_struct' has no member named 'cached_hole_size'
>
> Signed-off-by: James Hogan <james.hogan@imgtec.com>
> Cc: Michel Lespinasse <walken@google.com>
Looks good. Just one thing, which I don't have full context to evaluate:
> + info.align_mask = PAGE_MASK & HUGEPT_MASK;
This will work only if HUGEPT_MASK == HUGEPT_SIZE - 1, as opposed to
the PAGE_MASK definition which is ~(PAGE_SIZE - 1).
Not sure how HUGEPT_MASK is defined, so please double check that.
Acked-by: Michel Lespinasse <walken@google.com>
--
Michel "Walken" Lespinasse
A program is never fully debugged until the last user dies.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/5] metag: hugetlb: convert to vm_unmapped_area()
2013-02-15 8:04 ` Michel Lespinasse
@ 2013-02-15 9:26 ` James Hogan
0 siblings, 0 replies; 8+ messages in thread
From: James Hogan @ 2013-02-15 9:26 UTC (permalink / raw)
To: Michel Lespinasse; +Cc: linux-kernel, Arnd Bergmann
On 15/02/13 08:04, Michel Lespinasse wrote:
> On Wed, Feb 13, 2013 at 4:03 AM, James Hogan <james.hogan@imgtec.com> wrote:
>> Convert hugetlb_get_unmapped_area_new_pmd() to use vm_unmapped_area()
>> rather than searching the virtual address space itself. This fixes the
>> following errors in linux-next due to the specified members being
>> removed after other architectures have already been converted:
>>
>> arch/metag/mm/hugetlbpage.c: In function 'hugetlb_get_unmapped_area_new_pmd':
>> arch/metag/mm/hugetlbpage.c:199: error: 'struct mm_struct' has no member named 'cached_hole_size'
>> arch/metag/mm/hugetlbpage.c:200: error: 'struct mm_struct' has no member named 'free_area_cache'
>> arch/metag/mm/hugetlbpage.c:215: error: 'struct mm_struct' has no member named 'cached_hole_size'
>>
>> Signed-off-by: James Hogan <james.hogan@imgtec.com>
>> Cc: Michel Lespinasse <walken@google.com>
>
> Looks good. Just one thing, which I don't have full context to evaluate:
>
>> + info.align_mask = PAGE_MASK & HUGEPT_MASK;
>
> This will work only if HUGEPT_MASK == HUGEPT_SIZE - 1, as opposed to
> the PAGE_MASK definition which is ~(PAGE_SIZE - 1).
> Not sure how HUGEPT_MASK is defined, so please double check that.
>
> Acked-by: Michel Lespinasse <walken@google.com>
>
Thanks Michel. HUGEPT_MASK is indeed equal to HUGEPT_SIZE - 1. I
originally did info.align_mask = PAGE_MASK & ~HUGEPT_MASK accidentally
and as you say it just didn't work :)
Cheers
James
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-02-15 9:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-13 12:03 [PATCH 0/5] metag: second set of misc patches for v3.9 James Hogan
2013-02-13 12:03 ` [PATCH 1/5] metag: export metag_code_cache_flush_all James Hogan
2013-02-13 12:03 ` [PATCH 2/5] metag: export clear_page and copy_page James Hogan
2013-02-13 12:03 ` [PATCH 3/5] metag: hugetlb: convert to vm_unmapped_area() James Hogan
2013-02-15 8:04 ` Michel Lespinasse
2013-02-15 9:26 ` James Hogan
2013-02-13 12:03 ` [PATCH 4/5] genksyms: fix metag symbol prefix on crc symbols James Hogan
2013-02-13 12:03 ` [PATCH 5/5] metag: move irq enable out of irqflags.h on SMP James Hogan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).