xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [Xen-devel] [PATCH for-4.13 0/2] xen/arm: domain_build: Avoid implicit conversion from ULL to UL
@ 2019-09-29 15:56 Julien Grall
  2019-09-29 15:56 ` [Xen-devel] [PATCH for-4.13 1/2] " Julien Grall
  2019-09-29 15:56 ` [Xen-devel] [PATCH for-4.13 2/2] xen/arm: domain_build: Indent correctly parameters of alloc_bank_memory() Julien Grall
  0 siblings, 2 replies; 8+ messages in thread
From: Julien Grall @ 2019-09-29 15:56 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Julien Grall, Stefano Stabellini, Volodymyr Babchuk

Hi all,

This small patch series is here to avoid an implicit conversion from ULL to UL
when building with Arm32 (see patch #1). This patch is candidate for Xen 4.13.

The second patch is only a coding style fix. So could be deferred to next.

Cheers,

Cc: Juergen Gross <jgross@suse.com>

Julien Grall (2):
  xen/arm: domain_build: Avoid implicit conversion from ULL to UL
  xen/arm: domain_build: Indent correctly parameters of
    alloc_bank_memory()

 xen/arch/arm/domain_build.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [Xen-devel] [PATCH for-4.13 1/2] xen/arm: domain_build: Avoid implicit conversion from ULL to UL
  2019-09-29 15:56 [Xen-devel] [PATCH for-4.13 0/2] xen/arm: domain_build: Avoid implicit conversion from ULL to UL Julien Grall
@ 2019-09-29 15:56 ` Julien Grall
  2019-09-30  6:05   ` Jürgen Groß
  2019-10-01  1:05   ` Stefano Stabellini
  2019-09-29 15:56 ` [Xen-devel] [PATCH for-4.13 2/2] xen/arm: domain_build: Indent correctly parameters of alloc_bank_memory() Julien Grall
  1 sibling, 2 replies; 8+ messages in thread
From: Julien Grall @ 2019-09-29 15:56 UTC (permalink / raw)
  To: xen-devel
  Cc: Juergen Gross, Julien Grall, Stefano Stabellini, Volodymyr Babchuk

Clang 8.0 will fail to build domain_build.c on Arm32 because of the
following error:

domain_build.c:448:21: error: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 1090921693184 to 0
[-Werror,-Wconstant-conversion]
    bank_size = MIN(GUEST_RAM1_SIZE, kinfo->unassigned_mem);

Arm32 is able to support more than 4GB of physical memory, so it would
be theorically possible to create domian with more the 4GB of RAM.
Therefore, the size of a bank may not fit in 32-bit.

This can be resolved by switch the variable bank_size and the parameter
tot_size to "paddr_t".

Signed-off-by: Julien Grall <julien.grall@arm.com>

---

Cc: Juergen Gross <jgross@suse.com>

    I am not aware of any users trying to allocate more than 4GB VM for
    32-bit (there more it is in the dom0less path). Nonetheless, it
    would be best to fix it as soon as possible.

    Only built test it.
---
 xen/arch/arm/domain_build.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 337a89e518..b791e4b512 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -377,7 +377,7 @@ static void __init allocate_memory_11(struct domain *d,
 static bool __init allocate_bank_memory(struct domain *d,
                                        struct kernel_info *kinfo,
                                        gfn_t sgfn,
-                                       unsigned long tot_size)
+                                       paddr_t tot_size)
 {
     int res;
     struct page_info *pg;
@@ -433,7 +433,7 @@ static bool __init allocate_bank_memory(struct domain *d,
 static void __init allocate_memory(struct domain *d, struct kernel_info *kinfo)
 {
     unsigned int i;
-    unsigned long bank_size;
+    paddr_t bank_size;
 
     printk(XENLOG_INFO "Allocating mappings totalling %ldMB for %pd:\n",
            /* Don't want format this as PRIpaddr (16 digit hex) */
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* [Xen-devel] [PATCH for-4.13 2/2] xen/arm: domain_build: Indent correctly parameters of alloc_bank_memory()
  2019-09-29 15:56 [Xen-devel] [PATCH for-4.13 0/2] xen/arm: domain_build: Avoid implicit conversion from ULL to UL Julien Grall
  2019-09-29 15:56 ` [Xen-devel] [PATCH for-4.13 1/2] " Julien Grall
@ 2019-09-29 15:56 ` Julien Grall
  2019-10-01  1:05   ` Stefano Stabellini
  1 sibling, 1 reply; 8+ messages in thread
From: Julien Grall @ 2019-09-29 15:56 UTC (permalink / raw)
  To: xen-devel; +Cc: Julien Grall, Stefano Stabellini, Volodymyr Babchuk

Signed-off-by: Julien Grall <julien.grall@arm.com>
---
 xen/arch/arm/domain_build.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index b791e4b512..268e074af7 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -375,9 +375,9 @@ static void __init allocate_memory_11(struct domain *d,
 }
 
 static bool __init allocate_bank_memory(struct domain *d,
-                                       struct kernel_info *kinfo,
-                                       gfn_t sgfn,
-                                       paddr_t tot_size)
+                                        struct kernel_info *kinfo,
+                                        gfn_t sgfn,
+                                        paddr_t tot_size)
 {
     int res;
     struct page_info *pg;
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH for-4.13 1/2] xen/arm: domain_build: Avoid implicit conversion from ULL to UL
  2019-09-29 15:56 ` [Xen-devel] [PATCH for-4.13 1/2] " Julien Grall
@ 2019-09-30  6:05   ` Jürgen Groß
  2019-10-01  1:05   ` Stefano Stabellini
  1 sibling, 0 replies; 8+ messages in thread
From: Jürgen Groß @ 2019-09-30  6:05 UTC (permalink / raw)
  To: Julien Grall, xen-devel; +Cc: Stefano Stabellini, Volodymyr Babchuk

On 29.09.19 17:56, Julien Grall wrote:
> Clang 8.0 will fail to build domain_build.c on Arm32 because of the
> following error:
> 
> domain_build.c:448:21: error: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 1090921693184 to 0
> [-Werror,-Wconstant-conversion]
>      bank_size = MIN(GUEST_RAM1_SIZE, kinfo->unassigned_mem);
> 
> Arm32 is able to support more than 4GB of physical memory, so it would
> be theorically possible to create domian with more the 4GB of RAM.
> Therefore, the size of a bank may not fit in 32-bit.
> 
> This can be resolved by switch the variable bank_size and the parameter
> tot_size to "paddr_t".
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH for-4.13 1/2] xen/arm: domain_build: Avoid implicit conversion from ULL to UL
  2019-09-29 15:56 ` [Xen-devel] [PATCH for-4.13 1/2] " Julien Grall
  2019-09-30  6:05   ` Jürgen Groß
@ 2019-10-01  1:05   ` Stefano Stabellini
  1 sibling, 0 replies; 8+ messages in thread
From: Stefano Stabellini @ 2019-10-01  1:05 UTC (permalink / raw)
  To: Julien Grall
  Cc: Juergen Gross, xen-devel, Stefano Stabellini, Volodymyr Babchuk

On Sun, 29 Sep 2019, Julien Grall wrote:
> Clang 8.0 will fail to build domain_build.c on Arm32 because of the
> following error:
> 
> domain_build.c:448:21: error: implicit conversion from 'unsigned long long' to 'unsigned long' changes value from 1090921693184 to 0
> [-Werror,-Wconstant-conversion]
>     bank_size = MIN(GUEST_RAM1_SIZE, kinfo->unassigned_mem);
> 
> Arm32 is able to support more than 4GB of physical memory, so it would
> be theorically possible to create domian with more the 4GB of RAM.
                                    ^ domain

Other than the typo:

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> Therefore, the size of a bank may not fit in 32-bit.
> 
> This can be resolved by switch the variable bank_size and the parameter
> tot_size to "paddr_t".
> 
> Signed-off-by: Julien Grall <julien.grall@arm.com>
> 
> ---
> 
> Cc: Juergen Gross <jgross@suse.com>
> 
>     I am not aware of any users trying to allocate more than 4GB VM for
>     32-bit (there more it is in the dom0less path). Nonetheless, it
>     would be best to fix it as soon as possible.
> 
>     Only built test it.
> ---
>  xen/arch/arm/domain_build.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index 337a89e518..b791e4b512 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -377,7 +377,7 @@ static void __init allocate_memory_11(struct domain *d,
>  static bool __init allocate_bank_memory(struct domain *d,
>                                         struct kernel_info *kinfo,
>                                         gfn_t sgfn,
> -                                       unsigned long tot_size)
> +                                       paddr_t tot_size)
>  {
>      int res;
>      struct page_info *pg;
> @@ -433,7 +433,7 @@ static bool __init allocate_bank_memory(struct domain *d,
>  static void __init allocate_memory(struct domain *d, struct kernel_info *kinfo)
>  {
>      unsigned int i;
> -    unsigned long bank_size;
> +    paddr_t bank_size;
>  
>      printk(XENLOG_INFO "Allocating mappings totalling %ldMB for %pd:\n",
>             /* Don't want format this as PRIpaddr (16 digit hex) */
> -- 
> 2.11.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH for-4.13 2/2] xen/arm: domain_build: Indent correctly parameters of alloc_bank_memory()
  2019-09-29 15:56 ` [Xen-devel] [PATCH for-4.13 2/2] xen/arm: domain_build: Indent correctly parameters of alloc_bank_memory() Julien Grall
@ 2019-10-01  1:05   ` Stefano Stabellini
  2019-10-01  9:02     ` Julien Grall
  0 siblings, 1 reply; 8+ messages in thread
From: Stefano Stabellini @ 2019-10-01  1:05 UTC (permalink / raw)
  To: Julien Grall; +Cc: xen-devel, Stefano Stabellini, Volodymyr Babchuk

On Sun, 29 Sep 2019, Julien Grall wrote:
> Signed-off-by: Julien Grall <julien.grall@arm.com>

Acked-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/arch/arm/domain_build.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
> index b791e4b512..268e074af7 100644
> --- a/xen/arch/arm/domain_build.c
> +++ b/xen/arch/arm/domain_build.c
> @@ -375,9 +375,9 @@ static void __init allocate_memory_11(struct domain *d,
>  }
>  
>  static bool __init allocate_bank_memory(struct domain *d,
> -                                       struct kernel_info *kinfo,
> -                                       gfn_t sgfn,
> -                                       paddr_t tot_size)
> +                                        struct kernel_info *kinfo,
> +                                        gfn_t sgfn,
> +                                        paddr_t tot_size)
>  {
>      int res;
>      struct page_info *pg;
> -- 
> 2.11.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH for-4.13 2/2] xen/arm: domain_build: Indent correctly parameters of alloc_bank_memory()
  2019-10-01  1:05   ` Stefano Stabellini
@ 2019-10-01  9:02     ` Julien Grall
  2019-10-01  9:23       ` Jürgen Groß
  0 siblings, 1 reply; 8+ messages in thread
From: Julien Grall @ 2019-10-01  9:02 UTC (permalink / raw)
  To: Stefano Stabellini; +Cc: Juergen Gross, xen-devel, Volodymyr Babchuk

+Juergen

On 01/10/2019 02:05, Stefano Stabellini wrote:
> On Sun, 29 Sep 2019, Julien Grall wrote:
>> Signed-off-by: Julien Grall <julien.grall@arm.com>
> 
> Acked-by: Stefano Stabellini <sstabellini@kernel.org>
> 
> 
>> ---
>>   xen/arch/arm/domain_build.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> index b791e4b512..268e074af7 100644
>> --- a/xen/arch/arm/domain_build.c
>> +++ b/xen/arch/arm/domain_build.c
>> @@ -375,9 +375,9 @@ static void __init allocate_memory_11(struct domain *d,
>>   }
>>   
>>   static bool __init allocate_bank_memory(struct domain *d,
>> -                                       struct kernel_info *kinfo,
>> -                                       gfn_t sgfn,
>> -                                       paddr_t tot_size)
>> +                                        struct kernel_info *kinfo,
>> +                                        gfn_t sgfn,
>> +                                        paddr_t tot_size)
>>   {
>>       int res;
>>       struct page_info *pg;
>> -- 
>> 2.11.0
>>

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

* Re: [Xen-devel] [PATCH for-4.13 2/2] xen/arm: domain_build: Indent correctly parameters of alloc_bank_memory()
  2019-10-01  9:02     ` Julien Grall
@ 2019-10-01  9:23       ` Jürgen Groß
  0 siblings, 0 replies; 8+ messages in thread
From: Jürgen Groß @ 2019-10-01  9:23 UTC (permalink / raw)
  To: Julien Grall, Stefano Stabellini; +Cc: xen-devel, Volodymyr Babchuk

On 01.10.19 11:02, Julien Grall wrote:
> +Juergen
> 
> On 01/10/2019 02:05, Stefano Stabellini wrote:
>> On Sun, 29 Sep 2019, Julien Grall wrote:
>>> Signed-off-by: Julien Grall <julien.grall@arm.com>
>>
>> Acked-by: Stefano Stabellini <sstabellini@kernel.org>

Release-acked-by: Juergen Gross <jgross@suse.com>


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

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

end of thread, other threads:[~2019-10-01  9:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-29 15:56 [Xen-devel] [PATCH for-4.13 0/2] xen/arm: domain_build: Avoid implicit conversion from ULL to UL Julien Grall
2019-09-29 15:56 ` [Xen-devel] [PATCH for-4.13 1/2] " Julien Grall
2019-09-30  6:05   ` Jürgen Groß
2019-10-01  1:05   ` Stefano Stabellini
2019-09-29 15:56 ` [Xen-devel] [PATCH for-4.13 2/2] xen/arm: domain_build: Indent correctly parameters of alloc_bank_memory() Julien Grall
2019-10-01  1:05   ` Stefano Stabellini
2019-10-01  9:02     ` Julien Grall
2019-10-01  9:23       ` Jürgen Groß

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).