From: james_p_freyensee@linux.intel.com (J Freyensee)
Subject: [PATCH 18/18] nvme: move chardev and sysfs interface to common code
Date: Thu, 22 Oct 2015 11:36:19 -0700 [thread overview]
Message-ID: <1445538979.2750.14.camel@linux.intel.com> (raw)
In-Reply-To: <20151022074529.GE20076@lst.de>
On Thu, 2015-10-22@09:45 +0200, Christoph Hellwig wrote:
> On Wed, Oct 21, 2015@05:11:11PM -0700, J Freyensee wrote:
> > > + spin_lock(&dev_list_lock);
> > > + list_for_each_entry(ctrl, &nvme_ctrl_list, node) {
> >
> > list_for_each_entry_safe() and/or some type of lock access?
>
> list_for_each_entry_safe does not synchronize, it just ensures you
> can continue to iterate after deleting the current item.
>
> And the spin_lock() call above provides the required synchronization.
>
> > > + if (result < 0)
> > > + goto unregister_blkdev;
> > > + else if (result > 0)
> > > + nvme_char_major = result;
> > > +
> > > + nvme_class = class_create(THIS_MODULE, "nvme");
> >
> > It would be better to have "nvme" as a #define somewhere, probably
> > in
> > the .h?
>
> Why?
Well, for starters, it's good practice to have strings like this in a
#define.
I can send a patch to redefine this and 0x4E564D65 in the nvme.h.
>
> > > char name[12];
> > > char serial[20];
> > > @@ -60,6 +59,8 @@ struct nvme_ctrl {
> > > u16 abort_limit;
> > > u8 event_limit;
> > > u8 vwc;
> > > + u32 vs;
> > > + bool subsystem;
> >
> > OK, so 'bool subsystem' got added back in. Not sure still how a
> > bool
> > helps define a controller into a given subsystem. Isn't the
> > definition
> > of an NVM subsystem 1 or more controllers? So every new 'struct
> > nvme_ctrl' instance is going to set this to 'true'?
>
> In NVMe 1.0 the concept of subsystems didn't exist. Now strictly
> speaking
> what we care about here is if a subsystem _reset_ is supported, but
> I've
> kept the name from the existing code for now.
OK understood.
>
> > Or looking into the future, say if this is on a future fabric
> > connection, there could be lots of controllers under lots of
> > distinct
> > subsystems. Then I don't know how 'bool subsystem' makes sense and
> > distinguishes a controller in a given NVM subsystem.
>
> That's not what the flag is used for. It just indicates if we can do
> a subsystem reset.
>
> > > @@ -87,7 +88,9 @@ struct nvme_ns {
> > > struct nvme_ctrl_ops {
> > > int (*reg_read32)(struct nvme_ctrl *ctrl, u32 off, u32
> > > *val);
> > > int (*reg_read64)(struct nvme_ctrl *ctrl, u32 off, u64
> > > *val);
> > > + int (*reg_write32)(struct nvme_ctrl *ctrl, u32 off, u32
> > > val);
> >
> > I don't think they are being used currently, but the ACQ and ASQ 8
> > -byte
> > registers do have RW fields. Maybe add "int (*reg_write64)()" as
> > well?
>
> We can do that once we actually need it. But at least ACQ and ASQ
> are
> deeply tied to PCI specific initialization so right now there is no
> need
> for that.
>
> > > bool (*io_incapable)(struct nvme_ctrl *ctrl);
> > > + int (*reset_ctrl)(struct nvme_ctrl *ctrl);
> >
> > Probably would want a "(*shutdown_ctrl)()" as well?
>
> We currently don't shut the controller down from generic code, so
> until
> we have a state machine that might do that there's no need for that.
>
> >
> > > + return ctrl->ops->reg_write32(ctrl, NVME_REG_NSSR,
> > > 0x4E564D65);
> >
> > It would be really good to have the hex value in a #define, most
> > likely
> > located in the nvme.h file.
>
> Feel free to send incremental patches for these sorts of cleanups!
next prev parent reply other threads:[~2015-10-22 18:36 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-16 5:58 nvme driver split V2 Christoph Hellwig
2015-10-16 5:58 ` [PATCH 01/18] nvme: add missing unmaps in nvme_queue_rq Christoph Hellwig
2015-10-20 10:04 ` Sagi Grimberg
2015-10-20 14:07 ` Busch, Keith
2015-10-16 5:58 ` [PATCH 02/18] nvme: move struct nvme_iod to pci.c Christoph Hellwig
2015-10-20 10:04 ` Sagi Grimberg
2015-10-16 5:58 ` [PATCH 03/18] nvme: split command submission helpers out of pci.c Christoph Hellwig
2015-10-20 10:07 ` Sagi Grimberg
2015-10-21 18:48 ` J Freyensee
2015-10-16 5:58 ` [PATCH 04/18] nvme: add a vendor field to struct nvme_dev Christoph Hellwig
2015-10-20 10:08 ` Sagi Grimberg
2015-10-21 18:58 ` J Freyensee
2015-10-21 19:10 ` Busch, Keith
2015-10-16 5:58 ` [PATCH 05/18] nvme: use offset instead of a struct for registers Christoph Hellwig
2015-10-16 17:30 ` Busch, Keith
2015-10-21 20:28 ` J Freyensee
2015-10-16 5:58 ` [PATCH 06/18] nvme: split a new struct nvme_ctrl out of struct nvme_dev Christoph Hellwig
2015-10-20 10:19 ` Sagi Grimberg
2015-10-20 10:26 ` Christoph Hellwig
2015-10-20 10:44 ` Sagi Grimberg
2015-10-20 11:30 ` Christoph Hellwig
2015-10-21 14:40 ` Sagi Grimberg
2015-10-21 21:23 ` J Freyensee
2015-10-21 22:51 ` Busch, Keith
2015-10-22 0:15 ` J Freyensee
2015-10-22 7:37 ` Christoph Hellwig
2015-10-16 5:58 ` [PATCH 07/18] nvme: simplify nvme_setup_prps calling convention Christoph Hellwig
2015-10-20 10:30 ` Sagi Grimberg
2015-10-16 5:58 ` [PATCH 08/18] nvme: refactor nvme_queue_rq Christoph Hellwig
2015-10-16 5:58 ` [PATCH 09/18] nvme: move nvme_error_status to common code Christoph Hellwig
2015-10-20 10:54 ` Sagi Grimberg
2015-10-16 5:58 ` [PATCH 10/18] nvme: move nvme_setup_flush and nvme_setup_rw " Christoph Hellwig
2015-10-20 11:01 ` Sagi Grimberg
2015-10-21 6:55 ` Christoph Hellwig
2015-10-21 14:41 ` Sagi Grimberg
2015-10-16 5:58 ` [PATCH 11/18] nvme: split __nvme_submit_sync_cmd Christoph Hellwig
2015-10-16 5:58 ` [PATCH 12/18] nvme: use the block layer for userspace passthrough metadata Christoph Hellwig
2015-10-16 20:04 ` Busch, Keith
2015-10-18 18:22 ` Christoph Hellwig
2015-10-16 5:58 ` [PATCH 13/18] nvme: move block_device_operations and ns/ctrl freeing to common code Christoph Hellwig
2015-10-16 5:58 ` [PATCH 14/18] nvme: add explicit quirk handling Christoph Hellwig
2015-10-16 5:58 ` [PATCH 15/18] nvme: add a common helper to read Identify Controller data Christoph Hellwig
2015-10-21 22:44 ` J Freyensee
2015-10-22 7:38 ` Christoph Hellwig
2015-10-16 5:58 ` [PATCH 16/18] nvme: move the call to nvme_init_identify earlier Christoph Hellwig
2015-10-16 5:58 ` [PATCH 17/18] nvme: move namespace scanning to common code Christoph Hellwig
2015-10-16 6:14 ` Ming Lin
2015-10-16 6:16 ` Christoph Hellwig
2015-10-21 23:27 ` J Freyensee
2015-10-22 7:39 ` Christoph Hellwig
2015-10-22 13:48 ` Busch, Keith
2015-10-22 16:30 ` Christoph Hellwig
2015-10-22 21:24 ` Busch, Keith
2015-10-23 5:41 ` Christoph Hellwig
2015-10-16 5:58 ` [PATCH 18/18] nvme: move chardev and sysfs interface " Christoph Hellwig
2015-10-22 0:11 ` J Freyensee
2015-10-22 7:45 ` Christoph Hellwig
2015-10-22 18:36 ` J Freyensee [this message]
2015-10-22 18:59 ` Jon Derrick
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1445538979.2750.14.camel@linux.intel.com \
--to=james_p_freyensee@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).