From: keith.busch@intel.com (Keith Busch)
Subject: [PATCH v4 1/1] nvme: Add support for FW activation without reset
Date: Fri, 7 Jul 2017 11:19:15 -0400 [thread overview]
Message-ID: <20170707151914.GA14788@localhost.localdomain> (raw)
In-Reply-To: <1499427767-15891-1-git-send-email-a.dawn@samsung.com>
On Fri, Jul 07, 2017@05:12:47PM +0530, Arnav Dawn wrote:
> +static int nvme_get_fw_slot_info(struct nvme_ctrl *dev,
> + struct nvme_fw_slot_info_log *log)
> +{
> + struct nvme_command c = { };
> +
> + c.common.opcode = nvme_admin_get_log_page;
> + c.common.nsid = cpu_to_le32(0xFFFFFFFF);
> + c.common.cdw10[0] = cpu_to_le32(
> + (((sizeof(struct nvme_fw_slot_info_log) / 4) - 1) << 16)
> + | NVME_LOG_FW_SLOT);
> +
> + if (!log)
> + return -ENOMEM;
You check if log is not NULL here, but you already checked it before
calling the function.
I think you should just move the log allocation to the above function
instead of taking it as a parameter, anyway.
> void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
> union nvme_result *res)
> {
> @@ -2549,6 +2608,14 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
> dev_info(ctrl->device, "rescanning\n");
> nvme_queue_scan(ctrl);
> break;
> + case NVME_AER_NOTICE_FW_ACT_STARTING:
> + schedule_delayed_work(&ctrl->fw_act_work,
> + msecs_to_jiffies(100));
> + break;
> + case NVME_AER_ERR_FW_IMG_LOAD:
> + dev_warn(ctrl->device, "FW image load error\n");
> + cancel_delayed_work(&ctrl->fw_act_work);
> + break;
I'm still not a fan of the delayed work. Just use normal work, and remove
the NVME_AER_ERR_FW_IMG_LOAD case.
> +static inline bool nvme_ctrl_pp_status(struct nvme_ctrl *ctrl)
> +{
> +
> + u32 csts;
> +
> + if (ctrl->ops->reg_read32(ctrl, NVME_REG_CSTS, &csts))
> + return false;
> +
> + if (ctrl->ops->reg_read32(ctrl, NVME_REG_CC,
> + &ctrl->ctrl_config))
> + return false;
The above looks potentially racey. The ctrl->ctrl_config is the value
the driver wants to program CC to, not necessarily the current value. If
you're reading it back, that could race with a controller reset and
we'll get the wrong configuration.
Instead of reading the register, I think you can just rely on the value
of ctrl->ctrl_config to be accurate.
next prev parent reply other threads:[~2017-07-07 15:19 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20170707114112epcas1p293dc44953b942eab9d24fcba69d0fb33@epcas1p2.samsung.com>
[not found] ` <1497078304-5440-1-git-send-email-a.dawn@samsung.com>
2017-07-07 11:41 ` [PATCH v4 0/1]Add Support for FW activation without reset Arnav Dawn
2017-07-07 11:42 ` [PATCH v4 1/1] nvme: Add support " Arnav Dawn
2017-07-07 14:22 ` Christoph Hellwig
2017-07-07 15:19 ` Keith Busch [this message]
2017-07-11 13:44 ` [PATCH v5 0/1] Add Support " Arnav Dawn
2017-07-11 13:48 ` [PATCH v5 1/1] nvme: Add support " Arnav Dawn
2017-07-11 14:36 ` Keith Busch
2017-07-12 7:34 ` Christoph Hellwig
2017-07-12 10:32 ` Sagi Grimberg
2017-07-12 10:44 ` Arnav Dawn
2017-07-12 10:39 ` [PATCH v5 0/2] Add Support " Arnav Dawn
2017-07-12 10:44 ` Sagi Grimberg
2017-07-12 10:40 ` [PATCH v5 1/2] nvme: Add support " Arnav Dawn
2017-07-12 10:41 ` [PATCH v5 2/2] nvme: Define NVME_NSID_ALL Arnav Dawn
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=20170707151914.GA14788@localhost.localdomain \
--to=keith.busch@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