All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>, "Wei Liu" <wl@xen.org>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 9/9] RFC: Everything else
Date: Thu, 30 Mar 2023 14:55:13 +0200	[thread overview]
Message-ID: <77067988-9389-87b5-22e7-398a37bef1ef@suse.com> (raw)
In-Reply-To: <cbacbc0b-60a0-35ea-c813-e4d620f6406c@citrix.com>

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


  reply	other threads:[~2023-03-30 12:55 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-29 20:51 [PATCH RFC 0/9] x86: Merge cpuid and msr policy Andrew Cooper
2023-03-29 20:51 ` [PATCH 1/9] x86: Rename struct cpu_policy to struct old_cpuid_policy Andrew Cooper
2023-03-29 20:51 ` [PATCH 2/9] x86: Rename {domctl,sysctl}.cpu_policy.{cpuid,msr_policy} fields Andrew Cooper
2023-03-29 20:51 ` [PATCH 3/9] x86: Rename struct cpuid_policy to struct cpu_policy Andrew Cooper
2023-03-29 20:51 ` [PATCH 4/9] x86: Merge struct msr_policy into " Andrew Cooper
2023-03-30  9:30   ` Jan Beulich
2023-03-30 11:11     ` Andrew Cooper
2023-03-30 11:15       ` Jan Beulich
2023-03-29 20:51 ` [PATCH 5/9] x86: Merge the system {cpuid,msr} policy objects Andrew Cooper
2023-03-30  9:40   ` Jan Beulich
2023-03-30 11:19     ` Andrew Cooper
2023-03-29 20:51 ` [PATCH 6/9] x86: Merge a domain's " Andrew Cooper
2023-03-30 10:00   ` Jan Beulich
2023-03-30 11:14     ` Andrew Cooper
2023-03-29 20:51 ` [PATCH 7/9] x86: Merge xc_cpu_policy's cpuid and msr objects Andrew Cooper
2023-03-30 10:04   ` Jan Beulich
2023-03-30 11:56     ` Andrew Cooper
2023-03-29 20:51 ` [PATCH 8/9] x86: Drop struct old_cpu_policy Andrew Cooper
2023-03-30 10:08   ` Jan Beulich
2023-03-30 11:57     ` Andrew Cooper
2023-03-29 20:51 ` [PATCH 9/9] RFC: Everything else Andrew Cooper
2023-03-30 10:16   ` Jan Beulich
2023-03-30 12:01     ` Andrew Cooper
2023-03-30 12:06       ` Jan Beulich
2023-03-30 12:31         ` Andrew Cooper
2023-03-30 12:55           ` Jan Beulich [this message]
2023-03-30 10:18 ` [PATCH RFC 0/9] x86: Merge cpuid and msr policy Jan Beulich
2023-03-30 12:08   ` Andrew Cooper
2023-03-30 11:07 ` Roger Pau Monné
2023-03-30 12:59   ` Andrew Cooper
2023-03-30 14:43     ` Roger Pau Monné
2023-04-03 10:55       ` Andrew Cooper
2023-04-03 11:47         ` Roger Pau Monné
2023-04-03 11:48           ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=77067988-9389-87b5-22e7-398a37bef1ef@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.