Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-21 Thread Tony Luck
On Tue, Feb 19, 2013 at 5:38 PM, Xishi Qiu  wrote:
> Seems like a good idea, should we modify 
> "\linux\Documentation\kernel-parameters.txt"?

Perhaps in Documentation/kdump/kdump.txt (which the crashkernel entry
in kernel-parameters.txt
points at).  The ia64 section of kdump.txt notes that the start
address will be rounded up to
a GRANULE boundary, but doesn't talk about restrictions on the size.

I wonder if any other architectures have alignment restrictions on the
addresses in
"crashkernel" parameters? Does x86 like them to be 2MB aligned?

Second question is whether we should check and warn in parse_crashkernel_mem()?
I think the answer is "yes" (since the consequences of getting this
wrong don't show
up till much later, and the errors aren't all that obviously connected
back to the original
mistake).  Perhaps each architecture that cares could provide defines:

#define ARCH_CRASH_KERNEL_START_ALIGN (... arch value here ...)
#define ARCH_CRASH_KERNEL_SIZE_ALIGN (... arch value here ...)

[Suggestion provided mostly to provoke somebody to provide a more
elegant solution]

-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-21 Thread Tony Luck
On Tue, Feb 19, 2013 at 5:38 PM, Xishi Qiu qiuxi...@huawei.com wrote:
 Seems like a good idea, should we modify 
 \linux\Documentation\kernel-parameters.txt?

Perhaps in Documentation/kdump/kdump.txt (which the crashkernel entry
in kernel-parameters.txt
points at).  The ia64 section of kdump.txt notes that the start
address will be rounded up to
a GRANULE boundary, but doesn't talk about restrictions on the size.

I wonder if any other architectures have alignment restrictions on the
addresses in
crashkernel parameters? Does x86 like them to be 2MB aligned?

Second question is whether we should check and warn in parse_crashkernel_mem()?
I think the answer is yes (since the consequences of getting this
wrong don't show
up till much later, and the errors aren't all that obviously connected
back to the original
mistake).  Perhaps each architecture that cares could provide defines:

#define ARCH_CRASH_KERNEL_START_ALIGN (... arch value here ...)
#define ARCH_CRASH_KERNEL_SIZE_ALIGN (... arch value here ...)

[Suggestion provided mostly to provoke somebody to provide a more
elegant solution]

-Tony
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-19 Thread Xishi Qiu
On 2013/2/20 5:56, Tony Luck wrote:

> Foolishly sent an earlier reply from Outlook which appears
> to have mangled/lost it. Trying again ...
> 
>> In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
>> "crashkernel=1024M-:600M"
> 
> Is this where the real problem begins?  Should we insist that users

Hi Tony, I think this is the real problem begins and it only appears when use 
Sparse-Memory.

> provide crashkernel
> parameters rounded to GRANULE boundaries?
> 

Seems like a good idea, should we modify 
"\linux\Documentation\kernel-parameters.txt"?

Thanks,
Xishi Qiu

> -Tony
>  


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-19 Thread Tony Luck
Foolishly sent an earlier reply from Outlook which appears
to have mangled/lost it. Trying again ...

> In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
> "crashkernel=1024M-:600M"

Is this where the real problem begins?  Should we insist that users
provide crashkernel
parameters rounded to GRANULE boundaries?

-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-19 Thread Luck, Tony
> In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
> "crashkernel=1024M-:600M"

Is this where the real problem begins?  Should we insist that users provide 
crashkernel
parameters rounded to GRANULE boundaries?

-Tony
N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a���
0��h���i

RE: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-19 Thread Luck, Tony
 In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
 crashkernel=1024M-:600M

Is this where the real problem begins?  Should we insist that users provide 
crashkernel
parameters rounded to GRANULE boundaries?

-Tony
N�r��yb�X��ǧv�^�)޺{.n�+{zX����ܨ}���Ơz�j:+v���zZ+��+zf���h���~i���z��w���?��)ߢf��^jǫy�m��@A�a���
0��h���i

Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-19 Thread Tony Luck
Foolishly sent an earlier reply from Outlook which appears
to have mangled/lost it. Trying again ...

 In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
 crashkernel=1024M-:600M

Is this where the real problem begins?  Should we insist that users
provide crashkernel
parameters rounded to GRANULE boundaries?

-Tony
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-19 Thread Xishi Qiu
On 2013/2/20 5:56, Tony Luck wrote:

 Foolishly sent an earlier reply from Outlook which appears
 to have mangled/lost it. Trying again ...
 
 In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
 crashkernel=1024M-:600M
 
 Is this where the real problem begins?  Should we insist that users

Hi Tony, I think this is the real problem begins and it only appears when use 
Sparse-Memory.

 provide crashkernel
 parameters rounded to GRANULE boundaries?
 

Seems like a good idea, should we modify 
\linux\Documentation\kernel-parameters.txt?

Thanks,
Xishi Qiu

 -Tony
  


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-15 Thread Xishi Qiu
On 2013/2/13 18:07, Matt Fleming wrote:

>> In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
>> "crashkernel=1024M-:600M"
>> and use sparse memory model, when crash kernel booting it changes 
>> [128M-728M] to [128M-720M].
>> But initrd memory is in [709M-727M], and virt_addr_valid() *can not* check 
>> the invalid pages
>> when freeing initrd memory. There are some pages missed at the end of the 
>> seciton.
>>
>> ChangeLog V3:
>>  fixed vaddr mistake
>> ChangeLog V2:
>>  add invalid pages check when freeing initrd memory
>>
>> Signed-off-by: Xishi Qiu 
>> ---
>>  arch/ia64/mm/init.c |4 
>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
>> index 082e383..8a269f8 100644
>> --- a/arch/ia64/mm/init.c
>> +++ b/arch/ia64/mm/init.c
>> @@ -173,6 +173,7 @@ void __init
>>  free_initrd_mem (unsigned long start, unsigned long end)
>>  {
>>  struct page *page;
>> +unsigned long pfn;
>>  /*
>>   * EFI uses 4KB pages while the kernel can use 4KB or bigger.
>>   * Thus EFI and the kernel may have different page sizes. It is
>> @@ -213,6 +214,9 @@ free_initrd_mem (unsigned long start, unsigned long end)
>>  for (; start < end; start += PAGE_SIZE) {
>>  if (!virt_addr_valid(start))
>>  continue;
>> +pfn = __pa(start) >> PAGE_SHIFT;
>> +if (pfn >= max_low_pfn)
>> +continue;
>>  page = virt_to_page(start);
>>  ClearPageReserved(page);
>>  init_page_count(page);
> 
> I would have presumed that fixing this bug would involve modifying the
> ia64-specific kexec code?
> 
> Tony, Fenghua? Any thoughts?


Hi, I had the Spring Festival a few days ago. Please ignore the earlier
patch and consider the V3 one above.

Thanks,
Xishi Qiu


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-15 Thread Xishi Qiu
On 2013/2/13 18:07, Matt Fleming wrote:

 In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
 crashkernel=1024M-:600M
 and use sparse memory model, when crash kernel booting it changes 
 [128M-728M] to [128M-720M].
 But initrd memory is in [709M-727M], and virt_addr_valid() *can not* check 
 the invalid pages
 when freeing initrd memory. There are some pages missed at the end of the 
 seciton.

 ChangeLog V3:
  fixed vaddr mistake
 ChangeLog V2:
  add invalid pages check when freeing initrd memory

 Signed-off-by: Xishi Qiu qiuxi...@huawei.com
 ---
  arch/ia64/mm/init.c |4 
  1 files changed, 4 insertions(+), 0 deletions(-)

 diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
 index 082e383..8a269f8 100644
 --- a/arch/ia64/mm/init.c
 +++ b/arch/ia64/mm/init.c
 @@ -173,6 +173,7 @@ void __init
  free_initrd_mem (unsigned long start, unsigned long end)
  {
  struct page *page;
 +unsigned long pfn;
  /*
   * EFI uses 4KB pages while the kernel can use 4KB or bigger.
   * Thus EFI and the kernel may have different page sizes. It is
 @@ -213,6 +214,9 @@ free_initrd_mem (unsigned long start, unsigned long end)
  for (; start  end; start += PAGE_SIZE) {
  if (!virt_addr_valid(start))
  continue;
 +pfn = __pa(start)  PAGE_SHIFT;
 +if (pfn = max_low_pfn)
 +continue;
  page = virt_to_page(start);
  ClearPageReserved(page);
  init_page_count(page);
 
 I would have presumed that fixing this bug would involve modifying the
 ia64-specific kexec code?
 
 Tony, Fenghua? Any thoughts?


Hi, I had the Spring Festival a few days ago. Please ignore the earlier
patch and consider the V3 one above.

Thanks,
Xishi Qiu


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-13 Thread Matt Fleming
On Thu, 2013-02-07 at 14:09 +0800, Xishi Qiu wrote:
> > Sorry, this bug will be happen when use Sparse-Memory(section is valid, but 
> > last
> 
> > several pages are invalid). If use Flat-Memory, crash kernel will boot 
> > successfully.
> > I think the following patch would be better.
> > 
> > Hi Andrew, will you just ignore the earlier patch and consider the 
> > following one? :>
> > 
> > Signed-off-by: Xishi Qiu 
> > ---
> >  arch/ia64/mm/init.c |2 ++
> >  1 files changed, 2 insertions(+), 0 deletions(-)
> > 
> > diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> > index 082e383..23f2ee3 100644
> > --- a/arch/ia64/mm/init.c
> > +++ b/arch/ia64/mm/init.c
> > @@ -213,6 +213,8 @@ free_initrd_mem (unsigned long start, unsigned long end)
> > for (; start < end; start += PAGE_SIZE) {
> > if (!virt_addr_valid(start))
> > continue;
> > +   if ((start >> PAGE_SHIFT) >= max_low_pfn)
> 
> I confused the vaddr and paddr, really sorry for it.
> 
> In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
> "crashkernel=1024M-:600M"
> and use sparse memory model, when crash kernel booting it changes [128M-728M] 
> to [128M-720M].
> But initrd memory is in [709M-727M], and virt_addr_valid() *can not* check 
> the invalid pages
> when freeing initrd memory. There are some pages missed at the end of the 
> seciton.
> 
> ChangeLog V3:
>   fixed vaddr mistake
> ChangeLog V2:
>   add invalid pages check when freeing initrd memory
> 
> Signed-off-by: Xishi Qiu 
> ---
>  arch/ia64/mm/init.c |4 
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> index 082e383..8a269f8 100644
> --- a/arch/ia64/mm/init.c
> +++ b/arch/ia64/mm/init.c
> @@ -173,6 +173,7 @@ void __init
>  free_initrd_mem (unsigned long start, unsigned long end)
>  {
>   struct page *page;
> + unsigned long pfn;
>   /*
>* EFI uses 4KB pages while the kernel can use 4KB or bigger.
>* Thus EFI and the kernel may have different page sizes. It is
> @@ -213,6 +214,9 @@ free_initrd_mem (unsigned long start, unsigned long end)
>   for (; start < end; start += PAGE_SIZE) {
>   if (!virt_addr_valid(start))
>   continue;
> + pfn = __pa(start) >> PAGE_SHIFT;
> + if (pfn >= max_low_pfn)
> + continue;
>   page = virt_to_page(start);
>   ClearPageReserved(page);
>   init_page_count(page);

I would have presumed that fixing this bug would involve modifying the
ia64-specific kexec code?

Tony, Fenghua? Any thoughts?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-13 Thread Matt Fleming
On Thu, 2013-02-07 at 14:09 +0800, Xishi Qiu wrote:
  Sorry, this bug will be happen when use Sparse-Memory(section is valid, but 
  last
 
  several pages are invalid). If use Flat-Memory, crash kernel will boot 
  successfully.
  I think the following patch would be better.
  
  Hi Andrew, will you just ignore the earlier patch and consider the 
  following one? :
  
  Signed-off-by: Xishi Qiu qiuxi...@huawei.com
  ---
   arch/ia64/mm/init.c |2 ++
   1 files changed, 2 insertions(+), 0 deletions(-)
  
  diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
  index 082e383..23f2ee3 100644
  --- a/arch/ia64/mm/init.c
  +++ b/arch/ia64/mm/init.c
  @@ -213,6 +213,8 @@ free_initrd_mem (unsigned long start, unsigned long end)
  for (; start  end; start += PAGE_SIZE) {
  if (!virt_addr_valid(start))
  continue;
  +   if ((start  PAGE_SHIFT) = max_low_pfn)
 
 I confused the vaddr and paddr, really sorry for it.
 
 In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
 crashkernel=1024M-:600M
 and use sparse memory model, when crash kernel booting it changes [128M-728M] 
 to [128M-720M].
 But initrd memory is in [709M-727M], and virt_addr_valid() *can not* check 
 the invalid pages
 when freeing initrd memory. There are some pages missed at the end of the 
 seciton.
 
 ChangeLog V3:
   fixed vaddr mistake
 ChangeLog V2:
   add invalid pages check when freeing initrd memory
 
 Signed-off-by: Xishi Qiu qiuxi...@huawei.com
 ---
  arch/ia64/mm/init.c |4 
  1 files changed, 4 insertions(+), 0 deletions(-)
 
 diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
 index 082e383..8a269f8 100644
 --- a/arch/ia64/mm/init.c
 +++ b/arch/ia64/mm/init.c
 @@ -173,6 +173,7 @@ void __init
  free_initrd_mem (unsigned long start, unsigned long end)
  {
   struct page *page;
 + unsigned long pfn;
   /*
* EFI uses 4KB pages while the kernel can use 4KB or bigger.
* Thus EFI and the kernel may have different page sizes. It is
 @@ -213,6 +214,9 @@ free_initrd_mem (unsigned long start, unsigned long end)
   for (; start  end; start += PAGE_SIZE) {
   if (!virt_addr_valid(start))
   continue;
 + pfn = __pa(start)  PAGE_SHIFT;
 + if (pfn = max_low_pfn)
 + continue;
   page = virt_to_page(start);
   ClearPageReserved(page);
   init_page_count(page);

I would have presumed that fixing this bug would involve modifying the
ia64-specific kexec code?

Tony, Fenghua? Any thoughts?

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-12 Thread Tony Luck
On Tue, Feb 12, 2013 at 4:19 PM, Andrew Morton
 wrote:
> But, umm, why am I sitting here trying to maintain an ia64 bugfix and
> handling bug reports from the ia64 maintainer?  Wanna swap?

That sounds like a plan.  I'll look out for a new version with the
missing #include
and less silly global variable names and try to take it before you
pull it into -mm

-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-12 Thread Andrew Morton
On Tue, 12 Feb 2013 16:11:33 -0800
Tony Luck  wrote:

> Building linux-next today (tag next-20130212) I get the following errors when
> building arch/ia64/configs/{tiger_defconfig, zx1_defconfig, bigsur_defconfig,
> sim_defconfig}
> 
> arch/ia64/mm/init.c: In function 'free_initrd_mem':
> arch/ia64/mm/init.c:215: error: 'max_addr' undeclared (first use in
> this function)
> arch/ia64/mm/init.c:215: error: (Each undeclared identifier is
> reported only once
> arch/ia64/mm/init.c:215: error: for each function it appears in.)
> arch/ia64/mm/init.c:216: error: implicit declaration of function
> 'GRANULEROUNDDOWN'
> 

`max_addr' is an awesomely bad name for a global identifier, btw.

And this:

-static u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL;
+u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL;

needlessly exported `mem_limit' and `min_addr' as well.  These too are
very poor global identifiers.

Also, Matt suggested an alternative implementation which afaik hasn't
been responded to.


I think I'll just drop the patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-12 Thread Andrew Morton
On Tue, 12 Feb 2013 16:11:33 -0800
Tony Luck  wrote:

> Building linux-next today (tag next-20130212) I get the following errors when
> building arch/ia64/configs/{tiger_defconfig, zx1_defconfig, bigsur_defconfig,
> sim_defconfig}
> 
> arch/ia64/mm/init.c: In function 'free_initrd_mem':
> arch/ia64/mm/init.c:215: error: 'max_addr' undeclared (first use in
> this function)
> arch/ia64/mm/init.c:215: error: (Each undeclared identifier is
> reported only once
> arch/ia64/mm/init.c:215: error: for each function it appears in.)
> arch/ia64/mm/init.c:216: error: implicit declaration of function
> 'GRANULEROUNDDOWN'
> 
> with "git blame" saying that these lines in init.c were added/changed by
> 
> commit 5a54b4fb8f554b15c6113e30ca8412b7fe11c62e
> Author: Xishi Qiu 
> Date:   Thu Feb 7 12:25:59 2013 +1100
> 
> ia64/mm: fix a bad_page bug when crash kernel booting
> 

Presumably this:

--- 
a/arch/ia64/mm/init.c~ia64-mm-fix-a-bad_page-bug-when-crash-kernel-booting-fix
+++ a/arch/ia64/mm/init.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
_


But, umm, why am I sitting here trying to maintain an ia64 bugfix and
handling bug reports from the ia64 maintainer?  Wanna swap?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-12 Thread Tony Luck
Building linux-next today (tag next-20130212) I get the following errors when
building arch/ia64/configs/{tiger_defconfig, zx1_defconfig, bigsur_defconfig,
sim_defconfig}

arch/ia64/mm/init.c: In function 'free_initrd_mem':
arch/ia64/mm/init.c:215: error: 'max_addr' undeclared (first use in
this function)
arch/ia64/mm/init.c:215: error: (Each undeclared identifier is
reported only once
arch/ia64/mm/init.c:215: error: for each function it appears in.)
arch/ia64/mm/init.c:216: error: implicit declaration of function
'GRANULEROUNDDOWN'

with "git blame" saying that these lines in init.c were added/changed by

commit 5a54b4fb8f554b15c6113e30ca8412b7fe11c62e
Author: Xishi Qiu 
Date:   Thu Feb 7 12:25:59 2013 +1100

ia64/mm: fix a bad_page bug when crash kernel booting

-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-12 Thread Tony Luck
Building linux-next today (tag next-20130212) I get the following errors when
building arch/ia64/configs/{tiger_defconfig, zx1_defconfig, bigsur_defconfig,
sim_defconfig}

arch/ia64/mm/init.c: In function 'free_initrd_mem':
arch/ia64/mm/init.c:215: error: 'max_addr' undeclared (first use in
this function)
arch/ia64/mm/init.c:215: error: (Each undeclared identifier is
reported only once
arch/ia64/mm/init.c:215: error: for each function it appears in.)
arch/ia64/mm/init.c:216: error: implicit declaration of function
'GRANULEROUNDDOWN'

with git blame saying that these lines in init.c were added/changed by

commit 5a54b4fb8f554b15c6113e30ca8412b7fe11c62e
Author: Xishi Qiu qiuxi...@huawei.com
Date:   Thu Feb 7 12:25:59 2013 +1100

ia64/mm: fix a bad_page bug when crash kernel booting

-Tony
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-12 Thread Andrew Morton
On Tue, 12 Feb 2013 16:11:33 -0800
Tony Luck tony.l...@gmail.com wrote:

 Building linux-next today (tag next-20130212) I get the following errors when
 building arch/ia64/configs/{tiger_defconfig, zx1_defconfig, bigsur_defconfig,
 sim_defconfig}
 
 arch/ia64/mm/init.c: In function 'free_initrd_mem':
 arch/ia64/mm/init.c:215: error: 'max_addr' undeclared (first use in
 this function)
 arch/ia64/mm/init.c:215: error: (Each undeclared identifier is
 reported only once
 arch/ia64/mm/init.c:215: error: for each function it appears in.)
 arch/ia64/mm/init.c:216: error: implicit declaration of function
 'GRANULEROUNDDOWN'
 
 with git blame saying that these lines in init.c were added/changed by
 
 commit 5a54b4fb8f554b15c6113e30ca8412b7fe11c62e
 Author: Xishi Qiu qiuxi...@huawei.com
 Date:   Thu Feb 7 12:25:59 2013 +1100
 
 ia64/mm: fix a bad_page bug when crash kernel booting
 

Presumably this:

--- 
a/arch/ia64/mm/init.c~ia64-mm-fix-a-bad_page-bug-when-crash-kernel-booting-fix
+++ a/arch/ia64/mm/init.c
@@ -27,6 +27,7 @@
 #include asm/machvec.h
 #include asm/numa.h
 #include asm/patch.h
+#include asm/meminit.h
 #include asm/pgalloc.h
 #include asm/sal.h
 #include asm/sections.h
_


But, umm, why am I sitting here trying to maintain an ia64 bugfix and
handling bug reports from the ia64 maintainer?  Wanna swap?

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-12 Thread Andrew Morton
On Tue, 12 Feb 2013 16:11:33 -0800
Tony Luck tony.l...@gmail.com wrote:

 Building linux-next today (tag next-20130212) I get the following errors when
 building arch/ia64/configs/{tiger_defconfig, zx1_defconfig, bigsur_defconfig,
 sim_defconfig}
 
 arch/ia64/mm/init.c: In function 'free_initrd_mem':
 arch/ia64/mm/init.c:215: error: 'max_addr' undeclared (first use in
 this function)
 arch/ia64/mm/init.c:215: error: (Each undeclared identifier is
 reported only once
 arch/ia64/mm/init.c:215: error: for each function it appears in.)
 arch/ia64/mm/init.c:216: error: implicit declaration of function
 'GRANULEROUNDDOWN'
 

`max_addr' is an awesomely bad name for a global identifier, btw.

And this:

-static u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL;
+u64 mem_limit = ~0UL, max_addr = ~0UL, min_addr = 0UL;

needlessly exported `mem_limit' and `min_addr' as well.  These too are
very poor global identifiers.

Also, Matt suggested an alternative implementation which afaik hasn't
been responded to.


I think I'll just drop the patch.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-12 Thread Tony Luck
On Tue, Feb 12, 2013 at 4:19 PM, Andrew Morton
a...@linux-foundation.org wrote:
 But, umm, why am I sitting here trying to maintain an ia64 bugfix and
 handling bug reports from the ia64 maintainer?  Wanna swap?

That sounds like a plan.  I'll look out for a new version with the
missing #include
and less silly global variable names and try to take it before you
pull it into -mm

-Tony
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-06 Thread Xishi Qiu
> Sorry, this bug will be happen when use Sparse-Memory(section is valid, but 
> last

> several pages are invalid). If use Flat-Memory, crash kernel will boot 
> successfully.
> I think the following patch would be better.
> 
> Hi Andrew, will you just ignore the earlier patch and consider the following 
> one? :>
> 
> Signed-off-by: Xishi Qiu 
> ---
>  arch/ia64/mm/init.c |2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
> index 082e383..23f2ee3 100644
> --- a/arch/ia64/mm/init.c
> +++ b/arch/ia64/mm/init.c
> @@ -213,6 +213,8 @@ free_initrd_mem (unsigned long start, unsigned long end)
>   for (; start < end; start += PAGE_SIZE) {
>   if (!virt_addr_valid(start))
>   continue;
> + if ((start >> PAGE_SHIFT) >= max_low_pfn)

I confused the vaddr and paddr, really sorry for it.

In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
"crashkernel=1024M-:600M"
and use sparse memory model, when crash kernel booting it changes [128M-728M] 
to [128M-720M].
But initrd memory is in [709M-727M], and virt_addr_valid() *can not* check the 
invalid pages
when freeing initrd memory. There are some pages missed at the end of the 
seciton.

ChangeLog V3:
fixed vaddr mistake
ChangeLog V2:
add invalid pages check when freeing initrd memory

Signed-off-by: Xishi Qiu 
---
 arch/ia64/mm/init.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 082e383..8a269f8 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -173,6 +173,7 @@ void __init
 free_initrd_mem (unsigned long start, unsigned long end)
 {
struct page *page;
+   unsigned long pfn;
/*
 * EFI uses 4KB pages while the kernel can use 4KB or bigger.
 * Thus EFI and the kernel may have different page sizes. It is
@@ -213,6 +214,9 @@ free_initrd_mem (unsigned long start, unsigned long end)
for (; start < end; start += PAGE_SIZE) {
if (!virt_addr_valid(start))
continue;
+   pfn = __pa(start) >> PAGE_SHIFT;
+   if (pfn >= max_low_pfn)
+   continue;
page = virt_to_page(start);
ClearPageReserved(page);
init_page_count(page);
-- 
1.7.6.1





--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V3] ia64/mm: fix a bad_page bug when crash kernel booting

2013-02-06 Thread Xishi Qiu
 Sorry, this bug will be happen when use Sparse-Memory(section is valid, but 
 last

 several pages are invalid). If use Flat-Memory, crash kernel will boot 
 successfully.
 I think the following patch would be better.
 
 Hi Andrew, will you just ignore the earlier patch and consider the following 
 one? :
 
 Signed-off-by: Xishi Qiu qiuxi...@huawei.com
 ---
  arch/ia64/mm/init.c |2 ++
  1 files changed, 2 insertions(+), 0 deletions(-)
 
 diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
 index 082e383..23f2ee3 100644
 --- a/arch/ia64/mm/init.c
 +++ b/arch/ia64/mm/init.c
 @@ -213,6 +213,8 @@ free_initrd_mem (unsigned long start, unsigned long end)
   for (; start  end; start += PAGE_SIZE) {
   if (!virt_addr_valid(start))
   continue;
 + if ((start  PAGE_SHIFT) = max_low_pfn)

I confused the vaddr and paddr, really sorry for it.

In efi_init() memory aligns in IA64_GRANULE_SIZE(16M). If set 
crashkernel=1024M-:600M
and use sparse memory model, when crash kernel booting it changes [128M-728M] 
to [128M-720M].
But initrd memory is in [709M-727M], and virt_addr_valid() *can not* check the 
invalid pages
when freeing initrd memory. There are some pages missed at the end of the 
seciton.

ChangeLog V3:
fixed vaddr mistake
ChangeLog V2:
add invalid pages check when freeing initrd memory

Signed-off-by: Xishi Qiu qiuxi...@huawei.com
---
 arch/ia64/mm/init.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 082e383..8a269f8 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -173,6 +173,7 @@ void __init
 free_initrd_mem (unsigned long start, unsigned long end)
 {
struct page *page;
+   unsigned long pfn;
/*
 * EFI uses 4KB pages while the kernel can use 4KB or bigger.
 * Thus EFI and the kernel may have different page sizes. It is
@@ -213,6 +214,9 @@ free_initrd_mem (unsigned long start, unsigned long end)
for (; start  end; start += PAGE_SIZE) {
if (!virt_addr_valid(start))
continue;
+   pfn = __pa(start)  PAGE_SHIFT;
+   if (pfn = max_low_pfn)
+   continue;
page = virt_to_page(start);
ClearPageReserved(page);
init_page_count(page);
-- 
1.7.6.1





--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/