Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp975481ybz; Fri, 1 May 2020 12:00:14 -0700 (PDT) X-Google-Smtp-Source: APiQypIMI2REurFCmkZzt3fPAq6AHoM/SHLLM90WJWdq2S03Ce/IPbN0m+Bz18Daq9Y8PTsOYdlS X-Received: by 2002:a50:e8c7:: with SMTP id l7mr4627609edn.309.1588359613984; Fri, 01 May 2020 12:00:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588359613; cv=none; d=google.com; s=arc-20160816; b=NAGVNROaXdAbzZFsIPQFjxzg8dM/AfyOkoIaZrKsuBZeg/qtQdgF/OH+0IxRlRDFWU s4NX5lCoFJuGphbX6/LbGady7X8AeOlDZ9MdU4yNqlAqmcVZNUpYS1g7xcAjsr135LNJ m4KtHDfdxwpblL7NU4a1K+DyQJdwLKdktRKfBpJCXbp5lD/5Kmh+KPbgEWZv+XJgXeKQ yE5Uc15US6CO1GGWGW7sg4Y9XlXoYhS0sVEIppMe3gSmvW/3JgAAb/mWfuooSz/0soJg MijZzCj/UEc5b9loyb59wteyvKLCKzJyTfd98cnxXiHnUWc6J751/0uuuQ4caiFDFWah jxvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Vt0QD0qGDDBVo/FGY17/QPfRi70EGhMjrVST5CXganc=; b=Bcp/Je7ZXnu8odbWUI0VpjbuXIbbcgoc11NupyTDLuFVgqv8RbLfWrAh8lhdXEo4sN 7Gi0MCPBoQAI7V1AMvS7/iJeggRycx1Uru1erjlP1emoa0DMntmBl/7m2rF26eEijSYB XvcMSwugXuzkB+39QI89aZ634wwXB88c+B/YUR4XYtemiudpfqEqXRyVXzNvcVQ7GpQh WrAhokBMKI4K9V9USoq00Z5LwUcS4q47n4FV9w8p3ku5k8FtZ2FgFZoDKsMqjXSvhavw Y9kFo0m4LYduMvWJwDbrESZeXem6EAnsp0aegXA8r57nhZ8cHKB1m1u06UjpbyF3WsNh r4Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@anholt-net.20150623.gappssmtp.com header.s=20150623 header.b=n+VOSW7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si2455758ejj.231.2020.05.01.11.59.48; Fri, 01 May 2020 12:00:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@anholt-net.20150623.gappssmtp.com header.s=20150623 header.b=n+VOSW7M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730146AbgEAS6W (ORCPT + 99 others); Fri, 1 May 2020 14:58:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729930AbgEAS6U (ORCPT ); Fri, 1 May 2020 14:58:20 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E3FAC08E859 for ; Fri, 1 May 2020 11:58:20 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id t12so7982890edw.3 for ; Fri, 01 May 2020 11:58:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anholt-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Vt0QD0qGDDBVo/FGY17/QPfRi70EGhMjrVST5CXganc=; b=n+VOSW7MD4XNSmZihQfjum+mxK5FnIdMcEiBsOxO2YKarPrGhNRlvcg2KHGBfRAO6e 4gbTcv566mvkBg2iFpc/NReOVomtY9GLeW4yURrBxLL94iCOMH2NFhidOSWDfOVLE8h5 QYrYIGtF90V/JseWG8q987eBRh2ABNYDpFCvHQr5VZK4WNOxMrhCyO9RONejoHOPH296 sHzmULyHaChfwP/e/fMlyiabp3YCA16BBXIfKWM2tDqpwkLKNwN9ZYhLwBrIsHtUfS1Y fXdtX4nNCU0HVUP/jeU7v5WrRblEk6xrYarJ+/+Kfdv8tLcKTkqacAqVy9gqdGwqr0YQ VRDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Vt0QD0qGDDBVo/FGY17/QPfRi70EGhMjrVST5CXganc=; b=l0Hx9i+aT+rfZfPvDbxI29yoUn3AqbGZ5gFLw9EcFYenv9yctKuGQxgnI44nL4hKmv E0usvLdMO0xCJVxEKNhTzeSYUVNbuyLGgGt71MUZo8jVvMFgbIJm9imwe3q8qfZBdF/Z 7BegKTd4s5RFkFDDqS4OFCKdiszfHJDZbPN68H8/XAMHvbFz2N7tZ6s6GlfAKy6rlI8X 5rTrglz+ZNFR3ZjemfPh+gENFXS6SdktKfiTl0wr8Cx5xc22iIeNooOOk61TufrHeQ8t jT4eIbaTHI3g5MVUyuieuS8coLyoBqP6Ky/HkMpKif2pzc6o1poVY0V+oa5raZhZY2ne V4GQ== X-Gm-Message-State: AGi0Puak1ie4pvnyAGwrZpS4NQt0v9k7CpMn/2BsyuBvtzi5CiNOiYmK Q3/sECnVxRjlhzjaZSDv/WN/0SLT+ZKkDe7XjVaUEA== X-Received: by 2002:a50:aa8d:: with SMTP id q13mr4726587edc.88.1588359499000; Fri, 01 May 2020 11:58:19 -0700 (PDT) MIME-Version: 1.0 References: <20200501182533.19753-1-jcrouse@codeaurora.org> In-Reply-To: <20200501182533.19753-1-jcrouse@codeaurora.org> From: Eric Anholt Date: Fri, 1 May 2020 11:58:08 -0700 Message-ID: Subject: Re: [PATCH] drm/msm: Check for powered down HW in the devfreq callbacks To: Jordan Crouse Cc: linux-arm-msm@vger.kernel.org, stable@vger.kernel.org, Akhil P Oommen , AngeloGioacchino Del Regno , Ben Dooks , Daniel Vetter , David Airlie , Jeffrey Hugo , Rob Clark , Sean Paul , Sharat Masetty , Stephen Boyd , Thomas Gleixner , DRI Development , freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 1, 2020 at 11:26 AM Jordan Crouse wrote: > > Writing to the devfreq sysfs nodes while the GPU is powered down can > result in a system crash (on a5xx) or a nasty GMU error (on a6xx): > > $ /sys/class/devfreq/5000000.gpu# echo 500000000 > min_freq > [ 104.841625] platform 506a000.gmu: [drm:a6xx_gmu_set_oob] > *ERROR* Timeout waiting for GMU OOB set GPU_DCVS: 0x0 > > Despite the fact that we carefully try to suspend the devfreq device when > the hardware is powered down there are lots of holes in the governors that > don't check for the suspend state and blindly call into the devfreq > callbacks that end up triggering hardware reads in the GPU driver. > > Check the power state in the gpu_busy() and gpu_set_freq() callbacks for > a5xx and a6xx to make sure that the hardware is active before trying to > access it. Chatted on IRC -- while this avoids the instaboot on db820c when setting /sys/class/devfreq/devfreq1/min_freq, I think we should be using pm_runtime_get_if_in_use() to avoid the races while still avoiding bringing up the GPU.