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=-8.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 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 2D2B6CA9EBB for ; Mon, 4 Nov 2019 02:42:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B13B217F5 for ; Mon, 4 Nov 2019 02:42:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="A367mhJl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729002AbfKDCmd (ORCPT ); Sun, 3 Nov 2019 21:42:33 -0500 Received: from mailout3.samsung.com ([203.254.224.33]:62601 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728850AbfKDCmc (ORCPT ); Sun, 3 Nov 2019 21:42:32 -0500 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20191104024230epoutp030c3c307732903fdae37ec6abc01a7aeb~T1WsVnQj30484804848epoutp03C for ; Mon, 4 Nov 2019 02:42:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20191104024230epoutp030c3c307732903fdae37ec6abc01a7aeb~T1WsVnQj30484804848epoutp03C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1572835350; bh=Rs2gEr8eGJ5NgzXa3Z0pO2e5Rj3/ugs6+FpAD8JnSL8=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=A367mhJllYVA47d955aMXaiWsl72lm9dwD3FcpNygbbdPA5GAWKn+A/VzTpIWV1XW BURELkgvcYsS9OnC8VcehijtRCcv8uZHaIN8ByWe/hN/aireIL36lIoIevZ5lskd1d wiov518ny4Y5p+L9UvfD+TtOTL5lWsC1y8nrx6kU= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20191104024230epcas1p4da07407c569c3a29abf3a6639ac27e44~T1Wr2XrJX0777807778epcas1p4N; Mon, 4 Nov 2019 02:42:30 +0000 (GMT) Received: from epsmges1p1.samsung.com (unknown [182.195.40.153]) by epsnrtp3.localdomain (Postfix) with ESMTP id 475xsc19kszMqYkb; Mon, 4 Nov 2019 02:42:28 +0000 (GMT) Received: from epcas1p4.samsung.com ( [182.195.41.48]) by epsmges1p1.samsung.com (Symantec Messaging Gateway) with SMTP id 81.94.04144.4109FBD5; Mon, 4 Nov 2019 11:42:28 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p3.samsung.com (KnoxPortal) with ESMTPA id 20191104024227epcas1p3b97700a2c0993f70ac93b96c58520cd7~T1WpbadNn2000620006epcas1p3A; Mon, 4 Nov 2019 02:42:27 +0000 (GMT) Received: from epsmgms1p2new.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20191104024227epsmtrp14ad00803c4709fc7224f4457988104a0~T1Wpamahp2085620856epsmtrp1k; Mon, 4 Nov 2019 02:42:27 +0000 (GMT) X-AuditID: b6c32a35-2c7ff70000001030-65-5dbf90143a97 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 3F.AD.25663.3109FBD5; Mon, 4 Nov 2019 11:42:27 +0900 (KST) Received: from [10.113.221.102] (unknown [10.113.221.102]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20191104024227epsmtip28530c548515f2a0d7914e5256be9fdf4~T1WpJe-Lc0256902569epsmtip2v; Mon, 4 Nov 2019 02:42:27 +0000 (GMT) Subject: Re: [PATCH v8 15/18] PM / devfreq: Add new interrupt_driven flag for governors To: Dmitry Osipenko , Thierry Reding , MyungJoo Ham , Kyungmin Park , Jonathan Hunter , Tomeu Vizoso , Peter Geis , =?UTF-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: linux-pm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org From: Chanwoo Choi Organization: Samsung Electronics Message-ID: Date: Mon, 4 Nov 2019 11:48:06 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191103204130.2172-16-digetx@gmail.com> Content-Language: en-US Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA01TeUzTcBTOry1dUae1gjyXqFjxD1BwFYeditGIOgMxJMZETQg00DDC1i3t 5hkTFcNhxAv/wHoj3lGMIgEMTMeCDkVR4i1eEBUv4gHxiNGVYuS/7733fe+973dQONNAmqg8 ySPKkuBgySFETVOsOT5ipy/DrF6n+DOfOxG/Ra0g+NbNHwx8e/1+kv9aGkB8yTeV5PvetCD+ yaaTJN/6OpX/UX+Q4LefvUvOHWqr7ahEtjq1w2ArLfhE2tTCRtK2vfo0sn29MC6dXJk/2y4K OaIcLUrZrpw8KTeZTV2aOT/TkmTm4jkrP4ONlgSnmMympKXHL8xzhNZjo1cJDm8olS4oCjt1 zmzZ5fWI0XaX4klmRXeOw211JyiCU/FKuQnZLudMzmyeZgkRs/LtN2/VYO5Hk9b0bNqFb0Tf xm5F4RTQ02G3vwXfioZQDF2L4Mb9soHgC4KKYBXSWAzdh6D+Z/w/RdufZ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2gxMmZT1hAbE4BM4nD j/uZIZapS/yZdwnKFpe49WQ+1BHyEs1bZzNPYBSehaR9FpKWWUhaZiFpWcDIsopRMrWgODc9 t9iwwCgvtVyvODG3uDQvXS85P3cTIzgCtbR2MJ44EX+IUYCDUYmH9wXn/lgh1sSy4srcQ4wS HMxKIrwXZ+yNFeJNSaysSi3Kjy8qzUktPsQozcGiJM4rn38sUkggPbEkNTs1tSC1CCbLxMEp 1cCo+kfLPu9mRdNCnVL5p99MdWzqJcvWJljk7m74PjVv6lR9l0mq+f8NlQ+/3bPXVS/DemWd eGGDudKSWRsm1C++lDu5Lqzr4Zf/2zM2Sm2rEPorlXHunKZOKa/rVhaxc6aaZicnhW0JVshb 53D/4Fvmw0HlDfOdti1i2Wuif+C/fPH141Kye9KUWIozEg21mIuKEwG94ZJOvAIAAA== X-CMS-MailID: 20191104024227epcas1p3b97700a2c0993f70ac93b96c58520cd7 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20191103204257epcas1p4ce6f9ae729ed6cf6df1816237c80ee45 References: <20191103204130.2172-1-digetx@gmail.com> <20191103204130.2172-16-digetx@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dmitry, Sorry for the additional comment of this patch. I think that you better to change the 'interrupt_driven' checking style as following in order to keep the consistency of governor flag checking style. diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 27de8ddeaaa8..fe409fc1bcc4 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -410,9 +410,11 @@ static void devfreq_monitor(struct work_struct *work) */ void devfreq_monitor_start(struct devfreq *devfreq) { + if (devfreq->governor->interrupt_driven) + return; + INIT_DEFERRABLE_WORK(&devfreq->work, devfreq_monitor); if (devfreq->profile->polling_ms && - !devfreq->governor->interrupt_driven) queue_delayed_work(devfreq_wq, &devfreq->work, msecs_to_jiffies(devfreq->profile->polling_ms)); } @@ -475,12 +477,15 @@ void devfreq_monitor_resume(struct devfreq *devfreq) if (!devfreq->stop_polling) goto out; + if (devfreq->governor->interrupt_driven) + goto out_update; + if (!delayed_work_pending(&devfreq->work) && devfreq->profile->polling_ms && - !devfreq->governor->interrupt_driven) queue_delayed_work(devfreq_wq, &devfreq->work, msecs_to_jiffies(devfreq->profile->polling_ms)); +out_update: devfreq->last_stat_updated = jiffies; devfreq->stop_polling = false; If you edit it as following, feel free to add my reviewed-by tag: Reviewed-by: Chanwoo Choi On 19. 11. 4. 오전 5:41, Dmitry Osipenko wrote: > Currently interrupt-driven governors (like NVIDIA Tegra30 ACTMON governor) > are used to set polling_ms=0 in order to avoid periodic polling of device > status by devfreq core. This means that polling interval can't be changed > by userspace for such governors. > > The new governor flag allows interrupt-driven governors to convey that > devfreq core shouldn't perform polling of device status and thus generic > devfreq polling interval could be supported by these governors now. > > Signed-off-by: Dmitry Osipenko > --- > drivers/devfreq/devfreq.c | 9 +++++++-- > drivers/devfreq/governor.h | 3 +++ > 2 files changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c > index b905963cea7d..a711a76d386e 100644 > --- a/drivers/devfreq/devfreq.c > +++ b/drivers/devfreq/devfreq.c > @@ -410,7 +410,8 @@ static void devfreq_monitor(struct work_struct *work) > void devfreq_monitor_start(struct devfreq *devfreq) > { > INIT_DEFERRABLE_WORK(&devfreq->work, devfreq_monitor); > - if (devfreq->profile->polling_ms) > + if (devfreq->profile->polling_ms && > + !devfreq->governor->interrupt_driven) > queue_delayed_work(devfreq_wq, &devfreq->work, > msecs_to_jiffies(devfreq->profile->polling_ms)); > } > @@ -474,7 +475,8 @@ void devfreq_monitor_resume(struct devfreq *devfreq) > goto out; > > if (!delayed_work_pending(&devfreq->work) && > - devfreq->profile->polling_ms) > + devfreq->profile->polling_ms && > + !devfreq->governor->interrupt_driven) > queue_delayed_work(devfreq_wq, &devfreq->work, > msecs_to_jiffies(devfreq->profile->polling_ms)); > > @@ -509,6 +511,9 @@ void devfreq_interval_update(struct devfreq *devfreq, unsigned int *delay) > if (devfreq->stop_polling) > goto out; > > + if (devfreq->governor->interrupt_driven) > + goto out; > + > /* if new delay is zero, stop polling */ > if (!new_delay) { > mutex_unlock(&devfreq->lock); > diff --git a/drivers/devfreq/governor.h b/drivers/devfreq/governor.h > index bbe5ff9fcecf..dc7533ccc3db 100644 > --- a/drivers/devfreq/governor.h > +++ b/drivers/devfreq/governor.h > @@ -31,6 +31,8 @@ > * @name: Governor's name > * @immutable: Immutable flag for governor. If the value is 1, > * this govenror is never changeable to other governor. > + * @interrupt_driven: Devfreq core won't schedule polling work for this > + * governor if value is set to 1. > * @get_target_freq: Returns desired operating frequency for the device. > * Basically, get_target_freq will run > * devfreq_dev_profile.get_dev_status() to get the > @@ -49,6 +51,7 @@ struct devfreq_governor { > > const char name[DEVFREQ_NAME_LEN]; > const unsigned int immutable; > + const unsigned int interrupt_driven; > int (*get_target_freq)(struct devfreq *this, unsigned long *freq); > int (*event_handler)(struct devfreq *devfreq, > unsigned int event, void *data); > -- Best Regards, Chanwoo Choi Samsung Electronics