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]
Date:   Tue, 23 Oct 2018 08:54:31 -0700
From:   Mahesh Bandewar (महेश बंडेवार) 
        <maheshb@...gle.com>
To:     mk.singh@...cle.com
Cc:     linux-netdev <netdev@...r.kernel.org>,
        Jay Vosburgh <j.vosburgh@...il.com>,
        Veaceslav Falico <vfalico@...il.com>,
        Andy Gospodarek <andy@...yhouse.net>,
        "David S. Miller" <davem@...emloft.net>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bonding:avoid repeated display of same link status change

On Tue, Oct 23, 2018 at 8:29 AM,  <mk.singh@...cle.com> wrote:
> From: Manish Kumar Singh <mk.singh@...cle.com>
>
> When link status change needs to be committed and rtnl lock couldn't be
> taken, avoid redisplay of same link status change message.
>
> Signed-off-by: Manish Kumar Singh <mk.singh@...cle.com>
> ---
>  drivers/net/bonding/bond_main.c | 6 ++++--
>  include/net/bonding.h           | 1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 2b01180be834..af9ef889a429 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -2096,7 +2096,7 @@ static int bond_miimon_inspect(struct bonding *bond)
>                         bond_propose_link_state(slave, BOND_LINK_FAIL);
>                         commit++;
>                         slave->delay = bond->params.downdelay;
> -                       if (slave->delay) {
> +                       if (slave->delay && !atomic_read(&bond->rtnl_needed)) {
Atomic operations are expensive (on certain architectures) and miimon
runs quite frequently. Is the added cost of these atomic operations
even worth just to avoid *duplicate info* messages? This seems like a
overkill!

>                                 netdev_info(bond->dev, "link status down for %sinterface %s, disabling it in %d ms\n",
>                                             (BOND_MODE(bond) ==
>                                              BOND_MODE_ACTIVEBACKUP) ?
> @@ -2136,7 +2136,7 @@ static int bond_miimon_inspect(struct bonding *bond)
>                         commit++;
>                         slave->delay = bond->params.updelay;
>
> -                       if (slave->delay) {
> +                       if (slave->delay && !atomic_read(&bond->rtnl_needed)) {
>                                 netdev_info(bond->dev, "link status up for interface %s, enabling it in %d ms\n",
>                                             slave->dev->name,
>                                             ignore_updelay ? 0 :
> @@ -2310,9 +2310,11 @@ static void bond_mii_monitor(struct work_struct *work)
>                 if (!rtnl_trylock()) {
>                         delay = 1;
>                         should_notify_peers = false;
> +                       atomic_set(&bond->rtnl_needed, 1);
>                         goto re_arm;
>                 }
>
> +               atomic_set(&bond->rtnl_needed, 0);
>                 bond_for_each_slave(bond, slave, iter) {
>                         bond_commit_link_state(slave, BOND_SLAVE_NOTIFY_LATER);
>                 }
> diff --git a/include/net/bonding.h b/include/net/bonding.h
> index a4f116f06c50..a4353506bb4f 100644
> --- a/include/net/bonding.h
> +++ b/include/net/bonding.h
> @@ -229,6 +229,7 @@ struct bonding {
>         struct   dentry *debug_dir;
>  #endif /* CONFIG_DEBUG_FS */
>         struct rtnl_link_stats64 bond_stats;
> +       atomic_t rtnl_needed;
>  };
>
>  #define bond_slave_get_rcu(dev) \
> --
> 2.14.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ