Message ID | 20241010182427.1434605-58-seanjc@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org> 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 9C4D7CFC5FE for <linux-arm-kernel@archiver.kernel.org>; Thu, 10 Oct 2024 19:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Reply-To:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To: From:Subject:Message-ID:References:Mime-Version:In-Reply-To:Date: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9PLNR7J7/StxhsadOj2FvapRbIqIfrDfQ6nFmhEUvk8=; b=PttS/3pYo5/p+36rC10DaRBBqx ESnF39wE6BDWuWX+5RoZMxNoNzpMYsMqWpbta4uVK9ILaGoKitKnL1WxKNmvgbPxr/6R8iusq+gNv jraJnQE99oLgBTJBk9jmULlicQYrFX83OgvqHUXMeS98edLAvsP3d203R0JP/3+XYdcy9MlVMx+dp acai9vijyzLtuLrxKJ+BS5IlGSHnmmnbjn0hDQ6cTAXd55Kh8UBTf8iBsbDqlyEnSzKoQMv8Pwc8V huLkOEQfEye84suUxd4LlQ00e91SUAV9ftXxOUyLH1sQ68WXZhHo+6jxesFF6jtSQpFljEUxwsB3k tQtVvppA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syypz-0000000E6kX-3Ttq; Thu, 10 Oct 2024 19:28:39 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syxsF-0000000DrDY-3LSa for linux-arm-kernel@lists.infradead.org; Thu, 10 Oct 2024 18:26:58 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-6e2e4874925so21257117b3.1 for <linux-arm-kernel@lists.infradead.org>; Thu, 10 Oct 2024 11:26:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1728584814; x=1729189614; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=9PLNR7J7/StxhsadOj2FvapRbIqIfrDfQ6nFmhEUvk8=; b=oxXZstpB7bZForNibrdtUdgMDhKCKO5NoyWz/FZhmXi1O/5zBMkdNGoOBmZUnuHPL5 G5xj1yNE8SP9DIK/5R+FSLX1z3xFvSK7JT9CV/kxO/TU+0fFWjpeJqmMwLlYFO0Q+Tv4 I858qQIY6Wc0qtONrNlC8gbObQgUKRGiuFgn7O1Kkb3dzs2Qp7EmMuvNXtmlilk77dG6 00Dp5QMLKTvno0LnGfKXj09dJixXH9wsYC90KdPrw/8w/aMV7XGhbAVdXGuP5cSdmKEJ /2emmDAUPw3bLmVyf1eaRDVyfGHUrBZvZno+DFT7U8iIof4e8MNFX2e2pMznO8WrlsKE bLEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728584814; x=1729189614; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9PLNR7J7/StxhsadOj2FvapRbIqIfrDfQ6nFmhEUvk8=; b=xRNs+Aw4qNshcxWU5/RTmjvs8AD0sgoL1GXOyPrT3ORtfp2kDOuTknRo5NURriSt82 lcHc5m7N3C7kb2YWW8DPVQuBzROZq3tLhBKrZdPNJuHF+5bztfHeJd8cW7EVNQzdqnFg edh/1JvO371brqwgIKv+w3l2E/0UlbZNcEs370kPvw3/LW7gFZ4zR3T27qroGhWzbKp4 kiLMoZ3rVoCjA8Iz19cD35SCePjAlFJcPqEZOTqfELFGtue0jPbpcoXdtfdk0UC68+h2 K205oVzFcLeHLwkp+FxclAjT0u928mVUvWuEyPhJtFv5jL9lLYl2/xgMgy560s8QS2cB ctmQ== X-Forwarded-Encrypted: i=1; AJvYcCUHGdLcBGI7YCINb1GXgzM9eMT0M2Ho3CqsBhLMpoLll0WtWirkJfRZaRmqAUjC+12Nsp+7DJ9SI3KEdJCEYR38@lists.infradead.org X-Gm-Message-State: AOJu0YyIEdCSgfdUUQk1HXQDAxoU2LwTYqiVxsKPuEa94HhjSXN5iflL vgV+PvCOvch5Q5Hr1uOdZ8KaXgTfT9EUm5gsAWHYXZ9O506XKkpTvuG0e6CW0aDYTtJ3WlMp2FY N/g== X-Google-Smtp-Source: AGHT+IFTz5/NgoL1lG2XSkf5pquU6CJl4M8l3x57mh4U7FbzzS84rW+oHIk+OXb87gKu92fZB4cgNqwOitE= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:9d:3983:ac13:c240]) (user=seanjc job=sendgmr) by 2002:a05:690c:46c3:b0:6e3:21cf:a67f with SMTP id 00721157ae682-6e32242fb5emr1006557b3.7.1728584814138; Thu, 10 Oct 2024 11:26:54 -0700 (PDT) Date: Thu, 10 Oct 2024 11:23:59 -0700 In-Reply-To: <20241010182427.1434605-1-seanjc@google.com> Mime-Version: 1.0 References: <20241010182427.1434605-1-seanjc@google.com> X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <20241010182427.1434605-58-seanjc@google.com> Subject: [PATCH v13 57/85] KVM: RISC-V: Mark "struct page" pfns dirty iff a stage-2 PTE is installed From: Sean Christopherson <seanjc@google.com> To: Paolo Bonzini <pbonzini@redhat.com>, Marc Zyngier <maz@kernel.org>, Oliver Upton <oliver.upton@linux.dev>, Tianrui Zhao <zhaotianrui@loongson.cn>, Bibo Mao <maobibo@loongson.cn>, Huacai Chen <chenhuacai@kernel.org>, Michael Ellerman <mpe@ellerman.id.au>, Anup Patel <anup@brainfault.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Christian Borntraeger <borntraeger@linux.ibm.com>, Janosch Frank <frankja@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com>, Sean Christopherson <seanjc@google.com> Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, " =?utf-8?q?Alex_Benn=C3=A9e?= " <alex.bennee@linaro.org>, Yan Zhao <yan.y.zhao@intel.com>, David Matlack <dmatlack@google.com>, David Stevens <stevensd@chromium.org>, Andrew Jones <ajones@ventanamicro.com> Content-Type: text/plain; charset="UTF-8" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241010_112655_909064_6B8BA079 X-CRM114-Status: GOOD ( 11.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Reply-To: Sean Christopherson <seanjc@google.com> Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
KVM: Stop grabbing references to PFNMAP'd pages
|
expand
|
diff --git a/arch/riscv/kvm/mmu.c b/arch/riscv/kvm/mmu.c index b63650f9b966..06aa5a0d056d 100644 --- a/arch/riscv/kvm/mmu.c +++ b/arch/riscv/kvm/mmu.c @@ -669,7 +669,6 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu, goto out_unlock; if (writable) { - kvm_set_pfn_dirty(hfn); mark_page_dirty(kvm, gfn); ret = gstage_map_page(kvm, pcache, gpa, hfn << PAGE_SHIFT, vma_pagesize, false, true); @@ -682,6 +681,9 @@ int kvm_riscv_gstage_map(struct kvm_vcpu *vcpu, kvm_err("Failed to map in G-stage\n"); out_unlock: + if ((!ret || ret == -EEXIST) && writable) + kvm_set_pfn_dirty(hfn); + spin_unlock(&kvm->mmu_lock); kvm_set_pfn_accessed(hfn); kvm_release_pfn_clean(hfn);