Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame

From: Juergen Gross
Date: Wed Jul 26 2017 - 11:50:59 EST


On 26/07/17 15:48, Andy Lutomirski wrote:
> On Mon, Jul 24, 2017 at 7:28 AM, Juergen Gross <jgross@xxxxxxxx> wrote:
>> When running as Xen pv-guest the exception frame on the stack contains
>> %r11 and %rcx additional to the other data pushed by the processor.
>>
>> Instead of having a paravirt op being called for each exception type
>> prepend the Xen specific code to each exception entry. When running as
>> Xen pv-guest just use the exception entry with prepended instructions,
>> otherwise use the entry without the Xen specific code.
>
> I think this is a nice cleanup, but I'm wondering if it would be even
> nicer if the Xen part was kept out-of-line. That is, could Xen have
> little stubs like:
>
> xen_alignment_check:
> pop %rcx
> pop %r11
> jmp alignment_check
>
> rather than using the macros in entry_64.S that you have? Then you
> could adjust set_trap_gate instead of pack_gate and maybe even do
> something like:
>
> #define set_trap_gate(..., name, ...) set_native_or_xen_trap_gate(...,
> name, xen_##name, ...)

I think I'll have something like:

#define pv_trap_entry(name) (xen_pv_domain() ? xen_ ## name : name)

and use it like:

set_intr_gate(X86_TRAP_AC, pv_trap_entry(alignment_check));

This will avoid having to define macros for all variants of
set_intr_gate(), e.g. set_intr_gate_ist(), set_system_intr_gate().

Do you have any objections?


Juergen