Skip to content

Fix approach used for making PDs passive#535

Open
dreamliner787-9 wants to merge 5 commits into
seL4:mainfrom
au-ts:passive_improve
Open

Fix approach used for making PDs passive#535
dreamliner787-9 wants to merge 5 commits into
seL4:mainfrom
au-ts:passive_improve

Conversation

@dreamliner787-9

Copy link
Copy Markdown
Contributor

Previously, the ELF code treats program headers = segments. While this
worked originally, it broke for cases that requires >= 2 program
headers to refer to the same segment.

Now, when the ELF is parsed, the code will create a 1-1 mapping of
segments to program headers like before. But the allow for additional
program headers to be inserted.

Signed-off-by: Bill Nguyen <bill.nguyen@unsw.edu.au>
Added `pub fn phdrs_table(&self) -> Vec<(ElfProgramHeader64, usize)>` to
ELF code.

Signed-off-by: Bill Nguyen <bill.nguyen@unsw.edu.au>
Modified `pub fn add_segment()` to allow for an additional program
header in the ELF to describe the segment with a user defined type
identifier.

Signed-off-by: Bill Nguyen <bill.nguyen@unsw.edu.au>
Which also required changes to how the spec is packed into the
intialiser.

Signed-off-by: Bill Nguyen <bill.nguyen@unsw.edu.au>
Previously, when a task wants to be passive, it signals the monitor
after its `init()` entrypoint returns. While this is fine for single
core, there are 2 problems:
1. It will not scale/work in multi-core setups. Given that it is a
non-blocking send, a scenario may occur where the monitor is already
dealing with a message from one PD (meaning that it is not waiting on
an endpoint) and another PD that wants to make itself passive on another
core which means the message will be lost.
2. It affects verification as it leads to assumptions needing to be made
about the scheduling of the system.

Now, the process happens inside the capDL initialiser itself, which
fixes all the problems above.

Signed-off-by: Bill Nguyen <bill.nguyen@unsw.edu.au>
@@ -1043,29 +1028,13 @@ pub fn build_capdl_spec(

// Step 3-15 bind this PD's TCB to the monitor, this accomplish two purposes:
// 1. Allow PDs' TCBs to be named to their proper name in SDF in debug config.

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.

Not really relevant, but surely the capDL initialiser should also be doing this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It actually already does that, but based on the name of the TCB object rather than the PD name. In Microkit the TCB name is prefixed with tcb_ then PD name. If this isn't a big problem then we can strip out the debug name entirely from Microkit.

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.

I think we should probably strip out the Microkit duplication of this work, yes.

typedef seL4_MessageInfo_t microkit_msginfo;

#define MONITOR_EP 5
/* Index 5 is unused */

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.

I think this is probably unnecessary given all the other indices that are unused.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added that to signal to anyone looking at the code later that the index is free to re-use, since previously it was occupied. But I can remove it

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.

Fix approach used for making PDs passive at run-time

2 participants