Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-10-05 Thread Jan Stancek




- Original Message -
> From: "Greg KH" 
> To: "Jan Stancek" 
> Cc: linux-kernel@vger.kernel.org, linux...@kvack.org, "Dave Young" 
> 
> Sent: Sunday, 4 October, 2015 2:06:39 PM
> Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in 
> register_mem_sect_under_node
> 
> On Tue, Sep 22, 2015 at 04:27:01AM -0400, Jan Stancek wrote:
> > 
> > 
> > 
> > 
> > - Original Message -
> > > From: "Jan Stancek" 
> > > To: gre...@linuxfoundation.org
> > > Cc: linux-kernel@vger.kernel.org, linux...@kvack.org, "Dave Young"
> > > 
> > > Sent: Wednesday, 9 September, 2015 1:11:23 PM
> > > Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections
> > > in register_mem_sect_under_node
> > > 
> > > Greg,
> > > 
> > > any thoughts about the patch?
> > 
> > ping
> 
> I need some -mm people to sign off on it, as this code is tricky and I
> think has caused problems in the past, and I know nothing about it...

Thanks for response, get_maintainer.pl was giving me only your name.

> 
> So please resend and get some acks from them and I'll be glad to take
> it.

It looks like someone has already beat me to it:

commit 04697858d89e4bf2650364f8d6956e2554e8ef88
  mm: check if section present during memory block registering

Regards,
Jan

> 
> thanks,
> 
> greg k-h
> 
--
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 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-10-05 Thread Jan Stancek




- Original Message -
> From: "Greg KH" <gre...@linuxfoundation.org>
> To: "Jan Stancek" <jstan...@redhat.com>
> Cc: linux-kernel@vger.kernel.org, linux...@kvack.org, "Dave Young" 
> <dyo...@redhat.com>
> Sent: Sunday, 4 October, 2015 2:06:39 PM
> Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in 
> register_mem_sect_under_node
> 
> On Tue, Sep 22, 2015 at 04:27:01AM -0400, Jan Stancek wrote:
> > 
> > 
> > 
> > 
> > - Original Message -
> > > From: "Jan Stancek" <jstan...@redhat.com>
> > > To: gre...@linuxfoundation.org
> > > Cc: linux-kernel@vger.kernel.org, linux...@kvack.org, "Dave Young"
> > > <dyo...@redhat.com>
> > > Sent: Wednesday, 9 September, 2015 1:11:23 PM
> > > Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections
> > > in register_mem_sect_under_node
> > > 
> > > Greg,
> > > 
> > > any thoughts about the patch?
> > 
> > ping
> 
> I need some -mm people to sign off on it, as this code is tricky and I
> think has caused problems in the past, and I know nothing about it...

Thanks for response, get_maintainer.pl was giving me only your name.

> 
> So please resend and get some acks from them and I'll be glad to take
> it.

It looks like someone has already beat me to it:

commit 04697858d89e4bf2650364f8d6956e2554e8ef88
  mm: check if section present during memory block registering

Regards,
Jan

> 
> thanks,
> 
> greg k-h
> 
--
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 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-10-04 Thread Greg KH
On Tue, Sep 22, 2015 at 04:27:01AM -0400, Jan Stancek wrote:
> 
> 
> 
> 
> - Original Message -
> > From: "Jan Stancek" 
> > To: gre...@linuxfoundation.org
> > Cc: linux-kernel@vger.kernel.org, linux...@kvack.org, "Dave Young" 
> > 
> > Sent: Wednesday, 9 September, 2015 1:11:23 PM
> > Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in 
> > register_mem_sect_under_node
> > 
> > Greg,
> > 
> > any thoughts about the patch?
> 
> ping

I need some -mm people to sign off on it, as this code is tricky and I
think has caused problems in the past, and I know nothing about it...

So please resend and get some acks from them and I'll be glad to take
it.

thanks,

greg k-h
--
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 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-10-04 Thread Greg KH
On Tue, Sep 22, 2015 at 04:27:01AM -0400, Jan Stancek wrote:
> 
> 
> 
> 
> - Original Message -
> > From: "Jan Stancek" <jstan...@redhat.com>
> > To: gre...@linuxfoundation.org
> > Cc: linux-kernel@vger.kernel.org, linux...@kvack.org, "Dave Young" 
> > <dyo...@redhat.com>
> > Sent: Wednesday, 9 September, 2015 1:11:23 PM
> > Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in 
> > register_mem_sect_under_node
> > 
> > Greg,
> > 
> > any thoughts about the patch?
> 
> ping

I need some -mm people to sign off on it, as this code is tricky and I
think has caused problems in the past, and I know nothing about it...

So please resend and get some acks from them and I'll be glad to take
it.

thanks,

greg k-h
--
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 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-09-22 Thread Jan Stancek




- Original Message -
> From: "Jan Stancek" 
> To: gre...@linuxfoundation.org
> Cc: linux-kernel@vger.kernel.org, linux...@kvack.org, "Dave Young" 
> 
> Sent: Wednesday, 9 September, 2015 1:11:23 PM
> Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in 
> register_mem_sect_under_node
> 
> Greg,
> 
> any thoughts about the patch?

ping

> 
> Regards,
> Jan
> 
> - Original Message -
> > From: "Dave Young" 
> > To: "Jan Stancek" 
> > Cc: gre...@linuxfoundation.org, linux-kernel@vger.kernel.org,
> > linux...@kvack.org
> > Sent: Tuesday, 1 September, 2015 9:15:53 AM
> > Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in
> > register_mem_sect_under_node
> > 
> > On 08/27/15 at 04:43pm, Jan Stancek wrote:
> > > Skip non-present sections in mem_blk to avoid crashing during boot
> > > at register_mem_sect_under_node()->get_nid_for_pfn():
> > > 
> > >   Unable to handle kernel paging request for data at address
> > >   0xf0080020
> > >   Faulting instruction address: 0xc866b480
> > >   Oops: Kernel access of bad area, sig: 11 [#1]
> > >   SMP NR_CPUS=2048 NUMA pSeries
> > >   Modules linked in:
> > >   CPU: 14 PID: 1 Comm: swapper/14 Not tainted 4.2.0-rc8+ #6
> > >   task: c0001e48 ti: c0001e50 task.ti: c0001e50
> > >   NIP: c866b480 LR: c851aecc CTR: 0400
> > >   ...
> > >   NIP [c866b480] get_nid_for_pfn+0x10/0x30
> > >   LR [c851aecc] register_mem_sect_under_node+0x9c/0x190
> > >   Call Trace:
> > >   [c0001e503b10] [c84f89a4] put_device+0x24/0x40 (unreliable)
> > >   [c0001e503b60] [c851b3d4] register_one_node+0x2b4/0x390
> > >   [c0001e503bc0] [c8ae7a50] topology_init+0x4c/0x1e8
> > >   [c0001e503c30] [c800b3bc] do_one_initcall+0x10c/0x260
> > >   [c0001e503d00] [c8ae41b4] kernel_init_freeable+0x27c/0x364
> > >   [c0001e503dc0] [c800bc14] kernel_init+0x24/0x130
> > >   [c0001e503e30] [c8009530] ret_from_kernel_thread+0x5c/0xac
> > >   Instruction dump:
> > >   4e800020 6000 6000 6042 3b80ffed 4bc8  
> > >   3920 78633664 792900c4 7d434a14  2faa 41de0010
> > >   7c63482a
> > >   ---[ end trace e9ab4a173e0cee14 ]---
> > > 
> > > This has been observed during kdump kernel boot on ppc64le KVM guest
> > > (page size: 65536, sections_per_block: 16, PAGES_PER_SECTION: 256)
> > > where kdump adds "rtas" to list of usable regions:
> > >   # hexdump -C /sys/firmware/devicetree/base/rtas/linux,rtas-base
> > >     2f ff 00 00   |/...|
> > > 
> > > [0.00] Early memory node ranges
> > > [0.00]   node   0: [mem 0x-0x1fff]
> > > [0.00]   node   0: [mem 0x2fff-0x2fff]
> > > 
> > > Crash happens when register_mem_sect_under_node goes over mem_blk that
> > > spans sections 32-47, 32-46 are not present, 47 is present:
> > >   32 * 256 * 65536 == 0x2000
> > >   47 * 256 * 65536 == 0x2f00
> > > It tries to access page for first pfn of this mem_blk (8192 == 32 * 256)
> > > and crashes.
> > > 
> > > Signed-off-by: Jan Stancek 
> > > Cc: Greg Kroah-Hartman 
> > > ---
> > >  drivers/base/node.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > index 4c7423a4b5f4..e638cfde7486 100644
> > > --- a/drivers/base/node.c
> > > +++ b/drivers/base/node.c
> > > @@ -390,6 +390,9 @@ int register_mem_sect_under_node(struct memory_block
> > > *mem_blk, int nid)
> > >   sect_no <= mem_blk->end_section_nr;
> > >   sect_no++) {
> > >  
> > > + if (!present_section_nr(sect_no))
> > > + continue;
> > > +
> > >   sect_start_pfn = section_nr_to_pfn(sect_no);
> > >   sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
> > >  
> > > --
> > > 1.8.3.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/
> > 
> 
--
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 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-09-22 Thread Jan Stancek




- Original Message -
> From: "Jan Stancek" <jstan...@redhat.com>
> To: gre...@linuxfoundation.org
> Cc: linux-kernel@vger.kernel.org, linux...@kvack.org, "Dave Young" 
> <dyo...@redhat.com>
> Sent: Wednesday, 9 September, 2015 1:11:23 PM
> Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in 
> register_mem_sect_under_node
> 
> Greg,
> 
> any thoughts about the patch?

ping

> 
> Regards,
> Jan
> 
> - Original Message -
> > From: "Dave Young" <dyo...@redhat.com>
> > To: "Jan Stancek" <jstan...@redhat.com>
> > Cc: gre...@linuxfoundation.org, linux-kernel@vger.kernel.org,
> > linux...@kvack.org
> > Sent: Tuesday, 1 September, 2015 9:15:53 AM
> > Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in
> > register_mem_sect_under_node
> > 
> > On 08/27/15 at 04:43pm, Jan Stancek wrote:
> > > Skip non-present sections in mem_blk to avoid crashing during boot
> > > at register_mem_sect_under_node()->get_nid_for_pfn():
> > > 
> > >   Unable to handle kernel paging request for data at address
> > >   0xf0080020
> > >   Faulting instruction address: 0xc866b480
> > >   Oops: Kernel access of bad area, sig: 11 [#1]
> > >   SMP NR_CPUS=2048 NUMA pSeries
> > >   Modules linked in:
> > >   CPU: 14 PID: 1 Comm: swapper/14 Not tainted 4.2.0-rc8+ #6
> > >   task: c0001e48 ti: c0001e50 task.ti: c0001e50
> > >   NIP: c866b480 LR: c851aecc CTR: 0400
> > >   ...
> > >   NIP [c866b480] get_nid_for_pfn+0x10/0x30
> > >   LR [c851aecc] register_mem_sect_under_node+0x9c/0x190
> > >   Call Trace:
> > >   [c0001e503b10] [c84f89a4] put_device+0x24/0x40 (unreliable)
> > >   [c0001e503b60] [c851b3d4] register_one_node+0x2b4/0x390
> > >   [c0001e503bc0] [c8ae7a50] topology_init+0x4c/0x1e8
> > >   [c0001e503c30] [c800b3bc] do_one_initcall+0x10c/0x260
> > >   [c0001e503d00] [c8ae41b4] kernel_init_freeable+0x27c/0x364
> > >   [c0001e503dc0] [c800bc14] kernel_init+0x24/0x130
> > >   [c0001e503e30] [c8009530] ret_from_kernel_thread+0x5c/0xac
> > >   Instruction dump:
> > >   4e800020 6000 6000 6042 3b80ffed 4bc8  
> > >   3920 78633664 792900c4 7d434a14  2faa 41de0010
> > >   7c63482a
> > >   ---[ end trace e9ab4a173e0cee14 ]---
> > > 
> > > This has been observed during kdump kernel boot on ppc64le KVM guest
> > > (page size: 65536, sections_per_block: 16, PAGES_PER_SECTION: 256)
> > > where kdump adds "rtas" to list of usable regions:
> > >   # hexdump -C /sys/firmware/devicetree/base/rtas/linux,rtas-base
> > >     2f ff 00 00   |/...|
> > > 
> > > [0.00] Early memory node ranges
> > > [0.00]   node   0: [mem 0x-0x1fff]
> > > [0.00]   node   0: [mem 0x2fff-0x2fff]
> > > 
> > > Crash happens when register_mem_sect_under_node goes over mem_blk that
> > > spans sections 32-47, 32-46 are not present, 47 is present:
> > >   32 * 256 * 65536 == 0x2000
> > >   47 * 256 * 65536 == 0x2f00
> > > It tries to access page for first pfn of this mem_blk (8192 == 32 * 256)
> > > and crashes.
> > > 
> > > Signed-off-by: Jan Stancek <jstan...@redhat.com>
> > > Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
> > > ---
> > >  drivers/base/node.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > > index 4c7423a4b5f4..e638cfde7486 100644
> > > --- a/drivers/base/node.c
> > > +++ b/drivers/base/node.c
> > > @@ -390,6 +390,9 @@ int register_mem_sect_under_node(struct memory_block
> > > *mem_blk, int nid)
> > >   sect_no <= mem_blk->end_section_nr;
> > >   sect_no++) {
> > >  
> > > + if (!present_section_nr(sect_no))
> > > + continue;
> > > +
> > >   sect_start_pfn = section_nr_to_pfn(sect_no);
> > >   sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
> > >  
> > > --
> > > 1.8.3.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/
> > 
> 
--
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 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-09-09 Thread Jan Stancek
Greg,

any thoughts about the patch?

Regards,
Jan

- Original Message -
> From: "Dave Young" 
> To: "Jan Stancek" 
> Cc: gre...@linuxfoundation.org, linux-kernel@vger.kernel.org, 
> linux...@kvack.org
> Sent: Tuesday, 1 September, 2015 9:15:53 AM
> Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in 
> register_mem_sect_under_node
> 
> On 08/27/15 at 04:43pm, Jan Stancek wrote:
> > Skip non-present sections in mem_blk to avoid crashing during boot
> > at register_mem_sect_under_node()->get_nid_for_pfn():
> > 
> >   Unable to handle kernel paging request for data at address
> >   0xf0080020
> >   Faulting instruction address: 0xc866b480
> >   Oops: Kernel access of bad area, sig: 11 [#1]
> >   SMP NR_CPUS=2048 NUMA pSeries
> >   Modules linked in:
> >   CPU: 14 PID: 1 Comm: swapper/14 Not tainted 4.2.0-rc8+ #6
> >   task: c0001e48 ti: c0001e50 task.ti: c0001e50
> >   NIP: c866b480 LR: c851aecc CTR: 0400
> >   ...
> >   NIP [c866b480] get_nid_for_pfn+0x10/0x30
> >   LR [c851aecc] register_mem_sect_under_node+0x9c/0x190
> >   Call Trace:
> >   [c0001e503b10] [c84f89a4] put_device+0x24/0x40 (unreliable)
> >   [c0001e503b60] [c851b3d4] register_one_node+0x2b4/0x390
> >   [c0001e503bc0] [c8ae7a50] topology_init+0x4c/0x1e8
> >   [c0001e503c30] [c800b3bc] do_one_initcall+0x10c/0x260
> >   [c0001e503d00] [c8ae41b4] kernel_init_freeable+0x27c/0x364
> >   [c0001e503dc0] [c800bc14] kernel_init+0x24/0x130
> >   [c0001e503e30] [c8009530] ret_from_kernel_thread+0x5c/0xac
> >   Instruction dump:
> >   4e800020 6000 6000 6042 3b80ffed 4bc8  
> >   3920 78633664 792900c4 7d434a14  2faa 41de0010 7c63482a
> >   ---[ end trace e9ab4a173e0cee14 ]---
> > 
> > This has been observed during kdump kernel boot on ppc64le KVM guest
> > (page size: 65536, sections_per_block: 16, PAGES_PER_SECTION: 256)
> > where kdump adds "rtas" to list of usable regions:
> >   # hexdump -C /sys/firmware/devicetree/base/rtas/linux,rtas-base
> >     2f ff 00 00   |/...|
> > 
> > [0.00] Early memory node ranges
> > [0.00]   node   0: [mem 0x-0x1fff]
> > [0.00]   node   0: [mem 0x2fff-0x2fff]
> > 
> > Crash happens when register_mem_sect_under_node goes over mem_blk that
> > spans sections 32-47, 32-46 are not present, 47 is present:
> >   32 * 256 * 65536 == 0x2000
> >   47 * 256 * 65536 == 0x2f00
> > It tries to access page for first pfn of this mem_blk (8192 == 32 * 256)
> > and crashes.
> > 
> > Signed-off-by: Jan Stancek 
> > Cc: Greg Kroah-Hartman 
> > ---
> >  drivers/base/node.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > index 4c7423a4b5f4..e638cfde7486 100644
> > --- a/drivers/base/node.c
> > +++ b/drivers/base/node.c
> > @@ -390,6 +390,9 @@ int register_mem_sect_under_node(struct memory_block
> > *mem_blk, int nid)
> > sect_no <= mem_blk->end_section_nr;
> > sect_no++) {
> >  
> > +   if (!present_section_nr(sect_no))
> > +   continue;
> > +
> > sect_start_pfn = section_nr_to_pfn(sect_no);
> > sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
> >  
> > --
> > 1.8.3.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/
> 
--
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 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-09-09 Thread Jan Stancek
Greg,

any thoughts about the patch?

Regards,
Jan

- Original Message -
> From: "Dave Young" <dyo...@redhat.com>
> To: "Jan Stancek" <jstan...@redhat.com>
> Cc: gre...@linuxfoundation.org, linux-kernel@vger.kernel.org, 
> linux...@kvack.org
> Sent: Tuesday, 1 September, 2015 9:15:53 AM
> Subject: Re: [PATCH 2/2] drivers/base/node.c: skip non-present sections in 
> register_mem_sect_under_node
> 
> On 08/27/15 at 04:43pm, Jan Stancek wrote:
> > Skip non-present sections in mem_blk to avoid crashing during boot
> > at register_mem_sect_under_node()->get_nid_for_pfn():
> > 
> >   Unable to handle kernel paging request for data at address
> >   0xf0080020
> >   Faulting instruction address: 0xc866b480
> >   Oops: Kernel access of bad area, sig: 11 [#1]
> >   SMP NR_CPUS=2048 NUMA pSeries
> >   Modules linked in:
> >   CPU: 14 PID: 1 Comm: swapper/14 Not tainted 4.2.0-rc8+ #6
> >   task: c0001e48 ti: c0001e50 task.ti: c0001e50
> >   NIP: c866b480 LR: c851aecc CTR: 0400
> >   ...
> >   NIP [c866b480] get_nid_for_pfn+0x10/0x30
> >   LR [c851aecc] register_mem_sect_under_node+0x9c/0x190
> >   Call Trace:
> >   [c0001e503b10] [c84f89a4] put_device+0x24/0x40 (unreliable)
> >   [c0001e503b60] [c851b3d4] register_one_node+0x2b4/0x390
> >   [c0001e503bc0] [c8ae7a50] topology_init+0x4c/0x1e8
> >   [c0001e503c30] [c800b3bc] do_one_initcall+0x10c/0x260
> >   [c0001e503d00] [c8ae41b4] kernel_init_freeable+0x27c/0x364
> >   [c0001e503dc0] [c800bc14] kernel_init+0x24/0x130
> >   [c0001e503e30] [c8009530] ret_from_kernel_thread+0x5c/0xac
> >   Instruction dump:
> >   4e800020 6000 6000 6042 3b80ffed 4bc8  
> >   3920 78633664 792900c4 7d434a14  2faa 41de0010 7c63482a
> >   ---[ end trace e9ab4a173e0cee14 ]---
> > 
> > This has been observed during kdump kernel boot on ppc64le KVM guest
> > (page size: 65536, sections_per_block: 16, PAGES_PER_SECTION: 256)
> > where kdump adds "rtas" to list of usable regions:
> >   # hexdump -C /sys/firmware/devicetree/base/rtas/linux,rtas-base
> >     2f ff 00 00   |/...|
> > 
> > [0.00] Early memory node ranges
> > [0.00]   node   0: [mem 0x-0x1fff]
> > [0.00]   node   0: [mem 0x2fff-0x2fff]
> > 
> > Crash happens when register_mem_sect_under_node goes over mem_blk that
> > spans sections 32-47, 32-46 are not present, 47 is present:
> >   32 * 256 * 65536 == 0x2000
> >   47 * 256 * 65536 == 0x2f00
> > It tries to access page for first pfn of this mem_blk (8192 == 32 * 256)
> > and crashes.
> > 
> > Signed-off-by: Jan Stancek <jstan...@redhat.com>
> > Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
> > ---
> >  drivers/base/node.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/base/node.c b/drivers/base/node.c
> > index 4c7423a4b5f4..e638cfde7486 100644
> > --- a/drivers/base/node.c
> > +++ b/drivers/base/node.c
> > @@ -390,6 +390,9 @@ int register_mem_sect_under_node(struct memory_block
> > *mem_blk, int nid)
> > sect_no <= mem_blk->end_section_nr;
> > sect_no++) {
> >  
> > +   if (!present_section_nr(sect_no))
> > +   continue;
> > +
> > sect_start_pfn = section_nr_to_pfn(sect_no);
> > sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
> >  
> > --
> > 1.8.3.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/
> 
--
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 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-09-01 Thread Dave Young
On 08/27/15 at 04:43pm, Jan Stancek wrote:
> Skip non-present sections in mem_blk to avoid crashing during boot
> at register_mem_sect_under_node()->get_nid_for_pfn():
> 
>   Unable to handle kernel paging request for data at address 
> 0xf0080020
>   Faulting instruction address: 0xc866b480
>   Oops: Kernel access of bad area, sig: 11 [#1]
>   SMP NR_CPUS=2048 NUMA pSeries
>   Modules linked in:
>   CPU: 14 PID: 1 Comm: swapper/14 Not tainted 4.2.0-rc8+ #6
>   task: c0001e48 ti: c0001e50 task.ti: c0001e50
>   NIP: c866b480 LR: c851aecc CTR: 0400
>   ...
>   NIP [c866b480] get_nid_for_pfn+0x10/0x30
>   LR [c851aecc] register_mem_sect_under_node+0x9c/0x190
>   Call Trace:
>   [c0001e503b10] [c84f89a4] put_device+0x24/0x40 (unreliable)
>   [c0001e503b60] [c851b3d4] register_one_node+0x2b4/0x390
>   [c0001e503bc0] [c8ae7a50] topology_init+0x4c/0x1e8
>   [c0001e503c30] [c800b3bc] do_one_initcall+0x10c/0x260
>   [c0001e503d00] [c8ae41b4] kernel_init_freeable+0x27c/0x364
>   [c0001e503dc0] [c800bc14] kernel_init+0x24/0x130
>   [c0001e503e30] [c8009530] ret_from_kernel_thread+0x5c/0xac
>   Instruction dump:
>   4e800020 6000 6000 6042 3b80ffed 4bc8  
>   3920 78633664 792900c4 7d434a14  2faa 41de0010 7c63482a
>   ---[ end trace e9ab4a173e0cee14 ]---
> 
> This has been observed during kdump kernel boot on ppc64le KVM guest
> (page size: 65536, sections_per_block: 16, PAGES_PER_SECTION: 256)
> where kdump adds "rtas" to list of usable regions:
>   # hexdump -C /sys/firmware/devicetree/base/rtas/linux,rtas-base
>     2f ff 00 00   |/...|
> 
> [0.00] Early memory node ranges
> [0.00]   node   0: [mem 0x-0x1fff]
> [0.00]   node   0: [mem 0x2fff-0x2fff]
> 
> Crash happens when register_mem_sect_under_node goes over mem_blk that
> spans sections 32-47, 32-46 are not present, 47 is present:
>   32 * 256 * 65536 == 0x2000
>   47 * 256 * 65536 == 0x2f00
> It tries to access page for first pfn of this mem_blk (8192 == 32 * 256)
> and crashes.
> 
> Signed-off-by: Jan Stancek 
> Cc: Greg Kroah-Hartman 
> ---
>  drivers/base/node.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 4c7423a4b5f4..e638cfde7486 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -390,6 +390,9 @@ int register_mem_sect_under_node(struct memory_block 
> *mem_blk, int nid)
>   sect_no <= mem_blk->end_section_nr;
>   sect_no++) {
>  
> + if (!present_section_nr(sect_no))
> + continue;
> +
>   sect_start_pfn = section_nr_to_pfn(sect_no);
>   sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
>  
> -- 
> 1.8.3.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/
--
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 2/2] drivers/base/node.c: skip non-present sections in register_mem_sect_under_node

2015-09-01 Thread Dave Young
On 08/27/15 at 04:43pm, Jan Stancek wrote:
> Skip non-present sections in mem_blk to avoid crashing during boot
> at register_mem_sect_under_node()->get_nid_for_pfn():
> 
>   Unable to handle kernel paging request for data at address 
> 0xf0080020
>   Faulting instruction address: 0xc866b480
>   Oops: Kernel access of bad area, sig: 11 [#1]
>   SMP NR_CPUS=2048 NUMA pSeries
>   Modules linked in:
>   CPU: 14 PID: 1 Comm: swapper/14 Not tainted 4.2.0-rc8+ #6
>   task: c0001e48 ti: c0001e50 task.ti: c0001e50
>   NIP: c866b480 LR: c851aecc CTR: 0400
>   ...
>   NIP [c866b480] get_nid_for_pfn+0x10/0x30
>   LR [c851aecc] register_mem_sect_under_node+0x9c/0x190
>   Call Trace:
>   [c0001e503b10] [c84f89a4] put_device+0x24/0x40 (unreliable)
>   [c0001e503b60] [c851b3d4] register_one_node+0x2b4/0x390
>   [c0001e503bc0] [c8ae7a50] topology_init+0x4c/0x1e8
>   [c0001e503c30] [c800b3bc] do_one_initcall+0x10c/0x260
>   [c0001e503d00] [c8ae41b4] kernel_init_freeable+0x27c/0x364
>   [c0001e503dc0] [c800bc14] kernel_init+0x24/0x130
>   [c0001e503e30] [c8009530] ret_from_kernel_thread+0x5c/0xac
>   Instruction dump:
>   4e800020 6000 6000 6042 3b80ffed 4bc8  
>   3920 78633664 792900c4 7d434a14  2faa 41de0010 7c63482a
>   ---[ end trace e9ab4a173e0cee14 ]---
> 
> This has been observed during kdump kernel boot on ppc64le KVM guest
> (page size: 65536, sections_per_block: 16, PAGES_PER_SECTION: 256)
> where kdump adds "rtas" to list of usable regions:
>   # hexdump -C /sys/firmware/devicetree/base/rtas/linux,rtas-base
>     2f ff 00 00   |/...|
> 
> [0.00] Early memory node ranges
> [0.00]   node   0: [mem 0x-0x1fff]
> [0.00]   node   0: [mem 0x2fff-0x2fff]
> 
> Crash happens when register_mem_sect_under_node goes over mem_blk that
> spans sections 32-47, 32-46 are not present, 47 is present:
>   32 * 256 * 65536 == 0x2000
>   47 * 256 * 65536 == 0x2f00
> It tries to access page for first pfn of this mem_blk (8192 == 32 * 256)
> and crashes.
> 
> Signed-off-by: Jan Stancek 
> Cc: Greg Kroah-Hartman 
> ---
>  drivers/base/node.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/base/node.c b/drivers/base/node.c
> index 4c7423a4b5f4..e638cfde7486 100644
> --- a/drivers/base/node.c
> +++ b/drivers/base/node.c
> @@ -390,6 +390,9 @@ int register_mem_sect_under_node(struct memory_block 
> *mem_blk, int nid)
>   sect_no <= mem_blk->end_section_nr;
>   sect_no++) {
>  
> + if (!present_section_nr(sect_no))
> + continue;
> +
>   sect_start_pfn = section_nr_to_pfn(sect_no);
>   sect_end_pfn = sect_start_pfn + PAGES_PER_SECTION - 1;
>  
> -- 
> 1.8.3.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/
--
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/