[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAOQ_Qsi-50zLtq8nKeUN8wYKkiq9TkX9fcNHwzZ_F5JX0qJp-g@mail.gmail.com>
Date: Mon, 11 May 2020 10:04:29 -0700
From: Oliver Upton <oupton@...gle.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Peter Xu <peterx@...hat.com>, Paolo Bonzini <pbonzini@...hat.com>,
kvm list <kvm@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Tony Cook <tony-cook@...pond.com>, zoran.davidovac@...il.com,
euloanty@...e.com
Subject: Re: [PATCH] KVM: Fix a warning in __kvm_gfn_to_hva_cache_init()
On Mon, May 11, 2020 at 9:05 AM Sean Christopherson
<sean.j.christopherson@...el.com> wrote:
>
> +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".
Seems that doing absolutely nothing was the fix here :) See:
78a5255ffb6a ("Stop the ad-hoc games with -Wno-maybe-initialized")
--
Thanks,
Oliver
Powered by blists - more mailing lists