All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt.fleming@intel.com>
To: Xishi Qiu <qiuxishi@huawei.com>
Cc: "Luck, Tony" <tony.luck@intel.com>,
	fenghua.yu@intel.com, Liujiang <jiang.liu@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-efi@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] ia64/mm: fix a bad_page bug when crash kernel booting
Date: Mon, 04 Feb 2013 16:32:45 +0000	[thread overview]
Message-ID: <1359995565.7515.178.camel@mfleming-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <51074786.5030007@huawei.com>

On Tue, 2013-01-29 at 11:52 +0800, Xishi Qiu wrote:
> On ia64 platform, I set "crashkernel=1024M-:600M", and dmesg shows 128M-728M
> memory is reserved for crash kernel. Then "echo c > /proc/sysrq-trigger" to
> test kdump.
> 
> When crash kernel booting, efi_init() will aligns the memory address in
> IA64_GRANULE_SIZE(16M), so 720M-728M memory will be dropped, It means
> crash kernel only manage 128M-720M memory.
> 
> But initrd start and end are fixed in boot loader, it is before efi_init(),
> so initrd size maybe overflow when free_initrd_mem().

[...]

> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> index b755ea9..cfdb1eb 100644
> --- a/arch/ia64/mm/init.c
> +++ b/arch/ia64/mm/init.c
> @@ -207,6 +207,17 @@ free_initrd_mem (unsigned long start, unsigned long end)
>  	start = PAGE_ALIGN(start);
>  	end = end & PAGE_MASK;
> 
> +	/*
> +	 * Initrd size is fixed in boot loader, but kernel parameter max_addr
> +	 * which aligns in granules is fixed after boot loader, so initrd size
> +	 * maybe overflow.
> +	 */
> +	if (max_addr != ~0UL) {
> +		end = GRANULEROUNDDOWN(end);
> +		if (start > end)
> +			start = end;
> +	}
> +
>  	if (start < end)
>  		printk(KERN_INFO "Freeing initrd memory: %ldkB freed\n", (end - start) >> 10);

I don't think this is the correct fix.

Now, my ia64-fu is weak, but could it be that there's actually a bug in
efi_init() and that the following patch would be the best way to fix
this?

---

diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index f034563..8d579f1 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -482,7 +482,7 @@ efi_init (void)
 		if (memcmp(cp, "mem=", 4) == 0) {
 			mem_limit = memparse(cp + 4, &cp);
 		} else if (memcmp(cp, "max_addr=", 9) == 0) {
-			max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
+			max_addr = GRANULEROUNDUP(memparse(cp + 9, &cp));
 		} else if (memcmp(cp, "min_addr=", 9) == 0) {
 			min_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
 		} else {



WARNING: multiple messages have this Message-ID (diff)
From: Matt Fleming <matt.fleming@intel.com>
To: Xishi Qiu <qiuxishi@huawei.com>
Cc: "Luck, Tony" <tony.luck@intel.com>,
	fenghua.yu@intel.com, Liujiang <jiang.liu@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-efi@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] ia64/mm: fix a bad_page bug when crash kernel booting
Date: Mon, 04 Feb 2013 16:32:45 +0000	[thread overview]
Message-ID: <1359995565.7515.178.camel@mfleming-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <51074786.5030007@huawei.com>

On Tue, 2013-01-29 at 11:52 +0800, Xishi Qiu wrote:
> On ia64 platform, I set "crashkernel=1024M-:600M", and dmesg shows 128M-728M
> memory is reserved for crash kernel. Then "echo c > /proc/sysrq-trigger" to
> test kdump.
> 
> When crash kernel booting, efi_init() will aligns the memory address in
> IA64_GRANULE_SIZE(16M), so 720M-728M memory will be dropped, It means
> crash kernel only manage 128M-720M memory.
> 
> But initrd start and end are fixed in boot loader, it is before efi_init(),
> so initrd size maybe overflow when free_initrd_mem().

[...]

> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> index b755ea9..cfdb1eb 100644
> --- a/arch/ia64/mm/init.c
> +++ b/arch/ia64/mm/init.c
> @@ -207,6 +207,17 @@ free_initrd_mem (unsigned long start, unsigned long end)
>  	start = PAGE_ALIGN(start);
>  	end = end & PAGE_MASK;
> 
> +	/*
> +	 * Initrd size is fixed in boot loader, but kernel parameter max_addr
> +	 * which aligns in granules is fixed after boot loader, so initrd size
> +	 * maybe overflow.
> +	 */
> +	if (max_addr != ~0UL) {
> +		end = GRANULEROUNDDOWN(end);
> +		if (start > end)
> +			start = end;
> +	}
> +
>  	if (start < end)
>  		printk(KERN_INFO "Freeing initrd memory: %ldkB freed\n", (end - start) >> 10);

I don't think this is the correct fix.

Now, my ia64-fu is weak, but could it be that there's actually a bug in
efi_init() and that the following patch would be the best way to fix
this?

---

diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index f034563..8d579f1 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -482,7 +482,7 @@ efi_init (void)
 		if (memcmp(cp, "mem=", 4) == 0) {
 			mem_limit = memparse(cp + 4, &cp);
 		} else if (memcmp(cp, "max_addr=", 9) == 0) {
-			max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
+			max_addr = GRANULEROUNDUP(memparse(cp + 9, &cp));
 		} else if (memcmp(cp, "min_addr=", 9) == 0) {
 			min_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
 		} else {


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Matt Fleming <matt.fleming@intel.com>
To: Xishi Qiu <qiuxishi@huawei.com>
Cc: "Luck, Tony" <tony.luck@intel.com>,
	fenghua.yu@intel.com, Liujiang <jiang.liu@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-ia64@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-efi@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] ia64/mm: fix a bad_page bug when crash kernel booting
Date: Mon, 04 Feb 2013 16:32:45 +0000	[thread overview]
Message-ID: <1359995565.7515.178.camel@mfleming-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <51074786.5030007@huawei.com>

On Tue, 2013-01-29 at 11:52 +0800, Xishi Qiu wrote:
> On ia64 platform, I set "crashkernel\x1024M-:600M", and dmesg shows 128M-728M
> memory is reserved for crash kernel. Then "echo c > /proc/sysrq-trigger" to
> test kdump.
> 
> When crash kernel booting, efi_init() will aligns the memory address in
> IA64_GRANULE_SIZE(16M), so 720M-728M memory will be dropped, It means
> crash kernel only manage 128M-720M memory.
> 
> But initrd start and end are fixed in boot loader, it is before efi_init(),
> so initrd size maybe overflow when free_initrd_mem().

[...]

> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> index b755ea9..cfdb1eb 100644
> --- a/arch/ia64/mm/init.c
> +++ b/arch/ia64/mm/init.c
> @@ -207,6 +207,17 @@ free_initrd_mem (unsigned long start, unsigned long end)
>  	start = PAGE_ALIGN(start);
>  	end = end & PAGE_MASK;
> 
> +	/*
> +	 * Initrd size is fixed in boot loader, but kernel parameter max_addr
> +	 * which aligns in granules is fixed after boot loader, so initrd size
> +	 * maybe overflow.
> +	 */
> +	if (max_addr != ~0UL) {
> +		end = GRANULEROUNDDOWN(end);
> +		if (start > end)
> +			start = end;
> +	}
> +
>  	if (start < end)
>  		printk(KERN_INFO "Freeing initrd memory: %ldkB freed\n", (end - start) >> 10);

I don't think this is the correct fix.

Now, my ia64-fu is weak, but could it be that there's actually a bug in
efi_init() and that the following patch would be the best way to fix
this?

---

diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index f034563..8d579f1 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -482,7 +482,7 @@ efi_init (void)
 		if (memcmp(cp, "mem=", 4) = 0) {
 			mem_limit = memparse(cp + 4, &cp);
 		} else if (memcmp(cp, "max_addr=", 9) = 0) {
-			max_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
+			max_addr = GRANULEROUNDUP(memparse(cp + 9, &cp));
 		} else if (memcmp(cp, "min_addr=", 9) = 0) {
 			min_addr = GRANULEROUNDDOWN(memparse(cp + 9, &cp));
 		} else {



  reply	other threads:[~2013-02-04 16:32 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29  3:52 [PATCH] ia64/mm: fix a bad_page bug when crash kernel booting Xishi Qiu
2013-01-29  3:52 ` Xishi Qiu
2013-01-29  3:52 ` Xishi Qiu
2013-01-29  3:52 ` Xishi Qiu
2013-02-04 16:32 ` Matt Fleming [this message]
2013-02-04 16:32   ` Matt Fleming
2013-02-04 16:32   ` Matt Fleming
2013-02-05  3:48   ` Xishi Qiu
2013-02-05  3:48     ` Xishi Qiu
2013-02-05  3:48     ` Xishi Qiu
2013-02-05  3:48     ` Xishi Qiu
2013-02-07  2:32   ` [PATCH V2] " Xishi Qiu
2013-02-07  2:32     ` Xishi Qiu
2013-02-07  2:32     ` Xishi Qiu
2013-02-07  2:32     ` Xishi Qiu
2013-02-07  6:09     ` [PATCH V3] " Xishi Qiu
2013-02-07  6:09       ` Xishi Qiu
2013-02-07  6:09       ` Xishi Qiu
2013-02-07  6:09       ` Xishi Qiu
2013-02-13  0:11       ` Tony Luck
2013-02-13  0:11         ` Tony Luck
2013-02-13  0:11         ` Tony Luck
2013-02-13  0:11         ` Tony Luck
2013-02-13  0:19         ` Andrew Morton
2013-02-13  0:19           ` Andrew Morton
2013-02-13  0:19           ` Andrew Morton
2013-02-13  0:19           ` Andrew Morton
2013-02-13  0:32           ` Tony Luck
2013-02-13  0:32             ` Tony Luck
2013-02-13  0:32             ` Tony Luck
2013-02-13  0:22         ` Andrew Morton
2013-02-13  0:22           ` Andrew Morton
2013-02-13  0:22           ` Andrew Morton
2013-02-13  0:22           ` Andrew Morton
2013-02-13 10:07       ` Matt Fleming
2013-02-13 10:07         ` Matt Fleming
2013-02-13 10:07         ` Matt Fleming
2013-02-16  1:55         ` Xishi Qiu
2013-02-16  1:55           ` Xishi Qiu
2013-02-16  1:55           ` Xishi Qiu
2013-02-16  1:55           ` Xishi Qiu
2013-02-19 21:38       ` Luck, Tony
2013-02-19 21:38         ` Luck, Tony
2013-02-19 21:38         ` Luck, Tony
2013-02-19 21:56       ` Tony Luck
2013-02-19 21:56         ` Tony Luck
2013-02-19 21:56         ` Tony Luck
2013-02-19 21:56         ` Tony Luck
2013-02-20  1:38         ` Xishi Qiu
2013-02-20  1:38           ` Xishi Qiu
2013-02-20  1:38           ` Xishi Qiu
2013-02-21 18:21           ` Tony Luck
2013-02-21 18:21             ` Tony Luck
2013-02-21 18:21             ` Tony Luck

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=1359995565.7515.178.camel@mfleming-mobl1.ger.corp.intel.com \
    --to=matt.fleming@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=fenghua.yu@intel.com \
    --cc=jiang.liu@huawei.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=qiuxishi@huawei.com \
    --cc=tony.luck@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.