1. 17 Jan, 2019 4 commits
    • Stanislav Fomichev's avatar
      bpftool: add peek command · 66cf6e0b
      Stanislav Fomichev authored
      This is intended to be used with queues and stacks and be more
      user-friendly than 'lookup' without key/value.
      
      Example:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map peek pinned /sys/fs/bpf/q
      value: 00 01 02 03
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      66cf6e0b
    • Stanislav Fomichev's avatar
      bpftool: don't print empty key/value for maps · 04a5d323
      Stanislav Fomichev authored
      When doing dump or lookup, don't print key if key_size == 0 or value if
      value_size == 0. The initial usecase is queue and stack, where we have
      only values.
      
      This is for regular output only, json still has all the fields.
      
      Before:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map lookup pinned /sys/fs/bpf/q
      key:   value: 00 01 02 03
      
      After:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map lookup pinned /sys/fs/bpf/q
      value: 00 01 02 03
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      04a5d323
    • Stanislav Fomichev's avatar
      bpftool: make key optional in lookup command · 8a89fff6
      Stanislav Fomichev authored
      Bpftool expects key for 'lookup' operations. For some map types, key should
      not be specified. Support looking up those map types.
      
      Before:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map lookup pinned /sys/fs/bpf/q
      Error: did not find key
      
      After:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      bpftool map lookup pinned /sys/fs/bpf/q
      key:   value: 00 01 02 03
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      8a89fff6
    • Stanislav Fomichev's avatar
      bpftool: make key and value optional in update command · 7d7209cb
      Stanislav Fomichev authored
      Bpftool expects both key and value for 'update' operations. For some
      map types, key should not be specified. Support updating those map types.
      
      Before:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      Error: did not find key
      
      After:
      bpftool map create /sys/fs/bpf/q type queue value 4 entries 10 name q
      bpftool map update pinned /sys/fs/bpf/q value 0 1 2 3
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      7d7209cb
  2. 16 Jan, 2019 13 commits
    • Daniel Borkmann's avatar
      Merge branch 'bpf-int128-btf' · e13279e2
      Daniel Borkmann authored
      Yonghong Song says:
      
      ====================
      Previous maximum supported integer bit width is 64. But
      the __int128 type has been supported by most (if not all)
      64bit architectures including bpf for both gcc and clang.
      
      The kernel itself uses __int128 for x64 and arm64. Some bcc
      tools are using __int128 in bpf programs to describe ipv6
      addresses. Without 128bit int support, the vmlinux BTF won't
      work and those bpf programs using __int128 cannot utilize BTF.
      
      This patch set therefore implements BTF __int128 support.
      ====================
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      e13279e2
    • Yonghong Song's avatar
      tools/bpf: support __int128 in bpftool map pretty dumper · e86e5138
      Yonghong Song authored
      For formatted output, currently when json is enabled, the decimal
      number is required. Similar to kernel bpffs printout,
      for int128 numbers, only hex numbers are dumped, which are
      quoted as strings.
      
      The below is an example to show plain and json pretty print
      based on the map in test_btf pretty print test.
      
        $ bpftool m s
        75: hash  name pprint_test_has  flags 0x0
              key 4B  value 112B  max_entries 4  memlock 4096B
        $ bpftool m d id 75
        ......
          {
              "key": 3,
              "value": {
                  "ui32": 3,
                  "ui16": 0,
                  "si32": -3,
                  "unused_bits2a": 0x3,
                  "bits28": 0x3,
                  "unused_bits2b": 0x3,
                  "": {
                      "ui64": 3,
                      "ui8a": [3,0,0,0,0,0,0,0
                      ]
                  },
                  "aenum": 3,
                  "ui32b": 4,
                  "bits2c": 0x1,
                  "si128a": 0x3,
                  "si128b": 0xfffffffd,
                  "bits3": 0x3,
                  "bits80": 0x10000000000000003,
                  "ui128": 0x20000000000000003
              }
          },
        ......
      
        $ bptfool -p -j m d id 75
        ......
        {
              "key": ["0x03","0x00","0x00","0x00"
              ],
              "value": ["0x03","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0xfd","0xff","0xff","0xff","0x0f","0x00","0x00","0xc0",
                        "0x03","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0x03","0x00","0x00","0x00","0x04","0x00","0x00","0x00",
                        "0x01","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0x03","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0xfd","0xff","0xff","0xff","0x00","0x00","0x00","0x00",
                        "0x00","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0x1b","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0x08","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0x03","0x00","0x00","0x00","0x00","0x00","0x00","0x00",
                        "0x02","0x00","0x00","0x00","0x00","0x00","0x00","0x00"
              ],
              "formatted": {
                  "key": 3,
                  "value": {
                      "ui32": 3,
                      "ui16": 0,
                      "si32": -3,
                      "unused_bits2a": "0x3",
                      "bits28": "0x3",
                      "unused_bits2b": "0x3",
                      "": {
                          "ui64": 3,
                          "ui8a": [3,0,0,0,0,0,0,0
                          ]
                      },
                      "aenum": 3,
                      "ui32b": 4,
                      "bits2c": "0x1",
                      "si128a": "0x3",
                      "si128b": "0xfffffffd",
                      "bits3": "0x3",
                      "bits80": "0x10000000000000003",
                      "ui128": "0x20000000000000003"
                  }
              }
          }
        ......
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      e86e5138
    • Yonghong Song's avatar
      tools/bpf: add bpffs pretty print test for int128 · 4df3a1d0
      Yonghong Song authored
      The bpffs pretty print test is extended to cover int128 types.
      Tested on an x64 machine.
        $ test_btf -p
        ......
        BTF pretty print array(#3)......OK
        PASS:9 SKIP:0 FAIL:0
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      4df3a1d0
    • Yonghong Song's avatar
      tools/bpf: refactor test_btf pretty printing for multiple map value formats · ce6ec47a
      Yonghong Song authored
      The test_btf pretty print is refactored in order to easily
      support multiple map value formats. The next patch will
      add __int128 type tests which needs macro guard __SIZEOF_INT128__.
      There is no functionality change with this patch.
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      ce6ec47a
    • Yonghong Song's avatar
      tools/bpf: add int128 raw test in test_btf · a80eba20
      Yonghong Song authored
      Several int128 raw type tests are added to test_btf.
      Currently these tests are enabled only for x64 and arm64
      for which kernel has CONFIG_ARCH_SUPPORTS_INT128 set.
      
        $ test_btf
        ......
        BTF raw test[106] (128-bit int): OK
        BTF raw test[107] (struct, 128-bit int member): OK
        BTF raw test[108] (struct, 120-bit int member bitfield): OK
        BTF raw test[109] (struct, kind_flag, 128-bit int member): OK
        BTF raw test[110] (struct, kind_flag, 120-bit int member bitfield): OK
        ......
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      a80eba20
    • Yonghong Song's avatar
      bpf: btf: support 128 bit integer type · b1e8818c
      Yonghong Song authored
      Currently, btf only supports up to 64-bit integer.
      On the other hand, 128bit support for gcc and clang
      has existed for a long time. For example, both gcc 4.8
      and llvm 3.7 supports types "__int128" and
      "unsigned __int128" for virtually all 64bit architectures
      including bpf.
      
      The requirement for __int128 support comes from two areas:
        . bpf program may use __int128. For example, some bcc tools
          (https://github.com/iovisor/bcc/tree/master/tools),
          mostly tcp v6 related, tcpstates.py, tcpaccept.py, etc.,
          are using __int128 to represent the ipv6 addresses.
        . linux itself is using __int128 types. Hence supporting
          __int128 type in BTF is required for vmlinux BTF,
          which will be used by "compile once and run everywhere"
          and other projects.
      
      For 128bit integer, instead of base-10, hex numbers are pretty
      printed out as large decimal number is hard to decipher, e.g.,
      for ipv6 addresses.
      Acked-by: default avatarMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      b1e8818c
    • Stanislav Fomichev's avatar
      libbpf: don't define CC and AR · eeedd352
      Stanislav Fomichev authored
      We are already including tools/scripts/Makefile.include which correctly
      handles CROSS_COMPILE, no need to define our own vars.
      
      See related commit 7ed1c190 ("tools: fix cross-compile var clobbering")
      for more details.
      Signed-off-by: default avatarStanislav Fomichev <sdf@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      eeedd352
    • Randy Dunlap's avatar
      networking: Documentation: fix snmp_counters.rst Sphinx warnings · ae5220c6
      Randy Dunlap authored
      Fix over 100 documentation warnings in snmp_counter.rst by
      extending the underline string lengths and inserting a blank line
      after bullet items.
      
      Examples:
      
      Documentation/networking/snmp_counter.rst:1: WARNING: Title overline too short.
      Documentation/networking/snmp_counter.rst:14: WARNING: Bullet list ends without a blank line; unexpected unindent.
      
      Fixes: 2b965472 ("add document for TCP OFO, PAWS and skip ACK counters")
      Fixes: 8e2ea53a ("add snmp counters document")
      Fixes: 712ee16c ("add documents for snmp counters")
      Fixes: 80cc4950 ("net: Add part of TCP counts explanations in snmp_counters.rst")
      Fixes: b08794a9 ("documentation of some IP/ICMP snmp counters")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: yupeng <yupeng0921@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ae5220c6
    • Gustavo A. R. Silva's avatar
      net, decnet: use struct_size() in kzalloc() · bb3e16ad
      Gustavo A. R. Silva authored
      One of the more common cases of allocation size calculations is finding the
      size of a structure that has a zero-sized array at the end, along with memory
      for some number of elements for that array. For example:
      
      struct foo {
          int stuff;
          struct boo entry[];
      };
      
      instance = kzalloc(sizeof(struct foo) + count * sizeof(struct boo), GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can now
      use the new struct_size() helper:
      
      instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This code was detected with the help of Coccinelle.
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bb3e16ad
    • Gustavo A. R. Silva's avatar
      mlxsw: spectrum_nve: Use struct_size() in kzalloc() · faa311e9
      Gustavo A. R. Silva authored
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct foo {
          int stuff;
          struct boo entry[];
      };
      
      instance = kzalloc(sizeof(struct foo) + count * sizeof(struct boo), GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This issue was detected with the help of Coccinelle.
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      faa311e9
    • Gustavo A. R. Silva's avatar
      mlxsw: spectrum_acl_bloom_filter: use struct_size() in kzalloc() · 2285ec87
      Gustavo A. R. Silva authored
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct foo {
          int stuff;
          void *entry[];
      };
      
      instance = kzalloc(sizeof(struct foo) + sizeof(void *) * count, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kzalloc(struct_size(instance, entry, count), GFP_KERNEL);
      
      This issue was detected with the help of Coccinelle.
      Reviewed-by: default avatarIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2285ec87
    • Sergio Paracuellos's avatar
      dt-bindings: net: dsa: ksz9477: fix indentation for switch spi bindings · 590ce401
      Sergio Paracuellos authored
      Switch bindings for spi managed mode are using spaces instead of tabs.
      Fix them to get a file with a proper kernel indentation style.
      Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: default avatarSergio Paracuellos <sergio.paracuellos@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      590ce401
    • Lepton Wu's avatar
      Fix ERROR:do not initialise statics to 0 in af_vsock.c · a22d3251
      Lepton Wu authored
      Found by scripts/checkpatch.pl
      Reviewed-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a22d3251
  3. 15 Jan, 2019 20 commits
  4. 14 Jan, 2019 3 commits
    • Steven Rostedt (VMware)'s avatar
      sbitmap: Protect swap_lock from softirqs · 37198768
      Steven Rostedt (VMware) authored
      The swap_lock used by sbitmap has a chain with locks taken from softirq,
      but the swap_lock is not protected from being preempted by softirqs.
      
      A chain exists of:
      
       sbq->ws[i].wait -> dispatch_wait_lock -> swap_lock
      
      Where the sbq->ws[i].wait lock can be taken from softirq context, which
      means all locks below it in the chain must also be protected from
      softirqs.
      Reported-by: default avatarClark Williams <williams@redhat.com>
      Fixes: 58ab5e32 ("sbitmap: silence bogus lockdep IRQ warning")
      Fixes: ea86ea2c ("sbitmap: amortize cost of clearing bits")
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Ming Lei <ming.lei@redhat.com>
      Cc: Guenter Roeck <linux@roeck-us.net>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      37198768
    • Linus Torvalds's avatar
      Merge tag 'gpio-v5.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio · c962cb32
      Linus Torvalds authored
      Pull GPIO fixes from Linus Walleij:
       "The patch hitting the MMC/SD subsystem is fixing up my own mess when
        moving semantics from MMC/SD over to gpiolib. Ulf is on vacation but I
        managed to reach him on chat and obtain his ACK.
      
        The other two are early-rc fixes that are not super serious but pretty
        annoying so I'd like to get rid of them.
      
        Summary:
      
         - Get rid of some WARN_ON() from the ACPI code
      
         - Staticize a symbol
      
         - Fix MMC polarity detection"
      
      * tag 'gpio-v5.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
        mmc: core: don't override the CD GPIO level when "cd-inverted" is set
        gpio: pca953x: Make symbol 'pca953x_i2c_regmap' static
        gpiolib-acpi: Remove unnecessary WARN_ON from acpi_gpiochip_free_interrupts
      c962cb32
    • Linus Torvalds's avatar
      Merge tag 'mfd-next-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd · 9deb9e16
      Linus Torvalds authored
      Pull MFD updates from Lee Jones:
       "New Device Support
         - Add support for Power Supply to AXP813
         - Add support for GPIO, ADC, AC and Battery Power Supply to AXP803
         - Add support for UART to Exynos LPASS
      
        Fix-ups:
         - Use supplied MACROS; ti_am335x_tscadc
         - Trivial spelling/whitespace/alignment; tmio, axp20x, rave-sp
         - Regmap changes; bd9571mwv, wm5110-tables
         - Kconfig dependencies; MFD_AT91_USART
         - Supply shared data for child-devices; madera-core
         - Use new of_node_name_eq() API call; max77620, stmpe
         - Use managed resources (devm_*); tps65218
         - Comment descriptions; ingenic-tcu
         - Coding style; madera-core
      
        Bug Fixes:
         - Fix section mismatches; twl-core, db8500-prcmu
         - Correct error path related issues; mt6397-core, ab8500-core, mc13xxx-core
         - IRQ related fixes; tps6586x
         - Ensure proper initialisation sequence; qcom_rpm
         - Repair potential memory leak; cros_ec_dev"
      
      * tag 'mfd-next-4.21' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (25 commits)
        mfd: exynos-lpass: Enable UART module support
        mfd: mc13xxx: Fix a missing check of a register-read failure
        mfd: cros_ec: Add commands to control codec
        mfd: madera: Remove spurious semicolon in while loop
        mfd: rave-sp: Fix typo in rave_sp_checksum comment
        mfd: ingenic-tcu: Fix bit field description in header
        mfd: tps65218: Use devm_regmap_add_irq_chip and clean up error path in probe()
        mfd: Use of_node_name_eq() for node name comparisons
        mfd: cros_ec_dev: Add missing mfd_remove_devices() call in remove
        mfd: axp20x: Add supported cells for AXP803
        mfd: axp20x: Re-align MFD cell entries
        mfd: axp20x: Add AC power supply cell for AXP813
        mfd: wm5110: Add missing ASRC rate register
        mfd: qcom_rpm: write fw_version to CTRL_REG
        mfd: tps6586x: Handle interrupts on suspend
        mfd: madera: Add shared data for accessory detection
        mfd: at91-usart: Add platform dependency
        mfd: bd9571mwv: Add volatile register to make DVFS work
        mfd: ab8500-core: Return zero in get_register_interruptible()
        mfd: tmio: Typo s/use use/use/
        ...
      9deb9e16