mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers
@ 2023-09-24 16:22 Fenghua Yu
  2023-09-26 16:27 ` Lijun Pan
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Fenghua Yu @ 2023-09-24 16:22 UTC (permalink / raw)
  To: Vinod Koul, Dave Jiang
  Cc: dmaengine, linux-kernel, Fenghua Yu, Michael Prinke

idxd sub-drivers belong to bus dsa_bus_type. Thus, dsa_bus_type must be
registered in dsa bus init before idxd drivers can be registered.

But the order is wrong when both idxd and idxd_bus are builtin drivers.
In this case, idxd driver is compiled and linked before idxd_bus driver.
Since the initcall order is determined by the link order, idxd sub-drivers
are registered in idxd initcall before dsa_bus_type is registered
in idxd_bus initcall. idxd initcall fails:

[   21.562803] calling  idxd_init_module+0x0/0x110 @ 1
[   21.570761] Driver 'idxd' was unable to register with bus_type 'dsa' because the bus was not initialized.
[   21.586475] initcall idxd_init_module+0x0/0x110 returned -22 after 15717 usecs
[   21.597178] calling  dsa_bus_init+0x0/0x20 @ 1

To fix the issue, compile and link idxd_bus driver before idxd driver
to ensure the right registration order.

Fixes: d9e5481fca74 ("dmaengine: dsa: move dsa_bus_type out of idxd driver to standalone")
Reported-by: Michael Prinke <michael.prinke@intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
 drivers/dma/idxd/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/idxd/Makefile b/drivers/dma/idxd/Makefile
index dc096839ac63..c5e679070e46 100644
--- a/drivers/dma/idxd/Makefile
+++ b/drivers/dma/idxd/Makefile
@@ -1,12 +1,12 @@
 ccflags-y += -DDEFAULT_SYMBOL_NAMESPACE=IDXD
 
+obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o
+idxd_bus-y := bus.o
+
 obj-$(CONFIG_INTEL_IDXD) += idxd.o
 idxd-y := init.o irq.o device.o sysfs.o submit.o dma.o cdev.o debugfs.o
 
 idxd-$(CONFIG_INTEL_IDXD_PERFMON) += perfmon.o
 
-obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o
-idxd_bus-y := bus.o
-
 obj-$(CONFIG_INTEL_IDXD_COMPAT) += idxd_compat.o
 idxd_compat-y := compat.o
-- 
2.37.1


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

* Re: [PATCH] dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers
  2023-09-24 16:22 [PATCH] dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers Fenghua Yu
@ 2023-09-26 16:27 ` Lijun Pan
  2023-09-26 17:23 ` Dave Jiang
  2023-09-28 11:56 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Lijun Pan @ 2023-09-26 16:27 UTC (permalink / raw)
  To: Fenghua Yu, Vinod Koul, Dave Jiang
  Cc: dmaengine, linux-kernel, Michael Prinke



On 9/24/2023 11:22 AM, Fenghua Yu wrote:
> idxd sub-drivers belong to bus dsa_bus_type. Thus, dsa_bus_type must be
> registered in dsa bus init before idxd drivers can be registered.
> 
> But the order is wrong when both idxd and idxd_bus are builtin drivers.
> In this case, idxd driver is compiled and linked before idxd_bus driver.
> Since the initcall order is determined by the link order, idxd sub-drivers
> are registered in idxd initcall before dsa_bus_type is registered
> in idxd_bus initcall. idxd initcall fails:
> 
> [   21.562803] calling  idxd_init_module+0x0/0x110 @ 1
> [   21.570761] Driver 'idxd' was unable to register with bus_type 'dsa' because the bus was not initialized.
> [   21.586475] initcall idxd_init_module+0x0/0x110 returned -22 after 15717 usecs
> [   21.597178] calling  dsa_bus_init+0x0/0x20 @ 1
> 
> To fix the issue, compile and link idxd_bus driver before idxd driver
> to ensure the right registration order.
> 
> Fixes: d9e5481fca74 ("dmaengine: dsa: move dsa_bus_type out of idxd driver to standalone")
> Reported-by: Michael Prinke <michael.prinke@intel.com>
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> ---

I guess it was always configured as CONFIG_INTEL_IDXD=m.
Good catch on =y scenario.

Reviewed-by: Lijun Pan <lijun.pan@intel.com>
Tested-by: Lijun Pan <lijun.pan@intel.com>


>   drivers/dma/idxd/Makefile | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/idxd/Makefile b/drivers/dma/idxd/Makefile
> index dc096839ac63..c5e679070e46 100644
> --- a/drivers/dma/idxd/Makefile
> +++ b/drivers/dma/idxd/Makefile
> @@ -1,12 +1,12 @@
>   ccflags-y += -DDEFAULT_SYMBOL_NAMESPACE=IDXD
>   
> +obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o
> +idxd_bus-y := bus.o
> +
>   obj-$(CONFIG_INTEL_IDXD) += idxd.o
>   idxd-y := init.o irq.o device.o sysfs.o submit.o dma.o cdev.o debugfs.o
>   
>   idxd-$(CONFIG_INTEL_IDXD_PERFMON) += perfmon.o
>   
> -obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o
> -idxd_bus-y := bus.o
> -
>   obj-$(CONFIG_INTEL_IDXD_COMPAT) += idxd_compat.o
>   idxd_compat-y := compat.o

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

* Re: [PATCH] dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers
  2023-09-24 16:22 [PATCH] dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers Fenghua Yu
  2023-09-26 16:27 ` Lijun Pan
@ 2023-09-26 17:23 ` Dave Jiang
  2023-09-28 11:56 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Dave Jiang @ 2023-09-26 17:23 UTC (permalink / raw)
  To: Fenghua Yu, Vinod Koul; +Cc: dmaengine, linux-kernel, Michael Prinke



On 9/24/23 09:22, Fenghua Yu wrote:
> idxd sub-drivers belong to bus dsa_bus_type. Thus, dsa_bus_type must be
> registered in dsa bus init before idxd drivers can be registered.
> 
> But the order is wrong when both idxd and idxd_bus are builtin drivers.
> In this case, idxd driver is compiled and linked before idxd_bus driver.
> Since the initcall order is determined by the link order, idxd sub-drivers
> are registered in idxd initcall before dsa_bus_type is registered
> in idxd_bus initcall. idxd initcall fails:
> 
> [   21.562803] calling  idxd_init_module+0x0/0x110 @ 1
> [   21.570761] Driver 'idxd' was unable to register with bus_type 'dsa' because the bus was not initialized.
> [   21.586475] initcall idxd_init_module+0x0/0x110 returned -22 after 15717 usecs
> [   21.597178] calling  dsa_bus_init+0x0/0x20 @ 1
> 
> To fix the issue, compile and link idxd_bus driver before idxd driver
> to ensure the right registration order.
> 
> Fixes: d9e5481fca74 ("dmaengine: dsa: move dsa_bus_type out of idxd driver to standalone")
> Reported-by: Michael Prinke <michael.prinke@intel.com>
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
>  drivers/dma/idxd/Makefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/idxd/Makefile b/drivers/dma/idxd/Makefile
> index dc096839ac63..c5e679070e46 100644
> --- a/drivers/dma/idxd/Makefile
> +++ b/drivers/dma/idxd/Makefile
> @@ -1,12 +1,12 @@
>  ccflags-y += -DDEFAULT_SYMBOL_NAMESPACE=IDXD
>  
> +obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o
> +idxd_bus-y := bus.o
> +
>  obj-$(CONFIG_INTEL_IDXD) += idxd.o
>  idxd-y := init.o irq.o device.o sysfs.o submit.o dma.o cdev.o debugfs.o
>  
>  idxd-$(CONFIG_INTEL_IDXD_PERFMON) += perfmon.o
>  
> -obj-$(CONFIG_INTEL_IDXD_BUS) += idxd_bus.o
> -idxd_bus-y := bus.o
> -
>  obj-$(CONFIG_INTEL_IDXD_COMPAT) += idxd_compat.o
>  idxd_compat-y := compat.o

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

* Re: [PATCH] dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers
  2023-09-24 16:22 [PATCH] dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers Fenghua Yu
  2023-09-26 16:27 ` Lijun Pan
  2023-09-26 17:23 ` Dave Jiang
@ 2023-09-28 11:56 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2023-09-28 11:56 UTC (permalink / raw)
  To: Dave Jiang, Fenghua Yu; +Cc: dmaengine, linux-kernel, Michael Prinke


On Sun, 24 Sep 2023 09:22:32 -0700, Fenghua Yu wrote:
> idxd sub-drivers belong to bus dsa_bus_type. Thus, dsa_bus_type must be
> registered in dsa bus init before idxd drivers can be registered.
> 
> But the order is wrong when both idxd and idxd_bus are builtin drivers.
> In this case, idxd driver is compiled and linked before idxd_bus driver.
> Since the initcall order is determined by the link order, idxd sub-drivers
> are registered in idxd initcall before dsa_bus_type is registered
> in idxd_bus initcall. idxd initcall fails:
> 
> [...]

Applied, thanks!

[1/1] dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers
      commit: 88928addeec577386e8c83b48b5bc24d28ba97fd

Best regards,
-- 
~Vinod



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

end of thread, other threads:[~2023-09-28 11:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-24 16:22 [PATCH] dmaengine: idxd: Register dsa_bus_type before registering idxd sub-drivers Fenghua Yu
2023-09-26 16:27 ` Lijun Pan
2023-09-26 17:23 ` Dave Jiang
2023-09-28 11:56 ` Vinod Koul

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

all inboxes | Powered by JetHome®