Received: by 10.213.65.68 with SMTP id h4csp116927imn; Wed, 21 Mar 2018 13:54:30 -0700 (PDT) X-Google-Smtp-Source: AG47ELuhcCY/bR5skKfZ4/7nhDqJ6sgG6DYgCWrTLufyiB0SqCzjyB7m3q+i/vgSlbqWsJO7vgtY X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr22109241plp.228.1521665670583; Wed, 21 Mar 2018 13:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521665670; cv=none; d=google.com; s=arc-20160816; b=WRLvYjZn9NYOwA/gknhEGEAJNDRxxUAgUZT71aGZ1wsRphTLpMi+Hck4lEU6g7Bmuk 9ch4TTIlbEBFxDcEHIKGIRx4OO0axLeB6CDkeAylPlfU9io5l8yhyTC3EXP4NWbZzHK0 T+EUZOwMK5S+2TJsYB1Qk+zt+g5s5/tq/Sdf3mj6eGSxhx5UhmPqbygFyOiBiscWLebx OY4vFmNPC3dPPjyKQHFptWSLQqWq0LAh77IxXQusjv+ANdKAURPV2G+0V9YQQaZ25vnH lTayrG6Ojs1xF5bZvHhEeEgyRuim1TEZgUimialQB6FBkd88oxBJmmvoLU93WPMOnppF jHBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=wt4pDJfQvsVAIWbEHTCgZjpI/vIubX2AoUW6NQJb7as=; b=SvCHQ3sRb4IJ+OBJ7UkeYHllR6V4wPEx/TMLNz+4a+SDQErKmCA0BGNahFVOEz9HYd hKCxLqmvEL4rv1YbdLEYcswzHDNqJMqloBm/qf1BmYss22Mu31L8ISyYaS2D8dORNQVJ kECSYrkLEtyUCTSuIo7OMF4nNk6uEOHk5TgnQ0+Y7/e781dT+9f+7TFeOkL/jItsdHOd ypkQ/fOMXh46X6ZZlc+2tL+/uIpnxNmNgVy3tCTXx6P2f04psVhmCG2FaO68m7I7EqGb 1JAE2dOlYQiWgEa6z8eQg9HrIhWMJAciVtJv1L+VCrzXHijwMpDBN+2Cx5QDfjb7EpU1 3CDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z7uooKVk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b72si3719817pfk.135.2018.03.21.13.54.15; Wed, 21 Mar 2018 13:54:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z7uooKVk; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753362AbeCUUxL (ORCPT + 99 others); Wed, 21 Mar 2018 16:53:11 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:42236 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753209AbeCUUxC (ORCPT ); Wed, 21 Mar 2018 16:53:02 -0400 Received: by mail-pg0-f66.google.com with SMTP id f10so2242435pgs.9; Wed, 21 Mar 2018 13:53:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wt4pDJfQvsVAIWbEHTCgZjpI/vIubX2AoUW6NQJb7as=; b=Z7uooKVkk3lPWdk/cUoTBldJ+Mq7aZ9N7OZvvg6bO5z9C264Wm7ygI2wVzR7IZk7Nw hPeCsTQ2q+vj5qlrBAZT6C/NEsGTVVk2iv87t0OJ2mEyUCNBTKYAutS56HJVf/HlHmc1 iMX6XZghZLD3ws+FiJ+MtR3YewESS39y/PqIvOzZFXhOKo6cgw4g3xoef4V42G2MPVhO Eg8cKWL0Xf/v2T5+gMYUycyJza46Olmi2ospXsztx5b7Ij8t77bur22yMwJe8f8j/y0f 2RE2IEhwwsELWNqqlrYYo3uOq3jYyapM+ilwnZe5ya99H+kZRl4U92Qnm8A3Xed+399P AJDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=wt4pDJfQvsVAIWbEHTCgZjpI/vIubX2AoUW6NQJb7as=; b=n/pxL/N74zGN4Q8l+9iKOqn48iODB9Hl9S3ZKEmpjrehTIjsXHT/6n3Y9lFdKkvmn/ ZaFKl0PB4zd6UgzRfdJMSOEDNEbN3mWhZRAsdA8oYUgsNCWXzs/fCVD7w52PomOM3j77 gYc9ogjiRmlww3nnb0bgajrt9zChjBv64PXzYavnBF8+apjM94sGcqkv7xV0+ISVbUj3 Vu7BaBPSb2IT78zYoenmORu0jtvi+mK1ocOQmutqO8I4k5ynGKiHw63e35g98d7PgU9G RrgyBFGmVpSvLRpQExZrUvJuxMLWQ7fmOtUJ8m8gTnG1cj8qczyNw4/qUoRMavQa/Jx9 XakQ== X-Gm-Message-State: AElRT7GJyyeAX7I/E4szoelZ5R8XED5RyIh6TqRDbUtAVMtr2zTJ3QKl Uz3YduUvtFfBMLdcLqxWWefr4o4N X-Received: by 10.99.64.197 with SMTP id n188mr15927962pga.21.1521665581754; Wed, 21 Mar 2018 13:53:01 -0700 (PDT) Received: from [192.168.86.235] ([75.106.27.153]) by smtp.gmail.com with ESMTPSA id i12sm8755994pgr.9.2018.03.21.13.52.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 13:52:58 -0700 (PDT) Subject: Re: [bug, bisected] pfifo_fast causes packet reordering To: Jakob Unterwurzacher , Dave Taht Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "David S. Miller" , "linux-can@vger.kernel.org" , Martin Elshuber References: <946dbe16-a2eb-eca8-8069-468859ccc78d@theobroma-systems.com> <95844480-d020-9000-53ef-0da8b965ce6e@gmail.com> <3a959e50-8656-5d9c-97b9-227d733948f8@theobroma-systems.com> <5aeb54ba-2d96-4ab5-53c4-2d3691be7acc@gmail.com> <340a6c54-6031-5522-98f5-eafdd3a37a38@theobroma-systems.com> <00cc2d41-6861-9a9c-603f-ba8013b2e2ce@theobroma-systems.com> <4e33aae4-9e87-22b4-7f09-008183ea553a@gmail.com> <983427eb-2e25-f201-c953-4cff22569deb@theobroma-systems.com> From: John Fastabend Message-ID: Date: Wed, 21 Mar 2018 13:52:42 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <983427eb-2e25-f201-c953-4cff22569deb@theobroma-systems.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/21/2018 12:44 PM, Jakob Unterwurzacher wrote: > On 21.03.18 19:43, John Fastabend wrote: >> Thats my theory at least. Are you able to test a patch if I generate >> one to fix this? > > Yes, no problem. Can you try this, diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index d4907b5..1e596bd 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -30,6 +30,7 @@ struct qdisc_rate_table { enum qdisc_state_t { __QDISC_STATE_SCHED, __QDISC_STATE_DEACTIVATED, + __QDISC_STATE_RUNNING, }; struct qdisc_size_table { diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 190570f..cf7c37d 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -377,20 +377,26 @@ static inline bool qdisc_restart(struct Qdisc *q, int *packets) struct netdev_queue *txq; struct net_device *dev; struct sk_buff *skb; - bool validate; + bool more, validate; /* Dequeue packet */ + if (test_and_set_bit(__QDISC_STATE_RUNNING, &q->state)) + return false; + skb = dequeue_skb(q, &validate, packets); - if (unlikely(!skb)) + if (unlikely(!skb)) { + clear_bit(__QDISC_STATE_RUNNING, &q->state); return false; + } if (!(q->flags & TCQ_F_NOLOCK)) root_lock = qdisc_lock(q); dev = qdisc_dev(q); txq = skb_get_tx_queue(dev, skb); - - return sch_direct_xmit(skb, q, dev, txq, root_lock, validate); + more = sch_direct_xmit(skb, q, dev, txq, root_lock, validate); + clear_bit(__QDISC_STATE_RUNNING, &q->state); + return more; } > > I just tested with the flag change you suggested (see below, I had to keep TCQ_F_CPUSTATS to prevent a crash) and I have NOT seen OOO so far. > Right because the code expects per cpu stats if the CPUSTATS flag is removed it will crash. > Thanks, > Jakob > > > diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c > index 190570f21b20..51b68ef4977b 100644 > --- a/net/sched/sch_generic.c > +++ b/net/sched/sch_generic.c > @@ -792,7 +792,7 @@ struct Qdisc_ops pfifo_fast_ops __read_mostly = { >         .dump           =       pfifo_fast_dump, >         .change_tx_queue_len =  pfifo_fast_change_tx_queue_len, >         .owner          =       THIS_MODULE, > -       .static_flags   =       TCQ_F_NOLOCK | TCQ_F_CPUSTATS, > +       .static_flags   =       TCQ_F_CPUSTATS, >  }; >  EXPORT_SYMBOL(pfifo_fast_ops);