Date: Fri, 19 Jan 2024 11:19:47 -0700 From: Warner Losh <imp@bsdimp.com> To: Alan Somers <asomers@freebsd.org> Cc: Enji Cooper <yaneurabeya@gmail.com>, src-committers <src-committers@freebsd.org>, "<dev-commits-src-all@freebsd.org>" <dev-commits-src-all@freebsd.org>, "<dev-commits-src-main@freebsd.org>" <dev-commits-src-main@freebsd.org> Subject: Re: git: 8bae22bbbe65 - main - fusefs: prefer new/delete over malloc/free Message-ID: <CANCZdfo2%2BKpr8iHD-5ejPn2237CyXt0CALr1zNXW7Hr0tL%2BFwg@mail.gmail.com> In-Reply-To: <CAOtMX2iN-74op3de9vyWw4d59uV1B=hN9cid6_x24ymJskf1=Q@mail.gmail.com> References: <202401172250.40HMo4O9003460@gitrepo.freebsd.org> <8F36170D-9592-46D5-A275-12E24C3A13D8@gmail.com> <CAOtMX2j8mn1mRh0HzqS_uL5zuDKhXsgLvBRR5h1PX_fuEo3FtQ@mail.gmail.com> <CAOtMX2iN-74op3de9vyWw4d59uV1B=hN9cid6_x24ymJskf1=Q@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--00000000000015c6b8060f50870e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 19, 2024, 8:39=E2=80=AFAM Alan Somers <asomers@freebsd.org> wro= te: > On Fri, Jan 19, 2024 at 6:56=E2=80=AFAM Alan Somers <asomers@freebsd.org>= wrote: > > > > On Thu, Jan 18, 2024 at 10:32=E2=80=AFPM Enji Cooper <yaneurabeya@gmail= .com> > wrote: > > > > > > > > > > On Jan 17, 2024, at 2:50=E2=80=AFPM, Alan Somers <asomers@FreeBSD.o= rg> > wrote: > > > > > > > > The branch main has been updated by asomers: > > > > > > > > URL: > https://cgit.FreeBSD.org/src/commit/?id=3D8bae22bbbe6571da9259e0d43ffa8a5= 6f4b3e171 > > > > > > > > commit 8bae22bbbe6571da9259e0d43ffa8a56f4b3e171 > > > > Author: Alan Somers <asomers@FreeBSD.org> > > > > AuthorDate: 2024-01-15 23:49:47 +0000 > > > > Commit: Alan Somers <asomers@FreeBSD.org> > > > > CommitDate: 2024-01-17 22:49:41 +0000 > > > > > > > > fusefs: prefer new/delete over malloc/free > > > > > > > > MFC after: 2 weeks > > > > Reviewed by: kib > > > > Differential Revision: https://reviews.freebsd.org/D43464 > > > > > > Why not use smart pointers instead? > > > -Enji > > > > Only because this stuff all evolved from C code. Smart pointers would > > certainly work. > > Actually, TBH it's because I'm not real great with C++. It's a > difficult language, and after 2016 I stopped even trying to improve my > C++ skills. Instead, I've been focusing on Rust. Even when I wrote > these tests in 2019, I strongly considered using Rust instead of C++. > In the end, the only thing that forced me to use C++ is because I > wanted them to live in the base system, rather than in ports. > > I still dream about the day when Rust is allowed in the base system. > If it were, then in addition to these tests, I would've converted > gstat to Rust (rather than add sysutils/gstat-rs to ports), added the > nfs-exporter (instead of putting it in net-mgmt/nfs-exporter), added a > ctl-exporter (which is impossible to do in ports, so I had to do that > one in C), and converted tools/regression/fsx in place (instead of > putting in devel/fsx-rs). Maybe a couple of other things, too. Like > ztop, or the geom-exporter that I have half-written. I've also been > tempted to rewrite zfsd in Rust. > > Alas, I sense that there is little appetite for bringing Rust into contri= b. > I'd love there to be more tests written. One of the problems (one of many) with the tests is they are build during buildworld. This constrains them a bit too much, imho. While we can add a bunch of tests that are written in interpreted languages like python, per= l or pdksh, it's harder to add one written in an alternative language that's then compiled. Sometimes I think we should have a separate buildtests installtests which assume a post-installworld environment. That would let us build go, rust, etc tests. Though managing the crates, etc for the build might prove to be an interesting, though ports manage fairly well with carefully constructed packages. Rust is still evolving quickly relative to C. While C++ is also, it's not widely used in the tree so that evolution doesn't matter so much (though devd likely needs a full re-write) For rust to be considered in base, the community of developers likely would need to see visible success stories. While the ports that do the testing you mentioned are a good start, I'm of the opinion that having in-tree rust test cases would be helpful. Though there's no rust integration for kyua / ATF right now. I'd love to find some way to make this happen, possibly with the requirement that pkg install rust be done prior to the build, to show it's possible and to raise awareness of rust's viability and to shake out the inevitable growing pains that this will necessarily case. Tests are a good place to start since we already have a high burden on the users of the tests in terms of packages installed. We could have an opt-in set of rust tests that would fail if you didn't have the right ports installed (which we could encode into a metaport to keep it easy). But rust, itself, in the base has a lot of logistical issues since it isn't quite supported in llvm out of the box (I see john's note just now touching on this as well). But to put up with the logistical issues, there needs to be clearly demonstrated wins in our environment first, imho. I really, though, would be concerned if this means we go from 2 llvm builds to 4. Warner > --00000000000015c6b8060f50870e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div dir=3D"auto"><div><br><br><div class=3D"gmail_quote">= <div dir=3D"ltr" class=3D"gmail_attr">On Fri, Jan 19, 2024, 8:39=E2=80=AFAM= Alan Somers <<a href=3D"mailto:asomers@freebsd.org" target=3D"_blank">a= somers@freebsd.org</a>> wrote:<br></div><blockquote class=3D"gmail_quote= " style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">O= n Fri, Jan 19, 2024 at 6:56=E2=80=AFAM Alan Somers <<a href=3D"mailto:as= omers@freebsd.org" rel=3D"noreferrer" target=3D"_blank">asomers@freebsd.org= </a>> wrote:<br> ><br> > On Thu, Jan 18, 2024 at 10:32=E2=80=AFPM Enji Cooper <<a href=3D"ma= ilto:yaneurabeya@gmail.com" rel=3D"noreferrer" target=3D"_blank">yaneurabey= a@gmail.com</a>> wrote:<br> > ><br> > ><br> > > > On Jan 17, 2024, at 2:50=E2=80=AFPM, Alan Somers <asomers= @FreeBSD.org> wrote:<br> > > ><br> > > > The branch main has been updated by asomers:<br> > > ><br> > > > URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D8b= ae22bbbe6571da9259e0d43ffa8a56f4b3e171" rel=3D"noreferrer noreferrer" targe= t=3D"_blank">https://cgit.FreeBSD.org/src/commit/?id=3D8bae22bbbe6571da9259= e0d43ffa8a56f4b3e171</a><br> > > ><br> > > > commit 8bae22bbbe6571da9259e0d43ffa8a56f4b3e171<br> > > > Author:=C2=A0 =C2=A0 =C2=A0Alan Somers <asomers@FreeBSD.o= rg><br> > > > AuthorDate: 2024-01-15 23:49:47 +0000<br> > > > Commit:=C2=A0 =C2=A0 =C2=A0Alan Somers <asomers@FreeBSD.o= rg><br> > > > CommitDate: 2024-01-17 22:49:41 +0000<br> > > ><br> > > >=C2=A0 =C2=A0 fusefs: prefer new/delete over malloc/free<br> > > ><br> > > >=C2=A0 =C2=A0 MFC after:=C2=A0 =C2=A0 =C2=A0 2 weeks<br> > > >=C2=A0 =C2=A0 Reviewed by:=C2=A0 =C2=A0 kib<br> > > >=C2=A0 =C2=A0 Differential Revision: <a href=3D"https://revie= ws.freebsd.org/D43464" rel=3D"noreferrer noreferrer" target=3D"_blank">http= s://reviews.freebsd.org/D43464</a><br> > ><br> > > Why not use smart pointers instead?<br> > > -Enji<br> ><br> > Only because this stuff all evolved from C code.=C2=A0 Smart pointers = would<br> > certainly work.<br> <br> Actually, TBH it's because I'm not real great with C++.=C2=A0 It= 9;s a<br> difficult language, and after 2016 I stopped even trying to improve my<br> C++ skills.=C2=A0 Instead, I've been focusing on Rust.=C2=A0 Even when = I wrote<br> these tests in 2019, I strongly considered using Rust instead of C++.<br> In the end, the only thing that forced me to use C++ is because I<br> wanted them to live in the base system, rather than in ports.<br> <br> I still dream about the day when Rust is allowed in the base system.<br> If it were, then in addition to these tests, I would've converted<br> gstat to Rust (rather than add sysutils/gstat-rs to ports), added the<br> nfs-exporter (instead of putting it in net-mgmt/nfs-exporter), added a<br> ctl-exporter (which is impossible to do in ports, so I had to do that<br> one in C), and converted tools/regression/fsx in place (instead of<br> putting in devel/fsx-rs).=C2=A0 Maybe a couple of other things, too.=C2=A0 = Like<br> ztop, or the geom-exporter that I have half-written.=C2=A0 I've also be= en<br> tempted to rewrite zfsd in Rust.<br> <br> Alas, I sense that there is little appetite for bringing Rust into contrib.= <br></blockquote></div></div><div dir=3D"auto"><br></div><div>I'd love = there to be more tests written.</div><div><br></div><div>One of the problem= s (one of many) with the tests is they are build during</div><div>buildworl= d. This constrains them a bit too much, imho. While we can add</div><div>a = bunch of tests that are written in interpreted languages like python, perl<= /div><div>or pdksh, it's harder to add one written in an alternative la= nguage that's</div><div>then compiled. Sometimes I think we should have= a separate buildtests</div><div>installtests=C2=A0which assume a post-inst= allworld environment. That would let</div><div>us build go, rust, etc tests= . Though managing the crates, etc for the build</div><div>might prove to be= an interesting, though ports manage fairly well with carefully</div><div>c= onstructed packages.</div><div><br></div><div>Rust is still evolving quickl= y relative to C. While C++ is also, it's not widely</div><div>used in t= he tree so that evolution doesn't matter so much (though devd</div><div= >likely needs a full re-write)</div><div><br></div><div>For rust to be cons= idered=C2=A0in base, the community=C2=A0of developers=C2=A0likely</div><div= >would need to see visible success stories. While the ports that do</div><d= iv>the testing you mentioned are a good start, I'm of the opinion that<= /div><div>having in-tree rust test cases would be helpful. Though there'= ;s no</div><div>rust integration for kyua / ATF right now. I'd love to = find some way to</div><div>make this happen, possibly with the requirement = that pkg install rust</div><div>be done prior to the build, to show it'= s possible and to raise awareness</div><div>of rust's viability and to = shake out the inevitable growing pains that</div><div>this will necessarily= case. Tests are a good place to start since</div><div>we already have a hi= gh burden on the users of the tests in terms of</div><div>packages installe= d. We could have an opt-in set of rust tests that</div><div>would fail if y= ou didn't have the right ports installed (which we could</div><div>enco= de into a metaport to keep it easy).</div><div><br></div><div>But rust, its= elf, in the base has a lot of logistical issues since it isn't</div><di= v>quite supported in llvm out of the box (I see john's note just now to= uching</div><div>on this as well). But to put up with the logistical issues= , there needs to</div><div>be clearly demonstrated wins in our environment = first, imho. I really,</div><div>though, would be concerned if this means w= e go from 2 llvm builds to 4.</div><div><br></div><div>Warner</div><div dir= =3D"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" styl= e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> </blockquote></div></div></div> </div> --00000000000015c6b8060f50870e--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfo2%2BKpr8iHD-5ejPn2237CyXt0CALr1zNXW7Hr0tL%2BFwg>