From mboxrd@z Thu Jan 1 00:00:00 1970 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=-0.9 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 4E190C433E1 for ; Wed, 10 Jun 2020 19:04:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B62F2078C for ; Wed, 10 Jun 2020 19:04:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="A5UREhW8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727792AbgFJTEA (ORCPT ); Wed, 10 Jun 2020 15:04:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726392AbgFJTD7 (ORCPT ); Wed, 10 Jun 2020 15:03:59 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C7F9C03E96F for ; Wed, 10 Jun 2020 12:03:59 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id y20so2838959wmi.2 for ; Wed, 10 Jun 2020 12:03:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=NSUIdscZFTvAj/KAnkXmeLO33H1QImBmP7nNAatzF4E=; b=A5UREhW8Zimz/lgVsX6YJceKyEcTDjGffoiiTJOFdDh2MS8Wxd5Ju72jDNEe03+VwF mVZ3B2461XaZq/JxobIkPo8zWcoju/Yn/0yxVkOeKJtCgUkiqKoSrFTT2OuKrMCeaeFn nXsSEcazn3q3aNRxaP6pf9xhar75XQ1iFYbaA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=NSUIdscZFTvAj/KAnkXmeLO33H1QImBmP7nNAatzF4E=; b=rdMrRJyFgIbZLDZmhHmv2bDq/6pMIbT+DstsZpjtCyFA6waX+r+oAUe5CJDeWrthWt E9xvlPpybp9ft4AbW8Za3qfWlcmzBEApYz3+5SYPzd9z5tO98IV7UXiq3f514oSjZO0p Tn639KWyQOka9MkBHcoHQ9tr9oengYWhcYXbljYezozXSVxfTd+VbWl9GbYzPGCRwrwV j4p3I/PTLLBqIgfwmR72LoFfqX7OvMKCsveiYW0rfOt6RY8yym/Sm6waiFM0JOSh7LbG eCBXiWfqgz37MBH1irgh2J7CnHvnMOZeeR8hwR/AoF67wqH8JwyisvKFYa9VTzqUV5ya 8sdg== X-Gm-Message-State: AOAM530Q81pq7BvVfpRTbtRDz1QdPPipa0qmf7h31+3Zmm4GdfvCiNQT OJLZEwHa9IkBEFyNjhvhwMGo+g== X-Google-Smtp-Source: ABdhPJzTRfYPcTj3IRS5BINNXpxwdDXmbXJOisFqkC0CCPcDchPYcvzcaAwcf6hmVi/W346PEWyYcw== X-Received: by 2002:a1c:f301:: with SMTP id q1mr4562383wmq.110.1591815838119; Wed, 10 Jun 2020 12:03:58 -0700 (PDT) Received: from chromium.org (205.215.190.35.bc.googleusercontent.com. [35.190.215.205]) by smtp.gmail.com with ESMTPSA id d2sm1039640wrs.95.2020.06.10.12.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jun 2020 12:03:57 -0700 (PDT) Date: Wed, 10 Jun 2020 19:03:56 +0000 From: Tomasz Figa To: Ezequiel Garcia Cc: Hans Verkuil , Jerry-ch Chen , Laurent Pinchart , Matthias Brugger , Mauro Carvalho Chehab , Pi-Hsun Shih , yuzhao@chromium.org, zwisler@chromium.org, "moderated list:ARM/Mediatek SoC support" , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Sean Cheng =?utf-8?B?KOmEreaYh+W8mCk=?= , Sj Huang , Christie Yu =?utf-8?B?KOa4uOmbheaDoCk=?= , Frederic Chen =?utf-8?B?KOmZs+S/iuWFgyk=?= , Jungo Lin =?utf-8?B?KOael+aYjuS/iik=?= , Rynn Wu =?utf-8?B?KOWQs+iCsuaBqSk=?= , Linux Media Mailing List , srv_heupstream , linux-devicetree , Jerry-ch Chen Subject: Re: [RFC PATCH V4 1/4] media: v4l2-mem2mem: add v4l2_m2m_suspend, v4l2_m2m_resume Message-ID: <20200610190356.GJ201868@chromium.org> References: <20191204124732.10932-1-Jerry-Ch.chen@mediatek.com> <20191204124732.10932-2-Jerry-Ch.chen@mediatek.com> <20200521171101.GA243874@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Wed, Jun 10, 2020 at 03:52:39PM -0300, Ezequiel Garcia wrote: > Hi everyone, > > Thanks for the patch. > > On Wed, 10 Jun 2020 at 07:33, Tomasz Figa wrote: > > > > On Wed, Jun 10, 2020 at 12:29 PM Hans Verkuil wrote: > > > > > > On 21/05/2020 19:11, Tomasz Figa wrote: > > > > Hi Jerry, > > > > > > > > On Wed, Dec 04, 2019 at 08:47:29PM +0800, Jerry-ch Chen wrote: > > > >> From: Pi-Hsun Shih > > > >> > > > >> Add two functions that can be used to stop new jobs from being queued / > > > >> continue running queued job. This can be used while a driver using m2m > > > >> helper is going to suspend / wake up from resume, and can ensure that > > > >> there's no job running in suspend process. [snip] > > > > > > I assume this will be part of a future patch series that calls these new functions? > > > > The mtk-jpeg encoder series depends on this patch as well, so I guess > > it would go together with whichever is ready first. > > > > I would also envision someone changing the other existing drivers to > > use the helpers, as I'm pretty much sure some of them don't handle > > suspend/resume correctly. > > > > This indeed looks very good. If I understood the issue properly, > the change would be useful for both stateless (e.g. hantro, et al) > and stateful (e.g. coda) codecs. > > Hantro uses pm_runtime_force_suspend, and I believe that > could is enough for proper suspend/resume operation. Unfortunately, no. :( If the decoder is already decoding a frame, that would forcefully power off the hardware and possibly even cause a system lockup if we are unlucky to gate a clock in the middle of a bus transaction. I just inspected the code now and actually found one more bug in its power management handling. device_run() calls clk_bulk_enable() before pm_runtime_get_sync(), but only the latter is guaranteed to actually power on the relevant power domains, so we end up clocking unpowered hardware. > > I'm not seeing any code in CODA to handle this, so not sure > how it's handling suspend/resume. > > Maybe we can have CODA as the first user, given it's a well-maintained > driver and should be fairly easy to test. I remember checking a number of drivers using the m2m helpers randomly and none of them implemented suspend/resume correctly. I suppose that was not discovered because normally the userspace itself would stop the operation before the system is suspended, although it's not an API guarantee. Best regards, Tomasz