Skip to contentSkip to conversation

arm qemu test failures due to 'driver-core: platform: probe of-devices only using list of compatibles'

DISCUSSION Guenter Roeck 6 participants 26 messages Feb 14, 2016 – Feb 15, 2016 Linux-next tree

lore
Share & tools
lore
#0 lore raw

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Crash log:

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

ie the mmc driver no longer instantiates. Reverting the patch fixes the problem.

Bisect log is attached.

Guenter

---
# bad: [64d9a3617b3b8bc0734ba97caeb433b7019c6187] Add linux-next specific files for 20160212
# good: [388f7b1d6e8ca06762e2454d28d6c3c55ad0fe95] Linux 4.5-rc3
git bisect start 'HEAD' 'v4.5-rc3'
# good: [597dc9d36e8bc04941b61b26ac7aa3f8a33aba53] Merge remote-tracking branch 'sound-asoc/for-next' git bisect good 597dc9d36e8bc04941b61b26ac7aa3f8a33aba53
# bad: [91fe8ea815243ec595753ccf7e14126b6f87f2bf] Merge remote-tracking branch 'usb-chipidea-next/ci-for-usb-next' git bisect bad 91fe8ea815243ec595753ccf7e14126b6f87f2bf
# good: [1d6796e67f265e835bcb1a19d27ba0433dbd75e4] Merge remote-tracking branch 'tip/auto-latest'
git bisect good 1d6796e67f265e835bcb1a19d27ba0433dbd75e4
# bad: [858163465b53ab87c3939cae9e6fd0ecbeb60bfa] Merge remote-tracking branch 'driver-core/driver-core-next' git bisect bad 858163465b53ab87c3939cae9e6fd0ecbeb60bfa
# good: [5acd4c7ca23549bf4e480a92efb7d87d988be432] Merge remote-tracking branch 'kvm-arm/next'
git bisect good 5acd4c7ca23549bf4e480a92efb7d87d988be432
# good: [d28003ab55e09323bf1a026e804165c6d371ae6b] Merge remote-tracking branch 'drivers-x86/for-next' git bisect good d28003ab55e09323bf1a026e804165c6d371ae6b
# good: [f28a8693f4b1eb8b4035167825f2bcd44bd95546] Merge remote-tracking branch 'hsi/for-next'
git bisect good f28a8693f4b1eb8b4035167825f2bcd44bd95546
# good: [d3a7387f8aae81ba0f3687518a9ad7a14bfb165d] Merge remote-tracking branch 'ipmi/for-next'
git bisect good d3a7387f8aae81ba0f3687518a9ad7a14bfb165d
# good: [75f3e8e47f381074801d0034874d20c638d9e3d9] firmware: introduce sysfs driver for QEMU's fw_cfg device git bisect good 75f3e8e47f381074801d0034874d20c638d9e3d9
# good: [9e5b3d6f7f946a3fb4d83ac2ab6d2bfefcdafffb] drivers: dma-coherent: simplify dma_init_coherent_memory return value git bisect good 9e5b3d6f7f946a3fb4d83ac2ab6d2bfefcdafffb
# good: [cf68d85529f7dccc24412887d46e364f4b422a5d] driver-core: platform: fix typo in documentation for multi-driver helper git bisect good cf68d85529f7dccc24412887d46e364f4b422a5d
# bad: [67d02a1bbb334558e9380409a3cd426b36d4578b] driver-core: platform: probe of-devices only using list of compatibles git bisect bad 67d02a1bbb334558e9380409a3cd426b36d4578b

# first bad commit: [67d02a1bbb334558e9380409a3cd426b36d4578b] driver-core: platform: probe of-devices only using list of compatibles
#1 lore raw

[adding lakml and rmk to Cc]

Hello Guenter,

Quoted 12 lines · Guenter Roeck

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Crash log:

Quoted 7 lines

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

ie the mmc driver no longer instantiates. Reverting the patch fixes the problem.

The driver is drivers/mmc/host/mmci.c, right? and the relevant device tree snippet is:

	mmci at 05000 {
		compatible = "arm,pl180", "arm,primecell";
		...
	};

? So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted (or handle this case in a different way), or the mmci driver should declare compatibles (but then it needs to be a platform driver and not an amba driver?).

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw
Quoted 3 lines · Uwe Kleine-K?nig

So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted

Your expectation is wrong. AMBA primecell devices have hardware IDs and are matched to their drivers by those IDs. Just like PCI.

Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#9 lore raw
In reply to Uwe Kleine-König
Quoted 25 lines · Uwe Kleine-K?nig

[adding lakml and rmk to Cc]

Hello Guenter,

Quoted 12 lines · Guenter Roeck

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Crash log:

Quoted 7 lines

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

ie the mmc driver no longer instantiates. Reverting the patch fixes the problem.

Quoted 8 lines

The driver is drivers/mmc/host/mmci.c, right? and the relevant device tree snippet is:

	mmci at 05000 {
		compatible = "arm,pl180", "arm,primecell";
		...
	};

Yes, I think so, or one of the many other similar mmc entries.

Quoted 7 lines

? So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted (or handle this case in a different way), or the mmci driver should declare compatibles (but then it needs to be a platform driver and not an amba driver?).

No idea what the correct solution would be. I do see

         if (of_device_is_compatible(bus, "arm,primecell")) {
                 /*
                  * Don't return an error here to keep compatibility with older
                  * device tree files.
                  */
                 of_amba_device_create(bus, bus_id, platform_data, parent);
                 return 0;
         }

in drivers/of/platform.c, which suggests some special handling for amba devices. No idea if and how that is related, but I do have some concern that fixing the problem for mmc alone might not fix it for all the other devices instantiated with "arm,primecell". After all, my boot tests are really rudimentary (it boots, therefore it works).

Thanks,
Guenter

#10 lore raw

Hello Guenter,

Quoted 2 lines · Guenter Roeck
Quoted 1 line · Uwe Kleine-K?nig

[adding lakml and rmk to Cc]

[adding some more people to Cc]

Quoted 3 lines
Quoted 3 lines · Guenter Roeck
Quoted 2 lines

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

For the new readers, that is 67d02a1bbb334558e9380409a3cd426b36d4578b.

The original idea of this commit was to not bind a device created from device tree when its name matches the driver name but none of the driver's compatibles which might yield some surprises.

Quoted 18 lines
Quoted 18 lines
Quoted 7 lines

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Crash log:

Quoted 7 lines

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

ie the mmc driver no longer instantiates. Reverting the patch fixes the problem.

The driver is drivers/mmc/host/mmci.c, right? and the relevant device tree snippet is:

Quoted 7 lines
Quoted 5 lines
	mmci at 05000 {
		compatible = "arm,pl180", "arm,primecell";
		...
	};

Yes, I think so, or one of the many other similar mmc entries.

So the driver in question is an amba_driver and it fails to bind because

static int platform_match(struct device *dev, struct device_driver *drv)

was changed. This is the platform bus type's match function. Why is this called for amba devices (that I would expect to use amba_bustype and so amba_match)?

The driver isn't matched by of_driver_match_device, so the following code must yield 1 for the mmci device:

        /* Then try ACPI style match */
        if (acpi_driver_match_device(dev, drv))
                return 1;

        /* Then try to match against the id table */
        if (pdrv->id_table)
                return platform_match_id(pdrv->id_table, pdev) != NULL;

        /* fall-back to driver name match */
        return (strcmp(pdev->name, drv->name) == 0);

acpi seems unlikely, and the other two match by the device's name which feels wrong. And I also wonder, what drv is here, because platform_match assumes it is a platform_driver, not an amba_driver.

Quoted 9 lines
Quoted 6 lines

? So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted (or handle this case in a different way), or the mmci driver should declare compatibles (but then it needs to be a platform driver and not an amba driver?).

No idea what the correct solution would be. I do see

Quoted 8 lines
        if (of_device_is_compatible(bus, "arm,primecell")) {
                /*
                 * Don't return an error here to keep compatibility with older
                 * device tree files.
                 */
                of_amba_device_create(bus, bus_id, platform_data, parent);
                return 0;
        }

So there is a new (and better?) way to instantiate amba devices?

Quoted 5 lines

in drivers/of/platform.c, which suggests some special handling for amba devices. No idea if and how that is related, but I do have some concern that fixing the problem for mmc alone might not fix it for all the other devices instantiated with "arm,primecell". After all, my boot tests are really rudimentary (it boots, therefore it works).

I don't see the right thing to do either. Maybe someone else can shed some light on this issue?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw
In reply to Russell King - ARM Linux

Hello Russell,

Quoted 7 lines · Russell King - ARM Linux
Quoted 3 lines · Uwe Kleine-K?nig

So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted

Your expectation is wrong. AMBA primecell devices have hardware IDs and are matched to their drivers by those IDs. Just like PCI.

pci devices don't appear in dt, do they? I don't see the connection between amba devices and platform devices, see my other mail in this thread for some more details.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#4 lore raw
Quoted 8 lines · Uwe Kleine-K?nig

Hello Russell,

Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Uwe Kleine-K?nig

So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted

Quoted 6 lines
Quoted 2 lines

Your expectation is wrong. AMBA primecell devices have hardware IDs and are matched to their drivers by those IDs. Just like PCI.

pci devices don't appear in dt, do they? I don't see the connection between amba devices and platform devices, see my other mail in this thread for some more details.

They both have hardware IDs, and they are both matched via those hardware IDs.

Your change has introduced a regression and is therefore wrong.

Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#5 lore raw

Hello Russell,

Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Uwe Kleine-K?nig
Quoted 7 lines · Russell King - ARM Linux
Quoted 3 lines · Uwe Kleine-K?nig

So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted

Your expectation is wrong. AMBA primecell devices have hardware IDs and are matched to their drivers by those IDs. Just like PCI.

Quoted 6 lines
Quoted 3 lines

pci devices don't appear in dt, do they? I don't see the connection between amba devices and platform devices, see my other mail in this thread for some more details.

They both have hardware IDs, and they are both matched via those hardware IDs.

I changed platform_match which is about matching by dt compatible, acpi and/or device name. I don't see how this can affect an amba device given they match to a driver by a hardware id.

Quoted 1 line

Your change has introduced a regression and is therefore wrong.

I'd like to understand though why and how my commit is wrong to be able to fix it instead of getting it reverted.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#6 lore raw
Quoted 20 lines · Uwe Kleine-K?nig

Hello Russell,

Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Uwe Kleine-K?nig
Quoted 7 lines · Russell King - ARM Linux
Quoted 3 lines · Uwe Kleine-K?nig

So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted

Your expectation is wrong. AMBA primecell devices have hardware IDs and are matched to their drivers by those IDs. Just like PCI.

Quoted 6 lines
Quoted 3 lines

pci devices don't appear in dt, do they? I don't see the connection between amba devices and platform devices, see my other mail in this thread for some more details.

They both have hardware IDs, and they are both matched via those hardware IDs.

Quoted 8 lines

I changed platform_match which is about matching by dt compatible, acpi and/or device name. I don't see how this can affect an amba device given they match to a driver by a hardware id.

Quoted 1 line

Your change has introduced a regression and is therefore wrong.

I'd like to understand though why and how my commit is wrong to be able to fix it instead of getting it reverted.

I don't have the commit, and I haven't seen the patch so I can't comment further, sorry.

Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#7 lore raw

Hello Russell,

Quoted 23 lines · Russell King - ARM Linux
Quoted 22 lines · Uwe Kleine-K?nig
Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Uwe Kleine-K?nig
Quoted 7 lines · Russell King - ARM Linux
Quoted 3 lines · Uwe Kleine-K?nig

So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted

Your expectation is wrong. AMBA primecell devices have hardware IDs and are matched to their drivers by those IDs. Just like PCI.

Quoted 6 lines
Quoted 3 lines

pci devices don't appear in dt, do they? I don't see the connection between amba devices and platform devices, see my other mail in this thread for some more details.

They both have hardware IDs, and they are both matched via those hardware IDs.

I changed platform_match which is about matching by dt compatible, acpi and/or device name. I don't see how this can affect an amba device given they match to a driver by a hardware id.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Your change has introduced a regression and is therefore wrong.

I'd like to understand though why and how my commit is wrong to be able to fix it instead of getting it reverted.

I don't have the commit, and I haven't seen the patch so I can't comment further, sorry.

It's in -next. For a quick look:

	https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=67d02a1bbb33455

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#8 lore raw
Quoted 31 lines · Uwe Kleine-K?nig

Hello Russell,

Quoted 28 lines · Russell King - ARM Linux
Quoted 26 lines · Uwe Kleine-K?nig
Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Uwe Kleine-K?nig
Quoted 7 lines · Russell King - ARM Linux
Quoted 3 lines · Uwe Kleine-K?nig

So the unexpected abnormality here is that even though this device is instantiated by dt, the driver doesn't provide any compatibles. Either my expectation is wrong, then 67d02a1bbb33455 should be reverted

Your expectation is wrong. AMBA primecell devices have hardware IDs and are matched to their drivers by those IDs. Just like PCI.

Quoted 6 lines
Quoted 3 lines

pci devices don't appear in dt, do they? I don't see the connection between amba devices and platform devices, see my other mail in this thread for some more details.

They both have hardware IDs, and they are both matched via those hardware IDs.

I changed platform_match which is about matching by dt compatible, acpi and/or device name. I don't see how this can affect an amba device given they match to a driver by a hardware id.

Quoted 1 line

Your change has introduced a regression and is therefore wrong.

I'd like to understand though why and how my commit is wrong to be able to fix it instead of getting it reverted.

Quoted 6 lines
Quoted 2 lines

I don't have the commit, and I haven't seen the patch so I can't comment further, sorry.

It's in -next. For a quick look:

	https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/commit/?id=67d02a1bbb33455

Well, if that's only touching the platform device matching, it can't have any effect on AMBA bus matching, which uses completely different code. The AMBA bus code is entirely separate from platform devices.

Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#11 lore raw
In reply to Guenter Roeck

Hello Guenter,

Quoted 10 lines · Guenter Roeck

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Quoted 7 lines

Crash log:

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Can you provide a complete boot log? This might already reveal which device is failing. It might not be the mmci device but something it depends on (clock, bus parent, irq).

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#12 lore raw
Quoted 21 lines · Uwe Kleine-K?nig

Hello Guenter,

Quoted 10 lines · Guenter Roeck

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Quoted 7 lines

Crash log:

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Quoted 3 lines

Can you provide a complete boot log? This might already reveal which device is failing. It might not be the mmci device but something it depends on (clock, bus parent, irq).

FWIW the PL180 on my Juno still works fine with this patch picked on top of -rc3, so the issue would seem to be something else - From a quick comparison between the DTs I see a slight difference in compatible strings for the clocks, but the more likely-looking suspect is that the VExpress DT references some GPIOs where the Juno DT doesn't.

Robin.

Quoted 4 lines

Best regards
Uwe

#13 lore raw
Quoted 5 lines · Robin Murphy

FWIW the PL180 on my Juno still works fine with this patch picked on top of -rc3, so the issue would seem to be something else - From a quick comparison between the DTs I see a slight difference in compatible strings for the clocks, but the more likely-looking suspect is that the VExpress DT references some GPIOs where the Juno DT doesn't.

Maybe it would be a good idea that Uwe creates a patch which initially warns when a DT platform device falls back to matching via the platform strings?

It's likely that the "basic subsystem" platform drivers are silent when they probe, so having notification of a fallback would at least put something into the kernel log when that happens - and then later change that to be a hard failure (as Uwe is trying to do with his patch.)

However, I have to bring up another point: is what Uwe is trying to do actually the right thing? The DT platform device code has the ability to create standard platform devices from DT, with an of_node, but with standard names, and platform data. It's there for compatibility with older systems, and is there to allow systems to be transitioned over.

This patch breaks all that: despite the DT code changing the platform device bus_id from the address.nodename format to the standard format (thus allowing unconverted platform drivers to match), this patch means that because the platform device has a of_node attached, this will now fail.

Therefore, I think Uwe's patch is just wrong - or, if it's something we want, the auxdata table support code needs to _also_ be ripped out of the drivers/of/platform.c code, but that then means anyone who wants to go through the conversion has a big flag-day change to go through.

Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#18 lore raw
In reply to Uwe Kleine-König
Quoted 21 lines · Uwe Kleine-K?nig

Hello Guenter,

Quoted 10 lines · Guenter Roeck

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Quoted 7 lines

Crash log:

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Quoted 4 lines

Can you provide a complete boot log? This might already reveal which device is failing. It might not be the mmci device but something it depends on (clock, bus parent, irq).

Sure, something else may be failing, but why does reverting your patch fix the problem ?

Anyway, complete logs are at http://kerneltests.org/builders.

http://kerneltests.org/builders/qemu-arm-next/builds/376/steps/qemubuildcommand/logs/stdio

is the most recent log (next-20120215). Look for the vexpress crashes; the overo crash bisected to to 'PM / OPP: Disable OPPs that aren't supported by the regulator', in next-20160212, which I have not fully analyzed yet, and the beagle crashes as well as the 'new' overo crash are brand new.

Guenter

#19 lore raw
Quoted 30 lines · Guenter Roeck
Quoted 21 lines · Uwe Kleine-K?nig

Hello Guenter,

Quoted 10 lines · Guenter Roeck

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Quoted 7 lines

Crash log:

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Quoted 4 lines

Can you provide a complete boot log? This might already reveal which device is failing. It might not be the mmci device but something it depends on (clock, bus parent, irq).

Sure, something else may be failing, but why does reverting your patch fix the problem ?

Quoted 8 lines

Anyway, complete logs are at http://kerneltests.org/builders.

http://kerneltests.org/builders/qemu-arm-next/builds/376/steps/qemubuildcommand/logs/stdio

is the most recent log (next-20120215). Look for the vexpress crashes; the overo crash bisected to to 'PM / OPP: Disable OPPs that aren't supported by the regulator', in next-20160212, which I have not fully analyzed yet, and the beagle crashes as well as the 'new' overo crash are brand new.

Looking at the vexpress-ca9 one, nothing stands out to me apart from the lack of messages about a MMC driver. I don't see anything there which indicates why that would be.

Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#14 lore raw
In reply to Russell King - ARM Linux

Hello Russell,

Quoted 28 lines · Russell King - ARM Linux
Quoted 5 lines · Robin Murphy

FWIW the PL180 on my Juno still works fine with this patch picked on top of -rc3, so the issue would seem to be something else - From a quick comparison between the DTs I see a slight difference in compatible strings for the clocks, but the more likely-looking suspect is that the VExpress DT references some GPIOs where the Juno DT doesn't.

Maybe it would be a good idea that Uwe creates a patch which initially warns when a DT platform device falls back to matching via the platform strings?

It's likely that the "basic subsystem" platform drivers are silent when they probe, so having notification of a fallback would at least put something into the kernel log when that happens - and then later change that to be a hard failure (as Uwe is trying to do with his patch.)

However, I have to bring up another point: is what Uwe is trying to do actually the right thing? The DT platform device code has the ability to create standard platform devices from DT, with an of_node, but with standard names, and platform data. It's there for compatibility with older systems, and is there to allow systems to be transitioned over.

This patch breaks all that: despite the DT code changing the platform device bus_id from the address.nodename format to the standard format (thus allowing unconverted platform drivers to match), this patch means that because the platform device has a of_node attached, this will now fail.

Quoted 4 lines

Therefore, I think Uwe's patch is just wrong - or, if it's something we want, the auxdata table support code needs to _also_ be ripped out of the drivers/of/platform.c code, but that then means anyone who wants to go through the conversion has a big flag-day change to go through.

That's a valid concern I wasn't aware of when I created the patch.

So maybe just emitting a warning as you suggested is a good idea. And additionally only emit it when the driver is dt aware, too.

Greg, can you drop this patch, or do you need a proper changelog for a revert? On top of that I'd then create a new patch which is more conservative.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#15 lore raw
Quoted 36 lines · Uwe Kleine-K?nig

Hello Russell,

Quoted 28 lines · Russell King - ARM Linux
Quoted 5 lines · Robin Murphy

FWIW the PL180 on my Juno still works fine with this patch picked on top of -rc3, so the issue would seem to be something else - From a quick comparison between the DTs I see a slight difference in compatible strings for the clocks, but the more likely-looking suspect is that the VExpress DT references some GPIOs where the Juno DT doesn't.

Maybe it would be a good idea that Uwe creates a patch which initially warns when a DT platform device falls back to matching via the platform strings?

It's likely that the "basic subsystem" platform drivers are silent when they probe, so having notification of a fallback would at least put something into the kernel log when that happens - and then later change that to be a hard failure (as Uwe is trying to do with his patch.)

However, I have to bring up another point: is what Uwe is trying to do actually the right thing? The DT platform device code has the ability to create standard platform devices from DT, with an of_node, but with standard names, and platform data. It's there for compatibility with older systems, and is there to allow systems to be transitioned over.

This patch breaks all that: despite the DT code changing the platform device bus_id from the address.nodename format to the standard format (thus allowing unconverted platform drivers to match), this patch means that because the platform device has a of_node attached, this will now fail.

Quoted 4 lines

Therefore, I think Uwe's patch is just wrong - or, if it's something we want, the auxdata table support code needs to _also_ be ripped out of the drivers/of/platform.c code, but that then means anyone who wants to go through the conversion has a big flag-day change to go through.

Quoted 8 lines

That's a valid concern I wasn't aware of when I created the patch.

So maybe just emitting a warning as you suggested is a good idea. And additionally only emit it when the driver is dt aware, too.

Greg, can you drop this patch, or do you need a proper changelog for a revert? On top of that I'd then create a new patch which is more conservative.

A hint as to what the git commit id was would be helpful, I can just revert it based on that.

thanks,

greg k-h

#20 lore raw
In reply to Guenter Roeck
Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Uwe Kleine-K?nig

Hello Guenter,

Quoted 17 lines · Guenter Roeck

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Crash log:

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Quoted 7 lines
Quoted 4 lines

Can you provide a complete boot log? This might already reveal which device is failing. It might not be the mmci device but something it depends on (clock, bus parent, irq).

Sure, something else may be failing, but why does reverting your patch fix the problem ?

Well, my patch made matching of platform devices to platform drivers more strict. Your machine relies on the respective binding though. So of course reverting my patch "repairs" your machine, but that doesn't necessarily mean that my patch is wrong. Even though I'm convinced in the meantime by Russell that there are false positives it doesn't necessarily imply that your case is such a false positive, too.

One example of a combination of driver + device I intended to break with my patch was drivers/mtd/nand/mxc_nand.c and devices that got bound to that by name. The driver does:

	const struct of_device_id *of_id =
		of_match_device(mxcnd_dt_ids, host->dev);

and doesn't handle of_id being NULL after that. Some people argued (also for other drivers in similar situations) that this cannot happen because all compatibles had a non-NULL device_id. That is an error that is easy to make and so the idea was to just not bind in such a case and safe the user from the surprise.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#16 lore raw
In reply to Greg Kroah-Hartman

Hello Greg,

Quoted 7 lines · Greg Kroah-Hartman
Quoted 3 lines · Uwe Kleine-K?nig

Greg, can you drop this patch, or do you need a proper changelog for a revert? On top of that I'd then create a new patch which is more conservative.

A hint as to what the git commit id was would be helpful, I can just revert it based on that.

This is 67d02a1bbb33 ("driver-core: platform: probe of-devices only using list of compatibles")

If you need a log, something like:

Reallow binding of of-devices by name

It turned out that there are valid reasons (e.g. step by step conversion to device tree probing using auxdata) to bind of-instantiated devices to drivers by name. So revert to the original logic.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#23 lore raw
In reply to Guenter Roeck
Quoted 29 lines · Guenter Roeck
Quoted 23 lines · Uwe Kleine-K?nig

Hello Guenter,

Quoted 12 lines · Guenter Roeck

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Crash log:

Quoted 7 lines

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on

unknown-block(0,0)

Quoted 4 lines

Can you provide a complete boot log? This might already reveal which device is failing. It might not be the mmci device but something it depends on (clock, bus parent, irq).

Quoted 8 lines

Sure, something else may be failing, but why does reverting your patch fix the problem ?

Anyway, complete logs are at http://kerneltests.org/builders.

http://kerneltests.org/builders/qemu-arm-next/builds/376/steps/qemubuildcommand/logs/stdio

Sorry for missing this earlier, I could reproduce this on my TC2. The issue is with card-detect gpio probing. It's not related to AMBA probing as discussed on the mail thread.

mfd_add_device adds devices with of_node when cell->of_compatible is matched, but the device created is expected to be matched based on name which the patch under discussion clearly breaks.

One other option I see is to set driver_override for mfd devices (something like below) but I am not sure that can be generic.

Signature · 2 lines
Regards,
Sudeep
#24 lore raw
Quoted 7 lines · Sudeep Holla

Sorry for missing this earlier, I could reproduce this on my TC2. The issue is with card-detect gpio probing. It's not related to AMBA probing as discussed on the mail thread.

mfd_add_device adds devices with of_node when cell->of_compatible is matched, but the device created is expected to be matched based on name which the patch under discussion clearly breaks.

If I'm understanding you correctly, you're saying that MFD re-adds platform devices with the of_node of a new platform device pointing to an existing of_node, but expects this new platform device to match a _different_ driver?

Sounds like MFD needs fixing. I've said this before: of_node's must _never_ be copied between different device structures, especially when they are on the _same_ bus - quite simply because the driver core _can_ match using the DT compatible.

For example... let's say you have a platform device called "1234.foo" created by DT with compatible of "example,foo". You have two platform drivers. One of them matches compatible "example,foo" and the other matches against platform devices with a name of "bar".

The "example,foo" device driver is matched against "1234.foo". It creates a platform device with a name of "bar" and bus ID "bar.0", setting the of_node to the same as "1234.foo".

When scanning for a matching driver, if the "example,foo" driver is found first, "bar.0" will be matched to this driver, and its probe method called. If it accepts this device, it will repeat its action, creating "bar.1". Repeat until you run out of memory.

If it instead finds the "bar" driver first, this driver will be used and everything appears to work correctly.

Signature · 3 lines
RMK's Patch system: http://www.arm.linux.org.uk/developer/patches/
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
#21 lore raw
In reply to Uwe Kleine-König
Quoted 42 lines · Uwe Kleine-K?nig
Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Uwe Kleine-K?nig

Hello Guenter,

Quoted 17 lines · Guenter Roeck

Uwe,

Your patch 'driver-core: platform: probe of-devices only using list of compatibles' causes the following qemu tests to crash in -next.

arm:vexpress-a9:vexpress_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:vexpress_defconfig:vexpress-v2p-ca15-tc1 arm:vexpress-a9:multi_v7_defconfig:vexpress-v2p-ca9 arm:vexpress-a15:multi_v7_defconfig:vexpress-v2p-ca15-tc1

Crash log:

VFS: Cannot open root device "mmcblk0" or unknown-block(0,0): error -6 Please append a correct "root=" boot option; here are the available partitions:
1f00 131072 mtdblock0 (driver?)
1f01 32768 mtdblock1 (driver?)

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
Quoted 7 lines
Quoted 4 lines

Can you provide a complete boot log? This might already reveal which device is failing. It might not be the mmci device but something it depends on (clock, bus parent, irq).

Sure, something else may be failing, but why does reverting your patch fix the problem ?

Well, my patch made matching of platform devices to platform drivers more strict. Your machine relies on the respective binding though. So of course reverting my patch "repairs" your machine, but that doesn't necessarily mean that my patch is wrong. Even though I'm convinced in the meantime by Russell that there are false positives it doesn't necessarily imply that your case is such a false positive, too.

One example of a combination of driver + device I intended to break with my patch was drivers/mtd/nand/mxc_nand.c and devices that got bound to that by name. The driver does:

Quoted 9 lines
	const struct of_device_id *of_id =
		of_match_device(mxcnd_dt_ids, host->dev);

and doesn't handle of_id being NULL after that. Some people argued (also for other drivers in similar situations) that this cannot happen because all compatibles had a non-NULL device_id. That is an error that is easy to make and so the idea was to just not bind in such a case and safe the user from the surprise.

I added some debugging on top of your patch, and get:

platform basic-mmio-gpio.1.auto: Device node exists [/smb/motherboard/iofpga at 7,00000000/sysreg at 00000/sys_led at 08], of_driver_match_device() failed platform basic-mmio-gpio.1.auto: platform_match_id() succeeded
platform basic-mmio-gpio.2.auto: Device node exists [/smb/motherboard/iofpga at 7,00000000/sysreg at 00000/sys_mci at 48], of_driver_match_device() failed platform basic-mmio-gpio.2.auto: platform_match_id() succeeded
platform basic-mmio-gpio.3.auto: Device node exists [/smb/motherboard/iofpga at 7,00000000/sysreg at 00000/sys_flash at 4c], of_driver_match_device() failed platform basic-mmio-gpio.3.auto: platform_match_id() succeeded

So it isn't the mmc driver failing to instantiate directly, but (I think) vexpress-sysreg.

Guenter

#25 lore raw
In reply to Russell King - ARM Linux
Quoted 5 lines · Russell King - ARM Linux
Quoted 4 lines · Sudeep Holla

Sorry for missing this earlier, I could reproduce this on my TC2. The issue is with card-detect gpio probing. It's not related to AMBA probing as discussed on the mail thread.

Quoted 9 lines
Quoted 3 lines

mfd_add_device adds devices with of_node when cell->of_compatible is matched, but the device created is expected to be matched based on name which the patch under discussion clearly breaks.

If I'm understanding you correctly, you're saying that MFD re-adds platform devices with the of_node of a new platform device pointing to an existing of_node, but expects this new platform device to match a _different_ driver?

Sorry if I was not clear.

I don't think it re-adds. IIUC mfd cells are specified inside the mfd device DT node. MFD adds devices for it's child nodes with the associated device node but with the name specified by MFD cells matching the compatible.

Quoted 5 lines

Sounds like MFD needs fixing. I've said this before: of_node's must _never_ be copied between different device structures, especially when they are on the _same_ bus - quite simply because the driver core _can_ match using the DT compatible.

I don't think that's happening in this case at-least. For example:

Device node compatible: arm,vexpress-sysreg Child node compatible: arm,vexpress-sysreg,sys_mci

MFD device is created for above child node with name "basic-mmio-gpio.<id>.auto" as it matched the MFD cell of_compatible

Since there's no driver to match "arm,vexpress-sysreg,sys_mci", it fails with $subject patch applied which otherwise would do normal name matching

Signature · 2 lines
Regards,
Sudeep
#22 lore raw
In reply to Guenter Roeck

On 15/02/16 18:12, Guenter Roeck wrote:

[...]

Quoted 16 lines

I added some debugging on top of your patch, and get:

platform basic-mmio-gpio.1.auto: Device node exists [/smb/motherboard/iofpga at 7,00000000/sysreg at 00000/sys_led at 08], of_driver_match_device() failed
platform basic-mmio-gpio.1.auto: platform_match_id() succeeded platform basic-mmio-gpio.2.auto: Device node exists [/smb/motherboard/iofpga at 7,00000000/sysreg at 00000/sys_mci at 48], of_driver_match_device() failed
platform basic-mmio-gpio.2.auto: platform_match_id() succeeded platform basic-mmio-gpio.3.auto: Device node exists [/smb/motherboard/iofpga at 7,00000000/sysreg at 00000/sys_flash at 4c], of_driver_match_device() failed
platform basic-mmio-gpio.3.auto: platform_match_id() succeeded

Quoted 3 lines

So it isn't the mmc driver failing to instantiate directly, but (I think) vexpress-sysreg.

That's correct, I could reproduce this issue and reported with similar analysis earlier [1]

--
Regards,
Sudeep

[1] http://www.spinics.net/lists/arm-kernel/msg483107.html

#17 lore raw
In reply to Uwe Kleine-König
Quoted 14 lines · Uwe Kleine-K?nig

Hello Greg,

Quoted 7 lines · Greg Kroah-Hartman
Quoted 3 lines · Uwe Kleine-K?nig

Greg, can you drop this patch, or do you need a proper changelog for a revert? On top of that I'd then create a new patch which is more conservative.

A hint as to what the git commit id was would be helpful, I can just revert it based on that.

This is 67d02a1bbb33 ("driver-core: platform: probe of-devices only using list of compatibles")

Quoted 8 lines

If you need a log, something like:

Reallow binding of of-devices by name

It turned out that there are valid reasons (e.g. step by step conversion to device tree probing using auxdata) to bind of-instantiated devices to drivers by name. So revert to the original logic.

Now reverted, thanks for the text.

greg k-h