-
Notifications
You must be signed in to change notification settings - Fork 48
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
[RFC]: Add i.MX tests for module insert/removal #927
Conversation
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.
Sounds good to me, just not clear on the new PLATFORM variable.
tools/kmod/sof_remove.sh
Outdated
|
||
TOPDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) | ||
|
||
case $PLATFORM in |
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.
how is PLATFORM set?
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.
"This depends on PR: #926"
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.
Please make that an optional command line parameter. Environment variables suck, they hide from logs.
Something like this:
main()
{
local subscript="$1" # e.g.: 'intel'
if [ -n "$subscript" ]; then
"$TOPDIR"/tools/kmod/sof_remove_"$subscript".sh
return $?
fi
for remove_sub_script in "$TOPDIR"/tools/kmod/sof_remove_*.sh; do
"$remove_sub_script"
done
}
main "$@"
A main
function because #740
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 very good suggestion. One single comment about:
for remove_sub_script in "$TOPDIR"/tools/kmod/sof_remove_*.sh; do
"$remove_sub_script"
done
I'm not sure this is the correct way to run the sof_remove* scripts
as for example it doesn't make any sens to try to remove IMX modules on Intel platform or viceversa.
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 understand why this required, the current code is already able to skip missing or unloaded modules, it already does that routinely. Can you explain why you can't just append other modules to the existing lists? What problem does this solve?
Also, are all snd_soc_*
really Intel-specific? If they are, then why are some modules named snd_soc_intel_*
? Also, where would amd/snd-soc-acp-rt5645-mach.ko
fit?
You're right @marc-hb but in practice I don't think we want to have a giant file with all modules managed by all SOF contributors though. Too many changes left and right and too much churn. It's wise to split the parts that are platform specific and let each contributor deal with their own additions. In general, all modules with just 'sof' are intel only, except that we didn't do this for machine drivers. snd_soc_sof_sdw is intel specific but we forgot the prefix. So there will be some interesting cases to deal with. |
tools/kmod/sof_remove.sh
Outdated
|
||
TOPDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd) | ||
|
||
case $PLATFORM in |
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.
Please make that an optional command line parameter. Environment variables suck, they hide from logs.
Something like this:
main()
{
local subscript="$1" # e.g.: 'intel'
if [ -n "$subscript" ]; then
"$TOPDIR"/tools/kmod/sof_remove_"$subscript".sh
return $?
fi
for remove_sub_script in "$TOPDIR"/tools/kmod/sof_remove_*.sh; do
"$remove_sub_script"
done
}
main "$@"
A main
function because #740
3d340f3
to
071f0ae
Compare
Thanks for the comments @plbossart @marc-hb ! Based on your suggestions, I have made the following changes:
I have decided to remove said line.
It was a poor choice from my part to copy and paste those lines instead of adding them in one place. Now all of those pre-insert/pre-remove steps have been moved to a setup function which in turn is called by the main function in sof_{remove/insert}.sh.
|
@LaurentiuM1234 please add a (I didn't review the current version yet) |
I don't know why yet but the consistent check-sof-logger failures in https://sof-ci.01.org/softestpr/PR927/build63/devicetest/ really seem caused by this.
|
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.
First, thanks for the stellar breakdown into multiple commits, it makes the review so much easier, I wish we'd see that more often!
It will also help git blame
work across renames.
Looks mostly good to me except for the new mandatory "$platform" argument. @plbossart convinced me this new argument is a good thing but I do not agree it should be mandatory. It should also not be called "platform", more on that below.
I'm not sure this is the correct way to run the sof_remove* scripts as for example it doesn't make any sens to try to remove IMX modules on Intel platform or viceversa.
I see a few reasons why it makes sense to have a stupid for
loop that runs all the scripts for all platforms when no $platform argument is passed
- Backward-compatibility. This script is invoked in a number of places and not just in sof-test.
- "snd_soc_sof_sdw is intel specific but we forgot the prefix. So there will be some interesting cases to deal with." => there will be corner cases and bugs and then a stupid
for
loop will help - I know Yocto is all about optimizing and keeping only the absolute minimum necessary but "traditional" Linux distributions are not like that.
- Someone could actually want to try to load and unload modules from all vendors even when some don't drive any hardware for increased test coverage
- If you don't want to use the stupid default for IMX/yocto then simply ignore it and don't use it and it will make no difference to you. It will be only 3 lines of sof-test code.
As I wrote above, the new argument must not be called "platform" not because the name "platform" is super vague and sucks (even when it does) but because it's already being used all across sof and sof-test for making the difference between intel product generations. Just git grep -i platform
in sof and sof-test and you will see. I suggest $vendor
?
This parameter is also needed in Please add a new, optional |
6e0cd3a
to
bf0411b
Compare
bf0411b
to
64deeca
Compare
Current status just for the record: modified tests are failing in https://sof-ci.01.org/softestpr/PR927/build69/devicetest/ and there is a |
d112f2d
to
4a03669
Compare
@marc-hb i have no strong preference on this. Current implementation actually follows your advice. If no parameter is given then we iterate over all insert/remove *sh scripts and we ran them. The problem is that for example trying to insmod Intel drivers on IMX will cause a fail. Similar happens when you try to insert i.MX ARM compiled drivers on Intel. Maybe there is something I'm missing. Trying to call For example, we can see the following log when running current PR:
We have this common module What we can do for backward compatibility is to assume if no argument is given that the vendor is Intel and we preserve the behavior before this patch. |
I think this just shows a copy/paste/diverge issue. So the rationale for this split is:
If better maintenance is the goal then common modules should be in some For instance something like this: if [ -n "$VENDOR" ]; then
"$TOPDIR"/tools/kmod/sof_remove_"$VENDOR".sh || return $?
fi
dlogi "VENDOR not specified. Running all removal subscripts."
for remove_subscript in "$TOPDIR"/tools/kmod/sof_remove_*.sh; do
dlogi "Currently running: $remove_subscript"
"$remove_subscript" || return $?
done
"$TOPDIR"/tools/kmod/sof_common_remove.sh
Insertion should NOT have that problem thanks to dependencies, common modules should not be loaded explicitly. BTW I'm still curious what stopped you from simply adding IMX modules to the current "giant files". Speaking of |
Our first thought was to modularize things so that we developers should only care about their platform. Adding IMX modules to the giant files would make them even more "giant" :). Anyway, can we draw a conclusion on this? |
Because I believe it wouldn't scale very well:
Let's assume we go for the huge script and let's assume sof_remove.sh contains the following statements: ... Let's also assume that A uses B. What if there's another contributor n who has the following modules: A, B and C with A using C and C using B. Wouldn't it be easier for said contributor to just create his own sof_remove_n.sh instead of having to find modules A and B in the initial file and inserting module C in between them? What if the file contains hundreds of lines? Also, what would be the point of trying to remove/insert let's say hundreds of modules that you know can't be used on your platform? |
What if we had the following case: Contributor 1 has modules A and C. C is being used by A. Since C is a common module then it would have to be placed in sof_common_remove.sh, right? That would mean that either A and B are removed before C or C is removed before A and B. First case wouldn't work on contributor 2's platform because B is used by C so C should be removed first. Second case wouldn't work on contributor 1's platform. |
vendor-A depends on common-C which depends on vendor-B... how can a common module depend on a vendor module? |
That's more or less what exists already and it has required little effort. The "giant" file already used groups to make that easier, moving these groups to separate files does not seem like a ground-breaking improvement to me and it does complicate the scripting.
Because it's simple and it works. The only potential problem I see is this:
So yes, conflicts are not fun. But they haven't happened in practice yet and based on past history I'm not sure they would have been that frequent. It's not like modules get created or renamed every day. |
@marc-hb You're right, this is not possible, sorry. I'll just add the i.MX modules to the existing sof_{remove/insert}.sh scripts. |
Hey I'm not totally opposed to this split, don't get me wrong. I'm just saying it may cause more problems than it solves, at least initially. |
I agree we can add the imx modules to current scripts. |
4a03669
to
6fb7cba
Compare
tools/kmod/sof_insert.sh
Outdated
@@ -96,6 +98,20 @@ insert_module snd_sof_pci_intel_icl | |||
insert_module snd_sof_pci_intel_tgl | |||
insert_module snd_sof_pci_intel_mtl | |||
|
|||
# core SOF driver | |||
insert_module snd_sof | |||
|
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 would move core SOF driver before `top level ACPI/PCI SOF drivers.
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 ! Fixed.
Added modules used by i.MX. This change will allow tests based on module insertion/removal to work on i.MX. Signed-off-by: Laurentiu Mihalcea <[email protected]>
6fb7cba
to
6987b36
Compare
Sorry for the The 2 errors in https://sof-ci.01.org/softestpr/PR927/build79/devicetest/ are unrelated. |
This depends on PR: #926