From patchwork Thu Aug 24 16:25:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Almeida?= X-Patchwork-Id: 136879 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a7d1:0:b0:3f2:4152:657d with SMTP id p17csp1395309vqm; Thu, 24 Aug 2023 14:14:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHuWj3nySvPVKymjeJoVM/Fo3jv9Bgy9czwe5Vcu6mUzmpsxC+ERURke1HR291sEZUFWcxE X-Received: by 2002:a05:6512:3125:b0:500:94aa:7390 with SMTP id p5-20020a056512312500b0050094aa7390mr4568125lfd.18.1692911686260; Thu, 24 Aug 2023 14:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692911686; cv=none; d=google.com; s=arc-20160816; b=cfMLNds+D6MxAUlTRFtQEw4uQg68ghItXgCTo/lizEz4nkzv96Bt8zf2p4HPOEDDaS nl/7OnoLukWqDHlkCADGQqLGRpoBQs1hruPOYrHnhXQno/G6WhdZ7SjjygMHDkV+JNAR toSbgutFyM8/cqjTMDr+8q//wNTo0oThcYrWUvkbpkSV8y+OhxhLzeU9WFaztArOHRtq /iPanqlhT7tEGcpebZ9ukdclH91EcmqGnkEKHuNZTuLmyJTikg0KoKMAn5emnRvmWAtT 0t6i1NfEQH3JMq17LqY5uBar+oVeb4LpoVmys3FqDxbutVsBoZMn3jjx4jNgdgpLonbC ZI+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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/kdAy1qPc5Qv0WtsGr5qezqfWH6QagnMlc4kAqWcRsc=; fh=KUGLwWO1A75Jlv1C0BRtPTlRlsdZfeW4F3lkujEsvO4=; b=Yuhyxl9LmG4qFDmiUrdskmKJ3YAdiCn8kXbwHKv7ilxg/pC+YYMHPVaBh4BiRDep6K Q3slVtxL+8aea6p414OLpToqbdOqkuRJmGJhN8zk82xcxgHjLrx+6yZLl5YBsDgHOJC1 3Eg4kmhy57Mve7DODAzITXKwdmTIuVuZfKqedBH7Vl0cpLxow1e8qgkycaGXZlg24QEe arLpo6BNhmQSCckxJ2VGZYJQUHgakI2BF2KOWhK2tHThjVhZexJx2dK3IBf+xVky3K3p zmbcb0v9yw0PE/ZpVqoLxck35aLvM0Yw+KXSuFwxLAtaLaxwarYJrVWax6+gzbtBNi6h 0eow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@igalia.com header.s=20170329 header.b=jFHYD6T3; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y13-20020aa7d50d000000b005256673604esi219283edq.328.2023.08.24.14.13.52; Thu, 24 Aug 2023 14:14:46 -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=jFHYD6T3; 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 S240429AbjHXQZo (ORCPT + 99 others); Thu, 24 Aug 2023 12:25:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242561AbjHXQZ2 (ORCPT ); Thu, 24 Aug 2023 12:25:28 -0400 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FB7619B3 for ; Thu, 24 Aug 2023 09:25:26 -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=/kdAy1qPc5Qv0WtsGr5qezqfWH6QagnMlc4kAqWcRsc=; b=jFHYD6T3RJNHsiFU1LISCK8BPj B1IQnPZ1gUZ/0BHWRrILHIxdpGwK5jGEBfH847fetowQeTbHW87nZwCzx/xJhg4apbZDGBgFEQL9S eFvhwbnzHoIh1t3SgiNHwB+LJ6SjqB7HuIwO7fVgw0naoeZfFnte2KqJ88G8QYj27LHjZtqeQRqB9 ItSLjNdLxE3JOJJpT0OkzIIR5FSPrWbEwV5875TwwyBdV5pQfWkcnA2ts9gjnnwc/CcrMFnCJqXKe ij0M0iyg2cudgI/elUGctQMSCUPnp3pfJkd1+OYoOXP5UXMl7WyTft6jNxc4I8InKKSnBySjdVvi7 aEnhG/bA==; Received: from [187.35.42.59] (helo=steammachine.lan) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1qZD99-00F0DK-Um; Thu, 24 Aug 2023 18:25:24 +0200 From: =?utf-8?q?Andr=C3=A9_Almeida?= 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?b?J01hcmVrIE9sxaHDoWsn?= , =?utf-8?q?Andr=C3=A9_A?= =?utf-8?q?lmeida?= Subject: [PATCH 2/2] drm/amdgpu: Create an option to disable soft recovery Date: Thu, 24 Aug 2023 13:25:05 -0300 Message-ID: <20230824162505.173399-3-andrealmeid@igalia.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230824162505.173399-1-andrealmeid@igalia.com> References: <20230824162505.173399-1-andrealmeid@igalia.com> MIME-Version: 1.0 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 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: INBOX X-GMAIL-THRID: 1775146564711832446 X-GMAIL-MSGID: 1775146564711832446 Create a module option 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 | 6 ++++++ drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 6 +++++- drivers/gpu/drm/amd/include/amd_shared.h | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 4de074243c4d..8f4a93890345 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 d53e4097acc0..7d6c39b547cf 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; @@ -2891,6 +2892,11 @@ static void amdgpu_init_debug_options(void) pr_info("debug: enabled simulating large-bar capability on non-large bar system\n"); debug_largebar = true; } + + if (amdgpu_debug_mask & DEBUG_DISABLE_GPU_SOFT_RECOVERY) { + pr_info("debug: soft reset for GPU recovery disabled\n"); + amdgpu_soft_recovery = false; + } } static int __init amdgpu_init(void) 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; diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h index 6fa644c249a5..afcbacce0a13 100644 --- a/drivers/gpu/drm/amd/include/amd_shared.h +++ b/drivers/gpu/drm/amd/include/amd_shared.h @@ -264,6 +264,7 @@ enum AMDGPU_DEBUG_MASK { DEBUG_VERBOSE_EVICTIONS = (1 << 0), // 0x1 DEBUG_VM = (1 << 1), // 0x2 DEBUG_LARGEBAR = (1 << 2), // 0x4 + DEBUG_DISABLE_GPU_SOFT_RECOVERY = (1 << 3), // 0x8 }; /**