Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-27 Thread Stefano Stabellini
On Thu, 27 Aug 2020, Jürgen Groß wrote: > On 27.08.20 10:24, Julien Grall wrote: > > > > > > On 27/08/2020 06:21, Jürgen Groß wrote: > > > On 26.08.20 20:37, Julien Grall wrote: > > > "Usually" is a bit gross here. The only generic call site I could find > > > is xenbus_grant_ring(). All other in

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-27 Thread Jürgen Groß
On 27.08.20 10:24, Julien Grall wrote: On 27/08/2020 06:21, Jürgen Groß wrote: On 26.08.20 20:37, Julien Grall wrote: "Usually" is a bit gross here. The only generic call site I could find is xenbus_grant_ring(). All other instances (I counted 22) are not generic at all. will only catch one i

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-27 Thread Julien Grall
On 27/08/2020 06:21, Jürgen Groß wrote: On 26.08.20 20:37, Julien Grall wrote: "Usually" is a bit gross here. The only generic call site I could find is xenbus_grant_ring(). All other instances (I counted 22) are not generic at all. will only catch one instance and it means we would have to f

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-26 Thread Jürgen Groß
On 26.08.20 20:37, Julien Grall wrote: Hi Simon, On 25/08/2020 10:31, Simon Leiner wrote: As virt_to_gfn uses virt_to_phys, it will return invalid addresses when used with vmalloc'd addresses. This patch introduces a warning, when virt_to_gfn is used in this way. Signed-off-by: Simon Leiner -

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-26 Thread Julien Grall
Hi Simon, On 25/08/2020 10:31, Simon Leiner wrote: As virt_to_gfn uses virt_to_phys, it will return invalid addresses when used with vmalloc'd addresses. This patch introduces a warning, when virt_to_gfn is used in this way. Signed-off-by: Simon Leiner --- include/xen/arm/page.h | 6 +-

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-26 Thread Simon Leiner
On 26.08.20 10:27, Jürgen Groß wrote: > On 26.08.20 10:14, Simon Leiner wrote: >> On 26.08.20 09:59, Jürgen Groß wrote: >>> This seems to be an Arm specific function. >> >> Is that a problem? The caller site is also ARM specific. > > The caller site is ARM specific, but __is_lm_address() is define

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-26 Thread Jürgen Groß
On 26.08.20 10:14, Simon Leiner wrote: On 26.08.20 09:59, Jürgen Groß wrote: This seems to be an Arm specific function. Is that a problem? The caller site is also ARM specific. The caller site is ARM specific, but __is_lm_address() is defined for arm64 only. virt_addr_valid() seems to be

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-26 Thread Simon Leiner
On 26.08.20 09:59, Jürgen Groß wrote: > This seems to be an Arm specific function. Is that a problem? The caller site is also ARM specific. > virt_addr_valid() seems to be a good fit. If you prefer that anyway, I will change it and resubmit that part of the patch. Simon

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-26 Thread Jürgen Groß
On 26.08.20 09:50, Simon Leiner wrote: On 26.08.20 08:20, Jan Beulich wrote: Hmm, to me __phys_to_virt() and __virt_to_phys_nodebug() give the impression that they're just linear transformations of the address, which would seem to suggest there's a pre-determined address range used for the direc

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-26 Thread Simon Leiner
On 26.08.20 08:20, Jan Beulich wrote: > Hmm, to me __phys_to_virt() and __virt_to_phys_nodebug() give > the impression that they're just linear transformations of the > address, which would seem to suggest there's a pre-determined > address range used for the direct map. >From eyeballing the kerne

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-25 Thread Jan Beulich
On 26.08.2020 01:48, Stefano Stabellini wrote: > On Tue, 25 Aug 2020, Jan Beulich wrote: >> On 25.08.2020 11:31, Simon Leiner wrote: >>> --- a/include/xen/arm/page.h >>> +++ b/include/xen/arm/page.h >>> @@ -76,7 +76,11 @@ static inline unsigned long bfn_to_pfn(unsigned long bfn) >>> #define bfn_to

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-25 Thread Stefano Stabellini
On Tue, 25 Aug 2020, Simon Leiner wrote: > As virt_to_gfn uses virt_to_phys, it will return invalid addresses when > used with vmalloc'd addresses. This patch introduces a warning, when > virt_to_gfn is used in this way. > > Signed-off-by: Simon Leiner Reviewed-by: Stefano Stabellini > --- >

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-25 Thread Stefano Stabellini
On Tue, 25 Aug 2020, Jan Beulich wrote: > On 25.08.2020 11:31, Simon Leiner wrote: > > --- a/include/xen/arm/page.h > > +++ b/include/xen/arm/page.h > > @@ -76,7 +76,11 @@ static inline unsigned long bfn_to_pfn(unsigned long bfn) > > #define bfn_to_local_pfn(bfn) bfn_to_pfn(bfn) > > > > /*

Re: [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-25 Thread Jan Beulich
On 25.08.2020 11:31, Simon Leiner wrote: > --- a/include/xen/arm/page.h > +++ b/include/xen/arm/page.h > @@ -76,7 +76,11 @@ static inline unsigned long bfn_to_pfn(unsigned long bfn) > #define bfn_to_local_pfn(bfn)bfn_to_pfn(bfn) > > /* VIRT <-> GUEST conversion */ > -#define virt_to_gfn

[PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn

2020-08-25 Thread Simon Leiner
As virt_to_gfn uses virt_to_phys, it will return invalid addresses when used with vmalloc'd addresses. This patch introduces a warning, when virt_to_gfn is used in this way. Signed-off-by: Simon Leiner --- include/xen/arm/page.h | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --