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=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 362A4C433E0 for ; Tue, 2 Jun 2020 09:31:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0F322206A4 for ; Tue, 2 Jun 2020 09:31:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726904AbgFBJb3 (ORCPT ); Tue, 2 Jun 2020 05:31:29 -0400 Received: from foss.arm.com ([217.140.110.172]:48558 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbgFBJb2 (ORCPT ); Tue, 2 Jun 2020 05:31:28 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 45ACC55D; Tue, 2 Jun 2020 02:31:28 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A47393F305; Tue, 2 Jun 2020 02:31:26 -0700 (PDT) References: <20200527151613.16083-1-benjamin.gaignard@st.com> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Benjamin Gaignard Cc: hugues.fruchet@st.com, mchehab@kernel.org, mcoquelin.stm32@gmail.com, alexandre.torgue@st.com, linux-media@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, vincent.guittot@linaro.org, rjw@rjwysocki.net Subject: Re: [PATCH] media: stm32-dcmi: Set minimum cpufreq requirement In-reply-to: <20200527151613.16083-1-benjamin.gaignard@st.com> Date: Tue, 02 Jun 2020 10:31:21 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Benjamin, On 27/05/20 16:16, Benjamin Gaignard wrote: > Before start streaming set cpufreq minimum frequency requirement. > The cpufreq governor will adapt the frequencies and we will have > no latency for handling interrupts. > Few comments below from someone oblivious to your platform, they may not be all that relevant but I figured I'd pitch in anyway. > Signed-off-by: Benjamin Gaignard > --- > drivers/media/platform/stm32/stm32-dcmi.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c > index b8931490b83b..97c342351569 100644 > --- a/drivers/media/platform/stm32/stm32-dcmi.c > +++ b/drivers/media/platform/stm32/stm32-dcmi.c > @@ -13,6 +13,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -99,6 +100,8 @@ enum state { > > #define OVERRUN_ERROR_THRESHOLD 3 > > +#define DCMI_MIN_FREQ 650000 /* in KHz */ > + This assumes the handling part is guaranteed to always run on the same CPU with the same performance profile (regardless of the platform). If that's not guaranteed, it feels like you'd want this to be configurable in some way. > struct dcmi_graph_entity { > struct v4l2_async_subdev asd; > [...] > @@ -2020,6 +2042,8 @@ static int dcmi_probe(struct platform_device *pdev) > goto err_cleanup; > } > > + dcmi->policy = cpufreq_cpu_get(0); > + Ideally you'd want to fetch the policy of the CPU your IRQ (and handling thread) is affined to; The only compatible DTS I found describes a single A7, which is somewhat limited in the affinity area... > dev_info(&pdev->dev, "Probe done\n"); > > platform_set_drvdata(pdev, dcmi); > @@ -2049,6 +2073,9 @@ static int dcmi_remove(struct platform_device *pdev) > > pm_runtime_disable(&pdev->dev); > > + if (dcmi->policy) > + cpufreq_cpu_put(dcmi->policy); > + > v4l2_async_notifier_unregister(&dcmi->notifier); > v4l2_async_notifier_cleanup(&dcmi->notifier); > media_entity_cleanup(&dcmi->vdev->entity); 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 C1590C433E0 for ; Tue, 2 Jun 2020 09:31:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 90C6F206A4 for ; Tue, 2 Jun 2020 09:31:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="f1FUTvk9" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 90C6F206A4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date: In-reply-to:Subject:To:From:References:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=uJuPFeFA10EgAp5y+fK3oyMeAbjW5h+nBIIKjQnaEEQ=; b=f1FUTvk9arI7xNx2+cdZOu+XXX 5hM1sqgKz7wYV/1fSc/J+JkGrjZnR1WTkEzKDFjXlJwTXZaUaLyF/OG6VD58MU0wnBjxeQ5b7/Vhh 6naf5OL2T2cNob6XBBOzNMGcFbHZE5ArHCwotnDb5T/g/a65x/ol5iTnz/Mto6fnPbmOFO7YBYyNI tOQDwsLvGQxpvNFbn1fPXFD34XKWkqYZnKNJ1hyJVspbBOWAwTr19p2QM35KQe7yX9j3elHBiUxCz MeEq29uGh065lCPWIsoA8T7B0ZDFtRIZl40IF4D3RTkva1j5Dquwg4lTHKJf5lbL1zEZNN8NO1l+m Jh+M87qw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jg3Gi-0002CF-1N; Tue, 02 Jun 2020 09:31:36 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jg3Ge-0002B9-EL for linux-arm-kernel@lists.infradead.org; Tue, 02 Jun 2020 09:31:33 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 45ACC55D; Tue, 2 Jun 2020 02:31:28 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A47393F305; Tue, 2 Jun 2020 02:31:26 -0700 (PDT) References: <20200527151613.16083-1-benjamin.gaignard@st.com> User-agent: mu4e 0.9.17; emacs 26.3 From: Valentin Schneider To: Benjamin Gaignard Subject: Re: [PATCH] media: stm32-dcmi: Set minimum cpufreq requirement In-reply-to: <20200527151613.16083-1-benjamin.gaignard@st.com> Date: Tue, 02 Jun 2020 10:31:21 +0100 Message-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200602_023132_524892_C82AC4AC X-CRM114-Status: GOOD ( 14.38 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.torgue@st.com, rjw@rjwysocki.net, linux-kernel@vger.kernel.org, mcoquelin.stm32@gmail.com, hugues.fruchet@st.com, mchehab@kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Benjamin, On 27/05/20 16:16, Benjamin Gaignard wrote: > Before start streaming set cpufreq minimum frequency requirement. > The cpufreq governor will adapt the frequencies and we will have > no latency for handling interrupts. > Few comments below from someone oblivious to your platform, they may not be all that relevant but I figured I'd pitch in anyway. > Signed-off-by: Benjamin Gaignard > --- > drivers/media/platform/stm32/stm32-dcmi.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c > index b8931490b83b..97c342351569 100644 > --- a/drivers/media/platform/stm32/stm32-dcmi.c > +++ b/drivers/media/platform/stm32/stm32-dcmi.c > @@ -13,6 +13,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -99,6 +100,8 @@ enum state { > > #define OVERRUN_ERROR_THRESHOLD 3 > > +#define DCMI_MIN_FREQ 650000 /* in KHz */ > + This assumes the handling part is guaranteed to always run on the same CPU with the same performance profile (regardless of the platform). If that's not guaranteed, it feels like you'd want this to be configurable in some way. > struct dcmi_graph_entity { > struct v4l2_async_subdev asd; > [...] > @@ -2020,6 +2042,8 @@ static int dcmi_probe(struct platform_device *pdev) > goto err_cleanup; > } > > + dcmi->policy = cpufreq_cpu_get(0); > + Ideally you'd want to fetch the policy of the CPU your IRQ (and handling thread) is affined to; The only compatible DTS I found describes a single A7, which is somewhat limited in the affinity area... > dev_info(&pdev->dev, "Probe done\n"); > > platform_set_drvdata(pdev, dcmi); > @@ -2049,6 +2073,9 @@ static int dcmi_remove(struct platform_device *pdev) > > pm_runtime_disable(&pdev->dev); > > + if (dcmi->policy) > + cpufreq_cpu_put(dcmi->policy); > + > v4l2_async_notifier_unregister(&dcmi->notifier); > v4l2_async_notifier_cleanup(&dcmi->notifier); > media_entity_cleanup(&dcmi->vdev->entity); _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel