On Mon, 13 May 2024 07:22:49 -0700, Jakub Kicinski <kuba@xxxxxxxxxx> wrote: > On Mon, 13 May 2024 00:36:58 +0800 Heng Qi wrote: > > This failed use case seems to come from this series triggering a problem that > > has not been triggered historically, namely lockdep_rtnl_is_held() is not called > > in an environment where CONFIG_NET is not configured and CONFIG_PROVE_LOCKING is > > configured: > > If CONFIG_PROVE_LOCKING is configured as Y and CONFIG_NET is n, then > > lockdep_rtnl_is_held is in an undefined state at this time. > > > > So I think we should declare "CONFIG_PROVE_LOCKING depends on CONFIG_NET". > > How do you think? > > Doesn't sound right, `can we instead make building lib/dim/net_dim.c Why? IIUC, the reason is that if CONFIG_NET is not set to Y, the net/core directory will not be compiled, so the lockdep_rtnl_is_held symbol is not present. > dependent on CONFIG_NET? Untested but I'm thinking something like: > > diff --git a/lib/dim/Makefile b/lib/dim/Makefile > index c4cc4026c451..c02c306e2975 100644 > --- a/lib/dim/Makefile > +++ b/lib/dim/Makefile > @@ -4,4 +4,8 @@ > > obj-$(CONFIG_DIMLIB) += dimlib.o > > -dimlib-objs := dim.o net_dim.o rdma_dim.o > +dimlib-objs := dim.o rdma_dim.o > + > +ifeq ($(CONFIG_NET),y) > +dimlib-objs += net_dim.o > +endif 1. This is unlikely to work if the kernel is configured as[1]: [1] kernel configuration CONFIG_NET=n, CONFIG_ETHTOOL_NETLINK=n, CONFIG_PROVE_LOCKING=y, (CONFIG_FSL_MC_DPIO=y && CONFIG_FSL_MC_BUS=y) select CONFIG_DIMLIB=y. Then, because CONFIG_NET is not enabled, so there is no net_dim.o, the following warning appears: ld.lld: error: undefined symbol: net_dim_get_rx_moderation referenced by dpio-service.c drivers/soc/fsl/dpio/dpio-service.o:(dpaa2_io_dim_work) in archive vmlinux.a ld.lld: error: undefined symbol: net_dim referenced by dpio-service.c drivers/soc/fsl/dpio/dpio-service.o:(dpaa2_io_update_net_dim) in archive vmlinux.a 2. If we declare "CONFIG_DIMLIB depends on CONFIG_NET", if the configuration is still [1]: Then the result is: CONFIG_DIMLIB=Y (selected by CONFIG_FSL_MC_DPIO=y && CONFIG_FSL_MC_BUS=y), CONFIG_NET=n, but we declared "CONFIG_DIMLIB depends on CONFIG_NET", there is still a compilation error because the lockdep_rtnl_is_held symbol cannot be found. 3. If we declare "CONFIG_DIMLIB select CONFIG_NET" and kernel configuration is [1], then a circular dependency warning will appear: CONFIG_DIMLIB select CONFIG_NET, ETHTOOL_NETLINK=Y(depends on CONFIG_NET) selects CONFIG_DIMLIB. CONFIG_DIMLIB will select CONFIG_NET... > >