linux-mips
[Top] [All Lists]

Re: [PATCH -v1] MIPS: fix pfn_valid() for FLATMEM

To: Wu Zhangjin <wuzhangjin@gmail.com>
Subject: Re: [PATCH -v1] MIPS: fix pfn_valid() for FLATMEM
From: "Rafael J. Wysocki" <rjw@sisk.pl>
Date: Thu, 8 Oct 2009 22:21:12 +0200
Cc: linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>, Sergei Shtylyov <sshtylyov@ru.mvista.com>, Pavel Machek <pavel@ucw.cz>
In-reply-to: <1255001548-30567-1-git-send-email-wuzhangjin@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <1255001548-30567-1-git-send-email-wuzhangjin@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: KMail/1.12.1 (Linux/2.6.32-rc3-rjw; KDE/4.3.1; x86_64; ; )
On Thursday 08 October 2009, Wu Zhangjin wrote:
> When CONFIG_FLATMEM enabled, STD/Hiberation will fail on YeeLoong
> laptop, This patch fixes it:
> 
> if pfn is between min_low_pfn and max_mapnr, the old pfn_valid() will
> return TRUE, but in reality, if the memory is not continuous, it should
> be false. for example:
> 
> $ cat /proc/iomem | grep "System RAM"
> 00000000-0fffffff : System RAM
> 90000000-bfffffff : System RAM
> 
> as we can see, it is not continuous, so, some of the memory is not valid
> but regarded as valid by pfn_valid(), and at last make STD/Hibernate
> fail when shrinking a too large number of invalid memory.
> 
> 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?

Thanks,
Rafael

<Prev in Thread] Current Thread [Next in Thread>