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

Virtual Memory Heaps boot testing improvements #8775

Merged
merged 3 commits into from
Mar 5, 2024

Conversation

dabekjakub
Copy link
Member

Change boot test trigger from ipc to zephyr API call.
Change existing vmh tests and expand it.

Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

would be better as a change, not a rewrite

zephyr/boot_test.c Outdated Show resolved Hide resolved
zephyr/boot_test.c Outdated Show resolved Hide resolved
zephyr/test/vmh.c Outdated Show resolved Hide resolved
zephyr/test/vmh.c Show resolved Hide resolved
zephyr/test/vmh.c Outdated Show resolved Hide resolved
Copy link
Collaborator

@lyakh lyakh left a comment

Choose a reason for hiding this comment

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

extensive testing is good, but I think this is taking it a bit too far. And many indentation and curly brace issues

test_vmh_alloc_free(true);
test_vmh_alloc_free(false);
test_vmh_alloc_multiple_times(true);
test_vmh_alloc_multiple_times(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is quite a bit of testing, taking into account that many of these functions test multiple allocations too. Do we know how long this takes? I'm not sure we need that much testing - I'd basically test each (or most) configuration once - once in contiguous mode, once without, once with success, once with failure. Something rather lightweight for regular debug-overlay testing, possibly add a new Kconfig for extensive VMH testing. So do all these tests now pass? Can we re-enable boot-time testing by default?

Copy link
Member Author

Choose a reason for hiding this comment

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

Overall I assumed that this boot test feature is not intended to be enabled in the productized version. So we will only use the CONFIG_SOF_BOOT_TEST flag for testing only and are not that much impacted by test time.

However, for allocator testing, this is quite concise. Should not take that much time - will have better data on it as soon as I clean up all the issues those tests found.

Amount of tests: This test approach allows for clear identification of the issues. I tried to add tests for each case I encountered. For example, multiple allocations failed in my internal testing during development so now I want it tested extensively. Writing data to the allocated space also checks for correctly assigned physical pages.

Can we enable boot testing? No - I am still working out the issues in vmh API #8772 Once this is done It can be pushed.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good, that this helps you find issues with the VMH! Maybe we should first have all the issues fixed and then merge and enable this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am working on it so I see no problem In pushing both fixes and this at the same time.
Linked pr is for fixes I will do.

Copy link
Member

Choose a reason for hiding this comment

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

It does not matter how long the tests take to run as they should not be used in a production mode. i.e. we are not going to add latency to audio use case.
CI should be able to build this Kconfig and all tests should run for all subsystems.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to enable this in debug overlay, so this would get tested automatically with the current infra we have. That would require the tests to pass. Otherwise the code will very easily get broken (like it has when we temporarily disabled it in the debug overlay).

zephyr/test/vmh.c Outdated Show resolved Hide resolved
zephyr/test/vmh.c Show resolved Hide resolved
zephyr/test/vmh.c Outdated Show resolved Hide resolved
zephyr/test/vmh.c Outdated Show resolved Hide resolved
@dabekjakub dabekjakub force-pushed the vmh_tests_upstream branch 7 times, most recently from 8102942 to 8d37d79 Compare January 26, 2024 00:51
Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

@dabekjakub is this bisect-able with the remove and add patches being different i.e. will it build/run ?
Also please state in commit message why new test are better etc, i.e. what are you adding that makes the test better.

@dabekjakub dabekjakub force-pushed the vmh_tests_upstream branch 3 times, most recently from 0a3f7a9 to ae4d3cc Compare February 9, 2024 16:07
zephyr/boot_test.c Outdated Show resolved Hide resolved
Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

@dabekjakub commit message should say why we remove old test (i.e. what the gaps were) and why the new tests are better (what we test now and not before etc).

@dabekjakub
Copy link
Member Author

@lgirdwood @lyakh After zephyr update there is a build error in the current implementation.

I will update PR tomorrow with both review fixes and new zephyr ztest suite run implementation.

@dabekjakub dabekjakub force-pushed the vmh_tests_upstream branch 2 times, most recently from ddd8ae1 to 5b01043 Compare February 23, 2024 18:06
Boot tests were dependent on ipc. Change to run theme as part of
zephyr boot process.
Calls to zephyr api were deprecated and would not build with current
zephyr version. Update the call.

Signed-off-by: Jakub Dabek <[email protected]>
Remove current tests for vmh api. To be replaced by
new implementation.
Old implementation is not parametrized and only checks one scenario:
create heap and allocate on it.
New implementation will cover multiple heap creation, multiple allocations,
checking allocated memory for physical page allocation among other
scenarios.
Remove whole implementation since there is no code reuse.

Signed-off-by: Jakub Dabek <[email protected]>
@dabekjakub dabekjakub force-pushed the vmh_tests_upstream branch 2 times, most recently from 2849279 to fec9649 Compare February 24, 2024 00:27
Add enhanced vmh testing.
Add tests for: heap creation, heap creation with config, multiple
allocation tests for each heap mode.

Signed-off-by: Jakub Dabek <[email protected]>
@dabekjakub
Copy link
Member Author

dabekjakub commented Feb 24, 2024

Fixed review issues and some test issues I have found.
Tested with #8849 worked.
As soon as this and #8849 is merged we can reenable boot tests. However, they do take a lot of time so if we enhance those we should think about separating it as a test-only build.

@lyakh
Copy link
Collaborator

lyakh commented Feb 26, 2024

However, they do take a lot of time so if we enhance those we should think about separating it as a test-only build.

@dabekjakub maybe we could have a define (Kconfig?) to select between a short and a long VMH test, a short one would skip most configurations and only test a couple of them

@dabekjakub
Copy link
Member Author

It is a solution, however, this is outside of the scope and we would have to discuss it on an open forum, with people managing the validation of prs at least.

test_vmh_alloc_free(true);
test_vmh_alloc_free(false);
test_vmh_alloc_multiple_times(true);
test_vmh_alloc_multiple_times(false);
Copy link
Member

Choose a reason for hiding this comment

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

It does not matter how long the tests take to run as they should not be used in a production mode. i.e. we are not going to add latency to audio use case.
CI should be able to build this Kconfig and all tests should run for all subsystems.

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

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

Given the existing code doesn't build anymore, I'm ok to merge this version.

I do think we should enable this in some configuration CI tests (or add one, either in Intel internal/quickbuild). Otherwise the code will get broken and we won't know e.g. regressions with Zephyr. Having this enabled in CI would be very powerful e.g. to test Zephyr baseline updates.

test_vmh_alloc_free(true);
test_vmh_alloc_free(false);
test_vmh_alloc_multiple_times(true);
test_vmh_alloc_multiple_times(false);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer to enable this in debug overlay, so this would get tested automatically with the current infra we have. That would require the tests to pass. Otherwise the code will very easily get broken (like it has when we temporarily disabled it in the debug overlay).

@mwasko mwasko merged commit dc8b367 into thesofproject:main Mar 5, 2024
35 of 44 checks passed
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.

5 participants