All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Roger Pau Monné" <roger.pau@citrix.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 5/8] x86/IDT: Make idt_tables[] be per_cpu(idt)
Date: Tue, 4 Mar 2025 14:40:39 +0000	[thread overview]
Message-ID: <0981f331-8489-4327-93a3-d063bb00362d@citrix.com> (raw)
In-Reply-To: <1d4aa263-3a9b-4968-9b16-3dc3dcdc4b0c@suse.com>

On 25/02/2025 4:33 pm, Jan Beulich wrote:
> On 25.02.2025 16:40, Andrew Cooper wrote:
>> On 25/02/2025 9:07 am, Jan Beulich wrote:
>>> On 24.02.2025 17:05, Andrew Cooper wrote:
>>>> --- a/xen/arch/x86/cpu/common.c
>>>> +++ b/xen/arch/x86/cpu/common.c
>>>> @@ -819,6 +819,7 @@ void load_system_tables(void)
>>>>  	 * support using ARRAY_SIZE against per-cpu variables.
>>>>  	 */
>>>>  	struct tss_page *tss_page = &this_cpu(tss_page);
>>>> +        idt_entry_t *idt = this_cpu(idt);
>>> Nit: Tab indentation here.
>> Yeah, I noticed that only after sending the email.  Other parts of the
>> FRED series vastly changes this function.
>>
>>>> @@ -830,7 +831,7 @@ void load_system_tables(void)
>>>>  		.limit = LAST_RESERVED_GDT_BYTE,
>>>>  	};
>>>>  	const struct desc_ptr idtr = {
>>>> -		.base = (unsigned long)idt_tables[cpu],
>>>> +		.base = (unsigned long)idt,
>>>>  		.limit = sizeof(bsp_idt) - 1,
>>>>  	};
>>> Coming back to the comment on the earlier patch: Now that you touch all
>>> of the idt_tables[] uses anyway, ...
>>>
>>>> @@ -30,7 +31,7 @@ typedef union {
>>>>  } idt_entry_t;
>>>>  
>>>>  extern idt_entry_t bsp_idt[X86_IDT_VECTORS];
>>>> -extern idt_entry_t *idt_tables[];
>>>> +DECLARE_PER_CPU(idt_entry_t *, idt);
>>> ... this probably really ought to become
>>>
>>> DECLARE_PER_CPU(idt_entry_t (*)[X86_IDT_VECTORS], idt);
>>>
>>> ?
>> I'm afraid this doesn't compile.
>>
>> arch/x86/crash.c:66:17: error: passing argument 1 of ‘set_ist’ from
>> incompatible pointer type [-Werror=incompatible-pointer-types]
>> ...
>> note: expected ‘volatile idt_entry_t *’ but argument is of type
>> ‘idt_entry_t (*)[256]’
>>
>> Similarly {en,dis}able_each_ist() and _set_gate_lower().
> Well, did you adjust the use sites? As said in the respective comment on
> patch 4, that'll be necessary (to account for the abstract extra level of
> indirection; generated code ought to not change).

Having spent even more time, I'm giving up and rejecting this suggestion.

Some can be made to compile.  Some I can't make compile, and the result
is a good demonstration of why exotic types like this don't get common use.

If you want to try once this series is in, then feel free, but the
result is not pretty.

~Andrew


  reply	other threads:[~2025-03-04 14:40 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 16:05 [PATCH 0/8] x86/IDT: Generate the IDT at build time Andrew Cooper
2025-02-24 16:05 ` [PATCH 1/8] x86: Sort includes in various files Andrew Cooper
2025-02-24 16:11   ` Jan Beulich
2025-02-24 16:05 ` [PATCH 2/8] x86/IDT: Collect IDT related content idt.h Andrew Cooper
2025-02-25  8:27   ` Jan Beulich
2025-02-26 17:15     ` Andrew Cooper
2025-02-27  7:49       ` Jan Beulich
2025-02-24 16:05 ` [PATCH 3/8] x86/IDT: Rename X86_NR_VECTORS to X86_IDT_VECTORS Andrew Cooper
2025-02-25  8:31   ` Jan Beulich
2025-02-26 17:27     ` Andrew Cooper
2025-02-27  7:57       ` Jan Beulich
2025-02-24 16:05 ` [PATCH 4/8] x86/IDT: Rename idt_table[] to bsp_idt[] Andrew Cooper
2025-02-25  9:00   ` Jan Beulich
2025-02-25 12:54     ` Andrew Cooper
2025-02-25 14:33       ` Jan Beulich
2025-02-25 16:20         ` Andrew Cooper
2025-02-25 16:29           ` Jan Beulich
2025-02-24 16:05 ` [PATCH 5/8] x86/IDT: Make idt_tables[] be per_cpu(idt) Andrew Cooper
2025-02-25  9:07   ` Jan Beulich
2025-02-25 15:40     ` Andrew Cooper
2025-02-25 16:33       ` Jan Beulich
2025-03-04 14:40         ` Andrew Cooper [this message]
2025-02-24 16:05 ` [PATCH 6/8] x86/IDT: Generate bsp_idt[] at build time Andrew Cooper
2025-02-26 12:39   ` Jan Beulich
2025-02-26 13:37     ` Andrew Cooper
2025-02-26 14:14       ` Jan Beulich
2025-02-26 15:14         ` Andrew Cooper
2025-02-24 16:05 ` [PATCH 7/8] x86/IDT: Don't rewrite bsp_idt[] at boot time Andrew Cooper
2025-02-26 12:48   ` Jan Beulich
2025-02-26 12:53     ` Andrew Cooper
2025-02-26 13:18       ` Jan Beulich
2025-02-26 13:23         ` Andrew Cooper
2025-02-24 16:05 ` [PATCH 8/8] x86/traps: Convert pv_trap_init() to being an initcall Andrew Cooper
2025-02-26 12:53   ` Jan Beulich

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=0981f331-8489-4327-93a3-d063bb00362d@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --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.