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

Re: [PATCH v2 11/15] xen/x86: call hypercall handlers via generated macro


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 4 Nov 2021 10:26:19 +0100
  • 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=REfHvitxeO5kKWtpDJ1uPc/dax70aeONLAz/WVTHs6s=; b=RaO/q2SABPF2A8e0mkEVVWET0wT5Kxr36lsbS1a4xyJGibfpUpttZ5T+jGo48WBhj0BavIkeiwY2DbYND4g5q25X79qO3T4EUBGDi6mmNLO6cp4ZGINHnekd07qwPeSuj03Ps/eOUAhcc+hrj/nD0XgFfylqIgMS0GAhO71pLs+qNde6YUGSznvqAJvEdcHAjn7ri/UURn9nk+kfAFiH5bL5NpaJJ1qzG8HkYiBtfLhytqhkb3rThsYnf5JZdSYea4WzG9BaYYP/eIuqtRu+a5ileqqOmpXO4uAJmMxmwtjQuVyAjOYCKdXAa3oNxX2ep1Hidz2jtiKpI349bAnhAw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P0pFSBg7qJfvLwjtBGSw//T8QlNsIRbCo1lYlKHDgSn7RNriq3uN2EjXB6zqMZ+2MhWB4rO54uiueEu4b/KW7mJLb9mCGf1GJQBu/M+ezHI3+dr5z9MqO5CI6mtVQhzCxeBKeD9oKHV/Q/AymFV2ovnBkGWRjv97xb5lVHKf6ylIW/tJg347Vv0qMO0YE1jhZyar/jyI/I9vMEuRNMr7EJNnj1BNf5R7P8YSOpsxAZCjtlWUezrHmY5lSaxzK/rYJl2AAw8LYuOAbUuceYuujCLgtdFufnR2DBc87gM2SSjPG1hdL01BUXM8xrvwjGZ8tzOnV5gFMu2GnHmd3u2hHg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 04 Nov 2021 09:26:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 01.11.2021 16:20, Juergen Gross wrote:
> Instead of using a function table use the generated macros for calling
> the appropriate hypercall handlers.
> 
> This is beneficial to performance and avoids speculation issues.
> 
> With calling the handlers using the correct number of parameters now
> it is possible to do the parameter register clobbering in the NDEBUG
> case after returning from the handler. With the additional generated
> data the hard coded hypercall_args_table[] can be replaced by tables
> using the generated number of parameters.
> 
> Note that this change modifies behavior of clobbering registers in a
> minor way: in case a hypercall is returning -ENOSYS for any reason
> the parameter registers will no longer be clobbered. This should be
> of no real concern, as those cases ought to be extremely rare and
> reuse of the registers in those cases seems rather far fetched.

Considering mem-op where certain sub-ops can return huge positive
values, may I suggest to amend -ENOSYS by "(or the unsigned equivalent
thereof)" to make clear that this case was also recognized/considered?

> @@ -55,4 +42,45 @@ 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];

While maybe not overly relevant in debug builds, it doesn't cost us
much to use array_access_nospec() here, so I'd like to ask for that
to be switched to (replacing the original array_index_nospec() that
you remove). Preferably with this adjustment
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Jan




 


Rackspace

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