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

Re: [PATCH v2 01/10] xen: Implement xen/alternative-call.h for use in common code


  • To: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Tue, 13 Jul 2021 00:48:37 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qin92F4bC2RxTlzUZNheYyJ0+TFTswG2B7/ZNScveJ0=; b=mPhJGJmEdcUTlBNOj3l+KS+CHcEj4dmWXaVJG1E+EmpmG+GamO+gTygiIdA1X1r2X9eB9Tpnp+jWKZqXVSFOhqaiLyx+Vzm/jBjBOXVeUYkmGSakssBZlGOUYmcGcYaVOB9Lye3v6gIHBSLoSfkJPSx7AchnnE4GjssXgDQUxc5IriwHTv5vuMXm0y/FdFEt18+M5oAAuTkFMXhaWAOANDfGT1JA0h2P+HaYvhI38jA2q045Zjo+x8nC4q4uxR3s8Sh4cF4T+w1+y0pADsxNBUJadEVHeAJS+b2/qNmyXdyxI8bL5lnRzsWYk4IwehgVqbZcCpkfY5d8Tn6hupfZyg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JvzJP9Gxtj8AjGWO4B46CtIDTQ/KjsZgs1ZZAgz6ZItHoxYke/afEuiXImRZzr40BimUMEILYwMXmWboF2B55n2myOaGpYkoECXReQSRzNUfSfTI8o6rQmGhRGIl8gI5+AofdbSWp6T0YaUErbNSWN4teYpSILzFvKjeFgbOpbChvbVZ83lMsbNkrfHC2MvNu2GCH8RSxcaOpnZIhor2Hy7igPGO0/5NpYtTQDYH7b8aSSZRTZ2i6dEMq7kZfDxilfxeRcKErBEfVk2PxYP4I5fcglvstE6oA1aDmQVx/gAKhgAOnyMVpuBgjRH6SBV861okQ8W2yeHVawIT2wQBTA==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 12 Jul 2021 23:48:53 +0000
  • Ironport-hdrordr: A9a23:j/3CQ6rkQq9rcNx/D3TrML8aV5rveYIsimQD101hICG9Evb0qy nOpoV/6faQslwssR4b9uxoVJPvfZq+z+8W3WByB9eftWDd0QPFEGgL1+DfKlbbak7DH4BmtJ uJc8JFeafN5VoRt7eG3OFveexQvOVu88qT9JjjJ28Gd3APV0n5hT0JcjpyFCdNNW57LKt8Lr WwzOxdqQGtfHwGB/7LfUXsD4D41rv2fIuNW29+OyIa
  • Ironport-sdr: 0CZqER92cZ19JpEBI9UM9FDTBIu9q/+FvgSOtvE7NncPmaY1EkUezuJkfFTGtcJ0mIqDTfYJEA XSWr5J61uZL7YxqxaCUmOuriDL0j5SF7V6/iNzuSZNYL9EN/sETUGoLrcMhMfhSIYiKOO3/EyX OmbCqcPxv83JA4VNT29RRj/4ZP8A6igJg58mpXDcd6C837ws7MkD9s5YbUnjiWynGoyN2phS5M wIpMls3xklbg9BZQ0Wo9vj5zfxzyRRETD9QGtTyH4bAIDJhtQ7ib5UBHtzHnmmDcPsmuDhhZKL MRE=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12/07/2021 21:32, Daniel P. Smith wrote:
> diff --git a/xen/include/xen/alternative-call.h 
> b/xen/include/xen/alternative-call.h
> new file mode 100644
> index 0000000000..11d1c26068
> --- /dev/null
> +++ b/xen/include/xen/alternative-call.h
> @@ -0,0 +1,65 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef XEN_ALTERNATIVE_CALL
> +#define XEN_ALTERNATIVE_CALL
> +
> +/*
> + * Some subsystems in Xen may have multiple implementions, which can be
> + * resolved to a single implementation at boot time.  By default, this will
> + * result in the use of function pointers.
> + *
> + * Some architectures may have mechanisms for dynamically modifying .text.
> + * Using this mechnaism, function pointers can be converted to direct calls
> + * which are typically more efficient at runtime.
> + *
> + * For architectures to support:
> + *
> + * - Implement alternative_{,v}call() in asm/alternative.h.  Code generation
> + *   requirements are to emit a function pointer call at build time, and 
> stash
> + *   enough metadata to simplify the call at boot once the implementation has
> + *   been resolved.
> + * - Select ALTERNATIVE_CALL in Kconfig.
> + *
> + * To use:
> + *
> + * Consider the following simplified example.
> + *
> + *  1) struct foo_ops __alt_call_maybe_initdata ops;
> + *
> + *  2) struct foo_ops __alt_call_maybe_initconst foo_a_ops = { ... };
> + *     struct foo_ops __alt_call_maybe_initconst foo_b_ops = { ... };

It occurs to me after reviewing patch 2 that these want to be const
struct foo_ops __initconst ..., and there is no need for
__alt_call_maybe_initconst at all.

The only thing wanting a conditional annotation like this is the single
ops object, and it needs to be initdata (or hopefully ro_after_init in
the future).

~Andrew



 


Rackspace

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