LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Babu Moger <babu.moger@amd.com>
To: Borislav Petkov <bp@alien8.de>,
	Reinette Chatre <reinette.chatre@intel.com>
Cc: "Chen, Rong A" <rong.a.chen@intel.com>,
	kernel test robot <lkp@intel.com>, x86-ml <x86@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625
Date: Fri, 20 Aug 2021 09:16:28 -0500	[thread overview]
Message-ID: <20d8842e-197f-e413-2588-92652c1dcb47@amd.com> (raw)
In-Reply-To: <YR7HtVf3OzM7/3qj@zn.tnic>



On 8/19/21 4:05 PM, Borislav Petkov wrote:
> On Thu, Aug 19, 2021 at 01:39:46PM -0700, Reinette Chatre wrote:
>> I can confirm that the removed comment explains why m would be initialized
>> when used in the code that follows.
>>
>> How would you prefer to address this? We could add just the comment back in
>> support of future reports or perhaps by adding the default case back with
>> the same error that would be returned earlier when there is an invalid
>> EVENT_ID. Something like:
>>
>> ---8<---
>> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
>> b/arch/x86/kernel/cpu/resctrl/monitor.c
>> index 57e4bb695ff9..05b99e4d621c 100644
>> --- a/arch/x86/kernel/cpu/resctrl/monitor.c
>> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c
>> @@ -304,6 +304,12 @@ static u64 __mon_event_count(u32 rmid, struct rmid_read
>> *rr)
>>  	case QOS_L3_MBM_LOCAL_EVENT_ID:
>>  		m = &rr->d->mbm_local[rmid];
>>  		break;
>> +	default:
>> +		/*
>> +		 * Code would never reach here because
>> +		 * an invalid event id would fail the __rmid_read.
>> +		 */
>> +		return RMID_VAL_ERROR;
>>  	}
>>
>>  	if (rr->first) {
> 
> Right, I would normally not take a patch just to fix a tool because it
> cannot see it correctly.
> 
> But Babu has another use case which breaks the build so I guess that's
> serious enough to make an exception.
> 
> Babu, can you please explain?

Details:

The patch applies cleanly to RHEL8.5 tree but the build fails with an
uninitialized variable warning treated as an error. The RHEL8.5 Makefile
uses '-Werror=maybe-uninitialized' to force uninitialized variable
warnings to be treated as errors. The build error was found while using
the redhat/configs/kernel-x86_64.config kernel config. BTW, the 5.14-rc6
build passes and it does not build using '-Werror=maybe-uninitialized'.
The error from the build is below:

arch/x86/kernel/cpu/resctrl/monitor.c: In function ‘__mon_event_count’:
arch/x86/kernel/cpu/resctrl/monitor.c:261:12: error: ‘m’ may be used
uninitialized in this function [-Werror=maybe-uninitialized]
  m->chunks += chunks;
            ^~

The following patch fixes the problem.

diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c
b/arch/x86/kernel/cpu/resctrl/monitor.c
index 57e4bb695ff9..553cc6410442 100644
--- a/arch/x86/kernel/cpu/resctrl/monitor.c
+++ b/arch/x86/kernel/cpu/resctrl/monitor.c
@@ -304,6 +304,8 @@ static u64 __mon_event_count(u32 rmid, struct
rmid_read *rr)
        case QOS_L3_MBM_LOCAL_EVENT_ID:
                m = &rr->d->mbm_local[rmid];
                break;
+       default:
+               return RMID_VAL_ERROR;
        }

        if (rr->first) {


Reinette,
Are you going to send the official patch or let me know I will send. You
can add signoff from me after adding above details. We probably need Fixes
and Cc: stable@vger.kernel.org.

thanks
Babu

  reply	other threads:[~2021-08-20 14:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-15  8:36 kernel test robot
2021-08-15  8:42 ` Borislav Petkov
2021-08-15 10:22   ` Philip Li
2021-08-19  6:15   ` Chen, Rong A
2021-08-19  9:00     ` Borislav Petkov
2021-08-19 20:39       ` Reinette Chatre
2021-08-19 21:05         ` Borislav Petkov
2021-08-20 14:16           ` Babu Moger [this message]
2021-08-20 14:41             ` Reinette Chatre

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=20d8842e-197f-e413-2588-92652c1dcb47@amd.com \
    --to=babu.moger@amd.com \
    --cc=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=reinette.chatre@intel.com \
    --cc=rong.a.chen@intel.com \
    --cc=x86@kernel.org \
    --subject='Re: [tip:x86/urgent] BUILD SUCCESS WITH WARNING 064855a69003c24bd6b473b367d364e418c57625' \
    /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

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