Skip to contentSkip to conversation

i2c updates for 2.6.27, round 1

GIT PULL Jean Delvare 4 participants 13 messages Jul 14, 2008 – Aug 6, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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,

Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c
#1 lore raw

[crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1)

hi Jean,

Quoted 1 line · Jean Delvare

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 <[email protected]>
| 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 <[email protected]>
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 <[email protected]>
---
 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(-)
drivers/i2c/busses/Kconfig +12 -25
index 6ee997b..2a3819d 100644
@@ -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"
drivers/i2c/busses/Makefile +0 -1
index 97dbfa2..1adb173 100644
@@ -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
drivers/i2c/busses/i2c-nforce2-s4985.c deleted +0 -257

257 lines not on this page · raw message

drivers/i2c/busses/i2c-nforce2.c +0 -16
index 3b19bc4..7048e55 100644
@@ -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);
#2 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1)

Hi Ingo,

Quoted 46 lines · Ingo Molnar

hi Jean,

Quoted 1 line · Jean Delvare

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 <[email protected]>
| Date:   Mon Jul 14 22:38:21 2008 +0200
|
|    i2c-nforce2: Add support for multiplexing on the Tyan S4985
Quoted 4 lines

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 ;)).

Quoted 2 lines

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,

Signature · 1 line
Jean Delvare
#3 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object

Quoted 35 lines · Jean Delvare

Hi Ingo,

Quoted 32 lines · Ingo Molnar

hi Jean,

Quoted 1 line · Jean Delvare

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...

Signature · 1 line
Jean Delvare
#4 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object

Hi Ingo, John,

Thanks a lot for reporting this bug quickly, BTW.

Quoted 33 lines · Jean Delvare
Quoted 23 lines · Jean Delvare
Quoted 22 lines · Ingo Molnar
Quoted 1 line · Jean Delvare

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
Quoted 8 lines
Quoted 8 lines
[   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 
Quoted 1 line

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 <[email protected]>
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.

---
 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(-)
drivers/i2c/i2c-core.c +4 -0
@@ -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;
drivers/i2c/busses/i2c-nforce2-s4985.c +15 -16
@@ -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 <[email protected]>");
drivers/i2c/busses/i2c-amd756-s4882.c +13 -14
@@ -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 <[email protected]>");
Signature · 1 line
Jean Delvare
#5 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object

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

#6 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object

Quoted 5 lines · Ingo Molnar

Jean,

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

Quoted 7 lines

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 <[email protected]>
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 <[email protected]>
---
 drivers/i2c/busses/Kconfig |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/i2c/busses/Kconfig +3 -0
index 6ee997b..2213fab 100644
@@ -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
#7 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object

Quoted 16 lines · Ingo Molnar
Quoted 5 lines · Ingo Molnar

Jean,

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

Quoted 7 lines

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 
Quoted 2 lines

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.

#8 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object

Quoted 17 lines · Alexey Dobriyan
Quoted 16 lines · Ingo Molnar
Quoted 12 lines · Ingo Molnar

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 
Quoted 5 lines
Quoted 2 lines

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.

Quoted 6 lines

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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#9 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object

In reply to Alexey Dobriyan

Hi Alexey, Ingo,

Quoted 22 lines · Alexey Dobriyan
Quoted 16 lines · Ingo Molnar
Quoted 5 lines · Ingo Molnar

Jean,

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

Quoted 7 lines

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 
Quoted 2 lines

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

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

Quoted 8 lines

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.

---
 drivers/i2c/busses/i2c-amd756-s4882.c  |    9 ++++-----
 drivers/i2c/busses/i2c-nforce2-s4985.c |    5 +++--
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-amd756-s4882.c +4 -5
@@ -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;
 	}
 
drivers/i2c/busses/i2c-nforce2-s4985.c +3 -2
@@ -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,

Signature · 1 line
Jean Delvare
#10 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object

In reply to Ingo Molnar
Quoted 2 lines · Ingo Molnar

-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
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

#11 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object

Quoted 9 lines · Ingo Molnar

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
Quoted 3 lines
[   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 <[email protected]>
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 <[email protected]>
---
 drivers/i2c/busses/Kconfig |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/i2c/busses/Kconfig +3 -0
index 2213fab..ead9209 100644
@@ -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
#12 lore raw

Re: [crash, bisected] I2C, kobject (ffff81003e8c4160): tried to init an initialized object (was: Re: [GIT PULL] i2c updates for 2.6.27, round 1)

In reply to Jean Delvare
Quoted 6 lines · Jean Delvare
Quoted 2 lines

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