Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754580AbdHZNF5 (ORCPT ); Sat, 26 Aug 2017 09:05:57 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:43875 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752356AbdHZNF4 (ORCPT ); Sat, 26 Aug 2017 09:05:56 -0400 Date: Sat, 26 Aug 2017 15:05:48 +0200 (CEST) From: Thomas Gleixner To: Juergen Gross cc: Boris Ostrovsky , LKML , Ingo Molnar , Peter Anvin , Peter Zijlstra , Andy Lutomirski , Borislav Petkov , Steven Rostedt Subject: Re: [patch V2 35/44] x86/idt: Switch early trap init to IDT tables In-Reply-To: Message-ID: References: <20170825214648.264521964@linutronix.de> <20170825214942.983480384@linutronix.de> <7e182f46-d27b-9414-fb6d-ee48906a4180@oracle.com> User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1447 Lines: 42 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