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

lib/ukstore: Introduce dynamic store API #939

Closed
wants to merge 6 commits into from

Conversation

michpappas
Copy link
Member

@michpappas michpappas commented Jun 8, 2023

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran the checkpatch.uk on your commit series before opening this PR;
  • Updated relevant documentation.

Base target

  • Architecture(s): [e.g. x86_64 or N/A]
  • Platform(s): [e.g. kvm, xen or N/A]
  • Application(s): [e.g. app-python3 or N/A]

Additional configuration

Description of changes

This series adds dynamic entry support to uk_store. Libraries can dynamically register uk_store objects at runtime, each one of which is associated with one or more entries. Similarly to static entries, each dynamic entry is associated with a getter and / or a setter.

Consumers are notified for the lifetime of objects via events.

GitHub-Supersedes: #460
GitHub-Depends-On: #938

@michpappas michpappas requested review from a team as code owners June 8, 2023 04:34
@unikraft-bot unikraft-bot added area/lib Internal Unikraft Microlibrary lang/c Issues or PRs to do with C/C++ lib/syscall_shim lib/ukalloc lib/ukdebug labels Jun 8, 2023
Copy link
Member

@craciunoiuc craciunoiuc left a comment

Choose a reason for hiding this comment

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

Some small comments from my side, it looks good 🙏

I hope you also modified the code to be in accordance with the new coding conventions 😅

lib/ukstore/README.md Outdated Show resolved Hide resolved
lib/ukstore/README.md Outdated Show resolved Hide resolved
lib/ukstore/README.md Outdated Show resolved Hide resolved
@craciunoiuc
Copy link
Member

I saw also some errors in checkpatch, if those are actually ok, add the Checkpatch-Ignore: ... in the message

@craciunoiuc
Copy link
Member

In the PR text also add Closes for automatic closing when merged

https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests

@craciunoiuc
Copy link
Member

When @skuenzer is happy I'll also add my tag and we can merge

@michpappas

This comment was marked as outdated.

lib/ukstore/include/uk/store.h Outdated Show resolved Hide resolved
lib/ukstore/include/uk/store.h Outdated Show resolved Hide resolved
lib/ukstore/include/uk/store.h Outdated Show resolved Hide resolved
lib/ukstore/include/uk/store.h Show resolved Hide resolved
* @param library_id owner library id as returned by uklibid
* @param object_id object id
*/
void uk_store_release_object(__u16 library_id, __u64 object_id);
Copy link
Member

@skuenzer skuenzer Aug 16, 2023

Choose a reason for hiding this comment

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

Would void uk_store_release_object(struct uk_store_object *obj); work as well? I remember we had a longer discussion about this but I don't remember the result.

Copy link
Member Author

Choose a reason for hiding this comment

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

From a look at the client side, I see no reason why we can't do that. Yet this needs to be changed with clear mind as it affects how we lock the refcounts. I will look at it tomorrow morning.

Copy link
Member

Choose a reason for hiding this comment

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

I agree, sounds good.

lib/ukstore/include/uk/store.h Outdated Show resolved Hide resolved
lib/ukstore/include/uk/store.h Outdated Show resolved Hide resolved
@michpappas
Copy link
Member Author

@skuenzer I addressed all review comments except from #939 (comment) which I will look at tomorrow morning. I marked the rest as resolved.

michpappas added a commit to michpappas/unikraft that referenced this pull request Aug 16, 2023
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
michpappas added a commit to michpappas/unikraft that referenced this pull request Aug 17, 2023
Checkpatch-Ignore: LONG_LINE
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
@michpappas michpappas force-pushed the uk_store_dynamic_pr branch 3 times, most recently from 37a9f22 to 682c47b Compare August 17, 2023 14:01
@michpappas
Copy link
Member Author

@skuenzer all changes are in now, including an updated README.md.

@michpappas michpappas force-pushed the uk_store_dynamic_pr branch 2 times, most recently from ad701a2 to e16a7fc Compare August 17, 2023 16:32
michpappas and others added 6 commits August 17, 2023 22:26
Remove cookie from static uk_store entries. This is in anticipation of
dynamic entries that provide a cookie at the object level.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Introduce an id property to uk_store entries and replace name with id
on lookup operations, to avoid costly string comparison.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
…initions

Update calls to UK_STORE_STATIC_ENTRIES to remove the deprecated
cookie parameter.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Introduce header for definitions related to uk_store. Add
entry IDs for stats tracked by uk_alloc, and update static
entry definitions to pass entry IDs.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
This commit adds dynamic entry support to uk_store. Libraries can
dynamically register uk_store objects at runtime, each one of which
is associated with one or more entries. Similarly to static entries,
each dynamic entry is associated with a getter and / or a setter.

Consumers are notified for the lifetime of objects via events.

Checkpatch-Ignore: SPACING LONG_LINE
GitHub-Closes: unikraft#539
Co-authored-by: Michalis Pappas <michalis@unikraft.io>
Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
@skuenzer
Copy link
Member

skuenzer commented Aug 17, 2023

@michpappas : I just rebased this PR to latest staging and removed the commit "lib/ukstore: Bring function definitions into the private scope", as we discussed.

@unikraft-bot
Copy link
Member

Checkpatch passed

Beep boop! I ran Unikraft's checkpatch.pl support script on your pull request and it all looks good!

SHA commit checkpatch
22d81e6 lib/ukstore: Remove cookie from static entries
0f5f7e5 lib/ukstore: Lookup entries by id
abcb269 lib/ukalloc: Remove deprecated cookie parameter from static entry definitions
3ef1dae lib/ukalloc: Add entry IDs and update static entry definitions
77c0aa5 lib/ukstore: Introduce dynamic API
Checkpatch-Ignore: SPACING LONG_LINE
2e7d060 lib/ukstore: Add README.md

Copy link
Member

@skuenzer skuenzer left a comment

Choose a reason for hiding this comment

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

Thanks a lot for all your work @craciunoiuc and @michpappas

Reviewed-by: Simon Kuenzer simon@unikraft.io
Approved-by: Simon Kuenzer simon@unikraft.io

Copy link
Member

@craciunoiuc craciunoiuc left a comment

Choose a reason for hiding this comment

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

All good here. Thanks!

Reviewed-by: Cezar Craciunoiu cezar.craciunoiu@unikraft.io

unikraft-bot pushed a commit that referenced this pull request Aug 17, 2023
Introduce an id property to uk_store entries and replace name with id
on lookup operations, to avoid costly string comparison.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939
unikraft-bot pushed a commit that referenced this pull request Aug 17, 2023
…initions

Update calls to UK_STORE_STATIC_ENTRIES to remove the deprecated
cookie parameter.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939
unikraft-bot pushed a commit that referenced this pull request Aug 17, 2023
Introduce header for definitions related to uk_store. Add
entry IDs for stats tracked by uk_alloc, and update static
entry definitions to pass entry IDs.

Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939
unikraft-bot pushed a commit that referenced this pull request Aug 17, 2023
This commit adds dynamic entry support to uk_store. Libraries can
dynamically register uk_store objects at runtime, each one of which
is associated with one or more entries. Similarly to static entries,
each dynamic entry is associated with a getter and / or a setter.

Consumers are notified for the lifetime of objects via events.

Checkpatch-Ignore: SPACING LONG_LINE
GitHub-Closes: #539
Co-authored-by: Michalis Pappas <michalis@unikraft.io>
Signed-off-by: Cezar Craciunoiu <cezar.craciunoiu@gmail.com>
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939
unikraft-bot pushed a commit that referenced this pull request Aug 17, 2023
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Cezar Craciunoiu <cezar.craciunoiu@unikraft.io>
Approved-by: Simon Kuenzer <simon@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #939
@unikraft-bot unikraft-bot added the ci/merged Merged by CI label Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lib Internal Unikraft Microlibrary ci/merged Merged by CI lang/c Issues or PRs to do with C/C++ lib/syscall_shim lib/ukalloc lib/ukdebug
Projects
Status: Done!
Development

Successfully merging this pull request may close these issues.

None yet

6 participants