All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ib: Init subsystems if compiled to vmlinuz-core
@ 2017-11-29  9:09 Dmitry Monakhov
       [not found] ` <20171129090949.27602-1-dmonakhov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Monakhov @ 2017-11-29  9:09 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Dmitry Monakhov

Once infiniband was compiled as core component it's subsystems must be
enabled before device initialization. Otherwise this result NULL pointer
dereference during mlx4_core init, calltrace:
->device_add
  if (dev->class) {
     deref  dev->class->p =>NULLPTR

#Config
CONFIG_NET_DEVLINK=y
CONFIG_MAY_USE_DEVLINK=y
CONFIG_MLX4_EN=y

Signed-off-by: Dmitry Monakhov <dmonakhov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
---
 drivers/infiniband/core/cm.c        | 2 +-
 drivers/infiniband/core/device.c    | 2 +-
 drivers/infiniband/ulp/srp/ib_srp.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index 4c4b465..1012fd8 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -4370,6 +4370,6 @@ static void __exit ib_cm_cleanup(void)
 	idr_destroy(&cm.local_id_table);
 }
 
-module_init(ib_cm_init);
+subsys_initcall(ib_cm_init);
 module_exit(ib_cm_cleanup);
 
diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
index 84fc32a..5e1be49 100644
--- a/drivers/infiniband/core/device.c
+++ b/drivers/infiniband/core/device.c
@@ -1253,5 +1253,5 @@ static void __exit ib_core_cleanup(void)
 
 MODULE_ALIAS_RDMA_NETLINK(RDMA_NL_LS, 4);
 
-module_init(ib_core_init);
+subsys_initcall(ib_core_init);
 module_exit(ib_core_cleanup);
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index fa5ccdb..0c21a71 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -3785,5 +3785,5 @@ static void __exit srp_cleanup_module(void)
 	destroy_workqueue(srp_remove_wq);
 }
 
-module_init(srp_init_module);
+subsys_initcall(srp_init_module);
 module_exit(srp_cleanup_module);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] ib: Init subsystems if compiled to vmlinuz-core
       [not found] ` <20171129090949.27602-1-dmonakhov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
@ 2017-11-29  9:47   ` Leon Romanovsky
       [not found]     ` <20171129094703.GW29104-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2017-11-29  9:47 UTC (permalink / raw)
  To: Dmitry Monakhov; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 2419 bytes --]

On Wed, Nov 29, 2017 at 09:09:49AM +0000, Dmitry Monakhov wrote:
> Once infiniband was compiled as core component it's subsystems must be
> enabled before device initialization. Otherwise this result NULL pointer
> dereference during mlx4_core init, calltrace:
> ->device_add
>   if (dev->class) {
>      deref  dev->class->p =>NULLPTR
>
> #Config
> CONFIG_NET_DEVLINK=y
> CONFIG_MAY_USE_DEVLINK=y
> CONFIG_MLX4_EN=y
>
> Signed-off-by: Dmitry Monakhov <dmonakhov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
> ---
>  drivers/infiniband/core/cm.c        | 2 +-
>  drivers/infiniband/core/device.c    | 2 +-
>  drivers/infiniband/ulp/srp/ib_srp.c | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)

First please follow submission rules (patch versioning and changelog)
and second, I have hard time to believe that those changes in CM and SRP
are really needed.

Can you please provide actual kernel panic *without* any changes to init
sequences?

Thanks

>
> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
> index 4c4b465..1012fd8 100644
> --- a/drivers/infiniband/core/cm.c
> +++ b/drivers/infiniband/core/cm.c
> @@ -4370,6 +4370,6 @@ static void __exit ib_cm_cleanup(void)
>  	idr_destroy(&cm.local_id_table);
>  }
>
> -module_init(ib_cm_init);
> +subsys_initcall(ib_cm_init);
>  module_exit(ib_cm_cleanup);
>
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index 84fc32a..5e1be49 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -1253,5 +1253,5 @@ static void __exit ib_core_cleanup(void)
>
>  MODULE_ALIAS_RDMA_NETLINK(RDMA_NL_LS, 4);
>
> -module_init(ib_core_init);
> +subsys_initcall(ib_core_init);
>  module_exit(ib_core_cleanup);
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index fa5ccdb..0c21a71 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -3785,5 +3785,5 @@ static void __exit srp_cleanup_module(void)
>  	destroy_workqueue(srp_remove_wq);
>  }
>
> -module_init(srp_init_module);
> +subsys_initcall(srp_init_module);
>  module_exit(srp_cleanup_module);
> --
> 1.8.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] ib: Init subsystems if compiled to vmlinuz-core
       [not found]     ` <20171129094703.GW29104-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
@ 2017-11-29 10:53       ` Dmitry Monakhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Monakhov @ 2017-11-29 10:53 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> writes:

> On Wed, Nov 29, 2017 at 09:09:49AM +0000, Dmitry Monakhov wrote:
>> Once infiniband was compiled as core component it's subsystems must be
>> enabled before device initialization. Otherwise this result NULL pointer
>> dereference during mlx4_core init, calltrace:
>> ->device_add
>>   if (dev->class) {
>>      deref  dev->class->p =>NULLPTR
>>
>> #Config
>> CONFIG_NET_DEVLINK=y
>> CONFIG_MAY_USE_DEVLINK=y
>> CONFIG_MLX4_EN=y
>>
>> Signed-off-by: Dmitry Monakhov <dmonakhov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
>> ---
>>  drivers/infiniband/core/cm.c        | 2 +-
>>  drivers/infiniband/core/device.c    | 2 +-
>>  drivers/infiniband/ulp/srp/ib_srp.c | 2 +-
>>  3 files changed, 3 insertions(+), 3 deletions(-)
>
> First please follow submission rules (patch versioning and changelog)
> and second, I have hard time to believe that those changes in CM and SRP
> are really needed.
Ok. Seems you are right.
CM: ib_cm_init is always called prior to it's user (ib_ucm_init )
SRP: srp_class used only internally.

First version is enouth. Sorry for a noise.
>
> Can you please provide actual kernel panic *without* any changes to init
> sequences?
>
> Thanks
>
>>
>> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
>> index 4c4b465..1012fd8 100644
>> --- a/drivers/infiniband/core/cm.c
>> +++ b/drivers/infiniband/core/cm.c
>> @@ -4370,6 +4370,6 @@ static void __exit ib_cm_cleanup(void)
>>  	idr_destroy(&cm.local_id_table);
>>  }
>>
>> -module_init(ib_cm_init);
>> +subsys_initcall(ib_cm_init);
>>  module_exit(ib_cm_cleanup);
>>
>> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
>> index 84fc32a..5e1be49 100644
>> --- a/drivers/infiniband/core/device.c
>> +++ b/drivers/infiniband/core/device.c
>> @@ -1253,5 +1253,5 @@ static void __exit ib_core_cleanup(void)
>>
>>  MODULE_ALIAS_RDMA_NETLINK(RDMA_NL_LS, 4);
>>
>> -module_init(ib_core_init);
>> +subsys_initcall(ib_core_init);
>>  module_exit(ib_core_cleanup);
>> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
>> index fa5ccdb..0c21a71 100644
>> --- a/drivers/infiniband/ulp/srp/ib_srp.c
>> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
>> @@ -3785,5 +3785,5 @@ static void __exit srp_cleanup_module(void)
>>  	destroy_workqueue(srp_remove_wq);
>>  }
>>
>> -module_init(srp_init_module);
>> +subsys_initcall(srp_init_module);
>>  module_exit(srp_cleanup_module);
>> --
>> 1.8.3.1
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
>> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2017-11-29 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-29  9:09 [PATCH] ib: Init subsystems if compiled to vmlinuz-core Dmitry Monakhov
     [not found] ` <20171129090949.27602-1-dmonakhov-GEFAQzZX7r8dnm+yROfE0A@public.gmane.org>
2017-11-29  9:47   ` Leon Romanovsky
     [not found]     ` <20171129094703.GW29104-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-11-29 10:53       ` Dmitry Monakhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.