Skip to content
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

plugins/ocp: Use structure for ocp smart log #2604

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sc108-lee
Copy link
Contributor

printed log tested (same), except below
Remove wrong duplicated prints from stdout
NVMe base errata version
NVMe command set errata version

* @log_page_version: Log page version
* @log_page_guid: Log page GUID
*/
struct __packed ocp_smart_extended_log {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, you don't use __packed then you don't need to cast them for le64_to_cpu. The __packed attribute removes the natural alignment guarantees and that's why the compiler complains.

Anyway, I like where this is going!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review.
I found out, after I read your review, there are few type cast I forgot to remove.
removed and uptaed.

since we need the __packed as below, I didn't remove type cast from inside of le64_to_cpu
packed = 512
remove packed = 520

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the size increase because of the outer alignment? Could you post the output of pahole? Or did the spec screw this up? The __packed attribute should really be avoided if possible. It hides a lot of bugs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @igaw

Steven is on his honeymoon, so I fix it for him.
I removed the __packed keyword and aligned the struct size to be the same.
After #2577 merge, I will modify it if there is anything to modify.
Thanks.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice I hope he doesn't get bothered by us here and can enjoy it! :)

Cool, so the __packed is not needed, this is what it what I hoped for. This will allow the compiler to report unaligned access etc.

I'll go ahead with #2577 and wait for an update here. No hurry though, so if you don't have time on your hands don't worry.

@igaw
Copy link
Collaborator

igaw commented Dec 20, 2024

I've merged #2577, so this one needs a rebase. Thanks!

@hmi-jeon hmi-jeon force-pushed the smart branch 4 times, most recently from 66b3b6b to 744994b Compare December 23, 2024 04:58
printed log tested (same), except below
Remove wrong duplicated prints from stdout
  NVMe base errata version
  NVMe command set errata version

Signed-off-by: Steven Seungcheol Lee <[email protected]>
@hmi-jeon hmi-jeon force-pushed the smart branch 2 times, most recently from 1b03f68 to b7a4dd9 Compare December 23, 2024 05:18
@hmi-jeon
Copy link
Contributor

Hi @igaw

I rebased it. Thanks!

If the dssd point, minor version are declared as __le16, the alignment
will be broken. Remove __packed keyword.
Change parameter void to ocp_smart_extended_log.

Reported-by: Steven Seungcheol Lee <[email protected]>
Signed-off-by: Minsik Jeon <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants