linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Logan Gunthorpe <logang@deltatee.com>
To: Sagi Grimberg <sagi@grimberg.me>,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	Stephen Bates <sbates@raithlin.com>, Jens Axboe <axboe@fb.com>,
	Keith Busch <kbusch@kernel.org>, Max Gurtovoy <maxg@mellanox.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v11 8/9] nvmet-passthru: Add enable/disable helpers
Date: Thu, 27 Feb 2020 10:37:21 -0700	[thread overview]
Message-ID: <9c6355d8-cf4e-9932-1cef-0a7140f0fa7e@deltatee.com> (raw)
In-Reply-To: <96234649-fbc1-fb56-54d8-2f73dc455ffd@grimberg.me>



On 2020-02-26 4:33 p.m., Sagi Grimberg wrote:
> 
>> +    if (subsys->ver < NVME_VS(1, 2, 1)) {
>> +        pr_warn("nvme controller version is too old: %d.%d.%d,
>> advertising 1.2.1\n",
>> +            (int)NVME_MAJOR(subsys->ver),
>> +            (int)NVME_MINOR(subsys->ver),
>> +            (int)NVME_TERTIARY(subsys->ver));
>> +        subsys->ver = NVME_VS(1, 2, 1);
> 
> Umm.. is this OK? do we implement the mandatory 1.2.1 features on behalf
> of the passthru device?

This was the approach that Christoph suggested. It seemed sensible to
me. However, it would also *probably* be ok to just reject these
devices. Unless you feel strongly about this, I'll probably leave it the
way it is.

>> +    }
>> +
>> +    mutex_unlock(&subsys->lock);
>> +    return 0;
>> +
>> +out_put_ctrl:
>> +    nvme_put_ctrl(ctrl);
>> +out_unlock:
>> +    mutex_unlock(&subsys->lock);
>> +    return ret;
>> +}
>> +
>> +static void __nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys)
>> +{
>> +    if (subsys->passthru_ctrl) {
>> +        xa_erase(&passthru_subsystems, subsys->passthru_ctrl->cntlid);
>> +        nvme_put_ctrl(subsys->passthru_ctrl);
>> +    }
>> +    subsys->passthru_ctrl = NULL;
>> +    subsys->ver = NVMET_DEFAULT_VS;
>> +}
> 
> Isn't it strange that a subsystem changes its version in its lifetime?

It does seem strange. However, it's not at all unprecedented. See
nvmet_subsys_attr_version_store() which gives the user direct control of
the version through configfs.

>> +
>> +void nvmet_passthru_ctrl_disable(struct nvmet_subsys *subsys)
>> +{
>> +    mutex_lock(&subsys->lock);
>> +    __nvmet_passthru_ctrl_disable(subsys);
>> +    mutex_unlock(&subsys->lock);
>> +}
>> +
>> +void nvmet_passthru_subsys_free(struct nvmet_subsys *subsys)
>> +{
>> +    mutex_lock(&subsys->lock);
>> +    __nvmet_passthru_ctrl_disable(subsys);
>> +    kfree(subsys->passthru_ctrl_path);
>> +    mutex_unlock(&subsys->lock);
> 
> Nit, any reason why the free is in the mutex?

Nope. Will fix.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2020-02-27 17:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 20:36 [PATCH v11 0/9] nvmet: add target passthru commands support Logan Gunthorpe
2020-02-20 20:36 ` [PATCH v11 1/9] nvme-core: Clear any SGL flags in passthru commands Logan Gunthorpe
2020-02-26 23:08   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 2/9] nvme: Create helper function to obtain command effects Logan Gunthorpe
2020-02-26 23:09   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 3/9] nvme: Move nvme_passthru_[start|end]() calls to common helper Logan Gunthorpe
2020-02-26 23:10   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 4/9] nvmet-passthru: Introduce NVMet passthru Kconfig option Logan Gunthorpe
2020-02-26 23:12   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 5/9] nvme-core: Introduce nvme_ctrl_get_by_path() Logan Gunthorpe
2020-02-20 20:36 ` [PATCH v11 6/9] nvme: Export existing nvme core functions Logan Gunthorpe
2020-02-26 23:13   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 7/9] nvmet-passthru: Add passthru code to process commands Logan Gunthorpe
2020-02-26 23:28   ` Sagi Grimberg
2020-02-27 17:33     ` Logan Gunthorpe
2020-02-20 20:36 ` [PATCH v11 8/9] nvmet-passthru: Add enable/disable helpers Logan Gunthorpe
2020-02-26 23:33   ` Sagi Grimberg
2020-02-27 17:37     ` Logan Gunthorpe [this message]
2020-02-27 23:13       ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 9/9] nvmet-configfs: Introduce passthru configfs interface Logan Gunthorpe
2020-02-26 23:35   ` Sagi Grimberg

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=9c6355d8-cf4e-9932-1cef-0a7140f0fa7e@deltatee.com \
    --to=logang@deltatee.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=maxg@mellanox.com \
    --cc=sagi@grimberg.me \
    --cc=sbates@raithlin.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).