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

Re: [PATCH] x86: rework hypercall argument count table instantiation & use


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 15 Aug 2022 17:20:38 +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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Bc+BFnwA3IuzyJsXn1v064viyfz5y/UXnPnqicZ8sT0=; b=f63W1R59P3Y9V3WfckvtECUd7sMaulKW+TFAKmpxeqVlUwXfaQOHK98a6HQFsbmfTjF646xrpMI4kCWXKHTUXAxQKJ3Ii6FcujuTiOqJU/DtiRMvsPkIQ6RzFgZFMX+Bd6UVYWa3EdqkW8ZbW7/mwSYS6h5xFHAnMwY3oCuy+TPheAI/U7Mmvy9AjN65F/hc8+nbR6ItORxwRddxxKq/+IRlFt6OpJPEOz9YtkIclZYhKqZMiYf76sLIX4OEHqbeFafP7tgcJ/rWqSFMwkmyGYlTgK8snMDe5Pog9u3eyZKh8ZT9ohOrvIucKk+7uzPotH/zIrTY7ZKgfBtubmDSJg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JQmkGzEk2HhQT0cNOcQ7WYuq14U/wq9DckSGp97p+J3iMzQu/WmfQdmrxdAxbUM5k47JkK3ln92XoJX/JDGxVXA0fqgbb/DjiQlAtX1NWPRAC1mtz7SMikakW5y3V8d3MP1urBZml9XzSC5eSDsDLtZtuwtiTKieECJ2Ugt4Zl5Bm3OJj/U96VaAK3VKbXIcDiGtOgvoVypmgCeMn1tsOC9fh6toStjP2ZAx1FxaV1iW8CdW1Y9ec/quIm0HcMOQ++VVhwF5JY+dqLiLeKif2oHsYECBg/gprOBPYEN3GpSDAU8n5kQ+4sHvWx+Ye1Ps79oiCOg5/9aYkFtR0D0PTg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 15 Aug 2022 15:20:54 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.08.2022 17:13, Juergen Gross wrote:
> On 27.07.22 18:00, Jan Beulich wrote:
>> The initial observation were duplicate symbols that our checking warns
>> about. Instead of merely renaming one or both pair(s) of symbols,
>> reduce #ifdef-ary at the same time by moving the instantiation of the
>> arrays into macros (a native and a 32-bit one each, where likely more
>> redundancy could be eliminated, if we really wanted to). While doing the
>> conversion also stop open-coding array_access_nospec().
>>
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> 
> Reviewed-by: Juergen Gross <jgross@xxxxxxxx>

Thanks.

> With one small nit ...
> 
>> --- a/xen/arch/x86/include/asm/hypercall.h
>> +++ b/xen/arch/x86/include/asm/hypercall.h
>> @@ -43,16 +43,6 @@ compat_common_vcpu_op(
>>   
>>   #endif /* CONFIG_COMPAT */
>>   
>> -#ifndef NDEBUG
>> -static inline unsigned int _get_nargs(const unsigned char *tbl, unsigned 
>> int c)
>> -{
>> -    return tbl[c];
>> -}
>> -#define get_nargs(t, c) _get_nargs(t, array_index_nospec(c, ARRAY_SIZE(t)))
>> -#else
>> -#define get_nargs(tbl, c) 0
>> -#endif
>> -
>>   static inline void clobber_regs(struct cpu_user_regs *regs,
>>                                   unsigned int nargs)
>>   {
>> @@ -69,6 +59,11 @@ static inline void clobber_regs(struct c
>>   #endif
>>   }
>>   
>> +#define clobber_regs(r, n, t) ({ \
>> +    static const unsigned char t[] = hypercall_args_ ## t; \
>> +    clobber_regs(r, array_access_nospec(t, n)); \
>> +})
>> +
> 
> ... could I talk you into not overloading the names of the inline
> functions with macros? You are changing all the call sites anyway.

I do, but the call sites should use the present name, so if anything
it would be the inline function that gets renamed. Yet I'm
deliberately using the same name, to kind of "hide" the actual
function (like we do elsewhere in a few cases). The effect you're
after would be implicitly had by going the route described in the
post-commit-message remark. I'd be happy to switch to that model, if
that suites you better.

Jan



 


Rackspace

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