All of lore.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
	Greg KH <gregkh@suse.de>, LKML <linux-kernel@vger.kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>,
	Arjan van de Ven <arjan@infradead.org>
Subject: Re: [RFC][PATCH] PM: Introduce core framework for run-time PM of I/O devices (rev. 8)
Date: Wed, 8 Jul 2009 13:40:06 +0900	[thread overview]
Message-ID: <aec7e5c30907072140y7dd3b4c7ge7cb0b750bef3226@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0907072222210.13052-100000@netrider.rowland.org>

On Wed, Jul 8, 2009 at 11:54 AM, Alan Stern<stern@rowland.harvard.edu> wrote:
> On Wed, 8 Jul 2009, Rafael J. Wysocki wrote:
>
>> > I've now jumped from v5 to v8 and I feel that the code is getting
>> > cleaner and cleaner. Very nice.
>>
>> That's mostly thanks to Alan.
>
> I haven't had time yet to look through the new code.  Things have been
> very busy.
>
>> > Issue 1:
>> > ------------
>> > Device drivers which do not perform any hardware access in probe()
>> > work fine. During software setup in probe() the runtime pm code is
>> > initialized with the following:
>> >
>> > +   pm_suspend_ignore_children(&dev->dev, true);
>> > +   pm_runtime_set_suspended(&dev->dev);
>> > +   pm_runtime_enable(&dev->dev);
>> >
>> > Before accessing hardware I perform:
>> > +   pm_runtime_resume(pd->dev);
>> >
>> > When done with the hardware I do:
>> > +   pm_runtime_suspend(pd->dev);
>> >
>> > Not so complicated. Am I supposed to initialize something else as well?
>
> No, that's all you need.

Ok, thank you!

>> > All good with the code above, but there seem to be some issue with how
>> > usage_count is counted up and down and when runtime_disabled is set:
>> >
>> > 1. pm_runtime_init(): usage_count = 1, runtime_disabled = true
>> > 2. driver_probe_device(): pm_runtime_get_sync()
>> > 3. pm_runtime_get_sync(): usage_count = 2
>> > 4. device driver probe(): pm_runtime_enable()
>> > 5. pm_runtime_enable(): usage_count = 1
>> > 6. driver_probe_device(): pm_runtime_put()
>> > 7. pm_runtime_put(): usage_count = 0
>> >
>> > I expect runtime_disabled = false in 7.
>
> Wasn't it?  It should have been set to false in step 4 and remained
> that way.

I may misunderstand, but in v8 won't the pm_runtime_enable() function
do a atomic_dec_test() where the counter value will go from 2 to 1 in
the case above? This would mean that atomic_dec_test() returns false
so runtime_disabled is never modified.

Thanks for your feedback,

/ magnus
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Magnus Damm <magnus.damm@gmail.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
	Greg KH <gregkh@suse.de>, LKML <linux-kernel@vger.kernel.org>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>,
	Arjan van de Ven <arjan@infradead.org>
Subject: Re: [RFC][PATCH] PM: Introduce core framework for run-time PM of I/O  devices (rev. 8)
Date: Wed, 8 Jul 2009 13:40:06 +0900	[thread overview]
Message-ID: <aec7e5c30907072140y7dd3b4c7ge7cb0b750bef3226@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0907072222210.13052-100000@netrider.rowland.org>

On Wed, Jul 8, 2009 at 11:54 AM, Alan Stern<stern@rowland.harvard.edu> wrote:
> On Wed, 8 Jul 2009, Rafael J. Wysocki wrote:
>
>> > I've now jumped from v5 to v8 and I feel that the code is getting
>> > cleaner and cleaner. Very nice.
>>
>> That's mostly thanks to Alan.
>
> I haven't had time yet to look through the new code.  Things have been
> very busy.
>
>> > Issue 1:
>> > ------------
>> > Device drivers which do not perform any hardware access in probe()
>> > work fine. During software setup in probe() the runtime pm code is
>> > initialized with the following:
>> >
>> > +   pm_suspend_ignore_children(&dev->dev, true);
>> > +   pm_runtime_set_suspended(&dev->dev);
>> > +   pm_runtime_enable(&dev->dev);
>> >
>> > Before accessing hardware I perform:
>> > +   pm_runtime_resume(pd->dev);
>> >
>> > When done with the hardware I do:
>> > +   pm_runtime_suspend(pd->dev);
>> >
>> > Not so complicated. Am I supposed to initialize something else as well?
>
> No, that's all you need.

Ok, thank you!

>> > All good with the code above, but there seem to be some issue with how
>> > usage_count is counted up and down and when runtime_disabled is set:
>> >
>> > 1. pm_runtime_init(): usage_count = 1, runtime_disabled = true
>> > 2. driver_probe_device(): pm_runtime_get_sync()
>> > 3. pm_runtime_get_sync(): usage_count = 2
>> > 4. device driver probe(): pm_runtime_enable()
>> > 5. pm_runtime_enable(): usage_count = 1
>> > 6. driver_probe_device(): pm_runtime_put()
>> > 7. pm_runtime_put(): usage_count = 0
>> >
>> > I expect runtime_disabled = false in 7.
>
> Wasn't it?  It should have been set to false in step 4 and remained
> that way.

I may misunderstand, but in v8 won't the pm_runtime_enable() function
do a atomic_dec_test() where the counter value will go from 2 to 1 in
the case above? This would mean that atomic_dec_test() returns false
so runtime_disabled is never modified.

Thanks for your feedback,

/ magnus

  parent reply	other threads:[~2009-07-08  4:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-06  0:52 [RFC][PATCH] PM: Introduce core framework for run-time PM of I/O devices (rev. 8) Rafael J. Wysocki
2009-07-07 15:12 ` Magnus Damm
2009-07-07 15:12 ` Magnus Damm
2009-07-07 15:12   ` Magnus Damm
2009-07-07 22:07   ` Rafael J. Wysocki
2009-07-08  2:54     ` Alan Stern
2009-07-08  4:40       ` Magnus Damm
2009-07-08  4:40       ` Magnus Damm [this message]
2009-07-08  4:40         ` Magnus Damm
2009-07-08 14:26         ` Alan Stern
2009-07-08 14:26           ` Alan Stern
2009-07-08 17:50           ` [update][RFC][PATCH] PM: Introduce core framework for run-time PM of I/O devices (rev. 9) Rafael J. Wysocki
2009-07-08 17:50           ` Rafael J. Wysocki
2009-07-08 14:26         ` [RFC][PATCH] PM: Introduce core framework for run-time PM of I/O devices (rev. 8) Alan Stern
2009-07-08  2:54     ` Alan Stern
2009-07-08  5:45     ` Magnus Damm
2009-07-08  5:45     ` Magnus Damm
2009-07-08  5:45       ` Magnus Damm
2009-07-08 19:01       ` Rafael J. Wysocki
2009-07-08 19:42         ` Alan Stern
2009-07-08 19:42         ` Alan Stern
2009-07-08 19:55           ` Rafael J. Wysocki
2009-07-08 21:09             ` Alan Stern
2009-07-08 21:29               ` Rafael J. Wysocki
2009-07-08 21:29               ` Rafael J. Wysocki
2009-07-08 21:29               ` Rafael J. Wysocki
2009-07-08 21:29               ` Rafael J. Wysocki
2009-07-08 21:09             ` Alan Stern
2009-07-08 19:55           ` Rafael J. Wysocki
2009-07-09  2:52           ` Magnus Damm
2009-07-09  2:52           ` Magnus Damm
2009-07-09  2:52             ` Magnus Damm
2009-07-09 13:48             ` Alan Stern
2009-07-09 15:31               ` Magnus Damm
2009-07-09 15:31               ` Magnus Damm
2009-07-09 15:31                 ` Magnus Damm
2009-07-09 21:56                 ` Mahalingam, Nithish
2009-07-09 21:56                 ` [linux-pm] " Mahalingam, Nithish
2009-07-09 21:56                   ` Mahalingam, Nithish
2009-07-11 11:08                   ` Rafael J. Wysocki
2009-07-11 11:08                   ` [linux-pm] " Rafael J. Wysocki
2009-07-12  2:05                     ` Mahalingam, Nithish
2009-07-12  2:05                     ` [linux-pm] " Mahalingam, Nithish
2009-07-13  1:42                   ` Magnus Damm
2009-07-13  1:42                     ` [linux-pm] " Magnus Damm
2009-07-09 13:48             ` Alan Stern
2009-07-08 19:01       ` Rafael J. Wysocki
2009-07-07 22:07   ` Rafael J. Wysocki
2009-07-09 23:22 ` Pavel Machek
2009-07-09 23:22   ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2009-07-06  0:52 Rafael J. Wysocki

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=aec7e5c30907072140y7dd3b4c7ge7cb0b750bef3226@mail.gmail.com \
    --to=magnus.damm@gmail.com \
    --cc=arjan@infradead.org \
    --cc=gregkh@suse.de \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mingo@elte.hu \
    --cc=rjw@sisk.pl \
    --cc=stern@rowland.harvard.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.