[PATCH 2/3] powerpc: Split mmu_context handling

Stephen Rothwell sfr at canb.auug.org.au
Thu Dec 4 17:17:33 EST 2008


Hi Ben,

On Thu, 04 Dec 2008 16:41:48 +1100 Benjamin Herrenschmidt <benh at kernel.crashing.org> wrote:
>
> --- linux-work.orig/arch/powerpc/include/asm/bug.h	2008-12-03 13:50:01.000000000 +1100
> +++ linux-work/arch/powerpc/include/asm/bug.h	2008-12-03 13:50:18.000000000 +1100
> @@ -26,7 +26,7 @@
>  	 .previous
>  .endm
>  #else
> - .macro EMIT_BUG_ENTRY addr,file,line,flags
> +.macro EMIT_BUG_ENTRY addr,file,line,flags

Please don't make unrelated trivial fixups - they just make us look hard
to see if something really changed.

> -/*
> - * switch_mm is the entry point called from the architecture independent
> +/* switch_mm is the entry point called from the architecture independent

The same goes for just changing the comment style away from the usual ...

> -/*
> - * After we have set current->mm to a new value, this activates
> +/* After we have set current->mm to a new value, this activates

Ditto

> --- linux-work.orig/arch/powerpc/kernel/head_32.S	2008-12-03 13:50:01.000000000 +1100
> +++ linux-work/arch/powerpc/kernel/head_32.S	2008-12-03 13:50:18.000000000 +1100
> @@ -1050,7 +1051,7 @@ start_here:
>  	 * We do this here because we know the mmu is disabled, and
>  	 * will be enabled for real in just a few instructions.
>  	 */
> -	lis	r5, abatron_pteptrs at h
> +	lis	r5, abatron_pteptrs at h\
                                     ^
Is this right?

> +++ linux-work/arch/powerpc/mm/mmu_context_hash32.c	2008-12-03 13:50:18.000000000 +1100
> +/*
> + * This function defines the mapping from contexts to VSIDs (virtual
> + * segment IDs).  We use a skew on both the context and the high 4 bits
> + * of the 32-bit virtual address (the "effective segment ID") in order
> + * to spread out the entries in the MMU hash table.  Note, if this
> + * function is changed then arch/ppc/mm/hashtable.S will have to be
> + * changed to correspond.
> + */
> +#define CTX_TO_VSID(ctx, va)	(((ctx) * (897 * 16) + ((va) >> 28) * 0x111) \
> +				 & 0xffffff)

Any reason this is not a static inline function?  Hmmm, actually it
doesn't look like it is used anywhere ... I guess its just for
documentation?

> +++ linux-work/arch/powerpc/mm/mmu_context_nohash.c	2008-12-03 13:50:18.000000000 +1100
> +#ifdef CONFIG_8xx
> +#define NO_CONTEXT      	16
> +#define LAST_CONTEXT    	15
> +#define FIRST_CONTEXT    	0
> +
> +#elif defined(CONFIG_4xx)
> +#define NO_CONTEXT      	256
> +#define LAST_CONTEXT    	255
> +#define FIRST_CONTEXT    	1
> +
> +#elif defined(CONFIG_E200) || defined(CONFIG_E500)
> +#define NO_CONTEXT      	256
> +#define LAST_CONTEXT    	255
> +#define FIRST_CONTEXT    	1

Why not combine these last two?

> +static unsigned long next_mmu_context;

> +	/* free up context `next_mmu_context' */
> +	/* if we shouldn't free context 0, don't... */
> +	if (next_mmu_context < FIRST_CONTEXT)

If FIRST_CONTEXT is 0, this will generate a compiler warning (as
next_mmu_context can't be < 0).

> +config PPC_MMU_NOHASH_32
> +	def_bool y
> +	depends on PPC_MMU_NOHASH && PPC32
> +
> +config PPC_MMU_NOHASH_64
> +	def_bool y
> +	depends on PPC_MMU_NOHASH && PPC64

Neither of these are used anywhere.

-- 
Cheers,
Stephen Rothwell                    sfr at canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20081204/a3bbf59c/attachment.pgp>


More information about the Linuxppc-dev mailing list