* [PATCH] x86/resctrl: Fix 'uninitialized symbol' build warning
@ 2021-08-20 16:33 Babu Moger
2021-08-20 16:37 ` Reinette Chatre
2021-08-20 16:40 ` Wei Huang
0 siblings, 2 replies; 4+ messages in thread
From: Babu Moger @ 2021-08-20 16:33 UTC (permalink / raw)
To: tglx, mingo, bp
Cc: fenghua.yu, Terry.Bowman, x86, linux-kernel, hpa, reinette.chatre
The recent commit 064855a69003 ("x86/resctrl: Fix default monitoring
groups reporting"), caused a RHEL8.5 build failure with an uninitialized
variable warning treated as an error. The commit removed the default case
snippet. The RHEL8.5 Makefile uses '-Werror=maybe-uninitialized' to force
uninitialized variable warnings to be treated as errors. This is also
reported by kernel test robot. The error from the RHEL8.5 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 upstream Makefile does not build using '-Werror=maybe-uninitialized'.
So, the problem is not seen there. Fix the problem by putting back the
default case snippet.
Fixes: 064855a69003 ("x86/resctrl: Fix default monitoring groups reporting")
Cc: stable@vger.kernel.org
Reported-by: Terry Bowman <Terry.Bowman@amd.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/lkml/6118d218.4ZZRXYKZCzQSq1Km%25lkp@intel.com/
Signed-off-by: Babu Moger <babu.moger@amd.com>
---
arch/x86/kernel/cpu/resctrl/monitor.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
index 57e4bb695ff9..8caf871b796f 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) {
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/resctrl: Fix 'uninitialized symbol' build warning
2021-08-20 16:33 [PATCH] x86/resctrl: Fix 'uninitialized symbol' build warning Babu Moger
@ 2021-08-20 16:37 ` Reinette Chatre
2021-08-20 16:40 ` Wei Huang
1 sibling, 0 replies; 4+ messages in thread
From: Reinette Chatre @ 2021-08-20 16:37 UTC (permalink / raw)
To: Babu Moger, tglx, mingo, bp
Cc: fenghua.yu, Terry.Bowman, x86, linux-kernel, hpa
On 8/20/2021 9:33 AM, Babu Moger wrote:
> The recent commit 064855a69003 ("x86/resctrl: Fix default monitoring
> groups reporting"), caused a RHEL8.5 build failure with an uninitialized
> variable warning treated as an error. The commit removed the default case
> snippet. The RHEL8.5 Makefile uses '-Werror=maybe-uninitialized' to force
> uninitialized variable warnings to be treated as errors. This is also
> reported by kernel test robot. The error from the RHEL8.5 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 upstream Makefile does not build using '-Werror=maybe-uninitialized'.
> So, the problem is not seen there. Fix the problem by putting back the
> default case snippet.
>
> Fixes: 064855a69003 ("x86/resctrl: Fix default monitoring groups reporting")
> Cc: stable@vger.kernel.org
> Reported-by: Terry Bowman <Terry.Bowman@amd.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/lkml/6118d218.4ZZRXYKZCzQSq1Km%25lkp@intel.com/
>
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> arch/x86/kernel/cpu/resctrl/monitor.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 57e4bb695ff9..8caf871b796f 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) {
>
Thank you very much Babu.
Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
Reinette
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/resctrl: Fix 'uninitialized symbol' build warning
2021-08-20 16:33 [PATCH] x86/resctrl: Fix 'uninitialized symbol' build warning Babu Moger
2021-08-20 16:37 ` Reinette Chatre
@ 2021-08-20 16:40 ` Wei Huang
2021-08-20 18:58 ` Babu Moger
1 sibling, 1 reply; 4+ messages in thread
From: Wei Huang @ 2021-08-20 16:40 UTC (permalink / raw)
To: Babu Moger, tglx, mingo, bp
Cc: fenghua.yu, Terry.Bowman, x86, linux-kernel, hpa, reinette.chatre
On 8/20/21 11:33 AM, Babu Moger wrote:
> The recent commit 064855a69003 ("x86/resctrl: Fix default monitoring
> groups reporting"), caused a RHEL8.5 build failure with an uninitialized
Don't mention RHEL in the commit message, just use "commercial Linux
distro".
> variable warning treated as an error. The commit removed the default case
> snippet. The RHEL8.5 Makefile uses '-Werror=maybe-uninitialized' to force
Ditto
> uninitialized variable warnings to be treated as errors. This is also
> reported by kernel test robot. The error from the RHEL8.5 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 upstream Makefile does not build using '-Werror=maybe-uninitialized'.
> So, the problem is not seen there. Fix the problem by putting back the
> default case snippet.
>
> Fixes: 064855a69003 ("x86/resctrl: Fix default monitoring groups reporting")
> Cc: stable@vger.kernel.org
> Reported-by: Terry Bowman <Terry.Bowman@amd.com>
> Reported-by: kernel test robot <lkp@intel.com>
> Link: https://lore.kernel.org/lkml/6118d218.4ZZRXYKZCzQSq1Km%25lkp@intel.com/
>
> Signed-off-by: Babu Moger <babu.moger@amd.com>
> ---
> arch/x86/kernel/cpu/resctrl/monitor.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
> index 57e4bb695ff9..8caf871b796f 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;
> }
It used to return -EINVAL, you might want to do the same?
>
> if (rr->first) {
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] x86/resctrl: Fix 'uninitialized symbol' build warning
2021-08-20 16:40 ` Wei Huang
@ 2021-08-20 18:58 ` Babu Moger
0 siblings, 0 replies; 4+ messages in thread
From: Babu Moger @ 2021-08-20 18:58 UTC (permalink / raw)
To: Wei Huang, tglx, mingo, bp
Cc: fenghua.yu, Terry.Bowman, x86, linux-kernel, hpa, reinette.chatre
On 8/20/21 11:40 AM, Wei Huang wrote:
>
>
> On 8/20/21 11:33 AM, Babu Moger wrote:
>> The recent commit 064855a69003 ("x86/resctrl: Fix default monitoring
>> groups reporting"), caused a RHEL8.5 build failure with an uninitialized
>
> Don't mention RHEL in the commit message, just use "commercial Linux
> distro".
Talked to Wei on this. I will replace RHEL8.5 with just RHEL.
>
>> variable warning treated as an error. The commit removed the default case
>> snippet. The RHEL8.5 Makefile uses '-Werror=maybe-uninitialized' to force
>
> Ditto
Same as above.
>
>> uninitialized variable warnings to be treated as errors. This is also
>> reported by kernel test robot. The error from the RHEL8.5 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 upstream Makefile does not build using '-Werror=maybe-uninitialized'.
>> So, the problem is not seen there. Fix the problem by putting back the
>> default case snippet.
>>
>> Fixes: 064855a69003 ("x86/resctrl: Fix default monitoring groups reporting")
>> Cc: stable@vger.kernel.org
>> Reported-by: Terry Bowman <Terry.Bowman@amd.com>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Link: https://lore.kernel.org/lkml/6118d218.4ZZRXYKZCzQSq1Km%25lkp@intel.com/
>>
>> Signed-off-by: Babu Moger <babu.moger@amd.com>
>> ---
>> arch/x86/kernel/cpu/resctrl/monitor.c | 6 ++++++
>> 1 file changed, 6 insertions(+)
>>
>> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c
>> index 57e4bb695ff9..8caf871b796f 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;
>> }
>
> It used to return -EINVAL, you might want to do the same?
No. The function prototype has changed a bit. We have to return
RMID_VAL_ERROR(u64).
Thanks
Babu
>
>>
>> if (rr->first) {
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-08-20 18:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-20 16:33 [PATCH] x86/resctrl: Fix 'uninitialized symbol' build warning Babu Moger
2021-08-20 16:37 ` Reinette Chatre
2021-08-20 16:40 ` Wei Huang
2021-08-20 18:58 ` Babu Moger
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.