-
Notifications
You must be signed in to change notification settings - Fork 123
Print full CSTS value when NVMe device failed to init #1401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@@ -226,7 +226,7 @@ impl<T: DeviceBacking> NvmeDriver<T> { | |||
)) | |||
.await | |||
{ | |||
anyhow::bail!("device is gone"); | |||
anyhow::bail!("device is gone, csts: {:x}", u32::from(bar0.csts())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these all have slightly different messages too to distinguish them from one another?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that was my concern because I can't distinguish one from another, but I thought printing the full csts value will help figuring it out anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you
@@ -329,7 +329,7 @@ impl<T: DeviceBacking> NvmeDriver<T> { | |||
loop { | |||
let csts = worker.registers.bar0.csts(); | |||
if u32::from(csts) == !0 { | |||
anyhow::bail!("device is gone"); | |||
anyhow::bail!("device is gone, csts: {:x}", u32::from(csts)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: store the u32::from result in a var, or just hardcode it since we know what it is thanks to the if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this one let me add a variable. I think this code makes an assumption that failed emulated device returns 0xffffffff on read, but I am not sure if that's guaranteed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewing
@@ -226,7 +226,7 @@ impl<T: DeviceBacking> NvmeDriver<T> { | |||
)) | |||
.await | |||
{ | |||
anyhow::bail!("device is gone"); | |||
anyhow::bail!("device is gone, csts: {:x}", u32::from(bar0.csts())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you should read the value again. Either leave this one out (we know reset only fails if csts == -1), or have reset return Result<(), u32>
, where the error case is the csts value, and log that.
@@ -565,7 +566,7 @@ impl<T: DeviceBacking> NvmeDriver<T> { | |||
|
|||
// It is expected the device to be alive when restoring. | |||
if !bar0.csts().rdy() { | |||
anyhow::bail!("device is gone"); | |||
anyhow::bail!("device is gone, csts: {:x}", u32::from(bar0.csts())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't re-read csts, the value could be different on the next read and that could create confusion.
With the emulated devices likely it will be 0x00000000 or 0xFFFFFFFF but we need to distinguish the cases for further diagnostics.