Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp37480774rwd; Tue, 11 Jul 2023 15:09:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlGwlVjg4M6j9ct0/N8pIqMcBEw3ZUQoBbFdE2rDi8UwOMhtkFfs0vuKfZRXdJhPtzM69X4L X-Received: by 2002:aa7:dd0f:0:b0:51e:eba:55ba with SMTP id i15-20020aa7dd0f000000b0051e0eba55bamr10895141edv.32.1689113365769; Tue, 11 Jul 2023 15:09:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689113365; cv=none; d=google.com; s=arc-20160816; b=OTS80XzvoUW+cg1f1DJ2rWFfNeaoXw17CJqmayT0t1BeiuxfKnmv8AbEmcRzuLhB76 a3dEW2Lk0vGnsJ7LkS/jqX9d/WbtHmjhY80PpZTqdIAFuzEtvwOMyAlEc7zn58PHZQxc VHxxzAZsvLaLDnSUw9loxrAJwnRzJfXrowDRfq+eim62wAqUpREYfU+o1I6JT8FjFacT OXgNBwF7Az1hOHge6dbY9P21YlDQ+/mIQ6XoE/WGo8xRHd+ka9PNO0o+CTGaM9bSEx42 VAlicQy4Xru9eruDgVPC46wvxuX4fNVmKEsGpLQV9rg7Y6yaO875eFnW/A26PfqqkPDu JdGA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KtDjAFCYmByWLVDPHSoFeYlAFDkrSIvmPO75H9eHTbY=; fh=aYwOFvh45AiUk04AC35/CxFbCKpYy0XHNT+Ky7LGVhk=; b=xMIXzF4+0n2gHBAZ87hpaE999XZIkpuB+Elj5g4iwO9BCPZDOxUY8Bvas0QUw4Stue RBlBH18jFhBM1OTMJGmjzMk4Rk19dOXu8VdYoLYrDj376aEFs7xlkico3kPGJfKPKw6k tm+7BUBpZ7FV/UrxDCMJC9TzXnsLEkz9WyYx2Rb+7YtxeKprbCp96vMORjA5Vo8bqxI/ Wc6SIkZX1JzmN+d8Yk+C+s5lltP/WsagqtPtpkIIk1tM2bDU4axPOcgQ2aOIsV9OZ168 t27MdwwN/AVMXMgtxknizgkwC05YFqhYff4P63cuca3XTlRapXZh6580EPOg9BV/Vqec n+5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=VLIc1Y3O; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w20-20020aa7dcd4000000b0051e252568besi3048940edu.662.2023.07.11.15.08.59; Tue, 11 Jul 2023 15:09:25 -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=fail header.i=@igalia.com header.s=20170329 header.b=VLIc1Y3O; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbjGKVfu (ORCPT + 99 others); Tue, 11 Jul 2023 17:35:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230437AbjGKVfr (ORCPT ); Tue, 11 Jul 2023 17:35:47 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BAB1E69 for ; Tue, 11 Jul 2023 14:35:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=KtDjAFCYmByWLVDPHSoFeYlAFDkrSIvmPO75H9eHTbY=; b=VLIc1Y3O+024uwIdNbCglhXD23 kWJ5GKiw3jqPD27tDBblfuikBdP4D2HexBRXCb0+ZEaC19Ap4iP04G+ML7tEJ3Wq0Ddr7ZrAwCpro hdHljfSIqxvZiYIMv6dJNjFlrq91xFholDn12QBde4khFM7Qz2TF9XZavxWPMDE7n7dMA8QxCMCX1 eHjWKrt6WN7zLnilNC6SnvfdA1YfI3YdXhNpx7rfwigJWtqLsl+mGRa+Klw9pbRwx+vORBmVTl0/t pRnBV0tXE2QyUShZYfY/Duu5dO3A917qXjblluu6VTh8lQjNeBNpY0HtWA99tzVnpk8DN+Nm1jRAA phQL2nPw==; Received: from [187.74.70.209] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1qJL1K-00Cl0M-UT; Tue, 11 Jul 2023 23:35:43 +0200 From: =?UTF-8?q?Andr=C3=A9=20Almeida?= To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: kernel-dev@igalia.com, alexander.deucher@amd.com, christian.koenig@amd.com, pierre-eric.pelloux-prayer@amd.com, =?UTF-8?q?=27Marek=20Ol=C5=A1=C3=A1k=27?= , Samuel Pitoiset , Bas Nieuwenhuizen , =?UTF-8?q?Timur=20Krist=C3=B3f?= , michel.daenzer@mailbox.org, =?UTF-8?q?Andr=C3=A9=20Almeida?= Subject: [PATCH 1/6] drm/amdgpu: Create a module param to disable soft recovery Date: Tue, 11 Jul 2023 18:34:56 -0300 Message-ID: <20230711213501.526237-2-andrealmeid@igalia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230711213501.526237-1-andrealmeid@igalia.com> References: <20230711213501.526237-1-andrealmeid@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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 Create a module parameter to disable soft recoveries on amdgpu, making every recovery go through the device reset path. This option makes easier to force device resets for testing and debugging purposes. Signed-off-by: André Almeida --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 9 +++++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 6 +++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index a84bd4a0c421..dbe062a087c5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -189,6 +189,7 @@ extern uint amdgpu_force_long_training; extern int amdgpu_lbpw; extern int amdgpu_compute_multipipe; extern int amdgpu_gpu_recovery; +extern bool amdgpu_soft_recovery; extern int amdgpu_emu_mode; extern uint amdgpu_smu_memory_pool_size; extern int amdgpu_smu_pptable_id; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 3b711babd4e2..7c69f3169aa6 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -163,6 +163,7 @@ uint amdgpu_force_long_training; int amdgpu_lbpw = -1; int amdgpu_compute_multipipe = -1; int amdgpu_gpu_recovery = -1; /* auto */ +bool amdgpu_soft_recovery = true; int amdgpu_emu_mode; uint amdgpu_smu_memory_pool_size; int amdgpu_smu_pptable_id = -1; @@ -540,6 +541,14 @@ module_param_named(compute_multipipe, amdgpu_compute_multipipe, int, 0444); MODULE_PARM_DESC(gpu_recovery, "Enable GPU recovery mechanism, (1 = enable, 0 = disable, -1 = auto)"); module_param_named(gpu_recovery, amdgpu_gpu_recovery, int, 0444); +/** + * DOC: gpu_soft_recovery (bool) + * Set true to allow the driver to try soft recoveries if a job get stuck. Set + * to false to always force a GPU reset during recovery. + */ +MODULE_PARM_DESC(gpu_soft_recovery, "Enable GPU soft recovery mechanism (default: true)"); +module_param_named(gpu_soft_recovery, amdgpu_soft_recovery, bool, 0644); + /** * DOC: emu_mode (int) * Set value 1 to enable emulation mode. This is only needed when running on an emulator. The default is 0 (disabled). diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c index 80d6e132e409..40678d9fb17e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c @@ -434,8 +434,12 @@ bool amdgpu_ring_soft_recovery(struct amdgpu_ring *ring, unsigned int vmid, struct dma_fence *fence) { unsigned long flags; + ktime_t deadline; - ktime_t deadline = ktime_add_us(ktime_get(), 10000); + if (!amdgpu_soft_recovery) + return false; + + deadline = ktime_add_us(ktime_get(), 10000); if (amdgpu_sriov_vf(ring->adev) || !ring->funcs->soft_recovery || !fence) return false; -- 2.41.0