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 92FF1C433EF for ; Thu, 6 Jan 2022 02:44:44 +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:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eD/5HSnh70do1OgA74HFZlpYP7y54ma7EELawW6VWSw=; b=IZvwf1AT+N2+DC ZJA8obyM2mHZhCRvZXPPEezgAztl1l1+e/cdTf8apMCufn5hoE4Dkt+RQ+AOsM2ZLP1ynHOwNhzub BqfxHRDP/P9XC1A8GZSH8xyWHc5CBJjR4eQTbE9cg4QTWzuN+8P9DzJu1xUL6J1YnF6cGr7uAFEqF B3TdKc5FbMuO4RFJqMDLMjcgcGQTaUkpCHjaoX/oXtPHsjeMgYTPLARZE+G6ijFJf/AMxGCfVZEaq a+28Ce5X3gRSjKN2GBjMSQaA4lcmah/MF63JPlniKAkWPAPnCqpY9eTPdC2Hv1yqjXvGuPwBUTvxW P9aQRnPHvn3bgQ14XPVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5Ijx-00GFSA-MT; Thu, 06 Jan 2022 02:42:57 +0000 Received: from mail-yb1-xb33.google.com ([2607:f8b0:4864:20::b33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n5Iju-00GFRZ-Go for linux-arm-kernel@lists.infradead.org; Thu, 06 Jan 2022 02:42:56 +0000 Received: by mail-yb1-xb33.google.com with SMTP id i3so3339833ybh.11 for ; Wed, 05 Jan 2022 18:42:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VUrh3Npgeap/8EiEtwRjncA+1oSJVR1QQxVGHBNvM04=; b=f6EQYO79bUXprc7mhn+5kkGk7QaNhdm6TSnLti6itS7mqSCQT6sQjiGOBku7WoX188 vPdqu9VcHqayR/unWn8Q1ICELVnmKRotk6JQfhShEKTlwYXcQmP7i4wWQTx3chDRDI7A 4kBgcl+GK+bigbshUapujhp4+UlbLV1/GOkiY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VUrh3Npgeap/8EiEtwRjncA+1oSJVR1QQxVGHBNvM04=; b=3lQjrjvGe3q1RO6jqhx8PB81s5nxg2q0HBcnQ71p9tIxoSVJKkJWeXT52BCNHfNVfA mZbRVLAmvJqvNHpNIvZ3+PUQF9iOeP+2Bf2qjaaRAyN9c0ZcCFoJcKZTESJmjdGYiAYq G/I14q6SuJbjWn9Q5wxixRWFJB0figlBkG5sAxj/QezySPFvmWz0PvqfNE0xRplmEERW KFc/Ce6aqNCpTMZTqiHb4w6j/cuZoND68DiApDg0GKQbxJv9TUgF1kIwjB6Ejtay0Smw fv9yqmHbxPuMn43ty1Hoy73YcrVurhqaJLtpOThInFDoy8ADEkeWRTlgD+d60uZhsks8 bbYw== X-Gm-Message-State: AOAM530MaQ1lxH2HPy47d8tGe3qlfnOtxlbpedvOcRbintD+FtL2DcU/ DXBLacoT+5ECLUgC2VKwDiB20ESpjKDt046lG7nW8w== X-Google-Smtp-Source: ABdhPJySN8UQBiLK5ZELedz9aMDOihftjIfvLaugncGmaT2wHj67/GId/mm7KBCgharYeRmCbxfpR9IivB+Tgad8EI0= X-Received: by 2002:a25:5ca:: with SMTP id 193mr64959101ybf.406.1641436971074; Wed, 05 Jan 2022 18:42:51 -0800 (PST) MIME-Version: 1.0 References: <20211129034317.2964790-1-stevensd@google.com> <20211129034317.2964790-5-stevensd@google.com> In-Reply-To: From: David Stevens Date: Thu, 6 Jan 2022 11:42:39 +0900 Message-ID: Subject: Re: [PATCH v5 4/4] KVM: mmu: remove over-aggressive warnings To: Sean Christopherson 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, Chia-I Wu X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220105_184254_605567_E2F4D351 X-CRM114-Status: GOOD ( 17.84 ) 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, Jan 6, 2022 at 4:19 AM Sean Christopherson wrote: > > 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 :-) Our current use case here is virtio-gpu blob resources [1]. Blob resources are useful because they avoid a guest shadow buffer and the associated memcpys, and as I understand it they are also required for virtualized vulkan. One type of blob resources requires mapping dma-bufs allocated by the host directly into the guest. This works on Intel platforms and the ARM platforms I've tested. However, the amdgpu driver sometimes allocates higher order, non-compound pages via ttm_pool_alloc_page. These are the type of pages which KVM is currently rejecting. Is this something that KVM can support? +olv, who has done some of the blob resource work. [1] https://patchwork.kernel.org/project/dri-devel/cover/20200814024000.2485-1-gurchetansingh@chromium.org/ -David _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel