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

Re: [PATCH] x86/pv: Drop HYPERVISOR_COMPAT_VIRT_START()


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Tue, 27 Apr 2021 19:05:54 +0100
  • 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-SenderADCheck; bh=7AwccjTeH6mHGrlVLGtmNRrlrzvyZQE3qRjnJ1R6P1Q=; b=O88T3txHTTV4IzasBYM5VaQwTDL9N0Oco/hmk9BTeQULxwlyMdQbtvKHZY4tVZR05MzqUejirVLWeGBpjUjL9mVcZ5sSGe2hfgncjtn9oJrG36Yqcf/067XKd4o7pGWWQr2VHK6Gc7MC4PWI9SnzkRU77ibCbkm+l3DRKRwJ4mJZ2wEjMOJpqXDP1ApcU7bgm5956vhai4Og2uzbRp+oN/JZ5lvmxgtGeo3/qy0g4JkbwIw8j/FIBUo8UhclclOVl4k26QRfFFgaVx0S5xIa+wXHdTX1J++8Xawei+Vs7zjGQw4Dt3U2UALeIi3TrMKr1q9p178PKD8XeQh1tPteZw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YdcvkmpVhacNnANTd1oWofQuP6SHe1Dmy4g01hLG9cmAk2YFpL7tlAlExM2OF2OWg/lA07QqvbsdVB011DUl0nK7rpXEfgcWNskthJ1SVvMwgv2ewrKTwgv8urhxRHT9yMcKUzp99ETOUcwkWIo7rkN0JPKhSecP3HNYW9S5PUfd8FgEheB7hCIaxWHeChX2IZCWQcJeuH6obiertaehHyyR1D1h2QmB58bXGyjqsDjUHoE2Rv7JZrXE6w6zMGTehL7GJJwwIJ7sVICQw4kNV5yUqej0dgza+Te+bpqAjVQztmGL9VIel70Ba344G69E3iMMY8GguTvFgc555FCtbQ==
  • Authentication-results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 27 Apr 2021 18:06:15 +0000
  • Ironport-hdrordr: A9a23:fMmuyqva7ew9O0331zVN8ZgU7skCrIMji2hD6mlwRA09T+Wxi9 2ukPMH1RX9lTYWXzUalcqdPbSbKEmwybde544NMbC+GDT3oWfAFvAG0aLO4R3FXxf/+OlUyL t6f8FFYuHYIFBmga/BjzWQPM0nxLC8npyAocf74zNTQRpxa6dmhj0JaDqzNkFtXgFJCd4YOf OnhvZvnDardXQJYsnTPBBsM9TrnNHXiIngJScPGh9P0mKzpAm14733GQXw5GZ8bxpzx94ZkF TtokjCyYiI99q6zRLd0GG71eUtpPLRjuFtKebJpswcKjDHghulaoJ7S9S5zU0IidDq0nkGup 3hpAohItRS5hrqDx2IiCqo4SbM+nIP7GLv0lCRi3eLm72HeBsKT/BvqKgcVzmx0TtFgPhMlJ hl8kjcir9sSTTHpyj578igbWATqmOE5UAMvMRWs2ZSSuIlGdhshL1axmx5OrEaEhn37Yg2ed Med/301bJtfVSWY2uxhBgI/PWcGnA6HhKxSkMfoMCi0z9PgHBjz0cDrfZv50s9yA==
  • Ironport-sdr: 88DkJtVLEn5oSbeLruBjn8A3t8OJLEkFQ5YXhfrlqS/myBJgxVmLCmdCB7N8mOii5hdDqPdyKf TcrjVN4f6+tk+YQ7viAoeuiQluGPCh6n2fu039wnp7gYnM8Bzc9Bb7fv6TxUyYEMAsab8ATQov y64suw29zEKbqogoQvN9E68gSSBL8tafpCzNNPJx8AWUws3ik8y1rvCd0GmWn6mGpiztux5xwy Drn407NT+EghdH2iXXVq33DPaOfkM/QrzTnph9kVTDl3Qh7Zp5mMDoUt6X8BFAVvHWp9A197oX vSQ=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27/04/2021 14:18, Jan Beulich wrote:
> On 27.04.2021 15:02, Andrew Cooper wrote:
>> This is pure obfuscation (in particular, hiding the two locations where the
>> variable gets set), and is longer than the code it replaces.
> Obfuscation - not just; see below.
>
>> Also fix MACH2PHYS_COMPAT_VIRT_START to be expressed as a 1-parameter macro,
>> which is how it is used.  The current construct only works because
>> HYPERVISOR_COMPAT_VIRT_START was also a 1-parameter macro.
> I don't mind this getting changed, but I don't think there's any
> "fixing" involved here. Omitting macro parameters from macros
> forwarding to other macros (or functions) is well defined and imo
> not a problem at all. In fact, if at the end of all expansions a
> macro evaluates to a function, it may be necessary to do so in case
> covering not just function invocations is intended, but also taking
> of its address.

It might be well formed, but it doesn't help at all with trying to
follow what the code does.

>
>> --- a/xen/arch/x86/pv/descriptor-tables.c
>> +++ b/xen/arch/x86/pv/descriptor-tables.c
>> @@ -235,7 +235,7 @@ static bool check_descriptor(const struct domain *dom, 
>> seg_desc_t *d)
>>              if ( b & _SEGMENT_G )
>>                  limit <<= 12;
>>  
>> -            if ( (base == 0) && (limit > HYPERVISOR_COMPAT_VIRT_START(dom)) 
>> )
>> +            if ( (base == 0) && (limit > dom->arch.hv_compat_vstart) )
> I expect this (and a few more instances) to fail to build when !PV32.
> It was the purpose of ...
>
>> --- a/xen/include/asm-x86/config.h
>> +++ b/xen/include/asm-x86/config.h
>> @@ -254,21 +254,16 @@ extern unsigned char boot_edid_info[128];
>>  
>>  /* This is not a fixed value, just a lower limit. */
>>  #define __HYPERVISOR_COMPAT_VIRT_START 0xF5800000
>> -#define HYPERVISOR_COMPAT_VIRT_START(d) ((d)->arch.hv_compat_vstart)
>> -
>> -#else /* !CONFIG_PV32 */
>> -
>> -#define HYPERVISOR_COMPAT_VIRT_START(d) ((void)(d), 0)
> ... this to allow things to build in the absence of the actual struct
> member.

Hmm - I really should have got this change in earlier, shouldn't I...

For this example you've pointed out, feeding 0 into the limit
calculation is not a correct thing to do in the slightest.

~Andrew




 


Rackspace

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