All of lore.kernel.org
 help / color / mirror / Atom feed
* Facing issue with va to pa conversion in arm64/makedumpfile
@ 2020-11-18  9:08 aadiga
  2020-11-19  0:26 ` HAGIO KAZUHITO(萩尾 一仁)
  0 siblings, 1 reply; 3+ messages in thread
From: aadiga @ 2020-11-18  9:08 UTC (permalink / raw)
  To: k-hagio-ab, panand; +Cc: arunks, vatsa, kexec

Hi Pratyush/ Kazuhito ,

While attempting to create dumpfile on arm64, I was face issues with 
virtual address to physical address conversion when kalsr is enable. 
Linux kernel version is 5.4.42 stable kernel.

The following patch seems to add patch to enable kalsr support :

[PATCH 10/10] arm64: fix memory layout as per changes in v4.6 kernel

https://sourceforge.net/p/makedumpfile/code/ci/b6fe70c7ffef9affb540412407702b15d4a196e9


static unsigned long long
+__pa(unsigned long vaddr)
+{
+       if (kimage_voffset == NOT_FOUND_NUMBER ||
+                       (vaddr >= PAGE_OFFSET))
+               return (vaddr - PAGE_OFFSET + info->phys_base);
+       else
+               return (vaddr - kimage_voffset);
+}


I see that even when kimage_voffset is available , it calculates pa 
using PAGE_OFFSET.
But as KALSR is enabled it should ideally use kimage_voffset.

Not sure what is the significance of the check (vaddr >= PAGE_OFFSET) if 
kimage_voffset is available.

i think this should be something like

+       if (kimage_voffset == NOT_FOUND_NUMBER) && (vaddr >= 
PAGE_OFFSET))
+               return (vaddr - PAGE_OFFSET + info->phys_base);
+       else
+               return (vaddr - kimage_voffset);



Because we want to check vaddr is greater than PAGE_OFFSET when we are 
considering linear mapping without kaslr seed.

Or may be we should have a separate check which will error out all vaddr 
less than PAGE_OFFSET and kimage_voffset.

+       if  (vaddr < PAGE_OFFSET)
+              return -EINVAL;
+       if (kimage_voffset == NOT_FOUND_NUMBER)
+               return (vaddr - PAGE_OFFSET + info->phys_base);
+       else
+               return (vaddr - kimage_voffset);

-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora 
Forum,
a Linux Foundation Collaborative Project

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Facing issue with va to pa conversion in arm64/makedumpfile
  2020-11-18  9:08 Facing issue with va to pa conversion in arm64/makedumpfile aadiga
@ 2020-11-19  0:26 ` HAGIO KAZUHITO(萩尾 一仁)
  2020-11-20  8:41   ` Bhupesh Sharma
  0 siblings, 1 reply; 3+ messages in thread
From: HAGIO KAZUHITO(萩尾 一仁) @ 2020-11-19  0:26 UTC (permalink / raw)
  To: aadiga, panand; +Cc: vatsa, Bhupesh Sharma, arunks, kexec

Hi Akshay,
(Cc Bhupesh)

-----Original Message-----
> Hi Pratyush/ Kazuhito ,
> 
> While attempting to create dumpfile on arm64, I was face issues with
> virtual address to physical address conversion when kalsr is enable.
> Linux kernel version is 5.4.42 stable kernel.

It seems that it would be due to the flipped VA space at 5.4 arm64 kernel.
Bhupesh has been addressing this for us, but not merged yet.
How does it work with this patch?
http://lists.infradead.org/pipermail/kexec/2020-September/021336.html

(Its 1/3 and 2/3 patches were already merged, so I think the 3/3 patch
can be applied on top of the latest makedumpfile.)

Thanks,
Kazu

> 
> The following patch seems to add patch to enable kalsr support :
> 
> [PATCH 10/10] arm64: fix memory layout as per changes in v4.6 kernel
> 
> https://sourceforge.net/p/makedumpfile/code/ci/b6fe70c7ffef9affb540412407702b15d4a196e9
> 
> 
> static unsigned long long
> +__pa(unsigned long vaddr)
> +{
> +       if (kimage_voffset == NOT_FOUND_NUMBER ||
> +                       (vaddr >= PAGE_OFFSET))
> +               return (vaddr - PAGE_OFFSET + info->phys_base);
> +       else
> +               return (vaddr - kimage_voffset);
> +}
> 
> 
> I see that even when kimage_voffset is available , it calculates pa
> using PAGE_OFFSET.
> But as KALSR is enabled it should ideally use kimage_voffset.
> 
> Not sure what is the significance of the check (vaddr >= PAGE_OFFSET) if
> kimage_voffset is available.
> 
> i think this should be something like
> 
> +       if (kimage_voffset == NOT_FOUND_NUMBER) && (vaddr >=
> PAGE_OFFSET))
> +               return (vaddr - PAGE_OFFSET + info->phys_base);
> +       else
> +               return (vaddr - kimage_voffset);
> 
> 
> 
> Because we want to check vaddr is greater than PAGE_OFFSET when we are
> considering linear mapping without kaslr seed.
> 
> Or may be we should have a separate check which will error out all vaddr
> less than PAGE_OFFSET and kimage_voffset.
> 
> +       if  (vaddr < PAGE_OFFSET)
> +              return -EINVAL;
> +       if (kimage_voffset == NOT_FOUND_NUMBER)
> +               return (vaddr - PAGE_OFFSET + info->phys_base);
> +       else
> +               return (vaddr - kimage_voffset);
> 
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> Forum,
> a Linux Foundation Collaborative Project
> 
> _______________________________________________
> kexec mailing list
> kexec@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Facing issue with va to pa conversion in arm64/makedumpfile
  2020-11-19  0:26 ` HAGIO KAZUHITO(萩尾 一仁)
@ 2020-11-20  8:41   ` Bhupesh Sharma
  0 siblings, 0 replies; 3+ messages in thread
From: Bhupesh Sharma @ 2020-11-20  8:41 UTC (permalink / raw)
  To: HAGIO KAZUHITO(萩尾 一仁)
  Cc: aadiga, panand, vatsa, arunks, kexec

Hello Akshay,

As Kazu mentioned please try the patch :
http://lists.infradead.org/pipermail/kexec/2020-September/021336.html
and let me know your observations.

I am still on my holidays but will try to check my emails from today,
so will help you with any further issues.

Thanks,
Bhupesh

On Thu, Nov 19, 2020 at 5:56 AM HAGIO KAZUHITO(萩尾 一仁)
<k-hagio-ab@nec.com> wrote:
>
> Hi Akshay,
> (Cc Bhupesh)
>
> -----Original Message-----
> > Hi Pratyush/ Kazuhito ,
> >
> > While attempting to create dumpfile on arm64, I was face issues with
> > virtual address to physical address conversion when kalsr is enable.
> > Linux kernel version is 5.4.42 stable kernel.
>
> It seems that it would be due to the flipped VA space at 5.4 arm64 kernel.
> Bhupesh has been addressing this for us, but not merged yet.
> How does it work with this patch?
> http://lists.infradead.org/pipermail/kexec/2020-September/021336.html
>
> (Its 1/3 and 2/3 patches were already merged, so I think the 3/3 patch
> can be applied on top of the latest makedumpfile.)
>
> Thanks,
> Kazu
>
> >
> > The following patch seems to add patch to enable kalsr support :
> >
> > [PATCH 10/10] arm64: fix memory layout as per changes in v4.6 kernel
> >
> > https://sourceforge.net/p/makedumpfile/code/ci/b6fe70c7ffef9affb540412407702b15d4a196e9
> >
> >
> > static unsigned long long
> > +__pa(unsigned long vaddr)
> > +{
> > +       if (kimage_voffset == NOT_FOUND_NUMBER ||
> > +                       (vaddr >= PAGE_OFFSET))
> > +               return (vaddr - PAGE_OFFSET + info->phys_base);
> > +       else
> > +               return (vaddr - kimage_voffset);
> > +}
> >
> >
> > I see that even when kimage_voffset is available , it calculates pa
> > using PAGE_OFFSET.
> > But as KALSR is enabled it should ideally use kimage_voffset.
> >
> > Not sure what is the significance of the check (vaddr >= PAGE_OFFSET) if
> > kimage_voffset is available.
> >
> > i think this should be something like
> >
> > +       if (kimage_voffset == NOT_FOUND_NUMBER) && (vaddr >=
> > PAGE_OFFSET))
> > +               return (vaddr - PAGE_OFFSET + info->phys_base);
> > +       else
> > +               return (vaddr - kimage_voffset);
> >
> >
> >
> > Because we want to check vaddr is greater than PAGE_OFFSET when we are
> > considering linear mapping without kaslr seed.
> >
> > Or may be we should have a separate check which will error out all vaddr
> > less than PAGE_OFFSET and kimage_voffset.
> >
> > +       if  (vaddr < PAGE_OFFSET)
> > +              return -EINVAL;
> > +       if (kimage_voffset == NOT_FOUND_NUMBER)
> > +               return (vaddr - PAGE_OFFSET + info->phys_base);
> > +       else
> > +               return (vaddr - kimage_voffset);
> >
> > --
> > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora
> > Forum,
> > a Linux Foundation Collaborative Project
> >
> > _______________________________________________
> > kexec mailing list
> > kexec@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/kexec
>


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-20  8:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-18  9:08 Facing issue with va to pa conversion in arm64/makedumpfile aadiga
2020-11-19  0:26 ` HAGIO KAZUHITO(萩尾 一仁)
2020-11-20  8:41   ` Bhupesh Sharma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.