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>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 4/8] x86/IDT: Rename idt_table[] to bsp_idt[]
Date: Tue, 25 Feb 2025 10:00:32 +0100	[thread overview]
Message-ID: <fa0cd84c-a3a7-44c8-af62-3e8da91a6d1a@suse.com> (raw)
In-Reply-To: <20250224160509.1117847-5-andrew.cooper3@citrix.com>

On 24.02.2025 17:05, Andrew Cooper wrote:
> Having variables named idt_table[] and idt_tables[] is not ideal.
> 
> Use X86_IDT_VECTORS and remove IDT_ENTRIES.  State the size of bsp_idt[] in
> idt.h so that load_system_tables() and cpu_smpboot_alloc() can use sizeof()
> rather than opencoding the calculation.
> 
> Move the variable into a new traps-init.c, to make a start at splitting
> traps.c in half.

Hmm, I'd expect a file of that name to contain only __init code/data, and
hence for it to be possible to ...

> --- a/xen/arch/x86/Makefile
> +++ b/xen/arch/x86/Makefile
> @@ -65,6 +65,7 @@ obj-y += spec_ctrl.o
>  obj-y += srat.o
>  obj-y += string.o
>  obj-y += time.o
> +obj-y += traps-init.o

... use

obj-bin-y += traps-init.init.o

here.

> --- a/xen/arch/x86/cpu/common.c
> +++ b/xen/arch/x86/cpu/common.c
> @@ -831,7 +831,7 @@ void load_system_tables(void)
>  	};
>  	const struct desc_ptr idtr = {
>  		.base = (unsigned long)idt_tables[cpu],
> -		.limit = (IDT_ENTRIES * sizeof(idt_entry_t)) - 1,
> +		.limit = sizeof(bsp_idt) - 1,
>  	};

This ends up being odd: base address and size (limit) are taken from
different variables. Should we perhaps use ...

> --- a/xen/arch/x86/include/asm/idt.h
> +++ b/xen/arch/x86/include/asm/idt.h
> @@ -29,8 +29,7 @@ typedef union {
>      };
>  } idt_entry_t;
>  
> -#define IDT_ENTRIES 256
> -extern idt_entry_t idt_table[];
> +extern idt_entry_t bsp_idt[X86_IDT_VECTORS];
>  extern idt_entry_t *idt_tables[];

extern idt_entry_t (*idt_tables[])[X86_IDT_VECTORS];

and then sizeof(*idt_tables[cpu]) above? Of course we have quite a few uses
of idt_tables[], which all would then need adjusting for the additional
(abstract) level of indirection.

Jan


  reply	other threads:[~2025-02-25  9:00 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 [this message]
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
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=fa0cd84c-a3a7-44c8-af62-3e8da91a6d1a@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.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.