linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Zimmer <nzimmer@sgi.com>
To: Nathan Zimmer <nzimmer@sgi.com>
Cc: Holger Hans Peter Freyther <holger@freyther.de>,
	linux-kernel@vger.kernel.org
Subject: Re: /proc/timer_list and weird behavior with dropbear
Date: Fri, 19 Jul 2013 15:37:07 -0500	[thread overview]
Message-ID: <20130719203707.GA149061@asylum.americas.sgi.com> (raw)
In-Reply-To: <20130719203323.GA129438@asylum.americas.sgi.com>

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

On Fri, Jul 19, 2013 at 03:33:24PM -0500, Nathan Zimmer wrote:
> On Fri, Jul 19, 2013 at 07:03:54PM +0200, Holger Hans Peter Freyther wrote:
> > On Fri, Jul 19, 2013 at 10:45:15AM -0500, Nathan Zimmer wrote:
> > 
> > > I hadn't noticed anything.
> > > Let me try your program and see what I may have missed.
> > 
> > Hi,
> > 
> > I neither know the semantics of the timer_list nor how to use
> > seq_file correctly. What happens is that timer_list_next will only
> > be called once. This means that iter->cpu will never be increased.
> > 
> > This just moves to the next CPU when stop is called (e.g. nothing
> > was added once the print_tickdevice was printed). Do you think
> > this could be correct?
> > 
> > 
> > 
> > diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
> > index 3bdf283..8d36a3d 100644
> > --- a/kernel/time/timer_list.c
> > +++ b/kernel/time/timer_list.c
> > @@ -327,8 +327,10 @@ static void *timer_list_next(struct seq_file *file, void *v, loff_t *offset)
> >  	return timer_list_start(file, offset);
> >  }
> >  
> > -static void timer_list_stop(struct seq_file *seq, void *v)
> > +static void timer_list_stop(struct seq_file *file, void *v)
> >  {
> > +	struct timer_list_iter *iter = file->private;
> > +	iter->cpu = cpumask_next(iter->cpu, cpu_online_mask);
> >  }
> >  
> >  static const struct seq_operations timer_list_sops = {
> 
> 
> I think this would be an acceptable fix.
> It work file locally.  Could you check it out to see if it behaves?
> 
> Nate

Forgot the patch last time.
Sorry


[-- Attachment #2: tlfix.patch --]
[-- Type: text/x-patch, Size: 1041 bytes --]

diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index 3bdf283..a3620ec 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -305,24 +305,26 @@ static void *timer_list_start(struct seq_file *file, loff_t *offset)
 	if (!*offset) {
 		iter->cpu = -1;
 		iter->now = ktime_to_ns(ktime_get());
-	} else if (iter->cpu >= nr_cpu_ids) {
+	} else {
+		iter->cpu = cpumask_next(iter->cpu, cpu_online_mask);
+		if (iter->cpu >= nr_cpu_ids) {
 #ifdef CONFIG_GENERIC_CLOCKEVENTS
-		if (!iter->second_pass) {
-			iter->cpu = -1;
-			iter->second_pass = true;
-		} else
-			return NULL;
+			if (!iter->second_pass) {
+				iter->cpu = -1;
+				iter->second_pass = true;
+			} else
+				return NULL;
 #else
-		return NULL;
+			return NULL;
 #endif
+		}
 	}
+
 	return iter;
 }
 
 static void *timer_list_next(struct seq_file *file, void *v, loff_t *offset)
 {
-	struct timer_list_iter *iter = file->private;
-	iter->cpu = cpumask_next(iter->cpu, cpu_online_mask);
 	++*offset;
 	return timer_list_start(file, offset);
 }

  reply	other threads:[~2013-07-19 20:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19 15:28 /proc/timer_list and weird behavior with dropbear Holger Hans Peter Freyther
2013-07-19 15:45 ` Nathan Zimmer
2013-07-19 17:03   ` Holger Hans Peter Freyther
2013-07-19 19:05     ` Nathan Zimmer
2013-07-19 20:33     ` Nathan Zimmer
2013-07-19 20:37       ` Nathan Zimmer [this message]
2013-07-20  5:43         ` Holger Hans Peter Freyther
2013-07-22 21:18           ` [PATCH] timer_list: Correct the show function for timer_list by using iter->now Nathan Zimmer
2013-07-23  7:18             ` Holger Hans Peter Freyther
2013-07-23 22:50               ` Nathan Zimmer
2013-07-24 14:31               ` [PATCH] timer_list: Correct the iterator for timer_list Nathan Zimmer

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=20130719203707.GA149061@asylum.americas.sgi.com \
    --to=nzimmer@sgi.com \
    --cc=holger@freyther.de \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).