public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Mark D Rustad <mark.d.rustad@intel.com>, gleb@kernel.org
Cc: jeffrey.t.kirsher@intel.com, kvm@vger.kernel.org
Subject: Re: [PATCH V2 1/4] x86/kvm: Resolve some missing-initializers warnings
Date: Thu, 31 Jul 2014 13:50:37 +0200	[thread overview]
Message-ID: <53DA2D8D.9070903@redhat.com> (raw)
In-Reply-To: <20140730211845.127128.56203.stgit@mdrustad-wks.jf.intel.com>

Il 30/07/2014 23:18, Mark D Rustad ha scritto:
> Resolve some missing-initializers warnings that appear in W=2
> builds. They are resolved by adding the name as a parameter to
> the macros and having the macro generate all four fields of the
> structure.
> 
> Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> 
> ---
> V2: Change macro to supply all four fields instead of using a
>     designated initializer. Also fix up the array terminator.
> ---
>  arch/x86/kvm/x86.c |   71 ++++++++++++++++++++++++++--------------------------
>  1 file changed, 36 insertions(+), 35 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index ef432f891d30..623aea52ceba 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -82,8 +82,9 @@ u64 __read_mostly efer_reserved_bits = ~((u64)(EFER_SCE | EFER_LME | EFER_LMA));
>  static u64 __read_mostly efer_reserved_bits = ~((u64)EFER_SCE);
>  #endif
>  
> -#define VM_STAT(x) offsetof(struct kvm, stat.x), KVM_STAT_VM
> -#define VCPU_STAT(x) offsetof(struct kvm_vcpu, stat.x), KVM_STAT_VCPU
> +#define VM_STAT(name, x) name, offsetof(struct kvm, stat.x), KVM_STAT_VM, NULL
> +#define VCPU_STAT(name, x) name, offsetof(struct kvm_vcpu, stat.x), \
> +			   KVM_STAT_VCPU, NULL
>  
>  static void update_cr8_intercept(struct kvm_vcpu *vcpu);
>  static void process_nmi(struct kvm_vcpu *vcpu);
> @@ -128,39 +129,39 @@ static struct kvm_shared_msrs_global __read_mostly shared_msrs_global;
>  static struct kvm_shared_msrs __percpu *shared_msrs;
>  
>  struct kvm_stats_debugfs_item debugfs_entries[] = {
> -	{ "pf_fixed", VCPU_STAT(pf_fixed) },
> -	{ "pf_guest", VCPU_STAT(pf_guest) },
> -	{ "tlb_flush", VCPU_STAT(tlb_flush) },
> -	{ "invlpg", VCPU_STAT(invlpg) },
> -	{ "exits", VCPU_STAT(exits) },
> -	{ "io_exits", VCPU_STAT(io_exits) },
> -	{ "mmio_exits", VCPU_STAT(mmio_exits) },
> -	{ "signal_exits", VCPU_STAT(signal_exits) },
> -	{ "irq_window", VCPU_STAT(irq_window_exits) },
> -	{ "nmi_window", VCPU_STAT(nmi_window_exits) },
> -	{ "halt_exits", VCPU_STAT(halt_exits) },
> -	{ "halt_wakeup", VCPU_STAT(halt_wakeup) },
> -	{ "hypercalls", VCPU_STAT(hypercalls) },
> -	{ "request_irq", VCPU_STAT(request_irq_exits) },
> -	{ "irq_exits", VCPU_STAT(irq_exits) },
> -	{ "host_state_reload", VCPU_STAT(host_state_reload) },
> -	{ "efer_reload", VCPU_STAT(efer_reload) },
> -	{ "fpu_reload", VCPU_STAT(fpu_reload) },
> -	{ "insn_emulation", VCPU_STAT(insn_emulation) },
> -	{ "insn_emulation_fail", VCPU_STAT(insn_emulation_fail) },
> -	{ "irq_injections", VCPU_STAT(irq_injections) },
> -	{ "nmi_injections", VCPU_STAT(nmi_injections) },
> -	{ "mmu_shadow_zapped", VM_STAT(mmu_shadow_zapped) },
> -	{ "mmu_pte_write", VM_STAT(mmu_pte_write) },
> -	{ "mmu_pte_updated", VM_STAT(mmu_pte_updated) },
> -	{ "mmu_pde_zapped", VM_STAT(mmu_pde_zapped) },
> -	{ "mmu_flooded", VM_STAT(mmu_flooded) },
> -	{ "mmu_recycled", VM_STAT(mmu_recycled) },
> -	{ "mmu_cache_miss", VM_STAT(mmu_cache_miss) },
> -	{ "mmu_unsync", VM_STAT(mmu_unsync) },
> -	{ "remote_tlb_flush", VM_STAT(remote_tlb_flush) },
> -	{ "largepages", VM_STAT(lpages) },
> -	{ NULL }
> +	{ VCPU_STAT("pf_fixed", pf_fixed) },
> +	{ VCPU_STAT("pf_guest", pf_guest) },
> +	{ VCPU_STAT("tlb_flush", tlb_flush) },
> +	{ VCPU_STAT("invlpg", invlpg) },
> +	{ VCPU_STAT("exits", exits) },
> +	{ VCPU_STAT("io_exits", io_exits) },
> +	{ VCPU_STAT("mmio_exits", mmio_exits) },
> +	{ VCPU_STAT("signal_exits", signal_exits) },
> +	{ VCPU_STAT("irq_window", irq_window_exits) },
> +	{ VCPU_STAT("nmi_window", nmi_window_exits) },
> +	{ VCPU_STAT("halt_exits", halt_exits) },
> +	{ VCPU_STAT("halt_wakeup", halt_wakeup) },
> +	{ VCPU_STAT("hypercalls", hypercalls) },
> +	{ VCPU_STAT("request_irq", request_irq_exits) },
> +	{ VCPU_STAT("irq_exits", irq_exits) },
> +	{ VCPU_STAT("host_state_reload", host_state_reload) },
> +	{ VCPU_STAT("efer_reload", efer_reload) },
> +	{ VCPU_STAT("fpu_reload", fpu_reload) },
> +	{ VCPU_STAT("insn_emulation", insn_emulation) },
> +	{ VCPU_STAT("insn_emulation_fail", insn_emulation_fail) },
> +	{ VCPU_STAT("irq_injections", irq_injections) },
> +	{ VCPU_STAT("nmi_injections", nmi_injections) },
> +	{ VM_STAT("mmu_shadow_zapped", mmu_shadow_zapped) },
> +	{ VM_STAT("mmu_pte_write", mmu_pte_write) },
> +	{ VM_STAT("mmu_pte_updated", mmu_pte_updated) },
> +	{ VM_STAT("mmu_pde_zapped", mmu_pde_zapped) },
> +	{ VM_STAT("mmu_flooded", mmu_flooded) },
> +	{ VM_STAT("mmu_recycled", mmu_recycled) },
> +	{ VM_STAT("mmu_cache_miss", mmu_cache_miss) },
> +	{ VM_STAT("mmu_unsync", mmu_unsync) },
> +	{ VM_STAT("remote_tlb_flush", remote_tlb_flush) },
> +	{ VM_STAT("largepages", lpages) },

Please move the braces inside the macro as well.

> +	{ NULL, 0, 0, NULL }

This is ugly.  Do you really mind having one residual warning? :)

Paolo

>  };
>  
>  u64 __read_mostly host_xcr0;
> 


  reply	other threads:[~2014-07-31 11:51 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-25 13:27 [PATCH 1/4] x86/kvm: Resolve some missing-initializers warnings Jeff Kirsher
2014-07-25 13:27 ` [PATCH 2/4] kvm: Resolve missing-field-initializers warnings Jeff Kirsher
2014-07-25 14:06   ` Paolo Bonzini
2014-07-25 13:27 ` [PATCH 3/4] x86/kvm: Resolve shadow warnings in macro expansion Jeff Kirsher
2014-07-25 14:06   ` Paolo Bonzini
2014-07-25 17:18     ` Rustad, Mark D
2014-07-26  7:34       ` Paolo Bonzini
2014-07-30 21:19   ` [PATCH V2 " Mark D Rustad
2014-07-31 11:50     ` Paolo Bonzini
2014-07-31 16:59   ` [PATCH V3 " Mark D Rustad
2014-07-25 13:27 ` [PATCH 4/4] x86/kvm: Resolve shadow warning from min macro Jeff Kirsher
2014-07-25 14:06   ` Paolo Bonzini
2014-07-25 14:04 ` [PATCH 1/4] x86/kvm: Resolve some missing-initializers warnings Paolo Bonzini
2014-07-30 21:18 ` [PATCH V2 " Mark D Rustad
2014-07-31 11:50   ` Paolo Bonzini [this message]
2014-07-31 16:35     ` Rustad, Mark D
2014-07-31 16:50       ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53DA2D8D.9070903@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=gleb@kernel.org \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=mark.d.rustad@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox