Message ID | 20210929000735.585237-3-saravanak@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Fix simple-bus issues with fw_devlink | expand |
On Wed, Sep 29, 2021 at 2:07 AM Saravana Kannan <saravanak@google.com> wrote: > The simple-pm-bus driver is mandatory for CONFIG_OF based platforms to work > with fw_devlink. So, always compile it in for CONFIG_OF and delete the > config since it's no longer necessary. > > Signed-off-by: Saravana Kannan <saravanak@google.com> > Tested-by: Ulf Hansson <ulf.hansson@linaro.org> Works fine on R-Car Gen/Gen3 (simple-bus), and SH-Mobile AG5, R-Mobile APE6, and K210 (simple-pm-bus). Tested-by: Geert Uytterhoeven <geert+renesas@glider.be> Gr{oetje,eeting}s, Geert
Hi Saravana, This patch broke v5.15-rc6 on RB5 (sm8250 | qcom/qrb5165-rb5.dts). I can't boot past this point https://www.irccloud.com/pastebin/raw/Nv6ZwHmW. Regards, Amit Pundir On Wed, 29 Sept 2021 at 05:37, Saravana Kannan <saravanak@google.com> wrote: > > The simple-pm-bus driver is mandatory for CONFIG_OF based platforms to work > with fw_devlink. So, always compile it in for CONFIG_OF and delete the > config since it's no longer necessary. > > Signed-off-by: Saravana Kannan <saravanak@google.com> > Tested-by: Ulf Hansson <ulf.hansson@linaro.org> > --- > arch/arm/configs/multi_v7_defconfig | 1 - > arch/arm/configs/oxnas_v6_defconfig | 1 - > arch/arm/configs/shmobile_defconfig | 1 - > arch/arm/mach-omap2/Kconfig | 1 - > arch/arm64/configs/defconfig | 1 - > drivers/bus/Kconfig | 12 ------------ > drivers/bus/Makefile | 2 +- > drivers/soc/canaan/Kconfig | 1 - > 8 files changed, 1 insertion(+), 19 deletions(-) > > diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig > index d9abaae118dd..362720ae8d65 100644 > --- a/arch/arm/configs/multi_v7_defconfig > +++ b/arch/arm/configs/multi_v7_defconfig > @@ -196,7 +196,6 @@ CONFIG_PCI_EPF_TEST=m > CONFIG_DEVTMPFS=y > CONFIG_DEVTMPFS_MOUNT=y > CONFIG_OMAP_OCP2SCP=y > -CONFIG_SIMPLE_PM_BUS=y > CONFIG_MTD=y > CONFIG_MTD_CMDLINE_PARTS=y > CONFIG_MTD_BLOCK=y > diff --git a/arch/arm/configs/oxnas_v6_defconfig b/arch/arm/configs/oxnas_v6_defconfig > index cae0db6b4eaf..de37f7e90999 100644 > --- a/arch/arm/configs/oxnas_v6_defconfig > +++ b/arch/arm/configs/oxnas_v6_defconfig > @@ -46,7 +46,6 @@ CONFIG_DEVTMPFS=y > CONFIG_DEVTMPFS_MOUNT=y > CONFIG_DMA_CMA=y > CONFIG_CMA_SIZE_MBYTES=64 > -CONFIG_SIMPLE_PM_BUS=y > CONFIG_MTD=y > CONFIG_MTD_CMDLINE_PARTS=y > CONFIG_MTD_BLOCK=y > diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig > index d9a27e4e0914..18d2a960b2d2 100644 > --- a/arch/arm/configs/shmobile_defconfig > +++ b/arch/arm/configs/shmobile_defconfig > @@ -40,7 +40,6 @@ CONFIG_PCI_RCAR_GEN2=y > CONFIG_PCIE_RCAR_HOST=y > CONFIG_DEVTMPFS=y > CONFIG_DEVTMPFS_MOUNT=y > -CONFIG_SIMPLE_PM_BUS=y > CONFIG_MTD=y > CONFIG_MTD_BLOCK=y > CONFIG_MTD_CFI=y > diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig > index 7df8f5276ddf..02f2f3157f07 100644 > --- a/arch/arm/mach-omap2/Kconfig > +++ b/arch/arm/mach-omap2/Kconfig > @@ -112,7 +112,6 @@ config ARCH_OMAP2PLUS > select PM_GENERIC_DOMAINS > select PM_GENERIC_DOMAINS_OF > select RESET_CONTROLLER > - select SIMPLE_PM_BUS > select SOC_BUS > select TI_SYSC > select OMAP_IRQCHIP > diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig > index f423d08b9a71..474b1f2e3f06 100644 > --- a/arch/arm64/configs/defconfig > +++ b/arch/arm64/configs/defconfig > @@ -245,7 +245,6 @@ CONFIG_DEVTMPFS_MOUNT=y > CONFIG_FW_LOADER_USER_HELPER=y > CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y > CONFIG_HISILICON_LPC=y > -CONFIG_SIMPLE_PM_BUS=y > CONFIG_FSL_MC_BUS=y > CONFIG_TEGRA_ACONNECT=m > CONFIG_GNSS=m > diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig > index e7f7eee6ee9a..dc3801369488 100644 > --- a/drivers/bus/Kconfig > +++ b/drivers/bus/Kconfig > @@ -141,18 +141,6 @@ config QCOM_EBI2 > Interface 2, which can be used to connect things like NAND Flash, > SRAM, ethernet adapters, FPGAs and LCD displays. > > -config SIMPLE_PM_BUS > - tristate "Simple Power-Managed Bus Driver" > - depends on OF && PM > - help > - Driver for transparent busses that don't need a real driver, but > - where the bus controller is part of a PM domain, or under the control > - of a functional clock, and thus relies on runtime PM for managing > - this PM domain and/or clock. > - An example of such a bus controller is the Renesas Bus State > - Controller (BSC, sometimes called "LBSC within Bus Bridge", or > - "External Bus Interface") as found on several Renesas ARM SoCs. > - > config SUN50I_DE2_BUS > bool "Allwinner A64 DE2 Bus Driver" > default ARM64 > diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile > index 397e35392bff..86aacd36a56d 100644 > --- a/drivers/bus/Makefile > +++ b/drivers/bus/Makefile > @@ -26,7 +26,7 @@ obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o > obj-$(CONFIG_QCOM_EBI2) += qcom-ebi2.o > obj-$(CONFIG_SUN50I_DE2_BUS) += sun50i-de2.o > obj-$(CONFIG_SUNXI_RSB) += sunxi-rsb.o > -obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o > +obj-$(CONFIG_OF) += simple-pm-bus.o > obj-$(CONFIG_TEGRA_ACONNECT) += tegra-aconnect.o > obj-$(CONFIG_TEGRA_GMI) += tegra-gmi.o > obj-$(CONFIG_TI_PWMSS) += ti-pwmss.o > diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig > index 8179b69518b4..853096b7e84c 100644 > --- a/drivers/soc/canaan/Kconfig > +++ b/drivers/soc/canaan/Kconfig > @@ -5,7 +5,6 @@ config SOC_K210_SYSCTL > depends on RISCV && SOC_CANAAN && OF > default SOC_CANAAN > select PM > - select SIMPLE_PM_BUS > select SYSCON > select MFD_SYSCON > help > -- > 2.33.0.685.g46640cef36-goog >
* Amit Pundir <amit.pundir@linaro.org> [211021 11:22]: > Hi Saravana, > > This patch broke v5.15-rc6 on RB5 (sm8250 | qcom/qrb5165-rb5.dts). > I can't boot past this point https://www.irccloud.com/pastebin/raw/Nv6ZwHmW. Also, I noticed we now end up with simple-pm-bus.c that does no PM for the legacy which was the whole idea of the driver in the first place :) Saravana, could you consider just adding a new simple-bus.c driver in addition to simple-pm-bus.c for the cases that do not call pm_runtime_enable()? Thanks, Tony
On Thu, Oct 21, 2021 at 4:21 AM Amit Pundir <amit.pundir@linaro.org> wrote: > > Hi Saravana, > > This patch broke v5.15-rc6 on RB5 (sm8250 | qcom/qrb5165-rb5.dts). > I can't boot past this point https://www.irccloud.com/pastebin/raw/Nv6ZwHmW. Amit top posting? How did that happen? :) The fact you are seeing this issue is super strange though. The driver literally does nothing other than allowing some sync_state() callbacks to happen. I also grepped for the occurence of "simple-bus" in arch/arm64/boot/dts/qcom/ and the only instance for 8250 is for the soc node. The only thing I can think of is that without my patch some sync_state() callbacks weren't getting called and maybe it was masking some other issue. Can you try to boot with this log (see log patch below) and see if the device hangs right after a sync_state() callback? Also, looking at the different sync_state() implementations in upstream, I'm guessing one of the devices isn't voting for interconnect bandwidth when it should have. Another thing you could do is boot without the simple-bus changes and then look for all instances of "state_synced" in /sys/devices and then see if any of them has the value "0" after boot up is complete. -Saravana -- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1099,6 +1099,7 @@ static void device_links_flush_sync_list(struct list_head *list, if (dev != dont_lock_dev) device_lock(dev); + dev_info(dev, "Calling sync_state()\n"); if (dev->bus->sync_state) dev->bus->sync_state(dev); else if (dev->driver && dev->driver->sync_state)
On Fri, 22 Oct 2021 at 05:13, Saravana Kannan <saravanak@google.com> wrote: > > On Thu, Oct 21, 2021 at 4:21 AM Amit Pundir <amit.pundir@linaro.org> wrote: > > > > Hi Saravana, > > > > This patch broke v5.15-rc6 on RB5 (sm8250 | qcom/qrb5165-rb5.dts). > > I can't boot past this point https://www.irccloud.com/pastebin/raw/Nv6ZwHmW. > > Amit top posting? How did that happen? :) > > The fact you are seeing this issue is super strange though. The driver > literally does nothing other than allowing some sync_state() callbacks > to happen. I also grepped for the occurence of "simple-bus" in > arch/arm64/boot/dts/qcom/ and the only instance for 8250 is for the > soc node. > > The only thing I can think of is that without my patch some > sync_state() callbacks weren't getting called and maybe it was masking > some other issue. > > Can you try to boot with this log (see log patch below) and see if the > device hangs right after a sync_state() callback? Also, looking at the > different sync_state() implementations in upstream, I'm guessing one > of the devices isn't voting for interconnect bandwidth when it should > have. > > Another thing you could do is boot without the simple-bus changes and > then look for all instances of "state_synced" in /sys/devices and then > see if any of them has the value "0" after boot up is complete. Turned out RB5 is not even reaching up to device_links_flush_sync_list() and seem to be stuck somewhere in device_links_driver_bound(). So I added more print logs to narrow down to any specific lock state but those additional prints seem to have added enough delay to unblock that particular driver (Serial: 8250/16550 driver if I understood the logs correctly) and I eventually booted to UI. On the booted RB5 *with* and *without* the simple-bus changes, I see 4 instances of "0" state_synced nodes at: /sys/devices/platform/soc@0/9100000.interconnect/state_synced /sys/devices/platform/soc@0/1500000.interconnect/state_synced /sys/devices/platform/soc@0/1740000.interconnect/state_synced /sys/devices/platform/soc@0/163d000.interconnect/state_synced Regards, Amit Pundir > > -Saravana > > -- a/drivers/base/core.c > +++ b/drivers/base/core.c > @@ -1099,6 +1099,7 @@ static void device_links_flush_sync_list(struct > list_head *list, > if (dev != dont_lock_dev) > device_lock(dev); > > + dev_info(dev, "Calling sync_state()\n"); > if (dev->bus->sync_state) > dev->bus->sync_state(dev); > else if (dev->driver && dev->driver->sync_state)
On Fri, Oct 22, 2021 at 10:00 AM Amit Pundir <amit.pundir@linaro.org> wrote: > > On Fri, 22 Oct 2021 at 05:13, Saravana Kannan <saravanak@google.com> wrote: > > > > On Thu, Oct 21, 2021 at 4:21 AM Amit Pundir <amit.pundir@linaro.org> wrote: > > > > > > Hi Saravana, > > > > > > This patch broke v5.15-rc6 on RB5 (sm8250 | qcom/qrb5165-rb5.dts). > > > I can't boot past this point https://www.irccloud.com/pastebin/raw/Nv6ZwHmW. > > > > Amit top posting? How did that happen? :) > > > > The fact you are seeing this issue is super strange though. The driver > > literally does nothing other than allowing some sync_state() callbacks > > to happen. I also grepped for the occurence of "simple-bus" in > > arch/arm64/boot/dts/qcom/ and the only instance for 8250 is for the > > soc node. > > > > The only thing I can think of is that without my patch some > > sync_state() callbacks weren't getting called and maybe it was masking > > some other issue. > > > > Can you try to boot with this log (see log patch below) and see if the > > device hangs right after a sync_state() callback? Also, looking at the > > different sync_state() implementations in upstream, I'm guessing one > > of the devices isn't voting for interconnect bandwidth when it should > > have. > > > > Another thing you could do is boot without the simple-bus changes and > > then look for all instances of "state_synced" in /sys/devices and then > > see if any of them has the value "0" after boot up is complete. > > Turned out RB5 is not even reaching up to > device_links_flush_sync_list() and seem to be stuck somewhere in > device_links_driver_bound(). So I added more print logs to narrow down > to any specific lock state but those additional prints seem to have > added enough delay to unblock that particular driver (Serial: > 8250/16550 driver if I understood the logs correctly) and I eventually > booted to UI. Ugh... I think I know what's going on. It popped into my head over the weekend. Couple of ways to confirm my theory: 1. After it finishes booting in both cases, can you compare the output of the command below? I'm expecting to see a significant drop in the number of device links. ls -l /sys/class/devlink | wc -l 2. Can you try out this terrible hack patch (not final fix, no code reviews please) on top of Tot to see if it fixes your issue without having to add hacky logs? Thanks, Saravana --- a/drivers/bus/simple-pm-bus.c +++ b/drivers/bus/simple-pm-bus.c @@ -38,10 +38,12 @@ static int simple_pm_bus_probe(struct platform_device *pdev) * a device that has a more specific driver. */ if (match && match->data) { - if (of_property_match_string(np, "compatible", match->compatible) == 0) + if (of_property_match_string(np, "compatible", match->compatible) == 0) { + of_platform_populate(np, NULL, lookup, &pdev->dev); return 0; - else + } else { return -ENODEV; + } }
On Tue, 26 Oct 2021 at 06:00, Saravana Kannan <saravanak@google.com> wrote: > > On Fri, Oct 22, 2021 at 10:00 AM Amit Pundir <amit.pundir@linaro.org> wrote: > > > > On Fri, 22 Oct 2021 at 05:13, Saravana Kannan <saravanak@google.com> wrote: > > > > > > On Thu, Oct 21, 2021 at 4:21 AM Amit Pundir <amit.pundir@linaro.org> wrote: > > > > > > > > Hi Saravana, > > > > > > > > This patch broke v5.15-rc6 on RB5 (sm8250 | qcom/qrb5165-rb5.dts). > > > > I can't boot past this point https://www.irccloud.com/pastebin/raw/Nv6ZwHmW. > > > > > > Amit top posting? How did that happen? :) > > > > > > The fact you are seeing this issue is super strange though. The driver > > > literally does nothing other than allowing some sync_state() callbacks > > > to happen. I also grepped for the occurence of "simple-bus" in > > > arch/arm64/boot/dts/qcom/ and the only instance for 8250 is for the > > > soc node. > > > > > > The only thing I can think of is that without my patch some > > > sync_state() callbacks weren't getting called and maybe it was masking > > > some other issue. > > > > > > Can you try to boot with this log (see log patch below) and see if the > > > device hangs right after a sync_state() callback? Also, looking at the > > > different sync_state() implementations in upstream, I'm guessing one > > > of the devices isn't voting for interconnect bandwidth when it should > > > have. > > > > > > Another thing you could do is boot without the simple-bus changes and > > > then look for all instances of "state_synced" in /sys/devices and then > > > see if any of them has the value "0" after boot up is complete. > > > > Turned out RB5 is not even reaching up to > > device_links_flush_sync_list() and seem to be stuck somewhere in > > device_links_driver_bound(). So I added more print logs to narrow down > > to any specific lock state but those additional prints seem to have > > added enough delay to unblock that particular driver (Serial: > > 8250/16550 driver if I understood the logs correctly) and I eventually > > booted to UI. > > Ugh... I think I know what's going on. It popped into my head over the weekend. > > Couple of ways to confirm my theory: > 1. After it finishes booting in both cases, can you compare the output > of the command below? I'm expecting to see a significant drop in the > number of device links. > ls -l /sys/class/devlink | wc -l > On a successful boot with debug prints: rb5:/ $ ls -l /sys/class/devlink | wc -l 245 Booting with this SIMPLE_PM_BUS patch reverted: rb5:/ $ ls -l /sys/class/devlink | wc -l 248 > 2. Can you try out this terrible hack patch (not final fix, no code > reviews please) on top of Tot to see if it fixes your issue without > having to add hacky logs? > No luck booting with the following hack patch either. Regards, Amit Pundir > Thanks, > Saravana > > --- a/drivers/bus/simple-pm-bus.c > +++ b/drivers/bus/simple-pm-bus.c > @@ -38,10 +38,12 @@ static int simple_pm_bus_probe(struct platform_device *pdev) > * a device that has a more specific driver. > */ > if (match && match->data) { > - if (of_property_match_string(np, "compatible", > match->compatible) == 0) > + if (of_property_match_string(np, "compatible", > match->compatible) == 0) { > + of_platform_populate(np, NULL, lookup, &pdev->dev); > return 0; > - else > + } else { > return -ENODEV; > + } > }
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig index d9abaae118dd..362720ae8d65 100644 --- a/arch/arm/configs/multi_v7_defconfig +++ b/arch/arm/configs/multi_v7_defconfig @@ -196,7 +196,6 @@ CONFIG_PCI_EPF_TEST=m CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_OMAP_OCP2SCP=y -CONFIG_SIMPLE_PM_BUS=y CONFIG_MTD=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_BLOCK=y diff --git a/arch/arm/configs/oxnas_v6_defconfig b/arch/arm/configs/oxnas_v6_defconfig index cae0db6b4eaf..de37f7e90999 100644 --- a/arch/arm/configs/oxnas_v6_defconfig +++ b/arch/arm/configs/oxnas_v6_defconfig @@ -46,7 +46,6 @@ CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y CONFIG_DMA_CMA=y CONFIG_CMA_SIZE_MBYTES=64 -CONFIG_SIMPLE_PM_BUS=y CONFIG_MTD=y CONFIG_MTD_CMDLINE_PARTS=y CONFIG_MTD_BLOCK=y diff --git a/arch/arm/configs/shmobile_defconfig b/arch/arm/configs/shmobile_defconfig index d9a27e4e0914..18d2a960b2d2 100644 --- a/arch/arm/configs/shmobile_defconfig +++ b/arch/arm/configs/shmobile_defconfig @@ -40,7 +40,6 @@ CONFIG_PCI_RCAR_GEN2=y CONFIG_PCIE_RCAR_HOST=y CONFIG_DEVTMPFS=y CONFIG_DEVTMPFS_MOUNT=y -CONFIG_SIMPLE_PM_BUS=y CONFIG_MTD=y CONFIG_MTD_BLOCK=y CONFIG_MTD_CFI=y diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 7df8f5276ddf..02f2f3157f07 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -112,7 +112,6 @@ config ARCH_OMAP2PLUS select PM_GENERIC_DOMAINS select PM_GENERIC_DOMAINS_OF select RESET_CONTROLLER - select SIMPLE_PM_BUS select SOC_BUS select TI_SYSC select OMAP_IRQCHIP diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index f423d08b9a71..474b1f2e3f06 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -245,7 +245,6 @@ CONFIG_DEVTMPFS_MOUNT=y CONFIG_FW_LOADER_USER_HELPER=y CONFIG_FW_LOADER_USER_HELPER_FALLBACK=y CONFIG_HISILICON_LPC=y -CONFIG_SIMPLE_PM_BUS=y CONFIG_FSL_MC_BUS=y CONFIG_TEGRA_ACONNECT=m CONFIG_GNSS=m diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig index e7f7eee6ee9a..dc3801369488 100644 --- a/drivers/bus/Kconfig +++ b/drivers/bus/Kconfig @@ -141,18 +141,6 @@ config QCOM_EBI2 Interface 2, which can be used to connect things like NAND Flash, SRAM, ethernet adapters, FPGAs and LCD displays. -config SIMPLE_PM_BUS - tristate "Simple Power-Managed Bus Driver" - depends on OF && PM - help - Driver for transparent busses that don't need a real driver, but - where the bus controller is part of a PM domain, or under the control - of a functional clock, and thus relies on runtime PM for managing - this PM domain and/or clock. - An example of such a bus controller is the Renesas Bus State - Controller (BSC, sometimes called "LBSC within Bus Bridge", or - "External Bus Interface") as found on several Renesas ARM SoCs. - config SUN50I_DE2_BUS bool "Allwinner A64 DE2 Bus Driver" default ARM64 diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile index 397e35392bff..86aacd36a56d 100644 --- a/drivers/bus/Makefile +++ b/drivers/bus/Makefile @@ -26,7 +26,7 @@ obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o obj-$(CONFIG_QCOM_EBI2) += qcom-ebi2.o obj-$(CONFIG_SUN50I_DE2_BUS) += sun50i-de2.o obj-$(CONFIG_SUNXI_RSB) += sunxi-rsb.o -obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o +obj-$(CONFIG_OF) += simple-pm-bus.o obj-$(CONFIG_TEGRA_ACONNECT) += tegra-aconnect.o obj-$(CONFIG_TEGRA_GMI) += tegra-gmi.o obj-$(CONFIG_TI_PWMSS) += ti-pwmss.o diff --git a/drivers/soc/canaan/Kconfig b/drivers/soc/canaan/Kconfig index 8179b69518b4..853096b7e84c 100644 --- a/drivers/soc/canaan/Kconfig +++ b/drivers/soc/canaan/Kconfig @@ -5,7 +5,6 @@ config SOC_K210_SYSCTL depends on RISCV && SOC_CANAAN && OF default SOC_CANAAN select PM - select SIMPLE_PM_BUS select SYSCON select MFD_SYSCON help