xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH v2 03/12] x86: infrastructure to allow converting certain indirect calls to direct ones
Date: Wed, 29 Aug 2018 15:37:35 +0100	[thread overview]
Message-ID: <fce357b9-16d5-000b-ec39-427b49a53b23@arm.com> (raw)
In-Reply-To: <5B86A77B02000078001E3123@prv1-mh.provo.novell.com>

Hi Jan,

On 08/29/2018 03:02 PM, Jan Beulich wrote:
> +#define alternative_vcall2(func, arg1, arg2) ({           \
> +    ALT_CALL_ARG(arg1, 1);                                \
> +    ALT_CALL_ARG(arg2, 2);                                \

I believe this code has the same issue Stefano recently discovered on 
the SMCCC.

Using explicit register variable will not reserve the register. So if 
arg* is a function call, the register you have just assigned will get 
clobbered (see [1]).

The solution to this is evaluating all the arguments before declaring 
the variable with explicit registers. See the patch [2] for an example.


> +    ALT_CALL_NO_ARG3;                                     \
> +    (void)sizeof(func(arg1, arg2));                       \
> +    (void)alternative_callN(2, int, func);                \
> +})

[...]

> --- a/xen/include/xen/lib.h
> +++ b/xen/include/xen/lib.h
> @@ -66,6 +66,10 @@
>   
>   #define ROUNDUP(x, a) (((x) + (a) - 1) & ~((a) - 1))
>   
> +#define count_va_arg_(dot, a1, a2, a3, a4, a5, a6, a7, a8, x, ...) x > +#define count_va_arg(args...) \
> +    count_va_arg_(., ## args, 8, 7, 6, 5, 4, 3, 2, 1, 0)

We have a similar function in SMCCC where only the arguments except the 
first one (Function ID) and last one (Result pointer). I believe 
different context will require different way to count argument in order 
to keep the code readable.

So I am not entirely sure if there are a benefit to have this function 
in common.

Cheers,

[1] 
https://gcc.gnu.org/onlinedocs/gcc/Local-Register-Variables.html#Local-Register-Variables

[2] https://lists.xen.org/archives/html/xen-devel/2018-08/msg02139.html

-- 
Julien Grall

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

  reply	other threads:[~2018-08-29 14:37 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11 13:15 [PATCH 00/16] x86: indirect call overhead reduction Jan Beulich
2018-07-11 13:23 ` [PATCH 01/16] VMX: reduce number of posted-interrupt hooks Jan Beulich
2018-07-13 12:17   ` Andrew Cooper
2018-07-19  1:51   ` Tian, Kevin
2018-07-19  6:13     ` Jan Beulich
2018-07-11 13:23 ` [PATCH 02/16] VMX: don't unconditionally set the tsc_scaling.setup hook Jan Beulich
2018-07-13 12:17   ` Andrew Cooper
2018-07-19  1:52   ` Tian, Kevin
2018-07-11 13:24 ` [PATCH 03/16] x86/HVM: switch virtual_intr_delivery_enabled() hook to simple boolean Jan Beulich
2018-07-13 12:18   ` Andrew Cooper
2018-07-19  1:56   ` Tian, Kevin
2018-07-19  6:15     ` Jan Beulich
2018-07-19  6:18       ` Tian, Kevin
2018-07-11 13:25 ` [PATCH 04/16] x86/HVM: drop vmfunc_intercept Jan Beulich
2018-07-13 12:18   ` Andrew Cooper
2018-07-19  1:56   ` Tian, Kevin
2018-07-11 13:26 ` [PATCH 05/16] x86/HVM: add wrapper for hvm_funcs.set_tsc_offset() Jan Beulich
2018-07-13 12:19   ` Andrew Cooper
2018-07-13 13:20     ` Jan Beulich
2018-07-11 13:27 ` [PATCH 06/16] x86: allow producing .i or .s for multiply compiled files Jan Beulich
2018-07-13 12:20   ` Andrew Cooper
2018-07-11 13:29 ` [PATCH 07/16] x86/shadow: fetch CPL just once in sh_page_fault() Jan Beulich
2018-07-11 13:41   ` Andrew Cooper
2018-07-11 13:46   ` Tim Deegan
2018-07-11 13:50     ` Jan Beulich
2018-07-11 13:39 ` [PATCH 08/16] x86/alternatives: allow using assembler macros in favor of C ones Jan Beulich
2018-07-11 13:40 ` [PATCH 09/16] x86: infrastructure to allow converting certain indirect calls to direct ones Jan Beulich
2018-07-11 13:42 ` [PATCH 10/16] x86/HVM: patch indirect calls through hvm_funcs " Jan Beulich
2018-07-11 13:47   ` Jan Beulich
2018-07-13 10:06   ` Paul Durrant
2018-07-13 13:18     ` Jan Beulich
2018-07-11 13:43 ` [PATCH 11/16] x86/HVM: patch vINTR " Jan Beulich
2018-07-19  2:00   ` Tian, Kevin
2018-07-11 13:44 ` [PATCH 12/16] x86: patch ctxt_switch_masking() indirect call to direct one Jan Beulich
2018-07-11 13:44 ` [PATCH 13/16] x86/genapic: drop .target_cpus() hook Jan Beulich
2018-07-11 13:45 ` [PATCH 14/16] x86/genapic: remove indirection from genapic hook accesses Jan Beulich
2018-07-11 13:46 ` [PATCH 15/16] x86/genapic: patch indirect calls to direct ones Jan Beulich
2018-07-11 13:46 ` [PATCH 16/16] x86/cpuidle: patch some " Jan Beulich
2018-07-13  8:10 ` [PATCH 00/16] x86: indirect call overhead reduction Jan Beulich
2018-07-13 13:00   ` Julien Grall
2018-07-13 13:27     ` Jan Beulich
2018-07-13 13:39       ` Julien Grall
2018-07-13 14:27         ` Jan Beulich
2018-07-13 17:15           ` Julien Grall
2018-07-16  6:15             ` Jan Beulich
2018-08-01 10:01 ` Jan Beulich
2018-08-29 13:55 ` [PATCH v2 00/12] " Jan Beulich
2018-08-29 13:59   ` [PATCH v2 01/12] VMX: reduce number of posted-interrupt hooks Jan Beulich
2018-08-29 14:56     ` Andrew Cooper
2018-08-30  1:41     ` Tian, Kevin
2018-08-29 14:00   ` [PATCH v2 02/12] x86/alternatives: allow using assembler macros in favor of C ones Jan Beulich
2018-08-29 14:52     ` Andrew Cooper
2018-08-29 14:02   ` [PATCH v2 03/12] x86: infrastructure to allow converting certain indirect calls to direct ones Jan Beulich
2018-08-29 14:37     ` Julien Grall [this message]
2018-08-29 14:50       ` Jan Beulich
2018-08-29 16:01     ` Andrew Cooper
2018-08-30  7:19       ` Jan Beulich
2018-08-29 14:04   ` [PATCH v2 04/12] x86/HVM: patch indirect calls through hvm_funcs " Jan Beulich
2018-08-29 14:04   ` [PATCH v2 05/12] x86/HVM: patch vINTR " Jan Beulich
2018-08-29 14:05   ` [PATCH v2 06/12] x86: patch ctxt_switch_masking() indirect call to direct one Jan Beulich
2018-08-29 14:06   ` [PATCH v2 07/12] x86/genapic: drop .target_cpus() hook Jan Beulich
2018-08-29 15:45     ` Andrew Cooper
2018-08-29 14:06   ` [PATCH v2 08/12] x86/genapic: remove indirection from genapic hook accesses Jan Beulich
2018-08-29 14:07   ` [PATCH v2 09/12] x86/genapic: patch indirect calls to direct ones Jan Beulich
2018-08-29 14:07   ` [PATCH v2 10/12] x86/cpuidle: patch some " Jan Beulich
2018-08-29 14:08   ` [PATCH v2 11/12] cpufreq: convert to a single post-init driver (hooks) instance Jan Beulich
2018-08-29 14:09   ` [PATCH v2 12/12] cpufreq: patch target() indirect call to direct one Jan Beulich
2018-08-29 15:12   ` [PATCH v2 00/12] x86: indirect call overhead reduction 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=fce357b9-16d5-000b-ec39-427b49a53b23@arm.com \
    --to=julien.grall@arm.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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).