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: <20240417092724.GW2320920@kernel.org>
Date: Wed, 17 Apr 2024 10:27:24 +0100
From: Simon Horman <horms@...nel.org>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S. Miller" <davem@...emloft.net>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	Jamal Hadi Salim <jhs@...atatu.com>,
	Cong Wang <xiyou.wangcong@...il.com>, Jiri Pirko <jiri@...nulli.us>,
	netdev@...r.kernel.org, eric.dumazet@...il.com,
	Vinicius Costa Gomes <vinicius.gomes@...el.com>
Subject: Re: [PATCH net-next 03/14] net_sched: sch_cbs: implement lockless
 cbs_dump()

+ Vinicius Costa Gomes

On Mon, Apr 15, 2024 at 01:20:43PM +0000, Eric Dumazet wrote:
> Instead of relying on RTNL, cbs_dump() can use READ_ONCE()
> annotations, paired with WRITE_ONCE() ones in cbs_change().
> 
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>

Reviewed-by: Simon Horman <horms@...nel.org>

(Eric, I need to step away from my desk for a while.
 So there will be a bit of a delay in reviewing the rest
 of the series.)

> ---
>  net/sched/sch_cbs.c | 20 ++++++++++----------
>  1 file changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/net/sched/sch_cbs.c b/net/sched/sch_cbs.c
> index 69001eff0315584df23a24f81ae3b4cf7bf5fd79..939425da18955bc8a3f3d2d5b852b2585e9bcaee 100644
> --- a/net/sched/sch_cbs.c
> +++ b/net/sched/sch_cbs.c
> @@ -389,11 +389,11 @@ static int cbs_change(struct Qdisc *sch, struct nlattr *opt,
>  	}
>  
>  	/* Everything went OK, save the parameters used. */
> -	q->hicredit = qopt->hicredit;
> -	q->locredit = qopt->locredit;
> -	q->idleslope = qopt->idleslope * BYTES_PER_KBIT;
> -	q->sendslope = qopt->sendslope * BYTES_PER_KBIT;
> -	q->offload = qopt->offload;
> +	WRITE_ONCE(q->hicredit, qopt->hicredit);
> +	WRITE_ONCE(q->locredit, qopt->locredit);
> +	WRITE_ONCE(q->idleslope, qopt->idleslope * BYTES_PER_KBIT);
> +	WRITE_ONCE(q->sendslope, qopt->sendslope * BYTES_PER_KBIT);
> +	WRITE_ONCE(q->offload, qopt->offload);
>  
>  	return 0;
>  }
> @@ -459,11 +459,11 @@ static int cbs_dump(struct Qdisc *sch, struct sk_buff *skb)
>  	if (!nest)
>  		goto nla_put_failure;
>  
> -	opt.hicredit = q->hicredit;
> -	opt.locredit = q->locredit;
> -	opt.sendslope = div64_s64(q->sendslope, BYTES_PER_KBIT);
> -	opt.idleslope = div64_s64(q->idleslope, BYTES_PER_KBIT);
> -	opt.offload = q->offload;
> +	opt.hicredit = READ_ONCE(q->hicredit);
> +	opt.locredit = READ_ONCE(q->locredit);
> +	opt.sendslope = div64_s64(READ_ONCE(q->sendslope), BYTES_PER_KBIT);
> +	opt.idleslope = div64_s64(READ_ONCE(q->idleslope), BYTES_PER_KBIT);
> +	opt.offload = READ_ONCE(q->offload);
>  
>  	if (nla_put(skb, TCA_CBS_PARMS, sizeof(opt), &opt))
>  		goto nla_put_failure;
> -- 
> 2.44.0.683.g7961c838ac-goog
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ