[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 04/70] x86/pv-shim: Don't modify the hypercall table
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Mon, 21 Feb 2022 19:21:04 +0000
- Accept-language: en-GB, en-US
- 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uC0klHGT1wqSFpZrvxVI5rezQHtLRZtM72M9KVBJbGg=; b=gbw1eBP74IUdYikXPY1aLQ5M/6du6bg28ckdx5QsDGza+VRW9tO+EN0ecbv2NU0fhMrMwWzGwPs1wnolbI57zKh3k6h6OXjdOSJkoS4lK/C4GUKn7N5sBwNc2j/k1GvVJ294DxAVzYEzt0S/VetgIyr6RfPKQt+ebvEBqhPUb4VGehPyifSy25ZXmrgngC2UAvnBKFsf6dm5KdKQX2hGP9vMDd4ykAXgyBXZ2IgpnBLYlLJ0dmtnnYl9b25COa9SydC0GfkrcXlGDmjY2bEW23m6L4uATqsz8D28eTK0RaCG4d2Un7pdZSUiWTGkqANn3FxANuURIbXGSDYTMk8u+A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=j1AXjqzLtz1gmGKS4e2UYBsOFP4fWs43qlH3pUGiEN1Y27r9cUjwdnc9WLx8NgZEEFicz0TPqF/sT+cfq7JcM4TrvUGb5DnHE0c7Y3Ffiy5HwoYt7inLZB+21/c80gHyH0rTMtzOzPSXc7gBa/9dJLjtUNBfenD4BpGHeZyD4in/CZmYCAQot3gIws2dcOVMfR/uzV+dDNxxc4GHZSux5ePs0PffNE74LRNOrg3KV5jXhzlvYUzThOl3Evq8ni0lTM9jemRPfejLLI4eq5Ke0aTJ80O6MRPjhi4hlH+ouek+r62WHrIl0f86Z9FTk6g7t84Tdb7bExSUFsC7KkeM6A==
- Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: Juergen Gross <jgross@xxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Mon, 21 Feb 2022 19:21:22 +0000
- Ironport-data: A9a23:dpkYDaLD3d0hZW+DFE+RxJUlxSXFcZb7ZxGr2PjKsXjdYENSgzUEz GIWWGmHa/6JZjegKItxPdvk/U9Uv8DUydY1TVZlqX01Q3x08seUXt7xwmUcns+xwm8vaGo9s q3yv/GZdJhcokf0/0vrav67xZVF/fngqoDUUYYoAQgsA180IMsdoUg7wbRh2NQx2YLR7z6l4 rseneWOYDdJ5BYsWo4kw/rrRMRH5amaVJsw5zTSVNgT1LPsvyB94KE3fMldG0DQUIhMdtNWc s6YpF2PEsE1yD92Yj+tuu6TnkTn2dc+NyDW4pZdc/DKbhSvOkXee0v0XRYRQR4/ttmHozx+4 NwKlLm+cAECBPSPv7stUBN+EWJEPaITrdcrIVDn2SCS50jPcn+qyPRyFkAme4Yf/46bA0kXq 6ZecmpUKEne2aTmm9pXScE17ignBODtMJkSpTdLyjbBAOx9aZvCX7/L9ZlT2zJYasVmQ6iPP pRDNmQHgBLoXkNyIlUyDKICgPaxiyHjcRxbjFSEqv9ii4TU5FMoi+W8WDbPQfSaSMMQkkuGq 2bu+2XiHgpcJNGZ0SCC8H+nmqnIhyyTcIAdDrqj7dZxnUaegGcUDXU+V1G2vP24gU6WQM9EJ gof/S9GkEQp3BX1FJ+nBUT++SPa+E5HMzZNLwEkwAjK64/a2gCyPDFHaWFxa9YAtowMRTN/g zdlgOjVLTBotbSUT1eU+bGVsS6+NEApEI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dwbnDtCPxoRC9lTXTGC0TV3Wu4hjDlhCy8vBrZbQQFi+oQoV4rmdSt0kc7nmZ8 o=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHYIaGhGuRO8pqNlkK4xub7I1FLsayTC50AgAAE4YCAAAF7gIADsLoAgADKGoCABuBFAA==
- Thread-topic: [PATCH v2 04/70] x86/pv-shim: Don't modify the hypercall table
On 17/02/2022 10:20, Jan Beulich wrote:
> On 16.02.2022 23:17, Andrew Cooper wrote:
>> On 14/02/2022 13:56, Jan Beulich wrote:
>>> On 14.02.2022 14:50, Andrew Cooper wrote:
>>>> On 14/02/2022 13:33, Jan Beulich wrote:
>>>>> On 14.02.2022 13:50, Andrew Cooper wrote:
>>>>>> From: Juergen Gross <jgross@xxxxxxxx>
>>>>>>
>>>>>> 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>
>>>>>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
>>>>> I don't think you sync-ed this with Jürgen's v3. There were only minor
>>>>> changes but having a stale version sent two months later isn't very
>>>>> nice.
>>>> I did resync. What do you think is missing?
>>> A few likely() / unlikely() as far as I could see.
>> Oh those two. I appear to have forgot to email.
>>
>> They're wrong - observe they're in an ifndef block, not an ifdef block.
> I don't see how the (unrelated) #ifndef matters here: The #ifndef
> is about grant table availability. The two likely() are about
> running as shim. I'm of the firm opinion that a binary built
> without PV_SHIM_EXCLUSIVE is far more likely to be used as a bare
> metal hypervisor. And for a PV_SHIM_EXCLUSIVE hypervisor the
> conditions are constant anyway, and hence the unlikely() has no
> effect.
>
> And if your way should really be followed, why did you deem the two
> unlikely() in do_event_channel_op() and do_grant_table_op() okay?
Because those are at least not incorrect. (I still think we have far
too many annotations, and I doubt they're all helpful.)
The gnttab stubs in the !GNTTAB case exist strictly for compile tests
(there's no such thing as a production build of Xen without grant
tables) and PV_SHIM_EXCLUSIVE builds.
Code layout only matters for cases where we're executing code, which is
the PV Shim case, at which point the condition is constant and doesn't
generate a branch.
A compiler ought to raise a warning on finding that __builtin_expect()
has a constant parameter, because it's a nop in one case, and
demonstrably false in the other.
As for the function in question, the compiled result is an unconditional
tailcall to pv_shim_grant_table_op.
~Andrew
|