From patchwork Wed Dec 9 11:51:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Das, Nirmoy" X-Patchwork-Id: 11961215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 73094C4361B for ; Wed, 9 Dec 2020 11:52:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A1942054F for ; Wed, 9 Dec 2020 11:52:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A1942054F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=amd.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2A5B16EA10; Wed, 9 Dec 2020 11:52:32 +0000 (UTC) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2077.outbound.protection.outlook.com [40.107.244.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 25C156EA10 for ; Wed, 9 Dec 2020 11:52:31 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fSQXsZZ5dTuHptYpw747oKD8Sh2kZ86nS/frMbsrJLUQYrZkSrniEFcsmCjUiZeThU7CP9jmtDSGwDiHe6eqj/CyfcvUu/aDZEKN9KdjUpj9mGVzwG1KFnSyjGOLUwsMAl0bm5QqUP0ZQjK6bmnAYhbz6THiyRbec6n+mtoKCA7792EDWmiFEd7z6Yhy1slmpg+0q4vBNIfFEJCNzJyesXqAXYpQ8ca7xwfHKegM5JUWW9p1BhQjgpp8s48zQY84MRjS5GiIU/1tSuQbzOAhd2S4/FTkrclEKOJT+a++e3fRhADPefncquMm2IVojhwsBJ472PnKk5zWhROnJe6Psg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ghHnY4IXI5zUuqenjAqrlDLTClPwpDrjCOdaDhFNTQ0=; b=gFL7zvgyZ2GVciacWr7z55npp9novVL/M1udYAC1mtOyRphIsj/rEcLeTRNn7rf+d+41TvqCLlwsh1CmKUBkcJKB9182SVIOSgUzNzq4kQcc63YCj/F9rBBKHs75V1vDrc4LVdRnMAFHALqTjeNiXzD7+irLQSpoCol4NDekap06EZEarLbpoXYgHKpZSLbdyJjp3KHLAlphlpmvPtTTs9re+KNVIjY3RV246D4eJqiZXOvjfxvWxv2hQQIbzyKoAyryWO+IJoBWScWEYdE5c3qN5hr10VJgvEMIM56Ls4K4/jwrD2CbKCtCkmgZtJVatUGJ1Yis0fVGYNA8r1hJ6w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector2-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ghHnY4IXI5zUuqenjAqrlDLTClPwpDrjCOdaDhFNTQ0=; b=DrQomQXqzTPr5Hh8neNu/jk4b/XJzBaLvwt58GiVeCQL/ieepC2PQL3quV72kWylDUuRIjo4RL8TwFuqcEQOYEn+5AlEaFgnhGKhT670cN9AdHfHGtkzhks2N/nQyNtRjz3VMJmfblz49XeD6LyMOApNDlGgl/bTL44/HrxiRi8= Authentication-Results: lists.freedesktop.org; dkim=none (message not signed) header.d=none; lists.freedesktop.org; dmarc=none action=none header.from=amd.com; Received: from DM6PR12MB3916.namprd12.prod.outlook.com (2603:10b6:5:1ca::21) by DM6PR12MB2969.namprd12.prod.outlook.com (2603:10b6:5:115::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3632.17; Wed, 9 Dec 2020 11:52:29 +0000 Received: from DM6PR12MB3916.namprd12.prod.outlook.com ([fe80::7080:fa49:2223:5f4e]) by DM6PR12MB3916.namprd12.prod.outlook.com ([fe80::7080:fa49:2223:5f4e%7]) with mapi id 15.20.3632.023; Wed, 9 Dec 2020 11:52:28 +0000 From: Nirmoy Das To: dri-devel@lists.freedesktop.org Subject: [PATCH v2 1/1] drm/amdgpu: clean up bo in vce and vcn test Date: Wed, 9 Dec 2020 12:51:32 +0100 Message-Id: <20201209115132.98188-1-nirmoy.das@amd.com> X-Mailer: git-send-email 2.29.2 X-Originating-IP: [165.204.84.11] X-ClientProxiedBy: BN6PR08CA0051.namprd08.prod.outlook.com (2603:10b6:404:b9::13) To DM6PR12MB3916.namprd12.prod.outlook.com (2603:10b6:5:1ca::21) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from brihaspati.amd.com (165.204.84.11) by BN6PR08CA0051.namprd08.prod.outlook.com (2603:10b6:404:b9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.12 via Frontend Transport; Wed, 9 Dec 2020 11:52:27 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 4ff885ba-1613-4d04-1efb-08d89c38e78c X-MS-TrafficTypeDiagnostic: DM6PR12MB2969: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:513; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BJLFvZ8wBTEem1ltD6D8v6ytJQkndIewcUA48UkRgV1H4pKnzyYUN4q13gOo+FxGvdAG6sRHs5Q9lEg8p8ixCOoXmpbV4STSK4gciaF051kBI62rxwaD+5y3mXf2lXIjA/lXPyxOlbNX3NE7UdMzvHZWYoPFvIHyn+emmo70JLlZlWuAYHdmnNax5HimIcUnCjt5i33X37Il1tdHX8rNOJXenZqY/XwUiw9dfh9XlPEejEKlhLKZe3ji+SsCE7Jn/aCENB6YCbZomWS3M2bp4PCWLpXopSqcFCyzpPz5rt/zWopta4V0Erg9AmwkmqJo0pALy6+YcwDg5VjcsVgeqGwAPDy9vl1VjjxtOi+yOrigmo5eyWzoi2WLFgTmgqD1 X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR12MB3916.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(366004)(376002)(346002)(136003)(956004)(36756003)(5660300002)(83380400001)(54906003)(6916009)(66556008)(44832011)(66946007)(86362001)(1076003)(4326008)(34490700003)(2906002)(16526019)(6666004)(26005)(508600001)(2616005)(8936002)(6486002)(66574015)(8676002)(52116002)(186003)(66476007)(7696005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?utf-8?q?EWv8A7fKlAL7+19m+/mqg/WfuiCNWC?= =?utf-8?q?vE9WcjV2tYDZ9i3YB4am1/ECwKoff80ttbQ/ZDFiSpZvbrTO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1tqhB7/T?= =?utf-8?q?S+l04U2yl3TZqsKBK6a?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthSource: DM6PR12MB3916.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Dec 2020 11:52:28.8957 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-Network-Message-Id: 4ff885ba-1613-4d04-1efb-08d89c38e78c X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ovO9l0a6SPq/2UcB4VXNsiq8Ri0JzGRSxVDBC2iYSWoXSTEnfgcOZ0Pol9oEcSh2qX10NKi1QLFRX1UQSiCNIQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB2969 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Nirmoy Das , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" BO created with amdgpu_bo_create_reserved() wasn't clean properly before, which causes: [ 21.056218] WARNING: CPU: 0 PID: 7 at drivers/gpu/drm/ttm/ttm_bo.c:518 ttm_bo_release+0x2bf/0x310 [ttm] [ 21.056430] Call Trace: [ 21.056525] amdgpu_bo_unref+0x1a/0x30 [amdgpu] [ 21.056635] amdgpu_vcn_dec_send_msg+0x1b2/0x270 [amdgpu] [ 21.056740] amdgpu_vcn_dec_get_create_msg.constprop.0+0xd8/0x100 [amdgpu] [ 21.056843] amdgpu_vcn_dec_ring_test_ib+0x27/0x180 [amdgpu] [ 21.056936] amdgpu_ib_ring_tests+0xf1/0x150 [amdgpu] [ 21.057024] amdgpu_device_delayed_init_work_handler+0x11/0x30 [amdgpu] [ 21.057030] process_one_work+0x1df/0x370 [ 21.057033] worker_thread+0x46/0x340 [ 21.057034] ? process_one_work+0x370/0x370 [ 21.057037] kthread+0x11b/0x140 [ 21.057039] ? __kthread_bind_mask+0x60/0x60 [ 21.057043] ret_from_fork+0x22/0x30 Signed-off-by: Nirmoy Das Reviewed-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 2 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c index ecaa2d7483b2..78a4dd9bf11f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c @@ -1151,6 +1151,6 @@ int amdgpu_vce_ring_test_ib(struct amdgpu_ring *ring, long timeout) error: dma_fence_put(fence); amdgpu_bo_unreserve(bo); - amdgpu_bo_unref(&bo); + amdgpu_bo_free_kernel(&bo, NULL, NULL); return r; } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 7e19a6656715..921b81054c1b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -465,6 +465,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, struct amdgpu_job *job; struct amdgpu_ib *ib; uint64_t addr; + void *msg = NULL; int i, r; r = amdgpu_job_alloc_with_ib(adev, 64, @@ -474,6 +475,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, ib = &job->ibs[0]; addr = amdgpu_bo_gpu_offset(bo); + msg = amdgpu_bo_kptr(bo); ib->ptr[0] = PACKET0(adev->vcn.internal.data0, 0); ib->ptr[1] = addr; ib->ptr[2] = PACKET0(adev->vcn.internal.data1, 0); @@ -492,7 +494,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, amdgpu_bo_fence(bo, f, false); amdgpu_bo_unreserve(bo); - amdgpu_bo_unref(&bo); + amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg); if (fence) *fence = dma_fence_get(f); @@ -505,7 +507,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, err: amdgpu_bo_unreserve(bo); - amdgpu_bo_unref(&bo); + amdgpu_bo_free_kernel(&bo, NULL, (void **)&msg); return r; } @@ -761,6 +763,7 @@ int amdgpu_vcn_enc_ring_test_ib(struct amdgpu_ring *ring, long timeout) error: dma_fence_put(fence); amdgpu_bo_unreserve(bo); - amdgpu_bo_unref(&bo); + amdgpu_bo_free_kernel(&bo, NULL, NULL); + return r; }