forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 140
UUID Kernel support #2090
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
Closed
Closed
UUID Kernel support #2090
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d92ca8d
ASoC: SOF: tokens: add token for component UUID
keyonjie 89c1916
ASoC: SOF: add comp_ext to struct snd_sof_widget
keyonjie 181fbfb
ASoC: SOF: topology: create component extended tokens
keyonjie 1dd1eca
ASoC: SOF: topology: parse comp_ext_tokens for all widgets
keyonjie b7f225d
ASoC: SOF: use the sof_ipc_comp reserved bytes for extended data
keyonjie 6fc2038
ASoC: SOF: append extended data to sof_ipc_comp_dai
keyonjie 01db78c
ASoC: SOF: append extended data to sof_ipc_comp_mixer
keyonjie cb74bcf
ASoC: SOF: append extended data to sof_ipc_comp_volume
keyonjie ff7865e
ASoC: SOF: append extended data to sof_ipc_buffer
keyonjie 9927f09
ASoC: SOF: append extended data to sof_ipc_comp_host
keyonjie c0ab9aa
ASoC: SOF: append extended data to sof_ipc_comp_src
keyonjie 318b20e
ASoC: SOF: append extended data to sof_ipc_comp_asrc
keyonjie 6618bf9
ASoC: SOF: append extended data to sof_ipc_comp_tone
keyonjie e28bf58
ASoC: SOF: append extended data to sof_ipc_comp_process
keyonjie c984fec
ASoC: SOF: append extended data to sof_ipc_comp_mux
keyonjie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
seems to me like you've re-invented the concept of variable array?
this is exactly like we've done in other places e.g. with
uint32_t data_size;
uint8_t data[];
In both cases, this is a final change to the structure, you cannot add anything after the variable array, so it'd be wise indeed to keep some reserved space before the variable array.
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.
uint8_t data[]is an incomplete array type.A variable array is something like
int n; uint8_t data[n]instead.When it's the last member of a structure, an incomplete array type is more specifically called a flexible array member.
Sorry to be pedantic but the right terms are needed when searching documentation and more generally looking for information. For instance information about best initialization practices (see previous sizeof/memset discussion) or that the kernel is now VLA-free
https://www.phoronix.com/scan.php?page=news_item&px=Linux-Kills-The-VLA
https://lwn.net/Articles/749064/
Plus memory (mis)management is where most security issues lie so some pedantism can't hurt there :-)
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.
thanks for being pedantic @marc-hb, my point remains that it's probably better to be explicit about data structures than implicit. There are tools that will detect that a flexible array is the last in a structure, if it's not even declared we'd be writing them off.
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.
No, it is not the flexible array here, it means explicit one uint32_t member. It used to be reserved[2] and is reserved[1] after .core is introduced.
I think the reason that keeping these 'reserved' member is to avoid bumping MAJOR frequently, once they are used up, we have to extend it with a MAJOR bump when any new member being added.
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.
@marc-hb thanks for the details! I somehow completely missed the "get rid of VLAs" movement (shame). I'm wondering though: those articles use the expression "VLAs within structures" - are they referring to structures declared within functions like
? or do they mean what you call incomplete / flexible arrays?
Uh oh!
There was an error while loading. Please reload this page.
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, the former (gcc abomination).
There are a number of differences between Variable Length Arrays and Flexible Array Members. I believe the simplest to remember and also most relevant is:
I didn't know about gcc VLAs in struct, I read about them today. While plain VLAs were bad, gcc VLAs in structs raise Linus' language to yet another level:
http://thelinuxjedi.blogspot.com/2014/02/why-vlais-is-bad.html
So gcc VLAs in struct are a much worse form of standard VLAs with no relation to standard Flexible Array Members. The terminology is consistent, let's stick to it.
As opposed to all VLAs, Flexible Array Members (= what Pierre actually suggested) are totally welcome in the kernel and a great replacement for 0-sized arrays (bad) or 1-sized arrays (a catastrophe)
https://www.phoronix.com/scan.php?page=news_item&px=Linux-5.8-Flexible-Array-Member
PS: maybe not so pedantic after all? ;-)
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.
Is it possible that flexible arrays in IPC can be moved by also having an offset member which says where the array is beginning? This way you don't need to add reserved fields before the array itself, but IPC itself must be aware of this (and made slightly more complex due to it) so it can fill in those intermediate fields with zeros if necessary.