[PATCH] powerepc/book3s64/hash: Align start address correctly with bolt mapping
Michael Ellerman
mpe at ellerman.id.au
Tue Oct 29 22:08:47 AEDT 2019
"Aneesh Kumar K.V" <aneesh.kumar at linux.ibm.com> writes:
> Without this we can miss mapping the last page covering the end address passed
>
> BUG: Unable to handle kernel data access at 0xc001000406000000
> Faulting instruction address: 0xc000000000090790
> NIP [c000000000090790] arch_add_memory+0xc0/0x130
> LR [c000000000090744] arch_add_memory+0x74/0x130
> Call Trace:
> arch_add_memory+0x74/0x130 (unreliable)
> memremap_pages+0x74c/0xa30
> devm_memremap_pages+0x3c/0xa0
> pmem_attach_disk+0x188/0x770
> nvdimm_bus_probe+0xd8/0x470
> really_probe+0x148/0x570
> driver_probe_device+0x19c/0x1d0
> device_driver_attach+0xcc/0x100
> bind_store+0x134/0x1c0
> drv_attr_store+0x44/0x60
> sysfs_kf_write+0x74/0xc0
> kernfs_fop_write+0x1b4/0x290
> __vfs_write+0x3c/0x70
> vfs_write+0xd0/0x260
> ksys_write+0xdc/0x130
> system_call+0x5c/0x68
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.ibm.com>
> ---
> arch/powerpc/mm/book3s64/hash_utils.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
Presumably you want this backported to kernels that have any nvdimm
support on powerpc?
cheers
> diff --git a/arch/powerpc/mm/book3s64/hash_utils.c b/arch/powerpc/mm/book3s64/hash_utils.c
> index 6c123760164e..f66a1c6922d6 100644
> --- a/arch/powerpc/mm/book3s64/hash_utils.c
> +++ b/arch/powerpc/mm/book3s64/hash_utils.c
> @@ -257,8 +257,10 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
> DBG("htab_bolt_mapping(%lx..%lx -> %lx (%lx,%d,%d)\n",
> vstart, vend, pstart, prot, psize, ssize);
>
> - for (vaddr = vstart, paddr = pstart; vaddr < vend;
> - vaddr += step, paddr += step) {
> + vaddr = ALIGN_DOWN(vstart, step);
> + paddr = ALIGN_DOWN(pstart, step);
> +
> + for (; vaddr < vend; vaddr += step, paddr += step) {
> unsigned long hash, hpteg;
> unsigned long vsid = get_kernel_vsid(vaddr, ssize);
> unsigned long vpn = hpt_vpn(vaddr, vsid, ssize);
> --
> 2.21.0
More information about the Linuxppc-dev
mailing list