-
Notifications
You must be signed in to change notification settings - Fork 318
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
sof: coherent: Don't mark "struct coherent" as packed #8528
Conversation
Packing was done to optimize on cache lines, but the atomic lock needs to be arch specific for size and alignment. i..e removing the pack should be fine on 32bit as types should naturally shrink. |
You could/should say in the commit message that |
On 64-bit systems (i.e: i.MX93), marking "struct coherent" as packed leads to compilation warnings such as: "warning: taking address of packed member of 'struct coherent' may result in an unaligned pointer value" This is because the "list" attribute is found at offset 36, which is not 8B-aligned. In contrast, 32-bit systems don't have this problem as the "list" attribute is found at offset 24 which is 4B-aligned. Since marking "struct coherent" as packed doesn't seem to be necessary, remove this to fix the compilation warnings. On 32-bit systems, 'pahole' shows no difference between the 'packed' and the non-'packed' cases as the fields are already naturally aligned at the moment. A more detailed discussion regarding this issue can be found here: thesofproject#8521. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
0cb8a5d
to
c112d04
Compare
done! |
By this you mean that packing |
Yes, packing meant we helped optimise any struct fields to be on the same cache line. Never needed in practice though as the struct never grew much and was always smaller than cache line size. |
Supersedes the "best effort" use of `packed`, being removed by thesofproject#8528 Signed-off-by: Marc Herbert <marc.herbert@intel.com>
I submitted an compile-time assert in new #8539 which makes sure for real.
At least AMD's Renoir has a |
Hmm, I guess we could have went with the re-ordering of the |
Supersedes the "best effort" use of `packed`, being removed by #8528 Signed-off-by: Marc Herbert <marc.herbert@intel.com>
On 64-bit systems (i.e: i.MX93), marking "struct coherent" as packed leads to compilation warnings such as:
"warning: taking address of packed member of 'struct coherent' may result in an unaligned pointer value"
This is because the "list" attribute is found at offset 36, which is not 8B-aligned.
Since marking "struct coherent" as packed doesn't seem to be necessary, remove this to fix the compilation warnings.
A more detailed discussion regarding this issue can be found here: #8521.