mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Fulghum <paulkf@microgate.com>
To: Jurjen Oskam <jurjen@stupendous.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: Badness in local_bh_enable at kernel/softirq.c:122
Date: 27 May 2004 15:41:07 -0500	[thread overview]
Message-ID: <1085690466.2434.16.camel@toshiba> (raw)
In-Reply-To: <20040527174509.GA1654@quadpro.stupendous.org>

On Thu, 2004-05-27 at 12:45, Jurjen Oskam wrote:
> Hi there,
> 
> I'm using pptp-linux to connect to my ADSL-provider. I've been doing this
> for several years now, without significant problems. A week ago, I
> upgraded
> 
> May 27 11:35:41 calvin kernel: Badness in local_bh_enable at kernel/softirq.c:122
> May 27 11:35:41 calvin kernel: Call Trace:
> May 27 11:35:41 calvin kernel:  [<c011ac00>] local_bh_enable+0x60/0x80
> May 27 11:35:41 calvin kernel:  [<c4cc2b54>] ppp_sync_push+0x54/0x140 [ppp_synctty]
> May 27 11:35:41 calvin kernel:  [<c4cc25a5>] ppp_sync_wakeup+0x25/0x60 [ppp_synctty]
> May 27 11:35:41 calvin kernel:  [<c01f20e7>] pty_unthrottle+0x47/0x60
> May 27 11:35:41 calvin kernel:  [<c01eefb1>] check_unthrottle+0x31/0x40
> May 27 11:35:41 calvin kernel:  [<c01ef02b>] n_tty_flush_buffer+0xb/0x60
> May 27 11:35:41 calvin kernel:  [<c01f2488>] pty_flush_buffer+0x48/0x60
> May 27 11:35:41 calvin kernel:  [<c01ec116>] do_tty_hangup+0x2d6/0x340

I've been looking at this and the culprit is in
drivers/char/tty_io.c, function do_tty_hangup():

	lock_kernel();

        ...

	/* FIXME! What are the locking issues here? This may me overdoing things..
	* this question is especially important now that we've removed the irqlock. */
	{
		unsigned long flags;

		local_irq_save(flags); // FIXME: is this safe?
		if (tty->ldisc.flush_buffer)
			tty->ldisc.flush_buffer(tty);
		if (tty->driver->flush_buffer)
			tty->driver->flush_buffer(tty);
		if ((test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) &&
		    tty->ldisc.write_wakeup)
			(tty->ldisc.write_wakeup)(tty);
		local_irq_restore(flags); // FIXME: is this safe?
	}

        ...

	unlock_kernel();

I do not see that disabling the local CPU interrupts for the
flush_buffer and write_wakeup calls is needed. In fact
doing so provokes the warning message in softirq.c
when write_wakeup is called.

All of these functions are also invoked by ioctl calls
which do not disable the local IRQ (ioctl is protected
by lock_kernel/unlock_kernel just like do_tty_hangup).

So the flush_buffer/write_wakeup calls do *not*
need IRQs disabled (in fact need them enabled to
avoid the warning as is the case on ioctl).

Since the IRQ is restored immediately after these 3
calls, it does not seem to serve a purpose for the calling
function either.

The solution, in my opinion, is to remove the IRQ
disabling surrounding these 3 functions in do_tty_hangup.


-- 
Paul Fulghum
paulkf@microgate.com


  parent reply	other threads:[~2004-05-27 20:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-27 17:45 Jurjen Oskam
2004-05-27 18:19 ` Jurjen Oskam
2004-05-27 20:41 ` Paul Fulghum [this message]
2004-05-28 18:42 ` [PATCH][RFC] 2.6.6 tty_io.c hangup locking Paul Fulghum
2004-05-28 20:11   ` Jurjen Oskam
2004-05-28 20:33     ` Paul Fulghum
2004-05-28 23:06   ` Andrew Morton
2004-05-29 17:45     ` Paul Fulghum
2004-06-01 20:51     ` [PATCH] 2.6.6 synclinkmp.c Paul Fulghum
2004-06-01 20:57       ` Russell King
2004-06-01 21:25         ` Paul Fulghum
2004-06-02 21:22           ` Russell King
2004-06-02 22:04             ` Paul Fulghum
2004-06-02 14:13         ` Paul Fulghum
2004-06-01 20:51     ` [PATCH] 2.6.6 synclink.c Paul Fulghum
2004-06-02 14:15       ` Paul Fulghum
2004-06-01 20:53     ` [PATCH] 2.6.6 synclink_cs.c Paul Fulghum
2004-06-01 21:00       ` Russell King
2004-06-01 23:04         ` Paul Fulghum
2004-06-13  9:05   ` [PATCH][RFC] 2.6.6 tty_io.c hangup locking Jurjen Oskam
2004-06-13 13:29     ` Paul Fulghum
2004-06-13 14:24       ` Jurjen Oskam
2004-06-13 14:39         ` Paul Fulghum

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=1085690466.2434.16.camel@toshiba \
    --to=paulkf@microgate.com \
    --cc=jurjen@stupendous.org \
    --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

all inboxes | Powered by JetHome®