KVM: arm64: fix warnings in W=1 build
v2 cover KVM: arm64: fix warnings in W=1 build
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(-)
Signature · 1 line
2.42.0
PATCH v2 1/3 KVM: arm64: fix override-init warnings in W=1 builds
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,
|
--- arch/arm64/kvm/Makefile | 3 +++ arch/arm64/kvm/hyp/nvhe/Makefile | 2 ++ arch/arm64/kvm/hyp/vhe/Makefile | 2 ++ 3 files changed, 7 insertions(+)
arch/arm64/kvm/Makefile +3 -0
@@ -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 \
arch/arm64/kvm/hyp/nvhe/Makefile +2 -0
@@ -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
arch/arm64/kvm/hyp/vhe/Makefile +2 -0
@@ -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
Signature · 1 line
2.42.0
PATCH v2 2/3 KVM: arm64: fix kdoc warnings in W=1 builds
In reply to Sebastian OttFix kdoc warnings by adding missing function parameter descriptions or by conversion to a normal comment.
--- 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(-)
arch/arm64/kvm/arm.c +1 -0
@@ -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) {
arch/arm64/kvm/vgic/vgic-irqfd.c +4 -3
@@ -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,
arch/arm64/kvm/vgic/vgic-its.c +11 -7
@@ -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 *
arch/arm64/kvm/vgic/vgic-v3.c +1 -1
@@ -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 */
Signature · 1 line
2.42.0
PATCH v2 3/3 KVM: arm64: vgic: fix unexpected unlock sparse warnings
In reply to Sebastian OttGet 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
--- arch/arm64/kvm/vgic/vgic.c | 2 +- arch/arm64/kvm/vgic/vgic.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kvm/vgic/vgic.c +1 -1
@@ -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;
arch/arm64/kvm/vgic/vgic.h +1 -1
@@ -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);
Signature · 1 line
2.42.0
Quoted 18 lines · Sebastian Ott
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 inarch/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
Quoted 10 lines
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::
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
Oliver Upton
AppliedQuoted 9 lines · Sebastian Ott
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 inarch/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