linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: lpfc: fix linking against modular NVMe support
@ 2017-03-21 13:09 Arnd Bergmann
  2017-03-22  2:23 ` James Smart
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2017-03-21 13:09 UTC (permalink / raw)
  To: James E.J. Bottomley, Martin K. Petersen
  Cc: Arnd Bergmann, Hannes Reinecke, Finn Thain, Johannes Thumshirn,
	James Smart, linux-scsi, linux-kernel

When LPFC is built-in but NVMe is a loadable module, we fail to
link the kernel:

drivers/scsi/built-in.o: In function `lpfc_nvme_create_localport':
(.text+0x156a82): undefined reference to `nvme_fc_register_localport'
drivers/scsi/built-in.o: In function `lpfc_nvme_destroy_localport':
(.text+0x156eaa): undefined reference to `nvme_fc_unregister_remoteport'

We can avoid this either by forcing lpfc to be a module, or by disabling
NVMe support in this case. This implements the former.

Fixes: 7d7080335f8d ("scsi: lpfc: Finalize Kconfig options for nvme")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/scsi/Kconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 3c52867dfe28..d145e0d90227 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1241,6 +1241,8 @@ config SCSI_LPFC
 	tristate "Emulex LightPulse Fibre Channel Support"
 	depends on PCI && SCSI
 	depends on SCSI_FC_ATTRS
+	depends on NVME_TARGET_FC || NVME_TARGET_FC=n
+	depends on NVME_FC || NVME_FC=n
 	select CRC_T10DIF
 	---help---
           This lpfc driver supports the Emulex LightPulse
-- 
2.9.0

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

* Re: [PATCH] scsi: lpfc: fix linking against modular NVMe support
  2017-03-21 13:09 [PATCH] scsi: lpfc: fix linking against modular NVMe support Arnd Bergmann
@ 2017-03-22  2:23 ` James Smart
  2017-03-22  2:25   ` James Smart
  0 siblings, 1 reply; 4+ messages in thread
From: James Smart @ 2017-03-22  2:23 UTC (permalink / raw)
  To: Arnd Bergmann, James E.J. Bottomley, Martin K. Petersen
  Cc: Hannes Reinecke, Finn Thain, Johannes Thumshirn, James Smart,
	linux-scsi, linux-kernel

Arnd,

All of the build issues, including building as modules, should have been 
resolved by the following patch:
http://www.spinics.net/lists/linux-scsi/msg106102.html

Am I missing something ?

-- james


On 3/21/2017 6:09 AM, Arnd Bergmann wrote:
> When LPFC is built-in but NVMe is a loadable module, we fail to
> link the kernel:
>
> drivers/scsi/built-in.o: In function `lpfc_nvme_create_localport':
> (.text+0x156a82): undefined reference to `nvme_fc_register_localport'
> drivers/scsi/built-in.o: In function `lpfc_nvme_destroy_localport':
> (.text+0x156eaa): undefined reference to `nvme_fc_unregister_remoteport'
>
> We can avoid this either by forcing lpfc to be a module, or by disabling
> NVMe support in this case. This implements the former.
>
> Fixes: 7d7080335f8d ("scsi: lpfc: Finalize Kconfig options for nvme")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/scsi/Kconfig | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
> index 3c52867dfe28..d145e0d90227 100644
> --- a/drivers/scsi/Kconfig
> +++ b/drivers/scsi/Kconfig
> @@ -1241,6 +1241,8 @@ config SCSI_LPFC
>   	tristate "Emulex LightPulse Fibre Channel Support"
>   	depends on PCI && SCSI
>   	depends on SCSI_FC_ATTRS
> +	depends on NVME_TARGET_FC || NVME_TARGET_FC=n
> +	depends on NVME_FC || NVME_FC=n
>   	select CRC_T10DIF
>   	---help---
>             This lpfc driver supports the Emulex LightPulse

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

* Re: [PATCH] scsi: lpfc: fix linking against modular NVMe support
  2017-03-22  2:23 ` James Smart
@ 2017-03-22  2:25   ` James Smart
  2017-03-22  8:12     ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: James Smart @ 2017-03-22  2:25 UTC (permalink / raw)
  To: Arnd Bergmann, James E.J. Bottomley, Martin K. Petersen
  Cc: Hannes Reinecke, Finn Thain, Johannes Thumshirn, James Smart,
	linux-scsi, linux-kernel

Note: the patch I referenced 
(http://www.spinics.net/lists/linux-scsi/msg106102.html) replaced the 
one I think you referenced below 
(http://www.spinics.net/lists/linux-scsi/msg106024.html)

-- james


On 3/21/2017 7:23 PM, James Smart wrote:
> Arnd,
>
> All of the build issues, including building as modules, should have 
> been resolved by the following patch:
> http://www.spinics.net/lists/linux-scsi/msg106102.html
>
> Am I missing something ?
>
> -- james
>
>
> On 3/21/2017 6:09 AM, Arnd Bergmann wrote:
>> When LPFC is built-in but NVMe is a loadable module, we fail to
>> link the kernel:
>>
>> drivers/scsi/built-in.o: In function `lpfc_nvme_create_localport':
>> (.text+0x156a82): undefined reference to `nvme_fc_register_localport'
>> drivers/scsi/built-in.o: In function `lpfc_nvme_destroy_localport':
>> (.text+0x156eaa): undefined reference to `nvme_fc_unregister_remoteport'
>>
>> We can avoid this either by forcing lpfc to be a module, or by disabling
>> NVMe support in this case. This implements the former.
>>
>> Fixes: 7d7080335f8d ("scsi: lpfc: Finalize Kconfig options for nvme")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>>   drivers/scsi/Kconfig | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
>> index 3c52867dfe28..d145e0d90227 100644
>> --- a/drivers/scsi/Kconfig
>> +++ b/drivers/scsi/Kconfig
>> @@ -1241,6 +1241,8 @@ config SCSI_LPFC
>>       tristate "Emulex LightPulse Fibre Channel Support"
>>       depends on PCI && SCSI
>>       depends on SCSI_FC_ATTRS
>> +    depends on NVME_TARGET_FC || NVME_TARGET_FC=n
>> +    depends on NVME_FC || NVME_FC=n
>>       select CRC_T10DIF
>>       ---help---
>>             This lpfc driver supports the Emulex LightPulse
>

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

* Re: [PATCH] scsi: lpfc: fix linking against modular NVMe support
  2017-03-22  2:25   ` James Smart
@ 2017-03-22  8:12     ` Arnd Bergmann
  0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2017-03-22  8:12 UTC (permalink / raw)
  To: James Smart
  Cc: James E.J. Bottomley, Martin K. Petersen, Hannes Reinecke,
	Finn Thain, Johannes Thumshirn, James Smart, linux-scsi,
	Linux Kernel Mailing List

On Wed, Mar 22, 2017 at 3:25 AM, James Smart <james.smart@broadcom.com> wrote:
>
> On 3/21/2017 7:23 PM, James Smart wrote:
>>
>> Arnd,
>>
>> All of the build issues, including building as modules, should have been
>> resolved by the following patch:
>> http://www.spinics.net/lists/linux-scsi/msg106102.html
>>
>> Am I missing something ?
>
> Note: the patch I referenced
> (http://www.spinics.net/lists/linux-scsi/msg106102.html) replaced the one I
> think you referenced below
> (http://www.spinics.net/lists/linux-scsi/msg106024.html)

The build error I fixed was on yesterday's linux-next, which has the
http://www.spinics.net/lists/linux-scsi/msg106102.html patch, this is
the one I referenced as 7d7080335f8d ("scsi: lpfc: Finalize Kconfig
options for nvme").

The earlier version from linux-next-20170310 (there was no linux-next
last week) had the same bug but needed a different workaround:

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 4bf55b5d78be..52245eb83295 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -1256,12 +1256,14 @@ config SCSI_LPFC_DEBUG_FS
 config LPFC_NVME_INITIATOR
  bool "Emulex LightPulse Fibre Channel NVME Initiator Support"
  depends on SCSI_LPFC && NVME_FC
+ depends on SCSI_LPFC=m || NVME_FC=y
  ---help---
   This enables NVME Initiator support in the Emulex lpfc driver.

 config LPFC_NVME_TARGET
  bool "Emulex LightPulse Fibre Channel NVME Initiator Support"
  depends on SCSI_LPFC && NVME_TARGET_FC
+ depends on SCSI_LPFC=m || NVME_TARGET_FC=y
  ---help---
   This enables NVME Target support in the Emulex lpfc driver.
   Target enablement must still be enabled on a per adapter

As a side-note, the patch introduces a slightly unusual construct
using #if (IS_ENABLED(CONFIG_NVME_FC)). This can usually
expressed in a more readable way like this:

--- a/drivers/scsi/lpfc/lpfc_nvme.c
+++ b/drivers/scsi/lpfc/lpfc_nvme.c
@@ -2190,13 +2192,12 @@ lpfc_nvme_create_localport(struct lpfc_vport *vport)
 void
 lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
 {
-#if (IS_ENABLED(CONFIG_NVME_FC))
        struct nvme_fc_local_port *localport;
        struct lpfc_nvme_lport *lport;
        struct lpfc_nvme_rport *rport = NULL, *rport_next = NULL;
        int ret;

-       if (vport->nvmei_support == 0)
+       if (!IS_ENABLED(CONFIG_NVME_FC) || vport->nvmei_support == 0)
                return;

        localport = vport->localport;
@@ -2243,7 +2244,6 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport)
                                 "Failed, status x%x\n",
                                 ret);
        }
-#endif
 }

 void


You could also use if(IS_REACHABLE()) here to work around
the link error when CONFIG_NVME_FC=m, but that would make
things a little more confusing for users as it is not immediately
clear why it fails to work at runtime.

      Arnd

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

end of thread, other threads:[~2017-03-22  8:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-21 13:09 [PATCH] scsi: lpfc: fix linking against modular NVMe support Arnd Bergmann
2017-03-22  2:23 ` James Smart
2017-03-22  2:25   ` James Smart
2017-03-22  8:12     ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).