On Thu, Sep 3, 2020 at 9:20 AM Thomas Gleixner <t...@linutronix.de> wrote: > > On Thu, Sep 03 2020 at 00:34, Joel Fernandes wrote: > > On Wed, Sep 2, 2020 at 12:57 PM Dario Faggioli <dfaggi...@suse.com> wrote: > >> 2) protection of the kernel from the other thread running in userspace > >> may be achieved in different ways. This is one, sure. ASI will probably > >> be another. Hence if/when we'll have both, this and ASI, it would be > >> cool to be able to configure the system in such a way that there is > >> only one active, to avoid paying the price of both! :-) > > > > Actually, no. Part of ASI will involve exactly what this patch does - > > IPI-pausing siblings but ASI does so when they have no choice but to > > switch away from the "limited kernel" mapping, into the full host > > kernel mapping. I am not sure if they have yet implemented that part > > but they do talk of it in [1] and in their pretty LPC slides. It is > > just that ASI tries to avoid that scenario of kicking all siblings out > > of guest mode. So, maybe this patch can be a stepping stone to ASI. > > At least I got the entry hooks right, and the algorithm is efficient > > IMO (useless IPIs are avoided). ASI can then come in and avoid > > sending IPIs even more by doing their limited-kernel-mapping things if > > needed. So, it does not need to be this vs ASI, both may be needed. > > Right. There are different parts which are seperate: > > 1) Core scheduling as a best effort feature (performance for certain use > cases) > > 2) Enforced core scheduling (utilizes #1 basics) > > 3) ASI > > 4) Kick sibling out of guest/host and wait mechanics > > #1, #2, #3 can be used stand alone. #4 is a utility > > Then you get combos: > > A) #2 + #4: > > core wide protection. i.e. what this series tries to achieve. #3 > triggers the kick at the low level VMEXIT or entry from user mode > boundary. The wait happens at the same level > > B) #3 + #4: > > ASI plus kicking the sibling/wait mechanics independent of what's > scheduled. #3 triggers the kick at the ASI switch to full host > mapping boundary and the wait is probably the same as in #A > > C) #2 + #3 + #4: > > The full concert, but trigger/wait wise the same as #B > > So we really want to make at least #4 an independent utility.
Agreed! Thanks for enlisting all the cases so well. I believe this could be achieved by moving the calls to unsafe_enter() and unsafe_exit() to when ASI decides it is time to enter the unsafe kernel context. I will keep it in mind when sending the next revision as well. thanks, - Joel