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=-7.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 8DAF9C49EA5 for ; Thu, 24 Jun 2021 10:17:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 77BD361400 for ; Thu, 24 Jun 2021 10:17:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232193AbhFXKT6 (ORCPT ); Thu, 24 Jun 2021 06:19:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:42058 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232144AbhFXKT4 (ORCPT ); Thu, 24 Jun 2021 06:19:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624529857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=H1QmQf0HjgfEEO/YXFb07R4kp428RjM92oYJv9BIIfU1pd6duojaDyI7drSXXC1f8H2Ywn AvXBDSZI/lrCj8j/ASh1qhpRLH3p3oHWD1DEynMOa3UyttSPWHJ+KipgM4k9oOjf43gYiE MaEh2Ii3o4SFW6mTXKeDD9DV8UVUfwc= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-263-1sJaatheNGSutbpsLSbp4w-1; Thu, 24 Jun 2021 06:17:35 -0400 X-MC-Unique: 1sJaatheNGSutbpsLSbp4w-1 Received: by mail-ej1-f71.google.com with SMTP id de48-20020a1709069bf0b029048ae3ebecabso1810350ejc.16 for ; Thu, 24 Jun 2021 03:17:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=DgAGT36k8C9O2uOi0Pqz2Zrx36Zoincea66oa7dtS3DgJh9U0Y1RJAR+I5Ml2ExlK1 sALzFypKq0hJeSiB6b4g19RgEZp5LG5rD4zAfsFNpfDwB2BfyeUH2Xzzs/Xh/0sHAZOF qHcebCBjUIqessew9/D5qGXcbLZF6joeA4UGS0nx9Uwi+COO5NzpwaMMNxT4IxfTQ1m/ CpthbPTMy+/KCowPlskmpv3MJfL9anv5S8EsiiiJHNq2Qb4Fj30eaPRRIEWQJa+zLAnK xTR9VvZ20RI6vru34+rfiq9J4/oWnt2V5f18vvjwzbBzW9fxJYuKPvr5mBDQv53d/v3L 33vw== X-Gm-Message-State: AOAM531aPbZ60ckKMpr/YsqE02kwXFCb/cjnaKqOLGPdvmev0O3XfZQh JZzHkQCDE3J6sXTUBAo/KJ+zUqW9oPmyLN0PBRB5JlZoZGQifbhaJvAUv6ya6VOjFzS2TTG2Bio IKeMPosDh9P85D0oCu3xFv50n X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621425ejb.480.1624529854691; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxC6TqcAfZORfwKXJXCm8bql8vynsp6j3JYon1fQgnkpoL4xlG5zu/uVtJRITtzGjbxU3KFw== X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621398ejb.480.1624529854552; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x21sm1600772edv.97.2021.06.24.03.17.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:17:33 -0700 (PDT) Subject: Re: [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU To: Marc Zyngier , Nicholas Piggin Cc: Aleksandar Markovic , Huacai Chen , Paul Mackerras , David Stevens , Zhenyu Wang , Zhi Wang , Alexandru Elisei , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, James Morse , Jim Mattson , Joerg Roedel , kvmarm@lists.cs.columbia.edu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Sean Christopherson , Suzuki K Poulose , Vitaly Kuznetsov , Wanpeng Li , Will Deacon References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-4-stevensd@google.com> <1624524744.2sr7o7ix86.astroid@bobo.none> <87mtrfinks.wl-maz@kernel.org> From: Paolo Bonzini Message-ID: <0b7f9c30-eb12-35c5-191f-0e8e469e1b88@redhat.com> Date: Thu, 24 Jun 2021 12:17:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87mtrfinks.wl-maz@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/06/21 12:06, Marc Zyngier wrote: > On Thu, 24 Jun 2021 09:58:00 +0100, > Nicholas Piggin wrote: >> >> Excerpts from David Stevens's message of June 24, 2021 1:57 pm: >>> From: David Stevens >>> out_unlock: >>> if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) >>> read_unlock(&vcpu->kvm->mmu_lock); >>> else >>> write_unlock(&vcpu->kvm->mmu_lock); >>> - kvm_release_pfn_clean(pfn); >>> + if (pfnpg.page) >>> + put_page(pfnpg.page); >>> return r; >>> } >> >> How about >> >> kvm_release_pfn_page_clean(pfnpg); > > I'm not sure. I always found kvm_release_pfn_clean() ugly, because it > doesn't mark the page 'clean'. I find put_page() more correct. > > Something like 'kvm_put_pfn_page()' would make more sense, but I'm so > bad at naming things that I could just as well call it 'bob()'. The best way to go would be to get rid of kvm_release_pfn_clean() and always go through a pfn_page. Then we could or could not introduce wrappers kvm_put_pfn_page{,_dirty}. I think for now it's best to limit the churn since these patches will go in the stable releases too, and clean up the resulting API once we have a clear idea of how all architectures are using kvm_pfn_page. Paolo 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=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, 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 98B5DC48BDF for ; Thu, 24 Jun 2021 10:18:11 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 C17AB613FB for ; Thu, 24 Jun 2021 10:18:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C17AB613FB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4G9bgQ1JJTz3bxd for ; Thu, 24 Jun 2021 20:18:10 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H1QmQf0H; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H1QmQf0H; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=216.205.24.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=pbonzini@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H1QmQf0H; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=H1QmQf0H; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4G9bfs1qN7z2xg5 for ; Thu, 24 Jun 2021 20:17:41 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624529857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=H1QmQf0HjgfEEO/YXFb07R4kp428RjM92oYJv9BIIfU1pd6duojaDyI7drSXXC1f8H2Ywn AvXBDSZI/lrCj8j/ASh1qhpRLH3p3oHWD1DEynMOa3UyttSPWHJ+KipgM4k9oOjf43gYiE MaEh2Ii3o4SFW6mTXKeDD9DV8UVUfwc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624529857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=H1QmQf0HjgfEEO/YXFb07R4kp428RjM92oYJv9BIIfU1pd6duojaDyI7drSXXC1f8H2Ywn AvXBDSZI/lrCj8j/ASh1qhpRLH3p3oHWD1DEynMOa3UyttSPWHJ+KipgM4k9oOjf43gYiE MaEh2Ii3o4SFW6mTXKeDD9DV8UVUfwc= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-uRFmZ6gpP2KWNpuHKIrTnQ-1; Thu, 24 Jun 2021 06:17:35 -0400 X-MC-Unique: uRFmZ6gpP2KWNpuHKIrTnQ-1 Received: by mail-ej1-f71.google.com with SMTP id j26-20020a170906411ab02904774cb499f8so1830617ejk.6 for ; Thu, 24 Jun 2021 03:17:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=tXC0aS0f8bgggqGVuzlQHZFQk8xawBCaRpGT74kFEF0k/idu6zh9StYwlDee7fZWIZ 6x/2H6o/6UEWGZaRI57On4w+lcUjiVuTQ06iYS9iQVPcoZsUO19xPV/V6Ae1THk5OFzG 60G5Un5iqRjR5PSCB0hjxtunvkEsX7/ZMFAef4cPCaDpPrgsFC93FwCLH+3NNGN2UrPc K0Km80PmF2lpAJR2AFTWAB/1lTRUq0lcGcg3jOhAkmgn+15Xuj4O86hW9pCNOT1Nmm8h 4NiG0N8O8O+5s0R0e1Vmx/PH1BmiEL4s7q60IBPgUb/R5s3De4efjhvNZNuFj4BybDDI K2XQ== X-Gm-Message-State: AOAM531Fa5N6j0cyEUmwhpk4fiy2a2R7J4u5uuTaQ9U6GQohNqMentl+ UyM9TUHvs03Xsfly5nPWCNj32c9EjoDd3kPcuhQSx40nD5ks97iYughtAaZc2/A2Xtjjz4Folac xWwEST4lmnofO7pLTiJiQRaFiLQ== X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621422ejb.480.1624529854691; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxC6TqcAfZORfwKXJXCm8bql8vynsp6j3JYon1fQgnkpoL4xlG5zu/uVtJRITtzGjbxU3KFw== X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621398ejb.480.1624529854552; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x21sm1600772edv.97.2021.06.24.03.17.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:17:33 -0700 (PDT) Subject: Re: [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU To: Marc Zyngier , Nicholas Piggin References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-4-stevensd@google.com> <1624524744.2sr7o7ix86.astroid@bobo.none> <87mtrfinks.wl-maz@kernel.org> From: Paolo Bonzini Message-ID: <0b7f9c30-eb12-35c5-191f-0e8e469e1b88@redhat.com> Date: Thu, 24 Jun 2021 12:17:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87mtrfinks.wl-maz@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wanpeng Li , kvm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, Will Deacon , kvmarm@lists.cs.columbia.edu, Alexandru Elisei , Joerg Roedel , Huacai Chen , Aleksandar Markovic , Zhi Wang , Suzuki K Poulose , intel-gfx@lists.freedesktop.org, kvm-ppc@vger.kernel.org, Zhenyu Wang , intel-gvt-dev@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Jim Mattson , Sean Christopherson , linux-kernel@vger.kernel.org, James Morse , David Stevens , Vitaly Kuznetsov , linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On 24/06/21 12:06, Marc Zyngier wrote: > On Thu, 24 Jun 2021 09:58:00 +0100, > Nicholas Piggin wrote: >> >> Excerpts from David Stevens's message of June 24, 2021 1:57 pm: >>> From: David Stevens >>> out_unlock: >>> if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) >>> read_unlock(&vcpu->kvm->mmu_lock); >>> else >>> write_unlock(&vcpu->kvm->mmu_lock); >>> - kvm_release_pfn_clean(pfn); >>> + if (pfnpg.page) >>> + put_page(pfnpg.page); >>> return r; >>> } >> >> How about >> >> kvm_release_pfn_page_clean(pfnpg); > > I'm not sure. I always found kvm_release_pfn_clean() ugly, because it > doesn't mark the page 'clean'. I find put_page() more correct. > > Something like 'kvm_put_pfn_page()' would make more sense, but I'm so > bad at naming things that I could just as well call it 'bob()'. The best way to go would be to get rid of kvm_release_pfn_clean() and always go through a pfn_page. Then we could or could not introduce wrappers kvm_put_pfn_page{,_dirty}. I think for now it's best to limit the churn since these patches will go in the stable releases too, and clean up the resulting API once we have a clear idea of how all architectures are using kvm_pfn_page. Paolo 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=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, 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 5C793C49EA6 for ; Thu, 24 Jun 2021 10:17:42 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id D572E613FF for ; Thu, 24 Jun 2021 10:17:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D572E613FF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.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 50D524B26E; Thu, 24 Jun 2021 06:17:41 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@redhat.com 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 TzoSdK6uZnRn; Thu, 24 Jun 2021 06:17:40 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3BFB54B26F; Thu, 24 Jun 2021 06:17:40 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id A1E054B26D for ; Thu, 24 Jun 2021 06:17:38 -0400 (EDT) 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 B3fnAZBsTgb3 for ; Thu, 24 Jun 2021 06:17:37 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mm01.cs.columbia.edu (Postfix) with ESMTP id BA23A4B26C for ; Thu, 24 Jun 2021 06:17:37 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624529857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=H1QmQf0HjgfEEO/YXFb07R4kp428RjM92oYJv9BIIfU1pd6duojaDyI7drSXXC1f8H2Ywn AvXBDSZI/lrCj8j/ASh1qhpRLH3p3oHWD1DEynMOa3UyttSPWHJ+KipgM4k9oOjf43gYiE MaEh2Ii3o4SFW6mTXKeDD9DV8UVUfwc= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-539-p2JrJIE1Pb6bDbRW7RaU6g-1; Thu, 24 Jun 2021 06:17:35 -0400 X-MC-Unique: p2JrJIE1Pb6bDbRW7RaU6g-1 Received: by mail-ej1-f71.google.com with SMTP id f8-20020a1709064dc8b02904996ccd94c0so1831471ejw.9 for ; Thu, 24 Jun 2021 03:17:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=jGY2ECxML9CdRdUv4bfkRYuvNgnqiUkHBn1yHqxp7cMJjnYl8VXCU5sUWN9Ylx5/RB jLaDuD2FO1ei7T06nINWSMyNe4HL1g6J4E/GHtp/D9ML4fjPCbbDF94WPfv7RYr6nSGW Yfjha5OXruRPn9fKX7QDNeILxloTfAZRrBj1GcuUueSTSp6GAD5eFg4uvzL+qBmI/WbD XTyBHziWKXvRnAXvknAkTlBrE0XM1+W2dEmEB3Dgye/Xmi9LCbpaxc4Sql51Rrwh0WOz LobEMsDKklmlZi5HhWGhF+CJnfZb0e7ZLi49DazwtxcgWteFcy8jZRGY54gPikNmI5KN Q8Gw== X-Gm-Message-State: AOAM531eNCXc6WomU4+J8jjKdXRLCmn8ObyESx6H3r4LICGP+fJhgwu7 MZEqg7xPzNPI9HGLJ8XoB6+jTQQ92bmjeXBs6XKZBL5nt2EFpCTI24SLYrJSGjizoIlL9vlMrk8 ycoMsSeVTaeXHf1zRcnYYDu3i X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621430ejb.480.1624529854723; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxC6TqcAfZORfwKXJXCm8bql8vynsp6j3JYon1fQgnkpoL4xlG5zu/uVtJRITtzGjbxU3KFw== X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621398ejb.480.1624529854552; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x21sm1600772edv.97.2021.06.24.03.17.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:17:33 -0700 (PDT) Subject: Re: [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU To: Marc Zyngier , Nicholas Piggin References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-4-stevensd@google.com> <1624524744.2sr7o7ix86.astroid@bobo.none> <87mtrfinks.wl-maz@kernel.org> From: Paolo Bonzini Message-ID: <0b7f9c30-eb12-35c5-191f-0e8e469e1b88@redhat.com> Date: Thu, 24 Jun 2021 12:17:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87mtrfinks.wl-maz@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Cc: Wanpeng Li , kvm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, Paul Mackerras , Will Deacon , kvmarm@lists.cs.columbia.edu, Joerg Roedel , Huacai Chen , Aleksandar Markovic , Zhi Wang , intel-gfx@lists.freedesktop.org, kvm-ppc@vger.kernel.org, Zhenyu Wang , intel-gvt-dev@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Jim Mattson , Sean Christopherson , linux-kernel@vger.kernel.org, David Stevens , Vitaly Kuznetsov , linuxppc-dev@lists.ozlabs.org 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On 24/06/21 12:06, Marc Zyngier wrote: > On Thu, 24 Jun 2021 09:58:00 +0100, > Nicholas Piggin wrote: >> >> Excerpts from David Stevens's message of June 24, 2021 1:57 pm: >>> From: David Stevens >>> out_unlock: >>> if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) >>> read_unlock(&vcpu->kvm->mmu_lock); >>> else >>> write_unlock(&vcpu->kvm->mmu_lock); >>> - kvm_release_pfn_clean(pfn); >>> + if (pfnpg.page) >>> + put_page(pfnpg.page); >>> return r; >>> } >> >> How about >> >> kvm_release_pfn_page_clean(pfnpg); > > I'm not sure. I always found kvm_release_pfn_clean() ugly, because it > doesn't mark the page 'clean'. I find put_page() more correct. > > Something like 'kvm_put_pfn_page()' would make more sense, but I'm so > bad at naming things that I could just as well call it 'bob()'. The best way to go would be to get rid of kvm_release_pfn_clean() and always go through a pfn_page. Then we could or could not introduce wrappers kvm_put_pfn_page{,_dirty}. I think for now it's best to limit the churn since these patches will go in the stable releases too, and clean up the resulting API once we have a clear idea of how all architectures are using kvm_pfn_page. Paolo _______________________________________________ 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=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,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 23497C48BDF for ; Thu, 24 Jun 2021 10:19:50 +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 E398E61248 for ; Thu, 24 Jun 2021 10:19:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E398E61248 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+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.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=zKdoKzSa9ii2A5rUAXIlpct1PBf4Z18a71hZk7mHZw4=; b=PHabYOwU8SLcZs4am+4b7P2dGZ xHQjjcNNtiUhL8Y6aiaAZkvfzml9hSbLbEwtCMF71zBwhVYKUdfwES0C+HwDfsZYj/M8WYW7hI6ET GnA1FHqqrwv78AU7rOSutMz56oEoPoQq+hEOnNSYDwV0Vys7uApu4KmhRXEdtF+MIrg/ZEbJXXXbf eZMFj/3I3h/19RPElFlJaKzPE+kt9zwggEBDRHOVwfCGaVR1qYN1LQS3cOFTqBRR6pGxi8NnOQh1J sZpvZWFE21jIyCA2p4ySdsJCixkFUL3cTzO4WxPIo7xOULdqx4kCStKDjOZmc9axp8o1oSEy19Bry h5avUSYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwMQe-00E1A9-Ly; Thu, 24 Jun 2021 10:17:50 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwMQV-00E17b-1o for linux-arm-kernel@lists.infradead.org; Thu, 24 Jun 2021 10:17:40 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624529857; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=H1QmQf0HjgfEEO/YXFb07R4kp428RjM92oYJv9BIIfU1pd6duojaDyI7drSXXC1f8H2Ywn AvXBDSZI/lrCj8j/ASh1qhpRLH3p3oHWD1DEynMOa3UyttSPWHJ+KipgM4k9oOjf43gYiE MaEh2Ii3o4SFW6mTXKeDD9DV8UVUfwc= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-156-Nnj9Zx6WNP2oKHX4ExwQXA-1; Thu, 24 Jun 2021 06:17:35 -0400 X-MC-Unique: Nnj9Zx6WNP2oKHX4ExwQXA-1 Received: by mail-ej1-f71.google.com with SMTP id q14-20020a1709066aceb029049fa6bee56fso1802978ejs.21 for ; Thu, 24 Jun 2021 03:17:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=oF7G6m9H6Dgfjn3itsCuALqkI2uJcXL0gNv3mRVwP2qdoVpm+8xFiB7N7s5ZtiNqy5 pGKwx8fQsd/IHQttsNsIpkkVSVs7K639QTyDPay9eN63eDAhVj7VM429Vu677xe3MHrA WGTk1A+8S26TfvwXGmDryehkn0GYqUZNoAbIpjtjga+vJv83pUIwySTSjDwZsSP5fs6P nirIACdVy/29RYkyUFTIzkW1qeryKW3KKGlBs9ZtloNBHEtZjXuDhNSuDbptHPvbke40 TEJPrsXBzZCLuCL8vuOzG3zg+qZJNK3yjmRoGNEegYFk7023OjlcOWv8UtqIqv+9l6IM F8zw== X-Gm-Message-State: AOAM5310EecbtkM63ENNlUYanLKx4LWOfOwcYNYQGFmkNOBx1bHHHN3q tbYIGzVhHxjAF67xHTG021jnJER1sEHduMesmfbqpH+yyEK5wIDZ0eNbdkXBTaKWXw1E9dssWyf zlw5kMaYIpSSB3pjIj5rMOPlhLDZv/Vh4ehQ= X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621423ejb.480.1624529854691; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxC6TqcAfZORfwKXJXCm8bql8vynsp6j3JYon1fQgnkpoL4xlG5zu/uVtJRITtzGjbxU3KFw== X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621398ejb.480.1624529854552; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x21sm1600772edv.97.2021.06.24.03.17.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:17:33 -0700 (PDT) Subject: Re: [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU To: Marc Zyngier , Nicholas Piggin Cc: Aleksandar Markovic , Huacai Chen , Paul Mackerras , David Stevens , Zhenyu Wang , Zhi Wang , Alexandru Elisei , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, James Morse , Jim Mattson , Joerg Roedel , kvmarm@lists.cs.columbia.edu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Sean Christopherson , Suzuki K Poulose , Vitaly Kuznetsov , Wanpeng Li , Will Deacon References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-4-stevensd@google.com> <1624524744.2sr7o7ix86.astroid@bobo.none> <87mtrfinks.wl-maz@kernel.org> From: Paolo Bonzini Message-ID: <0b7f9c30-eb12-35c5-191f-0e8e469e1b88@redhat.com> Date: Thu, 24 Jun 2021 12:17:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87mtrfinks.wl-maz@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_031739_264250_36173C87 X-CRM114-Status: GOOD ( 16.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 24/06/21 12:06, Marc Zyngier wrote: > On Thu, 24 Jun 2021 09:58:00 +0100, > Nicholas Piggin wrote: >> >> Excerpts from David Stevens's message of June 24, 2021 1:57 pm: >>> From: David Stevens >>> out_unlock: >>> if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) >>> read_unlock(&vcpu->kvm->mmu_lock); >>> else >>> write_unlock(&vcpu->kvm->mmu_lock); >>> - kvm_release_pfn_clean(pfn); >>> + if (pfnpg.page) >>> + put_page(pfnpg.page); >>> return r; >>> } >> >> How about >> >> kvm_release_pfn_page_clean(pfnpg); > > I'm not sure. I always found kvm_release_pfn_clean() ugly, because it > doesn't mark the page 'clean'. I find put_page() more correct. > > Something like 'kvm_put_pfn_page()' would make more sense, but I'm so > bad at naming things that I could just as well call it 'bob()'. The best way to go would be to get rid of kvm_release_pfn_clean() and always go through a pfn_page. Then we could or could not introduce wrappers kvm_put_pfn_page{,_dirty}. I think for now it's best to limit the churn since these patches will go in the stable releases too, and clean up the resulting API once we have a clear idea of how all architectures are using kvm_pfn_page. Paolo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, 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 4CD9EC49EA7 for ; Thu, 24 Jun 2021 10:17:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 187D5613FB for ; Thu, 24 Jun 2021 10:17:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 187D5613FB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7B6E26EB4C; Thu, 24 Jun 2021 10:17:41 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F4186EB4C for ; Thu, 24 Jun 2021 10:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624529859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=fZxrt7Lezc/iAa63H6IbCRXWQDJNj5gPuzvDUmv/ZjFqIaMfKVckXsPdadGmcLJyGV5Lle XTKS1glQqZH7p0pORUVVUlqcgXJrPABr+3q5GTXUj4N8wUimqffOA9DT32oQ5sc7euhSa2 g3/xsyNIoXy8VBsxpyRdZ1XHKD/xGkI= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-539-4OCUC20AN4OTUyXYgjq8gQ-1; Thu, 24 Jun 2021 06:17:35 -0400 X-MC-Unique: 4OCUC20AN4OTUyXYgjq8gQ-1 Received: by mail-ej1-f70.google.com with SMTP id u4-20020a1709061244b02904648b302151so1821238eja.17 for ; Thu, 24 Jun 2021 03:17:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=N917y8zb/PYX2oYjONBab//i8AHTy3w7/lOiOuShID1tIJ4GzyQdMIj46S/qOh3Mrz jd7AeCjjvJ6eyY5TAdE2JLI9FqWdwh58OgIWUjbdMEGgkN6NVw8fVYBxsOUGMxQSLrXe J10JhYev1H15ntXWak2S/Ortqu7aoHSk72lef56HXd/SJ1TsRFhqCLkmJ1znDGkmA4wm BzXG+hSBGLCRMDCqRWL7c/O+rm3BAulAENsBwmTfFgIjKnncB2ZN23Kyq2QSLfbvrB5Z oaPU0APxNjSp8Osz1fOnyh5zV1yi/ov8K9zju4+BhJ0YOkJwoFv8uVp/Toyowt/dvSyr B1FA== X-Gm-Message-State: AOAM5302bMyXXp4bEHTHVQAX88F9oiTNtGquSjC6tFcdIoWtyTXwiNfn hbm4BNmwvRAEtLRuOGcuBY8BA4lsaXh1vo43E+YlXAdg8bB3Sus7SA5A2YEaULDg9Ws6DSsx4p7 gVzGk5fhNIsyJDs4IfCgBPZo8kRS0 X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621431ejb.480.1624529854729; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxC6TqcAfZORfwKXJXCm8bql8vynsp6j3JYon1fQgnkpoL4xlG5zu/uVtJRITtzGjbxU3KFw== X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621398ejb.480.1624529854552; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x21sm1600772edv.97.2021.06.24.03.17.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:17:33 -0700 (PDT) Subject: Re: [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU To: Marc Zyngier , Nicholas Piggin References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-4-stevensd@google.com> <1624524744.2sr7o7ix86.astroid@bobo.none> <87mtrfinks.wl-maz@kernel.org> From: Paolo Bonzini Message-ID: <0b7f9c30-eb12-35c5-191f-0e8e469e1b88@redhat.com> Date: Thu, 24 Jun 2021 12:17:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87mtrfinks.wl-maz@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wanpeng Li , kvm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, Paul Mackerras , Will Deacon , kvmarm@lists.cs.columbia.edu, Alexandru Elisei , Joerg Roedel , Huacai Chen , Aleksandar Markovic , Zhi Wang , Suzuki K Poulose , intel-gfx@lists.freedesktop.org, kvm-ppc@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Jim Mattson , Sean Christopherson , linux-kernel@vger.kernel.org, James Morse , David Stevens , Vitaly Kuznetsov , linuxppc-dev@lists.ozlabs.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 24/06/21 12:06, Marc Zyngier wrote: > On Thu, 24 Jun 2021 09:58:00 +0100, > Nicholas Piggin wrote: >> >> Excerpts from David Stevens's message of June 24, 2021 1:57 pm: >>> From: David Stevens >>> out_unlock: >>> if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) >>> read_unlock(&vcpu->kvm->mmu_lock); >>> else >>> write_unlock(&vcpu->kvm->mmu_lock); >>> - kvm_release_pfn_clean(pfn); >>> + if (pfnpg.page) >>> + put_page(pfnpg.page); >>> return r; >>> } >> >> How about >> >> kvm_release_pfn_page_clean(pfnpg); > > I'm not sure. I always found kvm_release_pfn_clean() ugly, because it > doesn't mark the page 'clean'. I find put_page() more correct. > > Something like 'kvm_put_pfn_page()' would make more sense, but I'm so > bad at naming things that I could just as well call it 'bob()'. The best way to go would be to get rid of kvm_release_pfn_clean() and always go through a pfn_page. Then we could or could not introduce wrappers kvm_put_pfn_page{,_dirty}. I think for now it's best to limit the churn since these patches will go in the stable releases too, and clean up the resulting API once we have a clear idea of how all architectures are using kvm_pfn_page. Paolo 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=-5.0 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, 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 82536C49EA5 for ; Thu, 24 Jun 2021 10:17:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 574A0613B9 for ; Thu, 24 Jun 2021 10:17:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 574A0613B9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F25996EB4E; Thu, 24 Jun 2021 10:17:41 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id 287896EB4D for ; Thu, 24 Jun 2021 10:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624529859; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=fZxrt7Lezc/iAa63H6IbCRXWQDJNj5gPuzvDUmv/ZjFqIaMfKVckXsPdadGmcLJyGV5Lle XTKS1glQqZH7p0pORUVVUlqcgXJrPABr+3q5GTXUj4N8wUimqffOA9DT32oQ5sc7euhSa2 g3/xsyNIoXy8VBsxpyRdZ1XHKD/xGkI= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-263-detZH5B_O3iYpAHAeCllng-1; Thu, 24 Jun 2021 06:17:35 -0400 X-MC-Unique: detZH5B_O3iYpAHAeCllng-1 Received: by mail-ej1-f71.google.com with SMTP id p20-20020a1709064994b02903cd421d7803so1814000eju.22 for ; Thu, 24 Jun 2021 03:17:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4frsi0H+HBjHeCdKISuXJMG773wuFNrwEMxUF4xqOQU=; b=mx9cuqUwlcfWjfxQczS0/hg7xxK8eFjt2O8EMcZYlEArMH5loA2F+gmnCz9XZ64WOy IqsBrybLEcvkOOR0mbREY+HjfhztqG25OZuH+mkUo66aeDgpCD2Bf07SqweHJp9lHJv6 APFH2k30BxRIDuIEOf+6UU+FaBQwY6tfD99Bm5jxjmneKZavUPIrohwRQjaR+JOCzICT A5Xs01/3Q+feSozu48m3Wv+7/Q7E7Uxz4JucDh0nUw5nwWLsd5rnWSQscHczY+oGloMm TeLwUXAuQiWlDntqCTJnxvBZ9wRBQGwyiXlJ0IzR2QDb9O8KzkHAGVP1Ix2oGqU9l62q 8ayA== X-Gm-Message-State: AOAM533P7I6EmMr519N43u3m1/9DVaUyLFBvhtu+9HaLuZSkGX6sNYhT UcWwErmUK2mufLLuxVSiLfM2pg9hz+8klVAbEOdtZlPt38lYyubMyXXklQR2xSlxmLWJCSbD1O3 oeHlQpgylTrwgBL63Yl54KPEBtQD8 X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621416ejb.480.1624529854690; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxC6TqcAfZORfwKXJXCm8bql8vynsp6j3JYon1fQgnkpoL4xlG5zu/uVtJRITtzGjbxU3KFw== X-Received: by 2002:a17:906:b254:: with SMTP id ce20mr4621398ejb.480.1624529854552; Thu, 24 Jun 2021 03:17:34 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id x21sm1600772edv.97.2021.06.24.03.17.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 03:17:33 -0700 (PDT) To: Marc Zyngier , Nicholas Piggin References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-4-stevensd@google.com> <1624524744.2sr7o7ix86.astroid@bobo.none> <87mtrfinks.wl-maz@kernel.org> From: Paolo Bonzini Message-ID: <0b7f9c30-eb12-35c5-191f-0e8e469e1b88@redhat.com> Date: Thu, 24 Jun 2021 12:17:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <87mtrfinks.wl-maz@kernel.org> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=pbonzini@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Wanpeng Li , kvm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mips@vger.kernel.org, Paul Mackerras , Will Deacon , kvmarm@lists.cs.columbia.edu, Alexandru Elisei , Joerg Roedel , Huacai Chen , Aleksandar Markovic , Suzuki K Poulose , intel-gfx@lists.freedesktop.org, kvm-ppc@vger.kernel.org, intel-gvt-dev@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Jim Mattson , Sean Christopherson , linux-kernel@vger.kernel.org, James Morse , David Stevens , Vitaly Kuznetsov , linuxppc-dev@lists.ozlabs.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 24/06/21 12:06, Marc Zyngier wrote: > On Thu, 24 Jun 2021 09:58:00 +0100, > Nicholas Piggin wrote: >> >> Excerpts from David Stevens's message of June 24, 2021 1:57 pm: >>> From: David Stevens >>> out_unlock: >>> if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) >>> read_unlock(&vcpu->kvm->mmu_lock); >>> else >>> write_unlock(&vcpu->kvm->mmu_lock); >>> - kvm_release_pfn_clean(pfn); >>> + if (pfnpg.page) >>> + put_page(pfnpg.page); >>> return r; >>> } >> >> How about >> >> kvm_release_pfn_page_clean(pfnpg); > > I'm not sure. I always found kvm_release_pfn_clean() ugly, because it > doesn't mark the page 'clean'. I find put_page() more correct. > > Something like 'kvm_put_pfn_page()' would make more sense, but I'm so > bad at naming things that I could just as well call it 'bob()'. The best way to go would be to get rid of kvm_release_pfn_clean() and always go through a pfn_page. Then we could or could not introduce wrappers kvm_put_pfn_page{,_dirty}. I think for now it's best to limit the churn since these patches will go in the stable releases too, and clean up the resulting API once we have a clear idea of how all architectures are using kvm_pfn_page. Paolo _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Date: Thu, 24 Jun 2021 10:17:31 +0000 Subject: Re: [PATCH 3/6] KVM: x86/mmu: avoid struct page in MMU Message-Id: <0b7f9c30-eb12-35c5-191f-0e8e469e1b88@redhat.com> List-Id: References: <20210624035749.4054934-1-stevensd@google.com> <20210624035749.4054934-4-stevensd@google.com> <1624524744.2sr7o7ix86.astroid@bobo.none> <87mtrfinks.wl-maz@kernel.org> In-Reply-To: <87mtrfinks.wl-maz@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Marc Zyngier , Nicholas Piggin Cc: Aleksandar Markovic , Huacai Chen , Paul Mackerras , David Stevens , Zhenyu Wang , Zhi Wang , Alexandru Elisei , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, James Morse , Jim Mattson , Joerg Roedel , kvmarm@lists.cs.columbia.edu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Sean Christopherson , Suzuki K Poulose , Vitaly Kuznetsov , Wanpeng Li , Will Deacon On 24/06/21 12:06, Marc Zyngier wrote: > On Thu, 24 Jun 2021 09:58:00 +0100, > Nicholas Piggin wrote: >> >> Excerpts from David Stevens's message of June 24, 2021 1:57 pm: >>> From: David Stevens >>> out_unlock: >>> if (is_tdp_mmu_root(vcpu->kvm, vcpu->arch.mmu->root_hpa)) >>> read_unlock(&vcpu->kvm->mmu_lock); >>> else >>> write_unlock(&vcpu->kvm->mmu_lock); >>> - kvm_release_pfn_clean(pfn); >>> + if (pfnpg.page) >>> + put_page(pfnpg.page); >>> return r; >>> } >> >> How about >> >> kvm_release_pfn_page_clean(pfnpg); > > I'm not sure. I always found kvm_release_pfn_clean() ugly, because it > doesn't mark the page 'clean'. I find put_page() more correct. > > Something like 'kvm_put_pfn_page()' would make more sense, but I'm so > bad at naming things that I could just as well call it 'bob()'. The best way to go would be to get rid of kvm_release_pfn_clean() and always go through a pfn_page. Then we could or could not introduce wrappers kvm_put_pfn_page{,_dirty}. I think for now it's best to limit the churn since these patches will go in the stable releases too, and clean up the resulting API once we have a clear idea of how all architectures are using kvm_pfn_page. Paolo