From patchwork Wed Jun 1 21:17:31 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 9148157 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 50EC160751 for ; Wed, 1 Jun 2016 21:17:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 428E720410 for ; Wed, 1 Jun 2016 21:17:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3776226B39; Wed, 1 Jun 2016 21:17:57 +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=-3.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9A1320410 for ; Wed, 1 Jun 2016 21:17:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 43B2E6EA52; Wed, 1 Jun 2016 21:17:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io0-x241.google.com (mail-io0-x241.google.com [IPv6:2607:f8b0:4001:c06::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id EBD326EA4F for ; Wed, 1 Jun 2016 21:17:42 +0000 (UTC) Received: by mail-io0-x241.google.com with SMTP id m17so4142533ioi.3 for ; Wed, 01 Jun 2016 14:17:42 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=7W/AJNVLYQ86g/J5twTYpTQn/qx6bOY56k6wCzvmv9c=; b=dKEslDwD5UMfD4lGxOCPn/CZlnygb2LRuJa0b/iFVy8F++I6yoWE04NrFd7XEZZef+ NRsUTMaoWr65i6lNyxdfyDRMR62UYHao/+bQ2q5MNI+0F3/7O3EmIkPtG1ZjftqiGPvH /tChRpMoofWjMaOzdmZGGWkNZp2tcNhZY0CGQ3/8dE438UOiyiHyqPY5A9CATaGDVZ2/ dA26vG1Lu60s6sI5WDeI/NexjyCLf6lmCyfhEWAxvXv8CjI1ViFvj+rzm2oI+wMJtQzX t0I2WRyqS4vxQidpMCvTXNWb7iexcOxAq0OAp96tunl6C3ovumzoEauSPEPb7o3kP6/V ZC+w== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=7W/AJNVLYQ86g/J5twTYpTQn/qx6bOY56k6wCzvmv9c=; b=DTf82uChbf9zXJliAnRs2DK8R3k5+eL/jcge7kDGfXCLUBO93wnEYxZPABLP4To/oK LNTmuPvfzJ04egnu6rpaMWSNUQRd7tQKhaQ6869MZ3hzdCsqLqQtMvCqrYTFJgcnsOoT tMXecNWpb+AFPNdBv2m6sijnRHTEnQ4DudJQ7WARGiV9eUJnQPBVmh0++LlNQRyJcaKE MTwX0sKpftxnPMFSlg9KU86/r/0Xu+Guf4iR/sH5OzOGFAeVh2RpSjnB55rsdKVfOA+t EgpNz5W2kZnCIiMT3xsah6AhK9V/fAWgDkJl7BtxkF3cL4txE9nljwOqt9j1yD/AO6Rm w6Pg== X-Gm-Message-State: ALyK8tK0ZgSRMoukh7xXO4pyQyBHTEnNBZ6oc7AGlW4KIhsfnfqGXaREz3JbDy0d7rOTuA== X-Received: by 10.107.40.67 with SMTP id o64mr6628205ioo.183.1464815861962; Wed, 01 Jun 2016 14:17:41 -0700 (PDT) Received: from cm.amd.com ([165.204.55.251]) by smtp.gmail.com with ESMTPSA id m123sm10696475iom.5.2016.06.01.14.17.41 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Jun 2016 14:17:41 -0700 (PDT) From: Alex Deucher X-Google-Original-From: Alex Deucher To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/3] drm/amdgpu: fix pplib finish bug Date: Wed, 1 Jun 2016 17:17:31 -0400 Message-Id: <1464815851-29658-4-git-send-email-alexander.deucher@amd.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1464815851-29658-1-git-send-email-alexander.deucher@amd.com> References: <1464815851-29658-1-git-send-email-alexander.deucher@amd.com> MIME-Version: 1.0 Cc: Alex Deucher , Monk Liu 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Monk Liu 1,should use late_fini to kfree all resource otherwise the released pointer maybe accessed in IRQ ip fini routine. 2,hwmgr should not be kfree by pem_fini which is invoked by hw fini path. Signed-off-by: Monk Liu Reviewed-by: Alex Deucher Reviewed-by: Christian König Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++++ drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c | 7 ------- drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c | 3 --- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index bb8b149..1996670 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c @@ -1325,6 +1325,11 @@ static int amdgpu_fini(struct amdgpu_device *adev) adev->ip_block_status[i].valid = false; } + for (i = adev->num_ip_blocks - 1; i >= 0; i--) { + if (adev->ip_blocks[i].funcs->late_fini) + adev->ip_blocks[i].funcs->late_fini((void *)adev); + } + return 0; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c index f2e08b35..078f467 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_powerplay.c @@ -184,13 +184,6 @@ static int amdgpu_pp_sw_fini(void *handle) if (ret) return ret; -#ifdef CONFIG_DRM_AMD_POWERPLAY - if (adev->pp_enabled) { - amdgpu_pm_sysfs_fini(adev); - amd_powerplay_fini(adev->powerplay.pp_handle); - } -#endif - return ret; } diff --git a/drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c b/drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c index 46410e3..fb88e4e 100644 --- a/drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c +++ b/drivers/gpu/drm/amd/powerplay/eventmgr/eventmgr.c @@ -58,9 +58,6 @@ static void pem_fini(struct pp_eventmgr *eventmgr) pem_unregister_interrupts(eventmgr); pem_handle_event(eventmgr, AMD_PP_EVENT_UNINITIALIZE, &event_data); - - if (eventmgr != NULL) - kfree(eventmgr); } int eventmgr_init(struct pp_instance *handle)