From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: myungjoo.ham@gmail.com
Cc: linux-pm@vger.kernel.org, Mark Gross <markgross@thegnar.org>,
kyungmin.park@samsung.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] PM / QoS: add pm_qos_update_request_timeout API
Date: Wed, 28 Mar 2012 12:25:48 +0200 [thread overview]
Message-ID: <201203281225.48779.rjw@sisk.pl> (raw)
In-Reply-To: <CAJ0PZbR6WW66Nr=rMELQOURaeKDA3hqUsbEsn1kAgCfDpDa2zw@mail.gmail.com>
On Wednesday, March 28, 2012, MyungJoo Ham wrote:
> 2012/3/28 Rafael J. Wysocki <rjw@sisk.pl>:
> > On Tuesday, March 27, 2012, MyungJoo Ham wrote:
> >> The new API, pm_qos_update_request_timeout() is to provide a timeout
> >> with pm_qos_update_request.
> >>
> >> For example, pm_qos_update_request_timeout(req, 100, 1000), means that
> >> QoS request on req with value 100 will be active for 1000 jiffies.
> >> After 1000 jiffies, the QoS request thru req is rolled back to the
> >> request status when pm_qos_update_request_timeout() was called. If there
> >> were another pm_qos_update_request(req, x) during the 1000 jiffies, this
> >> new request with value x will override as this is another request on the
> >> same req handle.
> >
> > Can you please update the above part of the changelog to reflect the
> > fact that microseconds are the new timeout units?
>
> Sure, I've just sent another.
>
> >
> >> A new request on the same req handle will always
> >> override the previous request whether it is the conventional request or
> >> it is the new timeout request.
> >>
> >> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> >> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> >> Acked-by: Mark Gross <markgross@thegnar.org>
> >
> > It is kind of too late for the 3.4 merge window, so I'd prefer to keep that
> > for the v3.5 cycle, unless you urgently need it in v3.4, in which case please
> > let me know.
> >
> > Thanks,
> > Rafael
> >
>
> Could you please put it with 3.4 if possible? We want to use this
> feature with 3.4.
Can you please give any details, if possible?
Rafael
> >> --
> >> Changes from v3
> >> - The timeout value is expresses in us (1/1000000 sec), not ms (1/1000 sec).
> >> Changes from v2
> >> - Rebased to avoid merge conflict
> >> Chages from v1(RFC)
> >> - The semmantics of timeout changed. A timeout now means that the
> >> corresponding qos-req object is being cancelled, not rolling back to
> >> the qos request state at the time of API call. With this changes,
> >> combined with the conventional update_request API, there exists up to
> >> only one qos request per qos-req object.
> >> - The timeout value is expressed in ms (1/1000 sec), not jiffies.
> >> - Style changes, removing unnecessary changes.
> >> - Bugfixes regarding pending timeout work.
> >> ---
> >> include/linux/pm_qos.h | 4 +++
> >> kernel/power/qos.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
> >> 2 files changed, 54 insertions(+), 0 deletions(-)
> >>
> >> diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h
> >> index c8a541e..18689737 100644
> >> --- a/include/linux/pm_qos.h
> >> +++ b/include/linux/pm_qos.h
> >> @@ -8,6 +8,7 @@
> >> #include <linux/notifier.h>
> >> #include <linux/miscdevice.h>
> >> #include <linux/device.h>
> >> +#include <linux/workqueue.h>
> >>
> >> enum {
> >> PM_QOS_RESERVED = 0,
> >> @@ -29,6 +30,7 @@ enum {
> >> struct pm_qos_request {
> >> struct plist_node node;
> >> int pm_qos_class;
> >> + struct delayed_work work; /* for pm_qos_update_request_timeout */
> >> };
> >>
> >> struct dev_pm_qos_request {
> >> @@ -73,6 +75,8 @@ void pm_qos_add_request(struct pm_qos_request *req, int pm_qos_class,
> >> s32 value);
> >> void pm_qos_update_request(struct pm_qos_request *req,
> >> s32 new_value);
> >> +void pm_qos_update_request_timeout(struct pm_qos_request *req,
> >> + s32 new_value, unsigned long timeout_us);
> >> void pm_qos_remove_request(struct pm_qos_request *req);
> >>
> >> int pm_qos_request(int pm_qos_class);
> >> diff --git a/kernel/power/qos.c b/kernel/power/qos.c
> >> index d6d6dbd..6a031e6 100644
> >> --- a/kernel/power/qos.c
> >> +++ b/kernel/power/qos.c
> >> @@ -230,6 +230,21 @@ int pm_qos_request_active(struct pm_qos_request *req)
> >> EXPORT_SYMBOL_GPL(pm_qos_request_active);
> >>
> >> /**
> >> + * pm_qos_work_fn - the timeout handler of pm_qos_update_request_timeout
> >> + * @work: work struct for the delayed work (timeout)
> >> + *
> >> + * This cancels the timeout request by falling back to the default at timeout.
> >> + */
> >> +static void pm_qos_work_fn(struct work_struct *work)
> >> +{
> >> + struct pm_qos_request *req = container_of(to_delayed_work(work),
> >> + struct pm_qos_request,
> >> + work);
> >> +
> >> + pm_qos_update_request(req, PM_QOS_DEFAULT_VALUE);
> >> +}
> >> +
> >> +/**
> >> * pm_qos_add_request - inserts new qos request into the list
> >> * @req: pointer to a preallocated handle
> >> * @pm_qos_class: identifies which list of qos request to use
> >> @@ -253,6 +268,7 @@ void pm_qos_add_request(struct pm_qos_request *req,
> >> return;
> >> }
> >> req->pm_qos_class = pm_qos_class;
> >> + INIT_DELAYED_WORK(&req->work, pm_qos_work_fn);
> >> pm_qos_update_target(pm_qos_array[pm_qos_class]->constraints,
> >> &req->node, PM_QOS_ADD_REQ, value);
> >> }
> >> @@ -279,6 +295,9 @@ void pm_qos_update_request(struct pm_qos_request *req,
> >> return;
> >> }
> >>
> >> + if (delayed_work_pending(&req->work))
> >> + cancel_delayed_work_sync(&req->work);
> >> +
> >> if (new_value != req->node.prio)
> >> pm_qos_update_target(
> >> pm_qos_array[req->pm_qos_class]->constraints,
> >> @@ -287,6 +306,34 @@ void pm_qos_update_request(struct pm_qos_request *req,
> >> EXPORT_SYMBOL_GPL(pm_qos_update_request);
> >>
> >> /**
> >> + * pm_qos_update_request_timeout - modifies an existing qos request temporarily.
> >> + * @req : handle to list element holding a pm_qos request to use
> >> + * @new_value: defines the temporal qos request
> >> + * @timeout_us: the effective duration of this qos request in usecs.
> >> + *
> >> + * After timeout_us, this qos request is cancelled automatically.
> >> + */
> >> +void pm_qos_update_request_timeout(struct pm_qos_request *req, s32 new_value,
> >> + unsigned long timeout_us)
> >> +{
> >> + if (!req)
> >> + return;
> >> + if (WARN(!pm_qos_request_active(req),
> >> + "%s called for unknown object.", __func__))
> >> + return;
> >> +
> >> + if (delayed_work_pending(&req->work))
> >> + cancel_delayed_work_sync(&req->work);
> >> +
> >> + if (new_value != req->node.prio)
> >> + pm_qos_update_target(
> >> + pm_qos_array[req->pm_qos_class]->constraints,
> >> + &req->node, PM_QOS_UPDATE_REQ, new_value);
> >> +
> >> + schedule_delayed_work(&req->work, usecs_to_jiffies(timeout_us));
> >> +}
> >> +
> >> +/**
> >> * pm_qos_remove_request - modifies an existing qos request
> >> * @req: handle to request list element
> >> *
> >> @@ -305,6 +352,9 @@ void pm_qos_remove_request(struct pm_qos_request *req)
> >> return;
> >> }
> >>
> >> + if (delayed_work_pending(&req->work))
> >> + cancel_delayed_work_sync(&req->work);
> >> +
> >> pm_qos_update_target(pm_qos_array[req->pm_qos_class]->constraints,
> >> &req->node, PM_QOS_REMOVE_REQ,
> >> PM_QOS_DEFAULT_VALUE);
> >>
> >
>
>
>
>
next prev parent reply other threads:[~2012-03-28 10:21 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-14 5:16 [RFC PATCH] PM / QoS: add pm_qos_update_request_timeout API MyungJoo Ham
2012-02-14 22:08 ` Rafael J. Wysocki
2012-02-15 6:44 ` MyungJoo Ham
2012-02-19 21:14 ` mark gross
2012-02-22 8:43 ` MyungJoo Ham
2012-02-29 4:56 ` [PATCH v2] " MyungJoo Ham
2012-03-07 5:06 ` [PATCH v3] " MyungJoo Ham
2012-03-24 16:35 ` mark gross
2012-03-26 1:41 ` MyungJoo Ham
2012-03-26 3:02 ` mark gross
2012-03-26 11:57 ` MyungJoo Ham
2012-03-26 20:42 ` Rafael J. Wysocki
2012-03-27 6:31 ` [PATCH v4] " MyungJoo Ham
2012-03-27 22:03 ` Rafael J. Wysocki
2012-03-28 1:47 ` [PATCH v4 resend] " MyungJoo Ham
2012-03-28 21:55 ` Rafael J. Wysocki
2012-03-28 1:53 ` [PATCH v4] " MyungJoo Ham
2012-03-28 10:25 ` Rafael J. Wysocki [this message]
2012-03-24 16:41 ` [PATCH v3] " mark gross
2012-03-24 18:37 ` mark gross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201203281225.48779.rjw@sisk.pl \
--to=rjw@sisk.pl \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=markgross@thegnar.org \
--cc=myungjoo.ham@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox