Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1697546

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

From Andy Lutomirski <luto@amacapital.net>
Newsgroups linux.kernel
Subject Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame
Date 2017-07-26 22:20 +0200
Message-ID <u7AWK-4Xd-17@gated-at.bofh.it> (permalink)
References <u6MwX-655-31@gated-at.bofh.it> <u7uRl-Xi-23@gated-at.bofh.it> <u7wT8-2dM-11@gated-at.bofh.it> <u7yLh-3p3-29@gated-at.bofh.it> <u7zxD-3Wx-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



> On Jul 26, 2017, at 2:43 PM, Juergen Gross <jgross@suse.com> wrote:
> 
>> On 26/07/17 19:57, Andy Lutomirski wrote:
>> 
>> 
>>>> On Jul 26, 2017, at 11:50 AM, Juergen Gross <jgross@suse.com> wrote:
>>>> 
>>>>> On 26/07/17 15:48, Andy Lutomirski wrote:
>>>>> On Mon, Jul 24, 2017 at 7:28 AM, Juergen Gross <jgross@suse.com> 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?
>>> 
>> 
>> Sounds good to me.
>> 
>> FWIW, I have no real objection to putting the Xen entry right before the native entry and falling through.  I don't love the ip -= 3 bit, though, and I think that the PV_ENTRY macro is too magical.
>> 
>> This might be okay, though:
>> 
>> XEN_PV_ENTRY_FALLTHROUGH(foo)
>> ENTRY(foo)
> 
> ENTRY() aligns on 16 byte boundary. So I have to avoid ENTRY(foo) above
> in the Xen case when I want to fall through.
> 
> So either I have to do something like PV_ENTRY (I could avoid the magic
> "3" by using the xen_foo entry via pv_trap_entry()), or I need the stub
> with "jmp" for Xen.

Hmm.  Either the 16 byte alignment is pointless or the PV_ENTRT macro is wrong.

Anyway, the jmp is probably the best approach.  Then we could eventually make a .text.xen_pv section and discard it on non-xen_pv boots.

> 
> 
> Juergen

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH v1] xen: get rid of paravirt op adjust_exception_frame Juergen Gross <jgross@suse.com> - 2017-07-24 16:30 +0200
  Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-07-26 15:00 +0200
  Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame Andy Lutomirski <luto@amacapital.net> - 2017-07-26 15:50 +0200
    Re: [Xen-devel] [PATCH v1] xen: get rid of paravirt op  adjust_exception_frame Andrew Cooper <andrew.cooper3@citrix.com> - 2017-07-26 16:10 +0200
      Re: [Xen-devel] [PATCH v1] xen: get rid of paravirt op adjust_exception_frame Andy Lutomirski <luto@amacapital.net> - 2017-07-26 16:10 +0200
        Re: [Xen-devel] [PATCH v1] xen: get rid of paravirt op  adjust_exception_frame Andrew Cooper <andrew.cooper3@citrix.com> - 2017-07-26 16:40 +0200
    Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame Juergen Gross <jgross@suse.com> - 2017-07-26 17:20 +0200
    Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame Juergen Gross <jgross@suse.com> - 2017-07-26 18:00 +0200
      Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame Andy Lutomirski <luto@amacapital.net> - 2017-07-26 20:00 +0200
        Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame Juergen Gross <jgross@suse.com> - 2017-07-26 20:50 +0200
          Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame Andy Lutomirski <luto@amacapital.net> - 2017-07-26 22:20 +0200

csiph-web