On 3/18/25 6:03 AM, Brendan Jackman wrote:
On Tue Mar 18, 2025 at 12:50 AM UTC, Junaid Shahid wrote:
On 3/17/25 4:40 AM, Brendan Jackman wrote:
static inline void asi_start(void)
{
/*
* Cannot currently context switch in the restricted adddress
* space.
*/
lockdep_assert_preemption_disabled();
I assume that this limitation is just for the initial version in this RFC,
right?
Well I think we also wanna get ASI in-tree with this limitation,
otherwise the initial series will be too big and complex.
Agreed. That is what I meant as well.
But even in that case, I think this should be in asi_start_critical()
below, not asi_start(), since IIRC the KVM run loop does contain preemptible
code as well. And we would need an explicit asi_exit() in the context switch
code like we had in an earlier RFC.
Oh. Yeah. In my proposal below I had totally forgotten we had
asi_exit() in the context_switch() path (it is there in this patch).
So we only need the asi_exit() in the KVM code in order to avoid
actually hitting e.g. exit_to_user_mode() in the restricted address
space.
But... we can just put an asi_exit() there explicitly instead of
dumping all this weirdness into the "core API" and the KVM codebase.
So... I think all we really need is asi_start_critical() and
asi_end_critical()? And make everything else happen as part of the
normal functioning of the entry and context-switching logic. Am I
forgetting something else?
Yes, I think this should work.
Thanks,
Junaid