Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp8926004rwp; Wed, 19 Jul 2023 18:31:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlGRnllMUAA2QjGlVxqEZrZ/ppzNiU6MecPAeqoazejbWRZp6w4j6I3D7HKpr4fymnJS+Bbb X-Received: by 2002:a17:907:ea9:b0:992:be80:ab01 with SMTP id ho41-20020a1709070ea900b00992be80ab01mr4911448ejc.58.1689816693508; Wed, 19 Jul 2023 18:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689816693; cv=none; d=google.com; s=arc-20160816; b=cam7DYm4tVvr/ISpSa9vVnQHj5ZMhIQHnoxsDz3zmFUJG6oiOAZnsKOFS71GYpJg5q TvaV56UpeDGNF2F7D1mwvq5NP6YqZ/Tg6kSvfm8mOCcExpW3jizZ+w7aghs6RxbeP3fb 5x2Qjc8O8wgGqKwvRTOrav7TyJgP7NDGKK+c3lvrP4BUxpYC+vpBvuph0hU95znbFOWP 4q9dp4fo5Hm7FRUPJrnVbLxu086i3hreGXN8skyvMb89x+NJNlA+ghZvXM0V7J4YfLY7 yfMxOdIhrXoOjpmXRn0qKzlAZaF3LeHVaqyLBZQe/RpBkK2S1K98TA2++M3QlrS1fKbk LsdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=B5oWrN3vHgnztM4IoSYQbydDy1Gm2FPXJHEts150Bgk=; fh=Kaga+gXb5dOI8TjD0KocLBb3EKBrJv2JBv9eYkRlFvA=; b=tMz8h3/V5o/pm2apI2WWV9usBP6k1lX4d2zpbk9N2JGXEBwIAGbTLjgYWdtBdgAI0E 7IZJiLXo2GimDi26XMMOB81J2VmRUo8XWXvtu/oNeL16nXtkoDBOZnY0O+BNy2xy7zOC O1G/PPBh9Jv2PWIgl8cVpTBI7xA4NxM31qUi5xAU+tE3K+P2XOPa/AWNeklkGu2KYhN3 JtvY8vW9ZywqC+O5qy1Iy4hPIYOyKMkrpQMgkCcqIHoovBL3KsPC7beeBjip4V5ScUqY 2MwtcLty4/L638zOGuu9T48UemVoWmMIhzhw8Sy5H9ms1ZUvns95Mqjkf63RcltWTFDH 8fhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KanBI6GF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z19-20020a170906945300b0098df1cbe2b1si3568760ejx.925.2023.07.19.18.31.09; Wed, 19 Jul 2023 18:31:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KanBI6GF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbjGTBQR (ORCPT + 99 others); Wed, 19 Jul 2023 21:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjGTBQO (ORCPT ); Wed, 19 Jul 2023 21:16:14 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 789C21FFD; Wed, 19 Jul 2023 18:16:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689815772; x=1721351772; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=0X3B3RFBvIohiBDiMK6hMbRCxfxPASWhBjQpW8WFunc=; b=KanBI6GFjg2yvoF3AnNTF8WKdoe+4ab/Nk7tEccronPJsTYxMfeX47/y faX7jODp3AeZJzLq//yTrreJ52426xiKc9UskXC6ySBoVjqY+cMocscbs 8M1xrtkUV8rk9UwQrkbtWAU/mYOCjfHdpqL9RpqDmuCgvb4+mCJsaUGGO eCVLOXhr8mjlSVi970PssVsc336ERySTAI6szaxp+ohQBXVgZpkrA02Y7 Wi1/PI9eQ9eWCTgMJDsIdTiIi+USE7GoCRPwrOsX679Eem2N8+v6chjxq 9thxw89k5YtSPYTkykTkNFEp4+hJL5sn4W8mJ320WAIdz5ByRSraGiK3J g==; X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="364065919" X-IronPort-AV: E=Sophos;i="6.01,216,1684825200"; d="scan'208";a="364065919" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Jul 2023 18:16:11 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10776"; a="674516361" X-IronPort-AV: E=Sophos;i="6.01,216,1684825200"; d="scan'208";a="674516361" Received: from yy-desk-7060.sh.intel.com (HELO localhost) ([10.239.159.76]) by orsmga003.jf.intel.com with ESMTP; 19 Jul 2023 18:15:44 -0700 Date: Thu, 20 Jul 2023 09:15:41 +0800 From: Yuan Yao To: Sean Christopherson Cc: Paolo Bonzini , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , "Matthew Wilcox (Oracle)" , Andrew Morton , Paul Moore , James Morris , "Serge E. Hallyn" , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Chao Peng , Fuad Tabba , Jarkko Sakkinen , Yu Zhang , Vishal Annapurve , Ackerley Tng , Maciej Szmigiero , Vlastimil Babka , David Hildenbrand , Quentin Perret , Michael Roth , Wang , Liam Merwick , Isaku Yamahata , "Kirill A . Shutemov" Subject: Re: [RFC PATCH v11 05/29] KVM: Convert KVM_ARCH_WANT_MMU_NOTIFIER to CONFIG_KVM_GENERIC_MMU_NOTIFIER Message-ID: <20230720011541.6ti5sygwwfwko6ab@yy-desk-7060> References: <20230718234512.1690985-1-seanjc@google.com> <20230718234512.1690985-6-seanjc@google.com> <20230719073115.vuedo2cf3mp27xm4@yy-desk-7060> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 19, 2023 at 07:15:09AM -0700, Sean Christopherson wrote: > On Wed, Jul 19, 2023, Yuan Yao wrote: > > On Tue, Jul 18, 2023 at 04:44:48PM -0700, Sean Christopherson wrote: > > > diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > > > index 90a0be261a5c..d2d3e083ec7f 100644 > > > --- a/include/linux/kvm_host.h > > > +++ b/include/linux/kvm_host.h > > > @@ -255,7 +255,9 @@ bool kvm_setup_async_pf(struct kvm_vcpu *vcpu, gpa_t cr2_or_gpa, > > > int kvm_async_pf_wakeup_all(struct kvm_vcpu *vcpu); > > > #endif > > > > > > -#ifdef KVM_ARCH_WANT_MMU_NOTIFIER > > > +struct kvm_gfn_range; > > > > Not sure why a declaration here, it's defined for ARCHs which defined > > KVM_ARCH_WANT_MMU_NOTIFIER before. > > The forward declaration exists to handle cases where CONFIG_KVM=n, specifically > arch/powerpc/include/asm/kvm_ppc.h's declaration of hooks to forward calls to > uarch modules: > > bool (*unmap_gfn_range)(struct kvm *kvm, struct kvm_gfn_range *range); > bool (*age_gfn)(struct kvm *kvm, struct kvm_gfn_range *range); > bool (*test_age_gfn)(struct kvm *kvm, struct kvm_gfn_range *range); > bool (*set_spte_gfn)(struct kvm *kvm, struct kvm_gfn_range *range); > > Prior to using a Kconfig, a forward declaration wasn't necessary because > arch/powerpc/include/asm/kvm_host.h would #define KVM_ARCH_WANT_MMU_NOTIFIER even > if CONFIG_KVM=n. > > Alternatively, kvm_ppc.h could declare the struct. I went this route mainly to > avoid the possibility of someone encountering the same problem on a different > architecture. Ah I see, thanks for your explanation!