Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3533423ybb; Tue, 31 Mar 2020 07:11:18 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsI+T7Ys62fqkLS2ywsjc33SKuKD/xeJbW0zTMD38zrBAY5Wa939Kmk3KQTI23T0mrS833/ X-Received: by 2002:aca:ec49:: with SMTP id k70mr2266321oih.80.1585663878795; Tue, 31 Mar 2020 07:11:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585663878; cv=none; d=google.com; s=arc-20160816; b=UEv+XBaHg5UI0JCL7ijJbZ4yxlG1+CkADSAQOr/enj+Hhmxot6NQHFZafhxhMoCr0x wBU/t49VDFo+3YqkHacYVxNx2EkXCwlEKH/jKIlbWr8waWdKfOZiohr1OdiXHUim8Iqq UzLGAIh0iYXd/VVGHjmpf/2NTU2DTEIcFwaOW79YqbV2NqTlMtQZHT0JLmgv55Wr+ryS T1Uqb6AnZ1hcIfpr5CamOW+rB/9Wab3b1tfla0a4yAR802wFpq2bUmvgwzZbds/slxjg WIw2OrKCTCrUny3gbaN0R9vYzwYGRrH1TlhxtseIDRk49RGyX1N1MvHdXDgndLFh//k7 tEAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6KkVAX9LHQdy5bHn212eBpteLV15dAVUf1jSf5zOtEI=; b=tDYMhbOvnbn4Pq8rT8AK9CLfagWAxFAvsYuXT+u/6CWCBeRqMQWA/hr+NYjMmDwMXc 19zUx3+eU5y9mCbSzsPbZ3hsm7FHUDXves5l2R1I5j8OkyoK1Abns3teAo/GMG5hAek0 2tTr4+WpZmVwajPOZYkinLZDPoq/4tqMCC6pshM49ApwJs1ctrvwpdMCHSO7xdExkvi6 dcqd0sgoulLq0mC09rW1IlCwAYkI2/Tiljem5t8+7HmcRAd4xuVOM/CUUNvF0kCGpyzk IHWVNhGbZsAjvWDFCCg/7YdAlDO81HHLoT2Q/FmO6a24tZoCynf9RcoKzgUiM4ffD0E1 p69Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CBuNpmAd; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h1si7456945otr.127.2020.03.31.07.11.05; Tue, 31 Mar 2020 07:11:18 -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=@gmail.com header.s=20161025 header.b=CBuNpmAd; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730923AbgCaOKb (ORCPT + 99 others); Tue, 31 Mar 2020 10:10:31 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:41836 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730742AbgCaOKa (ORCPT ); Tue, 31 Mar 2020 10:10:30 -0400 Received: by mail-wr1-f67.google.com with SMTP id h9so26122674wrc.8 for ; Tue, 31 Mar 2020 07:10:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=6KkVAX9LHQdy5bHn212eBpteLV15dAVUf1jSf5zOtEI=; b=CBuNpmAdmCOS9vPjHPGBzs3t/L7Yy6BKi/X/WMLwNFHK85ob3GXcaVicIX131gfJn2 OU8OqjmxYznVOzw9ShEUda19LDx6ErO2Z1y5NCgqYgJ9BmkpVH4/K8MyjDXe13mjsxg/ BB2i6Sy9cMjQttATOhQ32MukPB1hmG3r5LI7JfjFRrRlI7C3qBFymVIWXYs+kVfaC3zk R1uXZpAWPjrh9ry545106iUh6fNP3A4aLtkpmQyyG20Bvkkfyr7VSel8H2al5hDn3JM7 dCvpRDi901uzlVNmgDNP1wHvYyRMuDAxcI7kD5o/IFirSeHOgzVBdQko+U/ah64ZsuKK 7bzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=6KkVAX9LHQdy5bHn212eBpteLV15dAVUf1jSf5zOtEI=; b=rsV0hEfjB2mwFfhm2blTCjFc0hjSmqoDiFvMOHq9Eg5C6k7+l4eyQ/l8oOk6IAsQdV /QyvBitSLSZcN9NFMfc22zonzJ0XBu//r0n68p/kcw/d33b0aWmu4wzUUMqmkatbU+hI YWITmuW5kc8pNfb75bZt8hLheXYIC5tscW0/mtw54Gm/caT0JXeKi8vnvzXuFKZOXsPI 5O+bvFtQT9tFBhDCXJR9XFw2zj9hKPMF5wHkayjODcsJaKEdZ8VPrj1Jtw0pE7WvhWFl oAYKlqB/H/0Iy9Ll4ovYwkBGHXPe45b+om/moXfZd3CYOvwDl0cRktbU/Z6uK6Sg9lHj qgUw== X-Gm-Message-State: ANhLgQ0noas0ao586CQdvijtrrBkDJXKYZ18f0LR19nletuW4xD04Ysn jCDnC7vvHMUOxrTlHGPYGO73fvR1sAboiiARixg= X-Received: by 2002:a5d:6742:: with SMTP id l2mr21860749wrw.124.1585663828600; Tue, 31 Mar 2020 07:10:28 -0700 (PDT) MIME-Version: 1.0 References: <20200325090741.21957-2-bigbeeshane@gmail.com> <4aef60ff-d9e4-d3d0-1a28-8c2dc3b94271@samsung.com> <82df6735-1cf0-e31f-29cc-f7d07bdaf346@amd.com> <3a0cb2bc-84be-6f9f-a0e8-ecb653026301@samsung.com> In-Reply-To: <3a0cb2bc-84be-6f9f-a0e8-ecb653026301@samsung.com> From: Alex Deucher Date: Tue, 31 Mar 2020 10:10:17 -0400 Message-ID: Subject: Re: [v4,1/3] drm/prime: use dma length macro when mapping sg To: Marek Szyprowski Cc: =?UTF-8?Q?Christian_K=C3=B6nig?= , Shane Francis , Maling list - DRI developers , Dave Airlie , "Deucher, Alexander" , LKML , amd-gfx-request@lists.freedesktop.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 31, 2020 at 1:25 AM Marek Szyprowski wrote: > > Hi Alex, > > On 2020-03-30 15:23, Alex Deucher wrote: > > On Mon, Mar 30, 2020 at 4:18 AM Marek Szyprowski > > wrote: > >> Hi > >> > >> On 2020-03-27 10:10, Marek Szyprowski wrote: > >>> Hi Christian, > >>> > >>> On 2020-03-27 09:11, Christian K=C3=B6nig 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_pri= me.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 =3D 0; > >>>>>> for_each_sg(sgt->sgl, sg, sgt->nents, count) { > >>>>>> - len =3D sg->length; > >>>>>> + len =3D sg_dma_len(sg); > >>>>>> page =3D sg_page(sg); > >>>>>> addr =3D 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 th= e > >>> issues with amdgpu and radeon, while still working fine for exynos, s= o > >>> it is indeed a proper fix. > >> Today I've noticed that this patch went to final v5.6 without even a d= ay > >> of testing in linux-next, so v5.6 is broken on Exynos and probably a f= ew > >> other ARM archs, which rely on the drm_prime_sg_to_page_addr_arrays > >> function. > > Please commit your patch and cc stable. > > I've already did that: https://lkml.org/lkml/2020/3/27/555 Do you have drm-misc commit rights or do you need someone to commit this for you? Alex > > Best regards > -- > Marek Szyprowski, PhD > Samsung R&D Institute Poland >