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:   Wed, 21 Aug 2019 19:41:19 +0000
From:   Vlad Buslov <vladbu@...lanox.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     "netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH 33/38] act_api: Convert action_idr to XArray


On Wed 21 Aug 2019 at 01:32, Matthew Wilcox <willy@...radead.org> wrote:
> From: "Matthew Wilcox (Oracle)" <willy@...radead.org>
>
> Replace the mutex protecting the IDR with the XArray spinlock.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
> ---
>  include/net/act_api.h |   6 +-
>  net/sched/act_api.c   | 127 +++++++++++++++++-------------------------
>  2 files changed, 53 insertions(+), 80 deletions(-)
>
> diff --git a/include/net/act_api.h b/include/net/act_api.h

[...]

> @@ -290,10 +283,8 @@ static int tcf_del_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
>  	struct nlattr *nest;
>  	int n_i = 0;
>  	int ret = -EINVAL;
> -	struct idr *idr = &idrinfo->action_idr;
>  	struct tc_action *p;
> -	unsigned long id = 1;
> -	unsigned long tmp;
> +	unsigned long index;
>  
>  	nest = nla_nest_start_noflag(skb, 0);
>  	if (nest == NULL)
> @@ -301,18 +292,18 @@ static int tcf_del_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
>  	if (nla_put_string(skb, TCA_KIND, ops->kind))
>  		goto nla_put_failure;
>  
> -	mutex_lock(&idrinfo->lock);
> -	idr_for_each_entry_ul(idr, p, tmp, id) {
> +	xa_lock(&idrinfo->actions);
> +	xa_for_each(&idrinfo->actions, index, p) {
>  		ret = tcf_idr_release_unsafe(p);

I like the simplification of reusing builtin xarray spinlock for this,
but the reason we are using mutex here is because the following call
chain: tcf_idr_release_unsafe() -> tcf_action_cleanup() -> free_tcf() ->
tcf_chain_put_by_act() -> __tcf_chain_put() -> mutex_lock(&block->lock);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ