lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240912-optimistic-tourmaline-snail-1e5aac@leitao>
Date: Thu, 12 Sep 2024 12:13:05 -0700
From: Breno Leitao <leitao@...ian.org>
To: Maksym Kutsevol <max@...sevol.com>
Cc: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Alex Deucher <alexander.deucher@....com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v3 2/2] netcons: Add udp send fail statistics to
 netconsole

On Thu, Sep 12, 2024 at 01:58:12PM -0400, Maksym Kutsevol wrote:
> Hey Breno,
> Thanks for looking into this.
> 
> On Thu, Sep 12, 2024 at 1:49 PM Breno Leitao <leitao@...ian.org> wrote:
> >
> > Hello Maksym,
> >
> > Thanks for the patch, it is looking good. A few nits:
> >
> > On Thu, Sep 12, 2024 at 10:28:52AM -0700, Maksym Kutsevol wrote:
> > > +/**
> > > + * netpoll_send_udp_count_errs - Wrapper for netpoll_send_udp that counts errors
> > > + * @nt: target to send message to
> > > + * @msg: message to send
> > > + * @len: length of message
> > > + *
> > > + * Calls netpoll_send_udp and classifies the return value. If an error
> > > + * occurred it increments statistics in nt->stats accordingly.
> > > + * Only calls netpoll_send_udp if CONFIG_NETCONSOLE_DYNAMIC is disabled.
> > > + */
> > > +static void netpoll_send_udp_count_errs(struct netconsole_target *nt, const char *msg, int len)
> > > +{
> > > +     int result = netpoll_send_udp(&nt->np, msg, len);
> >
> > Would you get a "variable defined but not used" type of eror if
> > CONFIG_NETCONSOLE_DYNAMIC is disabled?
> >
> Most probably yes, I'll check. If so, I'll add __maybe_unused in the
> next iteration.
> 
> > > +
> > > +     if (IS_ENABLED(CONFIG_NETCONSOLE_DYNAMIC)) {
> > > +             if (result == NET_XMIT_DROP) {
> > > +                     u64_stats_update_begin(&nt->stats.syncp);
> > > +                     u64_stats_inc(&nt->stats.xmit_drop_count);
> > > +                     u64_stats_update_end(&nt->stats.syncp);
> > > +             } else if (result == -ENOMEM) {
> > > +                     u64_stats_update_begin(&nt->stats.syncp);
> > > +                     u64_stats_inc(&nt->stats.enomem_count);
> > > +                     u64_stats_update_end(&nt->stats.syncp);
> > > +             }
> > > +     }
> >
> > Would this look better?
> >
> >         if (IS_ENABLED(CONFIG_NETCONSOLE_DYNAMIC)) {
> >                 u64_stats_update_begin(&nt->stats.syncp);
> >
> >                 if (result == NET_XMIT_DROP)
> >                         u64_stats_inc(&nt->stats.xmit_drop_count);
> >                 else if (result == -ENOMEM)
> >                         u64_stats_inc(&nt->stats.enomem_count);
> >                 else
> >                         WARN_ONCE(true, "invalid result: %d\n", result)
> >
> >                 u64_stats_update_end(&nt->stats.syncp);
> >         }
> >
> 1. It will warn on positive result
> 2. If the last `else` is removed, it attempts locking when the result
> is positive, so I'd not do it this way.

Correct. We could replace the WARN_ONCE(true, ..) by
WARN_ONCE(result,..), but this might look worse.

Let's keep the way you proposed.

Other than that, the patch looks good.

Thanks


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ