Date: Tue, 28 Jun 2022 17:11:49 -0500 From: Jake Freeland <jake@technologyfriends.net> To: Mark Johnston <markj@freebsd.org> Cc: freebsd-hackers@freebsd.org Subject: Re: LinuxKPI debugfs Port Message-ID: <CAOgZAGYNe80kX55E9TxiEK8jz1fnmyMbPfiC8GaueXNobaQd2A@mail.gmail.com> In-Reply-To: <YrtwERomNF9FLEzw@nuc> References: <CAOgZAGaQOhxS0oeM-797fHy3Zs1D4A=hnS3uVYqKnzw4HWn8CA@mail.gmail.com> <YrtwERomNF9FLEzw@nuc>
next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000005048c105e289538c Content-Type: text/plain; charset="UTF-8" Mark, Your reply clears up a lot. I just forked drm-kmod, applied your Makefile patch, and added DEBUGFS to kconfig.mk. I am extremely excited to be back on track, especially now that I know how to proceed. Just to clarify, my job is to extend the current debugfs implementation (debugfs.h and lindebugfs.c) to include the missing functionality required for i915kms to compile and run successfully? I would ask manu@, but he has not responded to me in weeks. I greatly appreciate your explanations about LinuxKPI and lindebugfs. Extensive documentation is what draws me to FreeBSD, but I struggled to find any information regarding lindebugfs or LinuxKPI. I plan to write some of my own when I am done with this project to help others in my position :). Thank you so much, Jake Freeland On Tue, Jun 28, 2022 at 4:18 PM Mark Johnston <markj@freebsd.org> wrote: > On Tue, Jun 28, 2022 at 03:38:48PM -0500, Jake Freeland wrote: > > Hi there, > > > > I am working on porting Intel's igt-gpu-tools drm graphics driver testing > > suite to FreeBSD and I ran into some issues regarding debugfs. I spoke > > to manu@ who told me that CONFIG_DEBUG_FS is required for the > > testing to work properly. I started working on a debugfs port and quickly > > got confused about what manu@ meant by implementing "CONFIG_DEBUG_FS". > > I would guess that he meant to compile the i915kms driver with > CONFIG_DEBUGFS configured. I'm not sure what the "right" way is to do > that, but adding > > KCONFIG+= DEBUGFS > > to the end of kconfig.mk in the drm-kmod repository seems to do the > trick for me, with the caveat that the driver doesn't compile. :) > > I think the task is to get it to compile by extending the existing > debugfs shims in the LinuxKPI, but see my comments below. > > There is also a typo in the makefile there, see > https://github.com/freebsd/drm-kmod/pull/185 > > > Some quick internet searching says that CONFIG_DEBUG_FS is a > > Linux kernel configuration flag. I am curious how I would go about > > implementing this into FreeBSD. I copied the Linux debugfs source > > code into a new repository and attempted to compile it on FreeBSD > > as a kernel module: > > > > https://github.com/jakesfreeland/debugfs-freebsd > > > > Of course I was met with many, many incompatibility errors. I proceeded > > to copy the required `sys/compat/linuxkpi/common/include/linux` headers > > into my repository and I was met with two options: > > Yes, that's not going to work and isn't the right approach. > > > 1. continue modifying the LinuxKPI headers and commit my modifications > > to src. > > > > 2. re-engineer the debugfs source code to comply with the preexisting > > LinuxKPI headers. > > > > Many problems come with both approaches. First, if I modify the LinuxKPI > > headers, I'd be "copying" over some code from Linux's GPLv2 headers. > > I do not know how much I can "copy" before legal issues arise. Second, > > if I re-engineer the debugfs source code, I am revolting against what > > LinuxKPI > > stands for: running Linux code with little-to-no modification. I don't > know > > what the correct approach is here. > > The purpose of the LinuxKPI is to allow Linux _drivers_ to run (mostly) > unmodified on FreeBSD. Generic kernel components like debugfs itself > are not meant to run under the LinuxKPI and are out of its scope. > > debugfs provides a set of interfaces used by drivers, including i915, to > export debug info. The LinuxKPI provides a partial implementation of > that interface already, in debugfs.h and lindebugfs.c, and I think the > task ahead of you is to extend it to allow i915 to compile with DEBUGFS > configured. (But please double check that!) > > > I also discovered that lindebugfs, a curtailed version of Linux's > debugfs, > > already exists in FreeBSD's src. I am led to believe that this is > > exclusively > > used under the Linuxulator so it wouldn't help me. Is this correct? > > No, I don't think that's accurate. It's just another pseudo filesystem, > it can be used by anything that knows how to open and read files. > > > Thank you so much, > > Jake Freeland > --0000000000005048c105e289538c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Mark,<div><br></div><div>Your reply clears up a lot. I jus= t forked drm-kmod, applied your Makefile</div><div>patch, and added DEBUGFS= to <a href=3D"http://kconfig.mk">kconfig.mk</a>. I am extremely=C2=A0excit= ed to be</div><div>back on track, especially now that I know how to proceed= .</div><div><br></div><div>Just to clarify, my job is to extend the current= debugfs implementation</div><div>(debugfs.h and lindebugfs.c) to include t= he missing functionality required</div><div>for i915kms to compile and run = successfully? I would ask manu@, but</div><div>he has not responded to me i= n weeks.</div><div><br></div><div>I greatly appreciate your explanations ab= out LinuxKPI and lindebugfs.</div><div>Extensive documentation=C2=A0is what= draws me to FreeBSD, but I struggled</div><div>to find any information reg= arding lindebugfs or LinuxKPI. I plan to write</div><div>some of my own whe= n I am done with this project to help others in my</div><div>position :).</= div><div><br></div><div>Thank you so much,</div><div>Jake Freeland</div></d= iv><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On = Tue, Jun 28, 2022 at 4:18 PM Mark Johnston <<a href=3D"mailto:markj@free= bsd.org">markj@freebsd.org</a>> wrote:<br></div><blockquote class=3D"gma= il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2= 04,204);padding-left:1ex">On Tue, Jun 28, 2022 at 03:38:48PM -0500, Jake Fr= eeland wrote:<br> > Hi there,<br> > <br> > I am working on porting Intel's igt-gpu-tools drm graphics driver = testing<br> > suite to FreeBSD and I ran into some issues regarding debugfs. I spoke= <br> > to manu@ who told me that CONFIG_DEBUG_FS is required for the<br> > testing to work properly. I started working on a debugfs port and quic= kly<br> > got confused about what manu@ meant by implementing "CONFIG_DEBUG= _FS".<br> <br> I would guess that he meant to compile the i915kms driver with<br> CONFIG_DEBUGFS configured.=C2=A0 I'm not sure what the "right"= ; way is to do<br> that, but adding<br> <br> KCONFIG+=3D DEBUGFS<br> <br> to the end of <a href=3D"http://kconfig.mk" rel=3D"noreferrer" target=3D"_b= lank">kconfig.mk</a> in the drm-kmod repository seems to do the<br> trick for me, with the caveat that the driver doesn't compile. :)<br> <br> I think the task is to get it to compile by extending the existing<br> debugfs shims in the LinuxKPI, but see my comments below.<br> <br> There is also a typo in the makefile there, see<br> <a href=3D"https://github.com/freebsd/drm-kmod/pull/185" rel=3D"noreferrer"= target=3D"_blank">https://github.com/freebsd/drm-kmod/pull/185</a><br> <br> > Some quick internet searching says that CONFIG_DEBUG_FS is a<br> > Linux kernel configuration flag. I am curious how I would go about<br> > implementing this into FreeBSD. I copied the Linux debugfs source<br> > code into a new repository and attempted to compile it on FreeBSD<br> > as a kernel module:<br> > <br> > <a href=3D"https://github.com/jakesfreeland/debugfs-freebsd" rel=3D"no= referrer" target=3D"_blank">https://github.com/jakesfreeland/debugfs-freebs= d</a><br> > <br> > Of course I was met with many, many incompatibility errors. I proceede= d<br> > to copy the required `sys/compat/linuxkpi/common/include/linux` header= s<br> > into my repository and I was met with two options:<br> <br> Yes, that's not going to work and isn't the right approach.<br> <br> > 1. continue modifying the LinuxKPI headers and commit my modifications= <br> > to src.<br> > <br> > 2. re-engineer the debugfs source code to comply with the preexisting<= br> > LinuxKPI headers.<br> > <br> > Many problems come with both approaches. First, if I modify the LinuxK= PI<br> > headers, I'd be "copying" over some code from Linux'= s GPLv2 headers.<br> > I do not know how much I can "copy" before legal issues aris= e. Second,<br> > if I re-engineer the debugfs source code, I am revolting against what<= br> > LinuxKPI<br> > stands for: running Linux code with little-to-no modification. I don&#= 39;t know<br> > what the correct approach is here.<br> <br> The purpose of the LinuxKPI is to allow Linux _drivers_ to run (mostly)<br> unmodified on FreeBSD.=C2=A0 Generic kernel components like debugfs itself<= br> are not meant to run under the LinuxKPI and are out of its scope.<br> <br> debugfs provides a set of interfaces used by drivers, including i915, to<br= > export debug info.=C2=A0 The LinuxKPI provides a partial implementation of<= br> that interface already, in debugfs.h and lindebugfs.c, and I think the<br> task ahead of you is to extend it to allow i915 to compile with DEBUGFS<br> configured.=C2=A0 (But please double check that!)<br> <br> > I also discovered that lindebugfs, a curtailed version of Linux's = debugfs,<br> > already exists in FreeBSD's src. I am led to believe that this is<= br> > exclusively<br> > used under the Linuxulator so it wouldn't help me. Is this correct= ?<br> <br> No, I don't think that's accurate.=C2=A0 It's just another pseu= do filesystem,<br> it can be used by anything that knows how to open and read files.<br> <br> > Thank you so much,<br> > Jake Freeland<br> </blockquote></div> --0000000000005048c105e289538c--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOgZAGYNe80kX55E9TxiEK8jz1fnmyMbPfiC8GaueXNobaQd2A>