Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Franck Bui-Huu <vagabon.xyz@gmail.com>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] sparsemem fix
Date: Wed, 05 Jul 2006 10:35:28 +0200	[thread overview]
Message-ID: <44AB79D0.90002@innova-card.com> (raw)
In-Reply-To: <20060705.012244.96686002.anemo@mba.ocn.ne.jp>

Atsushi Nemoto wrote:
> 1. MIPS should select SPARSEMEM_STATIC since allocating bootmem in
>    memory_present() will corrupt bootmap area.
> 2. pfn_valid() for SPARSEMEM is defined in linux/mmzone.h
> 
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> 
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index f151a7e..879a19c 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -1690,6 +1690,7 @@ config ARCH_DISCONTIGMEM_ENABLE
>  
>  config ARCH_SPARSEMEM_ENABLE
>  	bool
> +	select SPARSEMEM_STATIC
>  
>  config NUMA
>  	bool "NUMA Support"
> diff --git a/include/asm-mips/page.h b/include/asm-mips/page.h
> index 6b97744..6ed1151 100644
> --- a/include/asm-mips/page.h
> +++ b/include/asm-mips/page.h
> @@ -138,16 +138,14 @@ #define __va(x)			((void *)((unsigned lo
>  
>  #define pfn_to_kaddr(pfn)	__va((pfn) << PAGE_SHIFT)
>  
> -#ifndef CONFIG_SPARSEMEM
> -#ifndef CONFIG_NEED_MULTIPLE_NODES
> -#define pfn_valid(pfn)		((pfn) < max_mapnr)
> -#endif
> -#endif
> -
>  #ifdef CONFIG_FLATMEM
>  
>  #define pfn_valid(pfn)		((pfn) < max_mapnr)
>  

In flatmem case, I would define pfn_valid like:

#define pfn_valid(pfn)          ((pfn) >= ARCH_PFN_OFFSET && (pfn) < max_mapnr)

> +#elif defined(CONFIG_SPARSEMEM)
> +
> +/* pfn_valid is defined in linux/mmzone.h */
> +
>  #elif defined(CONFIG_NEED_MULTIPLE_NODES)

why not using:

#elif defined(CONFIG_DISCONTIGMEM) || defined(CONFIG_NUMA)

hence, we would have all memory model cases.

For now it seems to be implemented only in sgi-ip27 machine. Maybe we should
make things clear by adding:

#ifdef CONFIG_SGI_IP27
#define pfn_valid	[...]
#else
#error discontigmem model is only supported by sgi-ip27 platforms.
#error Please try to implement a generic solution if you plan to
#error use this memory model. Good luck ;)
#endif /* CONFIG_SGI_IP27 */

>  
>  #define pfn_valid(pfn)							\
> @@ -159,8 +157,6 @@ ({									\
>  	            : 0);						\
>  })
>  
> -#else
> -#error Provide a definition of pfn_valid
>  #endif

maybe this would be better too ?

#else

#error Unknow memory model, provide a definition of pfn_valid

#endif

>  
>  #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
> 
> 

  parent reply	other threads:[~2006-07-05  8:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-04 16:22 [PATCH] sparsemem fix Atsushi Nemoto
2006-07-04 17:03 ` Chad Reese
2006-07-05  1:30   ` Atsushi Nemoto
2006-07-05  8:35 ` Franck Bui-Huu [this message]
2006-07-05 10:20   ` Atsushi Nemoto
2006-07-05 10:51     ` Franck Bui-Huu
2006-07-06 17:37       ` Ralf Baechle
2006-07-06 17:32     ` Ralf Baechle
2006-07-08 14:47       ` Franck Bui-Huu
2006-07-09 22:46         ` Ralf Baechle
2006-07-10  7:52           ` Franck Bui-Huu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44AB79D0.90002@innova-card.com \
    --to=vagabon.xyz@gmail.com \
    --cc=anemo@mba.ocn.ne.jp \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox