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=-10.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 349ECC49EA6 for ; Thu, 24 Jun 2021 15:37:15 +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 0240A613DA for ; Thu, 24 Jun 2021 15:37:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0240A613DA 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:Subject: From:References:Cc:To:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mJnmn6Ij2U6h1p/HuvNEgSzjjEDhSpBD9fgXDk8fnVU=; b=HYUWqHW2d4erREHJK/VaQnOMaO YGbUdG2HfS4LDhicxYeMroBjT89cGR4OLK3L5/lRx0dJdVeiXwNMFJiGJ8i5+K79p635bkAlqePL9 E5Mv+Inz8+Dqmp4khnF6SyXIGLedeYccKw4k39HXe9X7zsG03nz/NNbmBfAP/u1sNVAn0QQlTZEML KJk4DlJg4SHNpE3XejWWw2v+Z3gqSuQeFLvVvD0xT6vgEQcjlwn45vYfjFLeBXfk55TUDSUW6u3Tr H8FHY5yzp3XnbMBY+YxRrk5EpDwhgY4fVz+CS7aQjegDRFjOmL6VsOjpJByujvH54C6neipRM1Nvq ncAPy+1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwROD-00FGst-4a; Thu, 24 Jun 2021 15:35:37 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwRO9-00FGr9-0E for linux-arm-kernel@lists.infradead.org; Thu, 24 Jun 2021 15:35:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624548931; 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=f6k4ykVaPXFxqKCeveqsqgjZTsHJh+2Hx0FU9Hu8Shk=; b=ZBx2tblYKfmR4+9rG4NOwghzYxEOd7Mmx5Gn0vYSog7hKciWxWX4+Pdl6FZR1XLdZPc2pO MW7CiIwm6uEl/1E/Q9j53Du43FZmbal+Xi4KZCJAIE1hSQ1DFwIHgnXIXWc3YZ9vgMErJq wu2hpoiNvzSUm94KYiwFUKDyPBSRb5U= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-453-lck1iR4SPPKZugWRwQcnbQ-1; Thu, 24 Jun 2021 11:35:29 -0400 X-MC-Unique: lck1iR4SPPKZugWRwQcnbQ-1 Received: by mail-wr1-f70.google.com with SMTP id u16-20020a5d51500000b029011a6a17cf62so2315326wrt.13 for ; Thu, 24 Jun 2021 08:35:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=f6k4ykVaPXFxqKCeveqsqgjZTsHJh+2Hx0FU9Hu8Shk=; b=W0RRR5VU9pGnJ9p1jhctKvxbK/i5NyncEKxBzjBo1YGd4M28zc6QoM3RlnaSRA3acV hnHvHlGqjJzVvjrePkPsgfViM6t0OrpnC7j33dCcDtlMpBPPEIvk7DkhjlqzbAz7aQ5Q Xysi3CA3U1vTZ7bs0hfeDm79H4Gid3ymvPKTXUL8x1omJWVtiR/EasEjnvyLmqOxMtp5 XKjlezhH1rkfMgZKoBV7iOjbkYPzBsQigW3b1jZi6+6OaBqU8t0lyzIAuJ2xQe0wf9LU mxUwTXjsLuX/RZRnGqMo/B1RRMVjeUyafDlZSh1bY0RfqDJ0oD5oPcezJIYf8zgvCZKm L3tA== X-Gm-Message-State: AOAM531u5hLjhfmI5Ntmme8iS54Hx46Epn3ECWVAfhneqiXiIJzpZS92 fjSIEIc0CCpMXfEhVO3ASrYTTNPF1ohYUmHMOuO1xOaZgORrABQPthwd7MOHs7987RVLAPDUFmO hRSf62OOrPgO+aI+7nWhYOV0T5f/nvfTWAEk= X-Received: by 2002:a05:6000:1251:: with SMTP id j17mr5373888wrx.122.1624548927956; Thu, 24 Jun 2021 08:35:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwBnDqu4vf3bAIylFJkD7JiEEmgRW9T3VoP4swdNx5pmdzHboAZtCJNJi7bVPTY8V2i+hs/AQ== X-Received: by 2002:a05:6000:1251:: with SMTP id j17mr5373864wrx.122.1624548927675; Thu, 24 Jun 2021 08:35:27 -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 v18sm4013288wrv.24.2021.06.24.08.35.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 08:35:27 -0700 (PDT) To: Nicholas Piggin , Aleksandar Markovic , Huacai Chen , Marc Zyngier , Paul Mackerras , David Stevens , Zhenyu Wang , Zhi Wang Cc: 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 , David Stevens , Suzuki K Poulose , Vitaly Kuznetsov , Wanpeng Li , Will Deacon References: <20210624035749.4054934-1-stevensd@google.com> <1624530624.8jff1f4u11.astroid@bobo.none> <1624534759.nj0ylor2eh.astroid@bobo.none> <0d3a699a-15eb-9f1b-0735-79d14736f38c@redhat.com> <1624539354.6zggpdrdbw.astroid@bobo.none> From: Paolo Bonzini Subject: Re: [PATCH 0/6] KVM: Remove uses of struct page from x86 and arm64 MMU Message-ID: <81d99029-ec40-19c5-5647-20607d78dab0@redhat.com> Date: Thu, 24 Jun 2021 17:35:25 +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: <1624539354.6zggpdrdbw.astroid@bobo.none> 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_083533_170993_1155CAAC X-CRM114-Status: GOOD ( 15.04 ) 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 14:57, Nicholas Piggin wrote: > KVM: Fix page ref underflow for regions with valid but non-refcounted pages It doesn't really fix the underflow, it disallows mapping them in the first place. Since in principle things can break, I'd rather be explicit, so let's go with "KVM: do not allow mapping valid but non-reference-counted pages". > It's possible to create a region which maps valid but non-refcounted > pages (e.g., tail pages of non-compound higher order allocations). These > host pages can then be returned by gfn_to_page, gfn_to_pfn, etc., family > of APIs, which take a reference to the page, which takes it from 0 to 1. > When the reference is dropped, this will free the page incorrectly. > > Fix this by only taking a reference on the page if it was non-zero, s/on the page/on valid pages/ (makes clear that invalid pages are fine without refcounting). Thank you *so* much, I'm awful at Linux mm. Paolo > which indicates it is participating in normal refcounting (and can be > released with put_page). > > Signed-off-by: Nicholas Piggin _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel