* [PATCH] MIPS: vdso: Utilize __pa() for gic_pfn
@ 2022-07-07 20:27 Florian Fainelli
2022-07-08 1:58 ` Greg Ungerer
2022-07-11 8:38 ` Thomas Bogendoerfer
0 siblings, 2 replies; 3+ messages in thread
From: Florian Fainelli @ 2022-07-07 20:27 UTC (permalink / raw)
To: linux-mips
Cc: Florian Fainelli, Greg Ungerer, Serge Semin, Thomas Bogendoerfer,
open list
The GIC user offset is mapped into every process' virtual address and is
therefore part of the hot-path of arch_setup_additional_pages(). Utilize
__pa() such that we are more optimal even when CONFIG_DEBUG_VIRTUAL is
enabled, and while at it utilize PFN_DOWN() instead of open-coding the
right shift by PAGE_SHIFT.
Reported-by: Greg Ungerer <gerg@kernel.org>
Suggested-by: Serge Semin <fancer.lancer@gmail.com>
Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
arch/mips/kernel/vdso.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
index 3d0cf471f2fe..b2cc2c2dd4bf 100644
--- a/arch/mips/kernel/vdso.c
+++ b/arch/mips/kernel/vdso.c
@@ -159,7 +159,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
/* Map GIC user page. */
if (gic_size) {
gic_base = (unsigned long)mips_gic_base + MIPS_GIC_USER_OFS;
- gic_pfn = virt_to_phys((void *)gic_base) >> PAGE_SHIFT;
+ gic_pfn = PFN_DOWN(__pa(gic_base));
ret = io_remap_pfn_range(vma, base, gic_pfn, gic_size,
pgprot_noncached(vma->vm_page_prot));
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: vdso: Utilize __pa() for gic_pfn
2022-07-07 20:27 [PATCH] MIPS: vdso: Utilize __pa() for gic_pfn Florian Fainelli
@ 2022-07-08 1:58 ` Greg Ungerer
2022-07-11 8:38 ` Thomas Bogendoerfer
1 sibling, 0 replies; 3+ messages in thread
From: Greg Ungerer @ 2022-07-08 1:58 UTC (permalink / raw)
To: Florian Fainelli, linux-mips; +Cc: Serge Semin, Thomas Bogendoerfer, open list
On 8/7/22 06:27, Florian Fainelli wrote:
> The GIC user offset is mapped into every process' virtual address and is
> therefore part of the hot-path of arch_setup_additional_pages(). Utilize
> __pa() such that we are more optimal even when CONFIG_DEBUG_VIRTUAL is
> enabled, and while at it utilize PFN_DOWN() instead of open-coding the
> right shift by PAGE_SHIFT.
>
> Reported-by: Greg Ungerer <gerg@kernel.org>
> Suggested-by: Serge Semin <fancer.lancer@gmail.com>
> Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Fixes the issue of warnings on every process start with CONFIG_DEBUG_VIRTUAL
enabled for me. Thanks. So if you want:
Acked-by: Greg Ungerer <gerg@kernel.org>
Tested-by: Greg Ungerer <gerg@kernel.org>
Regards
Greg
> ---
> arch/mips/kernel/vdso.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
> index 3d0cf471f2fe..b2cc2c2dd4bf 100644
> --- a/arch/mips/kernel/vdso.c
> +++ b/arch/mips/kernel/vdso.c
> @@ -159,7 +159,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
> /* Map GIC user page. */
> if (gic_size) {
> gic_base = (unsigned long)mips_gic_base + MIPS_GIC_USER_OFS;
> - gic_pfn = virt_to_phys((void *)gic_base) >> PAGE_SHIFT;
> + gic_pfn = PFN_DOWN(__pa(gic_base));
>
> ret = io_remap_pfn_range(vma, base, gic_pfn, gic_size,
> pgprot_noncached(vma->vm_page_prot));
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] MIPS: vdso: Utilize __pa() for gic_pfn
2022-07-07 20:27 [PATCH] MIPS: vdso: Utilize __pa() for gic_pfn Florian Fainelli
2022-07-08 1:58 ` Greg Ungerer
@ 2022-07-11 8:38 ` Thomas Bogendoerfer
1 sibling, 0 replies; 3+ messages in thread
From: Thomas Bogendoerfer @ 2022-07-11 8:38 UTC (permalink / raw)
To: Florian Fainelli; +Cc: linux-mips, Greg Ungerer, Serge Semin, open list
On Thu, Jul 07, 2022 at 01:27:58PM -0700, Florian Fainelli wrote:
> The GIC user offset is mapped into every process' virtual address and is
> therefore part of the hot-path of arch_setup_additional_pages(). Utilize
> __pa() such that we are more optimal even when CONFIG_DEBUG_VIRTUAL is
> enabled, and while at it utilize PFN_DOWN() instead of open-coding the
> right shift by PAGE_SHIFT.
>
> Reported-by: Greg Ungerer <gerg@kernel.org>
> Suggested-by: Serge Semin <fancer.lancer@gmail.com>
> Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
> arch/mips/kernel/vdso.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c
> index 3d0cf471f2fe..b2cc2c2dd4bf 100644
> --- a/arch/mips/kernel/vdso.c
> +++ b/arch/mips/kernel/vdso.c
> @@ -159,7 +159,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
> /* Map GIC user page. */
> if (gic_size) {
> gic_base = (unsigned long)mips_gic_base + MIPS_GIC_USER_OFS;
> - gic_pfn = virt_to_phys((void *)gic_base) >> PAGE_SHIFT;
> + gic_pfn = PFN_DOWN(__pa(gic_base));
>
> ret = io_remap_pfn_range(vma, base, gic_pfn, gic_size,
> pgprot_noncached(vma->vm_page_prot));
> --
> 2.25.1
applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-07-11 8:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-07 20:27 [PATCH] MIPS: vdso: Utilize __pa() for gic_pfn Florian Fainelli
2022-07-08 1:58 ` Greg Ungerer
2022-07-11 8:38 ` Thomas Bogendoerfer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox