public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
@ 2025-09-23  5:32 Dan Carpenter
  2025-09-23  7:55 ` Ilkka Koskinen
  0 siblings, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2025-09-23  5:32 UTC (permalink / raw)
  To: oe-kbuild, Ilkka Koskinen
  Cc: lkp, oe-kbuild-all, linux-arm-kernel, Will Deacon

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/perf
head:   6d2f913fda5683fbd4c3580262e10386c1263dfb
commit: 71396cfac97d0249fa7d8dcc8e649b6ba4c090e4 [5/28] perf/dwc_pcie: Support counting multiple lane events in parallel
config: sparc64-randconfig-r072-20250922 (https://download.01.org/0day-ci/archive/20250923/202509231223.gZsX6Eio-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.5.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202509231223.gZsX6Eio-lkp@intel.com/

smatch warnings:
drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.

vim +/time_event +418 drivers/perf/dwc_pcie_pmu.c

71396cfac97d02 Ilkka Koskinen 2025-08-28  401  static int dwc_pcie_pmu_validate_group(struct perf_event *event)
71396cfac97d02 Ilkka Koskinen 2025-08-28  402  {
71396cfac97d02 Ilkka Koskinen 2025-08-28  403  	struct perf_event *sibling, *leader = event->group_leader;
71396cfac97d02 Ilkka Koskinen 2025-08-28  404  	DECLARE_BITMAP(val_lane_events, 2 * DWC_PCIE_LANE_MAX_EVENTS_PER_GROUP);
71396cfac97d02 Ilkka Koskinen 2025-08-28  405  	bool time_event;
71396cfac97d02 Ilkka Koskinen 2025-08-28  406  	int type;
71396cfac97d02 Ilkka Koskinen 2025-08-28  407  
71396cfac97d02 Ilkka Koskinen 2025-08-28  408  	type = DWC_PCIE_EVENT_TYPE(leader);
71396cfac97d02 Ilkka Koskinen 2025-08-28  409  	if (type == DWC_PCIE_TIME_BASE_EVENT)
71396cfac97d02 Ilkka Koskinen 2025-08-28  410  		time_event = true;
71396cfac97d02 Ilkka Koskinen 2025-08-28  411  	else
71396cfac97d02 Ilkka Koskinen 2025-08-28  412  		if (dwc_pcie_pmu_validate_add_lane_event(leader, val_lane_events))
71396cfac97d02 Ilkka Koskinen 2025-08-28  413  			return -ENOSPC;
71396cfac97d02 Ilkka Koskinen 2025-08-28  414  
71396cfac97d02 Ilkka Koskinen 2025-08-28  415  	for_each_sibling_event(sibling, leader) {
71396cfac97d02 Ilkka Koskinen 2025-08-28  416  		type = DWC_PCIE_EVENT_TYPE(sibling);
71396cfac97d02 Ilkka Koskinen 2025-08-28  417  		if (type == DWC_PCIE_TIME_BASE_EVENT) {
71396cfac97d02 Ilkka Koskinen 2025-08-28 @418  			if (time_event)

time_event is never set to false.  I really encourage developers to
use CONFIG_INIT_STACK_ALL_PATTERN=y for testing.  (Use
CONFIG_INIT_STACK_ALL_ZERO for production obviously).

71396cfac97d02 Ilkka Koskinen 2025-08-28  419  				return -ENOSPC;
71396cfac97d02 Ilkka Koskinen 2025-08-28  420  
71396cfac97d02 Ilkka Koskinen 2025-08-28  421  			time_event = true;
71396cfac97d02 Ilkka Koskinen 2025-08-28  422  			continue;
71396cfac97d02 Ilkka Koskinen 2025-08-28  423  		}
71396cfac97d02 Ilkka Koskinen 2025-08-28  424  
71396cfac97d02 Ilkka Koskinen 2025-08-28  425  		if (dwc_pcie_pmu_validate_add_lane_event(sibling, val_lane_events))
71396cfac97d02 Ilkka Koskinen 2025-08-28  426  			return -ENOSPC;
71396cfac97d02 Ilkka Koskinen 2025-08-28  427  	}
71396cfac97d02 Ilkka Koskinen 2025-08-28  428  
71396cfac97d02 Ilkka Koskinen 2025-08-28  429  	return 0;
71396cfac97d02 Ilkka Koskinen 2025-08-28  430  }

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
  2025-09-23  5:32 [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event' Dan Carpenter
@ 2025-09-23  7:55 ` Ilkka Koskinen
  2025-09-23  8:27   ` Dan Carpenter
  2025-09-23  8:29   ` Will Deacon
  0 siblings, 2 replies; 7+ messages in thread
From: Ilkka Koskinen @ 2025-09-23  7:55 UTC (permalink / raw)
  To: Will Deacon, Dan Carpenter
  Cc: oe-kbuild, Ilkka Koskinen, lkp, oe-kbuild-all, linux-arm-kernel



Hi Will,

That's cleary a bug and I don't know how I missed it.
I can submit a new version or a separate patch to fix it in the morning.
Which one do you prefer?

Cheers, Ilkka


On Tue, 23 Sep 2025, Dan Carpenter wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-next/perf
> head:   6d2f913fda5683fbd4c3580262e10386c1263dfb
> commit: 71396cfac97d0249fa7d8dcc8e649b6ba4c090e4 [5/28] perf/dwc_pcie: Support counting multiple lane events in parallel
> config: sparc64-randconfig-r072-20250922 (https://download.01.org/0day-ci/archive/20250923/202509231223.gZsX6Eio-lkp@intel.com/config)
> compiler: sparc64-linux-gcc (GCC) 12.5.0
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202509231223.gZsX6Eio-lkp@intel.com/
>
> smatch warnings:
> drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
>
> vim +/time_event +418 drivers/perf/dwc_pcie_pmu.c
>
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  401  static int dwc_pcie_pmu_validate_group(struct perf_event *event)
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  402  {
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  403  	struct perf_event *sibling, *leader = event->group_leader;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  404  	DECLARE_BITMAP(val_lane_events, 2 * DWC_PCIE_LANE_MAX_EVENTS_PER_GROUP);
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  405  	bool time_event;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  406  	int type;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  407
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  408  	type = DWC_PCIE_EVENT_TYPE(leader);
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  409  	if (type == DWC_PCIE_TIME_BASE_EVENT)
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  410  		time_event = true;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  411  	else
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  412  		if (dwc_pcie_pmu_validate_add_lane_event(leader, val_lane_events))
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  413  			return -ENOSPC;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  414
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  415  	for_each_sibling_event(sibling, leader) {
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  416  		type = DWC_PCIE_EVENT_TYPE(sibling);
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  417  		if (type == DWC_PCIE_TIME_BASE_EVENT) {
> 71396cfac97d02 Ilkka Koskinen 2025-08-28 @418  			if (time_event)
>
> time_event is never set to false.  I really encourage developers to
> use CONFIG_INIT_STACK_ALL_PATTERN=y for testing.  (Use
> CONFIG_INIT_STACK_ALL_ZERO for production obviously).
>
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  419  				return -ENOSPC;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  420
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  421  			time_event = true;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  422  			continue;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  423  		}
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  424
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  425  		if (dwc_pcie_pmu_validate_add_lane_event(sibling, val_lane_events))
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  426  			return -ENOSPC;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  427  	}
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  428
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  429  	return 0;
> 71396cfac97d02 Ilkka Koskinen 2025-08-28  430  }
>
> -- 
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
  2025-09-23  7:55 ` Ilkka Koskinen
@ 2025-09-23  8:27   ` Dan Carpenter
  2025-09-23  8:35     ` Will Deacon
  2025-09-23  8:29   ` Will Deacon
  1 sibling, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2025-09-23  8:27 UTC (permalink / raw)
  To: Ilkka Koskinen
  Cc: Will Deacon, oe-kbuild, lkp, oe-kbuild-all, linux-arm-kernel

On Tue, Sep 23, 2025 at 12:55:01AM -0700, Ilkka Koskinen wrote:
> 
> 
> Hi Will,
> 
> That's cleary a bug and I don't know how I missed it.

Because we disabled uninitialized variable warnings for GCC and because
everyone has CONFIG_INIT_STACK_ALL_ZERO set so it wouldn't show up in
testing either.

regards,
dan carpenter



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
  2025-09-23  7:55 ` Ilkka Koskinen
  2025-09-23  8:27   ` Dan Carpenter
@ 2025-09-23  8:29   ` Will Deacon
  1 sibling, 0 replies; 7+ messages in thread
From: Will Deacon @ 2025-09-23  8:29 UTC (permalink / raw)
  To: Ilkka Koskinen
  Cc: Dan Carpenter, oe-kbuild, lkp, oe-kbuild-all, linux-arm-kernel

On Tue, Sep 23, 2025 at 12:55:01AM -0700, Ilkka Koskinen wrote:
> That's cleary a bug and I don't know how I missed it.

Don't worry, these things happen. As Dan pointed out, it's hard to catch
this in practice anyway (and the robot is doing its job for us).

> I can submit a new version or a separate patch to fix it in the morning.
> Which one do you prefer?

Please just send fixes on top of for-next/perf, as that is a
non-rebasing branch.

Will


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
  2025-09-23  8:27   ` Dan Carpenter
@ 2025-09-23  8:35     ` Will Deacon
  2025-09-23  9:07       ` Will Deacon
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2025-09-23  8:35 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ilkka Koskinen, oe-kbuild, lkp, oe-kbuild-all, linux-arm-kernel

On Tue, Sep 23, 2025 at 11:27:21AM +0300, Dan Carpenter wrote:
> On Tue, Sep 23, 2025 at 12:55:01AM -0700, Ilkka Koskinen wrote:
> > That's cleary a bug and I don't know how I missed it.
> 
> Because we disabled uninitialized variable warnings for GCC and because
> everyone has CONFIG_INIT_STACK_ALL_ZERO set so it wouldn't show up in
> testing either.

The more annoying thing is that I run smatch on my tree before pushing
but somehow I didn't notice this. I'll run it again to see whether it
detected it in the first place...

Will


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
  2025-09-23  8:35     ` Will Deacon
@ 2025-09-23  9:07       ` Will Deacon
  2025-09-23 21:16         ` Ilkka Koskinen
  0 siblings, 1 reply; 7+ messages in thread
From: Will Deacon @ 2025-09-23  9:07 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Ilkka Koskinen, oe-kbuild, lkp, oe-kbuild-all, linux-arm-kernel

On Tue, Sep 23, 2025 at 09:35:18AM +0100, Will Deacon wrote:
> On Tue, Sep 23, 2025 at 11:27:21AM +0300, Dan Carpenter wrote:
> > On Tue, Sep 23, 2025 at 12:55:01AM -0700, Ilkka Koskinen wrote:
> > > That's cleary a bug and I don't know how I missed it.
> > 
> > Because we disabled uninitialized variable warnings for GCC and because
> > everyone has CONFIG_INIT_STACK_ALL_ZERO set so it wouldn't show up in
> > testing either.
> 
> The more annoying thing is that I run smatch on my tree before pushing
> but somehow I didn't notice this. I'll run it again to see whether it
> detected it in the first place...

bah, there it is:

+drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'. [smatch]

so not sure why I missed this. Maybe I used the wrong .config (this
driver isn't enabled in defconfig).

Will


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'.
  2025-09-23  9:07       ` Will Deacon
@ 2025-09-23 21:16         ` Ilkka Koskinen
  0 siblings, 0 replies; 7+ messages in thread
From: Ilkka Koskinen @ 2025-09-23 21:16 UTC (permalink / raw)
  To: Will Deacon
  Cc: Dan Carpenter, Ilkka Koskinen, oe-kbuild, lkp, oe-kbuild-all,
	linux-arm-kernel


On Tue, 23 Sep 2025, Will Deacon wrote:
> On Tue, Sep 23, 2025 at 09:35:18AM +0100, Will Deacon wrote:
>> On Tue, Sep 23, 2025 at 11:27:21AM +0300, Dan Carpenter wrote:
>>> On Tue, Sep 23, 2025 at 12:55:01AM -0700, Ilkka Koskinen wrote:
>>>> That's cleary a bug and I don't know how I missed it.
>>>
>>> Because we disabled uninitialized variable warnings for GCC and because
>>> everyone has CONFIG_INIT_STACK_ALL_ZERO set so it wouldn't show up in
>>> testing either.
>>
>> The more annoying thing is that I run smatch on my tree before pushing
>> but somehow I didn't notice this. I'll run it again to see whether it
>> detected it in the first place...
>
> bah, there it is:
>
> +drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event'. [smatch]
>
> so not sure why I missed this. Maybe I used the wrong .config (this
> driver isn't enabled in defconfig).
>
> Will

Interestingly, the gcc version I was using to doesn't raise a warning even 
if I have -Wmaybe-initialized set. It does warn though if I move the if 
line outside the loop.

Anyways, I'm glad Dan and the test bot caught the bug.

Cheers, Ilkka


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-09-23 21:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-23  5:32 [arm64:for-next/perf 5/28] drivers/perf/dwc_pcie_pmu.c:418 dwc_pcie_pmu_validate_group() error: uninitialized symbol 'time_event' Dan Carpenter
2025-09-23  7:55 ` Ilkka Koskinen
2025-09-23  8:27   ` Dan Carpenter
2025-09-23  8:35     ` Will Deacon
2025-09-23  9:07       ` Will Deacon
2025-09-23 21:16         ` Ilkka Koskinen
2025-09-23  8:29   ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox