public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] i2c updates for 2.6.27, round 1
@ 2008-07-14 20:49 Jean Delvare
  2008-07-16  8:23 ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1) Ingo Molnar
  0 siblings, 1 reply; 13+ messages in thread
From: Jean Delvare @ 2008-07-14 20:49 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Ben-cy1Wll9GaHOsTnJN9+BGXg, Linux I2C, Dooks, LKML

Hi Linus,

Please pull the first round of i2c subsystem updates for Linux 2.6.27
from:

git://jdelvare.pck.nerim.net/jdelvare-2.6 i2c-for-linus

There are two new i2c bus driver (i2c-cpm and i2c-isch), one new i2c
chip driver (at24), three bus drivers removed (i2c-i810, i2c-prosavage
and i2c-savage4), and many many improvements to both i2c-core and
pretty much every individual driver.

 Documentation/feature-removal-schedule.txt |    7 -
 Documentation/i2c/busses/i2c-i810          |   47 --
 Documentation/i2c/busses/i2c-prosavage     |   23 -
 Documentation/i2c/busses/i2c-savage4       |   26 -
 Documentation/i2c/fault-codes              |  127 +++++
 Documentation/i2c/smbus-protocol           |    4 +-
 Documentation/i2c/writing-clients          |   51 ++-
 MAINTAINERS                                |    7 +
 arch/mips/sibyte/swarm/Makefile            |    1 +
 arch/mips/sibyte/swarm/swarm-i2c.c         |   37 ++
 drivers/i2c/algos/i2c-algo-bit.c           |    4 +-
 drivers/i2c/algos/i2c-algo-pca.c           |    2 +-
 drivers/i2c/algos/i2c-algo-pcf.c           |   48 ++-
 drivers/i2c/busses/Kconfig                 |  715 +++++++++++++--------------
 drivers/i2c/busses/Makefile                |   57 ++-
 drivers/i2c/busses/i2c-ali1535.c           |   38 +-
 drivers/i2c/busses/i2c-ali1563.c           |   38 +-
 drivers/i2c/busses/i2c-ali15x3.c           |   32 +-
 drivers/i2c/busses/i2c-amd756-s4882.c      |    4 +-
 drivers/i2c/busses/i2c-amd756.c            |   35 +-
 drivers/i2c/busses/i2c-amd8111.c           |   54 ++-
 drivers/i2c/busses/i2c-au1550.c            |  130 +++--
 drivers/i2c/busses/i2c-cpm.c               |  745 ++++++++++++++++++++++++++++
 drivers/i2c/busses/i2c-davinci.c           |   89 +++-
 drivers/i2c/busses/i2c-elektor.c           |    4 +-
 drivers/i2c/busses/i2c-gpio.c              |    2 +-
 drivers/i2c/busses/i2c-hydra.c             |    3 -
 drivers/i2c/busses/i2c-i801.c              |  284 +++++------
 drivers/i2c/busses/i2c-i810.c              |  260 ----------
 drivers/i2c/busses/i2c-ibm_iic.c           |  206 +--------
 drivers/i2c/busses/i2c-iop3xx.c            |    2 +-
 drivers/i2c/busses/i2c-isch.c              |  339 +++++++++++++
 drivers/i2c/busses/i2c-mpc.c               |    2 +-
 drivers/i2c/busses/i2c-mv64xxx.c           |    2 +-
 drivers/i2c/busses/i2c-nforce2-s4985.c     |  257 ++++++++++
 drivers/i2c/busses/i2c-nforce2.c           |   49 ++-
 drivers/i2c/busses/i2c-ocores.c            |   44 ++-
 drivers/i2c/busses/i2c-pasemi.c            |    2 +-
 drivers/i2c/busses/i2c-pca-platform.c      |    2 +-
 drivers/i2c/busses/i2c-piix4.c             |   73 ++--
 drivers/i2c/busses/i2c-pmcmsp.c            |    2 +-
 drivers/i2c/busses/i2c-prosavage.c         |  325 ------------
 drivers/i2c/busses/i2c-pxa.c               |    2 +-
 drivers/i2c/busses/i2c-s3c2410.c           |    2 +-
 drivers/i2c/busses/i2c-savage4.c           |  185 -------
 drivers/i2c/busses/i2c-sibyte.c            |    8 +-
 drivers/i2c/busses/i2c-sis5595.c           |   29 +-
 drivers/i2c/busses/i2c-sis630.c            |   59 ++-
 drivers/i2c/busses/i2c-sis96x.c            |   37 +-
 drivers/i2c/busses/i2c-stub.c              |    6 +-
 drivers/i2c/busses/i2c-taos-evm.c          |    5 +-
 drivers/i2c/busses/i2c-via.c               |    5 +-
 drivers/i2c/busses/i2c-viapro.c            |   31 +-
 drivers/i2c/busses/i2c-voodoo3.c           |    2 -
 drivers/i2c/busses/scx200_acb.c            |    2 +-
 drivers/i2c/chips/Kconfig                  |   43 ++-
 drivers/i2c/chips/Makefile                 |    1 +
 drivers/i2c/chips/at24.c                   |  583 ++++++++++++++++++++++
 drivers/i2c/chips/eeprom.c                 |   81 ++--
 drivers/i2c/chips/max6875.c                |    4 +-
 drivers/i2c/chips/pca9539.c                |   25 +-
 drivers/i2c/chips/pcf8574.c                |   25 +-
 drivers/i2c/chips/pcf8591.c                |   33 +-
 drivers/i2c/i2c-core.c                     |  575 +++++++++++++++++-----
 drivers/i2c/i2c-dev.c                      |   12 +-
 drivers/video/fb_ddc.c                     |    1 +
 drivers/video/intelfb/intelfb_i2c.c        |   12 +-
 drivers/video/matrox/i2c-matroxfb.c        |   20 +-
 include/linux/i2c-algo-pcf.h               |    8 +-
 include/linux/i2c-id.h                     |    3 -
 include/linux/i2c.h                        |   46 ++-
 include/linux/i2c/at24.h                   |   28 +
 72 files changed, 3844 insertions(+), 2208 deletions(-)
 delete mode 100644 Documentation/i2c/busses/i2c-i810
 delete mode 100644 Documentation/i2c/busses/i2c-prosavage
 delete mode 100644 Documentation/i2c/busses/i2c-savage4
 create mode 100644 Documentation/i2c/fault-codes
 create mode 100644 arch/mips/sibyte/swarm/swarm-i2c.c
 create mode 100644 drivers/i2c/busses/i2c-cpm.c
 delete mode 100644 drivers/i2c/busses/i2c-i810.c
 create mode 100644 drivers/i2c/busses/i2c-isch.c
 create mode 100644 drivers/i2c/busses/i2c-nforce2-s4985.c
 delete mode 100644 drivers/i2c/busses/i2c-prosavage.c
 delete mode 100644 drivers/i2c/busses/i2c-savage4.c
 create mode 100644 drivers/i2c/chips/at24.c
 create mode 100644 include/linux/i2c/at24.h

---------------

Adrian Bunk (1):
      i2c: Remove 3 deprecated bus drivers

Alan Cox (1):
      i2c: Push ioctl BKL down into the i2c code

Alek Du (1):
      i2c: Add Intel SCH SMBus support

Dave Young (1):
      i2c: Use class_for_each_device

David Brownell (6):
      i2c: Document standard fault codes
      i2c-core: Return -Errno, not -1
      i2c: Kerneldoc for most I/O calls
      i2c: i2c_use_client() defends against NULL
      i2c: Bus drivers return -Errno not -1
      i2c: Deprecate the legacy gpio drivers

Eric Brower (1):
      i2c-algo-pcf: Multi-master lost-arbitration improvement

Jean Delvare (24):
      i2c-nforce2: Add support for multiplexing on the Tyan S4985
      i2c-core: Remove needless include
      i2c: Group bus drivers by type
      i2c: Delete unused function i2c_smbus_write_quick
      i2c: Update stray references to smbus_access
      i2c-piix4: Various cleanups and minor fixes
      i2c: Consistently reject unsupported transactions
      i2c: Simplify i2c_del_driver()
      i2c: Let framebuffer drivers set their I2C bus class to DDC
      i2c: Let bus drivers add SPD to their class
      i2c/eeprom: Only probe buses with DDC or SPD class
      i2c/eeprom: Fall back to SMBus read word transactions
      i2c: Simplify i2c_device_probe
      i2c-algo-pcf: Drop unused struct members
      i2c-i801: Remove verbose debugging messages
      i2c-i801: Properly report bus arbitration loss
      i2c-i801: Rename local variable temp to status
      i2c-i801: Fix handling of error conditions
      i2c: Check for ACPI resource conflicts
      i2c: Drop stray references to lm_sensors
      i2c-dev: Delete empty detach_client callback
      i2c: Clean up old chip drivers
      i2c: Call client_unregister for new-style devices too
      i2c: Add detection capability to new-style drivers

Jochen Friedrich (2):
      i2c: Add support for I2C bus on Freescale CPM1/CPM2 controllers
      i2c: Add MAINTAINER entry for i2c-cpm

Jon Smirl (1):
      i2c: Export the i2c_bus_type symbol

Maciej W. Rozycki (1):
      i2c-sibyte: SWARM I2C board initialization

Manuel Lauss (2):
      i2c-ocores: basic PM support
      i2c-au1550: Fix PM support

Matthias Kaehlcke (1):
      i2c: Use list_for_each_entry_safe

Mike Frysinger (1):
      i2c-bfin-twi: Update the dependencies

Sean MacLennan (1):
      i2c-ibm_iic: Register child nodes

Stefan Roese (2):
      i2c-ibm_iic: Remove deprecated OCP style part
      i2c-ibm_iic: Enable driver for all PPC4xx variants in arch/powerpc

Troy Kisky (5):
      i2c-davinci: Ensure clock between 7-12 MHz
      i2c-davinci: Move dev_dbg statement for more output
      i2c-davinci: Remove useless IVR read
      i2c-davinci: Fix signal handling bug
      i2c-davinci: Initialize cmd_complete sooner

Uli Luckas (1):
      i2c-pxa: Initialize early

Wolfram Sang (4):
      i2c-pca-algo: Fix error code
      i2c-pca-platform: Fix error code
      i2c-cpm: Bugfixes
      i2c: New-style EEPROM driver using device IDs

Thanks,
-- 
Jean Delvare

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

* [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1)
  2008-07-14 20:49 [GIT PULL] i2c updates for 2.6.27, round 1 Jean Delvare
@ 2008-07-16  8:23 ` Ingo Molnar
  2008-07-16  9:07   ` Jean Delvare
  0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2008-07-16  8:23 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Linux I2C, LKML, Ben Dooks, Greg KH


hi Jean,

* Jean Delvare <khali@linux-fr.org> wrote:

>       i2c-nforce2: Add support for multiplexing on the Tyan S4985

-tip random boot testing started triggering the following upstream boot 
crash, starting two days ago when the i2c tree was merged:

[   11.772002] kobject (ffff81003e8c4160): tried to init an initialized object, something is seriously wrong.
[   11.784004] Pid: 1, comm: swapper Not tainted 2.6.26-00007-g279e902-dirty #19896
[   11.793651] 
[   11.793651] Call Trace:
[   11.793651]  [<ffffffff8054471a>] kobject_init+0x7a/0x80
[   11.798969]  [<ffffffff805f0f9d>] device_initialize+0x2d/0xd0
[   11.806323]  [<ffffffff805f19a1>] device_register+0x11/0x20
[   11.811903]  [<ffffffff8087ee3b>] i2c_register_adapter+0xab/0x1d0
[   11.817666]  [<ffffffff8087f0e6>] i2c_add_adapter+0x96/0xb0
[   11.823761]  [<ffffffff81196372>] nforce2_s4985_init+0x272/0x370
[   11.829358]  [<ffffffff8027516a>] ? getnstimeofday+0x3a/0xc0
[   11.835365]  [<ffffffff802728ba>] ? ktime_get_ts+0x4a/0x60
[   11.840853]  [<ffffffff81196100>] ? nforce2_s4985_init+0x0/0x370
[   11.846859]  [<ffffffff81160aa3>] kernel_init+0x123/0x300
[   11.852261]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
[   11.857957]  [<ffffffff80228548>] child_rip+0xa/0x12
[   11.863781]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
[   11.868757]  [<ffffffff81160980>] ? kernel_init+0x0/0x300
[   11.874160]  [<ffffffff8022853e>] ? child_rip+0x0/0x12
[   11.879989] 
[   11.881141] general protection fault: 0000 [1] SMP 
[   11.881141] CPU 1 

with this config:

   http://redhat.com/~mingo/misc/config-Wed_Jul_16_02_26_04_CEST_2008.bad

today i had time to do a bisection run, and it came up with this commit:

| 279e902445557897707d325182916a6e28ba80de is first bad commit
| commit 279e902445557897707d325182916a6e28ba80de
| Author: Jean Delvare <khali@linux-fr.org>
| Date:   Mon Jul 14 22:38:21 2008 +0200
|
|    i2c-nforce2: Add support for multiplexing on the Tyan S4985

the crash is reproducible and i can test any fix patch in short order. 
As a quick temporary hack i've reverted this patch for now via the patch 
below, to keep the tests going. (Can send more details about the 
test-system if needed.)

btw., Greg, the kobject debugging check and output is really nice, 
informative and useful! It likely pinpoints the real bug here.

	Ingo

----------------->
commit 244439bcf780ac3ecbb427acd43d3444f9254008
Author: Ingo Molnar <mingo@elte.hu>
Date:   Wed Jul 16 10:17:30 2008 +0200

    Revert "i2c-nforce2: Add support for multiplexing on the Tyan S4985"
    
    This reverts commit 279e902445557897707d325182916a6e28ba80de.
    
    Boot test failure with:
    
      http://redhat.com/~mingo/misc/config-Wed_Jul_16_02_26_04_CEST_2008.bad
    
    causes this crash:
    
    [   11.772002] kobject (ffff81003e8c4160): tried to init an initialized object, something is seriously wrong.
    [   11.784004] Pid: 1, comm: swapper Not tainted 2.6.26-00007-g279e902-dirty #19896
    [   11.793651]
    [   11.793651] Call Trace:
    [   11.793651]  [<ffffffff8054471a>] kobject_init+0x7a/0x80
    [   11.798969]  [<ffffffff805f0f9d>] device_initialize+0x2d/0xd0
    [   11.806323]  [<ffffffff805f19a1>] device_register+0x11/0x20
    [   11.811903]  [<ffffffff8087ee3b>] i2c_register_adapter+0xab/0x1d0
    [   11.817666]  [<ffffffff8087f0e6>] i2c_add_adapter+0x96/0xb0
    [   11.823761]  [<ffffffff81196372>] nforce2_s4985_init+0x272/0x370
    [   11.829358]  [<ffffffff8027516a>] ? getnstimeofday+0x3a/0xc0
    [   11.835365]  [<ffffffff802728ba>] ? ktime_get_ts+0x4a/0x60
    [   11.840853]  [<ffffffff81196100>] ? nforce2_s4985_init+0x0/0x370
    [   11.846859]  [<ffffffff81160aa3>] kernel_init+0x123/0x300
    [   11.852261]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
    [   11.857957]  [<ffffffff80228548>] child_rip+0xa/0x12
    [   11.863781]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
    [   11.868757]  [<ffffffff81160980>] ? kernel_init+0x0/0x300
    [   11.874160]  [<ffffffff8022853e>] ? child_rip+0x0/0x12
    [   11.879989]
    [   11.881141] general protection fault: 0000 [1] SMP
    [   11.881141] CPU 1
    
    Conflicts:
    
    	drivers/i2c/busses/Kconfig
    	drivers/i2c/busses/Makefile
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 drivers/i2c/busses/Kconfig             |   37 ++---
 drivers/i2c/busses/Makefile            |    1 -
 drivers/i2c/busses/i2c-nforce2-s4985.c |  257 --------------------------------
 drivers/i2c/busses/i2c-nforce2.c       |   16 --
 4 files changed, 12 insertions(+), 299 deletions(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 6ee997b..2a3819d 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -136,28 +136,15 @@ config I2C_PIIX4
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-piix4.
 
-config I2C_NFORCE2
-	tristate "Nvidia nForce2, nForce3 and nForce4"
-	depends on PCI
-	help
-	  If you say yes to this option, support will be included for the Nvidia
-	  nForce2, nForce3 and nForce4 families of mainboard I2C interfaces.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called i2c-nforce2.
-
-config I2C_NFORCE2_S4985
-	tristate "SMBus multiplexing on the Tyan S4985"
-	depends on I2C_NFORCE2 && EXPERIMENTAL
+config I2C_MV64XXX
+	tristate "Marvell mv64xxx I2C Controller"
+	depends on (MV64X60 || PLAT_ORION) && EXPERIMENTAL
 	help
-	  Enabling this option will add specific SMBus support for the Tyan
-	  S4985 motherboard.  On this 4-CPU board, the SMBus is multiplexed
-	  over 4 different channels, where the various memory module EEPROMs
-	  live.  Saying yes here will give you access to these in addition
-	  to the trunk.
+	  If you say yes to this option, support will be included for the
+	  built-in I2C interface on the Marvell 64xxx line of host bridges.
 
 	  This driver can also be built as a module.  If so, the module
-	  will be called i2c-nforce2-s4985.
+	  will be called i2c-mv64xxx.
 
 config I2C_SIS5595
 	tristate "SiS 5595"
@@ -376,15 +363,15 @@ config I2C_MPC
 	  This driver can also be built as a module.  If so, the module
 	  will be called i2c-mpc.
 
-config I2C_MV64XXX
-	tristate "Marvell mv64xxx I2C Controller"
-	depends on (MV64X60 || PLAT_ORION) && EXPERIMENTAL
+config I2C_NFORCE2
+	tristate "Nvidia nForce2, nForce3 and nForce4"
+	depends on PCI
 	help
-	  If you say yes to this option, support will be included for the
-	  built-in I2C interface on the Marvell 64xxx line of host bridges.
+	  If you say yes to this option, support will be included for the Nvidia
+	  nForce2, nForce3 and nForce4 families of mainboard I2C interfaces.
 
 	  This driver can also be built as a module.  If so, the module
-	  will be called i2c-mv64xxx.
+	  will be called i2c-nforce2.
 
 config I2C_OCORES
 	tristate "OpenCores I2C Controller"
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 97dbfa2..1adb173 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_I2C_AMD8111)	+= i2c-amd8111.o
 obj-$(CONFIG_I2C_I801)		+= i2c-i801.o
 obj-$(CONFIG_I2C_ISCH)		+= i2c-isch.o
 obj-$(CONFIG_I2C_NFORCE2)	+= i2c-nforce2.o
-obj-$(CONFIG_I2C_NFORCE2_S4985)	+= i2c-nforce2-s4985.o
 obj-$(CONFIG_I2C_PIIX4)		+= i2c-piix4.o
 obj-$(CONFIG_I2C_SIS5595)	+= i2c-sis5595.o
 obj-$(CONFIG_I2C_SIS630)	+= i2c-sis630.o
diff --git a/drivers/i2c/busses/i2c-nforce2-s4985.c b/drivers/i2c/busses/i2c-nforce2-s4985.c
deleted file mode 100644
index 6a8995d..0000000
--- a/drivers/i2c/busses/i2c-nforce2-s4985.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * i2c-nforce2-s4985.c - i2c-nforce2 extras for the Tyan S4985 motherboard
- *
- * Copyright (C) 2008 Jean Delvare <khali@linux-fr.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- * We select the channels by sending commands to the Philips
- * PCA9556 chip at I2C address 0x18. The main adapter is used for
- * the non-multiplexed part of the bus, and 4 virtual adapters
- * are defined for the multiplexed addresses: 0x50-0x53 (memory
- * module EEPROM) located on channels 1-4. We define one virtual
- * adapter per CPU, which corresponds to one multiplexed channel:
- *   CPU0: virtual adapter 1, channel 1
- *   CPU1: virtual adapter 2, channel 2
- *   CPU2: virtual adapter 3, channel 3
- *   CPU3: virtual adapter 4, channel 4
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/init.h>
-#include <linux/i2c.h>
-#include <linux/mutex.h>
-
-extern struct i2c_adapter *nforce2_smbus;
-
-static struct i2c_adapter *s4985_adapter;
-static struct i2c_algorithm *s4985_algo;
-
-/* Wrapper access functions for multiplexed SMBus */
-static DEFINE_MUTEX(nforce2_lock);
-
-static s32 nforce2_access_virt0(struct i2c_adapter *adap, u16 addr,
-				unsigned short flags, char read_write,
-				u8 command, int size,
-				union i2c_smbus_data *data)
-{
-	int error;
-
-	/* We exclude the multiplexed addresses */
-	if ((addr & 0xfc) == 0x50 || (addr & 0xfc) == 0x30
-	 || addr == 0x18)
-		return -ENXIO;
-
-	mutex_lock(&nforce2_lock);
-	error = nforce2_smbus->algo->smbus_xfer(adap, addr, flags, read_write,
-						command, size, data);
-	mutex_unlock(&nforce2_lock);
-
-	return error;
-}
-
-/* We remember the last used channels combination so as to only switch
-   channels when it is really needed. This greatly reduces the SMBus
-   overhead, but also assumes that nobody will be writing to the PCA9556
-   in our back. */
-static u8 last_channels;
-
-static inline s32 nforce2_access_channel(struct i2c_adapter *adap, u16 addr,
-					 unsigned short flags, char read_write,
-					 u8 command, int size,
-					 union i2c_smbus_data *data,
-					 u8 channels)
-{
-	int error;
-
-	/* We exclude the non-multiplexed addresses */
-	if ((addr & 0xfc) != 0x50 && (addr & 0xfc) != 0x30)
-		return -ENXIO;
-
-	mutex_lock(&nforce2_lock);
-	if (last_channels != channels) {
-		union i2c_smbus_data mplxdata;
-		mplxdata.byte = channels;
-
-		error = nforce2_smbus->algo->smbus_xfer(adap, 0x18, 0,
-							I2C_SMBUS_WRITE, 0x01,
-							I2C_SMBUS_BYTE_DATA,
-							&mplxdata);
-		if (error)
-			goto UNLOCK;
-		last_channels = channels;
-	}
-	error = nforce2_smbus->algo->smbus_xfer(adap, addr, flags, read_write,
-						command, size, data);
-
-UNLOCK:
-	mutex_unlock(&nforce2_lock);
-	return error;
-}
-
-static s32 nforce2_access_virt1(struct i2c_adapter *adap, u16 addr,
-				unsigned short flags, char read_write,
-				u8 command, int size,
-				union i2c_smbus_data *data)
-{
-	/* CPU0: channel 1 enabled */
-	return nforce2_access_channel(adap, addr, flags, read_write, command,
-				      size, data, 0x02);
-}
-
-static s32 nforce2_access_virt2(struct i2c_adapter *adap, u16 addr,
-				unsigned short flags, char read_write,
-				u8 command, int size,
-				union i2c_smbus_data *data)
-{
-	/* CPU1: channel 2 enabled */
-	return nforce2_access_channel(adap, addr, flags, read_write, command,
-				      size, data, 0x04);
-}
-
-static s32 nforce2_access_virt3(struct i2c_adapter *adap, u16 addr,
-				unsigned short flags, char read_write,
-				u8 command, int size,
-				union i2c_smbus_data *data)
-{
-	/* CPU2: channel 3 enabled */
-	return nforce2_access_channel(adap, addr, flags, read_write, command,
-				      size, data, 0x08);
-}
-
-static s32 nforce2_access_virt4(struct i2c_adapter *adap, u16 addr,
-				unsigned short flags, char read_write,
-				u8 command, int size,
-				union i2c_smbus_data *data)
-{
-	/* CPU3: channel 4 enabled */
-	return nforce2_access_channel(adap, addr, flags, read_write, command,
-				      size, data, 0x10);
-}
-
-static int __init nforce2_s4985_init(void)
-{
-	int i, error;
-	union i2c_smbus_data ioconfig;
-
-	/* Unregister physical bus */
-	if (!nforce2_smbus)
-		return -ENODEV;
-	error = i2c_del_adapter(nforce2_smbus);
-	if (error) {
-		dev_err(&nforce2_smbus->dev, "Physical bus removal failed\n");
-		goto ERROR0;
-	}
-
-	printk(KERN_INFO "Enabling SMBus multiplexing for Tyan S4985\n");
-	/* Define the 5 virtual adapters and algorithms structures */
-	s4985_adapter = kzalloc(5 * sizeof(struct i2c_adapter), GFP_KERNEL);
-	if (!s4985_adapter) {
-		error = -ENOMEM;
-		goto ERROR1;
-	}
-	s4985_algo = kzalloc(5 * sizeof(struct i2c_algorithm), GFP_KERNEL);
-	if (!s4985_algo) {
-		error = -ENOMEM;
-		goto ERROR2;
-	}
-
-	/* Fill in the new structures */
-	s4985_algo[0] = *(nforce2_smbus->algo);
-	s4985_algo[0].smbus_xfer = nforce2_access_virt0;
-	s4985_adapter[0] = *nforce2_smbus;
-	s4985_adapter[0].algo = s4985_algo;
-	s4985_adapter[0].dev.parent = nforce2_smbus->dev.parent;
-	for (i = 1; i < 5; i++) {
-		s4985_algo[i] = *(nforce2_smbus->algo);
-		s4985_adapter[i] = *nforce2_smbus;
-		snprintf(s4985_adapter[i].name, sizeof(s4985_adapter[i].name),
-			 "SMBus nForce2 adapter (CPU%d)", i - 1);
-		s4985_adapter[i].algo = s4985_algo + i;
-		s4985_adapter[i].dev.parent = nforce2_smbus->dev.parent;
-	}
-	s4985_algo[1].smbus_xfer = nforce2_access_virt1;
-	s4985_algo[2].smbus_xfer = nforce2_access_virt2;
-	s4985_algo[3].smbus_xfer = nforce2_access_virt3;
-	s4985_algo[4].smbus_xfer = nforce2_access_virt4;
-
-	/* Configure the PCA9556 multiplexer */
-	ioconfig.byte = 0x00; /* All I/O to output mode */
-	error = nforce2_smbus->algo->smbus_xfer(nforce2_smbus, 0x18, 0,
-						I2C_SMBUS_WRITE, 0x03,
-						I2C_SMBUS_BYTE_DATA, &ioconfig);
-	if (error) {
-		dev_err(&nforce2_smbus->dev, "PCA9556 configuration failed\n");
-		error = -EIO;
-		goto ERROR3;
-	}
-
-	/* Register virtual adapters */
-	for (i = 0; i < 5; i++) {
-		error = i2c_add_adapter(s4985_adapter + i);
-		if (error) {
-			dev_err(&nforce2_smbus->dev,
-				"Virtual adapter %d registration "
-				"failed, module not inserted\n", i);
-			for (i--; i >= 0; i--)
-				i2c_del_adapter(s4985_adapter + i);
-			goto ERROR3;
-		}
-	}
-
-	return 0;
-
-ERROR3:
-	kfree(s4985_algo);
-	s4985_algo = NULL;
-ERROR2:
-	kfree(s4985_adapter);
-	s4985_adapter = NULL;
-ERROR1:
-	/* Restore physical bus */
-	i2c_add_adapter(nforce2_smbus);
-ERROR0:
-	return error;
-}
-
-static void __exit nforce2_s4985_exit(void)
-{
-	if (s4985_adapter) {
-		int i;
-
-		for (i = 0; i < 5; i++)
-			i2c_del_adapter(s4985_adapter+i);
-		kfree(s4985_adapter);
-		s4985_adapter = NULL;
-	}
-	kfree(s4985_algo);
-	s4985_algo = NULL;
-
-	/* Restore physical bus */
-	if (i2c_add_adapter(nforce2_smbus))
-		dev_err(&nforce2_smbus->dev, "Physical bus restoration "
-			"failed\n");
-}
-
-MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
-MODULE_DESCRIPTION("S4985 SMBus multiplexing");
-MODULE_LICENSE("GPL");
-
-module_init(nforce2_s4985_init);
-module_exit(nforce2_s4985_exit);
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c
index 3b19bc4..7048e55 100644
--- a/drivers/i2c/busses/i2c-nforce2.c
+++ b/drivers/i2c/busses/i2c-nforce2.c
@@ -125,20 +125,6 @@ static struct dmi_system_id __devinitdata nforce2_dmi_blacklist2[] = {
 
 static struct pci_driver nforce2_driver;
 
-/* For multiplexing support, we need a global reference to the 1st
-   SMBus channel */
-#if defined CONFIG_I2C_NFORCE2_S4985 || defined CONFIG_I2C_NFORCE2_S4985_MODULE
-struct i2c_adapter *nforce2_smbus;
-EXPORT_SYMBOL_GPL(nforce2_smbus);
-
-static void nforce2_set_reference(struct i2c_adapter *adap)
-{
-	nforce2_smbus = adap;
-}
-#else
-static inline void nforce2_set_reference(struct i2c_adapter *adap) { }
-#endif
-
 static void nforce2_abort(struct i2c_adapter *adap)
 {
 	struct nforce2_smbus *smbus = adap->algo_data;
@@ -419,7 +405,6 @@ static int __devinit nforce2_probe(struct pci_dev *dev, const struct pci_device_
 		return -ENODEV;
 	}
 
-	nforce2_set_reference(&smbuses[0].adapter);
 	return 0;
 }
 
@@ -428,7 +413,6 @@ static void __devexit nforce2_remove(struct pci_dev *dev)
 {
 	struct nforce2_smbus *smbuses = (void*) pci_get_drvdata(dev);
 
-	nforce2_set_reference(NULL);
 	if (smbuses[0].base) {
 		i2c_del_adapter(&smbuses[0].adapter);
 		release_region(smbuses[0].base, smbuses[0].size);

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

* Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init  an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1)
  2008-07-16  8:23 ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1) Ingo Molnar
@ 2008-07-16  9:07   ` Jean Delvare
  2008-07-16 10:08     ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object Jean Delvare
  2008-07-17 22:42     ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1) Greg KH
  0 siblings, 2 replies; 13+ messages in thread
From: Jean Delvare @ 2008-07-16  9:07 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Linux I2C, LKML, Ben Dooks, Greg KH, john stultz

Hi Ingo,

On Wed, 16 Jul 2008 10:23:52 +0200, Ingo Molnar wrote:
> 
> hi Jean,
> 
> * Jean Delvare <khali@linux-fr.org> wrote:
> 
> >       i2c-nforce2: Add support for multiplexing on the Tyan S4985
> 
> -tip random boot testing started triggering the following upstream boot 
> crash, starting two days ago when the i2c tree was merged:
> 
> [   11.772002] kobject (ffff81003e8c4160): tried to init an initialized object, something is seriously wrong.
> [   11.784004] Pid: 1, comm: swapper Not tainted 2.6.26-00007-g279e902-dirty #19896
> [   11.793651] 
> [   11.793651] Call Trace:
> [   11.793651]  [<ffffffff8054471a>] kobject_init+0x7a/0x80
> [   11.798969]  [<ffffffff805f0f9d>] device_initialize+0x2d/0xd0
> [   11.806323]  [<ffffffff805f19a1>] device_register+0x11/0x20
> [   11.811903]  [<ffffffff8087ee3b>] i2c_register_adapter+0xab/0x1d0
> [   11.817666]  [<ffffffff8087f0e6>] i2c_add_adapter+0x96/0xb0
> [   11.823761]  [<ffffffff81196372>] nforce2_s4985_init+0x272/0x370
> [   11.829358]  [<ffffffff8027516a>] ? getnstimeofday+0x3a/0xc0
> [   11.835365]  [<ffffffff802728ba>] ? ktime_get_ts+0x4a/0x60
> [   11.840853]  [<ffffffff81196100>] ? nforce2_s4985_init+0x0/0x370
> [   11.846859]  [<ffffffff81160aa3>] kernel_init+0x123/0x300
> [   11.852261]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
> [   11.857957]  [<ffffffff80228548>] child_rip+0xa/0x12
> [   11.863781]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
> [   11.868757]  [<ffffffff81160980>] ? kernel_init+0x0/0x300
> [   11.874160]  [<ffffffff8022853e>] ? child_rip+0x0/0x12
> [   11.879989] 
> [   11.881141] general protection fault: 0000 [1] SMP 
> [   11.881141] CPU 1 
> 
> with this config:
> 
>    http://redhat.com/~mingo/misc/config-Wed_Jul_16_02_26_04_CEST_2008.bad
> 
> today i had time to do a bisection run, and it came up with this commit:
> 
> | 279e902445557897707d325182916a6e28ba80de is first bad commit
> | commit 279e902445557897707d325182916a6e28ba80de
> | Author: Jean Delvare <khali@linux-fr.org>
> | Date:   Mon Jul 14 22:38:21 2008 +0200
> |
> |    i2c-nforce2: Add support for multiplexing on the Tyan S4985
> 
> the crash is reproducible and i can test any fix patch in short order. 
> As a quick temporary hack i've reverted this patch for now via the patch 
> below, to keep the tests going. (Can send more details about the 
> test-system if needed.)

Probably the same problem as reported by John Stultz:
http://lkml.org/lkml/2008/7/15/720

I'll look into it once I am done with higher priority tasks (read:
baby's bath ;)).

> btw., Greg, the kobject debugging check and output is really nice, 
> informative and useful! It likely pinpoints the real bug here.

Is this something new in 2.6.26-gitX? I want to know if the bug is
something new or if it could be already present in 2.6.26 and earlier
kernels and went unnoticed so far.

Thanks,
-- 
Jean Delvare

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

* Re: [crash, bisected] I2C,  kobject (ffff81003e8c4160): tried to init an initialized object
  2008-07-16  9:07   ` Jean Delvare
@ 2008-07-16 10:08     ` Jean Delvare
  2008-07-16 12:18       ` Jean Delvare
  2008-07-17 22:42     ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1) Greg KH
  1 sibling, 1 reply; 13+ messages in thread
From: Jean Delvare @ 2008-07-16 10:08 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: john stultz, Greg KH, LKML, Linux I2C

On Wed, 16 Jul 2008 11:07:02 +0200, Jean Delvare wrote:
> Hi Ingo,
> 
> On Wed, 16 Jul 2008 10:23:52 +0200, Ingo Molnar wrote:
> > 
> > hi Jean,
> > 
> > * Jean Delvare <khali@linux-fr.org> wrote:
> > 
> > >       i2c-nforce2: Add support for multiplexing on the Tyan S4985
> > 
> > -tip random boot testing started triggering the following upstream boot 
> > crash, starting two days ago when the i2c tree was merged:
> > 
> > [   11.772002] kobject (ffff81003e8c4160): tried to init an initialized object, something is seriously wrong.
> > [   11.784004] Pid: 1, comm: swapper Not tainted 2.6.26-00007-g279e902-dirty #19896
> > [   11.793651] 
> > [   11.793651] Call Trace:
> > [   11.793651]  [<ffffffff8054471a>] kobject_init+0x7a/0x80
> > [   11.798969]  [<ffffffff805f0f9d>] device_initialize+0x2d/0xd0
> > [   11.806323]  [<ffffffff805f19a1>] device_register+0x11/0x20
> > [   11.811903]  [<ffffffff8087ee3b>] i2c_register_adapter+0xab/0x1d0
> > [   11.817666]  [<ffffffff8087f0e6>] i2c_add_adapter+0x96/0xb0
> > [   11.823761]  [<ffffffff81196372>] nforce2_s4985_init+0x272/0x370
> > [   11.829358]  [<ffffffff8027516a>] ? getnstimeofday+0x3a/0xc0
> > [   11.835365]  [<ffffffff802728ba>] ? ktime_get_ts+0x4a/0x60
> > [   11.840853]  [<ffffffff81196100>] ? nforce2_s4985_init+0x0/0x370
> > [   11.846859]  [<ffffffff81160aa3>] kernel_init+0x123/0x300
> > [   11.852261]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
> > [   11.857957]  [<ffffffff80228548>] child_rip+0xa/0x12
> > [   11.863781]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
> > [   11.868757]  [<ffffffff81160980>] ? kernel_init+0x0/0x300
> > [   11.874160]  [<ffffffff8022853e>] ? child_rip+0x0/0x12
> > [   11.879989] 
> > [   11.881141] general protection fault: 0000 [1] SMP 
> > [   11.881141] CPU 1 

Good news: I can reproduce this locally. Stay tuned...

-- 
Jean Delvare

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

* Re: [crash, bisected] I2C,  kobject (ffff81003e8c4160): tried to init an initialized object
  2008-07-16 10:08     ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object Jean Delvare
@ 2008-07-16 12:18       ` Jean Delvare
  2008-07-17  9:26         ` Ingo Molnar
  0 siblings, 1 reply; 13+ messages in thread
From: Jean Delvare @ 2008-07-16 12:18 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: john stultz, Greg KH, LKML, Linux I2C, Ulrich Drepper

Hi Ingo, John,

Thanks a lot for reporting this bug quickly, BTW.

On Wed, 16 Jul 2008 12:08:01 +0200, Jean Delvare wrote:
> On Wed, 16 Jul 2008 11:07:02 +0200, Jean Delvare wrote:
> > On Wed, 16 Jul 2008 10:23:52 +0200, Ingo Molnar wrote:
> > > 
> > > * Jean Delvare <khali@linux-fr.org> wrote:
> > > 
> > > >       i2c-nforce2: Add support for multiplexing on the Tyan S4985
> > > 
> > > -tip random boot testing started triggering the following upstream boot 
> > > crash, starting two days ago when the i2c tree was merged:
> > > 
> > > [   11.772002] kobject (ffff81003e8c4160): tried to init an initialized object, something is seriously wrong.
> > > [   11.784004] Pid: 1, comm: swapper Not tainted 2.6.26-00007-g279e902-dirty #19896
> > > [   11.793651] 
> > > [   11.793651] Call Trace:
> > > [   11.793651]  [<ffffffff8054471a>] kobject_init+0x7a/0x80
> > > [   11.798969]  [<ffffffff805f0f9d>] device_initialize+0x2d/0xd0
> > > [   11.806323]  [<ffffffff805f19a1>] device_register+0x11/0x20
> > > [   11.811903]  [<ffffffff8087ee3b>] i2c_register_adapter+0xab/0x1d0
> > > [   11.817666]  [<ffffffff8087f0e6>] i2c_add_adapter+0x96/0xb0
> > > [   11.823761]  [<ffffffff81196372>] nforce2_s4985_init+0x272/0x370
> > > [   11.829358]  [<ffffffff8027516a>] ? getnstimeofday+0x3a/0xc0
> > > [   11.835365]  [<ffffffff802728ba>] ? ktime_get_ts+0x4a/0x60
> > > [   11.840853]  [<ffffffff81196100>] ? nforce2_s4985_init+0x0/0x370
> > > [   11.846859]  [<ffffffff81160aa3>] kernel_init+0x123/0x300
> > > [   11.852261]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
> > > [   11.857957]  [<ffffffff80228548>] child_rip+0xa/0x12
> > > [   11.863781]  [<ffffffff81160140>] ? early_idt_handler+0x0/0x74
> > > [   11.868757]  [<ffffffff81160980>] ? kernel_init+0x0/0x300
> > > [   11.874160]  [<ffffffff8022853e>] ? child_rip+0x0/0x12
> > > [   11.879989] 
> > > [   11.881141] general protection fault: 0000 [1] SMP 
> > > [   11.881141] CPU 1 
> 
> Good news: I can reproduce this locally. Stay tuned...

OK, here's the fix. I'll push it to Linus later today, unless someone
objects. I've tested it on a board without multiplexing. It would be
great if someone could now test on a board with multiplexing, just to
make sure I didn't break anything. Ulrich?

* * * * *

From: Jean Delvare <khali@linux-fr.org>
Subject: i2c: Clear i2c_adapter.dev on adapter removal

Clear i2c_adapter.dev on adapter removal. This makes it possible to
re-add the adapter at a later point, which some drivers
(i2c-amd756-s4882, i2c-nforce2-s4985) actually do.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
---
 drivers/i2c/busses/i2c-amd756-s4882.c  |   27 +++++++++++++--------------
 drivers/i2c/busses/i2c-nforce2-s4985.c |   31 +++++++++++++++----------------
 drivers/i2c/i2c-core.c                 |    4 ++++
 3 files changed, 32 insertions(+), 30 deletions(-)

--- linux-2.6.27-rc0.orig/drivers/i2c/i2c-core.c	2008-07-16 13:13:00.000000000 +0200
+++ linux-2.6.27-rc0/drivers/i2c/i2c-core.c	2008-07-16 13:27:48.000000000 +0200
@@ -654,6 +654,10 @@ int i2c_del_adapter(struct i2c_adapter *
 
 	dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
 
+	/* Clear the device structure in case this adapter is ever going to be
+	   added again */
+	memset(&adap->dev, 0, sizeof(adap->dev));
+
  out_unlock:
 	mutex_unlock(&core_lock);
 	return res;
--- linux-2.6.27-rc0.orig/drivers/i2c/busses/i2c-nforce2-s4985.c	2008-07-16 10:41:52.000000000 +0200
+++ linux-2.6.27-rc0/drivers/i2c/busses/i2c-nforce2-s4985.c	2008-07-16 13:58:43.000000000 +0200
@@ -150,6 +150,16 @@ static int __init nforce2_s4985_init(voi
 	int i, error;
 	union i2c_smbus_data ioconfig;
 
+	/* Configure the PCA9556 multiplexer */
+	ioconfig.byte = 0x00; /* All I/O to output mode */
+	error = i2c_smbus_xfer(nforce2_smbus, 0x18, 0, I2C_SMBUS_WRITE, 0x03,
+			       I2C_SMBUS_BYTE_DATA, &ioconfig);
+	if (error) {
+		dev_err(&nforce2_smbus->dev, "PCA9556 configuration failed\n");
+		error = -EIO;
+		goto ERROR0;
+	}
+
 	/* Unregister physical bus */
 	if (!nforce2_smbus)
 		return -ENODEV;
@@ -191,24 +201,13 @@ static int __init nforce2_s4985_init(voi
 	s4985_algo[3].smbus_xfer = nforce2_access_virt3;
 	s4985_algo[4].smbus_xfer = nforce2_access_virt4;
 
-	/* Configure the PCA9556 multiplexer */
-	ioconfig.byte = 0x00; /* All I/O to output mode */
-	error = nforce2_smbus->algo->smbus_xfer(nforce2_smbus, 0x18, 0,
-						I2C_SMBUS_WRITE, 0x03,
-						I2C_SMBUS_BYTE_DATA, &ioconfig);
-	if (error) {
-		dev_err(&nforce2_smbus->dev, "PCA9556 configuration failed\n");
-		error = -EIO;
-		goto ERROR3;
-	}
-
 	/* Register virtual adapters */
 	for (i = 0; i < 5; i++) {
 		error = i2c_add_adapter(s4985_adapter + i);
 		if (error) {
-			dev_err(&nforce2_smbus->dev,
-				"Virtual adapter %d registration "
-				"failed, module not inserted\n", i);
+			printk(KERN_ERR "i2c-nforce2-s4985: "
+			       "Virtual adapter %d registration "
+			       "failed, module not inserted\n", i);
 			for (i--; i >= 0; i--)
 				i2c_del_adapter(s4985_adapter + i);
 			goto ERROR3;
@@ -245,8 +244,8 @@ static void __exit nforce2_s4985_exit(vo
 
 	/* Restore physical bus */
 	if (i2c_add_adapter(nforce2_smbus))
-		dev_err(&nforce2_smbus->dev, "Physical bus restoration "
-			"failed\n");
+		printk(KERN_ERR "i2c-nforce2-s4985: "
+		       "Physical bus restoration failed\n");
 }
 
 MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");
--- linux-2.6.27-rc0.orig/drivers/i2c/busses/i2c-amd756-s4882.c	2008-07-16 10:41:52.000000000 +0200
+++ linux-2.6.27-rc0/drivers/i2c/busses/i2c-amd756-s4882.c	2008-07-16 13:58:25.000000000 +0200
@@ -155,6 +155,16 @@ static int __init amd756_s4882_init(void
 	int i, error;
 	union i2c_smbus_data ioconfig;
 
+	/* Configure the PCA9556 multiplexer */
+	ioconfig.byte = 0x00; /* All I/O to output mode */
+	error = i2c_smbus_xfer(&amd756_smbus, 0x18, 0, I2C_SMBUS_WRITE, 0x03,
+			       I2C_SMBUS_BYTE_DATA, &ioconfig);
+	if (error) {
+		dev_err(&amd756_smbus.dev, "PCA9556 configuration failed\n");
+		error = -EIO;
+		goto ERROR0;
+	}
+
 	/* Unregister physical bus */
 	error = i2c_del_adapter(&amd756_smbus);
 	if (error) {
@@ -198,22 +208,11 @@ static int __init amd756_s4882_init(void
 	s4882_algo[3].smbus_xfer = amd756_access_virt3;
 	s4882_algo[4].smbus_xfer = amd756_access_virt4;
 
-	/* Configure the PCA9556 multiplexer */
-	ioconfig.byte = 0x00; /* All I/O to output mode */
-	error = amd756_smbus.algo->smbus_xfer(&amd756_smbus, 0x18, 0,
-					      I2C_SMBUS_WRITE, 0x03,
-					      I2C_SMBUS_BYTE_DATA, &ioconfig);
-	if (error) {
-		dev_err(&amd756_smbus.dev, "PCA9556 configuration failed\n");
-		error = -EIO;
-		goto ERROR3;
-	}
-
 	/* Register virtual adapters */
 	for (i = 0; i < 5; i++) {
 		error = i2c_add_adapter(s4882_adapter+i);
 		if (error) {
-			dev_err(&amd756_smbus.dev,
+			printk(KERN_ERR "i2c-amd756-s4882: "
 			       "Virtual adapter %d registration "
 			       "failed, module not inserted\n", i);
 			for (i--; i >= 0; i--)
@@ -252,8 +251,8 @@ static void __exit amd756_s4882_exit(voi
 
 	/* Restore physical bus */
 	if (i2c_add_adapter(&amd756_smbus))
-		dev_err(&amd756_smbus.dev, "Physical bus restoration "
-			"failed\n");
+		printk(KERN_ERR "i2c-amd756-s4882: "
+		       "Physical bus restoration failed\n");
 }
 
 MODULE_AUTHOR("Jean Delvare <khali@linux-fr.org>");


-- 
Jean Delvare

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

* Re: [crash, bisected] I2C,  kobject (ffff81003e8c4160): tried to init an initialized object
  2008-07-16 12:18       ` Jean Delvare
@ 2008-07-17  9:26         ` Ingo Molnar
  2008-07-17  9:33           ` Ingo Molnar
       [not found]           ` <20080717092655.GA6115-X9Un+BFzKDI@public.gmane.org>
  0 siblings, 2 replies; 13+ messages in thread
From: Ingo Molnar @ 2008-07-17  9:26 UTC (permalink / raw)
  To: Jean Delvare; +Cc: john stultz, Greg KH, LKML, Linux I2C, Ulrich Drepper


Jean,

-tip testing found another (similar) i2c crash with latest -git, on a 
Core2Duo laptop:

calling  nforce2_init+0x0/0x1b
initcall nforce2_init+0x0/0x1b returned 0 after 0 msecs
calling  nforce2_s4985_init+0x0/0x275
BUG: unable to handle kernel NULL pointer dereference at 0000000c
IP: [<c04af2cf>] i2c_smbus_xfer+0x27/0x3f0
*pdpt = 00000000009cb001 *pde = 0000000000000000 
Oops: 0000 [#1] SMP 

Pid: 1, comm: swapper Not tainted (2.6.26-tip #3033)
EIP: 0060:[<c04af2cf>] EFLAGS: 00010246 CPU: 0
EIP is at i2c_smbus_xfer+0x27/0x3f0
EAX: 00000003 EBX: 00000000 ECX: 00000000 EDX: 00000018
ESI: 00000003 EDI: 00000018 EBP: f7c6ff24 ESP: f7c6fea8
 DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
Process swapper (pid: 1, ti=f7c6e000 task=f7c70000 task.ti=f7c6e000)
Stack: 00000035 00030000 00000000 c0104237 00000000 00000046 00000046 00000000 
       00000000 f7c6ff50 c09debf0 0001007b fffe007b 000000d8 ffffffef c01213cb 
       00000060 00000286 f7c6ff1c 00000004 00000286 00000246 f7c6ff24 c014673a 
Call Trace:
 [<c0104237>] ? common_interrupt+0x23/0x28
 [<c01213cb>] ? vprintk+0x290/0x29b
 [<c014673a>] ? ftrace_record_ip+0x19f/0x1e6
 [<c01a1385>] ? sysfs_add_file_mode+0x57/0x76
 [<c099632f>] ? nforce2_s4985_init+0x2d/0x275
 [<c013319c>] ? ktime_get_ts+0x51/0x55
 [<c01331b8>] ? ktime_get+0x18/0x34
 [<c0971887>] ? kernel_init+0x11f/0x24a
 [<c0996302>] ? nforce2_s4985_init+0x0/0x275
 [<c011cbe8>] ? schedule_tail+0x1e/0x4d
 [<c01037aa>] ? ret_from_fork+0x6/0x1c
 [<c0971768>] ? kernel_init+0x0/0x24a
 [<c0971768>] ? kernel_init+0x0/0x24a
 [<c0104477>] ? kernel_thread_helper+0x7/0x10
 =======================
Code: 5e 5f 5d c3 55 89 e5 57 56 53 83 ec 70 e8 ca 51 c5 ff 89 45 8c 8b 75 0c 83 e1 14 8a 45 08 89 d7 8b 5d 8c 88 45 8b 89 f0 88 45 8a <8b> 43 0c 83 78 04 00 0f b7 c1 89 45 84 74 3a 83 c3 20 89 d8 e8 
EIP: [<c04af2cf>] i2c_smbus_xfer+0x27/0x3f0 SS:ESP 0068:f7c6fea8
Kernel panic - not syncing: Fatal exception
Pid: 1, comm: swapper Tainted: G      D   2.6.26-tip #3033
 [<c01208ee>] panic+0x44/0xeb
 [<c0104c8d>] die+0x123/0x13a
 [<c0110f38>] do_page_fault+0x632/0x6f2
 [<c0110906>] ? do_page_fault+0x0/0x6f2
 [<c06585ca>] error_code+0x72/0x78
 [<c04af2cf>] ? i2c_smbus_xfer+0x27/0x3f0
 [<c0104237>] ? common_interrupt+0x23/0x28
 [<c01213cb>] ? vprintk+0x290/0x29b
 [<c014673a>] ? ftrace_record_ip+0x19f/0x1e6
 [<c01a1385>] ? sysfs_add_file_mode+0x57/0x76
 [<c099632f>] nforce2_s4985_init+0x2d/0x275
 [<c013319c>] ? ktime_get_ts+0x51/0x55
 [<c01331b8>] ? ktime_get+0x18/0x34
 [<c0971887>] kernel_init+0x11f/0x24a
 [<c0996302>] ? nforce2_s4985_init+0x0/0x275
 [<c011cbe8>] ? schedule_tail+0x1e/0x4d
 [<c01037aa>] ? ret_from_fork+0x6/0x1c
 [<c0971768>] ? kernel_init+0x0/0x24a
 [<c0971768>] ? kernel_init+0x0/0x24a
 [<c0104477>] kernel_thread_helper+0x7/0x10
 =======================

the config is:

  http://redhat.com/~mingo/misc/config-Thu_Jul_17_10_47_42_CEST_2008.bad

this too seems to have a sysfs angle. I have tried 
a3cf859321486f69506326146ab3e2fd15c05c3f, is that supposed to have fixed 
all previous problems?

	Ingo

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

* Re: [crash, bisected] I2C,  kobject (ffff81003e8c4160): tried to init an initialized object
  2008-07-17  9:26         ` Ingo Molnar
@ 2008-07-17  9:33           ` Ingo Molnar
  2008-07-17  9:48             ` Alexey Dobriyan
       [not found]           ` <20080717092655.GA6115-X9Un+BFzKDI@public.gmane.org>
  1 sibling, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2008-07-17  9:33 UTC (permalink / raw)
  To: Jean Delvare; +Cc: john stultz, Greg KH, LKML, Linux I2C, Ulrich Drepper


* Ingo Molnar <mingo@elte.hu> wrote:

> Jean,
> 
> -tip testing found another (similar) i2c crash with latest -git, on a 
> Core2Duo laptop:
> 
> calling  nforce2_init+0x0/0x1b
> initcall nforce2_init+0x0/0x1b returned 0 after 0 msecs
> calling  nforce2_s4985_init+0x0/0x275
> BUG: unable to handle kernel NULL pointer dereference at 0000000c
> IP: [<c04af2cf>] i2c_smbus_xfer+0x27/0x3f0
> *pdpt = 00000000009cb001 *pde = 0000000000000000 
> Oops: 0000 [#1] SMP 

turning off I2C_NFORCE2_S4985 makes the system boot up fine. Workaround 
patch below.

	Ingo

------------------->
commit 15e524060d13e8fac3fe2fb6c6519be6de9ab8a8
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jul 17 11:29:44 2008 +0200

    i2c workaround: turn off I2C_NFORCE2_S4985 for now
    
    I2C_NFORCE2_S4985 causes this crash:
    
    calling  nforce2_init+0x0/0x1b
    initcall nforce2_init+0x0/0x1b returned 0 after 0 msecs
    calling  nforce2_s4985_init+0x0/0x275
    BUG: unable to handle kernel NULL pointer dereference at 0000000c
    IP: [<c04af2cf>] i2c_smbus_xfer+0x27/0x3f0
    *pdpt = 00000000009cb001 *pde = 0000000000000000
    Oops: 0000 [#1] SMP
    
    Pid: 1, comm: swapper Not tainted (2.6.26-tip #3033)
    EIP: 0060:[<c04af2cf>] EFLAGS: 00010246 CPU: 0
    EIP is at i2c_smbus_xfer+0x27/0x3f0
    EAX: 00000003 EBX: 00000000 ECX: 00000000 EDX: 00000018
    ESI: 00000003 EDI: 00000018 EBP: f7c6ff24 ESP: f7c6fea8
     DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
    Process swapper (pid: 1, ti=f7c6e000 task=f7c70000 task.ti=f7c6e000)
    Stack: 00000035 00030000 00000000 c0104237 00000000 00000046 00000046 00000000
           00000000 f7c6ff50 c09debf0 0001007b fffe007b 000000d8 ffffffef c01213cb
           00000060 00000286 f7c6ff1c 00000004 00000286 00000246 f7c6ff24 c014673a
    Call Trace:
     [<c0104237>] ? common_interrupt+0x23/0x28
     [<c01213cb>] ? vprintk+0x290/0x29b
     [<c014673a>] ? ftrace_record_ip+0x19f/0x1e6
     [<c01a1385>] ? sysfs_add_file_mode+0x57/0x76
     [<c099632f>] ? nforce2_s4985_init+0x2d/0x275
     [<c013319c>] ? ktime_get_ts+0x51/0x55
     [<c01331b8>] ? ktime_get+0x18/0x34
     [<c0971887>] ? kernel_init+0x11f/0x24a
     [<c0996302>] ? nforce2_s4985_init+0x0/0x275
     [<c011cbe8>] ? schedule_tail+0x1e/0x4d
     [<c01037aa>] ? ret_from_fork+0x6/0x1c
     [<c0971768>] ? kernel_init+0x0/0x24a
     [<c0971768>] ? kernel_init+0x0/0x24a
     [<c0104477>] ? kernel_thread_helper+0x7/0x10
     =======================
    Code: 5e 5f 5d c3 55 89 e5 57 56 53 83 ec 70 e8 ca 51 c5 ff 89 45 8c 8b 75 0c 83 e1 14 8a 45 08 89 d7 8b 5d 8c 88 45 8b 89 f0 88 45 8a <8b> 43 0c 83 78 04 00 0f b7 c1 89 45 84 74 3a 83 c3 20 89 d8 e8
    EIP: [<c04af2cf>] i2c_smbus_xfer+0x27/0x3f0 SS:ESP 0068:f7c6fea8
    Kernel panic - not syncing: Fatal exception
    Pid: 1, comm: swapper Tainted: G      D   2.6.26-tip #3033
     [<c01208ee>] panic+0x44/0xeb
     [<c0104c8d>] die+0x123/0x13a
     [<c0110f38>] do_page_fault+0x632/0x6f2
     [<c0110906>] ? do_page_fault+0x0/0x6f2
     [<c06585ca>] error_code+0x72/0x78
     [<c04af2cf>] ? i2c_smbus_xfer+0x27/0x3f0
     [<c0104237>] ? common_interrupt+0x23/0x28
     [<c01213cb>] ? vprintk+0x290/0x29b
     [<c014673a>] ? ftrace_record_ip+0x19f/0x1e6
     [<c01a1385>] ? sysfs_add_file_mode+0x57/0x76
     [<c099632f>] nforce2_s4985_init+0x2d/0x275
     [<c013319c>] ? ktime_get_ts+0x51/0x55
     [<c01331b8>] ? ktime_get+0x18/0x34
     [<c0971887>] kernel_init+0x11f/0x24a
     [<c0996302>] ? nforce2_s4985_init+0x0/0x275
     [<c011cbe8>] ? schedule_tail+0x1e/0x4d
     [<c01037aa>] ? ret_from_fork+0x6/0x1c
     [<c0971768>] ? kernel_init+0x0/0x24a
     [<c0971768>] ? kernel_init+0x0/0x24a
     [<c0104477>] kernel_thread_helper+0x7/0x10
     =======================
    
    with this config:
    
      http://redhat.com/~mingo/misc/config-Thu_Jul_17_10_47_42_CEST_2008.bad
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 drivers/i2c/busses/Kconfig |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 6ee997b..2213fab 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -149,6 +149,9 @@ config I2C_NFORCE2
 config I2C_NFORCE2_S4985
 	tristate "SMBus multiplexing on the Tyan S4985"
 	depends on I2C_NFORCE2 && EXPERIMENTAL
+	# broke a T60 Core2Duo with:
+	# http://redhat.com/~mingo/misc/config-Thu_Jul_17_10_47_42_CEST_2008.bad
+	depends on 0
 	help
 	  Enabling this option will add specific SMBus support for the Tyan
 	  S4985 motherboard.  On this 4-CPU board, the SMBus is multiplexed

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

* Re: [crash, bisected] I2C,  kobject (ffff81003e8c4160): tried to init an initialized object
  2008-07-17  9:33           ` Ingo Molnar
@ 2008-07-17  9:48             ` Alexey Dobriyan
       [not found]               ` <20080717094858.GA18687-QDJVlCTZ4KWTKS93B3g+7KFoa47nwP16@public.gmane.org>
  2008-08-06 20:21               ` Jean Delvare
  0 siblings, 2 replies; 13+ messages in thread
From: Alexey Dobriyan @ 2008-07-17  9:48 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Jean Delvare, john stultz, Greg KH, LKML, Linux I2C,
	Ulrich Drepper

On Thu, Jul 17, 2008 at 11:33:30AM +0200, Ingo Molnar wrote:
> 
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > Jean,
> > 
> > -tip testing found another (similar) i2c crash with latest -git, on a 
> > Core2Duo laptop:
> > 
> > calling  nforce2_init+0x0/0x1b
> > initcall nforce2_init+0x0/0x1b returned 0 after 0 msecs
> > calling  nforce2_s4985_init+0x0/0x275
> > BUG: unable to handle kernel NULL pointer dereference at 0000000c
> > IP: [<c04af2cf>] i2c_smbus_xfer+0x27/0x3f0
> > *pdpt = 00000000009cb001 *pde = 0000000000000000 
> > Oops: 0000 [#1] SMP 
> 
> turning off I2C_NFORCE2_S4985 makes the system boot up fine. Workaround 
> patch below.

Well, it's pretty easy oops unless I misread something.

It happened on not nforce2 motherboard, right?

nforce2_init will just register PCI driver,
no matching PCI ids => nforce2_set_reference() isn't called =>
nforce2_smbus stays NULL.

Second module loads and tries to i2c_smbus_xfer(NULL, ) in module_init()
hook which oopses.

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

* Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object
       [not found]           ` <20080717092655.GA6115-X9Un+BFzKDI@public.gmane.org>
@ 2008-07-17  9:49             ` Ingo Molnar
  2008-07-17  9:54               ` Ingo Molnar
  0 siblings, 1 reply; 13+ messages in thread
From: Ingo Molnar @ 2008-07-17  9:49 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Ulrich Drepper, john stultz, Greg KH, LKML, Linux I2C


* Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org> wrote:

> -tip testing found another (similar) i2c crash with latest -git, on a 
> Core2Duo laptop:

found another bootup crash on an Athlon 64 X2 testsystem:

[   19.610000] bus: 'pci': add driver amd756_smbus
[   19.615204] initcall amd756_init+0x0/0x20 returned 0 after 9 msecs
[   19.620000] calling  amd756_s4882_init+0x0/0x2d7
[   19.624242] ------------[ cut here ]------------
[   19.628415] WARNING: at kernel/mutex.c:134 mutex_lock_nested+0xc0/0x267()
[   19.630000] Pid: 1, comm: swapper Not tainted 2.6.26-tip #20066
[   19.630000] 
[   19.630000] Call Trace:
[   19.630000]  [<ffffffff802358f5>] warn_on_slowpath+0x58/0x7f
[   19.630000]  [<ffffffff80263ac6>] ? ftrace_record_ip+0x20c/0x263
[   19.630000]  [<ffffffff80514faa>] ? _raw_spin_unlock+0x8e/0x93
[   19.630000]  [<ffffffff80507c44>] ? debug_locks_off+0x4/0x3c
[   19.630000]  [<ffffffff80263ac6>] ? ftrace_record_ip+0x20c/0x263
[   19.630000]  [<ffffffff8020b3a4>] ? mcount_call+0x5/0x31
[   19.630000]  [<ffffffff80861c19>] mutex_lock_nested+0xc0/0x267
[   19.630000]  [<ffffffff806e8ffd>] ? i2c_smbus_xfer+0x59/0x49c
[   19.630000]  [<ffffffff80cc8575>] ? amd756_s4882_init+0x0/0x2d7
[   19.630000]  [<ffffffff8020b3a4>] ? mcount_call+0x5/0x31
[   19.630000]  [<ffffffff806e8ffd>] i2c_smbus_xfer+0x59/0x49c
[   19.630000]  [<ffffffff80263ac6>] ? ftrace_record_ip+0x20c/0x263
[   19.630000]  [<ffffffff80514faa>] ? _raw_spin_unlock+0x8e/0x93
[   19.630000]  [<ffffffff80cc8584>] ? amd756_s4882_init+0xf/0x2d7
[   19.630000]  [<ffffffff80263ac6>] ? ftrace_record_ip+0x20c/0x263
[   19.630000]  [<ffffffff80cc8575>] ? amd756_s4882_init+0x0/0x2d7
[   19.630000]  [<ffffffff8020b3a4>] ? mcount_call+0x5/0x31
[   19.630000]  [<ffffffff80cc8575>] ? amd756_s4882_init+0x0/0x2d7
[   19.630000]  [<ffffffff80cc85b6>] amd756_s4882_init+0x41/0x2d7
[   19.630000]  [<ffffffff8024e325>] ? getnstimeofday+0x3f/0xa1
[   19.630000]  [<ffffffff8024bf25>] ? ktime_get_ts+0x4e/0x53
[   19.630000]  [<ffffffff80cc8575>] ? amd756_s4882_init+0x0/0x2d7
[   19.630000]  [<ffffffff80ca49a0>] kernel_init+0x143/0x2a4
[   19.630000]  [<ffffffff80863721>] ? _spin_unlock_irq+0x2b/0x37
[   19.630000]  [<ffffffff8020c9f9>] child_rip+0xa/0x11
[   19.630000]  [<ffffffff80ca485d>] ? kernel_init+0x0/0x2a4
[   19.630000]  [<ffffffff8020c9ef>] ? child_rip+0x0/0x11
[   19.630000] 
[   19.630000] ---[ end trace 0e79313125261797 ]---
[   19.630000] BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
[   19.630000] IP: [<ffffffff80861c66>] mutex_lock_nested+0x10d/0x267

with this config:

  http://redhat.com/~mingo/misc/config-Thu_Jul_17_11_34_08_CEST_2008.bad

i already had I2C_NFORCE2_S4985 off here, so it's a different one.

	Ingo

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

* Re: [crash, bisected] I2C,  kobject (ffff81003e8c4160): tried to init an initialized object
  2008-07-17  9:49             ` Ingo Molnar
@ 2008-07-17  9:54               ` Ingo Molnar
  0 siblings, 0 replies; 13+ messages in thread
From: Ingo Molnar @ 2008-07-17  9:54 UTC (permalink / raw)
  To: Jean Delvare; +Cc: john stultz, Greg KH, LKML, Linux I2C, Ulrich Drepper


* Ingo Molnar <mingo@elte.hu> wrote:

> found another bootup crash on an Athlon 64 X2 testsystem:
> 
> [   19.610000] bus: 'pci': add driver amd756_smbus
> [   19.615204] initcall amd756_init+0x0/0x20 returned 0 after 9 msecs
> [   19.620000] calling  amd756_s4882_init+0x0/0x2d7
> [   19.624242] ------------[ cut here ]------------
> [   19.628415] WARNING: at kernel/mutex.c:134 mutex_lock_nested+0xc0/0x267()
> [   19.630000] Pid: 1, comm: swapper Not tainted 2.6.26-tip #20066

> [   19.630000] ---[ end trace 0e79313125261797 ]---
> [   19.630000] BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
> [   19.630000] IP: [<ffffffff80861c66>] mutex_lock_nested+0x10d/0x267

turning off CONFIG_I2C_AMD756_S4882 works around this bug (as expected), 
via the patch below.

	Ingo

--------------------------->
commit 3f6403ab0bfdfca0cefbbc414afedc62734392f3
Author: Ingo Molnar <mingo@elte.hu>
Date:   Thu Jul 17 11:52:41 2008 +0200

    i2c: work around boot crash in amd756_s4882_init()
    
    work around:
    
    [   19.610000] bus: 'pci': add driver amd756_smbus
    [   19.615204] initcall amd756_init+0x0/0x20 returned 0 after 9 msecs
    [   19.620000] calling  amd756_s4882_init+0x0/0x2d7
    [   19.624242] ------------[ cut here ]------------
    [   19.628415] WARNING: at kernel/mutex.c:134 mutex_lock_nested+0xc0/0x267()
    [   19.630000] Pid: 1, comm: swapper Not tainted 2.6.26-tip #20066
    [   19.630000]
    [   19.630000] Call Trace:
    [   19.630000]  [<ffffffff802358f5>] warn_on_slowpath+0x58/0x7f
    [   19.630000]  [<ffffffff80263ac6>] ? ftrace_record_ip+0x20c/0x263
    [   19.630000]  [<ffffffff80514faa>] ? _raw_spin_unlock+0x8e/0x93
    [   19.630000]  [<ffffffff80507c44>] ? debug_locks_off+0x4/0x3c
    [   19.630000]  [<ffffffff80263ac6>] ? ftrace_record_ip+0x20c/0x263
    [   19.630000]  [<ffffffff8020b3a4>] ? mcount_call+0x5/0x31
    [   19.630000]  [<ffffffff80861c19>] mutex_lock_nested+0xc0/0x267
    [   19.630000]  [<ffffffff806e8ffd>] ? i2c_smbus_xfer+0x59/0x49c
    [   19.630000]  [<ffffffff80cc8575>] ? amd756_s4882_init+0x0/0x2d7
    [   19.630000]  [<ffffffff8020b3a4>] ? mcount_call+0x5/0x31
    [   19.630000]  [<ffffffff806e8ffd>] i2c_smbus_xfer+0x59/0x49c
    [   19.630000]  [<ffffffff80263ac6>] ? ftrace_record_ip+0x20c/0x263
    [   19.630000]  [<ffffffff80514faa>] ? _raw_spin_unlock+0x8e/0x93
    [   19.630000]  [<ffffffff80cc8584>] ? amd756_s4882_init+0xf/0x2d7
    [   19.630000]  [<ffffffff80263ac6>] ? ftrace_record_ip+0x20c/0x263
    [   19.630000]  [<ffffffff80cc8575>] ? amd756_s4882_init+0x0/0x2d7
    [   19.630000]  [<ffffffff8020b3a4>] ? mcount_call+0x5/0x31
    [   19.630000]  [<ffffffff80cc8575>] ? amd756_s4882_init+0x0/0x2d7
    [   19.630000]  [<ffffffff80cc85b6>] amd756_s4882_init+0x41/0x2d7
    [   19.630000]  [<ffffffff8024e325>] ? getnstimeofday+0x3f/0xa1
    [   19.630000]  [<ffffffff8024bf25>] ? ktime_get_ts+0x4e/0x53
    [   19.630000]  [<ffffffff80cc8575>] ? amd756_s4882_init+0x0/0x2d7
    [   19.630000]  [<ffffffff80ca49a0>] kernel_init+0x143/0x2a4
    [   19.630000]  [<ffffffff80863721>] ? _spin_unlock_irq+0x2b/0x37
    [   19.630000]  [<ffffffff8020c9f9>] child_rip+0xa/0x11
    [   19.630000]  [<ffffffff80ca485d>] ? kernel_init+0x0/0x2a4
    [   19.630000]  [<ffffffff8020c9ef>] ? child_rip+0x0/0x11
    [   19.630000]
    [   19.630000] ---[ end trace 0e79313125261797 ]---
    [   19.630000] BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
    [   19.630000] IP: [<ffffffff80861c66>] mutex_lock_nested+0x10d/0x267
    
    which occurs with:
    
      http://redhat.com/~mingo/misc/config-Thu_Jul_17_11_34_08_CEST_2008.bad
    
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 drivers/i2c/busses/Kconfig |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 2213fab..ead9209 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -56,6 +56,9 @@ config I2C_AMD756
 config I2C_AMD756_S4882
 	tristate "SMBus multiplexing on the Tyan S4882"
 	depends on I2C_AMD756 && EXPERIMENTAL
+	# broke an Athlon 64 X2 Asus A8N-E with:
+	# http://redhat.com/~mingo/misc/config-Thu_Jul_17_11_34_08_CEST_2008.bad
+	depends on 0
 	help
 	  Enabling this option will add specific SMBus support for the Tyan
 	  S4882 motherboard.  On this 4-CPU board, the SMBus is multiplexed

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

* Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object
       [not found]               ` <20080717094858.GA18687-QDJVlCTZ4KWTKS93B3g+7KFoa47nwP16@public.gmane.org>
@ 2008-07-17  9:59                 ` Ingo Molnar
  0 siblings, 0 replies; 13+ messages in thread
From: Ingo Molnar @ 2008-07-17  9:59 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: john stultz, Greg KH, LKML, Linux I2C, Ulrich Drepper


* Alexey Dobriyan <adobriyan-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> On Thu, Jul 17, 2008 at 11:33:30AM +0200, Ingo Molnar wrote:
> > 
> > * Ingo Molnar <mingo-X9Un+BFzKDI@public.gmane.org> wrote:
> > 
> > > Jean,
> > > 
> > > -tip testing found another (similar) i2c crash with latest -git, on a 
> > > Core2Duo laptop:
> > > 
> > > calling  nforce2_init+0x0/0x1b
> > > initcall nforce2_init+0x0/0x1b returned 0 after 0 msecs
> > > calling  nforce2_s4985_init+0x0/0x275
> > > BUG: unable to handle kernel NULL pointer dereference at 0000000c
> > > IP: [<c04af2cf>] i2c_smbus_xfer+0x27/0x3f0
> > > *pdpt = 00000000009cb001 *pde = 0000000000000000 
> > > Oops: 0000 [#1] SMP 
> > 
> > turning off I2C_NFORCE2_S4985 makes the system boot up fine. Workaround 
> > patch below.
> 
> Well, it's pretty easy oops unless I misread something.
> It happened on not nforce2 motherboard, right?

yeah.

> nforce2_init will just register PCI driver,
> no matching PCI ids => nforce2_set_reference() isn't called =>
> nforce2_smbus stays NULL.
> 
> Second module loads and tries to i2c_smbus_xfer(NULL, ) in module_init()
> hook which oopses.

can try patches, but got other 5 fresh upstream oopses/hangs/crashes to 
investigate now. (so i went for the minimal-effort 
turn-off-the-failing-part approach)

	Ingo

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

* Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init  an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1)
  2008-07-16  9:07   ` Jean Delvare
  2008-07-16 10:08     ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object Jean Delvare
@ 2008-07-17 22:42     ` Greg KH
  1 sibling, 0 replies; 13+ messages in thread
From: Greg KH @ 2008-07-17 22:42 UTC (permalink / raw)
  To: Jean Delvare; +Cc: Ingo Molnar, Linux I2C, LKML, Ben Dooks, john stultz

On Wed, Jul 16, 2008 at 11:07:02AM +0200, Jean Delvare wrote:
> > btw., Greg, the kobject debugging check and output is really nice, 
> > informative and useful! It likely pinpoints the real bug here.
> 
> Is this something new in 2.6.26-gitX? I want to know if the bug is
> something new or if it could be already present in 2.6.26 and earlier
> kernels and went unnoticed so far.

It is in 2.6.26 as I haven't merged any patches with Linus yet, portions
of it might be in older kernels, but not in the same type of format.

thanks,

greg k-h

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

* Re: [crash, bisected] I2C,  kobject (ffff81003e8c4160): tried to init an initialized object
  2008-07-17  9:48             ` Alexey Dobriyan
       [not found]               ` <20080717094858.GA18687-QDJVlCTZ4KWTKS93B3g+7KFoa47nwP16@public.gmane.org>
@ 2008-08-06 20:21               ` Jean Delvare
  1 sibling, 0 replies; 13+ messages in thread
From: Jean Delvare @ 2008-08-06 20:21 UTC (permalink / raw)
  To: Alexey Dobriyan
  Cc: Ingo Molnar, john stultz, Greg KH, LKML, Linux I2C,
	Ulrich Drepper

Hi Alexey, Ingo,

On Thu, 17 Jul 2008 13:48:58 +0400, Alexey Dobriyan wrote:
> On Thu, Jul 17, 2008 at 11:33:30AM +0200, Ingo Molnar wrote:
> > 
> > * Ingo Molnar <mingo@elte.hu> wrote:
> > 
> > > Jean,
> > > 
> > > -tip testing found another (similar) i2c crash with latest -git, on a 
> > > Core2Duo laptop:
> > > 
> > > calling  nforce2_init+0x0/0x1b
> > > initcall nforce2_init+0x0/0x1b returned 0 after 0 msecs
> > > calling  nforce2_s4985_init+0x0/0x275
> > > BUG: unable to handle kernel NULL pointer dereference at 0000000c
> > > IP: [<c04af2cf>] i2c_smbus_xfer+0x27/0x3f0
> > > *pdpt = 00000000009cb001 *pde = 0000000000000000 
> > > Oops: 0000 [#1] SMP 
> > 
> > turning off I2C_NFORCE2_S4985 makes the system boot up fine. Workaround 
> > patch below.
> 
> Well, it's pretty easy oops unless I misread something.
> 
> It happened on not nforce2 motherboard, right?
> 
> nforce2_init will just register PCI driver,
> no matching PCI ids => nforce2_set_reference() isn't called =>
> nforce2_smbus stays NULL.
> 
> Second module loads and tries to i2c_smbus_xfer(NULL, ) in module_init()
> hook which oopses.

Analysis is totally correct. I guess I shouldn't have tried to fix the
original bug in a hurry before leaving for vacation. I didn't have the
time to completely test it and as a result I introduced a new bug.
Which the following patch should fix:

* * * * *

Subject: i2c: Fix oops on bus multiplexer driver loading

The two I2C bus multiplexer drivers (i2c-amd756-s4882 and
i2c-nforce2-s4985) make use of the bus they want to multiplex before
checking if it is really present. Swap the instructions to test for
presence first. This fixes a oops reported by Ingo Molnar.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Ingo Molnar <mingo@elte.hu>
---
 drivers/i2c/busses/i2c-amd756-s4882.c  |    9 ++++-----
 drivers/i2c/busses/i2c-nforce2-s4985.c |    5 +++--
 2 files changed, 7 insertions(+), 7 deletions(-)

--- linux-2.6.27-rc2.orig/drivers/i2c/busses/i2c-amd756-s4882.c	2008-08-05 18:17:05.000000000 +0200
+++ linux-2.6.27-rc2/drivers/i2c/busses/i2c-amd756-s4882.c	2008-08-06 20:40:16.000000000 +0200
@@ -155,6 +155,9 @@ static int __init amd756_s4882_init(void
 	int i, error;
 	union i2c_smbus_data ioconfig;
 
+	if (!amd756_smbus.dev.parent)
+		return -ENODEV;
+
 	/* Configure the PCA9556 multiplexer */
 	ioconfig.byte = 0x00; /* All I/O to output mode */
 	error = i2c_smbus_xfer(&amd756_smbus, 0x18, 0, I2C_SMBUS_WRITE, 0x03,
@@ -168,11 +171,7 @@ static int __init amd756_s4882_init(void
 	/* Unregister physical bus */
 	error = i2c_del_adapter(&amd756_smbus);
 	if (error) {
-		if (error == -EINVAL)
-			error = -ENODEV;
-		else
-			dev_err(&amd756_smbus.dev, "Physical bus removal "
-				"failed\n");
+		dev_err(&amd756_smbus.dev, "Physical bus removal failed\n");
 		goto ERROR0;
 	}
 
--- linux-2.6.27-rc2.orig/drivers/i2c/busses/i2c-nforce2-s4985.c	2008-08-05 18:17:05.000000000 +0200
+++ linux-2.6.27-rc2/drivers/i2c/busses/i2c-nforce2-s4985.c	2008-08-06 20:07:48.000000000 +0200
@@ -150,6 +150,9 @@ static int __init nforce2_s4985_init(voi
 	int i, error;
 	union i2c_smbus_data ioconfig;
 
+	if (!nforce2_smbus)
+		return -ENODEV;
+
 	/* Configure the PCA9556 multiplexer */
 	ioconfig.byte = 0x00; /* All I/O to output mode */
 	error = i2c_smbus_xfer(nforce2_smbus, 0x18, 0, I2C_SMBUS_WRITE, 0x03,
@@ -161,8 +164,6 @@ static int __init nforce2_s4985_init(voi
 	}
 
 	/* Unregister physical bus */
-	if (!nforce2_smbus)
-		return -ENODEV;
 	error = i2c_del_adapter(nforce2_smbus);
 	if (error) {
 		dev_err(&nforce2_smbus->dev, "Physical bus removal failed\n");

This is going to Linus tomorrow.

Thanks,
-- 
Jean Delvare

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

end of thread, other threads:[~2008-08-06 20:21 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-14 20:49 [GIT PULL] i2c updates for 2.6.27, round 1 Jean Delvare
2008-07-16  8:23 ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1) Ingo Molnar
2008-07-16  9:07   ` Jean Delvare
2008-07-16 10:08     ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object Jean Delvare
2008-07-16 12:18       ` Jean Delvare
2008-07-17  9:26         ` Ingo Molnar
2008-07-17  9:33           ` Ingo Molnar
2008-07-17  9:48             ` Alexey Dobriyan
     [not found]               ` <20080717094858.GA18687-QDJVlCTZ4KWTKS93B3g+7KFoa47nwP16@public.gmane.org>
2008-07-17  9:59                 ` Ingo Molnar
2008-08-06 20:21               ` Jean Delvare
     [not found]           ` <20080717092655.GA6115-X9Un+BFzKDI@public.gmane.org>
2008-07-17  9:49             ` Ingo Molnar
2008-07-17  9:54               ` Ingo Molnar
2008-07-17 22:42     ` [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1) Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox