Fail to use out-of-tree comedi on debian

9 views
Skip to first unread message

Cédric Boudinet

unread,
Sep 30, 2025, 5:22:07 AM (8 days ago) Sep 30
to Comedi: Linux Control and Measurement Device Interface
Hello

I would like to improve the comedi driver for the dt9812 card.
I a working on debian Trixie. I tried to rebuild and install using dkms with the master version from git (https://github.com/Linux-Comedi/comedi/blob/master/INSTALL.md#running-comedi).
The build process and install works fine (modinfo loads comedi.ko.xz and dt9812.ko.xz from /lib/modules/6.12.48+deb13-amd64/updates/dkms/).

However when I plug the iocard, dmesg shows the following errors:

[ 1108.518334] usb 3-6: new full-speed USB device number 2 using xhci_hcd
[ 1108.663617] usb 3-6: New USB device found, idVendor=0867, idProduct=9812, bcdDevice= 0.00
[ 1108.663634] usb 3-6: New USB device strings: Mfr=0, Product=0, SerialNumber=0
[ 1108.686517] comedi: loading out-of-tree module taints kernel.
[ 1108.686525] comedi: module verification failed: signature and/or required key missing - tainting kernel
[ 1108.690791] comedi: version 0.7.76.1.399-f47a6897 - http://www.comedi.org
[ 1108.696684] ------------[ cut here ]------------
[ 1108.696688] transfer buffer is on stack
[ 1108.696727] WARNING: CPU: 0 PID: 7680 at drivers/usb/core/hcd.c:1476 usb_hcd_map_urb_for_dma+0x300/0x470 [usbcore]
[ 1108.696753] Modules linked in: dt9812(OE+) comedi(OE) sch_ingress qrtr rfcomm cmac algif_hash algif_skcipher af_alg bnep tun intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul ghash_clmulni_intel sha512_ssse3 sha256_ssse3 iwldvm sha1_ssse3 binfmt_misc mac80211 aesni_intel gf128mul snd_ctl_led mei_wdt btusb snd_hda_codec_realtek crypto_simd libarc4 nls_ascii mei_pxp mei_hdcp snd_hda_codec_generic btrtl nls_cp437 uvcvideo snd_hda_scodec_component snd_soc_rt5640 videobuf2_vmalloc btintel snd_hda_codec_hdmi uvc vfat dell_pc videobuf2_memops platform_profile fat videobuf2_v4l2 snd_hda_intel cryptd dell_laptop iwlwifi videodev snd_intel_dspcfg snd_soc_rl6231 btbcm rapl snd_intel_sdw_acpi intel_cstate btmtk dell_smm_hwmon videobuf2_common snd_hda_codec snd_soc_core bluetooth dell_wmi mc intel_uncore snd_hda_core dell_smbios snd_compress cfg80211 pcspkr dcdbas lis3lv02d_i2c snd_hwdep snd_pcm_dmaengine sparse_keymap lis3lv02d dell_wmi_descriptor wmi_bmof
[ 1108.696797]  at24 mei_me snd_pcm mei snd_timer snd soundcore dell_smo8800 dell_rbtn ac rfkill sg evdev joydev parport_pc ppdev lp parport efi_pstore configfs nfnetlink efivarfs ip_tables x_tables autofs4 ext4 mbcache jbd2 crc32c_generic amdgpu amdxcp drm_exec gpu_sched crc16 i915 radeon drm_buddy i2c_algo_bit drm_suballoc_helper drm_display_helper cec sr_mod sd_mod drm_ttm_helper rc_core cdrom ttm iTCO_wdt sdhci_pci intel_pmc_bxt xhci_pci ahci iTCO_vendor_support xhci_hcd ehci_pci drm_kms_helper ehci_hcd watchdog cqhci libahci sdhci crc32_pclmul libata mmc_core psmouse i2c_i801 crc32c_intel scsi_mod usbcore drm serio_raw i2c_smbus e1000e scsi_common lpc_ich usb_common video battery wmi button
[ 1108.696837] CPU: 0 UID: 0 PID: 7680 Comm: (udev-worker) Tainted: G           OE  X   6.12.48+deb13-amd64 #1  Debian 6.12.48-1
[ 1108.696840] Tainted: [O]=OOT_MODULE, [E]=UNSIGNED_MODULE, [X]=AUX
[ 1108.696841] Hardware name: Dell Inc. Latitude E6440/02P3T1, BIOS A24 06/13/2019
[ 1108.696842] RIP: 0010:usb_hcd_map_urb_for_dma+0x300/0x470 [usbcore]
[ 1108.696859] Code: 37 80 3d ca 15 02 00 00 b8 f5 ff ff ff 0f 85 d1 fe ff ff 48 c7 c7 59 c1 6b c0 89 44 24 04 c6 05 ad 15 02 00 01 e8 10 d5 84 db <0f> 0b 8b 53 5c 8b 44 24 04 e9 ac fe ff ff 4c 89 f7 4c 8b 7d 08 45
[ 1108.696861] RSP: 0018:ffffb0f60cccb5a8 EFLAGS: 00010286
[ 1108.696863] RAX: 0000000000000000 RBX: ffffa0552c0f5480 RCX: 0000000000000027
[ 1108.696864] RDX: ffffa056e6a21788 RSI: 0000000000000001 RDI: ffffa056e6a21780
[ 1108.696865] RBP: ffffa055c0d49000 R08: 0000000000000000 R09: ffffb0f60cccb428
[ 1108.696866] R10: ffffffff9dab43a8 R11: 0000000000000003 R12: 0000000000000001
[ 1108.696867] R13: 0000000000000c00 R14: ffffb0f60cccb718 R15: ffffa055fa255800
[ 1108.696868] FS:  00007f92c5c6e980(0000) GS:ffffa056e6a00000(0000) knlGS:0000000000000000
[ 1108.696870] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 1108.696871] CR2: 00007f29731dccd0 CR3: 000000005bfb2005 CR4: 00000000001726f0
[ 1108.696872] Call Trace:
[ 1108.696874]  <TASK>
[ 1108.696880]  usb_hcd_submit_urb+0xa3/0xc60 [usbcore]
[ 1108.696897]  ? idr_alloc_u32+0xa1/0xe0
[ 1108.696902]  ? __kmalloc_noprof+0x17e/0x400
[ 1108.696906]  usb_start_wait_urb+0x8a/0x190 [usbcore]
[ 1108.696924]  dt9812_read_info+0x90/0xf0 [dt9812]
[ 1108.696929]  dt9812_probe+0xf0/0x210 [dt9812]
[ 1108.696932]  ? __pm_runtime_set_status+0x132/0x2a0
[ 1108.696937]  usb_probe_interface+0xe8/0x2b0 [usbcore]
[ 1108.696953]  really_probe+0xde/0x340
[ 1108.696956]  ? pm_runtime_barrier+0x54/0x90
[ 1108.696959]  ? __pfx___driver_attach+0x10/0x10
[ 1108.696962]  __driver_probe_device+0x78/0x110
[ 1108.696964]  driver_probe_device+0x1f/0xa0
[ 1108.696967]  __driver_attach+0xba/0x1c0
[ 1108.696970]  bus_for_each_dev+0x8f/0xe0
[ 1108.696973]  bus_add_driver+0x112/0x1f0
[ 1108.696976]  driver_register+0x72/0xd0
[ 1108.696979]  usb_register_driver+0x8c/0x130 [usbcore]
[ 1108.696994]  usb_dt9812_init+0x65/0xff0 [dt9812]
[ 1108.696996]  ? __pfx_usb_dt9812_init+0x10/0x10 [dt9812]
[ 1108.696998]  do_one_initcall+0x5b/0x310
[ 1108.697003]  do_init_module+0x60/0x230
[ 1108.697006]  init_module_from_file+0x89/0xe0
[ 1108.697012]  idempotent_init_module+0x11e/0x310
[ 1108.697016]  __x64_sys_finit_module+0x5e/0xb0
[ 1108.697019]  do_syscall_64+0x82/0x190
[ 1108.697025]  ? vfs_read+0x15e/0x360
[ 1108.697028]  ? vfs_read+0x15e/0x360
[ 1108.697030]  ? __rseq_handle_notify_resume+0xa2/0x4a0
[ 1108.697035]  ? restore_fpregs_from_fpstate+0x3c/0xa0
[ 1108.697039]  ? switch_fpu_return+0x4e/0xd0
[ 1108.697041]  ? arch_exit_to_user_mode_prepare.isra.0+0x77/0xa0
[ 1108.697045]  ? syscall_exit_to_user_mode+0x37/0x1b0
[ 1108.697048]  ? do_syscall_64+0x8e/0x190
[ 1108.697049]  ? do_filp_open+0xc4/0x170
[ 1108.697056]  ? do_sys_openat2+0x9c/0xe0
[ 1108.697059]  ? arch_exit_to_user_mode_prepare.isra.0+0x16/0xa0
[ 1108.697061]  ? syscall_exit_to_user_mode+0x37/0x1b0
[ 1108.697063]  ? do_syscall_64+0x8e/0x190
[ 1108.697065]  entry_SYSCALL_64_after_hwframe+0x76/0x7e
[ 1108.697068] RIP: 0033:0x7f92c5f18779
[ 1108.697086] Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 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 4f 86 0d 00 f7 d8 64 89 01 48
[ 1108.697087] RSP: 002b:00007fffd9a75398 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
[ 1108.697089] RAX: ffffffffffffffda RBX: 000055711c3b3bd0 RCX: 00007f92c5f18779
[ 1108.697090] RDX: 0000000000000004 RSI: 00007f92c64c444d RDI: 0000000000000013
[ 1108.697091] RBP: 0000000000000004 R08: 0000000000000000 R09: 000055711c249b60
[ 1108.697092] R10: 0000000000000000 R11: 0000000000000246 R12: 00007f92c64c444d
[ 1108.697093] R13: 0000000000020000 R14: 000055711c24c040 R15: 0000000000000000
[ 1108.697097]  </TASK>
[ 1108.697098] ---[ end trace 0000000000000000 ]---
[ 1108.698598] dt9812 3-6:1.0: Failed to read vendor.
[ 1108.698653] usbcore: registered new interface driver dt9812


And no /dev/comedi0 is created. Do you know where the problem is coming from? Should I rebuild comedilib as well? Or maybe should I rebuilt from the debian kernel source?

Bests
Cedric

Ian Abbott

unread,
Sep 30, 2025, 8:36:23 AM (8 days ago) Sep 30
to comed...@googlegroups.com, Cédric Boudinet
I guess the cause is indicated by this message:

[ 1108.696688] transfer buffer is on stack

The Linux kernel in-tree Comedi USB drivers allocate USB command buffers
from kmalloc memory, due to stack memory not being supported on some
architectures for DMA. I guess "some architectures" now includes
x86-64, which it never used to.

It would be interesting to know if the Linux kernel in-tree dt9812
driver works OK. The module is included in Debian's default Linux
kernel image packages. But note that the Linux kernel in-tree Comedi
modules should not be loaded at the same time as the out-of-tree
comedi.org modules built from the Comedi GitHub repositories, so the
safest option would be to uninstall the DKMS modules to allow the
in-tree modules to be autoloaded.

There is no need to rebuild comedilib as well.

It should be possible to rebuild the in-tree dt9812 module as an
out-of-tree module for development purposes by copying the
"drivers/comedi/drivers/dt9812.c" file from the Linux kernel v6.16
sources into a directory along with a simple kernel module Makefile such
as the one below:

------------------------------------------------------------------
ifneq ($(KERNELRELEASE),)
# KBuild part of Makefile

obj-m += dt9812.o

else
# Normal part of Makefile

# Kernel build directory specified by KDIR variable
# Default to running kernel's build directory if KDIR not set externally
KDIR ?= "/lib/modules/$(shell uname -r)/build"

all:
$(MAKE) -C "$(KDIR)" M="$(CURDIR)" modules

clean:
$(MAKE) -C "$(KDIR)" M="$(CURDIR)" clean

endif
------------------------------------------------------------------

This has been possible since the v5.17 kernel. Before that kernel
version, it would also be necessary to copy a bunch of missing header files.

--
-=( Ian Abbott <abb...@mev.co.uk> || MEV Ltd. is a company )=-
-=( registered in England & Wales. Regd. number: 02862268. )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-

Ian Abbott

unread,
Sep 30, 2025, 9:25:42 AM (8 days ago) Sep 30
to comed...@googlegroups.com, Cédric Boudinet
On 30/09/2025 13:36, Ian Abbott wrote:
> On 30/09/2025 09:02, Cédric Boudinet wrote:
>> Hello
>>
>> I would like to improve the comedi driver for the dt9812 card.
>> I a working on debian Trixie. I tried to rebuild and install using
>> dkms with the master version from git (https://github.com/Linux-
>> Comedi/ comedi/blob/master/INSTALL.md#running-comedi).
>> The build process and install works fine (modinfo loads comedi.ko.xz
>> and dt9812.ko.xz from /lib/modules/6.12.48+deb13-amd64/updates/dkms/).
>>
>> However when I plug the iocard, dmesg shows the following errors:
[snip]
>> And no /dev/comedi0 is created. Do you know where the problem is
>> coming from? Should I rebuild comedilib as well? Or maybe should I
>> rebuilt from the debian kernel source?
>>
>> Bests
>> Cedric
>
> I guess the cause is indicated by this message:
>
> [ 1108.696688] transfer buffer is on stack
>
> The Linux kernel in-tree Comedi USB drivers allocate USB command buffers
> from kmalloc memory, due to stack memory not being supported on some
> architectures for DMA.  I guess "some architectures" now includes
> x86-64, which it never used to.

I've pushed a commit to the Comedi GitHub repo to hopefully correct this
problem, based on code in the Linux kernel in-tree version of the driver
to replace the on-stack buffers with temporary kmalloc'ed buffers
(actually kzalloc to zero-fill the allocated buffers).

Please let me know if it works if you get the chance to test it.

There may be similar problems in the other out-of-tree USB Comedi
drivers, but I'm looking into that now.

Cédric Boudinet

unread,
Sep 30, 2025, 3:58:06 PM (8 days ago) Sep 30
to Comedi: Linux Control and Measurement Device Interface
Dear Ian
I managed to built both in-tree and out-of-tree dt9812 modules and the iocard works as expected.
I can now work on the driver.
Thanks a lot.
Cedric
Reply all
Reply to author
Forward
0 new messages