* [PATCH AUTOSEL 5.10 13/16] nvme: introduce helper function to get ctrl state
[not found] <20231211140116.391986-1-sashal@kernel.org>
@ 2023-12-11 14:00 ` Sasha Levin
0 siblings, 0 replies; only message in thread
From: Sasha Levin @ 2023-12-11 14:00 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: Keith Busch, Sagi Grimberg, Sasha Levin, linux-nvme
From: Keith Busch <kbusch@kernel.org>
[ Upstream commit 5c687c287c46fadb14644091823298875a5216aa ]
The controller state is typically written by another CPU, so reading it
should ensure no optimizations are taken. This is a repeated pattern in
the driver, so start with adding a convenience function that returns the
controller state with READ_ONCE().
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/nvme/host/nvme.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index c3e4d9b6f9c0d..1e56fe8e8157c 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -354,6 +354,11 @@ struct nvme_ctrl {
struct nvme_fault_inject fault_inject;
};
+static inline enum nvme_ctrl_state nvme_ctrl_state(struct nvme_ctrl *ctrl)
+{
+ return READ_ONCE(ctrl->state);
+}
+
enum nvme_iopolicy {
NVME_IOPOLICY_NUMA,
NVME_IOPOLICY_RR,
--
2.42.0
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-12-11 14:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20231211140116.391986-1-sashal@kernel.org>
2023-12-11 14:00 ` [PATCH AUTOSEL 5.10 13/16] nvme: introduce helper function to get ctrl state Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox