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=-3.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 525A0C433DB for ; Thu, 21 Jan 2021 18:15:49 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 CC45C23A57 for ; Thu, 21 Jan 2021 18:15:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CC45C23A57 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject: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=7b8Cukp2jxKYEp8j54IVa+Lp0WNDLydTalSz2xE1vrg=; b=jp9Z+dqbCrq5J4hWup/fsQ1c/ Fzwh29KtJcH5eUWwXIvjKM+mtMn1ZJfPfwZO0agxKgCX6i0d0Z3yiCtDDVkL/nekd6nzQrdnzJ9O+ +djhtiYz3hXXy9e7bq9uYFGP8iRluaJKn4yDXrfad2Cgq+9mT2xJjiB7mUB0FLMu30FUQ/0RO2W9G SZq868axkpa+D9w9D934qP2YRgNo52BoRzfN/7Z2hHNKNLuSGuRYOlrRNV+nMDgciltKLqyRcKgdZ an8QKRzkgAyaR7bebmaALGuBdV4TzTvz8skz2/vOkGVICWFp7Q6aZ+nClfHl0gjIv/cREY71xpixy VyOvZb1sQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2eTS-0000hO-U5; Thu, 21 Jan 2021 18:14:26 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l2eTQ-0000gX-4A for linux-arm-kernel@lists.infradead.org; Thu, 21 Jan 2021 18:14:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611252863; 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=lEgMkUTOCJsoedIDEpBA2hjPtpKSlnIAkYz8Z2MMNg0=; b=HhV9sQ15u8xtMOCvc5f7XYyaKls4zmWZ3XnrKGBi8SLVsOj0ainwS2r11PbitDq/PEEzgD EE2r0OTfgQI7XSyaey4DEEolQZQK7q73EAJFV4O+cZdnE5kR1jFKNnNreppBZcyS+lSnkI 4BgDr7WmTT+vV4pVuOb0T52Anx48y6E= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-283-4sowHxENOA-jNF3X_XPxfw-1; Thu, 21 Jan 2021 13:14:19 -0500 X-MC-Unique: 4sowHxENOA-jNF3X_XPxfw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 87956107ACE3; Thu, 21 Jan 2021 18:14:16 +0000 (UTC) Received: from omen.home.shazbot.org (ovpn-112-255.phx2.redhat.com [10.3.112.255]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1251139A63; Thu, 21 Jan 2021 18:14:15 +0000 (UTC) Date: Thu, 21 Jan 2021 11:14:14 -0700 From: Alex Williamson To: Keqian Zhu Subject: Re: [PATCH v2 2/2] vfio/iommu_type1: Sanity check pfn_list when remove vfio_dma Message-ID: <20210121111414.143e3e4e@omen.home.shazbot.org> In-Reply-To: <32f8b347-587a-1a9a-bee8-569f09a03a15@huawei.com> References: <20210115092643.728-1-zhukeqian1@huawei.com> <20210115092643.728-3-zhukeqian1@huawei.com> <20210115121447.54c96857@omen.home.shazbot.org> <32f8b347-587a-1a9a-bee8-569f09a03a15@huawei.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210121_131424_194524_9CBF0AF9 X-CRM114-Status: GOOD ( 21.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , jiangkunkun@huawei.com, kvm@vger.kernel.org, Catalin Marinas , Kirti Wankhede , Will Deacon , kvmarm@lists.cs.columbia.edu, Marc Zyngier , Joerg Roedel , Daniel Lezcano , wanghaibin.wang@huawei.com, Julien Thierry , Suzuki K Poulose , Alexios Zavras , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Cornelia Huck , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, James Morse , Andrew Morton , Robin Murphy 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 Mon, 18 Jan 2021 21:16:08 +0800 Keqian Zhu wrote: > On 2021/1/16 3:14, Alex Williamson wrote: > > On Fri, 15 Jan 2021 17:26:43 +0800 > > Keqian Zhu wrote: > > > >> vfio_sanity_check_pfn_list() is used to check whether pfn_list of > >> vfio_dma is empty when remove the external domain, so it makes a > >> wrong assumption that only external domain will add pfn to dma pfn_list. > >> > >> Now we apply this check when remove a specific vfio_dma and extract > >> the notifier check just for external domain. > > > > The page pinning interface is gated by having a notifier registered for > > unmaps, therefore non-external domains would also need to register a > > notifier. There's currently no other way to add entries to the > > pfn_list. So if we allow pinning for such domains, then it's wrong to > > WARN_ON() when the notifier list is not-empty when removing an external > > domain. Long term we should probably extend page {un}pinning for the > > caller to pass their notifier to be validated against the notifier list > > rather than just allowing page pinning if *any* notifier is registered. > > Thanks, > I was misled by the code comments. So when the commit a54eb55045ae is > added, the only user of pin interface is mdev vendor driver, but now > we also allow iommu backed group to use this interface to constraint > dirty scope. Is vfio_iommu_unmap_unpin_all() a proper place to put > this WARN()? vfio_iommu_unmap_unpin_all() deals with removing vfio_dmas, it's logically unrelated to whether any driver is registered to receive unmap notifications. Thanks, Alex _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel