Re: [RFC PATCH] driver: base: memory: Maintain correct mem->end_section_nr when memory block is partially filled
On Mon, Aug 17, 2015 at 11:56:53AM +0530, Bharata B Rao wrote: > On Fri, Aug 14, 2015 at 10:27:53AM -0500, Nathan Fontenot wrote: > > On 08/13/2015 04:17 AM, Bharata B Rao wrote: > > > Last section of memory block is always initialized to > > > > > > mem->start_section_nr + sections_per_block - 1 > > > > > > which will not be true for a section that doesn't contain > > > sections_per_block > > > sections due to the memory size specified. This causes the following > > > kernel crash when memory blocks under a node are registered during reboot > > > that follows a memory hotplug operation on pseries guest. > > > > > > Unable to handle kernel paging request for data at address > > > 0xf03f0020 > > > Faulting instruction address: 0xc07657cc > > > Oops: Kernel access of bad area, sig: 11 [#1] > > > SMP NR_CPUS=1024 NUMA pSeries > > > > > > Modules linked in: > > > > > > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc6+ #48 > > > task: c000ba3c ti: c0013c58 task.ti: c0013c58 > > > NIP: c07657cc LR: c0592dbc CTR: 0400 > > > REGS: c0013c5836f0 TRAP: 0300 Not tainted (4.2.0-rc6+) > > > MSR: 80009032 MSR: 80009032 > > > <> CR: 4848 XER: > > > CR: 4848 XER: > > > CFAR: 3fff990f50ec CFAR: 3fff990f50ec DAR: f03f0020 > > > DSISR: 4000 DAR: f03f0020 DSISR: 4000 SOFTE: 1 SOFTE: 1 > > > GPR00: c0592dbc c0592dbc c0013c583970 > > > c0013c583970 c14f0300 c14f0300 003f > > > 003f > > > GPR04: c000f43b2900 > > > c000f43b2900 c000ba324668 c000ba324668 0001 > > > 0001 > > > GPR08: c1540300 c1540300 f000 > > > f000 f03f f03f 0001 > > > 0001 > > > GPR12: 2484 2484 cff2 > > > cff2 c000b5b0 c000b5b0 > > > > > > GPR16: > > > > > > > > > GPR20: > > > > > > > > > GPR24: c188c380 c188c380 > > > 00014000 00014000 c18b54e8 > > > c18b54e8 > > > GPR28: c0013c06e800 c0013c06e800 > > > fc00 > > > fc00 > > > > > > NIP [c07657cc] .get_nid_for_pfn+0x2c/0x60 > > > LR [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 > > > Call Trace: > > > [c0013c583970] [c056e44c] .put_device+0x2c/0x50 > > > [c0013c5839f0] [c0592dbc] > > > .register_mem_sect_under_node+0x8c/0x150 > > > [c0013c583a80] [c05932b4] .register_one_node+0x2c4/0x380 > > > [c0013c583b30] [c0c882b8] .topology_init+0x44/0x1e0 > > > [c0013c583bf0] [c000ad30] .do_one_initcall+0x110/0x270 > > > [c0013c583ce0] [c0c845d4] .kernel_init_freeable+0x278/0x360 > > > [c0013c583db0] [c000b5d4] .kernel_init+0x24/0x130 > > > [c0013c583e30] [c00094e8] .ret_from_kernel_thread+0x58/0x70 > > > > > > Fix this by updating the memory block to always contain the right > > > number of sections instead of assuming sections_per_block. > > > > > > Signed-off-by: Bharata B Rao > > > Cc: Nathan Fontenot > > > --- > > > drivers/base/memory.c | 1 + > > > 1 file changed, 1 insertion(+) > > > > > > diff --git a/drivers/base/memory.c b/drivers/base/memory.c > > > index 2804aed..7f3ce2e 100644 > > > --- a/drivers/base/memory.c > > > +++ b/drivers/base/memory.c > > > @@ -645,6 +645,7 @@ static int add_memory_block(int base_section_nr) > > > if (ret) > > > return ret; > > > mem->section_count = section_count; > > > +mem->end_section_nr = mem->start_section_nr + section_count -1; > > > > I think this change may be correct but makes me wonder if we need to update > > code elsewhere. There are places (at least in drivers/base/memory.c) that > > assume > > a memory block contains sections_per_block sections. > > > > Also, I think you may need to cc GregKH for this patch. > > Hi Greg - Do you think the above is the right fix to the problem that is > described here ? I have no idea, sorry, I didn't write this code :) -- 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: [RFC PATCH] driver: base: memory: Maintain correct mem->end_section_nr when memory block is partially filled
On Fri, Aug 14, 2015 at 10:27:53AM -0500, Nathan Fontenot wrote: > On 08/13/2015 04:17 AM, Bharata B Rao wrote: > > Last section of memory block is always initialized to > > > > mem->start_section_nr + sections_per_block - 1 > > > > which will not be true for a section that doesn't contain sections_per_block > > sections due to the memory size specified. This causes the following > > kernel crash when memory blocks under a node are registered during reboot > > that follows a memory hotplug operation on pseries guest. > > > > Unable to handle kernel paging request for data at address > > 0xf03f0020 > > Faulting instruction address: 0xc07657cc > > Oops: Kernel access of bad area, sig: 11 [#1] > > SMP NR_CPUS=1024 NUMA pSeries > > > > Modules linked in: > > > > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc6+ #48 > > task: c000ba3c ti: c0013c58 task.ti: c0013c58 > > NIP: c07657cc LR: c0592dbc CTR: 0400 > > REGS: c0013c5836f0 TRAP: 0300 Not tainted (4.2.0-rc6+) > > MSR: 80009032 MSR: 80009032 > > <> CR: 4848 XER: > > CR: 4848 XER: > > CFAR: 3fff990f50ec CFAR: 3fff990f50ec DAR: f03f0020 DSISR: > > 4000 DAR: f03f0020 DSISR: 4000 SOFTE: 1 SOFTE: 1 > > GPR00: c0592dbc c0592dbc c0013c583970 c0013c583970 > > c14f0300 c14f0300 003f 003f > > GPR04: c000f43b2900 c000f43b2900 > > c000ba324668 c000ba324668 0001 0001 > > GPR08: c1540300 c1540300 f000 f000 > > f03f f03f 0001 0001 > > GPR12: 2484 2484 cff2 cff2 > > c000b5b0 c000b5b0 > > GPR16: > > > > GPR20: > > > > GPR24: c188c380 c188c380 > > 00014000 00014000 c18b54e8 c18b54e8 > > GPR28: c0013c06e800 c0013c06e800 > > fc00 fc00 > > > > NIP [c07657cc] .get_nid_for_pfn+0x2c/0x60 > > LR [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 > > Call Trace: > > [c0013c583970] [c056e44c] .put_device+0x2c/0x50 > > [c0013c5839f0] [c0592dbc] > > .register_mem_sect_under_node+0x8c/0x150 > > [c0013c583a80] [c05932b4] .register_one_node+0x2c4/0x380 > > [c0013c583b30] [c0c882b8] .topology_init+0x44/0x1e0 > > [c0013c583bf0] [c000ad30] .do_one_initcall+0x110/0x270 > > [c0013c583ce0] [c0c845d4] .kernel_init_freeable+0x278/0x360 > > [c0013c583db0] [c000b5d4] .kernel_init+0x24/0x130 > > [c0013c583e30] [c00094e8] .ret_from_kernel_thread+0x58/0x70 > > > > Fix this by updating the memory block to always contain the right > > number of sections instead of assuming sections_per_block. > > > > Signed-off-by: Bharata B Rao > > Cc: Nathan Fontenot > > --- > > drivers/base/memory.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/base/memory.c b/drivers/base/memory.c > > index 2804aed..7f3ce2e 100644 > > --- a/drivers/base/memory.c > > +++ b/drivers/base/memory.c > > @@ -645,6 +645,7 @@ static int add_memory_block(int base_section_nr) > > if (ret) > > return ret; > > mem->section_count = section_count; > > +mem->end_section_nr = mem->start_section_nr + section_count -1; > > I think this change may be correct but makes me wonder if we need to update > code elsewhere. There are places (at least in drivers/base/memory.c) that > assume > a memory block contains sections_per_block sections. > > Also, I think you may need to cc GregKH for this patch. Hi Greg - Do you think the above is the right fix to the problem that is described here ? Regards, Bharata. -- 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: [RFC PATCH] driver: base: memory: Maintain correct mem-end_section_nr when memory block is partially filled
On Mon, Aug 17, 2015 at 11:56:53AM +0530, Bharata B Rao wrote: On Fri, Aug 14, 2015 at 10:27:53AM -0500, Nathan Fontenot wrote: On 08/13/2015 04:17 AM, Bharata B Rao wrote: Last section of memory block is always initialized to mem-start_section_nr + sections_per_block - 1 which will not be true for a section that doesn't contain sections_per_block sections due to the memory size specified. This causes the following kernel crash when memory blocks under a node are registered during reboot that follows a memory hotplug operation on pseries guest. Unable to handle kernel paging request for data at address 0xf03f0020 Faulting instruction address: 0xc07657cc Oops: Kernel access of bad area, sig: 11 [#1] SMP NR_CPUS=1024 NUMA pSeries Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc6+ #48 task: c000ba3c ti: c0013c58 task.ti: c0013c58 NIP: c07657cc LR: c0592dbc CTR: 0400 REGS: c0013c5836f0 TRAP: 0300 Not tainted (4.2.0-rc6+) MSR: 80009032 MSR: 80009032 SFSF,EE,EE,ME,ME,IR,IR,DR,DR,RI,RI CR: 4848 XER: CR: 4848 XER: CFAR: 3fff990f50ec CFAR: 3fff990f50ec DAR: f03f0020 DSISR: 4000 DAR: f03f0020 DSISR: 4000 SOFTE: 1 SOFTE: 1 GPR00: c0592dbc c0592dbc c0013c583970 c0013c583970 c14f0300 c14f0300 003f 003f GPR04: c000f43b2900 c000f43b2900 c000ba324668 c000ba324668 0001 0001 GPR08: c1540300 c1540300 f000 f000 f03f f03f 0001 0001 GPR12: 2484 2484 cff2 cff2 c000b5b0 c000b5b0 GPR16: GPR20: GPR24: c188c380 c188c380 00014000 00014000 c18b54e8 c18b54e8 GPR28: c0013c06e800 c0013c06e800 fc00 fc00 NIP [c07657cc] .get_nid_for_pfn+0x2c/0x60 LR [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 Call Trace: [c0013c583970] [c056e44c] .put_device+0x2c/0x50 [c0013c5839f0] [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 [c0013c583a80] [c05932b4] .register_one_node+0x2c4/0x380 [c0013c583b30] [c0c882b8] .topology_init+0x44/0x1e0 [c0013c583bf0] [c000ad30] .do_one_initcall+0x110/0x270 [c0013c583ce0] [c0c845d4] .kernel_init_freeable+0x278/0x360 [c0013c583db0] [c000b5d4] .kernel_init+0x24/0x130 [c0013c583e30] [c00094e8] .ret_from_kernel_thread+0x58/0x70 Fix this by updating the memory block to always contain the right number of sections instead of assuming sections_per_block. Signed-off-by: Bharata B Rao bhar...@linux.vnet.ibm.com Cc: Nathan Fontenot nf...@linux.vnet.ibm.com --- drivers/base/memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 2804aed..7f3ce2e 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -645,6 +645,7 @@ static int add_memory_block(int base_section_nr) if (ret) return ret; mem-section_count = section_count; +mem-end_section_nr = mem-start_section_nr + section_count -1; I think this change may be correct but makes me wonder if we need to update code elsewhere. There are places (at least in drivers/base/memory.c) that assume a memory block contains sections_per_block sections. Also, I think you may need to cc GregKH for this patch. Hi Greg - Do you think the above is the right fix to the problem that is described here ? I have no idea, sorry, I didn't write this code :) -- 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: [RFC PATCH] driver: base: memory: Maintain correct mem-end_section_nr when memory block is partially filled
On Fri, Aug 14, 2015 at 10:27:53AM -0500, Nathan Fontenot wrote: On 08/13/2015 04:17 AM, Bharata B Rao wrote: Last section of memory block is always initialized to mem-start_section_nr + sections_per_block - 1 which will not be true for a section that doesn't contain sections_per_block sections due to the memory size specified. This causes the following kernel crash when memory blocks under a node are registered during reboot that follows a memory hotplug operation on pseries guest. Unable to handle kernel paging request for data at address 0xf03f0020 Faulting instruction address: 0xc07657cc Oops: Kernel access of bad area, sig: 11 [#1] SMP NR_CPUS=1024 NUMA pSeries Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc6+ #48 task: c000ba3c ti: c0013c58 task.ti: c0013c58 NIP: c07657cc LR: c0592dbc CTR: 0400 REGS: c0013c5836f0 TRAP: 0300 Not tainted (4.2.0-rc6+) MSR: 80009032 MSR: 80009032 SFSF,EE,EE,ME,ME,IR,IR,DR,DR,RI,RI CR: 4848 XER: CR: 4848 XER: CFAR: 3fff990f50ec CFAR: 3fff990f50ec DAR: f03f0020 DSISR: 4000 DAR: f03f0020 DSISR: 4000 SOFTE: 1 SOFTE: 1 GPR00: c0592dbc c0592dbc c0013c583970 c0013c583970 c14f0300 c14f0300 003f 003f GPR04: c000f43b2900 c000f43b2900 c000ba324668 c000ba324668 0001 0001 GPR08: c1540300 c1540300 f000 f000 f03f f03f 0001 0001 GPR12: 2484 2484 cff2 cff2 c000b5b0 c000b5b0 GPR16: GPR20: GPR24: c188c380 c188c380 00014000 00014000 c18b54e8 c18b54e8 GPR28: c0013c06e800 c0013c06e800 fc00 fc00 NIP [c07657cc] .get_nid_for_pfn+0x2c/0x60 LR [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 Call Trace: [c0013c583970] [c056e44c] .put_device+0x2c/0x50 [c0013c5839f0] [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 [c0013c583a80] [c05932b4] .register_one_node+0x2c4/0x380 [c0013c583b30] [c0c882b8] .topology_init+0x44/0x1e0 [c0013c583bf0] [c000ad30] .do_one_initcall+0x110/0x270 [c0013c583ce0] [c0c845d4] .kernel_init_freeable+0x278/0x360 [c0013c583db0] [c000b5d4] .kernel_init+0x24/0x130 [c0013c583e30] [c00094e8] .ret_from_kernel_thread+0x58/0x70 Fix this by updating the memory block to always contain the right number of sections instead of assuming sections_per_block. Signed-off-by: Bharata B Rao bhar...@linux.vnet.ibm.com Cc: Nathan Fontenot nf...@linux.vnet.ibm.com --- drivers/base/memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 2804aed..7f3ce2e 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -645,6 +645,7 @@ static int add_memory_block(int base_section_nr) if (ret) return ret; mem-section_count = section_count; +mem-end_section_nr = mem-start_section_nr + section_count -1; I think this change may be correct but makes me wonder if we need to update code elsewhere. There are places (at least in drivers/base/memory.c) that assume a memory block contains sections_per_block sections. Also, I think you may need to cc GregKH for this patch. Hi Greg - Do you think the above is the right fix to the problem that is described here ? Regards, Bharata. -- 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: [RFC PATCH] driver: base: memory: Maintain correct mem->end_section_nr when memory block is partially filled
On 08/13/2015 04:17 AM, Bharata B Rao wrote: > Last section of memory block is always initialized to > > mem->start_section_nr + sections_per_block - 1 > > which will not be true for a section that doesn't contain sections_per_block > sections due to the memory size specified. This causes the following > kernel crash when memory blocks under a node are registered during reboot > that follows a memory hotplug operation on pseries guest. > > Unable to handle kernel paging request for data at address 0xf03f0020 > Faulting instruction address: 0xc07657cc > Oops: Kernel access of bad area, sig: 11 [#1] > SMP NR_CPUS=1024 NUMA pSeries > > Modules linked in: > > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc6+ #48 > task: c000ba3c ti: c0013c58 task.ti: c0013c58 > NIP: c07657cc LR: c0592dbc CTR: 0400 > REGS: c0013c5836f0 TRAP: 0300 Not tainted (4.2.0-rc6+) > MSR: 80009032 MSR: 80009032 > <> CR: 4848 XER: > CR: 4848 XER: > CFAR: 3fff990f50ec CFAR: 3fff990f50ec DAR: f03f0020 DSISR: > 4000 DAR: f03f0020 DSISR: 4000 SOFTE: 1 SOFTE: 1 > GPR00: c0592dbc c0592dbc c0013c583970 c0013c583970 > c14f0300 c14f0300 003f 003f > GPR04: c000f43b2900 c000f43b2900 > c000ba324668 c000ba324668 0001 0001 > GPR08: c1540300 c1540300 f000 f000 > f03f f03f 0001 0001 > GPR12: 2484 2484 cff2 cff2 > c000b5b0 c000b5b0 > GPR16: > > GPR20: > > GPR24: c188c380 c188c380 > 00014000 00014000 c18b54e8 c18b54e8 > GPR28: c0013c06e800 c0013c06e800 > fc00 fc00 > > NIP [c07657cc] .get_nid_for_pfn+0x2c/0x60 > LR [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 > Call Trace: > [c0013c583970] [c056e44c] .put_device+0x2c/0x50 > [c0013c5839f0] [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 > [c0013c583a80] [c05932b4] .register_one_node+0x2c4/0x380 > [c0013c583b30] [c0c882b8] .topology_init+0x44/0x1e0 > [c0013c583bf0] [c000ad30] .do_one_initcall+0x110/0x270 > [c0013c583ce0] [c0c845d4] .kernel_init_freeable+0x278/0x360 > [c0013c583db0] [c000b5d4] .kernel_init+0x24/0x130 > [c0013c583e30] [c00094e8] .ret_from_kernel_thread+0x58/0x70 > > Fix this by updating the memory block to always contain the right > number of sections instead of assuming sections_per_block. > > Signed-off-by: Bharata B Rao > Cc: Nathan Fontenot > --- > drivers/base/memory.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/base/memory.c b/drivers/base/memory.c > index 2804aed..7f3ce2e 100644 > --- a/drivers/base/memory.c > +++ b/drivers/base/memory.c > @@ -645,6 +645,7 @@ static int add_memory_block(int base_section_nr) > if (ret) > return ret; > mem->section_count = section_count; > +mem->end_section_nr = mem->start_section_nr + section_count -1; I think this change may be correct but makes me wonder if we need to update code elsewhere. There are places (at least in drivers/base/memory.c) that assume a memory block contains sections_per_block sections. Also, I think you may need to cc GregKH for this patch. -Nathan > return 0; > } > -- 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: [RFC PATCH] driver: base: memory: Maintain correct mem-end_section_nr when memory block is partially filled
On 08/13/2015 04:17 AM, Bharata B Rao wrote: Last section of memory block is always initialized to mem-start_section_nr + sections_per_block - 1 which will not be true for a section that doesn't contain sections_per_block sections due to the memory size specified. This causes the following kernel crash when memory blocks under a node are registered during reboot that follows a memory hotplug operation on pseries guest. Unable to handle kernel paging request for data at address 0xf03f0020 Faulting instruction address: 0xc07657cc Oops: Kernel access of bad area, sig: 11 [#1] SMP NR_CPUS=1024 NUMA pSeries Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc6+ #48 task: c000ba3c ti: c0013c58 task.ti: c0013c58 NIP: c07657cc LR: c0592dbc CTR: 0400 REGS: c0013c5836f0 TRAP: 0300 Not tainted (4.2.0-rc6+) MSR: 80009032 MSR: 80009032 SFSF,EE,EE,ME,ME,IR,IR,DR,DR,RI,RI CR: 4848 XER: CR: 4848 XER: CFAR: 3fff990f50ec CFAR: 3fff990f50ec DAR: f03f0020 DSISR: 4000 DAR: f03f0020 DSISR: 4000 SOFTE: 1 SOFTE: 1 GPR00: c0592dbc c0592dbc c0013c583970 c0013c583970 c14f0300 c14f0300 003f 003f GPR04: c000f43b2900 c000f43b2900 c000ba324668 c000ba324668 0001 0001 GPR08: c1540300 c1540300 f000 f000 f03f f03f 0001 0001 GPR12: 2484 2484 cff2 cff2 c000b5b0 c000b5b0 GPR16: GPR20: GPR24: c188c380 c188c380 00014000 00014000 c18b54e8 c18b54e8 GPR28: c0013c06e800 c0013c06e800 fc00 fc00 NIP [c07657cc] .get_nid_for_pfn+0x2c/0x60 LR [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 Call Trace: [c0013c583970] [c056e44c] .put_device+0x2c/0x50 [c0013c5839f0] [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 [c0013c583a80] [c05932b4] .register_one_node+0x2c4/0x380 [c0013c583b30] [c0c882b8] .topology_init+0x44/0x1e0 [c0013c583bf0] [c000ad30] .do_one_initcall+0x110/0x270 [c0013c583ce0] [c0c845d4] .kernel_init_freeable+0x278/0x360 [c0013c583db0] [c000b5d4] .kernel_init+0x24/0x130 [c0013c583e30] [c00094e8] .ret_from_kernel_thread+0x58/0x70 Fix this by updating the memory block to always contain the right number of sections instead of assuming sections_per_block. Signed-off-by: Bharata B Rao bhar...@linux.vnet.ibm.com Cc: Nathan Fontenot nf...@linux.vnet.ibm.com --- drivers/base/memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 2804aed..7f3ce2e 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -645,6 +645,7 @@ static int add_memory_block(int base_section_nr) if (ret) return ret; mem-section_count = section_count; +mem-end_section_nr = mem-start_section_nr + section_count -1; I think this change may be correct but makes me wonder if we need to update code elsewhere. There are places (at least in drivers/base/memory.c) that assume a memory block contains sections_per_block sections. Also, I think you may need to cc GregKH for this patch. -Nathan return 0; } -- 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/
[RFC PATCH] driver: base: memory: Maintain correct mem->end_section_nr when memory block is partially filled
Last section of memory block is always initialized to mem->start_section_nr + sections_per_block - 1 which will not be true for a section that doesn't contain sections_per_block sections due to the memory size specified. This causes the following kernel crash when memory blocks under a node are registered during reboot that follows a memory hotplug operation on pseries guest. Unable to handle kernel paging request for data at address 0xf03f0020 Faulting instruction address: 0xc07657cc Oops: Kernel access of bad area, sig: 11 [#1] SMP NR_CPUS=1024 NUMA pSeries Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc6+ #48 task: c000ba3c ti: c0013c58 task.ti: c0013c58 NIP: c07657cc LR: c0592dbc CTR: 0400 REGS: c0013c5836f0 TRAP: 0300 Not tainted (4.2.0-rc6+) MSR: 80009032 MSR: 80009032 <> CR: 4848 XER: CR: 4848 XER: CFAR: 3fff990f50ec CFAR: 3fff990f50ec DAR: f03f0020 DSISR: 4000 DAR: f03f0020 DSISR: 4000 SOFTE: 1 SOFTE: 1 GPR00: c0592dbc c0592dbc c0013c583970 c0013c583970 c14f0300 c14f0300 003f 003f GPR04: c000f43b2900 c000f43b2900 c000ba324668 c000ba324668 0001 0001 GPR08: c1540300 c1540300 f000 f000 f03f f03f 0001 0001 GPR12: 2484 2484 cff2 cff2 c000b5b0 c000b5b0 GPR16: GPR20: GPR24: c188c380 c188c380 00014000 00014000 c18b54e8 c18b54e8 GPR28: c0013c06e800 c0013c06e800 fc00 fc00 NIP [c07657cc] .get_nid_for_pfn+0x2c/0x60 LR [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 Call Trace: [c0013c583970] [c056e44c] .put_device+0x2c/0x50 [c0013c5839f0] [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 [c0013c583a80] [c05932b4] .register_one_node+0x2c4/0x380 [c0013c583b30] [c0c882b8] .topology_init+0x44/0x1e0 [c0013c583bf0] [c000ad30] .do_one_initcall+0x110/0x270 [c0013c583ce0] [c0c845d4] .kernel_init_freeable+0x278/0x360 [c0013c583db0] [c000b5d4] .kernel_init+0x24/0x130 [c0013c583e30] [c00094e8] .ret_from_kernel_thread+0x58/0x70 Fix this by updating the memory block to always contain the right number of sections instead of assuming sections_per_block. Signed-off-by: Bharata B Rao Cc: Nathan Fontenot --- drivers/base/memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 2804aed..7f3ce2e 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -645,6 +645,7 @@ static int add_memory_block(int base_section_nr) if (ret) return ret; mem->section_count = section_count; +mem->end_section_nr = mem->start_section_nr + section_count -1; return 0; } -- 2.1.0 -- 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/
[RFC PATCH] driver: base: memory: Maintain correct mem-end_section_nr when memory block is partially filled
Last section of memory block is always initialized to mem-start_section_nr + sections_per_block - 1 which will not be true for a section that doesn't contain sections_per_block sections due to the memory size specified. This causes the following kernel crash when memory blocks under a node are registered during reboot that follows a memory hotplug operation on pseries guest. Unable to handle kernel paging request for data at address 0xf03f0020 Faulting instruction address: 0xc07657cc Oops: Kernel access of bad area, sig: 11 [#1] SMP NR_CPUS=1024 NUMA pSeries Modules linked in: CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.2.0-rc6+ #48 task: c000ba3c ti: c0013c58 task.ti: c0013c58 NIP: c07657cc LR: c0592dbc CTR: 0400 REGS: c0013c5836f0 TRAP: 0300 Not tainted (4.2.0-rc6+) MSR: 80009032 MSR: 80009032 SFSF,EE,EE,ME,ME,IR,IR,DR,DR,RI,RI CR: 4848 XER: CR: 4848 XER: CFAR: 3fff990f50ec CFAR: 3fff990f50ec DAR: f03f0020 DSISR: 4000 DAR: f03f0020 DSISR: 4000 SOFTE: 1 SOFTE: 1 GPR00: c0592dbc c0592dbc c0013c583970 c0013c583970 c14f0300 c14f0300 003f 003f GPR04: c000f43b2900 c000f43b2900 c000ba324668 c000ba324668 0001 0001 GPR08: c1540300 c1540300 f000 f000 f03f f03f 0001 0001 GPR12: 2484 2484 cff2 cff2 c000b5b0 c000b5b0 GPR16: GPR20: GPR24: c188c380 c188c380 00014000 00014000 c18b54e8 c18b54e8 GPR28: c0013c06e800 c0013c06e800 fc00 fc00 NIP [c07657cc] .get_nid_for_pfn+0x2c/0x60 LR [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 Call Trace: [c0013c583970] [c056e44c] .put_device+0x2c/0x50 [c0013c5839f0] [c0592dbc] .register_mem_sect_under_node+0x8c/0x150 [c0013c583a80] [c05932b4] .register_one_node+0x2c4/0x380 [c0013c583b30] [c0c882b8] .topology_init+0x44/0x1e0 [c0013c583bf0] [c000ad30] .do_one_initcall+0x110/0x270 [c0013c583ce0] [c0c845d4] .kernel_init_freeable+0x278/0x360 [c0013c583db0] [c000b5d4] .kernel_init+0x24/0x130 [c0013c583e30] [c00094e8] .ret_from_kernel_thread+0x58/0x70 Fix this by updating the memory block to always contain the right number of sections instead of assuming sections_per_block. Signed-off-by: Bharata B Rao bhar...@linux.vnet.ibm.com Cc: Nathan Fontenot nf...@linux.vnet.ibm.com --- drivers/base/memory.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 2804aed..7f3ce2e 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -645,6 +645,7 @@ static int add_memory_block(int base_section_nr) if (ret) return ret; mem-section_count = section_count; +mem-end_section_nr = mem-start_section_nr + section_count -1; return 0; } -- 2.1.0 -- 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/