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

Re: [Xen-devel] [PATCH 3/4] x86/pv: Drop {compat_, }create_bounce_frame() and use the C version instead



On 09/05/17 17:16, Jan Beulich wrote:
>>>> On 08.05.17 at 17:48, <andrew.cooper3@xxxxxxxxxx> wrote:
>> --- a/xen/arch/x86/x86_64/compat/entry.S
>> +++ b/xen/arch/x86/x86_64/compat/entry.S
>> @@ -51,7 +51,7 @@ compat_test_guest_events:
>>          movl  VCPU_event_sel(%rbx),%eax
>>          movw  %ax,TRAPBOUNCE_cs(%rdx)
>>          movb  $TBF_INTERRUPT,TRAPBOUNCE_flags(%rdx)
>> -        call  compat_create_bounce_frame
>> +        call  pv_create_exception_frame
>>          jmp   compat_test_all_events
>>  
>>          ALIGN
>> @@ -95,7 +95,7 @@ compat_process_nmi:
>>          /* FALLTHROUGH */
>>  compat_process_trap:
>>          leaq  VCPU_trap_bounce(%rbx),%rdx
>> -        call  compat_create_bounce_frame
>> +        call  pv_create_exception_frame
>>          jmp   compat_test_all_events
> The leaq should go away then too.

So it can.

>
>> @@ -181,8 +181,7 @@ ENTRY(compat_post_handle_exception)
>>          testb $TBF_EXCEPTION,TRAPBOUNCE_flags(%rdx)
>>          jz    compat_test_all_events
>>  .Lcompat_bounce_exception:
>> -        call  compat_create_bounce_frame
>> -        movb  $0,TRAPBOUNCE_flags(%rdx)
>> +        call  pv_create_exception_frame
>>          jmp   compat_test_all_events
> Considering this recurring pattern of call/jmp I wonder whether we
> could reduce the branch tracking structure utilization in the CPU a
> little by folding these paths.

I think we can lift all of this softirq/event/nmi/mce handling logic up
into C, which will remove almost all of the guest-handling asm code in
entry.S

However, it would still retain this "goto again" structure, and will
eventually have to drop back into asm to actually return to the guest.

The problem (which I haven't got a good solution for yet) is that, if I
make the C functions noreturn, I will need to duplicate them so they can
jmp to the proper return point.  The alternative would be a moderately
hard to predict conditional jump.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

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