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 6BBEDC7EE2A for ; Mon, 22 May 2023 21:55:32 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=N8bouwkp9LzIuBRnOGdo598SWa7YHHb9bWoA0JNBPIo=; b=CIrg+9i1f5a2LFcNRcVR7hhH3O kSDz69jzLCwYPqgcidhPQ2sJx04ph0IIgeDuWe7h74hk6gZ82fe05Qz+dYlOd/HxhQtas9tF7l2uK zldRKL5PeuB7Ywq8wvqg6N/8Pl+zk5vSZ/EJiGikK5p3Omov2y/sa3BogKvMgTaYMO4DFnpn0VCoX hOxsf3jjAWYwWUIl2dXY4ZTx6Yx+kItVW/1nKFVTe3ZBAHMbP2tiMeGbyIoI5ARVJ9EYXd6GP13jA o5H4TH1lkbVPErBmfk0aKmq/gJNXxRDrP4UrVQLMK8PMOUQ+DIUNQFzYNcGE1DGam3ClxAQ4SPjFn W9OvaI7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1DUl-0089mt-0u; Mon, 22 May 2023 21:55:11 +0000 Received: from mail-pg1-x549.google.com ([2607:f8b0:4864:20::549]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1DUj-0089lp-0m for linux-arm-kernel@lists.infradead.org; Mon, 22 May 2023 21:55:10 +0000 Received: by mail-pg1-x549.google.com with SMTP id 41be03b00d2f7-51b7810ec2cso3520194a12.1 for ; Mon, 22 May 2023 14:55:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1684792507; x=1687384507; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=lsrdrfpStLHLCMcnUFm2bSNiOQJ8DFjC7VWw2vxFB9U=; b=3tTDxTYNGWf9angAoyiEj35tUIWKL6KNh6Tt+rSkge5LajeXEwtweh7tj3xiQTSc38 iv+rkHwLQur/ja0cpDHOZ4HdUpKv1e4ZFNi5BLvyQGW8LXWLxpL0CZ76idAI0vUmIqfO zT1xmizSSaeQnl+nfygCxJLtB7GZ92jHfMSG05m8baSg+6EE8g/xWSFsfAwCfx6dWvIj am6E5D7S3pKxpYKnVaUdxfqmZpzjbAdBttvgQ7IVHZAgClLc2YYIGCNLIGKSUvOX1Asp HZOlJXIqNRWXxIlTOczhsApaxyJJGELiCb7nAWOj/62KnAYg8rOLdWg8YxcGxQ9FlmC0 rc2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684792507; x=1687384507; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lsrdrfpStLHLCMcnUFm2bSNiOQJ8DFjC7VWw2vxFB9U=; b=copDtEdfCeDrhvPA2K62ZaN7Z/s/saIpSdOJsq8uQNDHalc+qbMqJZ9drPGp1OGbQm i1N8Oh9IyeqJUbJ+LAmfhUXcRyjbeCfJJ3NF7thHJXCI8c4Baj00mnqiqd6Gyg3k21N2 pVkju7OQptaVuFEq5ocqtGdgGoVawFQsPWq4SaEG+twZSv5z+yKRaVgirzxK5bgWntEV PkBwS+BQGQNmJ1HpO3AFgx8P9B4lsgC7KVbTP2nZ6plQTwCZ2VOjVDIF2yMQX9XAl9Qs /IvUbUuibcxlsFBLpjImtlYCvKHR6wN6TIyNKZ52+NWKiG6lk1niV6Egqq54xIMPzcBA x/Mg== X-Gm-Message-State: AC+VfDyKFPAM/4VeT38BGJW6VLSjWi34FO9DEg5CaFekRqRw9nf4zBWb 2krR/S1CqYKEGxpQPQMywyTDPLulQH4= X-Google-Smtp-Source: ACHHUZ4stFl0yANjF7GxRhiw9rEdZkfyfXAEA1DldggtFR98FAXWGyVwNlCjxcqGuUvDiNyJ5Ejy3a3pwtY= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:903:22c4:b0:1ac:4e96:cd22 with SMTP id y4-20020a17090322c400b001ac4e96cd22mr2951472plg.5.1684792506826; Mon, 22 May 2023 14:55:06 -0700 (PDT) Date: Mon, 22 May 2023 14:55:05 -0700 In-Reply-To: <20230330085802.2414466-5-stevensd@google.com> Mime-Version: 1.0 References: <20230330085802.2414466-1-stevensd@google.com> <20230330085802.2414466-5-stevensd@google.com> Message-ID: Subject: Re: [PATCH v6 4/4] KVM: mmu: remove over-aggressive warnings From: Sean Christopherson To: David Stevens Cc: Marc Zyngier , Oliver Upton , Paolo Bonzini , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230522_145509_323749_D9B60B27 X-CRM114-Status: GOOD ( 15.19 ) 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 On Thu, Mar 30, 2023, David Stevens wrote: > 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. This patch needs to be moved earlier, e.g. if just this patch is reverted, these WARNs will fire on a guest with non-refcounted memory. The shortlog and changelog also need to be reworded. The shortlog in particular is misleading, as the the WARNs aren't overly agressive _in the current code base_, but rather are invalidated by KVM allowing non-refcounted struct page memory to be mapped into the guest. Lastly, as I mentioned in previous versions, I would like to keep the sanity check if possible. But this time, I have a concrete idea :-) When installing a SPTE that points at a refcounted page, set a flag stating as much. Then use the flag to assert that the page has an elevate refcount whenever KVM is operating on the page. It'll require some additional plumbing changes, e.g. to tell make_spte() that the pfn is refcounted, but the actual code should be straightforward. Actually, we should make that a requirement to allow an arch to get non-refcounted struct page memory: the arch must be able to keep track which pages are/aren't refcounted. That'll disallow your GPU use case with 32-bit x86 host kernels (we're out of software bits in PAE SPTEs), but I can't imaging anyone cares. Then I believe we can make that support mutually exclusive with kvm_pfn_to_refcounted_page(), because all of the kvm_follow_pfn() users will know (and remember) that the pfn is backed by a refcounted page. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel