All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Linux-pm mailing list <linux-pm@lists.linux-foundation.org>,
	"Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Kernel development list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] PERF(kernel): Cleanup power events V2
Date: Wed, 27 Oct 2010 10:32:10 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1010271014280.1650-100000__41837.9809511409$1288254686$gmane$org@iolanthe.rowland.org> (raw)
In-Reply-To: <20101027122115.GA10722@Krystal>

[CC: list trimmed drastically, on the assumption that most of the 
people on it aren't very interested in the details of the PM runtime 
memory barriers.]

On Wed, 27 Oct 2010, Mathieu Desnoyers wrote:

> grep -r pm_runtime_get_noresume drivers/    hands out very interesting info.
> 
> e.g.:
> 
> drivers/usb/core/drivers.c: usb_autopm_get_interface_async()
> 
>         pm_runtime_get_noresume(&intf->dev);
>         s = ACCESS_ONCE(intf->dev.power.runtime_status);
>         if (s == RPM_SUSPENDING || s == RPM_SUSPENDED)
>                 status = pm_request_resume(&intf->dev);
> 
> How is this supposed to work ?

It's worth pointing out that this code is going to be removed during
the 2.6.38 development cycle, due to ongoing changes in the runtime PM
core.  It would have been removed already if not for the difficulty of
coordinating cross-subsystem changes.

But it's legitimate to ask how the code _was_ supposed to work...

> If the ACCESS_ONCE can be reordered before the atomic_inc(), then I fear the
> device can be suspended even after the check.

You are correct; the code as written may sometimes fail.  It was a
hack from the beginning; the kind of test it performs should not be
done outside the PM core.  However at the time it was the easiest way 
to do what I wanted.

> My point is that a get/put semantic should imply memory barriers, especially if
> these are exported APIs.

As far as I am aware, apart from the hack above,
pm_runtime_get_noresume is called only in places where either:

	it is purely advisory (e.g., we know that we will use the
	device in the near future so we would prefer to prevent it from
	being suspended, but we don't really care because we're going
	to call pm_runtime_resume_sync before using it anyway);

	or we already know that the usage_count is > 0.

No memory barrier is required for either of these cases.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Geschäftsführender Gesellschafter: Tjark Auerbach
Sitz der Gesellschaft: Tettnang
Handelsregister: Amtsgericht Ulm, HRB 630992
ALLGEMEINE GESCHÄFTSBEDINGUNGEN
Es gelten unsere Allgemeinen Geschäftsbedingungen
(AGB). Sie finden sie in der jeweils gültigen Fassung
im Internet unter http://www.avira.com/de/standard-terms-conditions-business-de
***************************************************
_______________________________________________
linux-pm mailing list
linux-pm@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/linux-pm

  parent reply	other threads:[~2010-10-27 14:32 UTC|newest]

Thread overview: 135+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1287488171-25303-1-git-send-email-trenn@suse.de>
2010-10-19 11:36 ` [PATCH 1/3] PERF: Do not export power_frequency, but power_start event Thomas Renninger
2010-10-19 11:36 ` Thomas Renninger
2010-10-19 11:36 ` [PATCH 2/3] PERF(kernel): Cleanup power events Thomas Renninger
2010-10-25  6:54   ` Arjan van de Ven
2010-10-25  6:54   ` Arjan van de Ven
2010-10-25  9:41     ` Thomas Renninger
2010-10-25 13:55       ` Arjan van de Ven
2010-10-25 13:55       ` Arjan van de Ven
2010-10-25 14:36         ` Thomas Renninger
2010-10-25 14:45           ` Arjan van de Ven
2010-10-25 14:45           ` Arjan van de Ven
2010-10-25 14:56             ` Ingo Molnar
2010-10-25 14:56             ` Ingo Molnar
2010-10-25 15:48               ` Thomas Renninger
2010-10-25 16:00                 ` Arjan van de Ven
2010-10-25 23:32                   ` Thomas Renninger
2010-10-25 23:32                   ` Thomas Renninger
2010-10-25 16:00                 ` Arjan van de Ven
2010-10-25 15:48               ` Thomas Renninger
2010-10-25 14:36         ` Thomas Renninger
2010-10-25  9:41     ` Thomas Renninger
2010-10-25  6:58   ` Arjan van de Ven
2010-10-25  6:58   ` Arjan van de Ven
2010-10-25 10:04   ` Ingo Molnar
2010-10-25 10:04   ` Ingo Molnar
2010-10-25 11:03     ` Thomas Renninger
2010-10-25 11:03     ` Thomas Renninger
2010-10-25 11:55       ` Ingo Molnar
2010-10-25 12:55         ` Thomas Renninger
2010-10-25 14:11           ` Arjan van de Ven
2010-10-25 14:11           ` Arjan van de Ven
2010-10-25 14:51             ` Thomas Renninger
2010-10-25 14:51             ` Thomas Renninger
2010-10-25 12:55         ` Thomas Renninger
2010-10-25 12:58         ` Mathieu Desnoyers
2010-10-25 12:58         ` Mathieu Desnoyers
2010-10-25 20:29           ` Rafael J. Wysocki
2010-10-25 20:29           ` Rafael J. Wysocki
2010-10-25 11:55       ` Ingo Molnar
2010-10-25 13:58       ` Arjan van de Ven
2010-10-25 13:58       ` Arjan van de Ven
2010-10-25 20:33         ` Rafael J. Wysocki
2010-10-25 20:33         ` Rafael J. Wysocki
2010-10-25 23:33   ` [PATCH] PERF(kernel): Cleanup power events V2 Thomas Renninger
2010-10-26  1:09     ` Arjan van de Ven
2010-10-26  1:09     ` Arjan van de Ven
2010-10-26  7:10     ` Ingo Molnar
2010-10-26  7:10     ` Ingo Molnar
2010-10-26  8:08       ` Jean Pihet
2010-10-26 11:21         ` Ingo Molnar
2010-10-26 11:48           ` Thomas Renninger
2010-10-26 11:48           ` Thomas Renninger
2010-10-26 11:54             ` Ingo Molnar
2010-10-26 11:54             ` Ingo Molnar
2010-10-26 13:17               ` Thomas Renninger
2010-10-26 13:35                 ` Thomas Renninger
2010-10-26 13:35                 ` Thomas Renninger
2010-10-26 13:17               ` Thomas Renninger
2010-10-26 18:57             ` Rafael J. Wysocki
2010-10-27  0:00               ` Thomas Renninger
2010-10-27  9:16                 ` Rafael J. Wysocki
2010-10-27  9:16                 ` Rafael J. Wysocki
2010-10-27  0:00               ` Thomas Renninger
2010-10-26 18:57             ` Rafael J. Wysocki
2010-10-26 11:21         ` Ingo Molnar
2010-10-26  8:08       ` Jean Pihet
2010-10-26  9:58       ` Arjan van de Ven
2010-10-26 10:19         ` Ingo Molnar
2010-10-26 10:19         ` Ingo Molnar
2010-10-26  9:58       ` Arjan van de Ven
2010-10-26 10:37       ` Thomas Renninger
2010-10-26 10:37       ` Thomas Renninger
2010-10-26 11:19         ` Ingo Molnar
2010-10-26 11:19         ` Ingo Molnar
2010-10-26 19:01           ` Rafael J. Wysocki
2010-10-26 19:01           ` Rafael J. Wysocki
2010-10-26 15:32       ` Pierre Tardy
2010-10-26 16:04         ` Arjan van de Ven
2010-10-26 16:04         ` Arjan van de Ven
2010-10-26 16:56           ` Pierre Tardy
2010-10-26 17:58             ` Peter Zijlstra
2010-10-26 18:14               ` Mathieu Desnoyers
2010-10-26 18:14               ` Mathieu Desnoyers
2010-10-26 18:50                 ` [linux-pm] " Alan Stern
2010-10-26 21:33                   ` Mathieu Desnoyers
2010-10-26 21:33                   ` [linux-pm] " Mathieu Desnoyers
2010-10-26 22:20                     ` Rafael J. Wysocki
2010-10-26 22:20                     ` [linux-pm] " Rafael J. Wysocki
2010-10-26 22:39                       ` Rafael J. Wysocki
2010-10-26 22:39                       ` [linux-pm] " Rafael J. Wysocki
2010-10-27  0:46                       ` Mathieu Desnoyers
2010-10-27 10:22                         ` Rafael J. Wysocki
2010-10-27 12:21                           ` Mathieu Desnoyers
2010-10-27 14:32                             ` Alan Stern
2010-10-27 14:32                             ` Alan Stern [this message]
2010-10-27 14:32                             ` [linux-pm] " Alan Stern
2010-10-28 15:22                               ` Alan Stern
2010-10-28 15:22                               ` [linux-pm] " Alan Stern
2010-10-27 21:43                             ` Rafael J. Wysocki
2010-10-27 21:43                             ` Rafael J. Wysocki
2010-10-27 12:21                           ` Mathieu Desnoyers
2010-10-27 10:22                         ` Rafael J. Wysocki
2010-10-27  0:46                       ` Mathieu Desnoyers
2010-10-26 18:50                 ` Alan Stern
2010-10-26 19:04                 ` Rafael J. Wysocki
2010-10-26 19:04                 ` Rafael J. Wysocki
2010-10-26 21:38                   ` Mathieu Desnoyers
2010-10-26 21:38                   ` Mathieu Desnoyers
2010-10-26 22:22                     ` Rafael J. Wysocki
2010-10-26 22:22                     ` Rafael J. Wysocki
2010-10-26 18:15               ` Pierre Tardy
2010-10-26 19:08                 ` Rafael J. Wysocki
2010-10-26 20:23                   ` Pierre Tardy
2010-10-26 20:23                   ` Pierre Tardy
2010-10-26 20:38                     ` Rafael J. Wysocki
2010-10-26 20:38                     ` Rafael J. Wysocki
2010-10-26 20:52                       ` Arjan van de Ven
2010-10-26 20:52                       ` Arjan van de Ven
2010-10-26 21:17                         ` Rafael J. Wysocki
2010-10-26 21:17                         ` Rafael J. Wysocki
2010-10-26 19:08                 ` Rafael J. Wysocki
2010-10-26 18:15               ` Pierre Tardy
2010-10-26 17:58             ` Peter Zijlstra
2010-10-26 16:56           ` Pierre Tardy
2010-10-26 15:32       ` Pierre Tardy
2010-10-26  7:59     ` Jean Pihet
2010-10-26  7:59     ` Jean Pihet
2010-10-26 18:52     ` Rafael J. Wysocki
2010-10-26 18:52     ` Rafael J. Wysocki
2010-10-25 23:33   ` Thomas Renninger
2010-10-19 11:36 ` [PATCH 2/3] PERF(kernel): Cleanup power events Thomas Renninger
2010-10-19 11:36 ` [PATCH 3/3] PERF(userspace): Adjust perf timechart to the new " Thomas Renninger
2010-10-19 11:36 ` Thomas Renninger
2010-10-26  0:18   ` [PATCH] PERF(userspace): Adjust perf timechart to the new power events V2 Thomas Renninger
2010-10-26  0:18   ` Thomas Renninger

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='Pine.LNX.4.44L0.1010271014280.1650-100000__41837.9809511409$1288254686$gmane$org@iolanthe.rowland.org' \
    --to=stern@rowland.harvard.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=paulmck@linux.vnet.ibm.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 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.