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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E54ABC4332F for ; Mon, 12 Dec 2022 22:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=SUL6ueRqA20+b0E6HboumqtGZ5t4j+ky9rtgq+QfNgc=; b=kA5oLnxQkpM0q/ 3hicSjOFC0oTwzoZvEQ2iItzgWiXAGQoHjuoCEva57sHRDpadlllmTb8cNlACzTNUJoOHhO6nX4k0 pmlDW3xPwjGuD/joL0u7TV/mT476/oAiBjuak3PvmRFlAUPgZWOwGAcDmphcRWZ+LkYPh4avufNDY 7OruF5VTw4TQcoyPJpYv4jVnc4+iwDwxQx7dR2NuP360UYhbVzsHJV97o5UIrEX6VNP/drzryR/3O 9YzVSZuXKwPTmpEIhUNbiKStNeMHvkv7ud2IkGgkfNpapBnEdBv1y3POOjSH7uXk3ObmIES73UKQH 9Zpa/pxMqQmBZWeMKc2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p4rJx-006cre-VY; Mon, 12 Dec 2022 22:30:50 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p4rJl-006cmA-Gr for linux-riscv@lists.infradead.org; Mon, 12 Dec 2022 22:30:39 +0000 Received: by mail-pf1-x42e.google.com with SMTP id x66so950290pfx.3 for ; Mon, 12 Dec 2022 14:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=wDIyaaZP6Sx38V8+GZMMaiCN2LYY75lyx3Qk2zggJjY=; b=AsH0HY9ES//YrqC7aVzHEC/CizcXUu59joNA74umGoNmkMvxLqS0wCffNxDluDxyKo EAqtkusIPRaWsTDrdjn9/llFRUygCmGbtm2vECAI+G08t237WcwWOvji02G3iAivLRkK XtmAOzz+XqYsq2GDP6d9iwh7sTltvZI9fxPTUGYZWGyPiUekYEmb0NyP6jBH0aSpM1QX 0tz4LyerHFPtS+ochp41KGvy5c0kQvu3ZBbrMJ4Y8A8WkC/7Ukk+1JDMNDpCdZbv+wUw sB78NjP1UXJBhqkf6gNp2CwQYVDksQEYfo+cDNGLFgrv7+7q0LQlQIxLu11hgJt4KH7o 881Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=wDIyaaZP6Sx38V8+GZMMaiCN2LYY75lyx3Qk2zggJjY=; b=OLDfLmgIZoPnpEzhAG9lVPChdam4JWOZl2CFs5xVS892BSGo4GjQQ+JNI62jmbV71R oqG4EW1bjfDeLrEDxeidVARDoogXaCjkoak2H8EoH91N/7rxSTIWViakH9Ht+t75qSlH gqqB8o6JjZYOBO1fzzNi0XDz5qF4c9PgjEKvbC2GZQlZyyjsoS2/xFtnfz2lb0Al4NKa xAfZXdEH+Vv/ZcoK5h8LdTlDNR/ufpz66mTttpZKQHzyrVC1k/Fln6wnnOVZlvNfMTau W0wbR2DjKiUNavm6lBl/p89s35lgzJDcSZGISOfyEhmHl00ayisNvhlT2Sm5Ch6U+xnH KQHQ== X-Gm-Message-State: ANoB5plfLCUI2ez90SipP8jTs1h9+VVWSjYzOeigqPdxpTZ7+Ss7vvuf ni/JJnpI3roVxQbttRmfMJxI0A== X-Google-Smtp-Source: AA0mqf74FM6U4ztV3LqdnGXHnnnSC43RbbAIDoSZcE8bsILwNcSluJ+18YStm6rGNZYFVpgbA3RNLg== X-Received: by 2002:aa7:9a1c:0:b0:574:3e1d:72dd with SMTP id w28-20020aa79a1c000000b005743e1d72ddmr18119342pfj.19.1670884234340; Mon, 12 Dec 2022 14:30:34 -0800 (PST) Received: from google.com (223.103.125.34.bc.googleusercontent.com. [34.125.103.223]) by smtp.gmail.com with ESMTPSA id q13-20020aa7842d000000b0056d98e31439sm6499921pfn.140.2022.12.12.14.30.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Dec 2022 14:30:33 -0800 (PST) Date: Mon, 12 Dec 2022 14:30:28 -0800 From: David Matlack To: Ben Gardon Cc: Paolo Bonzini , Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Oliver Upton , Huacai Chen , Aleksandar Markovic , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Sean Christopherson , Andrew Morton , Anshuman Khandual , Nadav Amit , "Matthew Wilcox (Oracle)" , Vlastimil Babka , "Liam R. Howlett" , Suren Baghdasaryan , Peter Xu , xu xin , Arnd Bergmann , Yu Zhao , Colin Cross , Hugh Dickins , Mingwei Zhang , Krish Sadhukhan , Ricardo Koller , Jing Zhang , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-mips@vger.kernel.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org Subject: Re: [RFC PATCH 10/37] KVM: MMU: Move struct kvm_page_fault to common code Message-ID: References: <20221208193857.4090582-1-dmatlack@google.com> <20221208193857.4090582-11-dmatlack@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221212_143037_571763_DAA609F9 X-CRM114-Status: GOOD ( 25.75 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Mon, Dec 12, 2022 at 10:24:31AM -0800, Ben Gardon wrote: > On Thu, Dec 8, 2022 at 11:39 AM David Matlack wrote: > > > > Move struct kvm_page_fault to common code. This will be used in a future > > commit to move the TDP MMU to common code. > > > > No functional change intended. > > > > Signed-off-by: David Matlack > > --- [...] > > diff --git a/include/kvm/mmu_types.h b/include/kvm/mmu_types.h > > index a9da33d4baa8..9f0ca920bf68 100644 > > --- a/include/kvm/mmu_types.h > > +++ b/include/kvm/mmu_types.h > > @@ -66,4 +66,48 @@ struct kvm_mmu_page { > > struct kvm_mmu_page_arch arch; > > }; > > > > +struct kvm_page_fault { > > + /* The raw faulting address. */ > > + const gpa_t addr; > > + > > + /* Whether the fault was synthesized to prefetch a mapping. */ > > + const bool prefetch; > > + > > + /* Information about the cause of the fault. */ > > + const bool write; > > + const bool exec; > > + > > + /* Shifted addr, or result of guest page table walk if shadow paging. */ > > + gfn_t gfn; > > Is this redundant to have in common code? If we're not doing common > shadow paging, then this is just addr shifted. Would this be better > placed in the arch specific struct? Yes it's redundant but it is actually used by the TDP MMU, unlike @addr. So if anything I would rather move @addr to kvm_page_fault_arch. > > > + > > + /* The memslot that contains @gfn. May be NULL. */ > > + struct kvm_memory_slot *slot; > > + > > + /* Maximum page size that can be created for this fault. */ > > + u8 max_level; > > + > > + /* > > + * Page size that can be created based on the max_level and the page > > + * size used by the host mapping. > > + */ > > + u8 req_level; > > + > > + /* Final page size that will be created. */ > > + u8 goal_level; > > + > > + /* > > + * The value of kvm->mmu_invalidate_seq before fetching the host > > + * mapping. Used to verify that the host mapping has not changed > > + * after grabbing the MMU lock. > > + */ > > + unsigned long mmu_seq; > > Should this be ifdef'ed with KVM_ARCH_WANT_MMU_NOTIFIER? I'll have to take a closer look, but probably yes. > > > + > > + /* Information about the host mapping. */ > > + kvm_pfn_t pfn; > > + hva_t hva; > > + bool map_writable; > > + > > + struct kvm_page_fault_arch arch; > > +}; > > + > > #endif /* !__KVM_MMU_TYPES_H */ > > -- > > 2.39.0.rc1.256.g54fd8350bd-goog > > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv