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

Re: [PATCH v2 09/15] x86/pv-shim: don't modify hypercall table


  • To: Juergen Gross <jgross@xxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 4 Nov 2021 10:13:32 +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=/81wyuY2f14e2jpOysYAPhE3iEyIGZo5UgzxSu9XhT8=; b=VdLxEx92DSQXKn8U+vP53IFw7pTaQ67BTnoZ6SgUgMU6yeN7naqZR8vxY3JDO+cEzBQCdNnnhigMUd8Yjn4OKyPkLxCzNjy/lg/Q+GbnXBSUCZO1a71Ci/OaxZ/XNOKCzlGnldYeAgLHpWXTMJ4uUkM2WEmo8EsRcG238WouymMny7cqXBVp9+77PM0aA7s9s4vrUShIk6UbBMqg8LD9AiUIhnW/Gnx2jw27SFtxJXFcXrzwomuZvJCTpfWhSxKKPw8rCGdp9gfwYd2I455bGREqxHZedOZWIFHW5oQxE7lLY07mItKxV/VRHcBbK3KerIzFgkSg8QU440f1I4hIEQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ClNnkJozI4eWHzUSQAGtMJhyxDVICTcUXGeDKiuzVgdhCqK0JGvf3mrhptK15vgCAbe1BS5Qr4R6lYFviZwUH1t9uRSJJW7IDo1u3psSfR4Pb0vAi3fv0UePf5RNrm99fzx0/zBCLQcYQcT++FNg/hhRHshkhg+5pUx++0utCj3W66Jmy6oe6a6FAP0OMg813lSY5Kv4fSKbdaPVck6aa9wrsDN+DRHzZ6H99dtirPFztB6DcmPISw3zcBipGOG7F8b4VP0tYKPOg0LZk1tBvMK5KZEXVLmlGYSkG7xMb1KQhLKXyHUjHXuOlURgmK43jGaEUnb4iDBD/1WoWaDpLg==
  • 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>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 04 Nov 2021 09:13:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 01.11.2021 16:20, Juergen Gross wrote:
> When running as pv-shim the hypercall is modified today in order to
> replace the functions for __HYPERVISOR_event_channel_op and
> __HYPERVISOR_grant_table_op hypercalls.
> 
> Change this to call the related functions from the normal handlers
> instead when running as shim. The performance implications are not
> really relevant, as a normal production hypervisor will not be
> configured to support shim mode, so the related calls will be dropped
> due to optimization of the compiler.
> 
> Note that for the CONFIG_PV_SHIM_EXCLUSIVE case there is a dummy
> wrapper do_grant_table_op() needed, as in this case grant_table.c
> isn't being built.
> 
> Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
albeit with a remark:

> @@ -1190,6 +1194,11 @@ long do_event_channel_op(int cmd, 
> XEN_GUEST_HANDLE_PARAM(void) arg)
>  {
>      int rc;
>  
> +#ifdef CONFIG_PV_SHIM
> +    if ( pv_shim )
> +        return pv_shim_event_channel_op(cmd, arg);
> +#endif

At the example of this, this is sub-optimal: In !PV_SHIM_EXCLUSIVE
this would imo better be unlikely(pv_shim). If it was just for the
positive forms, the annotation could actually be included in
pv_shim itself:

extern bool pv_shim;
#define pv_shim unlikely(pv_shim)

but this wouldn't necessarily play well with e.g. "if ( !pv_shim )".

As I would hope compilers don't mind constructs like "unlikely(1)",
I'd like to suggest considering to add likely() / unlikely() on
this and similar paths you add here.

Jan




 


Rackspace

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