All of lore.kernel.org
 help / color / mirror / Atom feed
* tty vs workqueue oddities
@ 2011-06-02  7:17 Benjamin Herrenschmidt
  2011-06-02  8:37 ` tty breakage in X (Was: tty vs workqueue oddities) Benjamin Herrenschmidt
  2011-06-02 10:03 ` tty vs workqueue oddities Alan Cox
  0 siblings, 2 replies; 17+ messages in thread
From: Benjamin Herrenschmidt @ 2011-06-02  7:17 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel@vger.kernel.org

Hi Alan !

Current upstream (but that's been around for at least 2 or 3 days) seems
to have a strange behaviour on one of my powerbooks. Something like
"dmesg" or "cat" of a large file in an X terminal "hangs" the machine
litterally for minutes. It generally recovers, so not always.

Network is unresponsive as well.

My attempts at stopping it into xmon always landed in process_one_work()
or flush_to_ldisc() from what I can tell, and a simple ftrace run shows
something that looks like an -enormous- lot of:

     kworker/0:1-258   [000]   412.105871: flush_to_ldisc <-process_one_work
     kworker/0:1-258   [000]   412.105871: tty_ldisc_ref <-flush_to_ldisc
     kworker/0:1-258   [000]   412.105872: n_tty_receive_buf <-flush_to_ldisc
     kworker/0:1-258   [000]   412.105872: kill_fasync <-n_tty_receive_buf
     kworker/0:1-258   [000]   412.105873: __wake_up <-n_tty_receive_buf
     kworker/0:1-258   [000]   412.105873: __wake_up_common <-__wake_up
     kworker/0:1-258   [000]   412.105874: default_wake_function <-__wake_up_common
     kworker/0:1-258   [000]   412.105874: try_to_wake_up <-default_wake_function
     kworker/0:1-258   [000]   412.105874: tty_throttle <-n_tty_receive_buf
     kworker/0:1-258   [000]   412.105875: mutex_lock <-tty_throttle
     kworker/0:1-258   [000]   412.105875: mutex_unlock <-tty_throttle
     kworker/0:1-258   [000]   412.105876: schedule_work <-flush_to_ldisc
     kworker/0:1-258   [000]   412.105876: queue_work <-schedule_work
     kworker/0:1-258   [000]   412.105877: queue_work_on <-queue_work
     kworker/0:1-258   [000]   412.105877: __queue_work <-queue_work_on
     kworker/0:1-258   [000]   412.105878: insert_work <-__queue_work
     kworker/0:1-258   [000]   412.105878: tty_ldisc_deref <-flush_to_ldisc
     kworker/0:1-258   [000]   412.105879: put_ldisc <-tty_ldisc_deref
     kworker/0:1-258   [000]   412.105879: __wake_up <-put_ldisc
     kworker/0:1-258   [000]   412.105880: __wake_up_common <-__wake_up
     kworker/0:1-258   [000]   412.105880: cwq_dec_nr_in_flight <-process_one_work
     kworker/0:1-258   [000]   412.105880: process_one_work <-worker_thread

   and repeat that sequence more/less identical ad nauseum

Sometimes it breaks out and makes progress, usually after a few mn.

2.6.39 is fine. I'm going to attempt a bisection but it's a bit slow on
those machines and I'm running out of time today, so I wanted to shoot
that to you in case it rings a bell.

Cheers,
Ben.



^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: tty breakage in X (Was: tty vs workqueue oddities)
@ 2011-06-03 10:23 Milton Miller
  0 siblings, 0 replies; 17+ messages in thread
From: Milton Miller @ 2011-06-03 10:23 UTC (permalink / raw)
  To: Linus Torvalds, Greg Kroah-Hartman
  Cc: linux-kernel, Alan Cox, Benjamin Herrenschmidt, Stefan Bigler,
	Toby Gray, Felipe Balbi

[not on list so made up cc list]

On Fri Jun 03 2011 about 05:37:52 EST, Linus wrote:
> On Fri, Jun 3, 2011 at 3:56 PM, Benjamin Herrenschmidt wrote:
> > So I think my theory stands that flush_to_ldisc constantly reschedule
> > itself causing the worker thread to eat all CPU and starve the consumer
> > of the PTY. I won't have time to dig much deeper today nor probably this
> > week-end so I'm sending this email for others who want to look.
> 
> Gaah - that commit is total and utter crap.
> 
> I *removed* the whole "reschedule the work queue again" crap. It was
> totally wrong. See commit a5660b41af6a.
> 
> But then commit b1c43f82c5aa added the crap right back in.
> 
> So does it all work if you just remove the broken schedule_work() line
> from flush_to_ldisc?
> 
> Otherwise we'll need to just revert it. The commit is clearly totally broken.

Its further broken in that the recieve_buf functions return -ERRORS
but the callers don't check for negative values.

milton

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2011-06-08  9:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-02  7:17 tty vs workqueue oddities Benjamin Herrenschmidt
2011-06-02  8:37 ` tty breakage in X (Was: tty vs workqueue oddities) Benjamin Herrenschmidt
2011-06-02  9:30   ` Andreas Schwab
2011-06-02 10:07   ` Alan Cox
2011-06-03  0:56     ` Benjamin Herrenschmidt
2011-06-03  6:17       ` Benjamin Herrenschmidt
2011-06-03  6:56         ` Benjamin Herrenschmidt
2011-06-03  9:36           ` Linus Torvalds
2011-06-05 14:37             ` Guillaume Chazarain
2011-06-06 14:24               ` Guillaume Chazarain
2011-06-08  2:44                 ` Linus Torvalds
2011-06-08  3:31                   ` Linus Torvalds
2011-06-08  8:31                     ` Guillaume Chazarain
2011-06-08  8:28                   ` Felipe Balbi
2011-06-08  9:04                   ` Alan Cox
2011-06-02 10:03 ` tty vs workqueue oddities Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2011-06-03 10:23 tty breakage in X (Was: tty vs workqueue oddities) Milton Miller

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.