Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5838381yba; Mon, 13 May 2019 19:03:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjKLIZ1YVkfFaHr9+CTPj6+VUXLyb+fHaegCpU8dipe61muh5axwOXVNvBIfSVs+Ohafy2 X-Received: by 2002:a17:902:2aab:: with SMTP id j40mr11346348plb.238.1557799428994; Mon, 13 May 2019 19:03:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557799428; cv=none; d=google.com; s=arc-20160816; b=V4AdoRvGNkMj2FOcwp71V4XHJ/Fqx6O43SPTGXgT8KA6wDU2EpZYxa2VJT97/1J73U ev1ufhsmOH7plD9BatHtXYEXTycEQkPfF96FzCGpSnnJ+oKUBbSLudR7c/yzvREoEcNO Pi8Qj5ru6aVCc2baocIcc6aOdfouHlV3xoNEQSzLNiqbKs4vtIQrTzZXkCUy1RlhUYpc Rd8bfGMYGF+Lz9SUJOyzHAURq/NcDRrquZ5x9nth4osb6UetnQ0gCR35D/81UAEY9J3M XN2YUWRJ6R+RLa5vuLsMsAjOuQmFA5xX3NCdsvI2newQj/JYwtJgduWDLQoLAm1CGP1o FUYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=/TgRi4Ld1Qw9+mN6KywYX/xBglWftuhDT8EpdWRjHUk=; b=kkqG28molpgqhpJkLzi2MM+PfiZdnPuMleBZZyQtjDvi2YIaWn3KMRj6mNriKqJc2O fpAqmU1tZpi1wXL9sGnKMbBExJB+K6vpCozmDX9cVN6MC8FJjApNboUiZf9jI0OpsEpE GXZm0nTQg6eUciMd1Z5dB2tRCV02xM2tjenvmn2txWENuUeGHAFoTGbP72XpnfdEADPk is73zdfUnFMPI9RGk8HpU6ZEKqflU6ZXdkk2P3Ov2tLafdvyOU7ELu2FfyQ0UgJjMRgA 32YpLmvFmNQsgA99S6YFqd52U9/CSvJOEwfwOIpeoVG8m+IddTR0SaXPcOr1Uvi0ilCQ fNXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=15Oxqiet; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si3927641pfb.272.2019.05.13.19.03.32; Mon, 13 May 2019 19:03:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=15Oxqiet; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726642AbfENCCo (ORCPT + 99 others); Mon, 13 May 2019 22:02:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:40604 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726233AbfENCCo (ORCPT ); Mon, 13 May 2019 22:02:44 -0400 Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 47249214D8 for ; Tue, 14 May 2019 02:02:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557799363; bh=4OBmtfQllm0RymwAbmCzcP2d3KH9f8oCMkSmd1HlaAA=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=15OxqietpeRfGcIVu5u4YGK6lQMkA8PXcTMZtnOt1lzuJODROCsf/5K71H11TL4ul XIQLz6xsf1OfhAS72AXJbUsNOQo5rEO7Y4JJrc/YQcRpjxUqD+Y1DbYwehJXNSN6/d Q0NETdnisf6YcHjz5rFLGoBCziHZbk+A/5MudBlA= Received: by mail-wm1-f53.google.com with SMTP id x64so1090184wmb.5 for ; Mon, 13 May 2019 19:02:43 -0700 (PDT) X-Gm-Message-State: APjAAAUBf7JKWvc0NN+BxQCUVK8sdMTVl+E1i7ZPmnoUbvIcG+YBYdy+ o1jJgPg5Dtrx7LPsZwmfcEQpp3Fgrz4mMSbkV+aEyg== X-Received: by 2002:a1c:486:: with SMTP id 128mr16481232wme.83.1557799361797; Mon, 13 May 2019 19:02:41 -0700 (PDT) MIME-Version: 1.0 References: <1557758315-12667-1-git-send-email-alexandre.chartre@oracle.com> <1557758315-12667-25-git-send-email-alexandre.chartre@oracle.com> <20190513151500.GY2589@hirez.programming.kicks-ass.net> <13F2FA4F-116F-40C6-9472-A1DE689FE061@oracle.com> In-Reply-To: <13F2FA4F-116F-40C6-9472-A1DE689FE061@oracle.com> From: Andy Lutomirski Date: Mon, 13 May 2019 19:02:30 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC KVM 24/27] kvm/isolation: KVM page fault handler To: Liran Alon Cc: Peter Zijlstra , Alexandre Chartre , Paolo Bonzini , Radim Krcmar , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Dave Hansen , Andrew Lutomirski , kvm list , X86 ML , Linux-MM , LKML , Konrad Rzeszutek Wilk , jan.setjeeilers@oracle.com, Jonathan Adams Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 13, 2019 at 2:26 PM Liran Alon wrote: > > > > > On 13 May 2019, at 18:15, Peter Zijlstra wrote: > > > > On Mon, May 13, 2019 at 04:38:32PM +0200, Alexandre Chartre wrote: > >> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c > >> index 46df4c6..317e105 100644 > >> --- a/arch/x86/mm/fault.c > >> +++ b/arch/x86/mm/fault.c > >> @@ -33,6 +33,10 @@ > >> #define CREATE_TRACE_POINTS > >> #include > >> > >> +bool (*kvm_page_fault_handler)(struct pt_regs *regs, unsigned long error_code, > >> + unsigned long address); > >> +EXPORT_SYMBOL(kvm_page_fault_handler); > > > > NAK NAK NAK NAK > > > > This is one of the biggest anti-patterns around. > > I agree. > I think that mm should expose a mm_set_kvm_page_fault_handler() or something (give it a better name). > Similar to how arch/x86/kernel/irq.c have kvm_set_posted_intr_wakeup_handler(). > > -Liran > This sounds like a great use case for static_call(). PeterZ, do you suppose we could wire up static_call() with the module infrastructure to make it easy to do "static_call to such-and-such GPL module symbol if that symbol is in a loaded module, else nop"?