Re: [patch V2 35/44] x86/idt: Switch early trap init to IDT tables

Thomas Gleixner
2017-08-26T13:05:57Z

On Sat, 26 Aug 2017, Juergen Gross wrote:
> On 26/08/17 10:16, Thomas Gleixner wrote:
> > early_trap_init() is called from setup_arch(), not from
> > x86_64_start_kernel().
> >
> > This patch merily renames the function and moves the code into a different
> > source file. So it's not changing the behaviour in any way.
>
> It does: the IDT entries are now statically defined. Before that any
> call of set_intr_gate() would have registered the trap handler with
> the hypervisor, now this is done only when the IDT is being activated.
> Boris' patch is doing that.

The IDT entries are not statically defined, bcause that's impossible as
that would require the linker to split the address into bits and pieces and
then it would require relocation entries which do the same split again.

+void __init idt_setup_early_traps(void)
+{
+ idt_setup_from_table(idt_table, early_idts, ARRAY_SIZE(early_idts));
+}

It sets up the IDT entries from the table instead of having a gazillion
calls to set_intr_gate() in the code. So that ends up in write_idt_entry()
which is paravirtualized and ends up where it ended up before.

What occured to me right now, is that the patch removes:

load_idt(&idt_descr);

from the original function without adding it to the new one. So that needs
to be fixed, but not in the XEN code. It simply wants to be added to
idt_setup_early_traps(). I'll send out a V3 of that particular patch.

Thanks,

tglx