Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1287203rwe; Fri, 14 Apr 2023 18:26:18 -0700 (PDT) X-Google-Smtp-Source: AKy350b+4gjUbxX8ScxAI3bXmezbfdTS/Dvog0F8kWhcSyvN897J+fIyniNafJCc1hPRAugydyU/ X-Received: by 2002:a05:6a00:a8f:b0:62a:4503:53ba with SMTP id b15-20020a056a000a8f00b0062a450353bamr12118139pfl.26.1681521978352; Fri, 14 Apr 2023 18:26:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681521978; cv=none; d=google.com; s=arc-20160816; b=yUj0ukLtn0EitjrtdMkjnHDWCT4hR5jhBf/340E8t2tFLCqxuwgJDymrbzuYWkGhr5 7C5iAiIdAnlcROTCyH5ETkkMNc6iRYiJDWAEqSQRcS23KVcrSXpEg8vcq/MoXZ5p/DOZ 3i2pHCoekPdX8x9cdg+6CTOKGRy6JN+W62cAkXR4ev9kjR7+2YXM9FYo2QA3ehM+RUh3 5epGcKiOeq57/89MXazlerchF5iynrTGuLhThFJBBkRO4VFFUMcs5PH/7OZd+znG20Wz TJrj1bQOIl1tgFG6mQw4yGU3GWcO563XYff+uQ1vtsjy84PLJ85PHPOzTl2/S8Hfdawv g67g== 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 :message-id:date:subject:cc:to:dkim-signature:dkim-signature:from; bh=wk6tBRL4rOUhZyc8yDlJOrUexb/aW0doiLcILhv9l7I=; b=fWUsXhbF+RtHLWRALC4qRn9bbAc3HTVOb6kcdL6uSFgQ6C5etxw4tdJY8kQd8/eu3T 7DrZL6skZUO9qhIExwamrb8KSF0Z3b6GaOwpq12y//UDc5TH7JdeC7ou47cKRZ19506F 2Hs4QosOMQP8kgggkwt2D6NByUCzW52aJSwhy/++F7DljycFUh8avhnqc0kzQVIV9K1g zWRJiYyUEGEyDhKTksMUgqw67wW3lAaqQrlHwbevr3I05iqSh94xqGSubiaP6XqY3Qkz DXym2TwSkHJwYfnTQpO+12IZtrsFaO591+E/0fgZU2FVsdtPngjEfUV/nQMViis0SMj2 YnrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=K3VpJIa7; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g17-20020aa79dd1000000b0063a375047c2si5744222pfq.175.2023.04.14.18.26.07; Fri, 14 Apr 2023 18:26:18 -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=@linutronix.de header.s=2020 header.b=K3VpJIa7; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229765AbjDOBXj (ORCPT + 99 others); Fri, 14 Apr 2023 21:23:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjDOBXf (ORCPT ); Fri, 14 Apr 2023 21:23:35 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5268C65B3 for ; Fri, 14 Apr 2023 18:23:34 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1681521812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=wk6tBRL4rOUhZyc8yDlJOrUexb/aW0doiLcILhv9l7I=; b=K3VpJIa7/dxb0WP7AvWLftrAQNOTsaZjvZmKQ6YN2nguYFLsK6AsUuyRV9uDrC6jiWGzPD lganGKWEcmuOvIgBuHlfalKv3fuJVLucbbyw+e9JWAQyXZ84woRWVrjWslhuXs85CfHp9c omAzaAOG5TzCfmfat02AeNfKJW9OCG2hOwekQ+PE6TYZMtIjsUYjIU2xXGrikg1ws+V8IS bdJ/57TjCAwVw/BA+SNG8YFss8jEtMXwtWg+dZqBAbssKa0td9ruPW/8anxCcbkqwD67qg 8bfNP4vxgc3Ums3ojYGSf6fK8w0v6DukzGWb5n0z5MF+slXH5C6fP3az35hViA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1681521812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=wk6tBRL4rOUhZyc8yDlJOrUexb/aW0doiLcILhv9l7I=; b=sD8RwqQUN1CEo6InqlzRlqogbgz0MsLVKyf2S6UvbYcE7yi6nc7UxCvpXgQQkjg45mnbnl XS7dLzTzE7fWAlDw== To: =?UTF-8?q?Christian=20K=C3=B6nig?= Cc: linux-kernel@vger.kernel.org, Ben Skeggs , Karol Herbst , Lyude Paul , David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, Tanmay Bhushan <007047221b@gmail.com> Subject: [PATCH v2] drm/nouveau: fix incorrect conversion to dma_resv_wait_timeout() Date: Sat, 15 Apr 2023 03:27:37 +0206 Message-Id: <20230415012137.615305-1-john.ogness@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 Commit 41d351f29528 ("drm/nouveau: stop using ttm_bo_wait") converted from ttm_bo_wait_ctx() to dma_resv_wait_timeout(). However, dma_resv_wait_timeout() returns greater than zero on success as opposed to ttm_bo_wait_ctx(). As a result, relocs will fail and log errors even when it was a success. Change the return code handling to match that of nouveau_gem_ioctl_cpu_prep(), which was already using dma_resv_wait_timeout() correctly. Fixes: 41d351f29528 ("drm/nouveau: stop using ttm_bo_wait") Reported-by: Tanmay Bhushan <007047221b@gmail.com> Link: https://lore.kernel.org/lkml/20230119225351.71657-1-007047221b@gmail.com Signed-off-by: John Ogness --- The original report was actually a patch that needed fixing. Since nobody has stepped up to fix this regression correctly, I'm posting the v2. This is a real regression introduced in 6.3-rc1. drivers/gpu/drm/nouveau/nouveau_gem.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index f77e44958037..346839c24273 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -645,8 +645,9 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, struct drm_nouveau_gem_pushbuf_reloc *reloc, struct drm_nouveau_gem_pushbuf_bo *bo) { - long ret = 0; + int ret = 0; unsigned i; + long lret; for (i = 0; i < req->nr_relocs; i++) { struct drm_nouveau_gem_pushbuf_reloc *r = &reloc[i]; @@ -703,13 +704,18 @@ nouveau_gem_pushbuf_reloc_apply(struct nouveau_cli *cli, data |= r->vor; } - ret = dma_resv_wait_timeout(nvbo->bo.base.resv, - DMA_RESV_USAGE_BOOKKEEP, - false, 15 * HZ); - if (ret == 0) + lret = dma_resv_wait_timeout(nvbo->bo.base.resv, + DMA_RESV_USAGE_BOOKKEEP, + false, 15 * HZ); + if (!lret) ret = -EBUSY; + else if (lret > 0) + ret = 0; + else + ret = lret; + if (ret) { - NV_PRINTK(err, cli, "reloc wait_idle failed: %ld\n", + NV_PRINTK(err, cli, "reloc wait_idle failed: %d\n", ret); break; } base-commit: 09a9639e56c01c7a00d6c0ca63f4c7c41abe075d -- 2.30.2