From patchwork Sat Oct 22 07:28:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 7782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1121508wrr; Sat, 22 Oct 2022 02:28:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7PZq75z8Lp9QB3gBhP4BeQDlrgYZosvBW3IGKX1o88EabSghNnucMf7FZN7hrvgiwTYa/n X-Received: by 2002:a17:907:72cb:b0:793:30b3:7f89 with SMTP id du11-20020a17090772cb00b0079330b37f89mr13917585ejc.259.1666430928149; Sat, 22 Oct 2022 02:28:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430928; cv=none; d=google.com; s=arc-20160816; b=RwBByCuv86aZTcW+v4o+yAEBLoCCMRGnLOV3HMom/1Fdo+TFQtmFPnVrxLKFEHxzQI dHc/nmGkpPAXmbTGRKfOU5xnhCnaff+rKTSvWWfSD4qxPciLQuqcgef2QrI0lZowRbV4 WpTMJQoYl0zH71cJNVv5GoVt1tft64zHoZWdNjNIHFuJC7Nyamj80Y36DWyQgTyn5+WU Nh+m9Ai4cZMubB8xVrah4PbWPnkRXM/qR/U61pKPPlo2jhq6INgi0I69IefpV4asDnbz W5+EvLge7dYKdB1FfFOqSDaF0lzHslMjCaLlG8UufOZr2AV6Oau7bd66u52Jykq8Rvx6 Ek0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IRvL89iu3AsYoBNtyhQYCs/DDPqSHzhlIPhLiEwM0o0=; b=acWF6s/m1I2w7mPY9TesxUeFqVjyBy4pLGKRlZetRm+kSW2wkcWPPFC6MPAm03mXaI Td62Lkln8KkPmsEsuGVB74rJ/yKefVi2Jo5yyCCbCNfmUwyLBKhHoxrZGCG42RuXAslK MmMOTuWNJtUXVMavw7WnSoMVXeJlSxlpVEzog7Xq7Ox+kUaPdzxUp7L3c5uUX1VY6ijt pBOZoMyQM+NnUzQwcG8VUk1wW6TFbpnNyPm5cG2jjyPkISDCpFTU/keB+jP0qQeBiX7p yLaWAqa07c8FdIt6Ki0RlwRz6HFanZ27Uj+39DoNgHJHQKpV1u2QaKI3A2Y5AcrSkJ1h 7HRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VQD4egYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y10-20020a056402270a00b0045dc9b4c034si15180765edd.582.2022.10.22.02.28.23; Sat, 22 Oct 2022 02:28:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VQD4egYx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234173AbiJVJDH (ORCPT + 99 others); Sat, 22 Oct 2022 05:03:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231305AbiJVJCf (ORCPT ); Sat, 22 Oct 2022 05:02:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AD6B2DB954; Sat, 22 Oct 2022 01:17:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7D5C7B82E37; Sat, 22 Oct 2022 08:05:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC2F9C433C1; Sat, 22 Oct 2022 08:05:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666425922; bh=Syyww4aE/A9q2YbgecUDjN7WhpYEeXohYESQpJiSY+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VQD4egYxjrwz4wIDEG+zjcgDgf8bsJBrGQVGu4h8lXQf/uTkYPqoDZqDZX/ur21Yc qACnaHHXgzbRlYOfhPga4l3zXfRQ05Dgid+Vr+0SbSy7wo8zJRCy8C9GM8923g+/VK KOnTCjgAbSI4pmSYsXLnFMwRtAfhqAS4mhCACSo4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philip Yang , Felix Kuehling , =?utf-8?q?Christian_K=C3=B6nig?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.19 619/717] drm/amdgpu: SDMA update use unlocked iterator Date: Sat, 22 Oct 2022 09:28:18 +0200 Message-Id: <20221022072525.839645654@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221022072415.034382448@linuxfoundation.org> References: <20221022072415.034382448@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747379476989066951?= X-GMAIL-MSGID: =?utf-8?q?1747379476989066951?= From: Philip Yang [ Upstream commit 3913f0179ba366f7d7d160c506ce00de1602bbc4 ] SDMA update page table may be called from unlocked context, this generate below warning. Use unlocked iterator to handle this case. WARNING: CPU: 0 PID: 1475 at drivers/dma-buf/dma-resv.c:483 dma_resv_iter_next Call Trace: dma_resv_iter_first+0x43/0xa0 amdgpu_vm_sdma_update+0x69/0x2d0 [amdgpu] amdgpu_vm_ptes_update+0x29c/0x870 [amdgpu] amdgpu_vm_update_range+0x2f6/0x6c0 [amdgpu] svm_range_unmap_from_gpus+0x115/0x300 [amdgpu] svm_range_cpu_invalidate_pagetables+0x510/0x5e0 [amdgpu] __mmu_notifier_invalidate_range_start+0x1d3/0x230 unmap_vmas+0x140/0x150 unmap_region+0xa8/0x110 Signed-off-by: Philip Yang Suggested-by: Felix Kuehling Reviewed-by: Christian König Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c index 1fd3cbca20a2..718db7d98e5a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c @@ -211,12 +211,15 @@ static int amdgpu_vm_sdma_update(struct amdgpu_vm_update_params *p, int r; /* Wait for PD/PT moves to be completed */ - dma_resv_for_each_fence(&cursor, bo->tbo.base.resv, - DMA_RESV_USAGE_KERNEL, fence) { + dma_resv_iter_begin(&cursor, bo->tbo.base.resv, DMA_RESV_USAGE_KERNEL); + dma_resv_for_each_fence_unlocked(&cursor, fence) { r = amdgpu_sync_fence(&p->job->sync, fence); - if (r) + if (r) { + dma_resv_iter_end(&cursor); return r; + } } + dma_resv_iter_end(&cursor); do { ndw = p->num_dw_left;