netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yunsheng Lin <linyunsheng@huawei.com>
To: Hillf Danton <hdanton@sina.com>
Cc: Juergen Gross <jgross@suse.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Jiri Kosina <JKosina@suse.com>
Subject: Re: [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc
Date: Tue, 13 Apr 2021 10:56:42 +0800	[thread overview]
Message-ID: <57ace28a-93bb-6581-bbba-18d77a9871f7@huawei.com> (raw)
In-Reply-To: <20210413022129.2203-1-hdanton@sina.com>

On 2021/4/13 10:21, Hillf Danton wrote:
> On Mon, 12 Apr 2021 20:00:43  Yunsheng Lin wrote:
>>
>> Yes, the below patch seems to fix the data race described in
>> the commit log.
>> Then what is the difference between my patch and your patch below:)
> 
> Hehe, this is one of the tough questions over a bounch of weeks.
> 
> If a seqcount can detect the race between skb enqueue and dequeue then we
> cant see any excuse for not rolling back to the point without NOLOCK.

I am not sure I understood what you meant above.

As my understanding, the below patch is essentially the same as
your previous patch, the only difference I see is it uses qdisc->pad
instead of __QDISC_STATE_NEED_RESCHEDULE.

So instead of proposing another patch, it would be better if you
comment on my patch, and make improvement upon that.

> 
> --- a/net/sched/sch_generic.c
> +++ b/net/sched/sch_generic.c
> @@ -632,6 +632,7 @@ static int pfifo_fast_enqueue(struct sk_
>  			return qdisc_drop(skb, qdisc, to_free);
>  	}
>  
> +	qdisc->pad++;

As has been mentioned:
Doing updating in pfifo_fast_enqueue() unconditionally does not
seems to be performance friendly, which is something my patch
tries to avoid as much as possible.

>  	qdisc_update_stats_at_enqueue(qdisc, pkt_len);
>  	return NET_XMIT_SUCCESS;
>  }
> @@ -642,6 +643,7 @@ static struct sk_buff *pfifo_fast_dequeu
>  	struct sk_buff *skb = NULL;
>  	int band;
>  
> +	qdisc->pad = 0;
>  	for (band = 0; band < PFIFO_FAST_BANDS && !skb; band++) {
>  		struct skb_array *q = band2list(priv, band);
>  
> --- a/include/net/sch_generic.h
> +++ b/include/net/sch_generic.h
> @@ -176,8 +176,12 @@ static inline bool qdisc_run_begin(struc
>  static inline void qdisc_run_end(struct Qdisc *qdisc)
>  {
>  	write_seqcount_end(&qdisc->running);
> -	if (qdisc->flags & TCQ_F_NOLOCK)
> +	if (qdisc->flags & TCQ_F_NOLOCK) {
>  		spin_unlock(&qdisc->seqlock);
> +
> +		if (qdisc->pad != 0)
> +			__netif_schedule(qdisc);
> +	}
>  }
>  
>  static inline bool qdisc_may_bulk(const struct Qdisc *qdisc)
> 
> .
> 


  parent reply	other threads:[~2021-04-13  2:56 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25  3:13 [PATCH net v3] net: sched: fix packet stuck problem for lockless qdisc Yunsheng Lin
2021-04-09  5:31 ` Juergen Gross
2021-04-12  1:04   ` Yunsheng Lin
2021-04-12  8:21     ` Juergen Gross
     [not found] ` <20210409090909.1767-1-hdanton@sina.com>
2021-04-12  1:24   ` Yunsheng Lin
     [not found]   ` <20210412032111.1887-1-hdanton@sina.com>
2021-04-12  3:37     ` Yunsheng Lin
     [not found]     ` <20210412072856.2046-1-hdanton@sina.com>
2021-04-12 12:00       ` Yunsheng Lin
     [not found]       ` <20210413022129.2203-1-hdanton@sina.com>
2021-04-13  2:56         ` Yunsheng Lin [this message]
     [not found]         ` <20210413032620.2259-1-hdanton@sina.com>
2021-04-13  3:34           ` Yunsheng Lin
     [not found]           ` <20210413071241.2325-1-hdanton@sina.com>
2021-04-13  7:57             ` Yunsheng Lin
     [not found]             ` <20210413083352.2424-1-hdanton@sina.com>
2021-04-13  9:03               ` Yunsheng Lin
2021-04-13  9:15                 ` Juergen Gross
2021-04-16 11:46                   ` Jiri Kosina
2021-04-18 22:59 ` Michal Kubecek
2021-04-19  2:04   ` Yunsheng Lin
2021-04-19 12:21     ` [Linuxarm] " Yunsheng Lin
2021-04-19 15:25       ` Michal Kubecek
2021-04-19 14:57     ` Michal Kubecek
2021-04-20  1:45       ` Yunsheng Lin

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=57ace28a-93bb-6581-bbba-18d77a9871f7@huawei.com \
    --to=linyunsheng@huawei.com \
    --cc=JKosina@suse.com \
    --cc=hdanton@sina.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).