[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH RFC for-4.13 04/10] xen/arm: Ensure the SSBD workaround is re-enabled right after exiting a guest



Hi,

On 27/09/2019 15:21, Volodymyr Babchuk wrote:

Julien Grall writes:

On 27/09/2019 14:33, Volodymyr Babchuk wrote:
Julien Grall writes:
On 27/09/2019 13:39, Volodymyr Babchuk wrote:
Julien Grall writes:
On 27/09/2019 12:56, Volodymyr Babchuk wrote:
Julien Grall writes:
Or maybe, we should not split the function at all? Instead, we enable
interrupts right in the middle of it.

I thought about this but I didn't much like the resulting code.

The instruction to unmask interrupts requires to take an immediate
(indicates which interrupts to unmask). As not all the traps require
to unmask the same interrupts, we would end up to have to a bunch of
if in the code to select the right unmasking.
Ah, yes, this is the problem. We can provide callback to
enter_hypervisor_from_guest().

I am not sure what you mean by this. Do you mean a callback that will
unmask the interrupts?
Yes. You can pass function pointer to enter_hypervisor_from_guest(). To
a function, that will unmask the interrupts. I'm sure that guest_vector
macro can generate it for you. Something like this:

         .macro  guest_vector compat, iflags, trap, save_x0_x1=1
         entry   hyp=0, compat=\compat, save_x0_x1=\save_x0_x1
         /*
          * The vSError will be checked while SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT
          * is not set. If a vSError took place, the initial exception will be
          * skipped. Exit ASAP
          */
         ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f",
                     "nop; nop",
                     SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT)
         ldr     x0, =1f
         bl      enter_hypervisor_from_guest
         mov     x0, sp
         bl      do_trap_\trap
         b       1f
2:
         msr     daifclr, \iflags
         ret
1:
         exit    hyp=0, compat=\compat
         .endm

TBH, I don't see what's the point you are trying to make here. Yes, there are many way to write a code and possibility to make one function. You could also create a skeleton macro for enter_hypervisor_from_guest and generate N of them (one per set of unmask interrupts) and call them.

But are they really worth it?

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.