kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH v2 0/2] Fix some compilation issues on 32bit
@ 2020-07-14 13:00 Claudio Imbrenda
  2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 1/2] x86/cstart: Fix compilation issue in 32 bit mode Claudio Imbrenda
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Claudio Imbrenda @ 2020-07-14 13:00 UTC (permalink / raw)
  To: kvm, pbonzini
  Cc: frankja, thuth, david, drjones, jmattson, sean.j.christopherson

Two small patches to fix compilation issues on 32bit:

one for a typo in x86/cstart

one for a thinko in lib/alloc_page

notice that there is another patch for the lib/alloc_page issue floating
around, this patch is an alternative to that one

v1->v2
* use the z modifier for size_t variables, instead of casting to long

Claudio Imbrenda (2):
  x86/cstart: Fix compilation issue in 32 bit mode
  lib/alloc_page: Fix compilation issue on 32bit archs

 lib/alloc_page.c | 4 ++--
 x86/cstart.S     | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.26.2


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

* [kvm-unit-tests PATCH v2 1/2] x86/cstart: Fix compilation issue in 32 bit mode
  2020-07-14 13:00 [kvm-unit-tests PATCH v2 0/2] Fix some compilation issues on 32bit Claudio Imbrenda
@ 2020-07-14 13:00 ` Claudio Imbrenda
  2020-07-15 14:29   ` Claudio Imbrenda
  2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 2/2] lib/alloc_page: Fix compilation issue on 32bit archs Claudio Imbrenda
  2020-07-28 21:25 ` [kvm-unit-tests PATCH v2 0/2] Fix some compilation issues on 32bit Paolo Bonzini
  2 siblings, 1 reply; 8+ messages in thread
From: Claudio Imbrenda @ 2020-07-14 13:00 UTC (permalink / raw)
  To: kvm, pbonzini
  Cc: frankja, thuth, david, drjones, jmattson, sean.j.christopherson

Fix a typo in x86/cstart.S so that 32bit code can be compiled again on x86.

Fixes: d86ef58519645 ("cstart: do not assume CR4 starts as zero")
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 x86/cstart.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/x86/cstart.S b/x86/cstart.S
index e63e4e2..c0efc5f 100644
--- a/x86/cstart.S
+++ b/x86/cstart.S
@@ -125,7 +125,7 @@ start:
         jmpl $8, $start32
 
 prepare_32:
-	mov %(1 << 4), %eax // pse
+	mov $(1 << 4), %eax // pse
 	mov %eax, %cr4
 
 	mov $pt, %eax
-- 
2.26.2


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

* [kvm-unit-tests PATCH v2 2/2] lib/alloc_page: Fix compilation issue on 32bit archs
  2020-07-14 13:00 [kvm-unit-tests PATCH v2 0/2] Fix some compilation issues on 32bit Claudio Imbrenda
  2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 1/2] x86/cstart: Fix compilation issue in 32 bit mode Claudio Imbrenda
@ 2020-07-14 13:00 ` Claudio Imbrenda
  2020-07-15 14:19   ` Thomas Huth
  2020-07-16  7:11   ` Nadav Amit
  2020-07-28 21:25 ` [kvm-unit-tests PATCH v2 0/2] Fix some compilation issues on 32bit Paolo Bonzini
  2 siblings, 2 replies; 8+ messages in thread
From: Claudio Imbrenda @ 2020-07-14 13:00 UTC (permalink / raw)
  To: kvm, pbonzini
  Cc: frankja, thuth, david, drjones, jmattson, sean.j.christopherson

The assert in lib/alloc_page is hardcoded to long.

Use the z modifier instead, which is meant to be used for size_t.

Fixes: 73f4b202beb39 ("lib/alloc_page: change some parameter types")
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
---
 lib/alloc_page.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/alloc_page.c b/lib/alloc_page.c
index fa3c527..74fe726 100644
--- a/lib/alloc_page.c
+++ b/lib/alloc_page.c
@@ -29,11 +29,11 @@ void free_pages(void *mem, size_t size)
 	assert_msg((unsigned long) mem % PAGE_SIZE == 0,
 		   "mem not page aligned: %p", mem);
 
-	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: %#lx", size);
+	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: %#zx", size);
 
 	assert_msg(size == 0 || (uintptr_t)mem == -size ||
 		   (uintptr_t)mem + size > (uintptr_t)mem,
-		   "mem + size overflow: %p + %#lx", mem, size);
+		   "mem + size overflow: %p + %#zx", mem, size);
 
 	if (size == 0) {
 		freelist = NULL;
-- 
2.26.2


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

* Re: [kvm-unit-tests PATCH v2 2/2] lib/alloc_page: Fix compilation issue on 32bit archs
  2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 2/2] lib/alloc_page: Fix compilation issue on 32bit archs Claudio Imbrenda
@ 2020-07-15 14:19   ` Thomas Huth
  2020-07-16  7:11   ` Nadav Amit
  1 sibling, 0 replies; 8+ messages in thread
From: Thomas Huth @ 2020-07-15 14:19 UTC (permalink / raw)
  To: Claudio Imbrenda, kvm, pbonzini
  Cc: frankja, david, drjones, jmattson, sean.j.christopherson

On 14/07/2020 15.00, Claudio Imbrenda wrote:
> The assert in lib/alloc_page is hardcoded to long.
> 
> Use the z modifier instead, which is meant to be used for size_t.
> 
> Fixes: 73f4b202beb39 ("lib/alloc_page: change some parameter types")
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  lib/alloc_page.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/alloc_page.c b/lib/alloc_page.c
> index fa3c527..74fe726 100644
> --- a/lib/alloc_page.c
> +++ b/lib/alloc_page.c
> @@ -29,11 +29,11 @@ void free_pages(void *mem, size_t size)
>  	assert_msg((unsigned long) mem % PAGE_SIZE == 0,
>  		   "mem not page aligned: %p", mem);
>  
> -	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: %#lx", size);
> +	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: %#zx", size);
>  
>  	assert_msg(size == 0 || (uintptr_t)mem == -size ||
>  		   (uintptr_t)mem + size > (uintptr_t)mem,
> -		   "mem + size overflow: %p + %#lx", mem, size);
> +		   "mem + size overflow: %p + %#zx", mem, size);
>  
>  	if (size == 0) {
>  		freelist = NULL;

Reviewed-by: Thomas Huth <thuth@redhat.com>


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

* Re: [kvm-unit-tests PATCH v2 1/2] x86/cstart: Fix compilation issue in 32 bit mode
  2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 1/2] x86/cstart: Fix compilation issue in 32 bit mode Claudio Imbrenda
@ 2020-07-15 14:29   ` Claudio Imbrenda
  0 siblings, 0 replies; 8+ messages in thread
From: Claudio Imbrenda @ 2020-07-15 14:29 UTC (permalink / raw)
  To: kvm, pbonzini
  Cc: frankja, thuth, david, drjones, jmattson, sean.j.christopherson

please disregard this patch, I had not noticed someone else had already
sent this same patch shortly before me

On Tue, 14 Jul 2020 15:00:29 +0200
Claudio Imbrenda <imbrenda@linux.ibm.com> wrote:

> Fix a typo in x86/cstart.S so that 32bit code can be compiled again
> on x86.
> 
> Fixes: d86ef58519645 ("cstart: do not assume CR4 starts as zero")
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
>  x86/cstart.S | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/x86/cstart.S b/x86/cstart.S
> index e63e4e2..c0efc5f 100644
> --- a/x86/cstart.S
> +++ b/x86/cstart.S
> @@ -125,7 +125,7 @@ start:
>          jmpl $8, $start32
>  
>  prepare_32:
> -	mov %(1 << 4), %eax // pse
> +	mov $(1 << 4), %eax // pse
>  	mov %eax, %cr4
>  
>  	mov $pt, %eax


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

* Re: [kvm-unit-tests PATCH v2 2/2] lib/alloc_page: Fix compilation issue on 32bit archs
  2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 2/2] lib/alloc_page: Fix compilation issue on 32bit archs Claudio Imbrenda
  2020-07-15 14:19   ` Thomas Huth
@ 2020-07-16  7:11   ` Nadav Amit
  2020-07-16  9:55     ` Claudio Imbrenda
  1 sibling, 1 reply; 8+ messages in thread
From: Nadav Amit @ 2020-07-16  7:11 UTC (permalink / raw)
  To: Claudio Imbrenda, Sean Christopherson
  Cc: kvm, Paolo Bonzini, frankja, Thomas Huth, David Hildenbrand,
	drjones, Jim Mattson

> On Jul 14, 2020, at 6:00 AM, Claudio Imbrenda <imbrenda@linux.ibm.com> wrote:
> 
> The assert in lib/alloc_page is hardcoded to long.
> 
> Use the z modifier instead, which is meant to be used for size_t.
> 
> Fixes: 73f4b202beb39 ("lib/alloc_page: change some parameter types")
> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> ---
> lib/alloc_page.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/alloc_page.c b/lib/alloc_page.c
> index fa3c527..74fe726 100644
> --- a/lib/alloc_page.c
> +++ b/lib/alloc_page.c
> @@ -29,11 +29,11 @@ void free_pages(void *mem, size_t size)
> 	assert_msg((unsigned long) mem % PAGE_SIZE == 0,
> 		   "mem not page aligned: %p", mem);
> 
> -	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: %#lx", size);
> +	assert_msg(size % PAGE_SIZE == 0, "size not page aligned: %#zx", size);
> 
> 	assert_msg(size == 0 || (uintptr_t)mem == -size ||
> 		   (uintptr_t)mem + size > (uintptr_t)mem,
> -		   "mem + size overflow: %p + %#lx", mem, size);
> +		   "mem + size overflow: %p + %#zx", mem, size);
> 
> 	if (size == 0) {
> 		freelist = NULL;
> — 
> 2.26.2

Sean sent a different patch ("lib/alloc_page: Revert to 'unsigned long’ for
@size params”) that changes size to unsigned long, so you really should
synchronize.


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

* Re: [kvm-unit-tests PATCH v2 2/2] lib/alloc_page: Fix compilation issue on 32bit archs
  2020-07-16  7:11   ` Nadav Amit
@ 2020-07-16  9:55     ` Claudio Imbrenda
  0 siblings, 0 replies; 8+ messages in thread
From: Claudio Imbrenda @ 2020-07-16  9:55 UTC (permalink / raw)
  To: Nadav Amit
  Cc: Sean Christopherson, kvm, Paolo Bonzini, frankja, Thomas Huth,
	David Hildenbrand, drjones, Jim Mattson

On Thu, 16 Jul 2020 00:11:31 -0700
Nadav Amit <nadav.amit@gmail.com> wrote:

> > On Jul 14, 2020, at 6:00 AM, Claudio Imbrenda
> > <imbrenda@linux.ibm.com> wrote:
> > 
> > The assert in lib/alloc_page is hardcoded to long.
> > 
> > Use the z modifier instead, which is meant to be used for size_t.
> > 
> > Fixes: 73f4b202beb39 ("lib/alloc_page: change some parameter types")
> > Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
> > ---
> > lib/alloc_page.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/lib/alloc_page.c b/lib/alloc_page.c
> > index fa3c527..74fe726 100644
> > --- a/lib/alloc_page.c
> > +++ b/lib/alloc_page.c
> > @@ -29,11 +29,11 @@ void free_pages(void *mem, size_t size)
> > 	assert_msg((unsigned long) mem % PAGE_SIZE == 0,
> > 		   "mem not page aligned: %p", mem);
> > 
> > -	assert_msg(size % PAGE_SIZE == 0, "size not page aligned:
> > %#lx", size);
> > +	assert_msg(size % PAGE_SIZE == 0, "size not page aligned:
> > %#zx", size);
> > 
> > 	assert_msg(size == 0 || (uintptr_t)mem == -size ||
> > 		   (uintptr_t)mem + size > (uintptr_t)mem,
> > -		   "mem + size overflow: %p + %#lx", mem, size);
> > +		   "mem + size overflow: %p + %#zx", mem, size);
> > 
> > 	if (size == 0) {
> > 		freelist = NULL;
> > — 
> > 2.26.2  
> 
> Sean sent a different patch ("lib/alloc_page: Revert to 'unsigned
> long’ for @size params”) that changes size to unsigned long, so you
> really should synchronize.

I know, this is a (simpler) alternative to his patch.


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

* Re: [kvm-unit-tests PATCH v2 0/2] Fix some compilation issues on 32bit
  2020-07-14 13:00 [kvm-unit-tests PATCH v2 0/2] Fix some compilation issues on 32bit Claudio Imbrenda
  2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 1/2] x86/cstart: Fix compilation issue in 32 bit mode Claudio Imbrenda
  2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 2/2] lib/alloc_page: Fix compilation issue on 32bit archs Claudio Imbrenda
@ 2020-07-28 21:25 ` Paolo Bonzini
  2 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2020-07-28 21:25 UTC (permalink / raw)
  To: Claudio Imbrenda, kvm
  Cc: frankja, thuth, david, drjones, jmattson, sean.j.christopherson

On 14/07/20 15:00, Claudio Imbrenda wrote:
> Two small patches to fix compilation issues on 32bit:
> 
> one for a typo in x86/cstart
> 
> one for a thinko in lib/alloc_page
> 
> notice that there is another patch for the lib/alloc_page issue floating
> around, this patch is an alternative to that one
> 
> v1->v2
> * use the z modifier for size_t variables, instead of casting to long
> 
> Claudio Imbrenda (2):
>   x86/cstart: Fix compilation issue in 32 bit mode
>   lib/alloc_page: Fix compilation issue on 32bit archs
> 
>  lib/alloc_page.c | 4 ++--
>  x86/cstart.S     | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 

Queued these, thanks.

Paolo


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

end of thread, other threads:[~2020-07-28 21:32 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-14 13:00 [kvm-unit-tests PATCH v2 0/2] Fix some compilation issues on 32bit Claudio Imbrenda
2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 1/2] x86/cstart: Fix compilation issue in 32 bit mode Claudio Imbrenda
2020-07-15 14:29   ` Claudio Imbrenda
2020-07-14 13:00 ` [kvm-unit-tests PATCH v2 2/2] lib/alloc_page: Fix compilation issue on 32bit archs Claudio Imbrenda
2020-07-15 14:19   ` Thomas Huth
2020-07-16  7:11   ` Nadav Amit
2020-07-16  9:55     ` Claudio Imbrenda
2020-07-28 21:25 ` [kvm-unit-tests PATCH v2 0/2] Fix some compilation issues on 32bit Paolo Bonzini

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).