Re: Marvell: hw perfevents: unable to count PMU IRQs

2021-03-26 Thread Paul Menzel

Dear Robin,


Thank you for the quick reply.

Am 26.03.21 um 13:29 schrieb Robin Murphy:

On 2021-03-25 21:39, Paul Menzel wrote:


On the Marvell Prestera switch, Linux 5.10.4 prints the error (with an 
additional info level message) below.


 [    0.00] Linux version 5.10.4 (robimarko@onlbuilder9) 
(aarch64-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516, GNU ld (GNU Binutils 
for Debian) 2.28) #1 SMP PREEMPT Thu Mar 11 10:22:09 UTC 2021
 […]
 [    1.996658] hw perfevents: unable to count PMU IRQs
 [    2.001825] hw perfevents: /ap806/config-space@f000/pmu: failed to 
register PMU devices!


[…]


Please find the output of `dmesg` attached.

How can the IRQs be counted?


Well, that message simply means we got an error back from 
platform_irq_count(), which in turn implies that 
platform_get_irq_optional() failed. Most likely we got -EPROBE_DEFER 
back from of_irq_get() because the relevant interrupt controller wasn't 
ready by that point - especially since that's the o9nly error code that 
platform_irq_cont() will actually pass. It looks like that should end up 
getting propagated all the way out appropriately, so the PMU driver 
should defer and be able to probe OK once the mvebu-pic driver has 
turned up to provide its IRQ. We could of course do a better job of not 
shouting error messages for a non-fatal condition


Yes, that would be great.

As for why the PMU doesn't eventually show up, my best guess would be 
either an issue with the mvebu-pic driver itself probing, and/or perhaps 
something in fw_devlink going awry - inspecting sysfs should shed a bit 
more light on those.


I just noticed, I missed

[3.298670] hw perfevents: enabled with armv8_cortex_a72 PMU 
driver, 7 counters available


a good second. So the interrupt controller indeed seems to take longer 
to be ready.


I guess, I’d need to boot with `initcall_debug` to find out the callers 
of the PMU functions.



Kind regards,

Paul


Re: Marvell: hw perfevents: unable to count PMU IRQs

2021-03-26 Thread Robin Murphy

On 2021-03-25 21:39, Paul Menzel wrote:

Dear Linux folks,


On the Marvell Prestera switch, Linux 5.10.4 prints the error (with an 
additional info level message) below.


     [    0.00] Linux version 5.10.4 (robimarko@onlbuilder9) 
(aarch64-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516, GNU ld (GNU 
Binutils for Debian) 2.28) #1 SMP PREEMPT Thu Mar 11 10:22:09 UTC 2021

     […]
     [    1.996658] hw perfevents: unable to count PMU IRQs
     [    2.001825] hw perfevents: /ap806/config-space@f000/pmu: 
failed to register PMU devices!


```
# lscpu
Architecture:  aarch64
Byte Order:    Little Endian
CPU(s):    4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s): 1
NUMA node(s):  1
Model: 1
BogoMIPS:  50.00
L1d cache: 32K
L1i cache: 48K
L2 cache:  512K
NUMA node0 CPU(s): 0-3
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
# cat /proc/cpuinfo
processor   : 0
BogoMIPS    : 50.00
Features    : fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 1
[…]
```

Please find the output of `dmesg` attached.

How can the IRQs be counted?


Well, that message simply means we got an error back from 
platform_irq_count(), which in turn implies that 
platform_get_irq_optional() failed. Most likely we got -EPROBE_DEFER 
back from of_irq_get() because the relevant interrupt controller wasn't 
ready by that point - especially since that's the o9nly error code that 
platform_irq_cont() will actually pass. It looks like that should end up 
getting propagated all the way out appropriately, so the PMU driver 
should defer and be able to probe OK once the mvebu-pic driver has 
turned up to provide its IRQ. We could of course do a better job of not 
shouting error messages for a non-fatal condition


As for why the PMU doesn't eventually show up, my best guess would be 
either an issue with the mvebu-pic driver itself probing, and/or perhaps 
something in fw_devlink going awry - inspecting sysfs should shed a bit 
more light on those.


Robin.


Marvell: hw perfevents: unable to count PMU IRQs

2021-03-25 Thread Paul Menzel

Dear Linux folks,


On the Marvell Prestera switch, Linux 5.10.4 prints the error (with an 
additional info level message) below.


[0.00] Linux version 5.10.4 (robimarko@onlbuilder9) 
(aarch64-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516, GNU ld (GNU 
Binutils for Debian) 2.28) #1 SMP PREEMPT Thu Mar 11 10:22:09 UTC 2021

[…]
[1.996658] hw perfevents: unable to count PMU IRQs
[2.001825] hw perfevents: /ap806/config-space@f000/pmu: 
failed to register PMU devices!


```
# lscpu
Architecture:  aarch64
Byte Order:Little Endian
CPU(s):4
On-line CPU(s) list:   0-3
Thread(s) per core:1
Core(s) per socket:4
Socket(s): 1
NUMA node(s):  1
Model: 1
BogoMIPS:  50.00
L1d cache: 32K
L1i cache: 48K
L2 cache:  512K
NUMA node0 CPU(s): 0-3
Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
# cat /proc/cpuinfo
processor   : 0
BogoMIPS: 50.00
Features: fp asimd evtstrm aes pmull sha1 sha2 crc32 cpuid
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x0
CPU part: 0xd08
CPU revision: 1
[…]
```

Please find the output of `dmesg` attached.

How can the IRQs be counted?


Kind regards,

Paul
[0.00] Booting Linux on physical CPU 0x00 [0x410fd081]
[0.00] Linux version 5.10.4 (robimarko@onlbuilder9) 
(aarch64-linux-gnu-gcc (Debian 6.3.0-18) 6.3.0 20170516, GNU ld (GNU Binutils 
for Debian) 2.28) #1 SMP PREEMPT Thu Mar 11 10:22:09 UTC 2021
[0.00] Machine model: delta,tn48m
[0.00] earlycon: uart8250 at MMIO32 0xf0512000 (options '')
[0.00] printk: bootconsole [uart8250] enabled
[0.00] efi: UEFI not found.
[0.00] [Firmware Bug]: Kernel image misaligned at boot, please fix your 
bootloader!
[0.00] cma: Reserved 32 MiB at 0xbe00
[0.00] NUMA: No NUMA configuration found
[0.00] NUMA: Faking a node at [mem 
0x-0x00023fff]
[0.00] NUMA: NODE_DATA [mem 0x23efdb100-0x23efdcfff]
[0.00] Zone ranges:
[0.00]   DMA  [mem 0x-0x3fff]
[0.00]   DMA32[mem 0x4000-0x]
[0.00]   Normal   [mem 0x0001-0x00023fff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x03ff]
[0.00]   node   0: [mem 0x0420-0xbfff]
[0.00]   node   0: [mem 0x0001-0x00023fff]
[0.00] Initmem setup node 0 [mem 0x-0x00023fff]
[0.00] On node 0 totalpages: 2096640
[0.00]   DMA zone: 4096 pages used for memmap
[0.00]   DMA zone: 0 pages reserved
[0.00]   DMA zone: 261632 pages, LIFO batch:63
[0.00]   DMA32 zone: 8192 pages used for memmap
[0.00]   DMA32 zone: 524288 pages, LIFO batch:63
[0.00]   Normal zone: 20480 pages used for memmap
[0.00]   Normal zone: 1310720 pages, LIFO batch:63
[0.00] psci: probing for conduit method from DT.
[0.00] psci: PSCIv1.1 detected in firmware.
[0.00] psci: Using standard PSCI v0.2 function IDs
[0.00] psci: Trusted OS resident on physical CPU 0x0
[0.00] psci: SMC Calling Convention v1.1
[0.00] percpu: Embedded 32 pages/cpu s94104 r8192 d28776 u131072
[0.00] pcpu-alloc: s94104 r8192 d28776 u131072 alloc=32*4096
[0.00] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3
[0.00] Detected PIPT I-cache on CPU0
[0.00] CPU features: detected: EL2 vector hardening
[0.00] CPU features: kernel page table isolation forced ON by KASLR
[0.00] CPU features: detected: Kernel page table isolation (KPTI)
[0.00] CPU features: detected: Spectre-v2
[0.00] CPU features: detected: ARM errata 1165522, 1319367, or 1530923
[0.00] Built 1 zonelists, mobility grouping on.  Total pages: 2063872
[0.00] Policy zone: Normal
[0.00] Kernel command line: console=ttyS0,115200 
earlycon=uart8250,mmio32,0xf0512000 onl_platform=arm64-delta-tn48m-poe-r0
[0.00] Dentry cache hash table entries: 1048576 (order: 11, 8388608 
bytes, linear)
[0.00] Inode-cache hash table entries: 524288 (order: 10, 4194304 
bytes, linear)
[0.00] mem auto-init: stack:off, heap alloc:off, heap free:off
[0.00] software IO TLB: mapped [mem 
0x3bfff000-0x3000] (64MB)
[0.00] Memory: 8071364K/8386560K available (18112K kernel code, 4006K 
rwdata, 9464K rodata, 9536K init, 539K bss, 282428K reserved, 32768K 
cma-reserved)
[0.00] ftrace: allocating 60579 entries in 237 pages
[0.00] ftrace: allocated 237 pages with 6 groups
[0.00] rcu: Preemptible hierarchical RCU implementation.
[0.00]