Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751558AbdGZNtF (ORCPT ); Wed, 26 Jul 2017 09:49:05 -0400 Received: from mail-vk0-f54.google.com ([209.85.213.54]:35438 "EHLO mail-vk0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750826AbdGZNtE (ORCPT ); Wed, 26 Jul 2017 09:49:04 -0400 MIME-Version: 1.0 In-Reply-To: <20170724142853.26448-1-jgross@suse.com> References: <20170724142853.26448-1-jgross@suse.com> From: Andy Lutomirski Date: Wed, 26 Jul 2017 06:48:42 -0700 Message-ID: Subject: Re: [PATCH v1] xen: get rid of paravirt op adjust_exception_frame To: Juergen Gross Cc: "linux-kernel@vger.kernel.org" , "xen-devel@lists.xenproject.org" , X86 ML , Boris Ostrovsky , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1553 Lines: 42 On Mon, Jul 24, 2017 at 7:28 AM, Juergen Gross wrote: > When running as Xen pv-guest the exception frame on the stack contains > %r11 and %rcx additional to the other data pushed by the processor. > > Instead of having a paravirt op being called for each exception type > prepend the Xen specific code to each exception entry. When running as > Xen pv-guest just use the exception entry with prepended instructions, > otherwise use the entry without the Xen specific code. I think this is a nice cleanup, but I'm wondering if it would be even nicer if the Xen part was kept out-of-line. That is, could Xen have little stubs like: xen_alignment_check: pop %rcx pop %r11 jmp alignment_check rather than using the macros in entry_64.S that you have? Then you could adjust set_trap_gate instead of pack_gate and maybe even do something like: #define set_trap_gate(..., name, ...) set_native_or_xen_trap_gate(..., name, xen_##name, ...) > /* Runs on exception stack */ > -ENTRY(nmi) > - /* > - * Fix up the exception frame if we're on Xen. > - * PARAVIRT_ADJUST_EXCEPTION_FRAME is guaranteed to push at most > - * one value to the stack on native, so it may clobber the rdx > - * scratch slot, but it won't clobber any of the important > - * slots past it. > - * > - * Xen is a different story, because the Xen frame itself overlaps > - * the "NMI executing" variable. > - */ I would keep this comment. The Xen frame really is in the way AFAICT. --Andy