Re: [comedi] Fail to use out-of-tree comedi on debian

Ian Abbott <[email protected]> Tue, 30 Sep 2025 13:36:18 +0100
Newsgroups gmane.linux.comedi
Organization MEV Ltd.
Message-ID <[email protected]>
On 30/09/2025 09:02, C=C3=A9dric Boudinet wrote:
> Hello
>=20
> 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=
=20
> with the master version from git (https://github.com/Linux-Comedi/=20
> comedi/blob/master/INSTALL.md#running-comedi).
> The build process and install works fine (modinfo loads comedi.ko.xz and=
=20
> dt9812.ko.xz from /lib/modules/6.12.48+deb13-amd64/updates/dkms/).
>=20
> However when I plug the iocard, dmesg shows the following errors:
>=20
> [ 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=3D0867,=20
> idProduct=3D9812, bcdDevice=3D 0.00
> [ 1108.663634] usb 3-6: New USB device strings: Mfr=3D0, Product=3D0,=20
> SerialNumber=3D0
> [ 1108.686517] comedi: loading out-of-tree module taints kernel.
> [ 1108.686525] comedi: module verification failed: signature and/or=20
> 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=
=20
> usb_hcd_map_urb_for_dma+0x300/0x470 [usbcore]
> [ 1108.696753] Modules linked in: dt9812(OE+) comedi(OE) sch_ingress=20
> qrtr rfcomm cmac algif_hash algif_skcipher af_alg bnep tun=20
> intel_rapl_msr intel_rapl_common x86_pkg_temp_thermal intel_powerclamp=20
> coretemp kvm_intel kvm irqbypass crct10dif_pclmul ghash_clmulni_intel=20
> sha512_ssse3 sha256_ssse3 iwldvm sha1_ssse3 binfmt_misc mac80211=20
> aesni_intel gf128mul snd_ctl_led mei_wdt btusb snd_hda_codec_realtek=20
> crypto_simd libarc4 nls_ascii mei_pxp mei_hdcp snd_hda_codec_generic=20
> btrtl nls_cp437 uvcvideo snd_hda_scodec_component snd_soc_rt5640=20
> videobuf2_vmalloc btintel snd_hda_codec_hdmi uvc vfat dell_pc=20
> videobuf2_memops platform_profile fat videobuf2_v4l2 snd_hda_intel=20
> cryptd dell_laptop iwlwifi videodev snd_intel_dspcfg snd_soc_rl6231=20
> btbcm rapl snd_intel_sdw_acpi intel_cstate btmtk dell_smm_hwmon=20
> videobuf2_common snd_hda_codec snd_soc_core bluetooth dell_wmi mc=20
> intel_uncore snd_hda_core dell_smbios snd_compress cfg80211 pcspkr=20
> dcdbas lis3lv02d_i2c snd_hwdep snd_pcm_dmaengine sparse_keymap lis3lv02d=
=20
> dell_wmi_descriptor wmi_bmof
> [ 1108.696797] =C2=A0at24 mei_me snd_pcm mei snd_timer snd soundcore=20
> dell_smo8800 dell_rbtn ac rfkill sg evdev joydev parport_pc ppdev lp=20
> parport efi_pstore configfs nfnetlink efivarfs ip_tables x_tables=20
> autofs4 ext4 mbcache jbd2 crc32c_generic amdgpu amdxcp drm_exec=20
> gpu_sched crc16 i915 radeon drm_buddy i2c_algo_bit drm_suballoc_helper=20
> drm_display_helper cec sr_mod sd_mod drm_ttm_helper rc_core cdrom ttm=20
> iTCO_wdt sdhci_pci intel_pmc_bxt xhci_pci ahci iTCO_vendor_support=20
> xhci_hcd ehci_pci drm_kms_helper ehci_hcd watchdog cqhci libahci sdhci=20
> crc32_pclmul libata mmc_core psmouse i2c_i801 crc32c_intel scsi_mod=20
> usbcore drm serio_raw i2c_smbus e1000e scsi_common lpc_ich usb_common=20
> video battery wmi button
> [ 1108.696837] CPU: 0 UID: 0 PID: 7680 Comm: (udev-worker) Tainted: G  =
=20
>  =C2=A0 =C2=A0 =C2=A0 =C2=A0 OE =C2=A0X =C2=A0 6.12.48+deb13-amd64 #1 =C2=
=A0Debian 6.12.48-1
> [ 1108.696840] Tainted: [O]=3DOOT_MODULE, [E]=3DUNSIGNED_MODULE, [X]=3DAU=
X
> [ 1108.696841] Hardware name: Dell Inc. Latitude E6440/02P3T1, BIOS A24=
=20
> 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=
=20
> ff ff 48 c7 c7 59 c1 6b c0 89 44 24 04 c6 05 ad 15 02 00 01 e8 10 d5 84=
=20
> 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:=20
> 0000000000000027
> [ 1108.696864] RDX: ffffa056e6a21788 RSI: 0000000000000001 RDI:=20
> ffffa056e6a21780
> [ 1108.696865] RBP: ffffa055c0d49000 R08: 0000000000000000 R09:=20
> ffffb0f60cccb428
> [ 1108.696866] R10: ffffffff9dab43a8 R11: 0000000000000003 R12:=20
> 0000000000000001
> [ 1108.696867] R13: 0000000000000c00 R14: ffffb0f60cccb718 R15:=20
> ffffa055fa255800
> [ 1108.696868] FS: =C2=A000007f92c5c6e980(0000) GS:ffffa056e6a00000(0000)=
=20
> knlGS:0000000000000000
> [ 1108.696870] CS: =C2=A00010 DS: 0000 ES: 0000 CR0: 0000000080050033
> [ 1108.696871] CR2: 00007f29731dccd0 CR3: 000000005bfb2005 CR4:=20
> 00000000001726f0
> [ 1108.696872] Call Trace:
> [ 1108.696874] =C2=A0<TASK>
> [ 1108.696880] =C2=A0usb_hcd_submit_urb+0xa3/0xc60 [usbcore]
> [ 1108.696897] =C2=A0? idr_alloc_u32+0xa1/0xe0
> [ 1108.696902] =C2=A0? __kmalloc_noprof+0x17e/0x400
> [ 1108.696906] =C2=A0usb_start_wait_urb+0x8a/0x190 [usbcore]
> [ 1108.696924] =C2=A0dt9812_read_info+0x90/0xf0 [dt9812]
> [ 1108.696929] =C2=A0dt9812_probe+0xf0/0x210 [dt9812]
> [ 1108.696932] =C2=A0? __pm_runtime_set_status+0x132/0x2a0
> [ 1108.696937] =C2=A0usb_probe_interface+0xe8/0x2b0 [usbcore]
> [ 1108.696953] =C2=A0really_probe+0xde/0x340
> [ 1108.696956] =C2=A0? pm_runtime_barrier+0x54/0x90
> [ 1108.696959] =C2=A0? __pfx___driver_attach+0x10/0x10
> [ 1108.696962] =C2=A0__driver_probe_device+0x78/0x110
> [ 1108.696964] =C2=A0driver_probe_device+0x1f/0xa0
> [ 1108.696967] =C2=A0__driver_attach+0xba/0x1c0
> [ 1108.696970] =C2=A0bus_for_each_dev+0x8f/0xe0
> [ 1108.696973] =C2=A0bus_add_driver+0x112/0x1f0
> [ 1108.696976] =C2=A0driver_register+0x72/0xd0
> [ 1108.696979] =C2=A0usb_register_driver+0x8c/0x130 [usbcore]
> [ 1108.696994] =C2=A0usb_dt9812_init+0x65/0xff0 [dt9812]
> [ 1108.696996] =C2=A0? __pfx_usb_dt9812_init+0x10/0x10 [dt9812]
> [ 1108.696998] =C2=A0do_one_initcall+0x5b/0x310
> [ 1108.697003] =C2=A0do_init_module+0x60/0x230
> [ 1108.697006] =C2=A0init_module_from_file+0x89/0xe0
> [ 1108.697012] =C2=A0idempotent_init_module+0x11e/0x310
> [ 1108.697016] =C2=A0__x64_sys_finit_module+0x5e/0xb0
> [ 1108.697019] =C2=A0do_syscall_64+0x82/0x190
> [ 1108.697025] =C2=A0? vfs_read+0x15e/0x360
> [ 1108.697028] =C2=A0? vfs_read+0x15e/0x360
> [ 1108.697030] =C2=A0? __rseq_handle_notify_resume+0xa2/0x4a0
> [ 1108.697035] =C2=A0? restore_fpregs_from_fpstate+0x3c/0xa0
> [ 1108.697039] =C2=A0? switch_fpu_return+0x4e/0xd0
> [ 1108.697041] =C2=A0? arch_exit_to_user_mode_prepare.isra.0+0x77/0xa0
> [ 1108.697045] =C2=A0? syscall_exit_to_user_mode+0x37/0x1b0
> [ 1108.697048] =C2=A0? do_syscall_64+0x8e/0x190
> [ 1108.697049] =C2=A0? do_filp_open+0xc4/0x170
> [ 1108.697056] =C2=A0? do_sys_openat2+0x9c/0xe0
> [ 1108.697059] =C2=A0? arch_exit_to_user_mode_prepare.isra.0+0x16/0xa0
> [ 1108.697061] =C2=A0? syscall_exit_to_user_mode+0x37/0x1b0
> [ 1108.697063] =C2=A0? do_syscall_64+0x8e/0x190
> [ 1108.697065] =C2=A0entry_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=
=20
> 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f=
=20
> 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:=20
> 0000000000000139
> [ 1108.697089] RAX: ffffffffffffffda RBX: 000055711c3b3bd0 RCX:=20
> 00007f92c5f18779
> [ 1108.697090] RDX: 0000000000000004 RSI: 00007f92c64c444d RDI:=20
> 0000000000000013
> [ 1108.697091] RBP: 0000000000000004 R08: 0000000000000000 R09:=20
> 000055711c249b60
> [ 1108.697092] R10: 0000000000000000 R11: 0000000000000246 R12:=20
> 00007f92c64c444d
> [ 1108.697093] R13: 0000000000020000 R14: 000055711c24c040 R15:=20
> 0000000000000000
> [ 1108.697097] =C2=A0</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
>=20
>=20
> And no /dev/comedi0 is created. Do you know where the problem is coming=
=20
> from? Should I rebuild comedilib as well? Or maybe should I rebuilt from=
=20
> the debian kernel source?
>=20
> 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=20
from kmalloc memory, due to stack memory not being supported on some=20
architectures for DMA.  I guess "some architectures" now includes=20
x86-64, which it never used to.

It would be interesting to know if the Linux kernel in-tree dt9812=20
driver works OK.  The module is included in Debian's default Linux=20
kernel image packages.  But note that the Linux kernel in-tree Comedi=20
modules should not be loaded at the same time as the out-of-tree=20
comedi.org modules built from the Comedi GitHub repositories, so the=20
safest option would be to uninstall the DKMS modules to allow the=20
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=20
out-of-tree module for development purposes by copying the=20
"drivers/comedi/drivers/dt9812.c" file from the Linux kernel v6.16=20
sources into a directory along with a simple kernel module Makefile such=20
as the one below:

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

obj-m +=3D 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 ?=3D "/lib/modules/$(shell uname -r)/build"

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

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

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

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

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

--=20
You received this message because you are subscribed to the Google Groups "=
Comedi: Linux Control and Measurement Device Interface" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/comedi_list=
/ed815261-cf2b-42b0-a565-42abc9e92661%40mev.co.uk.