public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev@vger.kernel.org, jiri@mellanox.com,
	jakub.kicinski@netronome.com, jhs@mojatatu.com
Subject: Re: [Patch net v3 3/3] net_sched: carefully handle tcf_block_put()
Date: Tue, 12 Sep 2017 12:43:58 +0200	[thread overview]
Message-ID: <20170912104358.GG2036@nanopsycho> (raw)
In-Reply-To: <20170911233332.7594-4-xiyou.wangcong@gmail.com>

Tue, Sep 12, 2017 at 01:33:32AM CEST, xiyou.wangcong@gmail.com wrote:
>As pointed out by Jiri, there is still a race condition between
>tcf_block_put() and tcf_chain_destroy() in a RCU callback. There
>is no way to make it correct without proper locking or synchronization,
>because both operate on a shared list.
>
>Locking is hard, because the only lock we can pick here is a spinlock,
>however, in tc_dump_tfilter() we iterate this list with a sleeping
>function called (tcf_chain_dump()), which makes using a lock to protect
>chain_list almost impossible.
>
>Jiri suggested the idea of holding a refcnt before flushing, this works
>because it guarantees us there would be no parallel tcf_chain_destroy()
>during the loop, therefore the race condition is gone. But we have to
>be very careful with proper synchronization with RCU callbacks.
>
>Suggested-by: Jiri Pirko <jiri@mellanox.com>
>Cc: Jamal Hadi Salim <jhs@mojatatu.com>
>Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

Thanks!

  reply	other threads:[~2017-09-12 10:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-11 23:33 [Patch net v3 0/3] net_sched: fix filter chain reference counting Cong Wang
2017-09-11 23:33 ` [Patch net v3 1/3] net_sched: get rid of tcfa_rcu Cong Wang
2017-09-12  9:42   ` Jiri Pirko
2017-09-12 10:40     ` Jiri Pirko
2017-09-12 21:10       ` Cong Wang
2017-09-12 21:36         ` Jiri Pirko
2017-09-12 21:53           ` Cong Wang
2017-09-13  6:13             ` Jiri Pirko
2017-09-11 23:33 ` [Patch net v3 2/3] net_sched: fix reference counting of tc filter chain Cong Wang
2017-09-12 10:43   ` Jiri Pirko
2017-09-11 23:33 ` [Patch net v3 3/3] net_sched: carefully handle tcf_block_put() Cong Wang
2017-09-12 10:43   ` Jiri Pirko [this message]
2017-09-13  3:41 ` [Patch net v3 0/3] net_sched: fix filter chain reference counting David Miller
2017-09-13  6:13   ` Jiri Pirko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170912104358.GG2036@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=jakub.kicinski@netronome.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox