linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	linux-mips@linux-mips.org,
	Sergei Shtylyov <sshtylyov@ru.mvista.com>,
	Pavel Machek <pavel@ucw.cz>
Subject: Re: [PATCH -v1] MIPS: fix pfn_valid() for FLATMEM
Date: Sat, 10 Oct 2009 00:02:10 +0800	[thread overview]
Message-ID: <1255104130.3658.122.camel@falcon> (raw)
In-Reply-To: <1255054108.5810.74.camel@falcon>

On Fri, 2009-10-09 at 10:08 +0800, Wu Zhangjin wrote:
> On Thu, 2009-10-08 at 22:44 +0200, Ralf Baechle wrote:
> > On Thu, Oct 08, 2009 at 10:21:12PM +0200, Rafael J. Wysocki wrote:
> > 
> > > > Here, we fix it via checking pfn is in the "System RAM" or not. and
> > > > Seems pfn_valid() is not called in assembly code, we move it to
> > > > "!__ASSEMBLY__" to ensure we can simply declare it via "extern int
> > > > pfn_valid(unsigned long)" without Compiling Error.
> > > > 
> > > > (This -v1 version incorporates feedback from Pavel Machek <pavel@ucw.cz>
> > > >  and Sergei Shtylyov <sshtylyov@ru.mvista.com>)
> > > 
> > > Hmm.  What exactly would be wrong with using register_nosave_region() or
> > > register_nosave_region_late() like x86 does?
> 
> Have tried to use register_nosave_region(), it works, but seems there is
> something else wrong there.
> 
> > 
> > That seems to be more the fix than pfn_valid / PageReserved fiddlery we were
> > discussing in the other thread.  Thanks!
> 
> Just checked the arch/mips/loongson/common/mem.c, Seems it did not
> register any reserved pages, in reality, two sections of memory are
> reserved.
> 
> here should be the patch, tested it, works.
> 
> diff --git a/arch/mips/loongson/common/mem.c
> b/arch/mips/loongson/common/mem.c
> index 7c92f79..069d20b 100644
> --- a/arch/mips/loongson/common/mem.c
> +++ b/arch/mips/loongson/common/mem.c
> @@ -15,11 +15,17 @@
>  
>  void __init prom_init_memory(void)
>  {
> -    add_memory_region(0x0, (memsize << 20), BOOT_MEM_RAM);
> +    add_memory_region(0x0, memsize << 20, BOOT_MEM_RAM);
> +
> +    add_memory_region(memsize << 20, LOONGSON_PCI_MEM_START - (memsize
> <<
> +                           20), BOOT_MEM_RESERVED);
>  #ifdef CONFIG_64BIT
>      if (highmemsize > 0)
>         add_memory_region(LOONGSON_HIGHMEM_START,
>                 highmemsize << 20, BOOT_MEM_RAM);
> +
> +    add_memory_region(LOONGSON_PCI_MEM_END + 1, LOONGSON_HIGHMEM_START
> -
> +                   LOONGSON_PCI_MEM_END - 1, BOOT_MEM_RESERVED);
>  #endif /* CONFIG_64BIT */
>  }

The above patch can not fix the problem when enabled FLATMEM in
linux-2.6.32-rc3, the real problem should be that we need register the
"pci memory space" as nosave pages, and also, the above "reserved"(not
memory) pages should be registered as nosave pages. but the simpler
solution should be the pfn_valid() I sent out in this E-mail thread, we
just need to check whether they are "valid", if they are "System
RAM"(BOOT_MEM_RAM or BOOT_MEM_ROM_DATA), they should be valid.

and what's more? should be register "pci memory space" as nosave pages
for all architecture?

Regards,
	Wu Zhangjin

  reply	other threads:[~2009-10-09 16:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-08 11:32 [PATCH -v1] MIPS: fix pfn_valid() for FLATMEM Wu Zhangjin
2009-10-08 20:21 ` Rafael J. Wysocki
2009-10-08 20:44   ` Ralf Baechle
2009-10-09  2:08     ` Wu Zhangjin
2009-10-09 16:02       ` Wu Zhangjin [this message]
2009-10-13 22:04         ` Ralf Baechle
2009-10-14  1:06           ` Wu Zhangjin
  -- strict thread matches above, loose matches on Subject: below --
2009-10-09 16:15 Wu Zhangjin
2009-10-09 16:20 ` Wu Zhangjin
2009-10-10 14:38 ` Wu Zhangjin
2009-10-10 19:19   ` Wu Zhangjin

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=1255104130.3658.122.camel@falcon \
    --to=wuzhangjin@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=pavel@ucw.cz \
    --cc=ralf@linux-mips.org \
    --cc=rjw@sisk.pl \
    --cc=sshtylyov@ru.mvista.com \
    /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;
as well as URLs for NNTP newsgroup(s).