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

Re: [PATCH 9/9] RFC: Everything else


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 30 Mar 2023 14:55:13 +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=NhFPt1TfXePXaRLUkYIb6ATg8B5TONBPN2u8BQmW2xM=; b=XYwDYtzf2P2wQ7Fv7RpEiiycoqH/WLkilaT030LTPm1n8+eO+m3C/MsBvOUgBBOGvQUNNG2tYCcJ8SFWVQbpNius0wf6tmUFtPSKzO4LsT0GKc5jmw6DMK4QS8WD9ffERQ51kZXKPDKWjrQ3wffWph9Hba0XgrNuov7k9rElrgnOvIps1UT2klHAOWgRsDvGBCFUdhlhB9vyH3UqL2yXvkBYAK18ajuSZJUmJYRX9T29Xuj/tr3ZwuZcluCTfz2VTut9irbdOmQQsD12BwXIzwXtyGeJ/RuOIOtJqdQEP5UCeQG+TXc71ZA1JNl74Pr4W9NQJyXlPzkQbd7QNc//Kg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UuZQxNYSFDZiuZTliIKlC/bBSsTNfOxJ+toUZfUkU6Y6kj1Fd4S3fHbcruVt2Pd7FOWzruBRiddNqVEJoyprtpOtMvyBOks6i2Vkm+dfYxccXy2Oq1INf4B8Vfwhz8VlzxogIFPRCtyMraJZNvz+jIYZ3iZ4RVBpLjVXP/jRTvtvSGPU7In89lINa1u9RRWx7m0BbdbBuJBSy3Pu8Wae54cJfIhMoJKKAWepCldi1WV0AGD90s0lhb6YH6Rmpb4MLLPcxo62WXs6f5s6vKZvf0IjGYk5shCAmN2O42BL/8iZfzZqqegKawpfxAnM03fsNqUwgi6ceClNPCs7fQYKDQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Thu, 30 Mar 2023 12:55:30 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 30.03.2023 14:31, Andrew Cooper wrote:
> On 30/03/2023 1:06 pm, Jan Beulich wrote:
>> On 30.03.2023 14:01, Andrew Cooper wrote:
>>> On 30/03/2023 11:16 am, Jan Beulich wrote:
>>>>> --- a/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
>>>>> +++ b/tools/fuzz/x86_instruction_emulator/fuzz-emul.c
>>>>> @@ -893,7 +893,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data_p, 
>>>>> size_t size)
>>>>>      struct x86_emulate_ctxt ctxt = {
>>>>>          .data = &state,
>>>>>          .regs = &input.regs,
>>>>> -        .cpuid = &cp,
>>>>> +        .cpu_policy = &cp,
>>>> ... this and ...
>>>>
>>>>> --- a/tools/tests/x86_emulator/test_x86_emulator.c
>>>>> +++ b/tools/tests/x86_emulator/test_x86_emulator.c
>>>>> @@ -909,7 +909,7 @@ int main(int argc, char **argv)
>>>>>  
>>>>>      ctxt.regs = &regs;
>>>>>      ctxt.force_writeback = 0;
>>>>> -    ctxt.cpuid     = &cp;
>>>>> +    ctxt.cpu_policy = &cp;
>>>> ... this imo want keeping as you have it here.
>>> Ok, so that's a firm "switch to using cpu_policy for emul_ctxt" then.
>>>
>>> Which is fine - in fact it's one I'd already started splitting out of
>>> this patch.
>> Hmm, wait - CPUID "basic" and "feat" and alike uses I still would prefer
>> to see using "cpuid". It's really only such initializers which (imo
>> even logically) want to use the name with the wider coverage.
> 
> So its the other way around and you're saying you don't want the field
> name to change, and you don't want to see
> 
> -#define vcpu_has_fpu()         (ctxt->cpuid->basic.fpu)
> +#define vcpu_has_fpu()         (ctxt->cpu_policy->basic.fpu)
> 
> in the resulting diff ?

Neither. I want the change as seen in the diff further up, but indeed
I'd prefer if the two quoted diff lines in your most recent reply
weren't there. This would again be by way of using a union, this time
in struct x86_emulate_ctxt:

    /* CPU Policy for the domain. */
    union {
        const struct cpu_policy *cpuid;
        const struct cpu_policy *cpu_policy;
    };

Having said that: I realize that this is against what C mandates for
the use of unions, but since we (ab)use unions in similar ways in many
other places, I don't think we need to be concerned. Furthermore this
specific use could, aiui, be "legalized" by making the declaration

    /* CPU Policy for the domain. */
    union {
        struct {
            const struct cpu_policy *cpuid;
        };
        struct {
            const struct cpu_policy *cpu_policy;
        };
    };

Jan



 


Rackspace

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