From patchwork Sun Oct 9 19:23:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grazvydas Ignotas X-Patchwork-Id: 9368643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BD84C607D2 for ; Sun, 9 Oct 2016 19:23:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 975D628926 for ; Sun, 9 Oct 2016 19:23:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72EF42892D; Sun, 9 Oct 2016 19:23:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DE8E428926 for ; Sun, 9 Oct 2016 19:23:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 902A36E1BD; Sun, 9 Oct 2016 19:23:16 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F29C6E1B2; Sun, 9 Oct 2016 19:23:14 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id p80so6564696lfp.1; Sun, 09 Oct 2016 12:23:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Q9EGZ9rjW5ElHLppR1H+gxAIiNmSfALzLlIcid5VeF0=; b=J5ukcCREDWiZSiqT4+bplZB2vnfzkAzhOlHzNePy6MCEAUG8hCMH3HUz23JWF9PXmi Eu2vsX5VuzIw2gO69eGR5taLfX7x4jJ4lQgLMFELjoR+fvXcWAxm3n0Q5XWAhUyto9Qe FYXjIF/AN0u6mCshZ+h56lrdY868gfe8s6vOFxo4IY4PrxCXT5jEmoNgvj3CYSw9yjFP 8X8dfjRHKy0vD4jrlnyRGZlf6Fd5uFs8NOEFC4nMc3Rokgakm3sIf7L1anp0pNrsHZEV /7x0ch49H8x2qwAFy4ostzqyfJjhrzUKNtuOTETFko8rIgTCJgqwBPzphvrOdfVzVR55 Zx2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Q9EGZ9rjW5ElHLppR1H+gxAIiNmSfALzLlIcid5VeF0=; b=D9v+8ZbUADeL8SpWhuvVedVjJNoX3BZmxD+kDFGesgVW5O2e+kpsF/jVpcPm7FqHfa JDDtFw9p22R3SNlktTbLVysRBk7pBjFoutKuWWd+6eMv7EO4ZRknYy39iKgbhV5MW31d gHvlywRONda8sMy20J4rVRsjMIttZ9GFtTqvpx7a5SKmetDFRz/Wcei21CswTlT5FM4S MRYz0OL/OelxMYkusIjjA19aAKZEGZu8MpSVML3ow6Kbop+R+q3PgHq3vZTCWug67skG qHZNxeMNNQHvBsVFhy+JCdh9Fr9Kz6SrXyon3cxZNGcCeT7Iy4BpG1nXrJWGhH2ouP6k +XEg== X-Gm-Message-State: AA6/9Rm2eBEqpWn7Vb3vQB36tQBiuduTOP9OAnwRqo0xw18ldQledgluwpJo/8xieo5gAA== X-Received: by 10.46.9.10 with SMTP id 10mr2908305ljj.2.1476040992451; Sun, 09 Oct 2016 12:23:12 -0700 (PDT) Received: from localhost.localdomain ([5.20.238.37]) by smtp.gmail.com with ESMTPSA id 197sm5414859ljj.3.2016.10.09.12.23.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 09 Oct 2016 12:23:12 -0700 (PDT) From: Grazvydas Ignotas To: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org Subject: [PATCH] drm/amd/powerplay: don't give up if DPM is already running Date: Sun, 9 Oct 2016 22:23:08 +0300 Message-Id: <1476040988-11676-1-git-send-email-notasas@gmail.com> X-Mailer: git-send-email 2.7.4 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Currently the driver crashes if smu7_enable_dpm_tasks() returns early, which it does if DPM is already active. It seems to be better just to continue anyway, at least I haven't noticed any ill effects. It's also unclear at what state the hardware was left by the previous driver, so IMO it's better to always fully initialize. Way to reproduce: $ modprobe amdgpu $ rmmod amdgpu $ modprobe amdgpu ... DPM is already running right now, no need to enable DPM! ... failed to send message 18b ret is 0 BUG: unable to handle kernel paging request at ffffed01fc9ab21f Call Trace: smu7_set_power_state_tasks+0x499/0x1940 [amdgpu] phm_set_power_state+0xcb/0x120 [amdgpu] psm_adjust_power_state_dynamic+0x11e/0x1b0 [amdgpu] pem_task_adjust_power_state+0xb9/0xd0 [amdgpu] pem_excute_event_chain+0x7d/0xe0 [amdgpu] pem_handle_event_unlocked+0x49/0x60 [amdgpu] pem_handle_event+0xe/0x10 [amdgpu] pp_dpm_dispatch_tasks+0xe0/0x190 [amdgpu] amdgpu_pm_compute_clocks+0x10c/0xc60 [amdgpu] dce_v11_0_crtc_dpms+0x7d/0x150 [amdgpu] dce_v11_0_crtc_disable+0x90/0x4a0 [amdgpu] drm_helper_disable_unused_functions+0x67/0x80 [drm_kms_helper] amdgpu_fbdev_init+0x13e/0x170 [amdgpu] amdgpu_device_init+0x1aeb/0x2490 [amdgpu] Signed-off-by: Grazvydas Ignotas Reviewed-by: Edward O'Callaghan --- drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c index f6afa6a..327030b 100644 --- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu7_hwmgr.c @@ -1166,8 +1166,8 @@ static int smu7_enable_dpm_tasks(struct pp_hwmgr *hwmgr) tmp_result = (!smum_is_dpm_running(hwmgr)) ? 0 : -1; PP_ASSERT_WITH_CODE(tmp_result == 0, - "DPM is already running right now, no need to enable DPM!", - return 0); + "DPM is already running", + ); if (smu7_voltage_control(hwmgr)) { tmp_result = smu7_enable_voltage_control(hwmgr);