All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Ganesh Mahendran <opensource.ganesh@gmail.com>
Cc: rjw@rjwysocki.net, len.brown@intel.com, rafael@kernel.org,
	gregkh@linuxfoundation.org, geert@linux-m68k.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] PM / wakeup: use seq_open() to show wakeup stats
Date: Sun, 29 Apr 2018 16:30:02 +0200	[thread overview]
Message-ID: <20180429143002.GC13475@amd> (raw)
In-Reply-To: <1524653971-10425-1-git-send-email-opensource.ganesh@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1346 bytes --]

On Wed 2018-04-25 18:59:31, Ganesh Mahendran wrote:
> single_open() interface requires that the whole output must
> fit into a single buffer. This will lead to timeout when
> system memory is not in a good situation.
> 
> This patch use seq_open() to show wakeup stats. This method
> need only one page, so timeout will not be observed.

Sounds like magic.

> -static int wakeup_sources_stats_show(struct seq_file *m, void *unused)
> +static void *wakeup_sources_stats_seq_start(struct seq_file *m,
> +					loff_t *pos)
>  {
...
> -	srcuidx = srcu_read_lock(&wakeup_srcu);
> -	list_for_each_entry_rcu(ws, &wakeup_sources, entry)
> -		print_wakeup_source_stats(m, ws);
> -	srcu_read_unlock(&wakeup_srcu, srcuidx);
> +	*srcuidx = srcu_read_lock(&wakeup_srcu);
> +	list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
> +		if (n-- <= 0)
> +			return ws;
> +	}
> +
> +	return NULL;
> +}
...
> +static void wakeup_sources_stats_seq_stop(struct seq_file *m, void *v)
> +{
> +	int *srcuidx = m->private;
> +
> +	srcu_read_unlock(&wakeup_srcu, *srcuidx);
> +}

But you are holding srcu_lock over return to userspace, and somehow I
don't think that's permitted?
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

  reply	other threads:[~2018-04-29 14:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 10:59 [PATCH v3] PM / wakeup: use seq_open() to show wakeup stats Ganesh Mahendran
2018-04-29 14:30 ` Pavel Machek [this message]
2018-05-02  2:26   ` Ganesh Mahendran
2018-05-13  8:46 ` 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=20180429143002.GC13475@amd \
    --to=pavel@ucw.cz \
    --cc=geert@linux-m68k.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=opensource.ganesh@gmail.com \
    --cc=rafael@kernel.org \
    --cc=rjw@rjwysocki.net \
    /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.