Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2200588ybb; Mon, 30 Mar 2020 01:19:02 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuhml3YNyYPdzEOfvtF1KU2bVodI/6xW2MfqtAs1K1WNw6u3zVBIYOcqw9jaBWRmpHshTdg X-Received: by 2002:a05:6820:346:: with SMTP id m6mr8774320ooe.22.1585556341483; Mon, 30 Mar 2020 01:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585556341; cv=none; d=google.com; s=arc-20160816; b=hNWINg6eOoCUWScs5HVT1ZIxh9XIcZOYsxx0IYi862yy3PqSXwDd3RJXPd6ZTUG0Nr EdGuXxTLb23UOssrA/nr12gMGIugChNEsubqsVO2G0Io7dms93zHg1CfP/fVdJe66Qde +6Ym7IdNmhKdOFvkCaDVKJpfZdJG9Y45465ubNsyAG3tToqJfCKZ1OTVNPIzk4SeKcmU /pkWwIwFHXxTfIWZEWdD06VRoKfakClfL41aWOA1QwR+zt3NXdb9eZLyTCcylbbESTU1 0x1P6ecWcHe7Ao5Z9TfjvOuvn3OrUyQr7MRFNG2zRPiOaOd7eJgWNie48krAZEORveG0 8OhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:cc:to:from:subject:dkim-signature:dkim-filter; bh=R4zKoePkE2jPIN9aq9DgHKaT2r9GlP1DFSynnnPQ5ME=; b=YlrAb9zz3BPZ4s3krIA5/oj7ilDi7RpSxvnPAhWFouEz7TQWyk/7DAtkZ9KC2jHEdp 7kvciW5WZ3HrVY8heJ2CSnVPlalIET7gxbzS5u3jCYsLpJha8fwjrLvx4cOY1i9lyHt3 LeNEIHZW0wusXEL0cgwuT7H6hT4zhdDBgn4qXH/Vm28wDP/vCG/tyXxF8SWZgI1CFEqT HiCSm29ThdtutJOcd6eW7xbTxE2ige6z/czfUb2lqldTLxoiq3R7ozPEcMW1sBvQdjPU gEoQhqRAOeY8LhPJ4tZ5j8xZLRX+vlOIJRQITiwYO7AUbYP2DjnIlNk1wfrMt452SeOx /u1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=NQLgoREV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e22si2547677otp.138.2020.03.30.01.18.47; Mon, 30 Mar 2020 01:19:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=NQLgoREV; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729639AbgC3IS2 (ORCPT + 99 others); Mon, 30 Mar 2020 04:18:28 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:49277 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729605AbgC3IS1 (ORCPT ); Mon, 30 Mar 2020 04:18:27 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200330081825euoutp02d4d68f118dafef06ffb6a6a8378e9da9~BBw8PhWUM1473914739euoutp027 for ; Mon, 30 Mar 2020 08:18:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200330081825euoutp02d4d68f118dafef06ffb6a6a8378e9da9~BBw8PhWUM1473914739euoutp027 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1585556305; bh=R4zKoePkE2jPIN9aq9DgHKaT2r9GlP1DFSynnnPQ5ME=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=NQLgoREVHeJ/WRu/QSmjIvPjhj+PHIY0kBrIa1p/OsSk32Ucho2rEKNC2jzqEJZiu E99MU1vTeA3Z69iVuzz57N4TVwz2G/Sq6P4mTeV3xW2BT/Gcsq6funCRBNJrF6ePpx rIG4KPlD1HI/xGZ8McmNedeS/qXQqd9DsKiNQ7Cs= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20200330081824eucas1p24db5a4b1a0e203b1eef2c353c93a2191~BBw768dP_0046300463eucas1p2z; Mon, 30 Mar 2020 08:18:24 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 59.DE.60698.05BA18E5; Mon, 30 Mar 2020 09:18:24 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200330081824eucas1p296ab0a861f799cf33aed0226869ac6fd~BBw7gAEJx0850008500eucas1p2-; Mon, 30 Mar 2020 08:18:24 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200330081824eusmtrp2e3bb561c7cfe7310445d73d502d0d31f~BBw7faMjc3035830358eusmtrp23; Mon, 30 Mar 2020 08:18:24 +0000 (GMT) X-AuditID: cbfec7f5-a0fff7000001ed1a-3d-5e81ab504239 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 77.62.08375.05BA18E5; Mon, 30 Mar 2020 09:18:24 +0100 (BST) Received: from [106.210.88.143] (unknown [106.210.88.143]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200330081823eusmtip18b39490b9c1a16667bebde8cd28cdae7~BBw6-6o8S1990419904eusmtip14; Mon, 30 Mar 2020 08:18:23 +0000 (GMT) Subject: Re: [v4,1/3] drm/prime: use dma length macro when mapping sg From: Marek Szyprowski To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Shane Francis , dri-devel@lists.freedesktop.org Cc: airlied@linux.ie, linux-kernel@vger.kernel.org, amd-gfx-request@lists.freedesktop.org, alexander.deucher@amd.com Message-ID: Date: Mon, 30 Mar 2020 10:18:21 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDKsWRmVeSWpSXmKPExsWy7djP87oBqxvjDFafUbXoPXeSyWLand2s Fuv+3WSxaNzZx2Tx9j6Qe+XrezaLy7vmsDmwe7Re+svmsXPWXXaP7d8esHrc7z7O5PF5k1wA axSXTUpqTmZZapG+XQJXxt+PR1gLJghWLHvQztTA2MTXxcjJISFgInHu2FW2LkYuDiGBFYwS 6z8tY4JwvjBKPLu7ih3C+cwo8X/FYSaYlm3vm6FaljNKrD0yiRnCec8oceb8OjaQKmEBV4md Ta2MIDabgKFE19susA4RgU5Gib71m1lAEswCZRKXns8BSnBw8ArYSTTsDgQJswioSvy6dAWs V1QgRuLi4X5WEJtXQFDi5MwnYK2cAvYS6+b3QI2Rl2jeOpsZwhaXuPVkPtgPEgLr2CV+b+yH OttF4u/V81C2sMSr41vYIWwZif87YRqaGSUenlvLDuH0MEpcbprBCFFlLXHn3C+wS5kFNCXW 79KHCDtKPLtykhkkLCHAJ3HjrSDEEXwSk7ZNhwrzSnS0CUFUq0nMOr4Obu3BC5eYJzAqzULy 2iwk78xC8s4shL0LGFlWMYqnl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IMW2Jo URp6Ne/edUMtuUV3Xbm0r39vcp71PJ/j6ZZppc/f2KSv/mR3Z9fJwFhXD4tGqbKtxjOOTbP5 +pe5bvX+hTsS9mSeKA9WXRtjqc5w7Kez6Yylhsm3Ntxy6nX+etbFNySi/G7+UZd+JZbijERD Leai4kQAmghP7tECAAA= X-CMS-MailID: 20200330081824eucas1p296ab0a861f799cf33aed0226869ac6fd X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200327075458eucas1p2f1011560c5d2d2a754d2394f56367ebb X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200327075458eucas1p2f1011560c5d2d2a754d2394f56367ebb References: <20200325090741.21957-2-bigbeeshane@gmail.com> <4aef60ff-d9e4-d3d0-1a28-8c2dc3b94271@samsung.com> <82df6735-1cf0-e31f-29cc-f7d07bdaf346@amd.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi On 2020-03-27 10:10, Marek Szyprowski wrote: > Hi Christian, > > On 2020-03-27 09:11, Christian König wrote: >> Am 27.03.20 um 08:54 schrieb Marek Szyprowski: >>> On 2020-03-25 10:07, Shane Francis wrote: >>>> As dma_map_sg can reorganize scatter-gather lists in a >>>> way that can cause some later segments to be empty we should >>>> always use the sg_dma_len macro to fetch the actual length. >>>> >>>> This could now be 0 and not need to be mapped to a page or >>>> address array >>>> >>>> Signed-off-by: Shane Francis >>>> Reviewed-by: Michael J. Ruhl >>> This patch landed in linux-next 20200326 and it causes a kernel >>> panic on >>> various Exynos SoC based boards. >>>> --- >>>>    drivers/gpu/drm/drm_prime.c | 2 +- >>>>    1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c >>>> index 86d9b0e45c8c..1de2cde2277c 100644 >>>> --- a/drivers/gpu/drm/drm_prime.c >>>> +++ b/drivers/gpu/drm/drm_prime.c >>>> @@ -967,7 +967,7 @@ int drm_prime_sg_to_page_addr_arrays(struct >>>> sg_table *sgt, struct page **pages, >>>>           index = 0; >>>>        for_each_sg(sgt->sgl, sg, sgt->nents, count) { >>>> -        len = sg->length; >>>> +        len = sg_dma_len(sg); >>>>            page = sg_page(sg); >>>>            addr = sg_dma_address(sg); >>> Sorry, but this code is wrong :( >> >> Well it is at least better than before because it makes most drivers >> work correctly again. > > Well, I'm not sure that a half-broken fix should be considered as a > fix ;) > > Anyway, I just got the comment from Shane, that my patch is fixing the > issues with amdgpu and radeon, while still working fine for exynos, so > it is indeed a proper fix. Today I've noticed that this patch went to final v5.6 without even a day of testing in linux-next, so v5.6 is broken on Exynos and probably a few other ARM archs, which rely on the drm_prime_sg_to_page_addr_arrays function. Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland