From patchwork Mon May 20 23:16:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Erico Nunes X-Patchwork-Id: 10952557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9372B112C for ; Mon, 20 May 2019 23:17:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83A422015F for ; Mon, 20 May 2019 23:17:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7708D288A7; Mon, 20 May 2019 23:17:18 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 E17292015F for ; Mon, 20 May 2019 23:17:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5D6EB89211; Mon, 20 May 2019 23:17:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F02C89211; Mon, 20 May 2019 23:17:14 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id b18so16330103wrq.12; Mon, 20 May 2019 16:17:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jWWkFF8qqNP1oyaV8DPzFg3zaBUl2kqL5tx2cpEwSt4=; b=XCY4ml8gFIM5/ulSC0st4Y54PVcX5lmQltDcDdx1y3StmjQPQlBRJL5jaMlnO69WDi 3dDLUxz/+q8cGBi3fXc616HStoe/ofBOVKpUALrwu3FfNUX04LuLe+nzF79/GtBDlBCu 3Lx01xmpQFfgHXKq8mnDcf2tkwO003aV2qNoLZYDXai4BQmib0vgHTx/wmrHA9hVQt0s Sl0C2Da/XJb62qxKO+igS3IxDbZZ3L1g0RXg5JZ9Vtpsjwz6uqazbH/gf/qDDwfFk4a9 Wu18ESmSuxcZqeunTURZEY+c/Fc+BFT+2d1mY8OMlNzWHCb8eeykKq+kbbe4kIjzdh3P g+oA== X-Gm-Message-State: APjAAAWcDqPquaNKL4rgvyTXQPHhhN1XHZXWjpicI+Bt6F5MY5XPtBgu 23yb6TxRW9PHmQT7Sx3vDxyxCzAt+OHUwA== X-Google-Smtp-Source: APXvYqzx/zP6ubKNDdOmlf6yFJ5Rzhj8cPIX/4o1hGkhOWhmx0lVlwAgurxizxUoOQkZtff/FdGtNw== X-Received: by 2002:adf:df87:: with SMTP id z7mr21697443wrl.8.1558394233106; Mon, 20 May 2019 16:17:13 -0700 (PDT) Received: from localhost.localdomain (ip-94-112-137-51.net.upcbroadband.cz. [94.112.137.51]) by smtp.gmail.com with ESMTPSA id r3sm16254721wrn.5.2019.05.20.16.17.11 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 May 2019 16:17:12 -0700 (PDT) From: Erico Nunes To: Qiang Yu , David Airlie , Daniel Vetter , Alex Deucher , christian.koenig@amd.com, Nayan Deshmukh , Andrey Grodzovsky , Eric Anholt , Sharat Masetty , dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org Subject: [PATCH v2] drm/scheduler: Fix job cleanup without timeout handler Date: Tue, 21 May 2019 01:16:49 +0200 Message-Id: <20190520231649.24595-1-nunes.erico@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=jWWkFF8qqNP1oyaV8DPzFg3zaBUl2kqL5tx2cpEwSt4=; b=fhhPHOUbnJjAKQ/oK9N32Q5BG/NnJA6uUABFa9IrkgVBrgxwYZzHDiJfspWhiuQ/eW gR5kDXd+Y+1yu9MwdNoxEq0+46NYDfinDG1ZbRvdaSHevEdKNyc+Wmo4tQWP2Lm9o24v EVcFPdYmLu1GdRw4LANoa/ru0vMKSp+auFea8UT/E5hPncNQij1cKj7vBo93qSPvBG3z ILWUVJpRF3MUIXUlgibGyPvJpq84OsWyGXHp/Tqq2UVs3S+SzX3itx6E69r1muTdNdhi 0nC7Yx4IHOYK9FWVICRTjthAmSyK4E7abfLmIsxc+jlD0oX9QwO3BiR06ncxH4KbAw2L fjrw== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Erico Nunes Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP After "5918045c4ed4 drm/scheduler: rework job destruction", jobs are only deleted when the timeout handler is able to be cancelled successfully. In case no timeout handler is running (timeout == MAX_SCHEDULE_TIMEOUT), job cleanup would be skipped which may result in memory leaks. Add the handling for the (timeout == MAX_SCHEDULE_TIMEOUT) case in drm_sched_cleanup_jobs. Signed-off-by: Erico Nunes Cc: Christian König Reviewed-by: Christian König --- drivers/gpu/drm/scheduler/sched_main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index f8f0e1c19002..10d1d37e644a 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -630,7 +630,8 @@ static void drm_sched_cleanup_jobs(struct drm_gpu_scheduler *sched) unsigned long flags; /* Don't destroy jobs while the timeout worker is running */ - if (!cancel_delayed_work(&sched->work_tdr)) + if (sched->timeout != MAX_SCHEDULE_TIMEOUT && + !cancel_delayed_work(&sched->work_tdr)) return;