From patchwork Fri Apr 27 15:54:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 10369349 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 62FFA601BE for ; Fri, 27 Apr 2018 15:54:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5314D288F4 for ; Fri, 27 Apr 2018 15:54:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47D4629462; Fri, 27 Apr 2018 15:54:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC486288F4 for ; Fri, 27 Apr 2018 15:54:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AAF156E95B; Fri, 27 Apr 2018 15:54:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from foss.arm.com (foss.arm.com [217.140.101.70]) by gabe.freedesktop.org (Postfix) with ESMTP id 96DC06E95B; Fri, 27 Apr 2018 15:54:10 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 760FE15AD; Fri, 27 Apr 2018 08:54:10 -0700 (PDT) Received: from [10.1.210.88] (e110467-lin.cambridge.arm.com [10.1.210.88]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 61E8B3F487; Fri, 27 Apr 2018 08:54:09 -0700 (PDT) Subject: Re: [PATCH v2 2/3] drm/amdgpu: Allow dma_map_sg() coalescing To: Sinan Kaya , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org References: <622c9ac3784170880dbde6900146e68631df958a.1523977133.git.robin.murphy@arm.com> <59bb29d9-da0c-1542-88bf-71bed96f3ed2@codeaurora.org> <6338cb4f-6968-c657-212f-6bfd988f880c@codeaurora.org> From: Robin Murphy Message-ID: Date: Fri, 27 Apr 2018 16:54:08 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <6338cb4f-6968-c657-212f-6bfd988f880c@codeaurora.org> Content-Language: en-GB X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexander.deucher@amd.com, christian.koenig@amd.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 25/04/18 21:44, Sinan Kaya wrote: > On 4/17/2018 5:13 PM, Sinan Kaya wrote: >> Tested-by: Sinan Kaya >> >> using QDF2400 and XFX Vega64 GPU for the first two patches. >> >> ./builddir/tests/amdgpu/amdgpu_test -s 1 >> >> Suite: Basic Tests >> Test: Userptr Test ...passed >> >> Userptr Test fails without this patch. > > > I'm taking this back. I observed a crash with the HSA applications: FWIW, was this working before, or is this somewhere new that we're only reaching now that pin_userpages can succeed? > ubuntu@ubuntu:~/amdgpu$_./vectoradd_hip.exe > [ 834.002206] create_process:620 > [ 837.413021] Unable to handle kernel NULL pointer dereference at virtual address 00000018 £5 says that's sg_dma_len(NULL), which implies either that something's gone horribly wrong with the scatterlist DMA mapping such that the lengths don't match, or much more likely that ttm.dma_address is NULL and I've missed the tiny subtlety below. Does that fix matters? Robin. ----->8----- addr = sg_dma_address(dma_sg); diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index b8ca06ea7d80..6a31229e4611 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -961,7 +961,7 @@ int drm_prime_sg_to_page_addr_arrays(struct sg_table *sgt, struct page **pages, index++; } - if (dma_len == 0) { + if (addrs && dma_len == 0) { dma_sg = sg_next(dma_sg); dma_len = sg_dma_len(dma_sg);