Skip to content

qat, initcontainer: add enablement of auto_reset #1852

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

Merged
merged 2 commits into from
Oct 2, 2024

Conversation

hj-johannes-lee
Copy link
Contributor

@hj-johannes-lee hj-johannes-lee commented Sep 25, 2024

For some reason, the previous pr #1838 is closed.
I make another pr.

Copy link
Contributor

@tkatila tkatila left a comment

Choose a reason for hiding this comment

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

I'll propose a bit different structure:

  • Change check_config to return true/false depending on the check result.
  • Drop is_found
    • Would remove some of the intermediate variables like AUTORESET_ENABLED_FOUND
  • Write the sriov and auto_reset activations like:
    • check_config "ServicesEnabled" "$SERVICES_LIST" && sysfs_config && enable_sriov
    • check_config "AutoresetEnabled" "$AUTORESET_OPTIONS_LIST" && enable_auto_reset
  • Separate "options check" into its own function

Those would make the code much more readable.

@mythi
Copy link
Contributor

mythi commented Sep 26, 2024

our target has been to eventually align with qatlib's qat_init.sh and this is taking us further from that.

@hj-johannes-lee
Copy link
Contributor Author

@mythi Thanks!

our target has been to eventually align with qatlib's qat_init.sh and this is taking us further from that.

Umm... would it be better to make totally independent script? Or another function in qat-init.sh?
To be honest, I do not see any reason why we need to keep it similar to that. I ofc checked the qat-init.sh of qatlib before starting the work, but there is no part about "setting auto_reset". If we make anything about auto_reset in qat-init.sh, then it is already far from the qatlib's init script.

@tkatila Thank you for your comments

Change check_config to return true/false depending on the check result.
Drop is_found

That was my first attempt, but unfortunately return is not implemented in toybox (http://lists.landley.net/pipermail/toybox-landley.net/2023-June/029623.html).

   Would remove some of the intermediate variables like AUTORESET_ENABLED_FOUND
Write the sriov and auto_reset activations like:
    check_config "ServicesEnabled" "$SERVICES_LIST" && sysfs_config && enable_sriov
    check_config "AutoresetEnabled" "$AUTORESET_OPTIONS_LIST" && enable_auto_reset
Separate "options check" into its own function

Thanks. Let me consider if we can "go further" from the qatlib's script. I need to wait what Mikko says about the the script...

@mythi
Copy link
Contributor

mythi commented Sep 26, 2024

I do not see any reason why we need to keep it similar to that.

the reason is we want to follow their work as much as possible and provide the exact same experience for users with and without k8s.

@hj-johannes-lee
Copy link
Contributor Author

hj-johannes-lee commented Sep 26, 2024

the reason is we want to follow their work as much as possible and provide the exact same experience for users with and without k8s.

So,, what do you think it's better? Just.. another function (but will be basically copy and paste of check_config) in qat-init.sh or just different script in the image?

@mythi
Copy link
Contributor

mythi commented Sep 26, 2024

it could be a simple add-on, e.g., using . "$(dirname "$0")/qat-autoreset.sh". my preference is to not touch the existing code/functions too much

@hj-johannes-lee
Copy link
Contributor Author

Then, I think it is even better to not make qat-init.sh be related to qat-autoreset.sh
I just changed the dockerfile.

@hj-johannes-lee
Copy link
Contributor Author

Idk if we would want to add more things in the future for the initcontainer part. If it happens, we may consider changing the name of qat-autoreset.sh to something else.

@hj-johannes-lee hj-johannes-lee force-pushed the PR-2024-006 branch 2 times, most recently from c594d38 to be6c426 Compare September 27, 2024 09:50
@hj-johannes-lee
Copy link
Contributor Author

@mythi @tkatila Hi, could you review this?

@mythi
Copy link
Contributor

mythi commented Sep 30, 2024

@mythi @tkatila Hi, could you review this?

Looks OK to me but the text here needs some fixes: "qat, initcontaniner: imporve the logic of config check".

@tkatila
Copy link
Contributor

tkatila commented Sep 30, 2024

The check_config function previously only considered the
ServicesEnabled variable. Improve the logic of the function so
that other variables can also be set through the qat.conf file.

Signed-off-by: Hyeongju Johannes Lee <[email protected]>
@hj-johannes-lee
Copy link
Contributor Author

Is the origin this script: https://github.com/intel/qatlib/blob/main/quickassist/utilities/service/qat_init.sh.in ?

@tkatila Yes!

Copy link
Contributor

@tkatila tkatila left a comment

Choose a reason for hiding this comment

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

Seems fine. I kinda dislike the script as it could be written in a more prettier way. But I understand why the style is as it is.

@hj-johannes-lee
Copy link
Contributor Author

@tkatila Yeah... I have not liked the script either since I made a qat-initcontainer..! 😅 😅

@hj-johannes-lee
Copy link
Contributor Author

@mythi Could you merge this if it looks good to you?

@hj-johannes-lee hj-johannes-lee merged commit e2a82e8 into intel:main Oct 2, 2024
75 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.

3 participants