gendisk and lightnvm
Hi Jens, Christoph, and Keith,
I have been pondering for a couple of weeks on how to integrate lightnvm into the sysfs stack. Lightnvm does not currently expose a "physical" device. During device registration, the block device name is simply stored, which the user may then use as an id later, and expose through a target implementation.
Until then, the device is left "dangling" in the kernel, without any good way to reference it other than asking the lightnvm manager. This also includes device driver specific configuration, such as power and mq sysfs entries.
It would be great to have a common way to expose the lightnvm subsystem through the block storage stack.
With block devices, the device driver centric information includes:
/sys/block/*/
inflight
removable
serial
/mq
/power
Simon has currently built an RFC patch that wires lightnvm devices up in /sys/devices/virtual/misc/lightnvm/*, without any access to the above entries.
What would be the best way to approach this?
1. Simply set genhd device capacity to 0, and let entries and block device be exposed through the common stack.
2. Add a GENHD_FL_BLKLESS_DEV flag, and use it in genhd.c and block layer to filter out block device specific entries.
3. Write a shim layer that exposes a semi genhd, with only the device driver sysfs entries exposed.
4. Any other?
Thank you,
Matias
On Mon, May 23, 2016 at 12:24 AM, Matias Bj=C3=B8rling <[email protected]> wrot= e:
Quoted 5 lines
Hi Jens, Christoph, and Keith,
I have been pondering for a couple of weeks on how to integrate lightnvm into the sysfs stack. Lightnvm does not currently expose a "physical" device. During device registration, the block device name is simply store=
d,
Quoted 11 lines
which the user may then use as an id later, and expose through a target implementation.
Until then, the device is left "dangling" in the kernel, without any good way to reference it other than asking the lightnvm manager. This also includes device driver specific configuration, such as power and mq sysfs entries.
It would be great to have a common way to expose the lightnvm subsystem through the block storage stack.
Quoted 8 lines
With block devices, the device driver centric information includes:
/sys/block/*/
inflight
removable
serial
/mq
/power
Which of these attributes do you need to access before the device is live?
Quoted 3 lines
Simon has currently built an RFC patch that wires lightnvm devices up in
/sys/devices/virtual/misc/lightnvm/*, without any access to the above entries.
This seems inverted, shouldn't lightnvm be a child of the device + driver that uses the api?
Quoted 19 lines · Dan Williams
Quoted 18 lines · Matias Bjørling
Hi Jens, Christoph, and Keith,
I have been pondering for a couple of weeks on how to integrate lightnvm into the sysfs stack. Lightnvm does not currently expose a "physical" device. During device registration, the block device name is simply stored, which the user may then use as an id later, and expose through a target implementation.
Until then, the device is left "dangling" in the kernel, without any good way to reference it other than asking the lightnvm manager. This also includes device driver specific configuration, such as power and mq sysfs entries.
It would be great to have a common way to expose the lightnvm subsystem through the block storage stack.
With block devices, the device driver centric information includes:
Quoted 9 lines
Quoted 6 lines
/sys/block/*/
inflight
removable
serial
/mq
/powerWhich of these attributes do you need to access before the device is live?
Hi Dan,
/mq would be great. That would make possible to know the status of the NVMe queues when used by targets. With the current design, the NVMe driver /mq is never exposed through sysfs, and the targets that exposes itself as a block device initializes their private genhd.
Quoted 7 lines
Quoted 3 lines
Simon has currently built an RFC patch that wires lightnvm devices up in
/sys/devices/virtual/misc/lightnvm/*, without any access to the above entries.This seems inverted, shouldn't lightnvm be a child of the device + driver that uses the api?
It could. It is placed above to allow multiple targets (FTLs) on top of a device, or a target can be across many drives.
On Thu, May 26, 2016 at 11:10 AM, Matias Bj=C3=B8rling <[email protected]> wrot= e:
Quoted 3 lines · Dan Williams
Quoted 2 lines
On Mon, May 23, 2016 at 12:24 AM, Matias Bj=C3=B8rling <[email protected]> w=
rote:
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Hi Jens, Christoph, and Keith,
I have been pondering for a couple of weeks on how to integrate lightnv=
m
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
into the sysfs stack. Lightnvm does not currently expose a "physical" device. During device registration, the block device name is simply stored,
which the user may then use as an id later, and expose through a target implementation.Until then, the device is left "dangling" in the kernel, without any go=
od
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
way to reference it other than asking the lightnvm manager. This also includes device driver specific configuration, such as power and mq sys=
fs
Quoted 15 lines
Quoted 15 lines
Quoted 13 lines
entries.
It would be great to have a common way to expose the lightnvm subsystem through the block storage stack.
With block devices, the device driver centric information includes:
/sys/block/*/
inflight
removable
serial
/mq
/power
Quoted 1 line
Quoted 1 line
Which of these attributes do you need to access before the device is liv=
e?
Quoted 5 lines
Quoted 1 line
Hi Dan,
/mq would be great. That would make possible to know the status of the NV=
Me
Quoted 1 line
queues when used by targets. With the current design, the NVMe driver /mq=
is
Quoted 1 line
never exposed through sysfs, and the targets that exposes itself as a blo=
ck
Quoted 1 line
device initializes their private genhd.
Hmm, the queue exists before the gendisk so it seems reasonable to register/publish mq/ sysfs before the gendisk arrives. I.e. both the gendisk and the pre-gendisk lightnvm device end up referencing the same request_queue.
Quoted 42 lines · Dan Williams
Quoted 34 lines · Matias Bjørling
Quoted 30 lines · Dan Williams
Quoted 18 lines · Matias Bjørling
Hi Jens, Christoph, and Keith,
I have been pondering for a couple of weeks on how to integrate lightnvm into the sysfs stack. Lightnvm does not currently expose a "physical" device. During device registration, the block device name is simply stored,
which the user may then use as an id later, and expose through a target implementation.Until then, the device is left "dangling" in the kernel, without any good way to reference it other than asking the lightnvm manager. This also includes device driver specific configuration, such as power and mq sysfs entries.
It would be great to have a common way to expose the lightnvm subsystem through the block storage stack.
Quoted 8 lines
With block devices, the device driver centric information includes:
/sys/block/*/inflight removable serial /mq /powerQuoted 2 lines
Which of these attributes do you need to access before the device is live?
Quoted 6 lines
Hi Dan,
/mq would be great. That would make possible to know the status of the NVMe queues when used by targets. With the current design, the NVMe driver /mq is never exposed through sysfs, and the targets that exposes itself as a block device initializes their private genhd.
Quoted 5 lines
Hmm, the queue exists before the gendisk so it seems reasonable to register/publish mq/ sysfs before the gendisk arrives. I.e. both the gendisk and the pre-gendisk lightnvm device end up referencing the same
request_queue.
In that case, the holder kobject is maintained by the request queue. That moves the block device naming earlier in the initialization process, and the request queue would properly need to hold the (struct gendisk)->diskname. I wonder if there is a better way.
On Thu, May 26, 2016 at 2:50 PM, Matias Bj=C3=B8rling <[email protected]> wrote= :
Quoted 1 line · Dan Williams
[..]
Quoted 2 lines
In that case, the holder kobject is maintained by the request queue. That moves the block device naming earlier in the initialization process, and =
the
Quoted 1 line
request queue would properly need to hold the (struct gendisk)->diskname.=
I
Quoted 1 line
wonder if there is a better way.
I don't see why it is necessary to move the block device naming earlier. The block device kobject can link to the mq/ kobject created by lightnvm rather than include it as a child of the gendisk.
Quoted 12 lines · Dan Williams
Quoted 1 line · Matias Bjørling
On 05/26/2016 09:05 PM, Dan Williams wrote:
[..]
Quoted 4 lines
In that case, the holder kobject is maintained by the request queue. That moves the block device naming earlier in the initialization process, and the request queue would properly need to hold the (struct gendisk)->diskname. I wonder if there is a better way.
I don't see why it is necessary to move the block device naming earlier. The block device kobject can link to the mq/ kobject created by lightnvm rather than include it as a child of the gendisk.
You're right. I'll cook up some RFC patches with the changes. Thanks.