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

Minor improvements to CRefine #699

Merged
merged 6 commits into from
Apr 13, 2024
Merged

Conversation

corlewis
Copy link
Member

@corlewis corlewis commented Dec 6, 2023

No description provided.

@@ -905,6 +905,8 @@ lemma valid_mdb_ctes_of_prev:

end

lemmas ThreadState_defs = StrictC'_thread_state_defs
Copy link
Member Author

Choose a reason for hiding this comment

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

It wasn't obvious where to put this. It ended up here purely because I wanted it outside of the kernel locale so that it could be used in ADT_C. Suggestions for a more sensible location are welcome.

Copy link
Member

Choose a reason for hiding this comment

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

Would Kernel_C in cspec make sense or is that too far up?

Copy link
Member Author

@corlewis corlewis Mar 27, 2024

Choose a reason for hiding this comment

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

That could work, although there isn't anything directly comparable there after the install_C_file command.

The other option I just thought of is cspec/KernelState_C. That also doesn't have anything directly comparable but has the benefit of being arch-generic so there's less duplication.

Copy link
Member

Choose a reason for hiding this comment

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

I don't know how directly comparable you need it to be, but from my perspective the Hide unqualified names conflicting with Kernel_Config names. Force use of Kernel_C prefix sounds like it's along the lines of what you're trying to do. It does have the downside of being duplicated across arches, being in Kernel_C. I've never touched KernelState_C before, it looks ancient. @lsf37 might remember what its role is supposed to be. I'd still prefer it in Kernel_C for now, given it's somewhere we might find it again.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good point about being able to find this again. I'm not sure if I've seen KernelState_C before either, I only found it now because I was looking at the arch-generic cspec files to decide whether any were suitable.

Copy link
Member

@lsf37 lsf37 Apr 8, 2024

Choose a reason for hiding this comment

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

KernelState_C was introduced by Simon in 2008 with the commit message "Changes for new bitfields", so I guess we can take it as whatever we like :-), but it looks like it is not actually included anywhere and the definitions in there are unused.

I like the idea of a theory where we could put some generic things that work for all kernel versions, but introducing that will mess with the theory include graph a bit. Not a major problem, but might be better to defer to a point where we want to think about arch splitting CRefine a bit more.

So I propose to put ThreadState_defs into Kernel_C instead and to remove KernelState_C from ROOT and the repo.

Copy link
Member

@lsf37 lsf37 Apr 8, 2024

Choose a reason for hiding this comment

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

Hm, correction. As Corey points out: the file is used, from generated bitfield theories (which git grep doesn't see), and those do use the definitions. In that case we should not remove it, of course. And the commit message actually makes sense with that.

Ok, new proposal: I'd still add ThreadState_defs to Kernel_C, and add a comment to KernelState_C saying that it is the base theory for generated bitfield proofs about the kernel.

Copy link
Member

Choose a reason for hiding this comment

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

I support this proposal.
At some point the idea of a generic theory that happens right after install_C_file might be useful, we should keep our eyes open for further demand for 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 like the proposal as well and have implemented it. Is there anything else to do before merging this PR?

Copy link
Member

Choose a reason for hiding this comment

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

All good to go from my side.

Copy link
Member

@lsf37 lsf37 left a comment

Choose a reason for hiding this comment

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

Nice. As discussed out-of-band, we should leave this one queued up for a bit until we can integrate nicely with AArch64 and MCS.

Copy link
Contributor

@michaelmcinerney michaelmcinerney left a comment

Choose a reason for hiding this comment

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

👍

proof/crefine/ARM/TcbAcc_C.thy Outdated Show resolved Hide resolved
@corlewis
Copy link
Member Author

corlewis commented Mar 27, 2024

This has been updated to also include AArch64. I think it's now ready to merge, pending a decision on the location of ThreadState_defs.

Copy link
Member

@Xaphiosis Xaphiosis left a comment

Choose a reason for hiding this comment

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

I think this is fine now

This allows these lemmas to be used for goals with slightly more
complicated return relations.

Signed-off-by: Corey Lewis <[email protected]>
This is just an alias for the c-parser generated
StrictC'_thread_state_defs, but is hopefully easier to remember.

Signed-off-by: Corey Lewis <[email protected]>
@corlewis corlewis merged commit 827ee5e into seL4:master Apr 13, 2024
13 checks passed
@corlewis corlewis deleted the crefine_improvements branch April 13, 2024 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants