Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp914357rwi; Wed, 19 Oct 2022 04:41:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6YEXyCPU4CHKp++fCpUgAV5x3w0HaP+MuyI0odDfz+93xAWVrHEgAdj6/9baCfM8dLDMNY X-Received: by 2002:a17:907:7e9e:b0:78d:f3b0:fc78 with SMTP id qb30-20020a1709077e9e00b0078df3b0fc78mr6416429ejc.478.1666179713268; Wed, 19 Oct 2022 04:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666179713; cv=none; d=google.com; s=arc-20160816; b=Aqwi+02wxznih+TXq9XdvjVSOvtYU06WVnonHwWpGaLEQEKh+wAyJRzed89upVQZRv pOs9eq4pluzAvJc213yEj7wm9niLYUzMdfMkGtXAfWl5rWbGNOsI17eXOzG6ELmybpa3 ZKDmn+L/nJga+JO7abzoU/JvzLA+jWx72q4BG3PmjCxnPWk2NjAfj05XDsOgPp8RkN2x vQApwZnu+eRvOCZDlB0lcEUzNiMsopsuPm122r0k+vdNAqr3iPYKBrJP0gHLs1p+0ayA JouYyz3PFrZCqBK7FF0ueBKLfR4FdCVABWg1RajJgpfj/KwqqxPakcT6Gj4/vX87J/eu Vl+A== 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=aY9AiG14uEZBBGnjLgxO9A2baTUYQh6OuM6t3JNlsxSl1npTAYr8wz8rELSN/9+qDH SuwVA6YoHeOibXQn1iZLR6dm+UFIuhUFggj83ZOTWbjleld4/2uyD9Z/mnOr3CitWKbl uXmLsEBwHpLAMrx89rPxho7CQVzEODj9dv4i5PVQTxLYl0nk049XBCk7HaBBQAGdHMvB chOkBlFtLef+I0x2muYqFxNGm+qZGaS0TWJY65Ak1iD1/SrbI+uuUf6vndgSciz/nmLH w0Lq1deMJkY/6esQxvvlNJxPGZTC+BmCSfNRtuAzGL7LL05+TNMiMF7G23H0yfcv49NV mf+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gDGk9bT+; 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 fk24-20020a056402399800b0045cafc51fbfsi14063646edb.525.2022.10.19.04.41.25; Wed, 19 Oct 2022 04:41:53 -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=gDGk9bT+; 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 S232538AbiJSLKC (ORCPT + 99 others); Wed, 19 Oct 2022 07:10:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233181AbiJSLIy (ORCPT ); Wed, 19 Oct 2022 07:08:54 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C97D14EC77; Wed, 19 Oct 2022 03:37: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 sin.source.kernel.org (Postfix) with ESMTPS id 59455CE21B0; Wed, 19 Oct 2022 09:11:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EE53C433D7; Wed, 19 Oct 2022 09:11:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1666170698; bh=Syyww4aE/A9q2YbgecUDjN7WhpYEeXohYESQpJiSY+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gDGk9bT+1mK4aCae/7WPEbGv2qy33SKbiMCdGlJGuNSxv9MEURoYEjRskOKs8OWn6 0e7ZCidLaqKTK92/Wf/NxjsVUJwdrdsQ0zJs8k1RtVuvfatAnqoizBjkSmiCGyi8or 6qsGSrJzVuX/RQ+h6nQKb8HzpurXNqkcAo+Q1Ljk= 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 6.0 754/862] drm/amdgpu: SDMA update use unlocked iterator Date: Wed, 19 Oct 2022 10:34:01 +0200 Message-Id: <20221019083323.217463591@linuxfoundation.org> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221019083249.951566199@linuxfoundation.org> References: <20221019083249.951566199@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.4 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