[PATCH] nvme: add ctrl state machine pdf creator

Chaitanya Kulkarni chaitanyak at nvidia.com
Thu Jul 28 16:07:43 PDT 2022


On 7/28/22 11:40, Christoph Hellwig wrote:
> On Wed, Jul 27, 2022 at 02:54:24PM -0700, Chaitanya Kulkarni wrote:
>> It is not always easy to read the NVMe Host controller state machine
>> quickly written in C when debugging the code for various transports.
>>
>> This adds a simple dot based state machine for the host controller that
>> creates pdf. The resulting pdf is easier to understand and process.
> 
> So, the graph looks pretty, but I'm a little worried that having a
> separate copy of the transitions somewhere out in Documentation/
> just means it will become out of date very quickly.  Can we instead
> come up with macros that allow to both generate the code and the
> visualization?
> 

I'll make sure to update the graph when reviewing the new branch.

I did thought of adding the documentation in in the
drivers/nvme/host/ctrl-state-machine, but found it odd to have it in the
nvme/host.

> e.g.
> 
> 	switch (new_state) {
> 	FROM_STATE(NVME_CTRL_LIVE);
> 		TO_STATE(NVME_CTRL_NEW);
> 		TO_STATE(NVME_CTRL_RESETTING);
> 		TO_STATE(NVME_CTRL_CONNECTING);
> 		END_STATE();
> 	..
> 

I fail to understand the part that links the C code from host/core.c to
the pdf in the graph, can you please explain more on this ?

I was trying to avoid new code changes and add more macros for the
documentation purpose, let me see if I can do come up with something
with minimal complexity.

-ck




More information about the Linux-nvme mailing list