[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: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 13 Jul 2021 08:28:44 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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=7zd019r5dabsAbw9PEOYqJoOKhTQ9EnewFNJ+EinRTE=; b=A1d2uMiXU7bLW5HWdGxOg4SI0eQKvgGnl0v6UZ5SaBL5XASnsKCnsX9dCI5BW9l3ts5q2SII+OzTu8iBcGS3svXtSQ82z1cfVyPOi8BtW9rGOD7UoW6yYP3cam8jDgdbO9SgUJ8O/t7ddx8etwfiQuHyrHFP2/O9GMfzaSK6g6fysSkyV+i4uQVeKNcxdpF5H9lvlsb+YqOqNkTBLY49pqFcGW8Tn2/h8EMXfVun0GuiaU0R9r3Z64Q9XffrVon1N2sP19F0iCxZzxGDrn/ftroPilO0MKDdOV3MoDV9vyhhrs+fB+iz0oKrZA3ZgahGGx+qS/qkrjMsEyKKw2HuDQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UxrO3ErhX1EjxGp7/GM77hGL9UZ239Lq7jyKNu3dRvWUHmTWGM7PnGqOq6PPQAVPQ/fEpB7zOJiwnw1BLuKhKaJEYT9R1jdFx7GB5/8Nd1DnK0AjRWOf7FALh1OCAeBWO1CsAO9CH+AXJL+zJDgDN/71PaV72KW7z/Db/+koJK233UgkYdxeh8IKeS7+/CiHpBLJ4qdz3sgvOUM47PyIAR+aSGvCC1Ssu7BXTFISn2qE3/kD+nWCACbBgUFF4z9j+D9T9d9fsWzCeSyOxEyXWQ3JSwS/Mz7dXxr11Gg2A/gWgtn7vaAvbhPhFQbCy25NowKCaeslbt3nK9felwlXqQ==
  • Authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 13 Jul 2021 06:28:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 13.07.2021 01:48, Andrew Cooper wrote:
> 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 ...,

__initconstrel then, I suppose.

> 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).

ro_after_init and initdata can't be alternatives of one another; ops
(until be gain ro_after_init) need to remain in .bss (or .data).

Jan




 


Rackspace

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