[net] net/smc: Fix dependency of SMC on ISM

Message ID 20231006125847.1517840-1-gbayer@linux.ibm.com
State New
Headers
Series [net] net/smc: Fix dependency of SMC on ISM |

Commit Message

Gerd Bayer Oct. 6, 2023, 12:58 p.m. UTC
  When the SMC protocol is built into the kernel proper while ISM is
configured to be built as module, linking the kernel fails due to
unresolved dependencies out of net/smc/smc_ism.o to
ism_get_smcd_ops, ism_register_client, and ism_unregister_client
as reported via the linux-next test automation (see link).
This however is a bug introduced a while ago.

Correct the dependency list in ISM's and SMC's Kconfig to reflect the
dependencies that are actually inverted. With this you cannot build a
kernel with CONFIG_SMC=y and CONFIG_ISM=m. Either ISM needs to be 'y',
too - or a 'n'. That way, SMC can still be configured on non-s390
architectures that do not have (nor need) an ISM driver.

Fixes: 89e7d2ba61b7 ("net/ism: Add new API for client registration")

Reported-by: Randy Dunlap <rdunlap@infradead.org>
Closes: https://lore.kernel.org/linux-next/d53b5b50-d894-4df8-8969-fd39e63440ae@infradead.org/
Co-developed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Signed-off-by: Wenjia Zhang <wenjia@linux.ibm.com>
Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
---
 drivers/s390/net/Kconfig | 2 +-
 net/smc/Kconfig          | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
  

Comments

Simon Horman Oct. 6, 2023, 2:48 p.m. UTC | #1
On Fri, Oct 06, 2023 at 02:58:47PM +0200, Gerd Bayer wrote:
> When the SMC protocol is built into the kernel proper while ISM is
> configured to be built as module, linking the kernel fails due to
> unresolved dependencies out of net/smc/smc_ism.o to
> ism_get_smcd_ops, ism_register_client, and ism_unregister_client
> as reported via the linux-next test automation (see link).
> This however is a bug introduced a while ago.
> 
> Correct the dependency list in ISM's and SMC's Kconfig to reflect the
> dependencies that are actually inverted. With this you cannot build a
> kernel with CONFIG_SMC=y and CONFIG_ISM=m. Either ISM needs to be 'y',
> too - or a 'n'. That way, SMC can still be configured on non-s390
> architectures that do not have (nor need) an ISM driver.
> 
> Fixes: 89e7d2ba61b7 ("net/ism: Add new API for client registration")
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Closes: https://lore.kernel.org/linux-next/d53b5b50-d894-4df8-8969-fd39e63440ae@infradead.org/
> Co-developed-by: Wenjia Zhang <wenjia@linux.ibm.com>
> Signed-off-by: Wenjia Zhang <wenjia@linux.ibm.com>
> Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>

Reviewed-by: Simon Horman <horms@kernel.org>
Tested-by: Simon Horman <horms@kernel.org> # build-tested
  
Randy Dunlap Oct. 6, 2023, 8:05 p.m. UTC | #2
Hi,

On 10/6/23 05:58, Gerd Bayer wrote:
> When the SMC protocol is built into the kernel proper while ISM is
> configured to be built as module, linking the kernel fails due to
> unresolved dependencies out of net/smc/smc_ism.o to
> ism_get_smcd_ops, ism_register_client, and ism_unregister_client
> as reported via the linux-next test automation (see link).
> This however is a bug introduced a while ago.
> 
> Correct the dependency list in ISM's and SMC's Kconfig to reflect the
> dependencies that are actually inverted. With this you cannot build a
> kernel with CONFIG_SMC=y and CONFIG_ISM=m. Either ISM needs to be 'y',
> too - or a 'n'. That way, SMC can still be configured on non-s390
> architectures that do not have (nor need) an ISM driver.
> 
> Fixes: 89e7d2ba61b7 ("net/ism: Add new API for client registration")
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Closes: https://lore.kernel.org/linux-next/d53b5b50-d894-4df8-8969-fd39e63440ae@infradead.org/
> Co-developed-by: Wenjia Zhang <wenjia@linux.ibm.com>
> Signed-off-by: Wenjia Zhang <wenjia@linux.ibm.com>
> Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>

Works for me. Thanks.

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org> # build-tested


> ---
>  drivers/s390/net/Kconfig | 2 +-
>  net/smc/Kconfig          | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig
> index 74760c1a163b..4902d45e929c 100644
> --- a/drivers/s390/net/Kconfig
> +++ b/drivers/s390/net/Kconfig
> @@ -102,7 +102,7 @@ config CCWGROUP
>  
>  config ISM
>  	tristate "Support for ISM vPCI Adapter"
> -	depends on PCI && SMC
> +	depends on PCI
>  	default n
>  	help
>  	  Select this option if you want to use the Internal Shared Memory
> diff --git a/net/smc/Kconfig b/net/smc/Kconfig
> index 1ab3c5a2c5ad..746be3996768 100644
> --- a/net/smc/Kconfig
> +++ b/net/smc/Kconfig
> @@ -2,6 +2,7 @@
>  config SMC
>  	tristate "SMC socket protocol family"
>  	depends on INET && INFINIBAND
> +	depends on m || ISM != m
>  	help
>  	  SMC-R provides a "sockets over RDMA" solution making use of
>  	  RDMA over Converged Ethernet (RoCE) technology to upgrade
  
patchwork-bot+netdevbpf@kernel.org Oct. 10, 2023, 10:20 a.m. UTC | #3
Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Fri,  6 Oct 2023 14:58:47 +0200 you wrote:
> When the SMC protocol is built into the kernel proper while ISM is
> configured to be built as module, linking the kernel fails due to
> unresolved dependencies out of net/smc/smc_ism.o to
> ism_get_smcd_ops, ism_register_client, and ism_unregister_client
> as reported via the linux-next test automation (see link).
> This however is a bug introduced a while ago.
> 
> [...]

Here is the summary with links:
  - [net] net/smc: Fix dependency of SMC on ISM
    https://git.kernel.org/netdev/net/c/a72178cfe855

You are awesome, thank you!
  
Randy Dunlap Oct. 16, 2023, 11:09 p.m. UTC | #4
Hi Gerd,

On 10/6/23 05:58, Gerd Bayer wrote:
> When the SMC protocol is built into the kernel proper while ISM is
> configured to be built as module, linking the kernel fails due to
> unresolved dependencies out of net/smc/smc_ism.o to
> ism_get_smcd_ops, ism_register_client, and ism_unregister_client
> as reported via the linux-next test automation (see link).
> This however is a bug introduced a while ago.
> 
> Correct the dependency list in ISM's and SMC's Kconfig to reflect the
> dependencies that are actually inverted. With this you cannot build a
> kernel with CONFIG_SMC=y and CONFIG_ISM=m. Either ISM needs to be 'y',
> too - or a 'n'. That way, SMC can still be configured on non-s390
> architectures that do not have (nor need) an ISM driver.
> 
> Fixes: 89e7d2ba61b7 ("net/ism: Add new API for client registration")
> 
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Closes: https://lore.kernel.org/linux-next/d53b5b50-d894-4df8-8969-fd39e63440ae@infradead.org/
> Co-developed-by: Wenjia Zhang <wenjia@linux.ibm.com>
> Signed-off-by: Wenjia Zhang <wenjia@linux.ibm.com>
> Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>

With this patch, ISM can be build without SMC being enabled.

This leads to some build warnings:

../drivers/s390/net/ism_drv.c:572:12: warning: 'ism_get_local_gid' defined but not used [-Wunused-function]
  572 | static u64 ism_get_local_gid(struct ism_dev *ism)
      |            ^~~~~~~~~~~~~~~~~
../drivers/s390/net/ism_drv.c:506:12: warning: 'ism_get_chid' defined but not used [-Wunused-function]
  506 | static u16 ism_get_chid(struct ism_dev *ism)
      |            ^~~~~~~~~~~~
../drivers/s390/net/ism_drv.c:432:12: warning: 'ism_signal_ieq' defined but not used [-Wunused-function]
  432 | static int ism_signal_ieq(struct ism_dev *ism, u64 rgid, u32 trigger_irq,
      |            ^~~~~~~~~~~~~~
../drivers/s390/net/ism_drv.c:292:12: warning: 'ism_query_rgid' defined but not used [-Wunused-function]
  292 | static int ism_query_rgid(struct ism_dev *ism, u64 rgid, u32 vid_valid,
      |            ^~~~~~~~~~~~~~

> ---
>  drivers/s390/net/Kconfig | 2 +-
>  net/smc/Kconfig          | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig
> index 74760c1a163b..4902d45e929c 100644
> --- a/drivers/s390/net/Kconfig
> +++ b/drivers/s390/net/Kconfig
> @@ -102,7 +102,7 @@ config CCWGROUP
>  
>  config ISM
>  	tristate "Support for ISM vPCI Adapter"
> -	depends on PCI && SMC
> +	depends on PCI
>  	default n
>  	help
>  	  Select this option if you want to use the Internal Shared Memory
> diff --git a/net/smc/Kconfig b/net/smc/Kconfig
> index 1ab3c5a2c5ad..746be3996768 100644
> --- a/net/smc/Kconfig
> +++ b/net/smc/Kconfig
> @@ -2,6 +2,7 @@
>  config SMC
>  	tristate "SMC socket protocol family"
>  	depends on INET && INFINIBAND
> +	depends on m || ISM != m
>  	help
>  	  SMC-R provides a "sockets over RDMA" solution making use of
>  	  RDMA over Converged Ethernet (RoCE) technology to upgrade
  
Gerd Bayer Oct. 17, 2023, 2:15 p.m. UTC | #5
On Mon, 2023-10-16 at 16:09 -0700, Randy Dunlap wrote:
> Hi Gerd,
> 
> On 10/6/23 05:58, Gerd Bayer wrote:
> > When the SMC protocol is built into the kernel proper while ISM is
> > configured to be built as module, linking the kernel fails due to
> > unresolved dependencies out of net/smc/smc_ism.o to
> > ism_get_smcd_ops, ism_register_client, and ism_unregister_client
> > as reported via the linux-next test automation (see link).
> > This however is a bug introduced a while ago.
> > 
> > Correct the dependency list in ISM's and SMC's Kconfig to reflect
> > the
> > dependencies that are actually inverted. With this you cannot build
> > a
> > kernel with CONFIG_SMC=y and CONFIG_ISM=m. Either ISM needs to be
> > 'y',
> > too - or a 'n'. That way, SMC can still be configured on non-s390
> > architectures that do not have (nor need) an ISM driver.
> > 
> > Fixes: 89e7d2ba61b7 ("net/ism: Add new API for client
> > registration")
> > 
> > Reported-by: Randy Dunlap <rdunlap@infradead.org>
> > Closes:
> > https://lore.kernel.org/linux-next/d53b5b50-d894-4df8-8969-fd39e63440ae@infradead.org/
> > Co-developed-by: Wenjia Zhang <wenjia@linux.ibm.com>
> > Signed-off-by: Wenjia Zhang <wenjia@linux.ibm.com>
> > Signed-off-by: Gerd Bayer <gbayer@linux.ibm.com>
> 
> With this patch, ISM can be build without SMC being enabled.
> 
> This leads to some build warnings:
> 
> ../drivers/s390/net/ism_drv.c:572:12: warning: 'ism_get_local_gid'
> defined but not used [-Wunused-function]
>   572 | static u64 ism_get_local_gid(struct ism_dev *ism)
>       |            ^~~~~~~~~~~~~~~~~
> ../drivers/s390/net/ism_drv.c:506:12: warning: 'ism_get_chid' defined
> but not used [-Wunused-function]
>   506 | static u16 ism_get_chid(struct ism_dev *ism)
>       |            ^~~~~~~~~~~~
> ../drivers/s390/net/ism_drv.c:432:12: warning: 'ism_signal_ieq'
> defined but not used [-Wunused-function]
>   432 | static int ism_signal_ieq(struct ism_dev *ism, u64 rgid, u32
> trigger_irq,
>       |            ^~~~~~~~~~~~~~
> ../drivers/s390/net/ism_drv.c:292:12: warning: 'ism_query_rgid'
> defined but not used [-Wunused-function]
>   292 | static int ism_query_rgid(struct ism_dev *ism, u64 rgid, u32
> vid_valid,
>       |            ^~~~~~~~~~~~~~

Hi Randy,

I must have missed testing a config of ISM without SMC. I'm working on
a fix.

Thanks for reporting,
Gerd
  

Patch

diff --git a/drivers/s390/net/Kconfig b/drivers/s390/net/Kconfig
index 74760c1a163b..4902d45e929c 100644
--- a/drivers/s390/net/Kconfig
+++ b/drivers/s390/net/Kconfig
@@ -102,7 +102,7 @@  config CCWGROUP
 
 config ISM
 	tristate "Support for ISM vPCI Adapter"
-	depends on PCI && SMC
+	depends on PCI
 	default n
 	help
 	  Select this option if you want to use the Internal Shared Memory
diff --git a/net/smc/Kconfig b/net/smc/Kconfig
index 1ab3c5a2c5ad..746be3996768 100644
--- a/net/smc/Kconfig
+++ b/net/smc/Kconfig
@@ -2,6 +2,7 @@ 
 config SMC
 	tristate "SMC socket protocol family"
 	depends on INET && INFINIBAND
+	depends on m || ISM != m
 	help
 	  SMC-R provides a "sockets over RDMA" solution making use of
 	  RDMA over Converged Ethernet (RoCE) technology to upgrade