* [PATCH] kvm: selftests: aarch64: compile with warnings on
@ 2019-05-23 9:40 Andrew Jones
2019-05-23 10:05 ` Thomas Huth
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Jones @ 2019-05-23 9:40 UTC (permalink / raw)
To: kvm; +Cc: pbonzini, rkrcmar, thuth
aarch64 fixups needed to compile with warnings as errors.
Signed-off-by: Andrew Jones <drjones@redhat.com>
---
tools/testing/selftests/kvm/lib/aarch64/processor.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tools/testing/selftests/kvm/lib/aarch64/processor.c b/tools/testing/selftests/kvm/lib/aarch64/processor.c
index e8c42506a09d..62b381a930ec 100644
--- a/tools/testing/selftests/kvm/lib/aarch64/processor.c
+++ b/tools/testing/selftests/kvm/lib/aarch64/processor.c
@@ -7,6 +7,8 @@
#define _GNU_SOURCE /* for program_invocation_name */
+#include <linux/compiler.h>
+
#include "kvm_util.h"
#include "../kvm_util_internal.h"
#include "processor.h"
@@ -67,15 +69,13 @@ static uint64_t ptrs_per_pgd(struct kvm_vm *vm)
return 1 << (vm->va_bits - shift);
}
-static uint64_t ptrs_per_pte(struct kvm_vm *vm)
+static uint64_t __maybe_unused ptrs_per_pte(struct kvm_vm *vm)
{
return 1 << (vm->page_shift - 3);
}
void virt_pgd_alloc(struct kvm_vm *vm, uint32_t pgd_memslot)
{
- int rc;
-
if (!vm->pgd_created) {
vm_paddr_t paddr = vm_phy_pages_alloc(vm,
page_align(vm, ptrs_per_pgd(vm) * 8) / vm->page_size,
@@ -181,6 +181,7 @@ vm_paddr_t addr_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
unmapped_gva:
TEST_ASSERT(false, "No mapping for vm virtual address, "
"gva: 0x%lx", gva);
+ return 0;
}
static void pte_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent, uint64_t page, int level)
@@ -312,6 +313,6 @@ void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent)
get_reg(vm, vcpuid, ARM64_CORE_REG(regs.pstate), &pstate);
get_reg(vm, vcpuid, ARM64_CORE_REG(regs.pc), &pc);
- fprintf(stream, "%*spstate: 0x%.16llx pc: 0x%.16llx\n",
+ fprintf(stream, "%*spstate: 0x%.16lx pc: 0x%.16lx\n",
indent, "", pstate, pc);
}
--
2.18.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm: selftests: aarch64: compile with warnings on
2019-05-23 9:40 [PATCH] kvm: selftests: aarch64: compile with warnings on Andrew Jones
@ 2019-05-23 10:05 ` Thomas Huth
2019-05-23 10:11 ` Andrew Jones
0 siblings, 1 reply; 3+ messages in thread
From: Thomas Huth @ 2019-05-23 10:05 UTC (permalink / raw)
To: Andrew Jones, kvm; +Cc: pbonzini, rkrcmar
On 23/05/2019 11.40, Andrew Jones wrote:
> aarch64 fixups needed to compile with warnings as errors.
>
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
> tools/testing/selftests/kvm/lib/aarch64/processor.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/tools/testing/selftests/kvm/lib/aarch64/processor.c b/tools/testing/selftests/kvm/lib/aarch64/processor.c
> index e8c42506a09d..62b381a930ec 100644
> --- a/tools/testing/selftests/kvm/lib/aarch64/processor.c
> +++ b/tools/testing/selftests/kvm/lib/aarch64/processor.c
> @@ -7,6 +7,8 @@
>
> #define _GNU_SOURCE /* for program_invocation_name */
>
> +#include <linux/compiler.h>
> +
> #include "kvm_util.h"
> #include "../kvm_util_internal.h"
> #include "processor.h"
> @@ -67,15 +69,13 @@ static uint64_t ptrs_per_pgd(struct kvm_vm *vm)
> return 1 << (vm->va_bits - shift);
> }
>
> -static uint64_t ptrs_per_pte(struct kvm_vm *vm)
> +static uint64_t __maybe_unused ptrs_per_pte(struct kvm_vm *vm)
> {
> return 1 << (vm->page_shift - 3);
> }
You could also wrap the function with "#ifdef DEBUG_VM" ?
> void virt_pgd_alloc(struct kvm_vm *vm, uint32_t pgd_memslot)
> {
> - int rc;
> -
> if (!vm->pgd_created) {
> vm_paddr_t paddr = vm_phy_pages_alloc(vm,
> page_align(vm, ptrs_per_pgd(vm) * 8) / vm->page_size,
> @@ -181,6 +181,7 @@ vm_paddr_t addr_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
> unmapped_gva:
> TEST_ASSERT(false, "No mapping for vm virtual address, "
> "gva: 0x%lx", gva);
> + return 0;
I'd rather use exit(1).
> }
>
> static void pte_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent, uint64_t page, int level)
> @@ -312,6 +313,6 @@ void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent)
> get_reg(vm, vcpuid, ARM64_CORE_REG(regs.pstate), &pstate);
> get_reg(vm, vcpuid, ARM64_CORE_REG(regs.pc), &pc);
>
> - fprintf(stream, "%*spstate: 0x%.16llx pc: 0x%.16llx\n",
> + fprintf(stream, "%*spstate: 0x%.16lx pc: 0x%.16lx\n",
> indent, "", pstate, pc);
> }
>
My comments were just suggestions / a matter of taste, so anyway:
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kvm: selftests: aarch64: compile with warnings on
2019-05-23 10:05 ` Thomas Huth
@ 2019-05-23 10:11 ` Andrew Jones
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Jones @ 2019-05-23 10:11 UTC (permalink / raw)
To: Thomas Huth; +Cc: kvm, pbonzini, rkrcmar
On Thu, May 23, 2019 at 12:05:00PM +0200, Thomas Huth wrote:
> On 23/05/2019 11.40, Andrew Jones wrote:
> > aarch64 fixups needed to compile with warnings as errors.
> >
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > ---
> > tools/testing/selftests/kvm/lib/aarch64/processor.c | 9 +++++----
> > 1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/testing/selftests/kvm/lib/aarch64/processor.c b/tools/testing/selftests/kvm/lib/aarch64/processor.c
> > index e8c42506a09d..62b381a930ec 100644
> > --- a/tools/testing/selftests/kvm/lib/aarch64/processor.c
> > +++ b/tools/testing/selftests/kvm/lib/aarch64/processor.c
> > @@ -7,6 +7,8 @@
> >
> > #define _GNU_SOURCE /* for program_invocation_name */
> >
> > +#include <linux/compiler.h>
> > +
> > #include "kvm_util.h"
> > #include "../kvm_util_internal.h"
> > #include "processor.h"
> > @@ -67,15 +69,13 @@ static uint64_t ptrs_per_pgd(struct kvm_vm *vm)
> > return 1 << (vm->va_bits - shift);
> > }
> >
> > -static uint64_t ptrs_per_pte(struct kvm_vm *vm)
> > +static uint64_t __maybe_unused ptrs_per_pte(struct kvm_vm *vm)
> > {
> > return 1 << (vm->page_shift - 3);
> > }
>
> You could also wrap the function with "#ifdef DEBUG_VM" ?
I considered that first, but opted to go this way instead because
this helper isn't strictly for debug, which I felt the ifdef would
convey.
>
> > void virt_pgd_alloc(struct kvm_vm *vm, uint32_t pgd_memslot)
> > {
> > - int rc;
> > -
> > if (!vm->pgd_created) {
> > vm_paddr_t paddr = vm_phy_pages_alloc(vm,
> > page_align(vm, ptrs_per_pgd(vm) * 8) / vm->page_size,
> > @@ -181,6 +181,7 @@ vm_paddr_t addr_gva2gpa(struct kvm_vm *vm, vm_vaddr_t gva)
> > unmapped_gva:
> > TEST_ASSERT(false, "No mapping for vm virtual address, "
> > "gva: 0x%lx", gva);
> > + return 0;
>
> I'd rather use exit(1).
That's a good suggestion. I'll send a v2 with this and your r-b.
Thanks,
drew
>
> > }
> >
> > static void pte_dump(FILE *stream, struct kvm_vm *vm, uint8_t indent, uint64_t page, int level)
> > @@ -312,6 +313,6 @@ void vcpu_dump(FILE *stream, struct kvm_vm *vm, uint32_t vcpuid, uint8_t indent)
> > get_reg(vm, vcpuid, ARM64_CORE_REG(regs.pstate), &pstate);
> > get_reg(vm, vcpuid, ARM64_CORE_REG(regs.pc), &pc);
> >
> > - fprintf(stream, "%*spstate: 0x%.16llx pc: 0x%.16llx\n",
> > + fprintf(stream, "%*spstate: 0x%.16lx pc: 0x%.16lx\n",
> > indent, "", pstate, pc);
> > }
> >
>
> My comments were just suggestions / a matter of taste, so anyway:
>
> Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-23 10:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-23 9:40 [PATCH] kvm: selftests: aarch64: compile with warnings on Andrew Jones
2019-05-23 10:05 ` Thomas Huth
2019-05-23 10:11 ` Andrew Jones
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.