Xenomai 3.2.4: Peak driver fails to register

This forum covers PCAN-Linux and Linux development issues concerning our products
Post Reply
User avatar
GeorgeCh
Posts: 3
Joined: Fri 22. Mar 2024, 12:56

Xenomai 3.2.4: Peak driver fails to register

Post by GeorgeCh » Fri 22. Mar 2024, 13:25

Hello,
I'm using xenomai v3.2.4 on ubuntu 22.04(5.15.129) with a PCAN-M.2.
When configuring the Peak driver from Xenomai this error is thrown at boot:

Code: Select all

[   13.385540] genirq: Flags mismatch irq 16. 00210000 (xeno_peak_pciefd) vs. 00000080 (PCIe PME)
[   13.385544] ------------[ cut here ]------------
[   13.385544] Trying to free already-free IRQ 16
[   13.385547] WARNING: CPU: 2 PID: 490 at kernel/irq/manage.c:1957 free_irq+0x24f/0x470
[   13.385553] Modules linked in: xeno_can_peak_pciefd(+) xeno_can mei_me serio_raw mei intel_pch_thermal binfmt_misc sch_fq_codel dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua msr ramoops reed_solomon pstore_blk pstore_zone ip_tables x_tables autofs4 btrfs blake2b_generic zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear hid_logitech_hidpp hid_logitech_dj hid_generic usbhid hid crct10dif_pclmul crc32_pclmul ghash_clmulni_intel i915 i2c_algo_bit intel_gtt ttm aesni_intel drm_kms_helper syscopyarea sysfillrect crypto_simd sysimgblt fb_sys_fops i2c_i801 cryptd psmouse cec e1000e i2c_smbus drm xhci_pci xhci_pci_renesas ahci libahci drm_panel_orientation_quirks
[   13.385589] CPU: 2 PID: 490 Comm: systemd-udevd Not tainted 5.15.129-xeno+ #11
[   13.385592] Hardware name: Dell Inc. OptiPlex 7040/096JG8, BIOS 1.15.5 07/19/2019
[   13.385593] IRQ stage: Linux
[   13.385594] RIP: 0010:free_irq+0x24f/0x470
[   13.385597] Code: f0 41 0f b1 94 24 c0 00 00 00 0f 85 c6 01 00 00 9c 58 48 89 45 c8 e9 67 fe ff ff 8b 75 d0 48 c7 c7 00 ae d4 83 e8 65 97 a8 00 <0f> 0b 65 8b 05 f8 1d 70 7d a9 00 00 00 01 74 2f 4c 89 f7 c6 07 00
[   13.385599] RSP: 0018:ffffadc8c0f67958 EFLAGS: 00010082
[   13.385601] RAX: 0000000000000000 RBX: ffff8ddf42a24030 RCX: 0000000000000027
[   13.385603] RDX: ffff8de055d1f588 RSI: 0000000000000001 RDI: ffff8de055d1f580
[   13.385604] RBP: ffffadc8c0f67990 R08: 0000000000000010 R09: 0000000000000010
[   13.385605] R10: ffffadc8c0f67848 R11: 0000000000000024 R12: ffff8ddf401ce000
[   13.385607] R13: ffff8ddf4ba8d100 R14: ffff8ddf401ce0c0 R15: ffff8ddf401ce188
[   13.385608] FS:  00007f7ed70568c0(0000) GS:ffff8de055d00000(0000) knlGS:0000000000000000
[   13.385610] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   13.385611] CR2: 00007f66e6c1f000 CR3: 000000010a94c005 CR4: 00000000003706e0
[   13.385613] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[   13.385614] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[   13.385615] Call Trace:
[   13.385616]  <TASK>
[   13.385618]  ? show_regs.cold+0x1a/0x1f
[   13.385623]  ? free_irq+0x24f/0x470
[   13.385625]  ? __warn+0x8c/0x100
[   13.385629]  ? free_irq+0x24f/0x470
[   13.385631]  ? report_bug+0xa5/0xd0
[   13.385636]  ? handle_bug+0x52/0xb0
[   13.385639]  ? exc_invalid_op+0xe7/0x100
[   13.385642]  ? asm_exc_invalid_op+0x1b/0x20
[   13.385646]  ? free_irq+0x24f/0x470
[   13.385648]  ? free_irq+0x24f/0x470
[   13.385651]  xnintr_destroy+0x25/0x30
[   13.385654]  rtdm_irq_request+0x7c/0xa0
[   13.385657]  peak_pciefd_probe+0x323/0x4a0 [xeno_can_peak_pciefd]
[   13.385663]  local_pci_probe+0x48/0x90
[   13.385667]  pci_device_probe+0x119/0x1f0
[   13.385670]  really_probe+0x21f/0x420
[   13.385675]  __driver_probe_device+0xe8/0x140
[   13.385678]  driver_probe_device+0x23/0xc0
[   13.385682]  __driver_attach+0xf7/0x1f0
[   13.385684]  ? __device_attach_driver+0x140/0x140
[   13.385686]  bus_for_each_dev+0x7c/0xd0
[   13.385690]  driver_attach+0x1e/0x30
[   13.385693]  bus_add_driver+0x148/0x220
[   13.385696]  ? vunmap_range_noflush+0x39c/0x470
[   13.385699]  driver_register+0x95/0x100
[   13.385701]  ? 0xffffffffc0cbe000
[   13.385702]  __pci_register_driver+0x68/0x70
[   13.385706]  rtcan_peak_pciefd_init+0x2d/0x1000 [xeno_can_peak_pciefd]
[   13.385710]  do_one_initcall+0x46/0x1e0
[   13.385713]  ? kmem_cache_alloc_trace+0x101/0x260
[   13.385718]  do_init_module+0x52/0x250
[   13.385722]  load_module+0x294d/0x2c50
[   13.385725]  ? ima_post_read_file+0xdc/0x100
[   13.385732]  __do_sys_finit_module+0xbf/0x120
[   13.385735]  ? __do_sys_finit_module+0xbf/0x120
[   13.385741]  __x64_sys_finit_module+0x18/0x20
[   13.385742]  do_syscall_64+0x63/0xa0
[   13.385745]  ? syscall_exit_to_user_mode+0x38/0x80
[   13.385748]  ? do_syscall_64+0x73/0xa0
[   13.385751]  ? do_syscall_64+0x73/0xa0
[   13.385753]  entry_SYSCALL_64_after_hwframe+0x62/0xcc
[   13.385756] RIP: 0033:0x7f7ed775088d
[   13.385758] Code: 5b 41 5c c3 66 0f 1f 84 00 00 00 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 73 b5 0f 00 f7 d8 64 89 01 48
[   13.385760] RSP: 002b:00007ffccb598348 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[   13.385762] RAX: ffffffffffffffda RBX: 000056241990f540 RCX: 00007f7ed775088d
[   13.385763] RDX: 0000000000000000 RSI: 00007f7ed78e8441 RDI: 000000000000000f
[   13.385765] RBP: 0000000000020000 R08: 0000000000000000 R09: 0000000000000002
[   13.385766] R10: 000000000000000f R11: 0000000000000246 R12: 00007f7ed78e8441
[   13.385767] R13: 0000562419938690 R14: 000056241980cb10 R15: 0000562419937d70
[   13.385770]  </TASK>
[   13.385771] ---[ end trace a5239bf27e94671b ]---
[   13.385773] xeno_peak_pciefd 0000:02:00.0: rtdm_irq_request(IRQ16) failure err -16
[   13.400804] xeno_peak_pciefd: probe of 0000:02:00.0 failed with error -12
I've also configured shared interrupts.
CONFIG_XENO_OPT_SHIRQ=y

Seems that IRQ16 is already used. I've tried solutions from other threads in this forum, but to no avail.

I'm not sure how to proceed from here. Do you have any ideas?


George
PS: i've attached dmesg log
Attachments
dmesg_log.txt
(49.3 KiB) Downloaded 557 times

User avatar
S.Grosjean
Software Development
Software Development
Posts: 357
Joined: Wed 4. Jul 2012, 17:02

Re: Xenomai 3.2.4: Peak driver fails to register

Post by S.Grosjean » Mon 25. Mar 2024, 11:21

Hello,

A quick grep into Xenomai 3.2.4 sources tree shows you that CONFIG_XENO_OPT_SHIRQ is no more handled at all by the core, while the option is strangely still proposed by the Xenomai configuration...

Currently, the xeno_can_peak_pciefd driver behaves like this:
  1. When CONFIG_XENO_OPT_SHIRQ is y, then the xeno_can_peak_pciefd driver registers SHARED legacy INTA interrupt by default (your situation)
  2. When CONFIG_XENO_OPT_SHIRQ is not defined, then the xeno_can_peak_pciefd driver registers MSI interrupt (one MSI per channel) by default
If MSI is enabled in your system BIOS, this default behavior can be changed by changing the default value of the module parameter "usemsi".
  • If you built the xeno_can_peak_pciefd as a module, then you can try this first:

    Code: Select all

    $ cd $YOUR_LINUX_KERNEL
    $ sudo insmod drivers/xenomai/can/peak_canfd/xeno_can_peak_pciefd.ko usemsi=1
    Note: according to your kernel RT-can configuration (if CONFIG_XENO_DRIVERS_CAN=M) then you'll have to load the RT-can core before, something like;

    Code: Select all

    $ sudo insmod drivers/xenomai/can/xeno_can.ko
    or:

    Code: Select all

    $ sudo modprobe xeno_can
  • If you built the xeno_can_peak_pciefd as a static driver, then you'll have to change the kernel command line, in order to append:

    Code: Select all

    xeno_can_peak_pciefd.usemsi=1
If the driver succeeds to register, then you can rebuild your Xenomai kernel without CONFIG_XENO_OPT_SHIRQ=y.

On the other hand, you can try to apply the patch attached to that post. This patch adds the handling of CONFIG_XENO_OPT_SHIRQ option in the Xenomai kernel core. It has been tested by some customers of us and according to their feedback, it does the trick.

Please do the following steps if you want to apply the attached patch which adds the handling of CONFIG_XENO_OPT_SHIRQ:

Code: Select all

$ cd xenomai-v3.2.4
$ patch -p 1 < 0001-xenomai-3.2.4-dovetail-add_shared_irq_support.patch
Then go back to your Linux kernel tree, rebuild then install it.

Regards,
Attachments
0001-xenomai-3.2.4-dovetail-add_shared_irq_support.patch
Patch to apply to Xenomai 3.2.4 to add the handling of CONFIG_XENO_OPT_SHIRQ
(1.11 KiB) Downloaded 563 times
— Stéphane

User avatar
GeorgeCh
Posts: 3
Joined: Fri 22. Mar 2024, 12:56

Re: Xenomai 3.2.4: Peak driver fails to register

Post by GeorgeCh » Mon 25. Mar 2024, 15:10

Hi,
Thanks for the detailed explanation. I will try the proposed solutions and get back to you with a status.

Thank you for the help,
George

User avatar
GeorgeCh
Posts: 3
Joined: Fri 22. Mar 2024, 12:56

Re: Xenomai 3.2.4: Peak driver fails to register

Post by GeorgeCh » Tue 26. Mar 2024, 06:01

Morning,
I tried last night the proposed solutions but unfortunately I have the same issue.

The only difference I saw at a first glance is the IRQ flag mask being different from one solution to another.
Eg1:

Code: Select all

 genirq: Flags mismatch irq 16. 00210000 (xeno_peak_pciefd) vs. 00000080 (PCIe PME) 
Eg2:

Code: Select all

 genirq: Flags mismatch irq 16. 00210080 (xeno_peak_pciefd) vs. 00000080 (PCIe PME) 
(I'm reproducing this from memory, might not reflect the actual values.)

I will get back to you with detailed configs and logs as soon as possible.

Following your observation that in v3.2.4 CONFIG_XENO_OPT_SHIRQ is no more handled at all by the core I've looked to see in what version this happened, and it seems that from 3.1.4 -> 3.2.x this happened, so I will spin up a 3.1.4 compiled kernel and see how it behaves.

Anyhow, thanks for the support.

George,

PS: sorry for the double post, could not edit my previous one.

Post Reply