1. 17 2月, 2016 1 次提交
  2. 26 8月, 2015 1 次提交
  3. 10 3月, 2015 2 次提交
    • W
      net_sched: fix struct tc_u_hnode layout in u32 · 5778d39d
      WANG Cong 提交于
      We dynamically allocate divisor+1 entries for ->ht[] in tc_u_hnode:
      
        ht = kzalloc(sizeof(*ht) + divisor*sizeof(void *), GFP_KERNEL);
      
      So ->ht is supposed to be the last field of this struct, however
      this is broken, since an rcu head is appended after it.
      
      Fixes: 1ce87720 ("net: sched: make cls_u32 lockless")
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Acked-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5778d39d
    • C
      net_sched: destroy proto tp when all filters are gone · 1e052be6
      Cong Wang 提交于
      Kernel automatically creates a tp for each
      (kind, protocol, priority) tuple, which has handle 0,
      when we add a new filter, but it still is left there
      after we remove our own, unless we don't specify the
      handle (literally means all the filters under
      the tuple). For example this one is left:
      
        # tc filter show dev eth0
        filter parent 8001: protocol arp pref 49152 basic
      
      The user-space is hard to clean up these for kernel
      because filters like u32 are organized in a complex way.
      So kernel is responsible to remove it after all filters
      are gone.  Each type of filter has its own way to
      store the filters, so each type has to provide its
      way to check if all filters are gone.
      
      Cc: Jamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: NCong Wang <cwang@twopensource.com>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Acked-by: Jamal Hadi Salim<jhs@mojatatu.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1e052be6
  4. 10 12月, 2014 1 次提交
  5. 02 10月, 2014 1 次提交
    • W
      net_sched: avoid calling tcf_unbind_filter() in call_rcu callback · a0efb80c
      WANG Cong 提交于
      This fixes the following crash:
      
      [   63.976822] general protection fault: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC
      [   63.980094] CPU: 1 PID: 15 Comm: ksoftirqd/1 Not tainted 3.17.0-rc6+ #648
      [   63.980094] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      [   63.980094] task: ffff880117dea690 ti: ffff880117dfc000 task.ti: ffff880117dfc000
      [   63.980094] RIP: 0010:[<ffffffff817e6d07>]  [<ffffffff817e6d07>] u32_destroy_key+0x27/0x6d
      [   63.980094] RSP: 0018:ffff880117dffcc0  EFLAGS: 00010202
      [   63.980094] RAX: ffff880117dea690 RBX: ffff8800d02e0820 RCX: 0000000000000000
      [   63.980094] RDX: 0000000000000001 RSI: 0000000000000002 RDI: 6b6b6b6b6b6b6b6b
      [   63.980094] RBP: ffff880117dffcd0 R08: 0000000000000000 R09: 0000000000000000
      [   63.980094] R10: 00006c0900006ba8 R11: 00006ba100006b9d R12: 0000000000000001
      [   63.980094] R13: ffff8800d02e0898 R14: ffffffff817e6d4d R15: ffff880117387a30
      [   63.980094] FS:  0000000000000000(0000) GS:ffff88011a800000(0000) knlGS:0000000000000000
      [   63.980094] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
      [   63.980094] CR2: 00007f07e6732fed CR3: 000000011665b000 CR4: 00000000000006e0
      [   63.980094] Stack:
      [   63.980094]  ffff88011a9cd300 ffffffff82051ac0 ffff880117dffce0 ffffffff817e6d68
      [   63.980094]  ffff880117dffd70 ffffffff810cb4c7 ffffffff810cb3cd ffff880117dfffd8
      [   63.980094]  ffff880117dea690 ffff880117dea690 ffff880117dfffd8 000000000000000a
      [   63.980094] Call Trace:
      [   63.980094]  [<ffffffff817e6d68>] u32_delete_key_freepf_rcu+0x1b/0x1d
      [   63.980094]  [<ffffffff810cb4c7>] rcu_process_callbacks+0x3bb/0x691
      [   63.980094]  [<ffffffff810cb3cd>] ? rcu_process_callbacks+0x2c1/0x691
      [   63.980094]  [<ffffffff817e6d4d>] ? u32_destroy_key+0x6d/0x6d
      [   63.980094]  [<ffffffff810780a4>] __do_softirq+0x142/0x323
      [   63.980094]  [<ffffffff810782a8>] run_ksoftirqd+0x23/0x53
      [   63.980094]  [<ffffffff81092126>] smpboot_thread_fn+0x203/0x221
      [   63.980094]  [<ffffffff81091f23>] ? smpboot_unpark_thread+0x33/0x33
      [   63.980094]  [<ffffffff8108e44d>] kthread+0xc9/0xd1
      [   63.980094]  [<ffffffff819e00ea>] ? do_wait_for_common+0xf8/0x125
      [   63.980094]  [<ffffffff8108e384>] ? __kthread_parkme+0x61/0x61
      [   63.980094]  [<ffffffff819e43ec>] ret_from_fork+0x7c/0xb0
      [   63.980094]  [<ffffffff8108e384>] ? __kthread_parkme+0x61/0x61
      
      tp could be freed in call_rcu callback too, the order is not guaranteed.
      
      John Fastabend says:
      
      ====================
      Its worth noting why this is safe. Any running schedulers will either
      read the valid class field or it will be zeroed.
      
      All schedulers today when the class is 0 do a lookup using the
      same call used by the tcf_exts_bind(). So even if we have a running
      classifier hit the null class pointer it will do a lookup and get
      to the same result. This is particularly fragile at the moment because
      the only way to verify this is to audit the schedulers call sites.
      ====================
      
      Cc: John Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Acked-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a0efb80c
  6. 29 9月, 2014 1 次提交
  7. 23 9月, 2014 3 次提交
  8. 20 9月, 2014 1 次提交
  9. 17 9月, 2014 2 次提交
    • J
      net: sched: cls_u32 add missing rcu_assign_pointer and annotation · a96366bf
      John Fastabend 提交于
      Add missing rcu_assign_pointer and missing  annotation for ht_up
      in cls_u32.c
      
      Caught by kbuild bot,
      
      >> net/sched/cls_u32.c:378:36: sparse: incorrect type in initializer (different address spaces)
         net/sched/cls_u32.c:378:36:    expected struct tc_u_hnode *ht
         net/sched/cls_u32.c:378:36:    got struct tc_u_hnode [noderef] <asn:4>*ht_up
      >> net/sched/cls_u32.c:610:54: sparse: incorrect type in argument 4 (different address spaces)
         net/sched/cls_u32.c:610:54:    expected struct tc_u_hnode *ht
         net/sched/cls_u32.c:610:54:    got struct tc_u_hnode [noderef] <asn:4>*ht_up
      >> net/sched/cls_u32.c:684:18: sparse: incorrect type in assignment (different address spaces)
         net/sched/cls_u32.c:684:18:    expected struct tc_u_hnode [noderef] <asn:4>*ht_up
         net/sched/cls_u32.c:684:18:    got struct tc_u_hnode *[assigned] ht
      >> net/sched/cls_u32.c:359:18: sparse: dereference of noderef expression
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a96366bf
    • J
      net: sched: fix unsued cpu variable · 80aab73d
      John Fastabend 提交于
      kbuild test robot reported an unused variable cpu in cls_u32.c
      after the patch below. This happens when PERF and MARK config
      variables are disabled
      
      Fix this is to use separate variables for perf and mark
      and define the cpu variable inside the ifdef logic.
      
      Fixes: 459d5f62 ("net: sched: make cls_u32 per cpu")'
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Acked-by: NCong Wang <cwang@twopensource.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      80aab73d
  10. 14 9月, 2014 4 次提交
    • J
      net: sched: make cls_u32 lockless · 1ce87720
      John Fastabend 提交于
      Make cls_u32 classifier safe to run without holding lock. This patch
      converts statistics that are kept in read section u32_classify into
      per cpu counters.
      
      This patch was tested with a tight u32 filter add/delete loop while
      generating traffic with pktgen. By running pktgen on vlan devices
      created on top of a physical device we can hit the qdisc layer
      correctly. For ingress qdisc's a loopback cable was used.
      
      for i in {1..100}; do
              q=`echo $i%8|bc`;
              echo -n "u32 tos: iteration $i on queue $q";
              tc filter add dev p3p2 parent $p prio $i u32 match ip tos 0x10 0xff \
                        action skbedit queue_mapping $q;
              sleep 1;
              tc filter del dev p3p2 prio $i;
      
              echo -n "u32 tos hash table: iteration $i on queue $q";
              tc filter add dev p3p2 parent $p protocol ip prio $i handle 628: u32 divisor 1
              tc filter add dev p3p2 parent $p protocol ip prio $i u32 \
                      match ip protocol 17 0xff link 628: offset at 0 mask 0xf00 shift 6 plus 0
              tc filter add dev p3p2 parent $p protocol ip prio $i u32 \
                      ht 628:0 match ip tos 0x10 0xff action skbedit queue_mapping $q
              sleep 2;
              tc filter del dev p3p2 prio $i
              sleep 1;
      done
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Acked-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      1ce87720
    • J
      net: sched: make cls_u32 per cpu · 459d5f62
      John Fastabend 提交于
      This uses per cpu counters in cls_u32 in preparation
      to convert over to rcu.
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Acked-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      459d5f62
    • J
      net: sched: make cls_u32 lockless · 8f787cd1
      John Fastabend 提交于
      Make cls_u32 classifier safe to run without holding lock. This patch
      converts statistics that are kept in read section u32_classify into
      per cpu counters.
      
      This patch was tested with a tight u32 filter add/delete loop while
      generating traffic with pktgen. By running pktgen on vlan devices
      created on top of a physical device we can hit the qdisc layer
      correctly. For ingress qdisc's a loopback cable was used.
      
      for i in {1..100}; do
              q=`echo $i%8|bc`;
              echo -n "u32 tos: iteration $i on queue $q";
              tc filter add dev p3p2 parent $p prio $i u32 match ip tos 0x10 0xff \
                        action skbedit queue_mapping $q;
              sleep 1;
              tc filter del dev p3p2 prio $i;
      
              echo -n "u32 tos hash table: iteration $i on queue $q";
              tc filter add dev p3p2 parent $p protocol ip prio $i handle 628: u32 divisor 1
              tc filter add dev p3p2 parent $p protocol ip prio $i u32 \
                      match ip protocol 17 0xff link 628: offset at 0 mask 0xf00 shift 6 plus 0
              tc filter add dev p3p2 parent $p protocol ip prio $i u32 \
                      ht 628:0 match ip tos 0x10 0xff action skbedit queue_mapping $q
              sleep 2;
              tc filter del dev p3p2 prio $i
              sleep 1;
      done
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Acked-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8f787cd1
    • J
      net: sched: make cls_u32 per cpu · f4f64050
      John Fastabend 提交于
      This uses per cpu counters in cls_u32 in preparation
      to convert over to rcu.
      Signed-off-by: NJohn Fastabend <john.r.fastabend@intel.com>
      Acked-by: NEric Dumazet <edumazet@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f4f64050
  11. 21 7月, 2014 1 次提交
    • C
      net_sched: avoid generating same handle for u32 filters · 7801db8a
      Cong Wang 提交于
      When kernel generates a handle for a u32 filter, it tries to start
      from the max in the bucket. So when we have a filter with the max (fff)
      handle, it will cause kernel always generates the same handle for new
      filters. This can be shown by the following command:
      
      	tc qdisc add dev eth0 ingress
      	tc filter add dev eth0 parent ffff: protocol ip pref 770 handle 800::fff u32 match ip protocol 1 0xff
      	tc filter add dev eth0 parent ffff: protocol ip pref 770 u32 match ip protocol 1 0xff
      	...
      
      we will get some u32 filters with same handle:
      
       # tc filter show dev eth0 parent ffff:
      filter protocol ip pref 770 u32
      filter protocol ip pref 770 u32 fh 800: ht divisor 1
      filter protocol ip pref 770 u32 fh 800::fff order 4095 key ht 800 bkt 0
        match 00010000/00ff0000 at 8
      filter protocol ip pref 770 u32 fh 800::fff order 4095 key ht 800 bkt 0
        match 00010000/00ff0000 at 8
      filter protocol ip pref 770 u32 fh 800::fff order 4095 key ht 800 bkt 0
        match 00010000/00ff0000 at 8
      filter protocol ip pref 770 u32 fh 800::fff order 4095 key ht 800 bkt 0
        match 00010000/00ff0000 at 8
      
      handles should be unique. This patch fixes it by looking up a bitmap,
      so that can guarantee the handle is as unique as possible. For compatibility,
      we still start from 0x800.
      
      Cc: "David S. Miller" <davem@davemloft.net>
      Signed-off-by: NCong Wang <cwang@twopensource.com>
      Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: NJamal Hadi Salim <jhs@mojatatu.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7801db8a
  12. 28 4月, 2014 1 次提交
  13. 14 1月, 2014 3 次提交
  14. 19 12月, 2013 2 次提交
  15. 11 12月, 2013 1 次提交
  16. 15 1月, 2013 1 次提交
  17. 15 8月, 2012 1 次提交
  18. 16 5月, 2012 1 次提交
  19. 02 4月, 2012 1 次提交
  20. 06 7月, 2011 1 次提交
  21. 23 2月, 2011 1 次提交
  22. 20 1月, 2011 1 次提交
  23. 05 10月, 2010 1 次提交
  24. 03 8月, 2010 1 次提交
  25. 02 6月, 2010 1 次提交
  26. 18 5月, 2010 1 次提交
  27. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  28. 25 3月, 2010 1 次提交
  29. 06 1月, 2009 1 次提交
  30. 20 11月, 2008 1 次提交