From patchwork Fri Aug 10 01:12:51 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: MyungJoo Ham X-Patchwork-Id: 1303611 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 713DC3FD8C for ; Fri, 10 Aug 2012 01:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756521Ab2HJBNF (ORCPT ); Thu, 9 Aug 2012 21:13:05 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:54672 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756341Ab2HJBMx (ORCPT ); Thu, 9 Aug 2012 21:12:53 -0400 Received: from epcpsbge3.samsung.com (mailout4.samsung.com [203.254.224.34]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0M8I00BMQM16WUF0@mailout4.samsung.com> for linux-pm@vger.kernel.org; Fri, 10 Aug 2012 10:12:51 +0900 (KST) X-AuditID: cbfee60d-b7f526d000004e6b-49-5024601372f0 Received: from epextmailer03 ( [203.254.219.153]) by epcpsbge3.samsung.com (EPCPMTA) with SMTP id EC.50.20075.31064205; Fri, 10 Aug 2012 10:12:51 +0900 (KST) Date: Fri, 10 Aug 2012 01:12:51 +0000 (GMT) From: =?euc-kr?B?x9S47cHW?= Subject: Re: Re: [PATCH] PM QoS: Add a metric : Bus Throughput. To: =?euc-kr?Q?=B9=DA=B0=E6=B9=CE?= , "Rafael J. Wysocki" Cc: =?euc-kr?Q?=C0=CC=C1=BE=C8=AD?= , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Pavel Machek , Len Brown Reply-to: myungjoo.ham@samsung.com MIME-version: 1.0 X-MTR: 20120810010647028@myungjoo.ham Msgkey: 20120810010647028@myungjoo.ham X-EPLocale: ko_KR.euc-kr X-Priority: 3 X-EPWebmail-Msg-Type: personal X-EPWebmail-Reply-Demand: 0 X-EPApproval-Locale: X-EPHeader: ML X-EPTrCode: X-EPTrName: X-MLAttribute: X-RootMTR: 20120810010647028@myungjoo.ham X-ParentMTR: X-ArchiveUser: X-CPGSPASS: N Content-transfer-encoding: base64 Content-type: text/plain; charset=euc-kr MIME-version: 1.0 Message-id: <25039060.6131344561170907.JavaMail.weblogic@epml26> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrFIsWRmVeSWpSXmKPExsVy+t/tmbrCCSoBBpOvqlt87j3C6MDo8XmT XABjFJdNSmpOZllqkb5dAlfG5emf2Aru2FTc6vnI1MA4wbqLkZNDSEBdYtGSk2wgtoSAicTr 1j3MELaYxIV769kgauYzSjzuKO1i5OBgEVCV6FlnAmKyCZhL3J8RBFIhLGAvceXnOkYQW0Qg TeJaywMgm4uDWaCBSWLJ/ztQY5Qk1ux7xQJi8woISpyc+YQFYpWqxMWV35gh4moS93p/QZ0g ITFr+gVWCJtXYkb7U6h6OYlpX9dA1UhLnJ+1gRHm5MXfH0PF+SWO3d7BBHInSO+T+8EwY3Zv /gL1rYDE1DMHoVq1JH6dec0EYfNJrFn4lgVmzK5Ty5lheu9vmQtWwyygKDGl+yE7hK0l8eXH PjZ0b/EKOEis3rSfcQKj3CwkqVlI2mchaUdWs4CRZRWjaGpBckFxUnqqsV5xYm5xaV66XnJ+ 7iZGcIw/493BOLfB4hCjAAejEg/vAyOVACHWxLLiytxDjBIczEoivCkvlAOEeFMSK6tSi/Lj i0pzUosPMUpzsCiJ837x+uovJJCeWJKanZpakFoEk2Xi4JRqYEyziP7vN+fjdKeVtod3fq7Z WyV7e8eWGfFTFvJtT9lxfdLRJdGXVoRMXn9klbfDk3k/Zs1aeFr5z6vWf4sNFly1rxQPTizb OYnxwYnqt3ufnHz/Z+rLh9O1iz1fGK8vaZs68wXTnJZ1D9ZmrGC8ekt7vtqrTu55r5ZnuSTx PN+7bueCXb8j3PKuT1NiKc5INNRiLipOBADrA9GT7QIAAA== X-TM-AS-MML: No Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org > + Myungjoo Ham, > > It used at devfreq. Mr. Ham can you explain it in detail? > > Thank you, > Kyungmin Park > , > On 8/9/12, Rafael J. Wysocki wrote: > > On Wednesday, August 08, 2012, Jonghwa Lee wrote: > >> Bus throughput metric is added to PM QoS in order to control the > >> frequency of memory interfaces and busses with PM QoS. > >> > >> Signed-off-by: Jonghwa Lee > >> Signed-off-by: Kyungmin Park > > > > I said some time ago I didn't want any new global PM QoS classes to be > > added this way. > > > > Can you please post a driver patch using this new thing? > > > > Rafael It'd be too early for V4L2 device driver QoS patches as they are undergoing major updates and the previous QoS patches over they are now obsolete. However, I've found that one QoS patch is still intact with the current one. Here goes the example driver that uses Bus-Throughput for its operation. (Fortunately, it is not V4L2, but DRM driver) It is a G2D (2D graphics acceleration) device driver that gets command lists from userspace and then process them via DMA. Many command lists finish even before any DVFS mechanism may react while the response time of a command list is still important for the user processes. Here we go: --- > > > > > >> --- > >> include/linux/pm_qos.h | 2 ++ > >> kernel/power/qos.c | 15 ++++++++++++++- > >> 2 files changed, 16 insertions(+), 1 deletions(-) > >> > >> diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h > >> index 233149c..6db4939 100644 > >> --- a/include/linux/pm_qos.h > >> +++ b/include/linux/pm_qos.h > >> @@ -15,6 +15,7 @@ enum { > >> PM_QOS_CPU_DMA_LATENCY, > >> PM_QOS_NETWORK_LATENCY, > >> PM_QOS_NETWORK_THROUGHPUT, > >> + PM_QOS_BUS_DMA_THROUGHPUT, > >> > >> /* insert new class ID */ > >> PM_QOS_NUM_CLASSES, > >> @@ -26,6 +27,7 @@ enum { > >> #define PM_QOS_NETWORK_LAT_DEFAULT_VALUE (2000 * USEC_PER_SEC) > >> #define PM_QOS_NETWORK_THROUGHPUT_DEFAULT_VALUE 0 > >> #define PM_QOS_DEV_LAT_DEFAULT_VALUE 0 > >> +#define PM_QOS_BUS_DMA_THROUGHPUT_DEFAULT_VALUE 0 > >> > >> struct pm_qos_request { > >> struct plist_node node; > >> diff --git a/kernel/power/qos.c b/kernel/power/qos.c > >> index 6a031e6..75322cc 100644 > >> --- a/kernel/power/qos.c > >> +++ b/kernel/power/qos.c > >> @@ -100,12 +100,25 @@ static struct pm_qos_object > >> network_throughput_pm_qos = { > >> .name = "network_throughput", > >> }; > >> > >> +static BLOCKING_NOTIFIER_HEAD(bus_dma_throughput_notifier); > >> +static struct pm_qos_constraints bus_dma_tput_constraints = { > >> + .list = PLIST_HEAD_INIT(bus_dma_tput_constraints.list), > >> + .target_value = PM_QOS_BUS_DMA_THROUGHPUT_DEFAULT_VALUE, > >> + .default_value = PM_QOS_BUS_DMA_THROUGHPUT_DEFAULT_VALUE, > >> + .type = PM_QOS_MAX, > >> + .notifiers = &bus_dma_throughput_notifier, > >> +}; > >> +static struct pm_qos_object bus_dma_throughput_pm_qos = { > >> + .constraints = &bus_dma_tput_constraints, > >> + .name = "bus_dma_throughput", > >> +}; > >> > >> static struct pm_qos_object *pm_qos_array[] = { > >> &null_pm_qos, > >> &cpu_dma_pm_qos, > >> &network_lat_pm_qos, > >> - &network_throughput_pm_qos > >> + &network_throughput_pm_qos, > >> + &bus_dma_throughput_pm_qos, > >> }; > >> > >> static ssize_t pm_qos_power_write(struct file *filp, const char __user > >> *buf, > >> > > > > -- > > To unsubscribe from this list: send the line "unsubscribe linux-pm" in > > the body of a message to majordomo@vger.kernel.org > > More majordomo info at http://vger.kernel.org/majordomo-info.html > > > > > > > > > diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index d2d88f2..969b2c5 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -135,6 +136,7 @@ struct g2d_data { struct workqueue_struct *g2d_workq; struct work_struct runqueue_work; struct exynos_drm_subdrv subdrv; + struct pm_qos_request_list pm_qos; bool suspended; /* cmdlist */ @@ -314,6 +316,9 @@ static void g2d_dma_start(struct g2d_data *g2d, pm_runtime_get_sync(g2d->dev); clk_enable(g2d->gate_clk); + /* 416MHz w/ 64b 30% saturating bus */ + pm_qos_update_request(&g2d->pm_qos, 1000000); + /* interrupt enable */ writel_relaxed(G2D_INTEN_ACF | G2D_INTEN_UCF | G2D_INTEN_GCF, g2d->regs + G2D_INTEN); @@ -360,6 +365,7 @@ static void g2d_runqueue_worker(struct work_struct *work) struct g2d_data *g2d = container_of(work, struct g2d_data, runqueue_work); + pm_qos_update_request(&g2d->pm_qos, 0); mutex_lock(&g2d->runqueue_mutex); clk_disable(g2d->gate_clk); @@ -841,6 +847,8 @@ static int __devinit g2d_probe(struct platform_device *pdev) goto err_free_irq; } + pm_qos_add_request(&g2d->pm_qos, PM_QOS_BUS_DMA_THROUGHPUT, 0); + dev_info(dev, "The exynos g2d(ver %d.%d) successfully probed\n", G2D_HW_MAJOR_VER, G2D_HW_MINOR_VER); @@ -872,6 +880,7 @@ static int __devexit g2d_remove(struct platform_device *pdev) struct g2d_data *g2d = platform_get_drvdata(pdev); cancel_work_sync(&g2d->runqueue_work); + pm_qos_remove_request(&g2d->pm_qos); exynos_drm_subdrv_unregister(&g2d->subdrv); free_irq(g2d->irq, g2d);