From patchwork Fri Apr 24 11:40:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 210050 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 B4197C55191 for ; Fri, 24 Apr 2020 11:41:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 917002084D for ; Fri, 24 Apr 2020 11:41:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=st.com header.i=@st.com header.b="Cz/dBvho" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726932AbgDXLlW (ORCPT ); Fri, 24 Apr 2020 07:41:22 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:14870 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726813AbgDXLlW (ORCPT ); Fri, 24 Apr 2020 07:41:22 -0400 Received: from pps.filterd (m0046660.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03OBWRX1023149; Fri, 24 Apr 2020 13:41:04 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=5Rg4znNj42bzqjnolZJ9lV8rYKa4nFxeh6irBMvctcs=; b=Cz/dBvho/0XMcgtyhgX+W9Q4pEgmNqeGCaUPo1EHOg6bNV9ptL7BHw1WnEvIE6Lf9XEP +ALfbyWp8T0ILDB6RGdtVPIjLIEK3w8TCsKtyLyA2iVk1qAxD1T/kabR55faLv1Wwb7+ b2Y1rmm1MSweMa/CYsHoPvyACRCoeGlAgtjCYAjzvkrDKkJ2XCWvVUTr9FODH3X8fFX9 bcEK5ybbmsAC2pQgNrf6tb57RTceHw8hcSFwsAbaGqHAd42x99+QIHiWgf8JcDD428zM q3n/3Jb9Dxtfof3ZxFRrNOBOR1P7ZHflgA5+pyj99aRNe85rQNv9yXzp6dZVJO9QhWSw RA== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30fpp9bch9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Apr 2020 13:41:04 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 6A0DE100038; Fri, 24 Apr 2020 13:41:04 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag3node3.st.com [10.75.127.9]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 576082B3DA2; Fri, 24 Apr 2020 13:41:04 +0200 (CEST) Received: from localhost (10.75.127.49) by SFHDAG3NODE3.st.com (10.75.127.9) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 24 Apr 2020 13:41:03 +0200 From: Benjamin Gaignard To: , , , , , , , CC: , , , , , Benjamin Gaignard Subject: [RFC 2/3] cpufreq: governor: Use minimum load QoS Date: Fri, 24 Apr 2020 13:40:57 +0200 Message-ID: <20200424114058.21199-3-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20200424114058.21199-1-benjamin.gaignard@st.com> References: <20200424114058.21199-1-benjamin.gaignard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.49] X-ClientProxiedBy: SFHDAG5NODE2.st.com (10.75.127.14) To SFHDAG3NODE3.st.com (10.75.127.9) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-24_04:2020-04-23,2020-04-24 signatures=0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Make sure that the returned load is above the system-wide minimum load QoS. Devices could set this specific QoS to inform governors about their need in terms of CPU load when computing it from idle time isn't accurate. Signed-off-by: Benjamin Gaignard --- drivers/cpufreq/cpufreq_governor.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index f99ae45efaea..1494e5e4c788 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c @@ -118,6 +118,7 @@ unsigned int dbs_update(struct cpufreq_policy *policy) unsigned int ignore_nice = dbs_data->ignore_nice_load; unsigned int max_load = 0, idle_periods = UINT_MAX; unsigned int sampling_rate, io_busy, j; + unsigned int qos_min_load; /* * Sometimes governors may use an additional multiplier to increase @@ -225,6 +226,10 @@ unsigned int dbs_update(struct cpufreq_policy *policy) policy_dbs->idle_periods = idle_periods; + qos_min_load = cpufreq_minload_qos_limit(); + if (qos_min_load > max_load) + max_load = qos_min_load; + return max_load; } EXPORT_SYMBOL_GPL(dbs_update); From patchwork Fri Apr 24 11:40:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 210051 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=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT 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 A0113C54FD0 for ; Fri, 24 Apr 2020 11:41:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D38020767 for ; Fri, 24 Apr 2020 11:41:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=st.com header.i=@st.com header.b="J6iWt8Py" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726968AbgDXLlW (ORCPT ); Fri, 24 Apr 2020 07:41:22 -0400 Received: from mx08-00178001.pphosted.com ([91.207.212.93]:54432 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726865AbgDXLlW (ORCPT ); Fri, 24 Apr 2020 07:41:22 -0400 Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03OBWi4b029084; Fri, 24 Apr 2020 13:41:06 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=st.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=STMicroelectronics; bh=f15cWn5l7+qnePYQkKeXeKN4S4ucsruNAsfQ5NRJgnw=; b=J6iWt8Pyv/o+0QkN41DpefKdKHfaEICctClHv4A7K0E1jeD3OY6t7KuiCpqPXdQpHKTi kB0LtSxI4ZUBJ5mp1FJVcglFZRtbGFMtdCh5Y0vt7Iwu9T3izsZk13yUvjktYwSts4pv XZeXC4swut3fqjqkxE5Q60GIehyGJL2+w2X8qMehw0qFohRGhre+MShqtH+PdttmypEi mT8PQdxMWTslx4Vto/iXhx7ipAWXrHhuzsssoyCT4uWQGrpsvsm6611No7o7FJMDsQtj YNztTP2MAe+5pm166gIncvD4tcKAohbXc269wwqTOGLHn0yb2x6Ut6ZSGKijqc7vGDE9 0g== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com with ESMTP id 30freh30hv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 24 Apr 2020 13:41:05 +0200 Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 75E6210002A; Fri, 24 Apr 2020 13:41:05 +0200 (CEST) Received: from Webmail-eu.st.com (sfhdag3node3.st.com [10.75.127.9]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 67D662B3DA0; Fri, 24 Apr 2020 13:41:05 +0200 (CEST) Received: from localhost (10.75.127.50) by SFHDAG3NODE3.st.com (10.75.127.9) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 24 Apr 2020 13:41:04 +0200 From: Benjamin Gaignard To: , , , , , , , CC: , , , , , Benjamin Gaignard Subject: [RFC 3/3] media: stm32-dcmi: Inform cpufreq governors about cpu load needs Date: Fri, 24 Apr 2020 13:40:58 +0200 Message-ID: <20200424114058.21199-4-benjamin.gaignard@st.com> X-Mailer: git-send-email 2.15.0 In-Reply-To: <20200424114058.21199-1-benjamin.gaignard@st.com> References: <20200424114058.21199-1-benjamin.gaignard@st.com> MIME-Version: 1.0 X-Originating-IP: [10.75.127.50] X-ClientProxiedBy: SFHDAG2NODE3.st.com (10.75.127.6) To SFHDAG3NODE3.st.com (10.75.127.9) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138, 18.0.676 definitions=2020-04-24_04:2020-04-23,2020-04-24 signatures=0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org When start streaming the CPU load could remain very low because almost all the capture pipeline is done in hardware (i.e. without using the CPU) and let believe to cpufreq governor that it could use lower frequencies. If the governor decides to use a too low frequency that becomes a problem when we need to acknowledge the interrupt during the blanking time. To avoid this problem, DCMI driver informs the cpufreq governors by adding a cpufreq minimum load QoS resquest. Signed-off-by: Benjamin Gaignard --- drivers/media/platform/stm32/stm32-dcmi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/media/platform/stm32/stm32-dcmi.c b/drivers/media/platform/stm32/stm32-dcmi.c index b8931490b83b..774f2506b2f1 100644 --- a/drivers/media/platform/stm32/stm32-dcmi.c +++ b/drivers/media/platform/stm32/stm32-dcmi.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -173,6 +174,8 @@ struct stm32_dcmi { struct media_device mdev; struct media_pad vid_cap_pad; struct media_pipeline pipeline; + + struct pm_qos_request qos_request; }; static inline struct stm32_dcmi *notifier_to_dcmi(struct v4l2_async_notifier *n) @@ -827,6 +830,9 @@ static int dcmi_start_streaming(struct vb2_queue *vq, unsigned int count) else reg_set(dcmi->regs, DCMI_IER, IT_OVR | IT_ERR); + cpufreq_minload_qos_add_request(&dcmi->qos_request, + CPUFREQ_GOV_QOS_MIN_LOAD_MAX_VALUE); + return 0; err_pipeline_stop: @@ -859,6 +865,8 @@ static void dcmi_stop_streaming(struct vb2_queue *vq) struct stm32_dcmi *dcmi = vb2_get_drv_priv(vq); struct dcmi_buf *buf, *node; + cpufreq_minload_qos_remove_request(&dcmi->qos_request); + dcmi_pipeline_stop(dcmi); media_pipeline_stop(&dcmi->vdev->entity);