Date: Sun, 6 Apr 2025 20:39:10 -0600 From: Warner Losh <imp@bsdimp.com> To: j_yoon.choi@samsung.com Cc: "freebsd-hackers@FreeBSD.org" <freebsd-hackers@freebsd.org> Subject: Re: Universal Flash Storage Driver Proposal Message-ID: <CANCZdfppZRLd3v=6jrBiCHdZUa8ixEfzE2CxmB6Ktx%2BTHHqbiQ@mail.gmail.com> In-Reply-To: <20250314052853epcms2p77524d50719009d62188486032c30f6c5@epcms2p7> References: <CGME20250314052853epcms2p77524d50719009d62188486032c30f6c5@epcms2p7> <20250314052853epcms2p77524d50719009d62188486032c30f6c5@epcms2p7>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --] On Thu, Mar 13, 2025 at 11:28 PM Jaeyoon Choi <j_yoon.choi@samsung.com> wrote: > Hi Warner, > I'm back in the office :). > > > I've been studying UMASS and have a different idea. I'm starting to not > > like the PIM flags > > now that I've read it. > > > > There's about a dozen commands that different USB flash devices can't do > in > > various ways. > > I've started to convert umass to just fail the command as illegal when a > > bad command is > > sent to it. I've also been modifying the da, cd, etc drivers to notice > the > > illegal commands and > > modify its behavior. It isn't a new idea: the periph drivers have been > > doing it to cope with > > drives that don't support READ(6) commands. It's recently (in the last 5 > > years) expanded to > > dealing with other commands like SYNCHRONIZE CACHE, MODE SENSE. > > > > The idea is to allow the device to reject the command as illegal. In the > > cases of reduced SCSI > > command sets, like RBC, UFS, etc the SIM should reject known bad commands > > at the SIM > > layer because history has shown that some of the > > lower-quality-but-still-working-enough drives > > can hang when unexpected commands are sent to them. > > > > Not supporting MODE SENSE(6) likely is going to be a somewhat larger > change. > > I will follow up on your UMASS modification. > And if you give me a guide, I'll follow it > Yes. Changing MODE SENSE(6) to MODE SENSE(10) likely will cause problems with some completion routines, but that's fixable. I'm about to commit a number of changes that will show how to 'reject' commands properly. > > Test how? I'm not sure I understand this question well enough to answer, > > so maybe a few examples will help me focus an answer. > > I was wondering how you do unit tests and integration tests for device > drivers. > Is there a framework to write unit tests when developing a device driver? > Is there any tool you use for Integration test (e.g. FIO(flexible I/O > tester)) > (I'm a FreeBSD newbie, so please forgive me if this is a stupid question). > FIO would work. It will do the basic I/O. But it destroys the data on the drive. For testing purposes, though, it's fine. > > In the mean time, I'll see if I can locate a copy of the UFS standard > > or a reasonable summary. The ones at jedec.org are a bit too expensive > > for me to buy on my own. I've found excerpts of it datasheets at best, > which > > may suffice for my review needs. > > If you register with JEDEC, you can get the documentation for UFS 2.1 > version > for free, although it is not the latest spec. > There are two documents to look at for the UFS specification. > UFSHCI, which is the host interface, and UFS, which is the device. > - UFS 2.1 spec: https://www.jedec.org/system/files/docs/JESD220C-2_1.pdf > - UFSHCI 2.1 spec: > https://www.jedec.org/sites/default/files/docs/JESD223C.pdf I've grabbed these. Thanks. I also found some vague command lists for newer versions in data sheets. My implementation will be based on UFS 4.1, but the basics are the same. > The main differences between UFS 2.1 and 4.1 are as follows > - I/O queue changed from single queue to multi-queue > - Maximum HS-GEAR changed from 3 -> 5, which improves bandwidth > - Supports Write Booster (SLC caching) > - Supports Host Performance Booster (HPB) > > I will explain the specification changes when I request a review of the > features added in UFS 4.1. > Great! That would be perfect. The last two look interesting... Warner > Thanks, > Jaeyoon > [-- Attachment #2 --] <div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Thu, Mar 13, 2025 at 11:28 PM Jaeyoon Choi <<a href="mailto:j_yoon.choi@samsung.com">j_yoon.choi@samsung.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Warner,<br> I'm back in the office :).<br> <br> > I've been studying UMASS and have a different idea. I'm starting to not<br> > like the PIM flags<br> > now that I've read it.<br> > <br> > There's about a dozen commands that different USB flash devices can't do in<br> > various ways.<br> > I've started to convert umass to just fail the command as illegal when a<br> > bad command is<br> > sent to it. I've also been modifying the da, cd, etc drivers to notice the<br> > illegal commands and<br> > modify its behavior. It isn't a new idea: the periph drivers have been<br> > doing it to cope with<br> > drives that don't support READ(6) commands. It's recently (in the last 5<br> > years) expanded to<br> > dealing with other commands like SYNCHRONIZE CACHE, MODE SENSE.<br> > <br> > The idea is to allow the device to reject the command as illegal. In the<br> > cases of reduced SCSI<br> > command sets, like RBC, UFS, etc the SIM should reject known bad commands<br> > at the SIM<br> > layer because history has shown that some of the<br> > lower-quality-but-still-working-enough drives<br> > can hang when unexpected commands are sent to them.<br> > <br> > Not supporting MODE SENSE(6) likely is going to be a somewhat larger change.<br> <br> I will follow up on your UMASS modification.<br> And if you give me a guide, I'll follow it<br></blockquote><div><br></div><div>Yes. Changing MODE SENSE(6) to MODE SENSE(10) likely will cause problems</div><div>with some completion routines, but that's fixable.</div><div><br></div><div>I'm about to commit a number of changes that will show how to 'reject' commands</div><div>properly.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> > Test how? I'm not sure I understand this question well enough to answer,<br> > so maybe a few examples will help me focus an answer.<br> <br> I was wondering how you do unit tests and integration tests for device drivers.<br> Is there a framework to write unit tests when developing a device driver?<br> Is there any tool you use for Integration test (e.g. FIO(flexible I/O tester))<br> (I'm a FreeBSD newbie, so please forgive me if this is a stupid question).<br></blockquote><div><br></div><div>FIO would work. It will do the basic I/O. But it destroys the data on the drive.</div><div>For testing purposes, though, it's fine.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> > In the mean time, I'll see if I can locate a copy of the UFS standard<br> > or a reasonable summary. The ones at <a href="http://jedec.org" rel="noreferrer" target="_blank">jedec.org</a> are a bit too expensive<br> > for me to buy on my own. I've found excerpts of it datasheets at best, which<br> > may suffice for my review needs.<br> <br> If you register with JEDEC, you can get the documentation for UFS 2.1 version <br> for free, although it is not the latest spec.<br> There are two documents to look at for the UFS specification. <br> UFSHCI, which is the host interface, and UFS, which is the device.<br> - UFS 2.1 spec: <a href="https://www.jedec.org/system/files/docs/JESD220C-2_1.pdf" rel="noreferrer" target="_blank">https://www.jedec.org/system/files/docs/JESD220C-2_1.pdf</a><br> - UFSHCI 2.1 spec: <a href="https://www.jedec.org/sites/default/files/docs/JESD223C.pdf" rel="noreferrer" target="_blank">https://www.jedec.org/sites/default/files/docs/JESD223C.pdf</a></blockquote><div><br></div><div>I've grabbed these. Thanks. I also found some vague command lists for newer</div><div>versions in data sheets.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> My implementation will be based on UFS 4.1, but the basics are the same.<br> The main differences between UFS 2.1 and 4.1 are as follows<br> - I/O queue changed from single queue to multi-queue<br> - Maximum HS-GEAR changed from 3 -> 5, which improves bandwidth<br> - Supports Write Booster (SLC caching)<br> - Supports Host Performance Booster (HPB)<br> <br> I will explain the specification changes when I request a review of the<br> features added in UFS 4.1.<br></blockquote><div><br></div><div>Great! That would be perfect. The last two look interesting...</div><div><br></div><div>Warner</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> Thanks,<br> Jaeyoon<br> </blockquote></div></div>home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfppZRLd3v=6jrBiCHdZUa8ixEfzE2CxmB6Ktx%2BTHHqbiQ>
