diff mbox series

net: drop_monitor: use IS_REACHABLE() to guard net_dm_hw_report()

Message ID 20200311062925.5163-1-masahiroy@kernel.org
State Not Applicable
Delegated to: David Miller
Headers show
Series net: drop_monitor: use IS_REACHABLE() to guard net_dm_hw_report() | expand

Commit Message

Masahiro Yamada March 11, 2020, 6:29 a.m. UTC
In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR.

The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR
from being 'm' when NET_DEVLINK=y.

With the planned Kconfig change that relaxes the 'imply', the
combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed.

Use IS_REACHABLE() to avoid the vmlinux link error for this case.

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

This build error was reported in linux-next.
https://lkml.org/lkml/2020/3/10/1936

If this patch is acceptable,
I'd like to get Ack from the maintainers,
and insert this patch before my Kconfig change.


 include/net/drop_monitor.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ido Schimmel March 11, 2020, 9:31 a.m. UTC | #1
On Wed, Mar 11, 2020 at 03:29:25PM +0900, Masahiro Yamada wrote:
> In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR.
> 
> The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR
> from being 'm' when NET_DEVLINK=y.
> 
> With the planned Kconfig change that relaxes the 'imply', the
> combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed.
> 
> Use IS_REACHABLE() to avoid the vmlinux link error for this case.
> 
> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Thanks, Masahiro.

Neil, Jiri, another option (long term) is to add a raw tracepoint (not
part of ABI) in devlink and have drop monitor register its probe on it
when monitoring.

Two advantages:
1. Consistent with what drop monitor is already doing with kfree_skb()
tracepoint
2. We can remove 'imply NET_DROP_MONITOR' altogether

What do you think?
Neil Horman March 11, 2020, 10:47 a.m. UTC | #2
On Wed, Mar 11, 2020 at 11:31:43AM +0200, Ido Schimmel wrote:
> On Wed, Mar 11, 2020 at 03:29:25PM +0900, Masahiro Yamada wrote:
> > In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR.
> > 
> > The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR
> > from being 'm' when NET_DEVLINK=y.
> > 
> > With the planned Kconfig change that relaxes the 'imply', the
> > combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed.
> > 
> > Use IS_REACHABLE() to avoid the vmlinux link error for this case.
> > 
> > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> 
> Thanks, Masahiro.
> 
> Neil, Jiri, another option (long term) is to add a raw tracepoint (not
> part of ABI) in devlink and have drop monitor register its probe on it
> when monitoring.
> 
> Two advantages:
> 1. Consistent with what drop monitor is already doing with kfree_skb()
> tracepoint
> 2. We can remove 'imply NET_DROP_MONITOR' altogether
> 
> What do you think?
> 
Agreed, I think I like this implementation better.
Neil
Ido Schimmel March 11, 2020, 11:28 a.m. UTC | #3
On Wed, Mar 11, 2020 at 06:47:56AM -0400, Neil Horman wrote:
> On Wed, Mar 11, 2020 at 11:31:43AM +0200, Ido Schimmel wrote:
> > On Wed, Mar 11, 2020 at 03:29:25PM +0900, Masahiro Yamada wrote:
> > > In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR.
> > > 
> > > The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR
> > > from being 'm' when NET_DEVLINK=y.
> > > 
> > > With the planned Kconfig change that relaxes the 'imply', the
> > > combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed.
> > > 
> > > Use IS_REACHABLE() to avoid the vmlinux link error for this case.
> > > 
> > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > 
> > Thanks, Masahiro.
> > 
> > Neil, Jiri, another option (long term) is to add a raw tracepoint (not
> > part of ABI) in devlink and have drop monitor register its probe on it
> > when monitoring.
> > 
> > Two advantages:
> > 1. Consistent with what drop monitor is already doing with kfree_skb()
> > tracepoint
> > 2. We can remove 'imply NET_DROP_MONITOR' altogether
> > 
> > What do you think?
> > 
> Agreed, I think I like this implementation better.

OK, but I don't want to block Masahiro. I think we can go with his patch
and then I'll add the raw tracepoint in the next release.
Neil Horman March 11, 2020, 5:30 p.m. UTC | #4
On Wed, Mar 11, 2020 at 01:28:33PM +0200, Ido Schimmel wrote:
> On Wed, Mar 11, 2020 at 06:47:56AM -0400, Neil Horman wrote:
> > On Wed, Mar 11, 2020 at 11:31:43AM +0200, Ido Schimmel wrote:
> > > On Wed, Mar 11, 2020 at 03:29:25PM +0900, Masahiro Yamada wrote:
> > > > In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR.
> > > > 
> > > > The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR
> > > > from being 'm' when NET_DEVLINK=y.
> > > > 
> > > > With the planned Kconfig change that relaxes the 'imply', the
> > > > combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed.
> > > > 
> > > > Use IS_REACHABLE() to avoid the vmlinux link error for this case.
> > > > 
> > > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > > 
> > > Thanks, Masahiro.
> > > 
> > > Neil, Jiri, another option (long term) is to add a raw tracepoint (not
> > > part of ABI) in devlink and have drop monitor register its probe on it
> > > when monitoring.
> > > 
> > > Two advantages:
> > > 1. Consistent with what drop monitor is already doing with kfree_skb()
> > > tracepoint
> > > 2. We can remove 'imply NET_DROP_MONITOR' altogether
> > > 
> > > What do you think?
> > > 
> > Agreed, I think I like this implementation better.
> 
> OK, but I don't want to block Masahiro. I think we can go with his patch
> and then I'll add the raw tracepoint in the next release.
> 
Yeah, ok, I can agree with that
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Masahiro Yamada March 11, 2020, 9:26 p.m. UTC | #5
On Thu, Mar 12, 2020 at 2:31 AM Neil Horman <nhorman@tuxdriver.com> wrote:
>
> On Wed, Mar 11, 2020 at 01:28:33PM +0200, Ido Schimmel wrote:
> > On Wed, Mar 11, 2020 at 06:47:56AM -0400, Neil Horman wrote:
> > > On Wed, Mar 11, 2020 at 11:31:43AM +0200, Ido Schimmel wrote:
> > > > On Wed, Mar 11, 2020 at 03:29:25PM +0900, Masahiro Yamada wrote:
> > > > > In net/Kconfig, NET_DEVLINK implies NET_DROP_MONITOR.
> > > > >
> > > > > The original behavior of the 'imply' keyword prevents NET_DROP_MONITOR
> > > > > from being 'm' when NET_DEVLINK=y.
> > > > >
> > > > > With the planned Kconfig change that relaxes the 'imply', the
> > > > > combination of NET_DEVLINK=y and NET_DROP_MONITOR=m would be allowed.
> > > > >
> > > > > Use IS_REACHABLE() to avoid the vmlinux link error for this case.
> > > > >
> > > > > Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
> > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > > >
> > > > Thanks, Masahiro.
> > > >
> > > > Neil, Jiri, another option (long term) is to add a raw tracepoint (not
> > > > part of ABI) in devlink and have drop monitor register its probe on it
> > > > when monitoring.
> > > >
> > > > Two advantages:
> > > > 1. Consistent with what drop monitor is already doing with kfree_skb()
> > > > tracepoint
> > > > 2. We can remove 'imply NET_DROP_MONITOR' altogether
> > > >
> > > > What do you think?
> > > >
> > > Agreed, I think I like this implementation better.
> >
> > OK, but I don't want to block Masahiro. I think we can go with his patch
> > and then I'll add the raw tracepoint in the next release.
> >
> Yeah, ok, I can agree with that
> Acked-by: Neil Horman <nhorman@tuxdriver.com>


Thanks, I will insert this patch before the kconfig change
with your Ack.
diff mbox series

Patch

diff --git a/include/net/drop_monitor.h b/include/net/drop_monitor.h
index 2ab668461463..f68bc373544a 100644
--- a/include/net/drop_monitor.h
+++ b/include/net/drop_monitor.h
@@ -19,7 +19,7 @@  struct net_dm_hw_metadata {
 	struct net_device *input_dev;
 };
 
-#if IS_ENABLED(CONFIG_NET_DROP_MONITOR)
+#if IS_REACHABLE(CONFIG_NET_DROP_MONITOR)
 void net_dm_hw_report(struct sk_buff *skb,
 		      const struct net_dm_hw_metadata *hw_metadata);
 #else