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 103E4C433EF for ; Wed, 5 Jan 2022 19:21:18 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SwHdqYlhMi8mWUH7ERFMw5EZPa4SEhVoUigG5z/H8p4=; b=Xh2Jj78na/8Mas BI8/QrIF/kgWaoue+Qk5Bkv2qOYEzy2b+eicOvHhgaGxnb9kJNzO4HOL4ZE6r3Vd4pT3UJ7v49iBC fiLd9EJafWD7si/K5PZvovRqZGEVAogiFzwH5n0e3eo0oenJW4bWhD84wnTqUWM4q4QkH6qtn+OiD goz9OSORbIJgPssDUjlCdhy08X26oKg02dBe96k7xsPOe+N+dV6KQofn+MIndfGdWHRaaxnsjx2im R0JV3ozlbmaGhEnIDWI6NtxcGr6YgQd/iimvGQCKyK6ZFIkxZHGVneXWe0xqbGxXU09pF8au+ACcd uqnzkDOlIyLYG7gtBtpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5BpB-00FgB8-M2; Wed, 05 Jan 2022 19:19:53 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5Bp8-00FgAn-5C for linux-arm-kernel@lists.infradead.org; Wed, 05 Jan 2022 19:19:51 +0000 Received: by mail-pg1-x52e.google.com with SMTP id g22so93124pgn.1 for ; Wed, 05 Jan 2022 11:19:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=qoub34JKMYw80YSVF2J+hWLmoHzppRyhKwTIl4ud58A=; b=eJrm9vSQlYbjzA48SXuyQTX4vpv+0waa/m6b4+CGvv+TU/vaqalx+wW2nsSxEQ/9vt A1suumBCxyzaCyNgn32IdqREfwZqOk/nXRQaoAh5CC60NGExeXlyi31EGxNmYxTQEX4E sQifAS+vZypu+S3JY78d2kp/YnmHYIUm5hak6fwjzowpaKSAXq5lBDIqAjzDrUlgI6lA KZYptrb10ts7MYcBXTd91Zphk5IkT12dQBvNVkTmAySlUziWKC75l3HxKYPl617awyGC o8+l5yF/ne1DrgpDW61L5Cb9yCX34IVOYNXYh6PnfvMZk7x3F7tG0p/lLsdCZ42dXxXJ EFLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=qoub34JKMYw80YSVF2J+hWLmoHzppRyhKwTIl4ud58A=; b=YQSD4VhXaaxn+k3qI68Q1k4Bj68YKxCoHTaThtMekSjkYz5tU5oZrWhqqM4Qw28CZ5 4j85wSRDCY5GIVVKJDx7lv263mmDgaxoKPk/v5xABcATDsxXGWYLkc/4FYdwknPmv9xa i1dQUBkshHeDRR/UK2mf7THsA+oMXJqQAg/oJuh+OO/8BIkJwpRoEGSL0VTt67muu+eC w4KUPbIz6oFc9nuiFbIn3I1euK3i4fMK9azvirVKK1/+Y70ADT82S+bc+E3wHbCf6uQV 5S8+jSFpcfTXq6TH4+kpuoKNF70m9Btm+1VluToQpYc5LSEJxRdz3ou+qBDqqyHH68Kx NaEA== X-Gm-Message-State: AOAM530nb+Lc/xOz84XxpKRP8zY4tcbGaMdwvQ6cWHlOzpM4FPcfhUww Fvbtyv24x1mAAc/xCEBxIWvQbg== X-Google-Smtp-Source: ABdhPJxye1sjvjOvj00utsHDdoqYNY5iCIYZuac2xNc6/XTpseq2jJOALu2rGleR4A8aeXodNqfdiQ== X-Received: by 2002:a63:1422:: with SMTP id u34mr49958790pgl.135.1641410389102; Wed, 05 Jan 2022 11:19:49 -0800 (PST) Received: from google.com (157.214.185.35.bc.googleusercontent.com. [35.185.214.157]) by smtp.gmail.com with ESMTPSA id a17sm3400933pjs.23.2022.01.05.11.19.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jan 2022 11:19:48 -0800 (PST) Date: Wed, 5 Jan 2022 19:19:45 +0000 From: Sean Christopherson To: David Stevens Cc: Marc Zyngier , Paolo Bonzini , James Morse , Alexandru Elisei , Suzuki K Poulose , Will Deacon , Wanpeng Li , Jim Mattson , Joerg Roedel , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v5 4/4] KVM: mmu: remove over-aggressive warnings Message-ID: References: <20211129034317.2964790-1-stevensd@google.com> <20211129034317.2964790-5-stevensd@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220105_111950_242055_1E1D52F1 X-CRM114-Status: GOOD ( 13.17 ) 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 Wed, Jan 05, 2022, Sean Christopherson wrote: > Ah, I got royally confused by ensure_pfn_ref()'s comment > > * Certain IO or PFNMAP mappings can be backed with valid > * struct pages, but be allocated without refcounting e.g., > * tail pages of non-compound higher order allocations, which > * would then underflow the refcount when the caller does the > * required put_page. Don't allow those pages here. > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > that doesn't apply here because kvm_faultin_pfn() uses the low level > __gfn_to_pfn_page_memslot(). On fifth thought, I think this is wrong and doomed to fail. By mapping these pages into the guest, KVM is effectively saying it supports these pages. But if the guest uses the corresponding gfns for an action that requires KVM to access the page, e.g. via kvm_vcpu_map(), ensure_pfn_ref() will reject the access and all sorts of bad things will happen to the guest. So, why not fully reject these types of pages? If someone is relying on KVM to support these types of pages, then we'll fail fast and get a bug report letting us know we need to properly support these types of pages. And if not, then we reduce KVM's complexity and I get to keep my precious WARN :-) _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel