public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: linas@austin.ibm.com (Linas Vepstas)
To: Andy Whitcroft <apw@shadowen.org>
Cc: gregkh@suse.de, paulus@samba.org, Andrew Morton <akpm@osdl.org>,
	linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Re: 2.6.21-rc7-mm2 -- hvsi console driver registration failure
Date: Fri, 4 May 2007 14:04:08 -0500	[thread overview]
Message-ID: <20070504190408.GN6193@austin.ibm.com> (raw)
In-Reply-To: <4fe4528cb20beb569a8f2ac817c776e5@pinky>

On Fri, May 04, 2007 at 12:38:58PM +0100, Andy Whitcroft wrote:
> 
> Trying to get 2.6.21-rc7-mm2 to boot on large PPC64 seems to be a
> bit of a challenge.  We have been seeing panics on boot from the
> hvsi driver:
> 
> 	Couldn't register hvsi console driver
> 
> Tracking this back, this seems to come from hvsi driver trying to
> register itself via tty_register_driver() with a zero units.
> 
> The failure is triggered by a change in semantics for kmalloc()
> between SLAB and SLUB; kmalloc(0) now returns NULL rather than an
> allocation at the smallest size.  Looking at the code in question
> even when the allocation succeeds we will not actually use the
> memory when device->num is zero.
> 
> It is not clear to me if this is a bug in the hvsi driver in that
> it should specify some units.  It seems we will try and reserve zero
> devices in this case, which seems pointless.

Yes, it seems pointless to me ... 

> I have tested with the patch below which seems safe to me and stops
> the errors and even seems to make the console work.  But perhaps
> someone with more driver fu, could verify if driver->num of zero
> has any meaning and kick this to the hvsi people if not.

Hollis nominated me to be "hvsi people", although I'm near-totally
ignorant of the thing.

If hvsi_count is zero, then the device tree did not have any
"serial" nodes that speak "hvterm-protocol". The hvsi should not 
have even tried to register anything. The attached patch seems more 
to the point.

--linas


The hvsi driver is used whenever the device-tree contains
nodes for serial ports, and those serial ports speak the hvterm
protocol. However, if no such nodes are found, then the hvsi
driver should not even register. 

This patch avoids a kernel panic with "Couldn't register hvsi 
console driver". 

In addition, this patch makes tty_register_driver refuse
to do anything, if there are no actual tty ports to be 
registered.

Utterly & completely untested.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>

----
 drivers/char/hvsi.c   |    4 ++++
 drivers/char/tty_io.c |    3 +++
 2 files changed, 7 insertions(+)

Index: linux-2.6.21-rc7-mm2/drivers/char/hvsi.c
===================================================================
--- linux-2.6.21-rc7-mm2.orig/drivers/char/hvsi.c	2007-04-26 15:37:33.000000000 -0500
+++ linux-2.6.21-rc7-mm2/drivers/char/hvsi.c	2007-05-04 13:55:56.000000000 -0500
@@ -1148,6 +1148,10 @@ static int __init hvsi_init(void)
 {
 	int i;
 
+	/* No serial hvterm-protocol device-tree nodes found. */
+	if (hvsi_count == 0)
+		return 0;
+
 	hvsi_driver = alloc_tty_driver(hvsi_count);
 	if (!hvsi_driver)
 		return -ENOMEM;
Index: linux-2.6.21-rc7-mm2/drivers/char/tty_io.c
===================================================================
--- linux-2.6.21-rc7-mm2.orig/drivers/char/tty_io.c	2007-04-26 15:37:33.000000000 -0500
+++ linux-2.6.21-rc7-mm2/drivers/char/tty_io.c	2007-05-04 13:54:14.000000000 -0500
@@ -3724,6 +3724,9 @@ int tty_register_driver(struct tty_drive
 	if (driver->flags & TTY_DRIVER_INSTALLED)
 		return 0;
 
+	if (driver->num == 0)
+		return -ENODEV;
+
 	if (!(driver->flags & TTY_DRIVER_DEVPTS_MEM)) {
 		p = kmalloc(driver->num * 3 * sizeof(void *), GFP_KERNEL);
 		if (!p)

  reply	other threads:[~2007-05-04 19:04 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-26  5:57 2.6.21-rc7-mm2 Andrew Morton
2007-04-26 11:47 ` 2.6.21-rc7-mm2 Gabriel C
2007-04-26 20:37   ` 2.6.21-rc7-mm2 Andrew Morton
2007-04-26 20:46     ` 2.6.21-rc7-mm2 Randy Dunlap
2007-04-29  8:05       ` 2.6.21-rc7-mm2 Geert Uytterhoeven
2007-04-26 20:57     ` 2.6.21-rc7-mm2 Timur Tabi
2007-04-26 21:13       ` 2.6.21-rc7-mm2 Gabriel C
2007-04-26 21:33       ` 2.6.21-rc7-mm2 Andrew Morton
2007-04-26 12:16 ` 2.6.21-rc7-mm2 -- x86_64 VDSO compile error Andy Whitcroft
2007-04-26 13:27   ` Mel Gorman
2007-04-26 14:11     ` Andi Kleen
2007-04-26 14:31       ` Mel Gorman
2007-04-26 14:13     ` 2.6.21-rc7-mm2 -- x86_64 VDSO compile error II Andi Kleen
2007-04-26 14:39       ` Mel Gorman
2007-04-26 15:20         ` Mel Gorman
2007-04-26 15:24           ` Andi Kleen
2007-04-26 15:45             ` Mel Gorman
2007-04-27  0:39               ` Andi Kleen
2007-04-27  8:59                 ` Mel Gorman
2007-04-27 15:50                   ` [PATCH] Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu fix Mel Gorman
2007-04-27 16:34                     ` Andi Kleen
2007-04-27 16:49                       ` Mel Gorman
2007-04-26 12:30 ` 2.6.21-rc7-mm2 -- x86_64 blade hard hangs Andy Whitcroft
2007-04-26 13:51   ` Andi Kleen
2007-04-26 13:33     ` Mel Gorman
2007-04-26 14:46       ` Mel Gorman
2007-04-26 17:40         ` Mel Gorman
     [not found]           ` <20070426234002.GH5475@linux-os.sc.intel.com>
     [not found]             ` <20070427110709.GE3645@skynet.ie>
2007-04-27 17:54               ` Siddha, Suresh B
2007-04-27 23:59                 ` Mel Gorman
2007-04-26 13:17 ` 2.6.21-rc7-mm2 Andy Whitcroft
2007-04-26 13:41   ` 2.6.21-rc7-mm2 -- PPC link failure Andy Whitcroft
2007-04-26 18:14     ` Andy Whitcroft
2007-04-26 18:27       ` Christoph Lameter
2007-04-26 18:40         ` Andy Whitcroft
2007-04-26 18:49           ` Christoph Lameter
2007-04-26 19:12           ` Christoph Lameter
2007-04-26 19:48             ` Andy Whitcroft
2007-04-26 20:23               ` Christoph Lameter
2007-04-27 16:55                 ` Andy Whitcroft
2007-04-27 16:58                   ` Christoph Lameter
2007-04-26 18:25 ` [PATCH] mm/memory.c: remove warning from an uninitialized spinlock. was: Re: 2.6.21-rc7-mm2 Borislav Petkov
2007-04-28  0:22   ` Andrew Morton
2007-04-28  0:27     ` Jeremy Fitzhardinge
2007-04-28  5:57     ` Borislav Petkov
2007-04-28  6:25       ` Borislav Petkov
2007-04-28  6:54         ` Andrew Morton
2007-04-28  7:03         ` Jeremy Fitzhardinge
2007-04-28 23:48     ` Andy Whitcroft
2007-04-29  3:25       ` Andrew Morton
2007-04-29  6:50       ` Borislav Petkov
2007-04-29  8:19         ` Andrew Morton
2007-04-29  9:24         ` Andrew Morton
2007-04-29 21:36           ` Dave Jones
2007-04-29 21:45             ` Andrew Morton
2007-11-07 19:20           ` Steven Rostedt
2007-11-08  5:15             ` Borislav Petkov
2007-04-26 23:47 ` [-mm patch] make drivers/hwmon/applesmc.c:backlight_work static Adrian Bunk
2007-04-26 23:47 ` [-mm patch] unexport highlevel_host_reset Adrian Bunk
2007-04-27  0:16   ` Stefan Richter
2007-04-27  2:31 ` 2.6.21-rc7-mm2 breaks 'lvm vgscan' Valdis.Kletnieks
2007-04-27  2:55   ` Andrew Morton
2007-05-05 18:04   ` Valdis.Kletnieks
2007-04-28 17:56 ` 2.6.21-rc7-mm2 crash: Eeek! page_mapcount(page) went negative! (-1) Tilman Schmidt
2007-04-28 21:10   ` Andrew Morton
2007-04-28 22:06     ` Hugh Dickins
2007-04-30 17:17     ` Tilman Schmidt
2007-04-30 18:21       ` Andrew Morton
2007-04-30 19:28         ` Tilman Schmidt
2007-04-30 19:46           ` Andrew Morton
2007-04-30 21:32             ` Tilman Schmidt
2007-05-01 11:26             ` Tilman Schmidt
2007-05-02  3:10               ` Greg KH
2007-05-02  7:01             ` Tilman Schmidt
2007-05-02  7:02               ` Greg KH
2007-05-02  7:10               ` Andrew Morton
2007-05-02  7:28                 ` Greg KH
2007-05-02  7:43                 ` Greg KH
2007-05-02  9:41                   ` Tilman Schmidt
2007-05-02 22:06                     ` Greg KH
2007-05-02 12:14                   ` Kay Sievers
2007-05-02  7:52                 ` Greg KH
2007-05-02 17:36                   ` Tilman Schmidt
2007-05-02 20:07                     ` Andrew Morton
2007-05-02 21:22                       ` Tilman Schmidt
2007-05-02  7:10               ` Nick Piggin
2007-04-28 19:19 ` [-mm patch] make drivers/misc/thinkpad_acpi:fan_mutex static Adrian Bunk
2007-04-28 19:58   ` Henrique de Moraes Holschuh
2007-04-29  1:53     ` Len Brown
2007-04-29  2:50     ` Adrian Bunk
2007-04-29  4:09       ` Henrique de Moraes Holschuh
2007-04-28 19:19 ` [-mm patch] MMC: make tifm_sd_set_dma_data() static Adrian Bunk
2007-05-01 14:14   ` Pierre Ossman
2007-04-28 19:20 ` [-mm patch] drivers/rtc/rtc-dev.c should #include "rtc-core.h" Adrian Bunk
2007-04-28 19:20 ` [-mm patch] scsi/lpfc/lpfc_init.c: remove unused variable Adrian Bunk
2007-04-29 19:19 ` 2.6.21-rc7-mm2 Dan Kruchinin
2007-04-29 19:48   ` 2.6.21-rc7-mm2 Andrew Morton
2007-04-30  5:01 ` 2.6.21-rc7-mm2 hangs in boot Randy Dunlap
2007-04-30  5:23   ` Andrew Morton
2007-04-30 15:16     ` Randy Dunlap
2007-04-30 23:51       ` 2.6.21-rc7-mm2 hangs in boot (netconsole) Randy Dunlap
2007-05-01  0:12         ` Andrew Morton
2007-05-01  0:45           ` Randy Dunlap
2007-05-01  1:08             ` Andrew Morton
2007-05-01  3:43               ` Andi Kleen
2007-05-01  5:16                 ` Randy Dunlap
2007-05-01  5:23                   ` Andrew Morton
2007-05-01  6:24                     ` Andi Kleen
2007-05-01  5:38                       ` Andrew Morton
2007-05-01 16:15                         ` Randy Dunlap
2007-05-01  6:22                   ` Andi Kleen
2007-05-01 16:22                     ` Randy Dunlap
2007-05-01 17:26                       ` Randy Dunlap
2007-05-04 11:38 ` [PATCH] Re: 2.6.21-rc7-mm2 -- hvsi console driver registration failure Andy Whitcroft
2007-05-04 19:04   ` Linas Vepstas [this message]
2007-05-04 20:09   ` Andrew Morton
2007-05-04 21:21     ` Christoph Lameter

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=20070504190408.GN6193@austin.ibm.com \
    --to=linas@austin.ibm.com \
    --cc=akpm@osdl.org \
    --cc=apw@shadowen.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.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