Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3935352rwi; Sat, 22 Oct 2022 02:29:41 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Vo43GzkN+6fO9MzCD8mojrEErOZjwzyK7655LVaJe3sf+1TFeXiFJgDWbvCeO5vW6RYwv X-Received: by 2002:a05:6402:4302:b0:45d:c9b4:c007 with SMTP id m2-20020a056402430200b0045dc9b4c007mr21260422edc.328.1666430980928; Sat, 22 Oct 2022 02:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666430980; cv=none; d=google.com; s=arc-20160816; b=vkXrZGJMGvGwMHRD39XO3U6l50brc79oDi8b/GkWN5gKe3vq37qJb036cLEOoWrZ8w bTpAsFe9o8BP+j4MloA5WJiPp6zUJ0YIYv6PE5t/6oEVCas+zIIy7g+ZN5dB1ItoU9jr 35IWMP/HD7+FduRcdCgPpjyTcAiVsTe1irUZ6IIYcUmTd4ri43O7PXPqjF479K7+Xm2x uXU/yqZFxbCxm6OKQPJWQXies+/fzndN6CP70ENNFXJaR2a+QhAu3KJ3eHxNnKlRoOxA 03EtxiQ3T5hW5O4yR4uHmxMHryXAbOtchNsw4npPSAL1t3XvY5LqRrjBPPz/C/yH4olS 2rKg== 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 Return-Path: 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.29.15; Sat, 22 Oct 2022 02:29:40 -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=20K=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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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; -- 2.35.1