Skip to content

Commit d0dd594

Browse files
leitaokeithbusch
authored andcommitted
nvme: Print capabilities changes just once
This current dev_info() could be very verbose and being printed very frequently depending on some userspace application sending some specific commands. Just print this message once and skip it until the controller resets. Use a controller flag (NVME_CTRL_DIRTY_CAPABILITY) to track if the capability needs a reset. Signed-off-by: Breno Leitao <leitao@debian.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 2293cae commit d0dd594

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

drivers/nvme/host/core.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1125,8 +1125,11 @@ void nvme_passthru_end(struct nvme_ctrl *ctrl, u32 effects,
11251125
mutex_unlock(&ctrl->scan_lock);
11261126
}
11271127
if (effects & NVME_CMD_EFFECTS_CCC) {
1128-
dev_info(ctrl->device,
1128+
if (!test_and_set_bit(NVME_CTRL_DIRTY_CAPABILITY,
1129+
&ctrl->flags)) {
1130+
dev_info(ctrl->device,
11291131
"controller capabilities changed, reset may be required to take effect.\n");
1132+
}
11301133
}
11311134
if (effects & (NVME_CMD_EFFECTS_NIC | NVME_CMD_EFFECTS_NCC)) {
11321135
nvme_queue_scan(ctrl);
@@ -3280,6 +3283,7 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl, bool was_suspended)
32803283
return ret;
32813284
}
32823285

3286+
clear_bit(NVME_CTRL_DIRTY_CAPABILITY, &ctrl->flags);
32833287
ctrl->identified = true;
32843288

32853289
return 0;

drivers/nvme/host/nvme.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ enum nvme_ctrl_flags {
243243
NVME_CTRL_STARTED_ONCE = 2,
244244
NVME_CTRL_STOPPED = 3,
245245
NVME_CTRL_SKIP_ID_CNS_CS = 4,
246+
NVME_CTRL_DIRTY_CAPABILITY = 5,
246247
};
247248

248249
struct nvme_ctrl {

0 commit comments

Comments
 (0)