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

Cédric Boudinet <[email protected]> Tue, 30 Sep 2025 12:58:06 -0700 (PDT)
Newsgroups gmane.linux.comedi
Message-ID <[email protected]>
------=_Part_121882_749835560.1759262286141
Content-Type: multipart/alternative; 
	boundary="----=_Part_121883_1816700165.1759262286141"

------=_Part_121883_1816700165.1759262286141
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Dear Ian
I managed to built both in-tree and out-of-tree dt9812 modules and the=20
iocard works as expected.
I can now work on the driver.
Thanks a lot.
Cedric

On Tuesday, 30 September 2025 at 15:25:42 UTC+2 Ian Abbott wrote:

> On 30/09/2025 13:36, Ian Abbott wrote:
> > On 30/09/2025 09:02, C=C3=A9dric 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=20
> >> dkms with the master version from git (https://github.com/Linux-=20
> >> Comedi/ comedi/blob/master/INSTALL.md#running-comedi).
> >> The build process and install works fine (modinfo loads comedi.ko.xz=
=20
> >> 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=20
> >> coming from? Should I rebuild comedilib as well? Or maybe should I=20
> >> rebuilt from the debian kernel source?
> >>
> >> Bests
> >> Cedric
> >=20
> > I guess the cause is indicated by this message:
> >=20
> > [ 1108.696688] transfer buffer is on stack
> >=20
> > The Linux kernel in-tree Comedi USB drivers allocate USB command buffer=
s=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.
>
> I've pushed a commit to the Comedi GitHub repo to hopefully correct this=
=20
> problem, based on code in the Linux kernel in-tree version of the driver=
=20
> to replace the on-stack buffers with temporary kmalloc'ed buffers=20
> (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=20
> drivers, but I'm looking into that now.
>
> --=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=
/781f991a-51ad-46d8-b924-2a000b7cfef2n%40googlegroups.com.

------=_Part_121883_1816700165.1759262286141
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div>Dear Ian</div><div>I managed to built both in-tree and out-of-tree dt9=
812 modules and the iocard works as expected.</div><div>I can now work on t=
he driver.</div><div>Thanks a lot.</div><div>Cedric</div><br /><div class=
=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr">On Tuesday, 30 Sept=
ember 2025 at 15:25:42 UTC+2 Ian Abbott wrote:<br/></div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0 0 0 0.8ex; border-left: 1px solid rgb(2=
04, 204, 204); padding-left: 1ex;">On 30/09/2025 13:36, Ian Abbott wrote:
<br>&gt; On 30/09/2025 09:02, C=C3=A9dric Boudinet wrote:
<br>&gt;&gt; Hello
<br>&gt;&gt;
<br>&gt;&gt; I would like to improve the comedi driver for the dt9812 card.
<br>&gt;&gt; I a working on debian Trixie. I tried to rebuild and install u=
sing=20
<br>&gt;&gt; dkms with the master version from git (<a href=3D"https://gith=
ub.com/Linux-" target=3D"_blank" rel=3D"nofollow" data-saferedirecturl=3D"h=
ttps://www.google.com/url?hl=3Den-GB&amp;q=3Dhttps://github.com/Linux-&amp;=
source=3Dgmail&amp;ust=3D1759348570029000&amp;usg=3DAOvVaw3LrjvZ-GlTrFwifQa=
oz9Gd">https://github.com/Linux-</a>=20
<br>&gt;&gt; Comedi/ comedi/blob/master/INSTALL.md#running-comedi).
<br>&gt;&gt; The build process and install works fine (modinfo loads comedi=
.ko.xz=20
<br>&gt;&gt; and dt9812.ko.xz from /lib/modules/6.12.48+deb13-amd64/updates=
/dkms/).
<br>&gt;&gt;
<br>&gt;&gt; However when I plug the iocard, dmesg shows the following erro=
rs:
<br>[snip]
<br>&gt;&gt; And no /dev/comedi0 is created. Do you know where the problem =
is=20
<br>&gt;&gt; coming from? Should I rebuild comedilib as well? Or maybe shou=
ld I=20
<br>&gt;&gt; rebuilt from the debian kernel source?
<br>&gt;&gt;
<br>&gt;&gt; Bests
<br>&gt;&gt; Cedric
<br>&gt;=20
<br>&gt; I guess the cause is indicated by this message:
<br>&gt;=20
<br>&gt; [ 1108.696688] transfer buffer is on stack
<br>&gt;=20
<br>&gt; The Linux kernel in-tree Comedi USB drivers allocate USB command b=
uffers=20
<br>&gt; from kmalloc memory, due to stack memory not being supported on so=
me=20
<br>&gt; architectures for DMA.=C2=A0 I guess &quot;some architectures&quot=
; now includes=20
<br>&gt; x86-64, which it never used to.
<br>
<br>I&#39;ve pushed a commit to the Comedi GitHub repo to hopefully correct=
 this=20
<br>problem, based on code in the Linux kernel in-tree version of the drive=
r=20
<br>to replace the on-stack buffers with temporary kmalloc&#39;ed buffers=
=20
<br>(actually kzalloc to zero-fill the allocated buffers).
<br>
<br>Please let me know if it works if you get the chance to test it.
<br>
<br>There may be similar problems in the other out-of-tree USB Comedi=20
<br>drivers, but I&#39;m looking into that now.
<br>
<br>--=20
<br>-=3D( Ian Abbott &lt;<a href data-email-masked rel=3D"nofollow">abb...@=
mev.co.uk</a>&gt; || MEV Ltd. is a company  )=3D-
<br>-=3D( registered in England &amp; Wales.  Regd. number: 02862268.  )=3D=
-
<br>-=3D( Regd. addr.: S11 &amp; 12 Building 67, Europa Business Park, )=3D=
-
<br>-=3D( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || <a href=3D"http://www.=
mev.co.uk" target=3D"_blank" rel=3D"nofollow" data-saferedirecturl=3D"https=
://www.google.com/url?hl=3Den-GB&amp;q=3Dhttp://www.mev.co.uk&amp;source=3D=
gmail&amp;ust=3D1759348570030000&amp;usg=3DAOvVaw1CLlQrIV1EWgpXXCsXr0nl">ww=
w.mev.co.uk</a> )=3D-
<br></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;Comedi: Linux Control and Measurement Device Interface&quot; group.<br=
 />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">comedi_=
[email protected]</a>.<br />
To view this discussion visit <a href=3D"https://groups.google.com/d/msgid/=
comedi_list/781f991a-51ad-46d8-b924-2a000b7cfef2n%40googlegroups.com?utm_me=
dium=3Demail&utm_source=3Dfooter">https://groups.google.com/d/msgid/comedi_=
list/781f991a-51ad-46d8-b924-2a000b7cfef2n%40googlegroups.com</a>.<br />

------=_Part_121883_1816700165.1759262286141--

------=_Part_121882_749835560.1759262286141--