Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp512793ybm; Fri, 29 May 2020 05:49:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvHPdYj8U1jJowyC0r7JnSgYon2aM4tVdWAhfst2nrTOnvPv6h1KtPVLVi2F2r3dGsp+a3 X-Received: by 2002:aa7:cb8f:: with SMTP id r15mr8536352edt.120.1590756583493; Fri, 29 May 2020 05:49:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590756583; cv=none; d=google.com; s=arc-20160816; b=kPp0cJawtlSy1kNjTk3oio7cIMnGTJQWAmJNylZII+l066H1wdQH154bD0TQzuI6gU 7TzZ8JFqGNwn+Sh3FOnQIWcqxql/6EbvHnzxlIkB5t80wrhsZT1ARVifJe+4mEUpq6WN xreFz1AckY+e5zavFzPx2giHVeQmSirzWro/NpzjfFtcHOiXMFZzMyITWgWvy7By1BQ6 kldXp3d94AQZi41MZuiJ8KG+8VvQNvNKGbjHPAXxYAmygEk6l1VLopp3Hyn1TgNsvrO6 KnQGHg/ImCiCZjaSFCzcfNNO/d4qdt1nvc6aZJ6/zk7m2GIUinocKQoRekuZ4CKwsO6W UsOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hWDpNSmqqL4jiVuIX8+MfcVSYKD0Sr0CkGGlOnTksS8=; b=jrzx1TwlkgS5DhIK4jg3f4ySU8cWiMAOKR+GW4gCcWY/bdR6u4c5SiZLLvNeoQya/C PTmEdI5YSkT/P0aLFikBSnHuMgYp4t5xFKrpVcdD9kmLH3u881MaJtODfK3U0J0Q3tpD QMwlwFSKqOGOaZg+psPY9XYukbxHRqe7oLupsENJ+6R5TfgrfzOpLb/qZZ/p6Gp4fBz5 00MwKBmSXsPGSFnYOzD6P53sbVVWR7NHaxA53qCnpPmktovcaKn44Yn2ZVtLoL5T1FQt g/Ud3aJUb5enjHzqEGtRx5NpYiSK17v7jDNqpbI71R+Fd73eweph0oj6f2qqNgKXJimy iptw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Mw3cOcpw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p12si6213871ejo.592.2020.05.29.05.49.20; Fri, 29 May 2020 05:49:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Mw3cOcpw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726907AbgE2Mpb (ORCPT + 99 others); Fri, 29 May 2020 08:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbgE2Mpa (ORCPT ); Fri, 29 May 2020 08:45:30 -0400 Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA9D5C03E969; Fri, 29 May 2020 05:45:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=hWDpNSmqqL4jiVuIX8+MfcVSYKD0Sr0CkGGlOnTksS8=; b=Mw3cOcpwT75KMypA7DbQN76n3K LmIujEvwcjqz8mB4DIQNPRDiJKYUham8VvC6rSnD6+3ba6I3VkRz3MaFsFNabdvTOT2j5AatU+Z7I o2P6if4RDFm1y5wwdk2idNMSaFbHSv9nUDIt/4zeeljrafN3UYBqYE+KqfQCvuFK6OcWyAc+raczK RK1oGDElglttDYT91kX4m02qQyIV6yN6hy+hALyRQRMTpe79Bv+Xx23bujAFJtHO/oMRx35Hz3zuD lD4co5ouUY7qPRY4OdLY/2HO+5AIT+8BT8rZU73mdGN5IlVfIzk0ihyFqydTRs7blGIxekQ3JxAc7 R7D+WZjw==; Received: from hch by bombadil.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jeeO3-00062M-2L; Fri, 29 May 2020 12:45:23 +0000 Date: Fri, 29 May 2020 05:45:23 -0700 From: Christoph Hellwig To: Logan Gunthorpe Cc: Tom Murphy , iommu@lists.linux-foundation.org, kvm@vger.kernel.org, David Airlie , dri-devel@lists.freedesktop.org, Bjorn Andersson , Matthias Brugger , Julien Grall , Thierry Reding , Will Deacon , Jean-Philippe Brucker , linux-samsung-soc@vger.kernel.org, Marc Zyngier , Krzysztof Kozlowski , Jonathan Hunter , linux-rockchip@lists.infradead.org, Andy Gross , Gerald Schaefer , linux-s390@vger.kernel.org, linux-arm-msm@vger.kernel.org, intel-gfx@lists.freedesktop.org, Alex Williamson , linux-mediatek@lists.infradead.org, Rodrigo Vivi , linux-tegra@vger.kernel.org, Thomas Gleixner , virtualization@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, Robin Murphy , Cornelia Huck , linux-kernel@vger.kernel.org, Kukjin Kim , David Woodhouse , Marek Szyprowski , Jani Nikula , Joonas Lahtinen Subject: Re: [PATCH 0/8] Convert the intel iommu driver to the dma-iommu api Message-ID: <20200529124523.GA11817@infradead.org> References: <20191221150402.13868-1-murphyt7@tcd.ie> <465815ae-9292-f37a-59b9-03949cb68460@deltatee.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <465815ae-9292-f37a-59b9-03949cb68460@deltatee.com> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 28, 2020 at 06:00:44PM -0600, Logan Gunthorpe wrote: > > This issue is most likely in the i915 driver and is most likely caused by the driver not respecting the return value of the dma_map_ops::map_sg function. You can see the driver ignoring the return value here: > > https://github.com/torvalds/linux/blob/7e0165b2f1a912a06e381e91f0f4e495f4ac3736/drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c#L51 > > > > Previously this didn’t cause issues because the intel map_sg always returned the same number of elements as the input scatter gather list but with the change to this dma-iommu api this is no longer the case. I wasn’t able to track the bug down to a specific line of code unfortunately. Mark did a big audit into the map_sg API abuse and initially had some i915 patches, but then gave up on them with this comment: "The biggest TODO is DRM/i915 driver and I don't feel brave enough to fix it fully. The driver creatively uses sg_table->orig_nents to store the size of the allocate scatterlist and ignores the number of the entries returned by dma_map_sg function. In this patchset I only fixed the sg_table objects exported by dmabuf related functions. I hope that I didn't break anything there." it would be really nice if the i915 maintainers could help with sorting that API abuse out.