From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Wei Liu <wei.liu2@citrix.com>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 3/4] x86/pv: Drop {compat_, }create_bounce_frame() and use the C version instead
Date: Tue, 9 May 2017 18:24:32 +0100 [thread overview]
Message-ID: <bfd937eb-7a42-2e11-ff9c-d22c81d28db4@citrix.com> (raw)
In-Reply-To: <591207600200007800158518@prv-mh.provo.novell.com>
On 09/05/17 17:16, Jan Beulich wrote:
>>>> On 08.05.17 at 17:48, <andrew.cooper3@citrix.com> 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@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-05-09 17:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-08 15:48 [PATCH RFC for-next 0/4] Reimpliement {compat_, }create_bounce_frame() in C Andrew Cooper
2017-05-08 15:48 ` [PATCH 1/4] x86/pv: Drop int80_bounce from struct pv_vcpu Andrew Cooper
2017-05-09 14:49 ` Jan Beulich
2017-05-09 15:09 ` Andrew Cooper
2017-05-08 15:48 ` [PATCH 2/4] x86/pv: Introduce pv_create_exception_frame() Andrew Cooper
2017-05-09 15:58 ` Jan Beulich
2017-05-09 17:09 ` Andrew Cooper
2017-05-10 7:43 ` Jan Beulich
2017-05-08 15:48 ` [PATCH 3/4] x86/pv: Drop {compat_, }create_bounce_frame() and use the C version instead Andrew Cooper
2017-05-09 16:16 ` Jan Beulich
2017-05-09 17:24 ` Andrew Cooper [this message]
2017-05-10 7:50 ` Jan Beulich
2017-05-08 15:48 ` [PATCH 4/4] x86/pv: Implement the failsafe callback using the general path Andrew Cooper
2017-05-09 16:22 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bfd937eb-7a42-2e11-ff9c-d22c81d28db4@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).