From patchwork Wed Feb 16 14:13:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anders Roxell X-Patchwork-Id: 543377 Delivered-To: patch@linaro.org Received: by 2002:ac0:e142:0:0:0:0:0 with SMTP id r2csp201973imn; Thu, 17 Feb 2022 00:24:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYtp+r/X5CBwiGlzxUzaFwGiMBAysDNjidK7N01e7cMNdC221q5UfKD2dWPIMrgtbBlj4M X-Received: by 2002:a63:594b:0:b0:370:27b0:79a6 with SMTP id j11-20020a63594b000000b0037027b079a6mr1590732pgm.52.1645086275117; Thu, 17 Feb 2022 00:24:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645086275; cv=none; d=google.com; s=arc-20160816; b=o9X+DNakYmBJ6rGtxc1TQ+Hg6JdlL2i9qapTeMMT6DzHtvvNrf1cI9FzsP+T7SWgyt ngicYXotDPuGp6EdlpGe+dWaRWjhZ+Uo/RkkebChMCuwIZRWnerY/q6JXuiqPRCXfUne WfaSpKxrEIbiyYU14Bckjmg8Ssy4pAaTQ8Aj9jWY8jQ7nT3KLz0GsjHQ2gd9NclV2KiV cbkNc3mJGxcdDkDNeH/kcawzYCUkdHWmxrfUz4W2IPD+90rRam2GFMsj//Fd0HYVVZyh e0zRp2nol3Qx1+W45y0bhqGR4sXpUWawDSGyhdR/6OyMgagU3Qk9/FZVIYFmg7QrOwyU tubQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:content-transfer-encoding:precedence :mime-version:dkim-signature:references:in-reply-to:message-id:date :subject:to:from:delivered-to; bh=3ZyUSPlGqRZPZU/gevmWS0TcFbtyhKP7S0zjcIQWO/Q=; b=FRBlb2sQ0syk56x8gxx2aGjBq6i0FxhH0uqbFZ3gCnPvOP3MpgBSXg4DI+waoO0m7D zf9LubBbusoZTOesVOdFR1rGzUgVOHL04NKDfdGXnM8M2A6S1kA7u4HrdyBReAPp6wSt tTURbjJ2pzmA1PgPNr56UXsl6iHj+7cvdPWcWugUAtcxIIi9q6BylYu8KAA9KKE66/sS i4ztqQGDRiJROHfyr22jT2MMN9olgbKAiIyBDLa6Q+DrR+KvBPp+MfVbE/zMrcqXmVMK oYNYPzvlaP8aeq+4zcQjvlRPywJ/zfq9DMBkX2f/jUolUC6m+fKF3/TLZ+IwpBLTZ5B+ dYlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="Dadc/cXP"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id bx3si256285pjb.108.2022.02.17.00.24.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Feb 2022 00:24:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b="Dadc/cXP"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF81110E95B; Thu, 17 Feb 2022 08:24:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by gabe.freedesktop.org (Postfix) with ESMTPS id F419710F149 for ; Wed, 16 Feb 2022 14:13:22 +0000 (UTC) Received: by mail-lf1-x12d.google.com with SMTP id d23so4018798lfv.13 for ; Wed, 16 Feb 2022 06:13:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:dkim-signature:mime-version:precedence:list-id :content-transfer-encoding; bh=3ZyUSPlGqRZPZU/gevmWS0TcFbtyhKP7S0zjcIQWO/Q=; b=sEzEE/LwHGWzsp3aF69P3h+TAdURkfuuGcB3ELdVEUh8vso8NnSlvgs1wnMA8iXNlx OZj+8UJFqcuYqCaf9FddoJ/jVchuMWzx/K+nOGuL+w8E6Y/X1z+DXfljXEw854gayzkY mONCvs8oIWa3Pa2lVoTZz9DkylsCt3qeGVq41+cI1z0Veyc9Dqp7YEWTfP4cMWDoMS+A l38poaNSWWEPNPPpl5T4A9KIkJnhP6ea4mlKoW+Ggmsnmjbqy4BoYKZh2rqIKWQmYyZ7 HJIvzN7pS313FCVcGE1Jw6xt80zHEtkHHYK3uj0BchBkUG+IGa0Yf2QBI57bc9vF2CUn kHMA== X-Gm-Message-State: AOAM533z8HfM9EZ8x0kD5VVvOyvyXE9ge3cf4MJ1QSR0DODvXaSW2lZC KWaxRLk1PmsFLEQQ4ozcafa5Ug== X-Received: by 2002:a05:6512:10c2:b0:441:fa79:8893 with SMTP id k2-20020a05651210c200b00441fa798893mr2121701lfg.480.1645020801113; Wed, 16 Feb 2022 06:13:21 -0800 (PST) Received: from localhost (c-9b28e555.07-21-73746f28.bbcust.telenor.se. [85.229.40.155]) by smtp.gmail.com with ESMTPSA id h11sm2799428lfr.208.2022.02.16.06.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 06:13:20 -0800 (PST) From: Anders Roxell To: robdclark@gmail.com, dri-devel@lists.freedesktop.org Subject: [PATCH v3 2/2] drm/msm/gpu: Cancel idle/boost work on suspend Date: Wed, 16 Feb 2022 15:13:13 +0100 Message-Id: <20220108180913.814448-3-robdclark@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220108180913.814448-1-robdclark@gmail.com> References: <20220108180913.814448-1-robdclark@gmail.com> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AEE4C433EF for ; Sat, 8 Jan 2022 18:09:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234899AbiAHSJc (ORCPT ); Sat, 8 Jan 2022 13:09:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234868AbiAHSJa (ORCPT ); Sat, 8 Jan 2022 13:09:30 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6719C06173F; Sat, 8 Jan 2022 10:09:29 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id hv15so1844920pjb.5; Sat, 08 Jan 2022 10:09:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NpENl1wlwqcfbBT73rctGeiDbGEPDlZ8miqyZA+HW/A=; b=Dadc/cXPO0Uubd/3MkatQs1U4WERUA3XCupDgrJmGVsJIwvpDXnqEeetn63+ka7T6Z QJYYtuWQ5Gyrir8ulQHyjWOX0EnHqHvClV0uivmDk7DPOB7iZRL6wlcZIglDpjtOJ1su +W99NY5LlfFCa7TGy62ZQFZTX88A0anOL/loyhDqYjjitMGy92fcAVjzSMnBVdlt7yDE 94MyLMx/eNiHmh8ipu6YCC6PkDl1WMt9c9uXODNhAR5deTV37UvygLEdopJp7mibuvN6 knAv7q0CKzIOYCT7fetCaRQb7VFAyZT45H84lTcSs7ZqxIxoj3u2UdaLqu3DiBYylpPp iPmg== X-Received: by 2002:a17:902:e749:b0:148:f083:3905 with SMTP id p9-20020a170902e74900b00148f0833905mr68561286plf.136.1641665369257; Sat, 08 Jan 2022 10:09:29 -0800 (PST) Received: from localhost ([2601:1c0:5200:a6:307:a401:7b76:c6e5]) by smtp.gmail.com with ESMTPSA id ng7sm2564668pjb.41.2022.01.08.10.09.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jan 2022 10:09:28 -0800 (PST) X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org X-Mailman-Approved-At: Thu, 17 Feb 2022 08:24:32 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: robdclark@chromium.org, airlied@linux.ie, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, quic_abhinavk@quicinc.com, sean@poorly.run, freedreno@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Rob Clark From: Rob Clark With system suspend using pm_runtime_force_suspend() we can't rely on the pm_runtime_get_if_in_use() trick to deal with devfreq callbacks after (or racing with) suspend. So flush any pending idle or boost work in the suspend path. Signed-off-by: Rob Clark --- drivers/gpu/drm/msm/msm_gpu_devfreq.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/msm_gpu_devfreq.c b/drivers/gpu/drm/msm/msm_gpu_devfreq.c index 62405e980925..9bf319be11f6 100644 --- a/drivers/gpu/drm/msm/msm_gpu_devfreq.c +++ b/drivers/gpu/drm/msm/msm_gpu_devfreq.c @@ -133,6 +133,18 @@ void msm_devfreq_init(struct msm_gpu *gpu) CLOCK_MONOTONIC, HRTIMER_MODE_REL); } +static void cancel_idle_work(struct msm_gpu_devfreq *df) +{ + hrtimer_cancel(&df->idle_work.timer); + kthread_cancel_work_sync(&df->idle_work.work); +} + +static void cancel_boost_work(struct msm_gpu_devfreq *df) +{ + hrtimer_cancel(&df->boost_work.timer); + kthread_cancel_work_sync(&df->boost_work.work); +} + void msm_devfreq_cleanup(struct msm_gpu *gpu) { struct msm_gpu_devfreq *df = &gpu->devfreq; @@ -152,7 +164,12 @@ void msm_devfreq_resume(struct msm_gpu *gpu) void msm_devfreq_suspend(struct msm_gpu *gpu) { - devfreq_suspend_device(gpu->devfreq.devfreq); + struct msm_gpu_devfreq *df = &gpu->devfreq; + + devfreq_suspend_device(df->devfreq); + + cancel_idle_work(df); + cancel_boost_work(df); } static void msm_devfreq_boost_work(struct kthread_work *work) @@ -196,7 +213,7 @@ void msm_devfreq_active(struct msm_gpu *gpu) /* * Cancel any pending transition to idle frequency: */ - hrtimer_cancel(&df->idle_work.timer); + cancel_idle_work(df); idle_time = ktime_to_ms(ktime_sub(ktime_get(), df->idle_time));