Re: [PATCH V5 2/2] scsi: ufs: Add configfs support for ufs provisioning

From: Bart Van Assche
Date: Tue Jul 17 2018 - 17:06:44 EST


On Tue, 2018-07-17 at 13:23 -0700, Evan Green wrote:
+AD4- On Mon, Jul 16, 2018 at 5:04 PM Bart Van Assche +ADw-Bart.VanAssche+AEA-wdc.com+AD4- wrote:
+AD4- +AD4-
+AD4- +AD4- On Mon, 2018-07-16 at 16:46 -0700, Evan Green wrote:
+AD4- +AD4- +AD4- I see Bart has chimed in on the next series with a suggestion to break
+AD4- +AD4- +AD4- out each field into individual files within configfs. Bart, what are
+AD4- +AD4- +AD4- your feelings about converting to a binary attribute? I remember when
+AD4- +AD4- +AD4- I did my sysfs equivalent of this patch, somebody chimed in indicating
+AD4- +AD4- +AD4- a +ACI-commit+ACI- file might be needed so that the new configuration could be
+AD4- +AD4- +AD4- written in one fell swoop. One advantage of the binary attribute is
+AD4- +AD4- +AD4- that it writes the configuration atomically.
+AD4- +AD4-
+AD4- +AD4- Hello Evan,
+AD4- +AD4-
+AD4- +AD4- I may be missing some UFS background information. But since a configfs interface
+AD4- +AD4- is being added I think the same rule applies as to all Linux kernel user space
+AD4- +AD4- interfaces, namely that it should be backwards compatible. Additionally, if
+AD4- +AD4- anyone ever will want to use this interface from a shell script, I think that
+AD4- +AD4- it will be much easier to write multiple ASCII attributes than a single binary
+AD4- +AD4- attribute.
+AD4- +AD4-
+AD4-
+AD4- Hi Bart,
+AD4- I'm unsure about the compatibility aspect for binary attributes that
+AD4- essentially represent direct windows into hardware. I suppose this
+AD4- comes down to who this interface is most useful to. Hypothetically
+AD4- lets say a future revision of UFS adds fields to the configuration
+AD4- descriptor, but is otherwise backwards compatible. If this interface
+AD4- is primarily for OEMs initializing their devices in the factory, then
+AD4- I'd argue they'd want the most direct window to the configuration
+AD4- descriptor. These folks probably just have a configuration they want
+AD4- to plunk into the hardware, and would prefer being able to write all
+AD4- fields over having some sort of compatibility restriction. If, on the
+AD4- other hand, this is used by long-running scripts that stick around for
+AD4- years without modification, then yes, it seems like it would be more
+AD4- important to stay compatible, and have smarts in the kernel to make
+AD4- writes of old descriptors work in new devices.
+AD4-
+AD4- At least for myself, I fall into the category of someone who just
+AD4- needs to plunk a configuration descriptor in once, and would prefer
+AD4- not to have to submit kernel changes if the descriptor evolves
+AD4- slightly. It also seemed a little odd that this patch now spends a
+AD4- bunch of energy converting ASCII into bytes, just to write it without
+AD4- modification into the hardware, and convert back again to ASCII for
+AD4- reads.
+AD4-
+AD4- We plan to use a script for provisioning, and could easily handle
+AD4- ASCII or rawbytes:
+AD4-
+AD4- +ACM- Some bytes, ready to go with the interface today...
+AD4- some+AF8-bytes+AD0AIg-00 01 02 03+ACI-
+AD4-
+AD4- +ACM- Same bytes, now in binary format
+AD4- bytes+AF8-fmt+AD0AJA-(echo +ACI- +ACQ-some+AF8-bytes+ACI- +AHw- sed 's/ /+AFwAXA-x/g')
+AD4- /usr/bin/printf +ACIAJA-bytes+AF8-fmt+ACI- +AD4- /configfs/ufs+AF8-provision
+AD4-
+AD4- I'm not dead set on binary, since as above I could do it either way,
+AD4- but it seemed worth at least talking through. Let me know what you
+AD4- think.

The configfs documentation (Documentation/filesystems/configfs/configfs.txt)
is clear about this: +ACI-Preferably only one value per file should be used.+ACI- So
I would like to hear the opinion of someone who has more authority than I
with regard to configfs.

Bart.