Thread (44 messages) 44 messages, 3 authors, 2019-03-02

Re: [PATCH net-next 09/12] net: sched: flower: handle concurrent tcf proto deletion

From: Vlad Buslov <hidden>
Date: 2019-02-19 14:08:52

On Mon 18 Feb 2019 at 20:47, Cong Wang [off-list ref] wrote:
On Wed, Feb 13, 2019 at 11:47 PM Vlad Buslov [off-list ref] wrote:
quoted
Without rtnl lock protection tcf proto can be deleted concurrently. Check
tcf proto 'deleting' flag after taking tcf spinlock to verify that no
concurrent deletion is in progress. Return EAGAIN error if concurrent
deletion detected, which will cause caller to retry and possibly create new
instance of tcf proto.
Please state the reason why you prefer retry over locking the whole
tp without retrying, that is why and how it is better?

Personally I always prefer non-retry logic, because it is very easy
to understand and justify its correctness.

As you prefer otherwise, please share your reasoning in changelog.

Thanks!
At the moment filter removal code is implemented by cls API in following
fashion:

1) tc_del_tfilter() obtains opaque void pointer to filter by calling
tp->ops->get()

2) Pass filter pointer to tfilter_del_notify() which prepares skb with
all necessary info about filter that is being removed and...

3) ... calls tp->ops->delete() to actually delete filter.

Between 1) and 3) filter can be removed concurrently and there is
nothing we can do about it in flower, besides account for that with some
kind of retry logic. I will explain why I prefer cls API to not just
lock whole classifier instance when modifying it in any way in reply to
cls API patch "net: sched: protect filter_chain list with
filter_chain_lock mutex" discussion.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help