Patchwork Problem with module_init?

login
register
mail settings
Submitter Sean MacLennan
Date April 2, 2009, 4:08 a.m.
Message ID <20090402000803.087600da@lappy.seanm.ca>
Download mbox | patch
Permalink /patch/25515/
State Superseded
Headers show

Comments

Sean MacLennan - April 2, 2009, 4:08 a.m.
On Thu, 02 Apr 2009 09:24:43 +1100
"Benjamin Herrenschmidt" <benh@kernel.crashing.org> wrote:

> I suspect I just screwed up the definition of PAGE_KERNEL_EXEC or
> something like that.

Yup, that is exactly what you did ;) You left out _PAGE_HWEXEC. The
following patch fixes the problem for me.

Cheers,
   Sean
Benjamin Herrenschmidt - April 2, 2009, 4:26 a.m.
On Thu, 2009-04-02 at 00:08 -0400, Sean MacLennan wrote:
> On Thu, 02 Apr 2009 09:24:43 +1100
> "Benjamin Herrenschmidt" <benh@kernel.crashing.org> wrote:
> 
> > I suspect I just screwed up the definition of PAGE_KERNEL_EXEC or
> > something like that.
> 
> Yup, that is exactly what you did ;) You left out _PAGE_HWEXEC. The
> following patch fixes the problem for me.

The proper fix is for PAGE_KERNEL_X to have _PAGE_HWEXEC. I'll fix that.

Cheers,
Ben.

> Cheers,
>    Sean
> 
> diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h
> index d9740e8..a84f248 100644
> --- a/arch/powerpc/include/asm/pte-common.h
> +++ b/arch/powerpc/include/asm/pte-common.h
> @@ -167,7 +167,8 @@ extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
>  #endif
>  
>  /* Make modules code happy. We don't set RO yet */
> -#define PAGE_KERNEL_EXEC	PAGE_KERNEL_X
> +// #define PAGE_KERNEL_EXEC	PAGE_KERNEL_X
> +#define PAGE_KERNEL_EXEC __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW | _PAGE_EXEC | _PAGE_HWEXEC)
>  
>  /* Advertise special mapping type for AGP */
>  #define PAGE_AGP		(PAGE_KERNEL_NC)
Sean MacLennan - April 2, 2009, 4:39 a.m.
On Thu, 02 Apr 2009 15:26:02 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> The proper fix is for PAGE_KERNEL_X to have _PAGE_HWEXEC. I'll fix
> that.

That may not be enough. I made that change (adding _PAGE_HWEXEC to
PAGE_KERNEL_X) and it works for some drivers, but I am still crashing in
one driver. Although, that *could* be unrelated bug.

Cheers,
   Sean
Sean MacLennan - April 2, 2009, 4:51 a.m.
On Thu, 2 Apr 2009 00:39:05 -0400
"Sean MacLennan" <sean.maclennan@ottawa.kanatek.ca> wrote:

> Although, that *could* be unrelated bug.

It *is* an unrelated bug. dma_alloc_coherent now requires a device
where before it was optional. Carry on.

Cheers,
   Sean
Benjamin Herrenschmidt - April 2, 2009, 4:54 a.m.
On Thu, 2009-04-02 at 00:51 -0400, Sean MacLennan wrote:
> On Thu, 2 Apr 2009 00:39:05 -0400
> "Sean MacLennan" <sean.maclennan@ottawa.kanatek.ca> wrote:
> 
> > Although, that *could* be unrelated bug.
> 
> It *is* an unrelated bug. dma_alloc_coherent now requires a device
> where before it was optional. Carry on.

Right, that's new in .30

Cheers,
Ben.

> Cheers,
>    Sean

Patch

diff --git a/arch/powerpc/include/asm/pte-common.h b/arch/powerpc/include/asm/pte-common.h
index d9740e8..a84f248 100644
--- a/arch/powerpc/include/asm/pte-common.h
+++ b/arch/powerpc/include/asm/pte-common.h
@@ -167,7 +167,8 @@  extern unsigned long bad_call_to_PMD_PAGE_SIZE(void);
 #endif
 
 /* Make modules code happy. We don't set RO yet */
-#define PAGE_KERNEL_EXEC	PAGE_KERNEL_X
+// #define PAGE_KERNEL_EXEC	PAGE_KERNEL_X
+#define PAGE_KERNEL_EXEC __pgprot(_PAGE_BASE | _PAGE_KERNEL_RW | _PAGE_EXEC | _PAGE_HWEXEC)
 
 /* Advertise special mapping type for AGP */
 #define PAGE_AGP		(PAGE_KERNEL_NC)