Skip to content
  1. Nov 29, 2016
  2. Nov 28, 2016
    • David S. Miller's avatar
      Merge branch 'bpf-misc-next' · 53c4ce02
      David S. Miller authored
      
      
      Daniel Borkmann says:
      
      ====================
      BPF cleanups and misc updates
      
      This patch set adds couple of cleanups in first few patches,
      exposes owner_prog_type for array maps as well as mlocked mem
      for maps in fdinfo, allows for mount permissions in fs and
      fixes various outstanding issues in selftests and samples.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      53c4ce02
    • Daniel Borkmann's avatar
      bpf: fix multiple issues in selftest suite and samples · e00c7b21
      Daniel Borkmann authored
      1) The test_lru_map and test_lru_dist fails building on my machine since
         the sys/resource.h header is not included.
      
      2) test_verifier fails in one test case where we try to call an invalid
         function, since the verifier log output changed wrt printing function
         names.
      
      3) Current selftest suite code relies on sysconf(_SC_NPROCESSORS_CONF) for
         retrieving the number of possible CPUs. This is broken at least in our
         scenario and really just doesn't work.
      
         glibc tries a number of things for retrieving _SC_NPROCESSORS_CONF.
         First it tries equivalent of /sys/devices/system/cpu/cpu[0-9]* | wc -l,
         if that fails, depending on the config, it either tries to count CPUs
         in /proc/cpuinfo, or returns the _SC_NPROCESSORS_ONLN value instead.
         If /proc/cpuinfo has some issue, it returns just 1 worst case. This
         oddity is nothing new [1], but semantics/behaviour seems to be settled.
         _SC_NPROCESSORS_ONLN will parse /sys/devices/system/cpu/online, if
         that fails it looks into /proc/stat for cpuX entries, and if also that
         fails for some reason, /proc/cpuinfo is consulted (and returning 1 if
         unlikely all breaks down).
      
         While that might match num_possible_cpus() from the kernel in some
         cases, it's really not guaranteed with CPU hotplugging, and can result
         in a buffer overflow since the array in user space could have too few
         number of slots, and on perpcu map lookup, the kernel will write beyond
         that memory of the value buffer.
      
         William Tu reported such mismatches:
      
           [...] The fact that sysconf(_SC_NPROCESSORS_CONF) != num_possible_cpu()
           happens when CPU hotadd is enabled. For example, in Fusion when
           setting vcpu.hotadd = "TRUE" or in KVM, setting ./qemu-system-x86_64
           -smp 2, maxcpus=4 ... the num_possible_cpu() will be 4 and sysconf()
           will be 2 [2]. [...]
      
         Documentation/cputopology.txt says /sys/devices/system/cpu/possible
         outputs cpu_possible_mask. That is the same as in num_possible_cpus(),
         so first step would be to fix the _SC_NPROCESSORS_CONF calls with our
         own implementation. Later, we could add support to bpf(2) for passing
         a mask via CPU_SET(3), for example, to just select a subset of CPUs.
      
         BPF samples code needs this fix as well (at least so that people stop
         copying this). Thus, define bpf_num_possible_cpus() once in selftests
         and import it from there for the sample code to avoid duplicating it.
         The remaining sysconf(_SC_NPROCESSORS_CONF) in samples are unrelated.
      
      After all three issues are fixed, the test suite runs fine again:
      
        # make run_tests | grep self
        selftests: test_verifier [PASS]
        selftests: test_maps [PASS]
        selftests: test_lru_map [PASS]
        selftests: test_kmod.sh [PASS]
      
        [1] https://www.sourceware.org/ml/libc-alpha/2011-06/msg00079.html
        [2] https://www.mail-archive.com/netdev@vger.kernel.org/msg121183.html
      
      Fixes: 3059303f ("samples/bpf: update tracex[23] examples to use per-cpu maps")
      Fixes: 86af8b41 ("Add sample for adding simple drop program to link")
      Fixes: df570f57 ("samples/bpf: unit test for BPF_MAP_TYPE_PERCPU_ARRAY")
      Fixes: e1559671 ("samples/bpf: unit test for BPF_MAP_TYPE_PERCPU_HASH")
      Fixes: ebb676da ("bpf: Print function name in addition to function id")
      Fixes: 5db58faf
      
       ("bpf: Add tests for the LRU bpf_htab")
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Cc: William Tu <u9012063@gmail.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e00c7b21
    • Daniel Borkmann's avatar
      bpf: allow for mount options to specify permissions · a3af5f80
      Daniel Borkmann authored
      
      
      Since we recently converted the BPF filesystem over to use mount_nodev(),
      we now have the possibility to also hold mount options in sb's s_fs_info.
      This work implements mount options support for specifying permissions on
      the sb's inode, which will be used by tc when it manually needs to mount
      the fs.
      
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a3af5f80
    • Daniel Borkmann's avatar
      bpf: add owner_prog_type and accounted mem to array map's fdinfo · 21116b70
      Daniel Borkmann authored
      
      
      Allow for checking the owner_prog_type of a program array map. In some
      cases bpf(2) can return -EINVAL /after/ the verifier passed and did all
      the rewrites of the bpf program.
      
      The reason that lets us fail at this late stage is that program array
      maps are incompatible. Allow users to inspect this earlier after they
      got the map fd through BPF_OBJ_GET command. tc will get support for this.
      
      Also, display how much we charged the map with regards to RLIMIT_MEMLOCK.
      
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      21116b70
    • Daniel Borkmann's avatar
      bpf: reuse dev_is_mac_header_xmit for redirect · c491680f
      Daniel Borkmann authored
      Commit dcf80034
      
       ("net/sched: act_mirred: Refactor detection whether
      dev needs xmit at mac header") added dev_is_mac_header_xmit(); since it's
      also useful elsewhere, move it to if_arp.h and reuse it for BPF.
      
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c491680f
    • Daniel Borkmann's avatar
      bpf: drop useless bpf_fd member from cls/act · 55556dd5
      Daniel Borkmann authored
      
      
      After setup we don't need to keep user space fd number around anymore, as
      it also has no useful meaning for anyone, just remove it.
      
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      55556dd5
    • Daniel Borkmann's avatar
      bpf: drop unnecessary context cast from BPF_PROG_RUN · 88575199
      Daniel Borkmann authored
      
      
      Since long already bpf_func is not only about struct sk_buff * as
      input anymore. Make it generic as void *, so that callers don't
      need to cast for it each time they call BPF_PROG_RUN().
      
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      88575199
    • Dan Carpenter's avatar
      sfc: remove unneeded variable · e3739099
      Dan Carpenter authored
      We don't use ->heap_buf after commit 46d1efd8
      
       ("sfc: remove Software
      TSO") so let's remove the last traces.
      
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Acked-by: default avatarEdward Cree <ecree@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e3739099
    • David S. Miller's avatar
      Merge tag 'wireless-drivers-next-for-davem-2016-11-25' of... · 33f8a045
      David S. Miller authored
      
      Merge tag 'wireless-drivers-next-for-davem-2016-11-25' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
      
      Kalle Valo says:
      
      ====================
      wireless-drivers-next patches for 4.10
      
      Major changes:
      
      iwlwifi
      
      * finalize and enable dynamic queue allocation
      * use dev_coredumpmsg() to prevent locking the driver
      * small fix to pass the AID to the FW
      * use FW PS decisions with multi-queue
      
      ath9k
      
      * add device tree bindings
      * switch to use mac80211 intermediate software queues to reduce
        latency and fix bufferbloat
      
      wl18xx
      
      * allow scanning in AP mode
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      33f8a045
    • Michael S. Tsirkin's avatar
      netdevice: fix sparse warning for HARD_TX_LOCK · 5a717f4f
      Michael S. Tsirkin authored
      
      
      sparse warns about context imbalance in any code
      that uses HARD_TX_LOCK/UNLOCK - this is because it's
      unable to determine that flags don't change so
      lock and unlock are paired.
      
      Seems easy enough to fix by adding __acquire/__release
      calls.
      
      With this patch af_packet.c is now sparse-clean,
      
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5a717f4f
    • Ulrik De Bie's avatar
      ptp: gianfar: Use high resolution frequency method. · 42895116
      Ulrik De Bie authored
      This patch depends on commit d8d26354
      
       ("ptp: Introduce a high
      resolution frequency adjustment method.")
      
      The gianfar devices offer a frequency resolution of about 0.46 ppb
      (depends on actual value of tmr_add, for the calculation assumed
      0x80000000). This patch lets users of the device benefit from the increased
      frequency resolution when tuning the clock. Thanks to the rounding the
      maximum error between the requested frequency and the applied frequency
      will then be about 0.23 ppb.
      
      Tested on a v3.3.8 kernel on a real gianfar device. Verified compilation
      on net-next (currently at v4.9-rc5).
      
      Signed-off-by: default avatarUlrik De Bie <ulrik.debie-os@e2big.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      42895116
    • Eric Dumazet's avatar
      mlx4: do not use priv->stats_lock in mlx4_en_auto_moderation() · b9972d22
      Eric Dumazet authored
      
      
      Per RX ring packets/bytes counters are not protected by global
      priv->stats_lock.
      
      Better not confuse the reader, and use READ_ONCE() to show we read
      these counters without surrounding synchronization.
      
      Interrupt moderation is best effort, and we do not really care of
      ultra precise counters.
      
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b9972d22
  3. Nov 27, 2016
    • David S. Miller's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · 0b42f25d
      David S. Miller authored
      
      
      udplite conflict is resolved by taking what 'net-next' did
      which removed the backlog receive method assignment, since
      it is no longer necessary.
      
      Two entries were added to the non-priv ethtool operations
      switch statement, one in 'net' and one in 'net-next, so
      simple overlapping changes.
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0b42f25d
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · d8e435f3
      Linus Torvalds authored
      Pull vfs splice fix from Al Viro.
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        fix default_file_splice_read()
      d8e435f3
    • Al Viro's avatar
      fix default_file_splice_read() · 8e54cada
      Al Viro authored
      
      
      Botched calculation of number of pages.  As the result,
      we were dropping pieces when doing splice to pipe from
      e.g. 9p.
      
      Reported-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Tested-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      8e54cada
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · e3480312
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Here is a revert and two bugfixes for the I2C designware driver.
      
        Please note that we are still hunting down a regression for the
        i2c-octeon driver. While there is a fix pending, we have unclear
        feedback from the testers currently. An rc8 would be quite helpful
        for this case"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        Revert "i2c: designware: do not disable adapter after transfer"
        i2c: designware: fix rx fifo depth tracking
        i2c: designware: report short transfers
      e3480312
    • Linus Torvalds's avatar
      Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm · a56f3eb2
      Linus Torvalds authored
      Pull ARM fix from Russell King:
       "This resolves the ksyms issues by reverting the commit which
        introduced the breakage"
      
      There was what I consider to be a better fix, but it's late in the rc
      game, so I'll take the revert.
      
      * 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm:
        Revert "arm: move exports to definitions"
      a56f3eb2
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · a0d60e62
      Linus Torvalds authored
      Pull networking fixes from David Miller:
      
       1) Fix leak in fsl/fman driver, from Dan Carpenter.
      
       2) Call flow dissector initcall earlier than any networking driver can
          register and start to use it, from Eric Dumazet.
      
       3) Some dup header fixes from Geliang Tang.
      
       4) TIPC link monitoring compat fix from Jon Paul Maloy.
      
       5) Link changes require EEE re-negotiation in bcm_sf2 driver, from
          Florian Fainelli.
      
       6) Fix bogus handle ID passed into tfilter_notify_chain(), from Roman
          Mashak.
      
       7) Fix dump size calculation in rtnl_calcit(), from Zhang Shengju.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (26 commits)
        tipc: resolve connection flow control compatibility problem
        mvpp2: use correct size for memset
        net/mlx5: drop duplicate header delay.h
        net: ieee802154: drop duplicate header delay.h
        ibmvnic: drop duplicate header seq_file.h
        fsl/fman: fix a leak in tgec_free()
        net: ethtool: don't require CAP_NET_ADMIN for ETHTOOL_GLINKSETTINGS
        tipc: improve sanity check for received domain records
        tipc: fix compatibility bug in link monitoring
        net: ethernet: mvneta: Remove IFF_UNICAST_FLT which is not implemented
        dwc_eth_qos: drop duplicate headers
        net sched filters: fix filter handle ID in tfilter_notify_chain()
        net: dsa: bcm_sf2: Ensure we re-negotiate EEE during after link change
        bnxt: do not busy-poll when link is down
        udplite: call proper backlog handlers
        ipv6: bump genid when the IFA_F_TENTATIVE flag is clear
        net/mlx4_en: Free netdev resources under state lock
        net: revert "net: l2tp: Treat NET_XMIT_CN as success in l2tp_eth_dev_xmit"
        rtnetlink: fix the wrong minimal dump size getting from rtnl_calcit()
        bnxt_en: Fix a VXLAN vs GENEVE issue
        ...
      a0d60e62