From: Sean Christopherson <sean.j.christopherson@intel.com>
To: Peter Xu <peterx@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Oliver Upton <oupton@google.com>,
Tony Cook <tony-cook@bigpond.com>,
zoran.davidovac@gmail.com, euloanty@live.com
Subject: Re: [PATCH] KVM: Fix a warning in __kvm_gfn_to_hva_cache_init()
Date: Mon, 11 May 2020 09:05:37 -0700 [thread overview]
Message-ID: <20200511160537.GC24052@linux.intel.com> (raw)
In-Reply-To: <20200505141245.GH6299@xz-x1>
+cc a few other people that have reported this at one time or another.
On Tue, May 05, 2020 at 10:12:45AM -0400, Peter Xu wrote:
> On Mon, May 04, 2020 at 06:39:29PM -0700, Sean Christopherson wrote:
> > On Mon, May 04, 2020 at 03:05:26PM -0400, Peter Xu wrote:
> > > GCC 10.0.1 gives me this warning when building KVM:
> > >
> > > warning: ‘nr_pages_avail’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> > > 2442 | for ( ; start_gfn <= end_gfn; start_gfn += nr_pages_avail) {
> > >
> > > It should not happen, but silent it.
> >
> > Heh, third times a charm? This has been reported and proposed twice
> > before[1][2]. Are you using any custom compiler flags? E.g. -O3 is known
> > to cause false positives with -Wmaybe-uninitialized.
>
> No, what I did was only upgrading to Fedora 32 (which will auto-upgrade GCC),
> so it should be using the default params of whatever provided.
>
> >
> > If we do end up killing this warning, I'd still prefer to use
> > uninitialized_var() over zero-initializing the variable.
> >
> > [1] https://lkml.kernel.org/r/20200218184756.242904-1-oupton@google.com
> > [2] https://bugzilla.kernel.org/show_bug.cgi?id=207173
>
> OK, I didn't know this is a known problem and discussions going on. But I
> guess it would be good to address this sooner because it could become a common
> warning very soon after people upgrades gcc.
Ya, others are hitting this as well. It's especially painful with the
existence of KVM_WERROR.
Paolo, any preference on how to resolve this? It would appear GCC 10 got
"smarter".
next prev parent reply other threads:[~2020-05-11 16:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 19:05 [PATCH] KVM: Fix a warning in __kvm_gfn_to_hva_cache_init() Peter Xu
2020-05-04 23:20 ` Gavin Shan
2020-05-05 1:39 ` Sean Christopherson
2020-05-05 14:12 ` Peter Xu
2020-05-11 16:05 ` Sean Christopherson [this message]
2020-05-11 17:04 ` Oliver Upton
2020-05-11 17:10 ` Sean Christopherson
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=20200511160537.GC24052@linux.intel.com \
--to=sean.j.christopherson@intel.com \
--cc=euloanty@live.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oupton@google.com \
--cc=pbonzini@redhat.com \
--cc=peterx@redhat.com \
--cc=tony-cook@bigpond.com \
--cc=zoran.davidovac@gmail.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;
as well as URLs for NNTP newsgroup(s).