linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build
@ 2024-07-23 10:12 Sebastian Ott
  2024-07-23 10:12 ` [PATCH v2 1/3] KVM: arm64: fix override-init warnings in W=1 builds Sebastian Ott
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Sebastian Ott @ 2024-07-23 10:12 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, linux-kernel
  Cc: Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose,
	Catalin Marinas, Will Deacon, Zenghui Yu, Mark Rutland

Building arch/arm64/kvm/ with W=1 spills out a lot of warnings. When
changing stuff I try to use as much tooling as possible to make sure
that I don't screw up - having a clean baseline imho helps with that.

With the first 2 patches applied make W=1 arch/arm64/kvm/ runs without
warnings for me (fedora userspace, upstream linux after kvm merge).
Patch 3 gets rid of sparse lock warnings in arch/arm64/kvm/vgic/.

Patch 1 now just adds -Wno-override-init to the cflags of the affected
files. Alternatives would be to add this to the whole subdir or
reintroduce the flag for higher warn levels..

Sebastian Ott (3):
  KVM: arm64: fix override-init warnings in W=1 builds
  KVM: arm64: fix kdoc warnings in W=1 builds
  KVM: arm64: vgic: fix unexpected unlock sparse warnings

 arch/arm64/kvm/Makefile          |  3 +++
 arch/arm64/kvm/arm.c             |  1 +
 arch/arm64/kvm/hyp/nvhe/Makefile |  2 ++
 arch/arm64/kvm/hyp/vhe/Makefile  |  2 ++
 arch/arm64/kvm/vgic/vgic-irqfd.c |  7 ++++---
 arch/arm64/kvm/vgic/vgic-its.c   | 18 +++++++++++-------
 arch/arm64/kvm/vgic/vgic-v3.c    |  2 +-
 arch/arm64/kvm/vgic/vgic.c       |  2 +-
 arch/arm64/kvm/vgic/vgic.h       |  2 +-
 9 files changed, 26 insertions(+), 13 deletions(-)

-- 
2.42.0



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

* [PATCH v2 1/3] KVM: arm64: fix override-init warnings in W=1 builds
  2024-07-23 10:12 [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build Sebastian Ott
@ 2024-07-23 10:12 ` Sebastian Ott
  2024-07-23 10:12 ` [PATCH v2 2/3] KVM: arm64: fix kdoc " Sebastian Ott
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Ott @ 2024-07-23 10:12 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, linux-kernel
  Cc: Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose,
	Catalin Marinas, Will Deacon, Zenghui Yu, Mark Rutland

Add -Wno-override-init to the build flags for sys_regs.c,
handle_exit.c, and switch.c to fix warnings like the following:

arch/arm64/kvm/hyp/vhe/switch.c:271:43: warning: initialized field overwritten [-Woverride-init]
  271 |         [ESR_ELx_EC_CP15_32]            = kvm_hyp_handle_cp15_32,
      |

Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
 arch/arm64/kvm/Makefile          | 3 +++
 arch/arm64/kvm/hyp/nvhe/Makefile | 2 ++
 arch/arm64/kvm/hyp/vhe/Makefile  | 2 ++
 3 files changed, 7 insertions(+)

diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
index a6497228c5a8..86a629aaf0a1 100644
--- a/arch/arm64/kvm/Makefile
+++ b/arch/arm64/kvm/Makefile
@@ -10,6 +10,9 @@ include $(srctree)/virt/kvm/Makefile.kvm
 obj-$(CONFIG_KVM) += kvm.o
 obj-$(CONFIG_KVM) += hyp/
 
+CFLAGS_sys_regs.o += -Wno-override-init
+CFLAGS_handle_exit.o += -Wno-override-init
+
 kvm-y += arm.o mmu.o mmio.o psci.o hypercalls.o pvtime.o \
 	 inject_fault.o va_layout.o handle_exit.o \
 	 guest.o debug.o reset.o sys_regs.o stacktrace.o \
diff --git a/arch/arm64/kvm/hyp/nvhe/Makefile b/arch/arm64/kvm/hyp/nvhe/Makefile
index 782b34b004be..b43426a493df 100644
--- a/arch/arm64/kvm/hyp/nvhe/Makefile
+++ b/arch/arm64/kvm/hyp/nvhe/Makefile
@@ -20,6 +20,8 @@ HOST_EXTRACFLAGS += -I$(objtree)/include
 lib-objs := clear_page.o copy_page.o memcpy.o memset.o
 lib-objs := $(addprefix ../../../lib/, $(lib-objs))
 
+CFLAGS_switch.nvhe.o += -Wno-override-init
+
 hyp-obj-y := timer-sr.o sysreg-sr.o debug-sr.o switch.o tlb.o hyp-init.o host.o \
 	 hyp-main.o hyp-smp.o psci-relay.o early_alloc.o page_alloc.o \
 	 cache.o setup.o mm.o mem_protect.o sys_regs.o pkvm.o stacktrace.o ffa.o
diff --git a/arch/arm64/kvm/hyp/vhe/Makefile b/arch/arm64/kvm/hyp/vhe/Makefile
index 3b9e5464b5b3..afc4aed9231a 100644
--- a/arch/arm64/kvm/hyp/vhe/Makefile
+++ b/arch/arm64/kvm/hyp/vhe/Makefile
@@ -6,6 +6,8 @@
 asflags-y := -D__KVM_VHE_HYPERVISOR__
 ccflags-y := -D__KVM_VHE_HYPERVISOR__
 
+CFLAGS_switch.o += -Wno-override-init
+
 obj-y := timer-sr.o sysreg-sr.o debug-sr.o switch.o tlb.o
 obj-y += ../vgic-v3-sr.o ../aarch32.o ../vgic-v2-cpuif-proxy.o ../entry.o \
 	 ../fpsimd.o ../hyp-entry.o ../exception.o
-- 
2.42.0



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

* [PATCH v2 2/3] KVM: arm64: fix kdoc warnings in W=1 builds
  2024-07-23 10:12 [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build Sebastian Ott
  2024-07-23 10:12 ` [PATCH v2 1/3] KVM: arm64: fix override-init warnings in W=1 builds Sebastian Ott
@ 2024-07-23 10:12 ` Sebastian Ott
  2024-07-23 10:12 ` [PATCH v2 3/3] KVM: arm64: vgic: fix unexpected unlock sparse warnings Sebastian Ott
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Ott @ 2024-07-23 10:12 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, linux-kernel
  Cc: Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose,
	Catalin Marinas, Will Deacon, Zenghui Yu, Mark Rutland

Fix kdoc warnings by adding missing function parameter
descriptions or by conversion to a normal comment.

Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
 arch/arm64/kvm/arm.c             |  1 +
 arch/arm64/kvm/vgic/vgic-irqfd.c |  7 ++++---
 arch/arm64/kvm/vgic/vgic-its.c   | 18 +++++++++++-------
 arch/arm64/kvm/vgic/vgic-v3.c    |  2 +-
 4 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c
index a7ca776b51ec..23e1fa56c02d 100644
--- a/arch/arm64/kvm/arm.c
+++ b/arch/arm64/kvm/arm.c
@@ -164,6 +164,7 @@ static int kvm_arm_default_max_vcpus(void)
 /**
  * kvm_arch_init_vm - initializes a VM data structure
  * @kvm:	pointer to the KVM struct
+ * @type:	kvm device type
  */
 int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 {
diff --git a/arch/arm64/kvm/vgic/vgic-irqfd.c b/arch/arm64/kvm/vgic/vgic-irqfd.c
index 8c711deb25aa..c314c016659a 100644
--- a/arch/arm64/kvm/vgic/vgic-irqfd.c
+++ b/arch/arm64/kvm/vgic/vgic-irqfd.c
@@ -9,7 +9,7 @@
 #include <kvm/arm_vgic.h>
 #include "vgic.h"
 
-/**
+/*
  * vgic_irqfd_set_irq: inject the IRQ corresponding to the
  * irqchip routing entry
  *
@@ -75,7 +75,8 @@ static void kvm_populate_msi(struct kvm_kernel_irq_routing_entry *e,
 	msi->flags = e->msi.flags;
 	msi->devid = e->msi.devid;
 }
-/**
+
+/*
  * kvm_set_msi: inject the MSI corresponding to the
  * MSI routing entry
  *
@@ -98,7 +99,7 @@ int kvm_set_msi(struct kvm_kernel_irq_routing_entry *e,
 	return vgic_its_inject_msi(kvm, &msi);
 }
 
-/**
+/*
  * kvm_arch_set_irq_inatomic: fast-path for irqfd injection
  */
 int kvm_arch_set_irq_inatomic(struct kvm_kernel_irq_routing_entry *e,
diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
index 40bb43f20bf3..ba945ba78cc7 100644
--- a/arch/arm64/kvm/vgic/vgic-its.c
+++ b/arch/arm64/kvm/vgic/vgic-its.c
@@ -2040,6 +2040,7 @@ typedef int (*entry_fn_t)(struct vgic_its *its, u32 id, void *entry,
  * @start_id: the ID of the first entry in the table
  * (non zero for 2d level tables)
  * @fn: function to apply on each entry
+ * @opaque: pointer to opaque data
  *
  * Return: < 0 on error, 0 if last element was identified, 1 otherwise
  * (the last element may not be found on second level tables)
@@ -2079,7 +2080,7 @@ static int scan_its_table(struct vgic_its *its, gpa_t base, int size, u32 esz,
 	return 1;
 }
 
-/**
+/*
  * vgic_its_save_ite - Save an interrupt translation entry at @gpa
  */
 static int vgic_its_save_ite(struct vgic_its *its, struct its_device *dev,
@@ -2099,6 +2100,8 @@ static int vgic_its_save_ite(struct vgic_its *its, struct its_device *dev,
 
 /**
  * vgic_its_restore_ite - restore an interrupt translation entry
+ *
+ * @its: its handle
  * @event_id: id used for indexing
  * @ptr: pointer to the ITE entry
  * @opaque: pointer to the its_device
@@ -2231,6 +2234,7 @@ static int vgic_its_restore_itt(struct vgic_its *its, struct its_device *dev)
  * @its: ITS handle
  * @dev: ITS device
  * @ptr: GPA
+ * @dte_esz: device table entry size
  */
 static int vgic_its_save_dte(struct vgic_its *its, struct its_device *dev,
 			     gpa_t ptr, int dte_esz)
@@ -2313,7 +2317,7 @@ static int vgic_its_device_cmp(void *priv, const struct list_head *a,
 		return 1;
 }
 
-/**
+/*
  * vgic_its_save_device_tables - Save the device table and all ITT
  * into guest RAM
  *
@@ -2386,7 +2390,7 @@ static int handle_l1_dte(struct vgic_its *its, u32 id, void *addr,
 	return ret;
 }
 
-/**
+/*
  * vgic_its_restore_device_tables - Restore the device table and all ITT
  * from guest RAM to internal data structs
  */
@@ -2478,7 +2482,7 @@ static int vgic_its_restore_cte(struct vgic_its *its, gpa_t gpa, int esz)
 	return 1;
 }
 
-/**
+/*
  * vgic_its_save_collection_table - Save the collection table into
  * guest RAM
  */
@@ -2518,7 +2522,7 @@ static int vgic_its_save_collection_table(struct vgic_its *its)
 	return ret;
 }
 
-/**
+/*
  * vgic_its_restore_collection_table - reads the collection table
  * in guest memory and restores the ITS internal state. Requires the
  * BASER registers to be restored before.
@@ -2556,7 +2560,7 @@ static int vgic_its_restore_collection_table(struct vgic_its *its)
 	return ret;
 }
 
-/**
+/*
  * vgic_its_save_tables_v0 - Save the ITS tables into guest ARM
  * according to v0 ABI
  */
@@ -2571,7 +2575,7 @@ static int vgic_its_save_tables_v0(struct vgic_its *its)
 	return vgic_its_save_collection_table(its);
 }
 
-/**
+/*
  * vgic_its_restore_tables_v0 - Restore the ITS tables from guest RAM
  * to internal data structs according to V0 ABI
  *
diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c
index ed6e412cd74b..3eecdd2f4b8f 100644
--- a/arch/arm64/kvm/vgic/vgic-v3.c
+++ b/arch/arm64/kvm/vgic/vgic-v3.c
@@ -370,7 +370,7 @@ static void map_all_vpes(struct kvm *kvm)
 						dist->its_vm.vpes[i]->irq));
 }
 
-/**
+/*
  * vgic_v3_save_pending_tables - Save the pending tables into guest RAM
  * kvm lock and all vcpu lock must be held
  */
-- 
2.42.0



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

* [PATCH v2 3/3] KVM: arm64: vgic: fix unexpected unlock sparse warnings
  2024-07-23 10:12 [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build Sebastian Ott
  2024-07-23 10:12 ` [PATCH v2 1/3] KVM: arm64: fix override-init warnings in W=1 builds Sebastian Ott
  2024-07-23 10:12 ` [PATCH v2 2/3] KVM: arm64: fix kdoc " Sebastian Ott
@ 2024-07-23 10:12 ` Sebastian Ott
  2024-07-23 17:04 ` [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build Marc Zyngier
  2024-08-05 22:12 ` Oliver Upton
  4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Ott @ 2024-07-23 10:12 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, linux-kernel
  Cc: Marc Zyngier, Oliver Upton, James Morse, Suzuki K Poulose,
	Catalin Marinas, Will Deacon, Zenghui Yu, Mark Rutland

Get rid of unexpected unlock sparse warnings in vgic code
by adding an annotation to vgic_queue_irq_unlock().

arch/arm64/kvm/vgic/vgic.c:334:17: warning: context imbalance in 'vgic_queue_irq_unlock' - unexpected unlock
arch/arm64/kvm/vgic/vgic.c:419:5: warning: context imbalance in 'kvm_vgic_inject_irq' - different lock contexts for basic block

Signed-off-by: Sebastian Ott <sebott@redhat.com>
---
 arch/arm64/kvm/vgic/vgic.c | 2 +-
 arch/arm64/kvm/vgic/vgic.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
index f07b3ddff7d4..974849ea7101 100644
--- a/arch/arm64/kvm/vgic/vgic.c
+++ b/arch/arm64/kvm/vgic/vgic.c
@@ -313,7 +313,7 @@ static bool vgic_validate_injection(struct vgic_irq *irq, bool level, void *owne
  * with all locks dropped.
  */
 bool vgic_queue_irq_unlock(struct kvm *kvm, struct vgic_irq *irq,
-			   unsigned long flags)
+			   unsigned long flags) __releases(&irq->irq_lock)
 {
 	struct kvm_vcpu *vcpu;
 
diff --git a/arch/arm64/kvm/vgic/vgic.h b/arch/arm64/kvm/vgic/vgic.h
index 03d356a12377..ba8f790431bd 100644
--- a/arch/arm64/kvm/vgic/vgic.h
+++ b/arch/arm64/kvm/vgic/vgic.h
@@ -186,7 +186,7 @@ bool vgic_get_phys_line_level(struct vgic_irq *irq);
 void vgic_irq_set_phys_pending(struct vgic_irq *irq, bool pending);
 void vgic_irq_set_phys_active(struct vgic_irq *irq, bool active);
 bool vgic_queue_irq_unlock(struct kvm *kvm, struct vgic_irq *irq,
-			   unsigned long flags);
+			   unsigned long flags) __releases(&irq->irq_lock);
 void vgic_kick_vcpus(struct kvm *kvm);
 void vgic_irq_handle_resampling(struct vgic_irq *irq,
 				bool lr_deactivated, bool lr_pending);
-- 
2.42.0



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

* Re: [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build
  2024-07-23 10:12 [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build Sebastian Ott
                   ` (2 preceding siblings ...)
  2024-07-23 10:12 ` [PATCH v2 3/3] KVM: arm64: vgic: fix unexpected unlock sparse warnings Sebastian Ott
@ 2024-07-23 17:04 ` Marc Zyngier
  2024-08-05 22:12 ` Oliver Upton
  4 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2024-07-23 17:04 UTC (permalink / raw)
  To: Sebastian Ott
  Cc: linux-arm-kernel, kvmarm, linux-kernel, Oliver Upton, James Morse,
	Suzuki K Poulose, Catalin Marinas, Will Deacon, Zenghui Yu,
	Mark Rutland

On Tue, 23 Jul 2024 11:12:01 +0100,
Sebastian Ott <sebott@redhat.com> wrote:
> 
> Building arch/arm64/kvm/ with W=1 spills out a lot of warnings. When
> changing stuff I try to use as much tooling as possible to make sure
> that I don't screw up - having a clean baseline imho helps with that.
> 
> With the first 2 patches applied make W=1 arch/arm64/kvm/ runs without
> warnings for me (fedora userspace, upstream linux after kvm merge).
> Patch 3 gets rid of sparse lock warnings in arch/arm64/kvm/vgic/.
> 
> Patch 1 now just adds -Wno-override-init to the cflags of the affected
> files. Alternatives would be to add this to the whole subdir or
> reintroduce the flag for higher warn levels..
> 
> Sebastian Ott (3):
>   KVM: arm64: fix override-init warnings in W=1 builds
>   KVM: arm64: fix kdoc warnings in W=1 builds
>   KVM: arm64: vgic: fix unexpected unlock sparse warnings
> 
>  arch/arm64/kvm/Makefile          |  3 +++
>  arch/arm64/kvm/arm.c             |  1 +
>  arch/arm64/kvm/hyp/nvhe/Makefile |  2 ++
>  arch/arm64/kvm/hyp/vhe/Makefile  |  2 ++
>  arch/arm64/kvm/vgic/vgic-irqfd.c |  7 ++++---
>  arch/arm64/kvm/vgic/vgic-its.c   | 18 +++++++++++-------
>  arch/arm64/kvm/vgic/vgic-v3.c    |  2 +-
>  arch/arm64/kvm/vgic/vgic.c       |  2 +-
>  arch/arm64/kvm/vgic/vgic.h       |  2 +-
>  9 files changed, 26 insertions(+), 13 deletions(-)

For the series, and assuming we take this in 6.11::

Reviewed-by: Marc Zyngier <maz@kernel.org>

	M.

-- 
Without deviation from the norm, progress is not possible.


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

* Re: [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build
  2024-07-23 10:12 [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build Sebastian Ott
                   ` (3 preceding siblings ...)
  2024-07-23 17:04 ` [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build Marc Zyngier
@ 2024-08-05 22:12 ` Oliver Upton
  4 siblings, 0 replies; 6+ messages in thread
From: Oliver Upton @ 2024-08-05 22:12 UTC (permalink / raw)
  To: linux-arm-kernel, kvmarm, linux-kernel, Sebastian Ott
  Cc: Oliver Upton, Catalin Marinas, James Morse, Suzuki K Poulose,
	Zenghui Yu, Marc Zyngier, Will Deacon, Mark Rutland

On Tue, 23 Jul 2024 12:12:01 +0200, Sebastian Ott wrote:
> Building arch/arm64/kvm/ with W=1 spills out a lot of warnings. When
> changing stuff I try to use as much tooling as possible to make sure
> that I don't screw up - having a clean baseline imho helps with that.
> 
> With the first 2 patches applied make W=1 arch/arm64/kvm/ runs without
> warnings for me (fedora userspace, upstream linux after kvm merge).
> Patch 3 gets rid of sparse lock warnings in arch/arm64/kvm/vgic/.
> 
> [...]

Applied to kvmarm/fixes, thanks!

[1/3] KVM: arm64: fix override-init warnings in W=1 builds
      https://git.kernel.org/kvmarm/kvmarm/c/963a08e586bd
[2/3] KVM: arm64: fix kdoc warnings in W=1 builds
      https://git.kernel.org/kvmarm/kvmarm/c/0aa34b37a78d
[3/3] KVM: arm64: vgic: fix unexpected unlock sparse warnings
      https://git.kernel.org/kvmarm/kvmarm/c/19d837bc881b

--
Best,
Oliver


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

end of thread, other threads:[~2024-08-05 22:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-23 10:12 [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build Sebastian Ott
2024-07-23 10:12 ` [PATCH v2 1/3] KVM: arm64: fix override-init warnings in W=1 builds Sebastian Ott
2024-07-23 10:12 ` [PATCH v2 2/3] KVM: arm64: fix kdoc " Sebastian Ott
2024-07-23 10:12 ` [PATCH v2 3/3] KVM: arm64: vgic: fix unexpected unlock sparse warnings Sebastian Ott
2024-07-23 17:04 ` [PATCH v2 0/3] KVM: arm64: fix warnings in W=1 build Marc Zyngier
2024-08-05 22:12 ` Oliver Upton

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