[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f2244b849e81e26239d232499b1c714b96b2243c.camel@mellanox.com>
Date: Wed, 24 Apr 2019 18:43:42 +0000
From: Saeed Mahameed <saeedm@...lanox.com>
To: "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
Vlad Buslov <vladbu@...lanox.com>
CC: "jhs@...atatu.com" <jhs@...atatu.com>,
"davem@...emloft.net" <davem@...emloft.net>,
"jakub.kicinski@...ronome.com" <jakub.kicinski@...ronome.com>,
"xiyou.wangcong@...il.com" <xiyou.wangcong@...il.com>,
"jiri@...nulli.us" <jiri@...nulli.us>
Subject: Re: [PATCH net-next v2] net: sched: flower: refactor reoffload for
concurrent access
On Wed, 2019-04-24 at 09:53 +0300, Vlad Buslov wrote:
> Recent changes that introduced unlocked flower did not properly
> account for
> case when reoffload is initiated concurrently with filter updates. To
> fix
> the issue, extend flower with 'hw_filters' list that is used to store
> filters that don't have 'skip_hw' flag set. Filter is added to the
> list
> when it is inserted to hardware and only removed from it after being
> unoffloaded from all drivers that parent block is attached to. This
> ensures
> that concurrent reoffload can still access filter that is being
> deleted and
> prevents race condition when driver callback can be removed when
> filter is
> no longer accessible trough idr, but is still present in hardware.
>
> Refactor fl_change() to respect new filter reference counter and to
> release
> filter reference with __fl_put() in case of error, instead of
> directly
> deallocating filter memory. This allows for concurrent access to
> filter
> from fl_reoffload() and protects it with reference counting. Refactor
> fl_reoffload() to iterate over hw_filters list instead of idr.
> Implement
> fl_get_next_hw_filter() helper function that is used to iterate over
> hw_filters list with reference counting and skips filters that are
> being
> concurrently deleted.
>
> Fixes: 92149190067d ("net: sched: flower: set unlocked flag for
> flower proto ops")
> Signed-off-by: Vlad Buslov <vladbu@...lanox.com>
Reviewed-by: Saeed Mahameed <saeedm@...lanox.com>
> ---
> Changes from V1 to V2:
> - Don't verify that list is not empty before calling list_del_init().
> - Assert that rtnl lock is taken in fl_reoffload().
> - Refactor fl_get_next_hw_filter() to simplify the code.
> - Remove redundant check for skip_hw flag from fl_reoffload() main
> loop.
>
> net/sched/cls_flower.c | 79 ++++++++++++++++++++++++++++++--------
>
Powered by blists - more mailing lists