fpga: disable KUnit test suites when module support is enabled

Message ID 20231018163814.100803-1-marpagan@redhat.com
State New
Headers
Series fpga: disable KUnit test suites when module support is enabled |

Commit Message

Marco Pagani Oct. 18, 2023, 4:38 p.m. UTC
  The fpga core currently assumes that all manager, bridge, and region
devices have a parent device associated with a driver that can be used
to take the module's refcount. This behavior causes the fpga test suites
to crash with a null-ptr-deref since parent fake devices do not have a
driver. This patch disables all fpga KUnit test suites when loadable
module support is enabled until the fpga core is fixed. Test suites
can still be run using the KUnit default UML kernel.

Signed-off-by: Marco Pagani <marpagan@redhat.com>
---
 drivers/fpga/tests/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Xu Yilun Oct. 19, 2023, 2:47 p.m. UTC | #1
On Wed, Oct 18, 2023 at 06:38:13PM +0200, Marco Pagani wrote:
> The fpga core currently assumes that all manager, bridge, and region
> devices have a parent device associated with a driver that can be used
> to take the module's refcount. This behavior causes the fpga test suites
> to crash with a null-ptr-deref since parent fake devices do not have a
> driver. This patch disables all fpga KUnit test suites when loadable
> module support is enabled until the fpga core is fixed. Test suites
> can still be run using the KUnit default UML kernel.
> 
> Signed-off-by: Marco Pagani <marpagan@redhat.com>

LGTM, I've tested on my machine.

Acked-by: Xu Yilun <yilun.xu@intel.com>

Hi Greg:

Could you help review and pull it in for 6.6-final if it's OK.

https://lore.kernel.org/linux-fpga/2023101825-ligament-undergrad-cc4d@gregkh/

Thanks,
Yilun

> ---
>  drivers/fpga/tests/Kconfig | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/fpga/tests/Kconfig b/drivers/fpga/tests/Kconfig
> index e4a64815f16d..d4e55204c092 100644
> --- a/drivers/fpga/tests/Kconfig
> +++ b/drivers/fpga/tests/Kconfig
> @@ -1,6 +1,6 @@
>  config FPGA_KUNIT_TESTS
> -	tristate "KUnit test for the FPGA subsystem" if !KUNIT_ALL_TESTS
> -	depends on FPGA && FPGA_REGION && FPGA_BRIDGE && KUNIT=y
> +	bool "KUnit test for the FPGA subsystem" if !KUNIT_ALL_TESTS
> +	depends on FPGA=y && FPGA_REGION=y && FPGA_BRIDGE=y && KUNIT=y && MODULES=n
>  	default KUNIT_ALL_TESTS
>          help
>            This builds unit tests for the FPGA subsystem
> -- 
> 2.41.0
>
  
Greg KH Oct. 19, 2023, 5:33 p.m. UTC | #2
On Thu, Oct 19, 2023 at 10:47:39PM +0800, Xu Yilun wrote:
> On Wed, Oct 18, 2023 at 06:38:13PM +0200, Marco Pagani wrote:
> > The fpga core currently assumes that all manager, bridge, and region
> > devices have a parent device associated with a driver that can be used
> > to take the module's refcount. This behavior causes the fpga test suites
> > to crash with a null-ptr-deref since parent fake devices do not have a
> > driver. This patch disables all fpga KUnit test suites when loadable
> > module support is enabled until the fpga core is fixed. Test suites
> > can still be run using the KUnit default UML kernel.
> > 
> > Signed-off-by: Marco Pagani <marpagan@redhat.com>
> 
> LGTM, I've tested on my machine.
> 
> Acked-by: Xu Yilun <yilun.xu@intel.com>
> 
> Hi Greg:
> 
> Could you help review and pull it in for 6.6-final if it's OK.
> 
> https://lore.kernel.org/linux-fpga/2023101825-ligament-undergrad-cc4d@gregkh/

Needs a "Fixes:" tag please, you can provide it here in this email
thread and b4 will pick it up automatically for me.

thanks,

greg k-h
  
Xu Yilun Oct. 20, 2023, 2:38 a.m. UTC | #3
On Thu, Oct 19, 2023 at 07:33:08PM +0200, Greg KH wrote:
> On Thu, Oct 19, 2023 at 10:47:39PM +0800, Xu Yilun wrote:
> > On Wed, Oct 18, 2023 at 06:38:13PM +0200, Marco Pagani wrote:
> > > The fpga core currently assumes that all manager, bridge, and region
> > > devices have a parent device associated with a driver that can be used
> > > to take the module's refcount. This behavior causes the fpga test suites
> > > to crash with a null-ptr-deref since parent fake devices do not have a
> > > driver. This patch disables all fpga KUnit test suites when loadable
> > > module support is enabled until the fpga core is fixed. Test suites
> > > can still be run using the KUnit default UML kernel.
> > > 
> > > Signed-off-by: Marco Pagani <marpagan@redhat.com>
> > 
> > LGTM, I've tested on my machine.
> > 
> > Acked-by: Xu Yilun <yilun.xu@intel.com>
> > 
> > Hi Greg:
> > 
> > Could you help review and pull it in for 6.6-final if it's OK.
> > 
> > https://lore.kernel.org/linux-fpga/2023101825-ligament-undergrad-cc4d@gregkh/
> 
> Needs a "Fixes:" tag please, you can provide it here in this email
> thread and b4 will pick it up automatically for me.

Fixes: ccbc1c302115 ("fpga: add an initial KUnit suite for the FPGA Manager")

Thanks,
Yilun

> 
> thanks,
> 
> greg k-h
  

Patch

diff --git a/drivers/fpga/tests/Kconfig b/drivers/fpga/tests/Kconfig
index e4a64815f16d..d4e55204c092 100644
--- a/drivers/fpga/tests/Kconfig
+++ b/drivers/fpga/tests/Kconfig
@@ -1,6 +1,6 @@ 
 config FPGA_KUNIT_TESTS
-	tristate "KUnit test for the FPGA subsystem" if !KUNIT_ALL_TESTS
-	depends on FPGA && FPGA_REGION && FPGA_BRIDGE && KUNIT=y
+	bool "KUnit test for the FPGA subsystem" if !KUNIT_ALL_TESTS
+	depends on FPGA=y && FPGA_REGION=y && FPGA_BRIDGE=y && KUNIT=y && MODULES=n
 	default KUNIT_ALL_TESTS
         help
           This builds unit tests for the FPGA subsystem