Skip to content

Commit

Permalink
net: sched: don't disable bh when accessing action idr
Browse files Browse the repository at this point in the history
Initial net_device implementation used ingress_lock spinlock to synchronize
ingress path of device. This lock was used in both process and bh context.
In some code paths action map lock was obtained while holding ingress_lock.
Commit e1e992e ("[NET_SCHED] protect action config/dump from irqs")
modified actions to always disable bh, while using action map lock, in
order to prevent deadlock on ingress_lock in softirq. This lock was removed
from net_device, so disabling bh, while accessing action map, is no longer
necessary.

Replace all action idr spinlock usage with regular calls that do not
disable bh.

Signed-off-by: Vlad Buslov <vladbu@mellanox.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Vlad Buslov authored and David S. Miller committed May 22, 2018
1 parent 73bf1fc commit 290aa0a
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions net/sched/act_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ static void free_tcf(struct tc_action *p)

static void tcf_idr_remove(struct tcf_idrinfo *idrinfo, struct tc_action *p)
{
spin_lock_bh(&idrinfo->lock);
spin_lock(&idrinfo->lock);
idr_remove(&idrinfo->action_idr, p->tcfa_index);
spin_unlock_bh(&idrinfo->lock);
spin_unlock(&idrinfo->lock);
gen_kill_estimator(&p->tcfa_rate_est);
free_tcf(p);
}
Expand Down Expand Up @@ -156,7 +156,7 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
struct tc_action *p;
unsigned long id = 1;

spin_lock_bh(&idrinfo->lock);
spin_lock(&idrinfo->lock);

s_i = cb->args[0];

Expand Down Expand Up @@ -191,7 +191,7 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
if (index >= 0)
cb->args[0] = index + 1;

spin_unlock_bh(&idrinfo->lock);
spin_unlock(&idrinfo->lock);
if (n_i) {
if (act_flags & TCA_FLAG_LARGE_DUMP_ON)
cb->args[1] = n_i;
Expand Down Expand Up @@ -261,9 +261,9 @@ static struct tc_action *tcf_idr_lookup(u32 index, struct tcf_idrinfo *idrinfo)
{
struct tc_action *p = NULL;

spin_lock_bh(&idrinfo->lock);
spin_lock(&idrinfo->lock);
p = idr_find(&idrinfo->action_idr, index);
spin_unlock_bh(&idrinfo->lock);
spin_unlock(&idrinfo->lock);

return p;
}
Expand Down Expand Up @@ -323,15 +323,15 @@ int tcf_idr_create(struct tc_action_net *tn, u32 index, struct nlattr *est,
}
spin_lock_init(&p->tcfa_lock);
idr_preload(GFP_KERNEL);
spin_lock_bh(&idrinfo->lock);
spin_lock(&idrinfo->lock);
/* user doesn't specify an index */
if (!index) {
index = 1;
err = idr_alloc_u32(idr, NULL, &index, UINT_MAX, GFP_ATOMIC);
} else {
err = idr_alloc_u32(idr, NULL, &index, index, GFP_ATOMIC);
}
spin_unlock_bh(&idrinfo->lock);
spin_unlock(&idrinfo->lock);
idr_preload_end();
if (err)
goto err3;
Expand Down Expand Up @@ -369,9 +369,9 @@ void tcf_idr_insert(struct tc_action_net *tn, struct tc_action *a)
{
struct tcf_idrinfo *idrinfo = tn->idrinfo;

spin_lock_bh(&idrinfo->lock);
spin_lock(&idrinfo->lock);
idr_replace(&idrinfo->action_idr, a, a->tcfa_index);
spin_unlock_bh(&idrinfo->lock);
spin_unlock(&idrinfo->lock);
}
EXPORT_SYMBOL(tcf_idr_insert);

Expand Down

0 comments on commit 290aa0a

Please sign in to comment.