Skip to content

tool(cleanup): use names not IDs for PDs - #590

Merged
midnightveil merged 3 commits into
seL4:mainfrom
au-ts:julia/use-names-not-id
Aug 12, 2026
Merged

tool(cleanup): use names not IDs for PDs#590
midnightveil merged 3 commits into
seL4:mainfrom
au-ts:julia/use-names-not-id

Conversation

@midnightveil

Copy link
Copy Markdown
Collaborator

As part of this, use Rc instead of String/&str in places so that we can cheaply have owned-strings in HashMap keys without needing to allocate more and more string data.

This will be necessary for the Multikernel version of the Microkit as it will be implemented by building a system/spec for each core, which makes the indices invalid when embedded in e.g. channels or otherwise.

This also means that you can declare channels before PDs, instead they were forced to be placed in the SDF after the PDs due to the way the parsing worked.

As part of this, use Rc<str> instead of String/&str in
places so that we can cheaply have owned-strings in
HashMap keys without needing to allocate more and more
string data.

This will be necessary for the Multikernel version of the
Microkit as it will be implemented by building a system/spec
for each core, which makes the indices invalid when embedded
in e.g. channels or otherwise.

This also means that you can declare channels before PDs,
instead they were forced to be placed in the SDF after
the PDs due to the way the parsing worked.

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
HashMaps have inconsistent ordering across platforms so
this can cause slight behaviour differences; this is enough
to map tests pass/fail based on order of names.

We'd be able to remove all uses of HashMaps if the rust-seL4
ObjectId implemented Ord, but let's not for now.

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
Comment thread tool/microkit/src/sdf.rs
}

for pd in pds.iter() {
if pds.iter().filter(|x| pd.name == x.name).count() > 1 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Personally I would use a HashSet then return error on collision. This linear scan is a bit slow if the user have a lot of PDs when we get around to raising MAX_PDS. This is rather inconsequential in the grand scheme of things (capDL steps, then compression etc) so up to you if you want to change it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, this could be refactored to be a bit smarter. This code previously existed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll tack on an extra commit.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

... Actually, no, what I really should do is change pd_flatten to be a HashMap and then can move the error there, but that gets more complicated.

This is a little more flexible than &String.

Signed-off-by: Julia Vassiliki <julia.vassiliki@unsw.edu.au>
@midnightveil
midnightveil merged commit be1c3ed into seL4:main Aug 12, 2026
12 checks passed
@midnightveil
midnightveil deleted the julia/use-names-not-id branch August 12, 2026 03:52
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.

2 participants