arm[64]/memremap: fix arch_memremap_can_ram_remap()
Subsystems (3)
PATCH 1/1 arm[64]/memremap: fix arch_memremap_can_ram_remap()
commit 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map") added the definition of arch_memremap_can_ram_remap() for arm[64] specific filtering of what pages can be used from the linear mapping. memblock_is_map_memory() was called with the pfn of the address given to arch_memremap_can_ram_remap(); however, memblock_is_map_memory() expects to be given an address, not a pfn.
This results in calls to memremap() returning a newly mapped area when it should return an address in the existing linear mapping.
Fix this by removing the address to pfn translation and pass the address directly.
--- arch/arm/mm/ioremap.c | 4 +--- arch/arm64/mm/ioremap.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)
arch/arm/mm/ioremap.c +1 -3
@@ -515,7 +515,5 @@ void __init early_ioremap_init(void)bool arch_memremap_can_ram_remap (resource_size_t offset,size_t size,unsigned long flags) { -unsigned long pfn =PHYS_PFN (offset); - -return memblock_is_map_memory (pfn); +return memblock_is_map_memory (offset); }
arch/arm64/mm/ioremap.c +1 -3
@@ -51,7 +51,5 @@ void __init early_ioremap_init(void)bool arch_memremap_can_ram_remap (resource_size_t offset,size_t size,unsigned long flags) { -unsigned long pfn =PHYS_PFN (offset); - -return pfn_is_map_memory (pfn); +return pfn_is_map_memory (offset); }
Signature · 1 line
2.49.0
Catalin Marinas
maintainerPlease cc the maintainers and the original contributor of the commit you are fixing, otherwise the patch may not be noticed.
Quoted 26 lines · Ross Stutterheim
commit
260364d112bc("arm[64]/memremap: don't abusepfn_valid()to ensure presence of linear map") added the definition ofarch_memremap_can_ram_remap()for arm[64] specific filtering of what pages can be used from the linear mapping.memblock_is_map_memory()was called with the pfn of the address given toarch_memremap_can_ram_remap(); however,memblock_is_map_memory()expects to be given an address, not a pfn.This results in calls to
memremap()returning a newly mapped area when it should return an address in the existing linear mapping.Fix this by removing the address to pfn translation and pass the address directly.
Fixes 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")Signed-off-by Ross Stutterheim <[email protected]>--- arch/arm/mm/ioremap.c | 4 +--- arch/arm64/mm/ioremap.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-)arch/arm/mm/ioremap.c +0
-0
arch/arm/mm/ioremap.c void __init early_ioremap_init(void) · line 519
Quoted 8 lines
arch/arm/mm/ioremap.c +1
-3@@ -515,7 +515,5 @@ void __init early_ioremap_init(void)bool arch_memremap_can_ram_remap (resource_size_t offset,size_t size,unsigned long flags) { -unsigned long pfn =PHYS_PFN (offset); - -return memblock_is_map_memory (pfn); +return memblock_is_map_memory (offset); }
This indeed needs fixing.
arch/arm64/mm/ioremap.c void __init early_ioremap_init(void) · line 54
Quoted 12 lines
arch/arm64/mm/ioremap.c +1
-3@@ -51,7 +51,5 @@ void __init early_ioremap_init(void)bool arch_memremap_can_ram_remap (resource_size_t offset,size_t size,unsigned long flags) { -unsigned long pfn =PHYS_PFN (offset); - -return pfn_is_map_memory (pfn); +return pfn_is_map_memory (offset);
This is already correct.
Signature · 1 line
Catalin
Quoted 2 lines · Catalin Marinas
Please cc the maintainers and the original contributor of the commit you are fixing, otherwise the patch may not be noticed.
Thanks for adding them on your reply. I will add to V2.
Quoted 6 lines
Quoted 6 lines
arch/arm64/mm/ioremap.c +0
-0@@ -51,7 +51,5 @@ void __init early_ioremap_init(void) bool arch_memremap_can_ram_remap(resource_size_t offset, size_t size,
Quoted 8 lines
arch/arm64/mm/ioremap.c void __init early_ioremap_init(void) · line 54
Quoted 6 lines
arch/arm64/mm/ioremap.c +1
-3unsigned long flags) { -unsigned long pfn =PHYS_PFN (offset); - -return pfn_is_map_memory (pfn); +return pfn_is_map_memory (offset);This is already correct.
Will remove on V2.
--
Ross
PATCH v2 1/1 arm/memremap: fix arch_memremap_can_ram_remap()
In reply to Ross Stutterheimcommit 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map") added the definition of arch_memremap_can_ram_remap() for arm[64] specific filtering of what pages can be used from the linear mapping. memblock_is_map_memory() was called with the pfn of the address given to arch_memremap_can_ram_remap(); however, memblock_is_map_memory() expects to be given an address for arm, not a pfn.
This results in calls to memremap() returning a newly mapped area when it should return an address in the existing linear mapping.
Fix this by removing the address to pfn translation and pass the address directly.
--- arch/arm/mm/ioremap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/mm/ioremap.c +1 -3
@@ -515,7 +515,5 @@ void __init early_ioremap_init(void)bool arch_memremap_can_ram_remap (resource_size_t offset,size_t size,unsigned long flags) { -unsigned long pfn =PHYS_PFN (offset); - -return memblock_is_map_memory (pfn); +return memblock_is_map_memory (offset); }
Signature · 1 line
2.49.0
Re: [PATCH v2] arm/memremap: fix arch_memremap_can_ram_remap()
Quoted 8 lines · Ross Stutterheim
commit
260364d112bc("arm[64]/memremap: don't abusepfn_valid()to ensure presence of linear map") added the definition ofarch_memremap_can_ram_remap()for arm[64] specific filtering of what pages can be used from the linear mapping.memblock_is_map_memory()was called with the pfn of the address given toarch_memremap_can_ram_remap(); however,memblock_is_map_memory()expects to be given an address for arm, not a pfn.
Quoted 8 lines
This results in calls to
memremap()returning a newly mapped area when it should return an address in the existing linear mapping.Fix this by removing the address to pfn translation and pass the address directly.
Fixes 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")Signed-off-by Ross Stutterheim <[email protected]>
I think you could also add:
Quoted 9 lines
--- arch/arm/mm/ioremap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)arch/arm/mm/ioremap.c +0
-0
arch/arm/mm/ioremap.c void __init early_ioremap_init(void) · line 519
Quoted 8 lines
arch/arm/mm/ioremap.c +1
-3@@ -515,7 +515,5 @@ void __init early_ioremap_init(void)bool arch_memremap_can_ram_remap (resource_size_t offset,size_t size,unsigned long flags) { -unsigned long pfn =PHYS_PFN (offset); - -return memblock_is_map_memory (pfn); +return memblock_is_map_memory (offset); }
Not sure how Russell picks patches up these days (I used to send them to the patch system -
https://www.arm.linux.org.uk/developer/patches/info.php).
It might be simpler with git send-email (that's the alias I had):
git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="[email protected]"
Signature · 1 line
Catalin
Re: [PATCH v2] arm/memremap: fix arch_memremap_can_ram_remap()
Quoted 6 lines · Catalin Marinas
Quoted 2 lines
Fixes 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")Signed-off-by Ross Stutterheim <[email protected]>I think you could also add:
Cc <[email protected]>
Done. I also added some other Cc: entries on V3 along with Reviewed-by: lines . I'm new here, so I'm not sure I've used those 100% properly.
Quoted 8 lines
Not sure how Russell picks patches up these days (I used to send them to the patch system -
https://www.arm.linux.org.uk/developer/patches/info.php).It might be simpler with git send-email (that's the alias I had):
git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="[email protected]"
Thanks. I created an account there and submitted V3 through the web interface (to avoid my SMTP server appending more stuff on the end).
--
Ross
Russell King (Oracle)
maintainerRe: [PATCH v2] arm/memremap: fix arch_memremap_can_ram_remap()
Quoted 14 lines · Ross Stutterheim
Quoted 6 lines · Catalin Marinas
Quoted 2 lines
Fixes 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")Signed-off-by Ross Stutterheim <[email protected]>I think you could also add:
Cc <[email protected]>Done. I also added some other Cc: entries on V3 along with Reviewed-by:
lines . I'm new here, so I'm not sure I've used those 100% properly.Quoted 4 lines
Not sure how Russell picks patches up these days (I used to send them to the patch system -
https://www.arm.linux.org.uk/developer/patches/info.php).
Quoted 6 lines
Quoted 4 lines
It might be simpler with git send-email (that's the alias I had):
git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="[email protected]"Thanks. I created an account there and submitted V3 through the web interface (to avoid my SMTP server appending more stuff on the end).
Thanks, seems all good, applied and pushed out. I'll send it to Linus tomorrow as it's certainly a serious regression.
I'm surprised Mike hasn't responded...
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Catalin Marinas
maintainerRe: [PATCH v2] arm/memremap: fix arch_memremap_can_ram_remap()
Quoted 19 lines · Russell King
Quoted 18 lines · Ross Stutterheim
Quoted 6 lines · Catalin Marinas
Quoted 2 lines
Fixes 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")Signed-off-by Ross Stutterheim <[email protected]>I think you could also add:
Cc <[email protected]>Done. I also added some other Cc: entries on V3 along with Reviewed-by:
lines . I'm new here, so I'm not sure I've used those 100% properly.Quoted 8 lines
Not sure how Russell picks patches up these days (I used to send them to the patch system -
https://www.arm.linux.org.uk/developer/patches/info.php).It might be simpler with git send-email (that's the alias I had):
git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="[email protected]"
Quoted 7 lines
Quoted 2 lines
Thanks. I created an account there and submitted V3 through the web interface (to avoid my SMTP server appending more stuff on the end).
Thanks, seems all good, applied and pushed out. I'll send it to Linus tomorrow as it's certainly a serious regression.
I'm surprised Mike hasn't responded...
Ah, I think he joined Microsoft. Adding his kernel.org address.
Signature · 1 line
Catalin
Re: [PATCH v2] arm/memremap: fix arch_memremap_can_ram_remap()
In reply to Russell King (Oracle)Quoted 19 lines · Russell King (Oracle)
Quoted 18 lines · Ross Stutterheim
Quoted 6 lines · Catalin Marinas
Quoted 2 lines
Fixes 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")Signed-off-by Ross Stutterheim <[email protected]>I think you could also add:
Cc <[email protected]>Done. I also added some other Cc: entries on V3 along with Reviewed-by:
lines . I'm new here, so I'm not sure I've used those 100% properly.Quoted 8 lines
Not sure how Russell picks patches up these days (I used to send them to the patch system -
https://www.arm.linux.org.uk/developer/patches/info.php).It might be simpler with git send-email (that's the alias I had):
git send-email --add-header="KernelVersion: $(git describe --abbrev=0)" --no-thread --suppress-cc=all --to="[email protected]"
Quoted 7 lines
Quoted 2 lines
Thanks. I created an account there and submitted V3 through the web interface (to avoid my SMTP server appending more stuff on the end).
Thanks, seems all good, applied and pushed out. I'll send it to Linus tomorrow as it's certainly a serious regression.
I'm surprised Mike hasn't responded...
Passover vacation :)
Quoted 3 lines
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Signature · 2 lines
Sincerely yours, Mike.
Re: [PATCH v2] arm/memremap: fix arch_memremap_can_ram_remap()
In reply to Ross StutterheimQuoted 8 lines · Ross Stutterheim
commit
260364d112bc("arm[64]/memremap: don't abusepfn_valid()to ensure presence of linear map") added the definition ofarch_memremap_can_ram_remap()for arm[64] specific filtering of what pages can be used from the linear mapping.memblock_is_map_memory()was called with the pfn of the address given toarch_memremap_can_ram_remap(); however,memblock_is_map_memory()expects to be given an address for arm, not a pfn.
Quoted 8 lines
This results in calls to
memremap()returning a newly mapped area when it should return an address in the existing linear mapping.Fix this by removing the address to pfn translation and pass the address directly.
Fixes 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map")Signed-off-by Ross Stutterheim <[email protected]>
OMG
Also add Cc: [email protected] as pointed out by Catalin.
Yours,
Linus Walleij
PATCH v3 1/1 arm/memremap: fix arch_memremap_can_ram_remap()
In reply to Ross Stutterheimcommit 260364d112bc ("arm[64]/memremap: don't abuse pfn_valid() to ensure presence of linear map") added the definition of arch_memremap_can_ram_remap() for arm[64] specific filtering of what pages can be used from the linear mapping. memblock_is_map_memory() was called with the pfn of the address given to arch_memremap_can_ram_remap(); however, memblock_is_map_memory() expects to be given an address for arm, not a pfn.
This results in calls to memremap() returning a newly mapped area when it should return an address in the existing linear mapping.
Fix this by removing the address to pfn translation and pass the address directly.
--- arch/arm/mm/ioremap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/arm/mm/ioremap.c +1 -3
@@ -515,7 +515,5 @@ void __init early_ioremap_init(void)bool arch_memremap_can_ram_remap (resource_size_t offset,size_t size,unsigned long flags) { -unsigned long pfn =PHYS_PFN (offset); - -return memblock_is_map_memory (pfn); +return memblock_is_map_memory (offset); }
Signature · 1 line
2.49.0