From patchwork Mon May 20 22:50:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Erico Nunes X-Patchwork-Id: 10952529 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 F401E17E0 for ; Mon, 20 May 2019 22:51:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E123028948 for ; Mon, 20 May 2019 22:51:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C93FA2894B; Mon, 20 May 2019 22:51:42 +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 6B91928948 for ; Mon, 20 May 2019 22:51:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2809A89193; Mon, 20 May 2019 22:51:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by gabe.freedesktop.org (Postfix) with ESMTPS id F138889193; Mon, 20 May 2019 22:51:38 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id q15so898579wmj.0; Mon, 20 May 2019 15:51:38 -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=OIPvZjuI/lMeNdF8mkeNCYnvgnDdXkv0Gu6SZLCKPLw=; b=S2rX/ZeiUQybThzeiARDeTL6aISGgZNCAKVfFduFhALeTngBXIgWJsXjMghpTdP8ni fOYnQjfyKzMvqBwoUIoTSUa7f6ASc4QcVZoCq84QqJXFczv6aPiSHsbrVlMdPkvGe71/ cOItREgG3ZaPUfGNj1JUjJKlfkj34s8CClXVnKndvg0n9MQjSUKCWkcpvmr+G6qXPevS T0ajfio+pLODnfA2sQtXlCkGGH4Lj8mrgFn8tVtfAz8ZSr2Z99JEUP0lMBmqPrm/zrSD SB5af15UdZ0W1NUnFiy+txdqL2ogfimwON9+i21g7nuPkBbSB+qZko7x9Pr4n2TFgFIz GYzQ== X-Gm-Message-State: APjAAAVY5F60GxbRL3blJOGGDEVDxOgK74seFA1IUsuAgPyMok59PH/N CB97kHjmMy2wY7oGRwoeaiM= X-Google-Smtp-Source: APXvYqw/IpNploDES7UUoe7huaUQZvVZ9UwxV7+lgQS22h+aoq1lMdB+uXR92EXT3NccKD6rOsDNEA== X-Received: by 2002:a7b:ca42:: with SMTP id m2mr975726wml.35.1558392697679; Mon, 20 May 2019 15:51:37 -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 x64sm2165979wmg.17.2019.05.20.15.51.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 May 2019 15:51:37 -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] drm/scheduler: Fix job cleanup without timeout handler Date: Tue, 21 May 2019 00:50:58 +0200 Message-Id: <20190520225058.21406-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=OIPvZjuI/lMeNdF8mkeNCYnvgnDdXkv0Gu6SZLCKPLw=; b=ohwvQTRuPG+pblUW8WWalVU8R0qsq9YuGGnaCEgAUwRtlbS46CQq9uI2Xj6owEH46l gbkGJhRImR92mb/VBVGatqbSwVzBnnCBWh8tYqzeA4KNVZEGMEUmG+1a9Ap0CriTzM9+ uoVpRSxd7Fyxq5/B8mLyXE/MKN4x+rNOml0Eid/MyoN9TY22bmhJJYaescO58BZRCwP0 3gZSky3XMDapkr8EtSgpNhYeb+ojywhAEk+Yw9R/2erPsCbIBv1EKfnPMVl3ig6vfLWc AHSjLBVHkAN8zFbLd+MBWX9yZJfeLePx8mxbLmqDB8a1FVmJKueQya4N1aaXssvtoUNy ILwA== 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 --- 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..07ecaba15127 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;