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 45FD9C6FD1D for ; Thu, 30 Mar 2023 08:59:35 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HMtM61FFcgitX1kI7ZtlopSGKVtmthGIkay5vGwn2H4=; b=0dNpyaiFwc8bvD 83lYZNNpHJU2HCZOax4AYTtgk2PHBWhitrZg2dzXiEUASAlPvmLwSBHCfFWlUD/dK0UO95Aha9oqT q8QSpOf0yhV9h3OdBGwyoYV0+FgK8oN0aJZYKdHB/1FAyU/8KYEUnOeWOOE+6nhinSh1B8dgbRK/3 bR41b74938P+guU1mIKAz4N4We+IDgW1xaq6FuzAc4zq0+55Ed3PCuvBh8wOBFQGkQJ16jWEh+83o +BQIjSHNnuPIgi45OT8ScM1N39xWCC0WlDzWdHQrVH2U3kQxn0KR9VDL6gzokgNFKPoYfpsqCHMSa /birVvhMa2G9OrIqUrGQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pho7L-003Bdr-1S; Thu, 30 Mar 2023 08:58:47 +0000 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pho76-003BYY-03 for linux-arm-kernel@lists.infradead.org; Thu, 30 Mar 2023 08:58:33 +0000 Received: by mail-pl1-x633.google.com with SMTP id le6so17437071plb.12 for ; Thu, 30 Mar 2023 01:58:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1680166709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DARmMfXxqHb2Ls37OggPINW15nuQ84yCV7KESHjLY2s=; b=OXoX2NCxtPATlq8jnBH3sThb7ycsR+0Oe6TcPImZJi9tCnRpIHfnfMjFvh2OLeHSO7 M7F63PjkEBkJdxcACVhouJSazYLSPB0gy7jVYsu0xN+szgvXnNWoZ7Oh0kFFo4CWOLgC d+rHEFtEcJ4GCWJzO34ClqYb+5IULO9O4L5x8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680166709; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DARmMfXxqHb2Ls37OggPINW15nuQ84yCV7KESHjLY2s=; b=KLOwMwAMXjNReaPcQ829BJ0Q3L4hBgUHlZhumEjA24wcKM/dxWFWtb078vfcROhEkG DBYZ+AZuSTY034L9RMDWaL9qqGZiygVvoopwnVApTYpVrJRHP3YBBOvmr3uzV4ggCbSe LXN3duox3JYM44zzdhgfdp45GaVLSvplgfjOPxHHiRiz/QeY64wCJVRQ0NM0vUQCYxX4 xQG+bv95bS/CJ95F/QF75pKt9Szdu4NZDgwVEjhmER2anJvbKg2dIT1sL+PjATD08JJv I3SscoFFZh+dmw1OtMwtEMlg0Cwi6xG6/bUYJ+b6MzqZAMskcs3kLAQIv9swBxrCWcg0 fmCg== X-Gm-Message-State: AAQBX9egRTRtkf+YpmFNEDS178GDXeWNkHj8EHMnrRRadzQ4+GCCEvd2 wxDVxJOfHrQ1IbUDieg+P/zpTw== X-Google-Smtp-Source: AKy350YitOtGSTe/IC945dOZxknelnREFOYZr+go4eGipagCeEp7bTT+/hLXchLclFceYZl0IfvvWw== X-Received: by 2002:a17:902:fb85:b0:19e:b088:5900 with SMTP id lg5-20020a170902fb8500b0019eb0885900mr19155304plb.38.1680166709092; Thu, 30 Mar 2023 01:58:29 -0700 (PDT) Received: from localhost ([2401:fa00:8f:203:1320:eef8:d0bb:b161]) by smtp.gmail.com with UTF8SMTPSA id s5-20020a63e805000000b00502f1256674sm23134697pgh.41.2023.03.30.01.58.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Mar 2023 01:58:28 -0700 (PDT) From: David Stevens X-Google-Original-From: David Stevens To: Marc Zyngier , Sean Christopherson Cc: Oliver Upton , Paolo Bonzini , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, David Stevens Subject: [PATCH v6 4/4] KVM: mmu: remove over-aggressive warnings Date: Thu, 30 Mar 2023 17:58:02 +0900 Message-Id: <20230330085802.2414466-5-stevensd@google.com> X-Mailer: git-send-email 2.40.0.348.gf938b09366-goog In-Reply-To: <20230330085802.2414466-1-stevensd@google.com> References: <20230330085802.2414466-1-stevensd@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230330_015832_057529_5A1B6400 X-CRM114-Status: GOOD ( 17.12 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: David Stevens Remove two warnings that require ref counts for pages to be non-zero, as mapped pfns from follow_pfn may not have an initialized ref count. Signed-off-by: David Stevens --- arch/x86/kvm/mmu/mmu.c | 10 ---------- virt/kvm/kvm_main.c | 5 ++--- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 86b74e7bccfa..46b3d6c0ff27 100644 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -555,7 +555,6 @@ static u64 mmu_spte_clear_track_bits(struct kvm *kvm, u64 *sptep) kvm_pfn_t pfn; u64 old_spte = *sptep; int level = sptep_to_sp(sptep)->role.level; - struct page *page; if (!is_shadow_present_pte(old_spte) || !spte_has_volatile_bits(old_spte)) @@ -570,15 +569,6 @@ static u64 mmu_spte_clear_track_bits(struct kvm *kvm, u64 *sptep) pfn = spte_to_pfn(old_spte); - /* - * KVM doesn't hold a reference to any pages mapped into the guest, and - * instead uses the mmu_notifier to ensure that KVM unmaps any pages - * before they are reclaimed. Sanity check that, if the pfn is backed - * by a refcounted page, the refcount is elevated. - */ - page = kvm_pfn_to_refcounted_page(pfn); - WARN_ON(page && !page_count(page)); - if (is_accessed_spte(old_spte)) kvm_set_pfn_accessed(pfn); diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 007dd984eeea..a80070cb04d7 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -165,10 +165,9 @@ bool kvm_is_zone_device_page(struct page *page) /* * The metadata used by is_zone_device_page() to determine whether or * not a page is ZONE_DEVICE is guaranteed to be valid if and only if - * the device has been pinned, e.g. by get_user_pages(). WARN if the - * page_count() is zero to help detect bad usage of this helper. + * the device has been pinned, e.g. by get_user_pages(). */ - if (WARN_ON_ONCE(!page_count(page))) + if (!page_count(page)) return false; return is_zone_device_page(page); -- 2.40.0.348.gf938b09366-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel