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: <87sfkkfhoc.fsf@intel.com>
Date:   Wed, 21 Sep 2022 16:09:55 -0700
From:   Vinicius Costa Gomes <vinicius.gomes@...el.com>
To:     Vladimir Oltean <vladimir.oltean@....com>, netdev@...r.kernel.org
Cc:     Jamal Hadi Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Jiri Pirko <jiri@...nulli.us>,
        "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] net/sched: taprio: remove unnecessary
 taprio_list_lock

Vladimir Oltean <vladimir.oltean@....com> writes:

> The 3 functions that want access to the taprio_list:
> taprio_dev_notifier(), taprio_destroy() and taprio_init() are all called
> with the rtnl_mutex held, therefore implicitly serialized with respect
> to each other. A spin lock serves no purpose.
>
> Signed-off-by: Vladimir Oltean <vladimir.oltean@....com>
> ---
>  net/sched/sch_taprio.c | 7 -------
>  1 file changed, 7 deletions(-)
>
> diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c
> index 1ab92968c1e3..163255e0cd77 100644
> --- a/net/sched/sch_taprio.c
> +++ b/net/sched/sch_taprio.c
> @@ -27,7 +27,6 @@
>  #include <net/tcp.h>
>  
>  static LIST_HEAD(taprio_list);
> -static DEFINE_SPINLOCK(taprio_list_lock);
>  
>  #define TAPRIO_ALL_GATES_OPEN -1
>  
> @@ -1082,7 +1081,6 @@ static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event,
>  	if (event != NETDEV_UP && event != NETDEV_CHANGE)
>  		return NOTIFY_DONE;
>  
> -	spin_lock(&taprio_list_lock);
>  	list_for_each_entry(q, &taprio_list, taprio_list) {
>  		qdev = qdisc_dev(q->root);
>  		if (qdev == dev) {

Optional simplification: do you mind removing 'found' and moving the
call to taprio_set_picos_per_byte() here?

Anyway,

Acked-by: Vinicius Costa Gomes <vinicius.gomes@...el.com>

> @@ -1090,7 +1088,6 @@ static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event,
>  			break;
>  		}
>  	}
> -	spin_unlock(&taprio_list_lock);
>  
>  	if (found)
>  		taprio_set_picos_per_byte(dev, q);
> @@ -1602,9 +1599,7 @@ static void taprio_destroy(struct Qdisc *sch)
>  	struct sched_gate_list *oper, *admin;
>  	unsigned int i;
>  
> -	spin_lock(&taprio_list_lock);
>  	list_del(&q->taprio_list);
> -	spin_unlock(&taprio_list_lock);
>  
>  	/* Note that taprio_reset() might not be called if an error
>  	 * happens in qdisc_create(), after taprio_init() has been called.
> @@ -1653,9 +1648,7 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt,
>  	q->clockid = -1;
>  	q->flags = TAPRIO_FLAGS_INVALID;
>  
> -	spin_lock(&taprio_list_lock);
>  	list_add(&q->taprio_list, &taprio_list);
> -	spin_unlock(&taprio_list_lock);
>  
>  	if (sch->parent != TC_H_ROOT) {
>  		NL_SET_ERR_MSG_MOD(extack, "Can only be attached as root qdisc");
> -- 
> 2.34.1
>


Cheers,
-- 
Vinicius

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ