From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Christopherson Date: Fri, 31 Jan 2020 18:55:32 +0000 Subject: Re: [PATCH 5/5] KVM: x86: Set kvm_x86_ops only after ->hardware_setup() completes Message-Id: <20200131185531.GB18946@linux.intel.com> List-Id: References: <20200130001023.24339-1-sean.j.christopherson@intel.com> <20200130001023.24339-6-sean.j.christopherson@intel.com> <44e0c550-7dcc-bfed-07c4-907e61d476a1@redhat.com> In-Reply-To: <44e0c550-7dcc-bfed-07c4-907e61d476a1@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Paolo Bonzini Cc: Paul Mackerras , Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org On Thu, Jan 30, 2020 at 06:44:09AM +0100, Paolo Bonzini wrote: > On 30/01/20 01:10, Sean Christopherson wrote: > > Set kvm_x86_ops with the vendor's ops only after ->hardware_setup() > > completes to "prevent" using kvm_x86_ops before they are ready, i.e. to > > generate a null pointer fault instead of silently consuming unconfigured > > state. > > What about even copying kvm_x86_ops by value, so that they can be > accessed with "kvm_x86_ops.callback()" and save one memory access? Oooh, I like that idea. And {svm,vmx}_x86_ops could be marked __initdata to save a few bytes and force all the runtime stuff through kvm_x86_ops. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48363C2D0DB for ; Fri, 31 Jan 2020 18:56:05 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id D134B20707 for ; Fri, 31 Jan 2020 18:56:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D134B20707 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5913F4A7E4; Fri, 31 Jan 2020 13:56:04 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Hak8Rqjzsr1q; Fri, 31 Jan 2020 13:56:03 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5CF6A4A52C; Fri, 31 Jan 2020 13:56:03 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 163374A52C for ; Fri, 31 Jan 2020 13:56:02 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YxAG3GH2uGIj for ; Fri, 31 Jan 2020 13:56:00 -0500 (EST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 165814A4E1 for ; Fri, 31 Jan 2020 13:55:59 -0500 (EST) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2020 10:55:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,386,1574150400"; d="scan'208";a="253419672" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by fmsmga004.fm.intel.com with ESMTP; 31 Jan 2020 10:55:32 -0800 Date: Fri, 31 Jan 2020 10:55:32 -0800 From: Sean Christopherson To: Paolo Bonzini Subject: Re: [PATCH 5/5] KVM: x86: Set kvm_x86_ops only after ->hardware_setup() completes Message-ID: <20200131185531.GB18946@linux.intel.com> References: <20200130001023.24339-1-sean.j.christopherson@intel.com> <20200130001023.24339-6-sean.j.christopherson@intel.com> <44e0c550-7dcc-bfed-07c4-907e61d476a1@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <44e0c550-7dcc-bfed-07c4-907e61d476a1@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Cc: Wanpeng Li , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , Marc Zyngier , Joerg Roedel , Cornelia Huck , linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Mackerras , Christian Borntraeger , linux-arm-kernel@lists.infradead.org, Vitaly Kuznetsov , kvmarm@lists.cs.columbia.edu, Jim Mattson X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Thu, Jan 30, 2020 at 06:44:09AM +0100, Paolo Bonzini wrote: > On 30/01/20 01:10, Sean Christopherson wrote: > > Set kvm_x86_ops with the vendor's ops only after ->hardware_setup() > > completes to "prevent" using kvm_x86_ops before they are ready, i.e. to > > generate a null pointer fault instead of silently consuming unconfigured > > state. > > What about even copying kvm_x86_ops by value, so that they can be > accessed with "kvm_x86_ops.callback()" and save one memory access? Oooh, I like that idea. And {svm,vmx}_x86_ops could be marked __initdata to save a few bytes and force all the runtime stuff through kvm_x86_ops. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29FD9C33CB7 for ; Fri, 31 Jan 2020 18:55:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03337214D8 for ; Fri, 31 Jan 2020 18:55:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726332AbgAaSzf (ORCPT ); Fri, 31 Jan 2020 13:55:35 -0500 Received: from mga18.intel.com ([134.134.136.126]:30623 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725939AbgAaSze (ORCPT ); Fri, 31 Jan 2020 13:55:34 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2020 10:55:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,386,1574150400"; d="scan'208";a="253419672" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by fmsmga004.fm.intel.com with ESMTP; 31 Jan 2020 10:55:32 -0800 Date: Fri, 31 Jan 2020 10:55:32 -0800 From: Sean Christopherson To: Paolo Bonzini Cc: Paul Mackerras , Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH 5/5] KVM: x86: Set kvm_x86_ops only after ->hardware_setup() completes Message-ID: <20200131185531.GB18946@linux.intel.com> References: <20200130001023.24339-1-sean.j.christopherson@intel.com> <20200130001023.24339-6-sean.j.christopherson@intel.com> <44e0c550-7dcc-bfed-07c4-907e61d476a1@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <44e0c550-7dcc-bfed-07c4-907e61d476a1@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org On Thu, Jan 30, 2020 at 06:44:09AM +0100, Paolo Bonzini wrote: > On 30/01/20 01:10, Sean Christopherson wrote: > > Set kvm_x86_ops with the vendor's ops only after ->hardware_setup() > > completes to "prevent" using kvm_x86_ops before they are ready, i.e. to > > generate a null pointer fault instead of silently consuming unconfigured > > state. > > What about even copying kvm_x86_ops by value, so that they can be > accessed with "kvm_x86_ops.callback()" and save one memory access? Oooh, I like that idea. And {svm,vmx}_x86_ops could be marked __initdata to save a few bytes and force all the runtime stuff through kvm_x86_ops. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=0.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_DBL_ABUSE_MALW,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81E5AC35246 for ; Fri, 31 Jan 2020 18:55:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5A87820707 for ; Fri, 31 Jan 2020 18:55:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="R+9lsbbh" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5A87820707 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=8jU50ltISMfjyhTDyckheqQVEQLkN7yN0a+cbgtt/hA=; b=R+9lsbbh0H8mJU hz4O77R3mjPsC31kphkiWa0+kFBwHmqlsVzytFTA3qNzNQbsqR7MfHg4Un0Lqcr91N9saumJwSlVv Ik7EOgKlxUB8C7F9J+TErgySXpTXFXby8s5z71s0JAkx5Hn5wMXquVtiVkI4h845F2axpaCsn/YOc +0JTNyaBE9BC6kgNoFheBVj1XTcvrCe+cnEc4855CFG1xThdpipQHX23O09y2W500rtugNR0Gqp3/ H3iHzDjI6bqeNiJMsNhxMFCLRPO05xQB8L1OaYNayCIcR2FObK3/wuTEGIZToryhix9KB5QHw4x8p ++AfkMnG77sDhZrQDlnw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1ixbS5-0008Sf-CQ; Fri, 31 Jan 2020 18:55:37 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1ixbS2-0008SJ-Dr for linux-arm-kernel@lists.infradead.org; Fri, 31 Jan 2020 18:55:35 +0000 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 31 Jan 2020 10:55:33 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,386,1574150400"; d="scan'208";a="253419672" Received: from sjchrist-coffee.jf.intel.com (HELO linux.intel.com) ([10.54.74.202]) by fmsmga004.fm.intel.com with ESMTP; 31 Jan 2020 10:55:32 -0800 Date: Fri, 31 Jan 2020 10:55:32 -0800 From: Sean Christopherson To: Paolo Bonzini Subject: Re: [PATCH 5/5] KVM: x86: Set kvm_x86_ops only after ->hardware_setup() completes Message-ID: <20200131185531.GB18946@linux.intel.com> References: <20200130001023.24339-1-sean.j.christopherson@intel.com> <20200130001023.24339-6-sean.j.christopherson@intel.com> <44e0c550-7dcc-bfed-07c4-907e61d476a1@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <44e0c550-7dcc-bfed-07c4-907e61d476a1@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200131_105534_476999_C93A0CC9 X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wanpeng Li , Janosch Frank , kvm@vger.kernel.org, David Hildenbrand , Marc Zyngier , Joerg Roedel , Cornelia Huck , linux-mips@vger.kernel.org, kvm-ppc@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Mackerras , Christian Borntraeger , James Morse , linux-arm-kernel@lists.infradead.org, Vitaly Kuznetsov , Suzuki K Poulose , kvmarm@lists.cs.columbia.edu, Julien Thierry , Jim Mattson Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jan 30, 2020 at 06:44:09AM +0100, Paolo Bonzini wrote: > On 30/01/20 01:10, Sean Christopherson wrote: > > Set kvm_x86_ops with the vendor's ops only after ->hardware_setup() > > completes to "prevent" using kvm_x86_ops before they are ready, i.e. to > > generate a null pointer fault instead of silently consuming unconfigured > > state. > > What about even copying kvm_x86_ops by value, so that they can be > accessed with "kvm_x86_ops.callback()" and save one memory access? Oooh, I like that idea. And {svm,vmx}_x86_ops could be marked __initdata to save a few bytes and force all the runtime stuff through kvm_x86_ops. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel