Skip to contentSkip to conversation

arm_pmu: Mark expected switch fall-through

PATCH In review Anders Roxell 4 participants 10 messages Jul 26, 2019 – Jul 30, 2019 Arm PMU profiling and debugging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm_pmu: Mark expected switch fall-through

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]
cpu_pm_pmu_setup(armpmu, cmd); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

 drivers/perf/arm_pmu.c | 1 +
 1 file changed, 1 insertion(+)
drivers/perf/arm_pmu.c +1 -0
index 2d06b8095a19..465a15705bab 100644
@@ -724,6 +724,7 @@ static int cpu_pm_pmu_notify(struct notifier_block *b, unsigned long cmd,
 		break;
 	case CPU_PM_EXIT:
 		cpu_pm_pmu_setup(armpmu, cmd);
+		/* Fall through */
 	case CPU_PM_ENTER_FAILED:
 		armpmu->start(armpmu);
 		break;
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 16 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   cpu_pm_pmu_setup(armpmu, cmd);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Quoted 7 lines

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

I agree, think that should be:

	case CPU_PM_EXIT:
	case CPU_PM_ENTER_FAILED:
		cpu_pm_pmu_setup(armpmu, cmd);
		armpmu->start(armpmu);
		break;

... so that we re-start the events before we start the PMU.

That would be a fix for commit:

da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier")

Thanks,
Mark.

Quoted 19 lines
 drivers/perf/arm_pmu.c | 1 +
 1 file changed, 1 insertion(+)
drivers/perf/arm_pmu.c +1 -0
index 2d06b8095a19..465a15705bab 100644
@@ -724,6 +724,7 @@ static int cpu_pm_pmu_notify(struct notifier_block *b, unsigned long cmd,
 		break;
 	case CPU_PM_EXIT:
 		cpu_pm_pmu_setup(armpmu, cmd);
+		/* Fall through */
 	case CPU_PM_ENTER_FAILED:
 		armpmu->start(armpmu);
 		break;
Signature · 1 line
2.20.1
maintainer
#2 lore raw
Quoted 33 lines · Mark Rutland
Quoted 16 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   cpu_pm_pmu_setup(armpmu, cmd);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Quoted 7 lines

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

I agree, think that should be:

	case CPU_PM_EXIT:
	case CPU_PM_ENTER_FAILED:
		cpu_pm_pmu_setup(armpmu, cmd);
		armpmu->start(armpmu);
		break;
Quoted 5 lines

... so that we re-start the events before we start the PMU.

That would be a fix for commit:

da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier")

Does seem about right, but I'd like Lorenzo's ack on this.

Will

#3 lore raw
In reply to Mark Rutland
Quoted 33 lines · Mark Rutland
Quoted 16 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   cpu_pm_pmu_setup(armpmu, cmd);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Quoted 7 lines

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

I agree, think that should be:

	case CPU_PM_EXIT:
	case CPU_PM_ENTER_FAILED:
		cpu_pm_pmu_setup(armpmu, cmd);
		armpmu->start(armpmu);
		break;
Quoted 5 lines

... so that we re-start the events before we start the PMU.

That would be a fix for commit:

da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier")

Yes that's correct, apologies. Probably we did not hit it because CPU PM notifier entry failures are a pretty rare event; regardless:

I can send the updated fix, just let me know.

Thanks,
Lorenzo

Quoted 22 lines

Thanks,
Mark.

Quoted 19 lines
 drivers/perf/arm_pmu.c | 1 +
 1 file changed, 1 insertion(+)
drivers/perf/arm_pmu.c +1 -0
index 2d06b8095a19..465a15705bab 100644
@@ -724,6 +724,7 @@ static int cpu_pm_pmu_notify(struct notifier_block *b, unsigned long cmd,
 		break;
 	case CPU_PM_EXIT:
 		cpu_pm_pmu_setup(armpmu, cmd);
+		/* Fall through */
 	case CPU_PM_ENTER_FAILED:
 		armpmu->start(armpmu);
 		break;
Signature · 1 line
2.20.1
maintainer Acked-by
#4 lore raw
Quoted 38 lines · Lorenzo Pieralisi
Quoted 37 lines · Mark Rutland
Quoted 16 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   cpu_pm_pmu_setup(armpmu, cmd);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Quoted 7 lines

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

I agree, think that should be:

	case CPU_PM_EXIT:
	case CPU_PM_ENTER_FAILED:
		cpu_pm_pmu_setup(armpmu, cmd);
		armpmu->start(armpmu);
		break;

... so that we re-start the events before we start the PMU.

That would be a fix for commit:

Quoted 8 lines
Quoted 1 line

da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier")

Yes that's correct, apologies. Probably we did not hit it because CPU PM notifier entry failures are a pretty rare event; regardless:

I can send the updated fix, just let me know.

I'm not sure what Will wants, but assuming you do so:

Thanks,
Mark.

maintainer
#5 lore raw
Quoted 44 lines · Mark Rutland
Quoted 43 lines · Lorenzo Pieralisi
Quoted 33 lines · Mark Rutland
Quoted 16 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   cpu_pm_pmu_setup(armpmu, cmd);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Quoted 7 lines

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

I agree, think that should be:

	case CPU_PM_EXIT:
	case CPU_PM_ENTER_FAILED:
		cpu_pm_pmu_setup(armpmu, cmd);
		armpmu->start(armpmu);
		break;
Quoted 5 lines

... so that we re-start the events before we start the PMU.

That would be a fix for commit:

da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier")

Yes that's correct, apologies. Probably we did not hit it because CPU PM notifier entry failures are a pretty rare event; regardless:

Quoted 7 lines
Quoted 3 lines

I can send the updated fix, just let me know.

I'm not sure what Will wants, but assuming you do so:

I gave up waiting, so it's already queued here:

https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?h=for-next/fixes&id=0d7fd70f26039bd4b33444ca47f0e69ce3ae0354

Will

maintainer
#6 lore raw
Quoted 49 lines · Will Deacon
Quoted 48 lines · Mark Rutland
Quoted 46 lines · Lorenzo Pieralisi
Quoted 33 lines · Mark Rutland
Quoted 16 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   cpu_pm_pmu_setup(armpmu, cmd);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Quoted 7 lines

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

I agree, think that should be:

	case CPU_PM_EXIT:
	case CPU_PM_ENTER_FAILED:
		cpu_pm_pmu_setup(armpmu, cmd);
		armpmu->start(armpmu);
		break;
Quoted 5 lines

... so that we re-start the events before we start the PMU.

That would be a fix for commit:

da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier")

Yes that's correct, apologies. Probably we did not hit it because CPU PM notifier entry failures are a pretty rare event; regardless:

I can send the updated fix, just let me know.

Quoted 7 lines
Quoted 3 lines

I'm not sure what Will wants, but assuming you do so:

I gave up waiting, so it's already queued here:

https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?h=for-next/fixes&id=0d7fd70f26039bd4b33444ca47f0e69ce3ae0354

Great; I'll mark this thread as done, then. :)

Mark.

#7 lore raw
In reply to Will Deacon
Quoted 48 lines · Will Deacon
Quoted 46 lines · Mark Rutland
Quoted 45 lines · Lorenzo Pieralisi
Quoted 33 lines · Mark Rutland
Quoted 16 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   cpu_pm_pmu_setup(armpmu, cmd);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Quoted 7 lines

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

I agree, think that should be:

  case CPU_PM_EXIT:
  case CPU_PM_ENTER_FAILED:
          cpu_pm_pmu_setup(armpmu, cmd);
          armpmu->start(armpmu);
          break;
Quoted 5 lines

... so that we re-start the events before we start the PMU.

That would be a fix for commit:

da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier")

Yes that's correct, apologies. Probably we did not hit it because CPU PM notifier entry failures are a pretty rare event; regardless:

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

I can send the updated fix, just let me know.

I'm not sure what Will wants, but assuming you do so:

I gave up waiting

I'm sorry for letting you wait.

Quoted 3 lines

, so it's already queued here:

https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/commit/?h=for-next/fixes&id=0d7fd70f26039bd4b33444ca47f0e69ce3ae0354

Thanks for fixing it.

Cheers,
Anders

maintainer
#8 lore raw
Quoted 51 lines · Anders Roxell
Quoted 50 lines · Will Deacon
Quoted 48 lines · Mark Rutland
Quoted 46 lines · Lorenzo Pieralisi
Quoted 33 lines · Mark Rutland
Quoted 16 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   cpu_pm_pmu_setup(armpmu, cmd);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Quoted 7 lines

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

I agree, think that should be:

  case CPU_PM_EXIT:
  case CPU_PM_ENTER_FAILED:
          cpu_pm_pmu_setup(armpmu, cmd);
          armpmu->start(armpmu);
          break;
Quoted 5 lines

... so that we re-start the events before we start the PMU.

That would be a fix for commit:

da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier")

Yes that's correct, apologies. Probably we did not hit it because CPU PM notifier entry failures are a pretty rare event; regardless:

I can send the updated fix, just let me know.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

I'm not sure what Will wants, but assuming you do so:

I gave up waiting

I'm sorry for letting you wait.

No, not at all. It's just that everybody was piling in with patches for these issues and I suspected you were busy dealing with responses. Rather than wait, I figured the best bet was just to get this fixed.

Are you going to respin the SMMUv3 change per Robin's feedback?

Will

#9 lore raw
Quoted 57 lines · Will Deacon
Quoted 55 lines · Anders Roxell
Quoted 54 lines · Will Deacon
Quoted 51 lines · Mark Rutland
Quoted 38 lines · Lorenzo Pieralisi
Quoted 37 lines · Mark Rutland
Quoted 16 lines · Anders Roxell

When fall-through warnings was enabled by default the following warning was starting to show up:

../drivers/perf/arm_pmu.c: In function ‘cpu_pm_pmu_notify’:
../drivers/perf/arm_pmu.c:726:3: warning: this statement may fall
through [-Wimplicit-fallthrough=]

   cpu_pm_pmu_setup(armpmu, cmd);
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../drivers/perf/arm_pmu.c:727:2: note: here
case CPU_PM_ENTER_FAILED:
^~~~

Rework so that the compiler doesn't warn about fall-through.

Fixes d93512ef0f0e ("Makefile: Globally enable fall-through warning")
Quoted 7 lines

---

I'm not convinced that this is the correct patch to fix this issue. However, I can't see why we do 'armpmu->start(armpmu);' only in 'case CPU_PM_ENTER_FAILED' and why we not call function cpu_pm_pmu_setup() there also, since in cpu_pm_pmu_setup() has a case prepared for CPU_PM_ENTER_FAILED.

I agree, think that should be:

  case CPU_PM_EXIT:
  case CPU_PM_ENTER_FAILED:
          cpu_pm_pmu_setup(armpmu, cmd);
          armpmu->start(armpmu);
          break;

... so that we re-start the events before we start the PMU.

That would be a fix for commit:

Quoted 8 lines
Quoted 1 line

da4e4f18afe0f372 ("drivers/perf: arm_pmu: implement CPU_PM notifier")

Yes that's correct, apologies. Probably we did not hit it because CPU PM notifier entry failures are a pretty rare event; regardless:

I can send the updated fix, just let me know.

I'm not sure what Will wants, but assuming you do so:

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I gave up waiting

I'm sorry for letting you wait.

No, not at all. It's just that everybody was piling in with patches for these issues and I suspected you were busy dealing with responses. Rather than wait, I figured the best bet was just to get this fixed.

Thanks.

Quoted 2 lines

Are you going to respin the SMMUv3 change per Robin's feedback?

Yes, just sent it.

Cheers,
Anders