1. 07 10月, 2020 10 次提交
  2. 06 10月, 2020 2 次提交
    • A
      bpf, doc: Update Andrii's email in MAINTAINERS · dca4121c
      Andrii Nakryiko 提交于
      Update Andrii Nakryiko's reviewer email to kernel.org account. This optimizes
      email logistics on my side and makes it less likely for me to miss important
      patches.
      Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20201005223648.2437130-1-andrii@kernel.org
      dca4121c
    • S
      bpf: Use raw_spin_trylock() for pcpu_freelist_push/pop in NMI · 39d8f0d1
      Song Liu 提交于
      Recent improvements in LOCKDEP highlighted a potential A-A deadlock with
      pcpu_freelist in NMI:
      
      ./tools/testing/selftests/bpf/test_progs -t stacktrace_build_id_nmi
      
      [   18.984807] ================================
      [   18.984807] WARNING: inconsistent lock state
      [   18.984808] 5.9.0-rc6-01771-g1466de1330e1 #2967 Not tainted
      [   18.984809] --------------------------------
      [   18.984809] inconsistent {INITIAL USE} -> {IN-NMI} usage.
      [   18.984810] test_progs/1990 [HC2[2]:SC0[0]:HE0:SE1] takes:
      [   18.984810] ffffe8ffffc219c0 (&head->lock){....}-{2:2}, at: __pcpu_freelist_pop+0xe3/0x180
      [   18.984813] {INITIAL USE} state was registered at:
      [   18.984814]   lock_acquire+0x175/0x7c0
      [   18.984814]   _raw_spin_lock+0x2c/0x40
      [   18.984815]   __pcpu_freelist_pop+0xe3/0x180
      [   18.984815]   pcpu_freelist_pop+0x31/0x40
      [   18.984816]   htab_map_alloc+0xbbf/0xf40
      [   18.984816]   __do_sys_bpf+0x5aa/0x3ed0
      [   18.984817]   do_syscall_64+0x2d/0x40
      [   18.984818]   entry_SYSCALL_64_after_hwframe+0x44/0xa9
      [   18.984818] irq event stamp: 12
      [...]
      [   18.984822] other info that might help us debug this:
      [   18.984823]  Possible unsafe locking scenario:
      [   18.984823]
      [   18.984824]        CPU0
      [   18.984824]        ----
      [   18.984824]   lock(&head->lock);
      [   18.984826]   <Interrupt>
      [   18.984826]     lock(&head->lock);
      [   18.984827]
      [   18.984828]  *** DEADLOCK ***
      [   18.984828]
      [   18.984829] 2 locks held by test_progs/1990:
      [...]
      [   18.984838]  <NMI>
      [   18.984838]  dump_stack+0x9a/0xd0
      [   18.984839]  lock_acquire+0x5c9/0x7c0
      [   18.984839]  ? lock_release+0x6f0/0x6f0
      [   18.984840]  ? __pcpu_freelist_pop+0xe3/0x180
      [   18.984840]  _raw_spin_lock+0x2c/0x40
      [   18.984841]  ? __pcpu_freelist_pop+0xe3/0x180
      [   18.984841]  __pcpu_freelist_pop+0xe3/0x180
      [   18.984842]  pcpu_freelist_pop+0x17/0x40
      [   18.984842]  ? lock_release+0x6f0/0x6f0
      [   18.984843]  __bpf_get_stackid+0x534/0xaf0
      [   18.984843]  bpf_prog_1fd9e30e1438d3c5_oncpu+0x73/0x350
      [   18.984844]  bpf_overflow_handler+0x12f/0x3f0
      
      This is because pcpu_freelist_head.lock is accessed in both NMI and
      non-NMI context. Fix this issue by using raw_spin_trylock() in NMI.
      
      Since NMI interrupts non-NMI context, when NMI context tries to lock the
      raw_spinlock, non-NMI context of the same CPU may already have locked a
      lock and is blocked from unlocking the lock. For a system with N CPUs,
      there could be N NMIs at the same time, and they may block N non-NMI
      raw_spinlocks. This is tricky for pcpu_freelist_push(), where unlike
      _pop(), failing _push() means leaking memory. This issue is more likely to
      trigger in non-SMP system.
      
      Fix this issue with an extra list, pcpu_freelist.extralist. The extralist
      is primarily used to take _push() when raw_spin_trylock() failed on all
      the per CPU lists. It should be empty most of the time. The following
      table summarizes the behavior of pcpu_freelist in NMI and non-NMI:
      
      non-NMI pop(): 	use _lock(); check per CPU lists first;
                      if all per CPU lists are empty, check extralist;
                      if extralist is empty, return NULL.
      
      non-NMI push(): use _lock(); only push to per CPU lists.
      
      NMI pop():    use _trylock(); check per CPU lists first;
                    if all per CPU lists are locked or empty, check extralist;
                    if extralist is locked or empty, return NULL.
      
      NMI push():   use _trylock(); check per CPU lists first;
                    if all per CPU lists are locked; try push to extralist;
                    if extralist is also locked, keep trying on per CPU lists.
      Reported-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NSong Liu <songliubraving@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/bpf/20201005165838.3735218-1-songliubraving@fb.com
      39d8f0d1
  3. 05 10月, 2020 2 次提交
  4. 03 10月, 2020 14 次提交
  5. 02 10月, 2020 12 次提交
    • S
      selftests/bpf: Properly initialize linfo in sockmap_basic · 48ca6243
      Stanislav Fomichev 提交于
      When using -Werror=missing-braces, compiler complains about missing braces.
      Let's use use ={} initialization which should do the job:
      
      tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: In function 'test_sockmap_iter':
      tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:181:8: error: missing braces around initializer [-Werror=missing-braces]
        union bpf_iter_link_info linfo = {0};
              ^
      tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:181:8: error: (near initialization for 'linfo.map') [-Werror=missing-braces]
      tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: At top level:
      Signed-off-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Link: https://lore.kernel.org/bpf/20201002000451.1794044-1-sdf@google.com
      48ca6243
    • S
      selftests/bpf: Initialize duration in xdp_noinline.c · cffcdbff
      Stanislav Fomichev 提交于
      Fixes clang error:
      tools/testing/selftests/bpf/prog_tests/xdp_noinline.c:35:6: error: variable 'duration' is uninitialized when used here [-Werror,-Wuninitialized]
              if (CHECK(!skel, "skel_open_and_load", "failed\n"))
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Signed-off-by: NStanislav Fomichev <sdf@google.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NMartin KaFai Lau <kafai@fb.com>
      Link: https://lore.kernel.org/bpf/20201001225440.1373233-1-sdf@google.com
      cffcdbff
    • A
      lib8390: Use netif_msg_init to initialize msg_enable bits · 360f8987
      Armin Wolf 提交于
      Use netif_msg_init() to process param settings
      and use only the proper initialized value of
      ei_local->msg_level for later processing;
      Signed-off-by: NArmin Wolf <W_Armin@gmx.de>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      360f8987
    • W
      net: phy: realtek: Modify 2.5G PHY name to RTL8226 · 7a333af6
      Willy Liu 提交于
      Realtek single-chip Ethernet PHY solutions can be separated as below:
      10M/100Mbps: RTL8201X
      1Gbps: RTL8211X
      2.5Gbps: RTL8226/RTL8221X
      RTL8226 is the first version for realtek that compatible 2.5Gbps single PHY.
      Since RTL8226 is single port only, realtek changes its name to RTL8221B from
      the second version.
      PHY ID for RTL8226 is 0x001cc800 and RTL8226B/RTL8221B is 0x001cc840.
      
      RTL8125 is not a single PHY solution, it integrates PHY/MAC/PCIE bus
      controller and embedded memory.
      Signed-off-by: NWilly Liu <willy.liu@realtek.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7a333af6
    • J
      caif_virtio: Remove redundant initialization of variable err · f1638a4c
      Jing Xiangfeng 提交于
      After commit a8c7687b ("caif_virtio: Check that vringh_config is not
      null"), the variable err is being initialized with '-EINVAL' that is
      meaningless. So remove it.
      Signed-off-by: NJing Xiangfeng <jingxiangfeng@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f1638a4c
    • Y
      net-sysfs: Fix inconsistent of format with argument type in net-sysfs.c · 000fe268
      Ye Bin 提交于
      Fix follow warnings:
      [net/core/net-sysfs.c:1161]: (warning) %u in format string (no. 1)
      	requires 'unsigned int' but the argument type is 'int'.
      [net/core/net-sysfs.c:1162]: (warning) %u in format string (no. 1)
      	requires 'unsigned int' but the argument type is 'int'.
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NYe Bin <yebin10@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      000fe268
    • Y
      pktgen: Fix inconsistent of format with argument type in pktgen.c · 32be425b
      Ye Bin 提交于
      Fix follow warnings:
      [net/core/pktgen.c:925]: (warning) %u in format string (no. 1)
      	requires 'unsigned int' but the argument type is 'signed int'.
      [net/core/pktgen.c:942]: (warning) %u in format string (no. 1)
      	requires 'unsigned int' but the argument type is 'signed int'.
      [net/core/pktgen.c:962]: (warning) %u in format string (no. 1)
      	requires 'unsigned int' but the argument type is 'signed int'.
      [net/core/pktgen.c:984]: (warning) %u in format string (no. 1)
      	requires 'unsigned int' but the argument type is 'signed int'.
      [net/core/pktgen.c:1149]: (warning) %d in format string (no. 1)
      	requires 'int' but the argument type is 'unsigned int'.
      Reported-by: NHulk Robot <hulkci@huawei.com>
      Signed-off-by: NYe Bin <yebin10@huawei.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      32be425b
    • X
      drivers/net/wan/hdlc_fr: Correctly handle special skb->protocol values · 8306266c
      Xie He 提交于
      The fr_hard_header function is used to prepend the header to skbs before
      transmission. It is used in 3 situations:
      1) When a control packet is generated internally in this driver;
      2) When a user sends an skb on an Ethernet-emulating PVC device;
      3) When a user sends an skb on a normal PVC device.
      
      These 3 situations need to be handled differently by fr_hard_header.
      Different headers should be prepended to the skb in different situations.
      
      Currently fr_hard_header distinguishes these 3 situations using
      skb->protocol. For situation 1 and 2, a special skb->protocol value
      will be assigned before calling fr_hard_header, so that it can recognize
      these 2 situations. All skb->protocol values other than these special ones
      are treated by fr_hard_header as situation 3.
      
      However, it is possible that in situation 3, the user sends an skb with
      one of the special skb->protocol values. In this case, fr_hard_header
      would incorrectly treat it as situation 1 or 2.
      
      This patch tries to solve this issue by using skb->dev instead of
      skb->protocol to distinguish between these 3 situations. For situation
      1, skb->dev would be NULL; for situation 2, skb->dev->type would be
      ARPHRD_ETHER; and for situation 3, skb->dev->type would be ARPHRD_DLCI.
      
      This way fr_hard_header would be able to distinguish these 3 situations
      correctly regardless what skb->protocol value the user tries to use in
      situation 3.
      
      Cc: Krzysztof Halasa <khc@pm.waw.pl>
      Signed-off-by: NXie He <xie.he.0141@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8306266c
    • D
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next · 23a1f682
      David S. Miller 提交于
      Daniel Borkmann says:
      
      ====================
      pull-request: bpf-next 2020-10-01
      
      The following pull-request contains BPF updates for your *net-next* tree.
      
      We've added 90 non-merge commits during the last 8 day(s) which contain
      a total of 103 files changed, 7662 insertions(+), 1894 deletions(-).
      
      Note that once bpf(/net) tree gets merged into net-next, there will be a small
      merge conflict in tools/lib/bpf/btf.c between commit 12450081 ("libbpf: Fix
      native endian assumption when parsing BTF") from the bpf tree and the commit
      3289959b ("libbpf: Support BTF loading and raw data output in both endianness")
      from the bpf-next tree. Correct resolution would be to stick with bpf-next, it
      should look like:
      
        [...]
              /* check BTF magic */
              if (fread(&magic, 1, sizeof(magic), f) < sizeof(magic)) {
                      err = -EIO;
                      goto err_out;
              }
              if (magic != BTF_MAGIC && magic != bswap_16(BTF_MAGIC)) {
                      /* definitely not a raw BTF */
                      err = -EPROTO;
                      goto err_out;
              }
      
              /* get file size */
        [...]
      
      The main changes are:
      
      1) Add bpf_snprintf_btf() and bpf_seq_printf_btf() helpers to support displaying
         BTF-based kernel data structures out of BPF programs, from Alan Maguire.
      
      2) Speed up RCU tasks trace grace periods by a factor of 50 & fix a few race
         conditions exposed by it. It was discussed to take these via BPF and
         networking tree to get better testing exposure, from Paul E. McKenney.
      
      3) Support multi-attach for freplace programs, needed for incremental attachment
         of multiple XDP progs using libxdp dispatcher model, from Toke Høiland-Jørgensen.
      
      4) libbpf support for appending new BTF types at the end of BTF object, allowing
         intrusive changes of prog's BTF (useful for future linking), from Andrii Nakryiko.
      
      5) Several BPF helper improvements e.g. avoid atomic op in cookie generator and add
         a redirect helper into neighboring subsys, from Daniel Borkmann.
      
      6) Allow map updates on sockmaps from bpf_iter context in order to migrate sockmaps
         from one to another, from Lorenz Bauer.
      
      7) Fix 32 bit to 64 bit assignment from latest alu32 bounds tracking which caused
         a verifier issue due to type downgrade to scalar, from John Fastabend.
      
      8) Follow-up on tail-call support in BPF subprogs which optimizes x64 JIT prologue
         and epilogue sections, from Maciej Fijalkowski.
      
      9) Add an option to perf RB map to improve sharing of event entries by avoiding remove-
         on-close behavior. Also, add BPF_PROG_TEST_RUN for raw_tracepoint, from Song Liu.
      
      10) Fix a crash in AF_XDP's socket_release when memory allocation for UMEMs fails,
          from Magnus Karlsson.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      23a1f682
    • D
      Merge branch 'net-ravb-Add-support-for-explicit-internal-clock-delay-c · 7c89d9d9
      David S. Miller 提交于
      onfiguration'
      
      Geert Uytterhoeven says:
      
      ====================
      net/ravb: Add support for explicit internal clock delay configuration
      
      Some Renesas EtherAVB variants support internal clock delay
      configuration, which can add larger delays than the delays that are
      typically supported by the PHY (using an "rgmii-*id" PHY mode, and/or
      "[rt]xc-skew-ps" properties).
      
      Historically, the EtherAVB driver configured these delays based on the
      "rgmii-*id" PHY mode.  This caused issues with PHY drivers that
      implement PHY internal delays properly[1].  Hence a backwards-compatible
      workaround was added by masking the PHY mode[2].
      
      This patch series implements the next step of the plan outlined in [3],
      and adds proper support for explicit configuration of the MAC internal
      clock delays using new "[rt]x-internal-delay-ps" properties.  If none of
      these properties is present, the driver falls back to the old handling.
      
      This can be considered the MAC counterpart of commit 9150069b
      ("dt-bindings: net: Add tx and rx internal delays"), which applies to
      the PHY.  Note that unlike commit 92252eec ("net: phy: Add a
      helper to return the index for of the internal delay"), no helpers are
      provided to parse the DT properties, as so far there is a single user
      only, which supports only zero or a single fixed value.  Of course such
      helpers can be added later, when the need arises, or when deemed useful
      otherwise.
      
      This series consists of 3 parts:
        1. DT binding updates documenting the new properties, for both the
           generic ethernet-controller and the EtherAVB-specific bindings,
        2. Conversion to json-schema of the Renesas EtherAVB DT bindings.
           Technically, the conversion is independent of all of the above.
           I included it in this series, as it shows how all sanity checks on
           "[rt]x-internal-delay-ps" values are implemented as DT binding
           checks,
        3. EtherAVB driver update implementing support for the new properties.
      
      Given Rob has provided his acks for the DT binding updates, all of this
      can be merged through net-next.
      
      Changes compared to v3[4]:
        - Add Reviewed-by,
        - Drop the DT updates, as they will be merged through renesas-devel and
          arm-soc, and have a hard dependency on this series.
      
      Changes compared to v2[5]:
        - Update recently added board DTS files,
        - Add Reviewed-by.
      
      Changes compared to v1[6]:
        - Added "[PATCH 1/7] dt-bindings: net: ethernet-controller: Add
          internal delay properties",
        - Replace "renesas,[rt]xc-delay-ps" by "[rt]x-internal-delay-ps",
        - Incorporated EtherAVB DT binding conversion to json-schema,
        - Add Reviewed-by.
      
      Impacted, tested:
        - Salvator-X(S) with R-Car H3 ES1.0 and ES2.0, M3-W, and M3-N.
      
      Not impacted, tested:
        - Ebisu with R-Car E3.
      
      Impacted, not tested:
        - Salvator-X(S) with other SoC variants,
        - ULCB with R-Car H3/M3-W/M3-N variants,
        - V3MSK and Eagle with R-Car V3M,
        - Draak with R-Car V3H,
        - HiHope RZ/G2[MN] with RZ/G2M or RZ/G2N,
        - Beacon EmbeddedWorks RZ/G2M Development Kit.
      
      To ease testing, I have pushed this series and the DT updates to the
      topic/ravb-internal-clock-delays-v4 branch of my renesas-drivers
      repository at
      git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers.git.
      
      Thanks for applying!
      
      References:
        [1] Commit bcf3440c ("net: phy: micrel: add phy-mode support
            for the KSZ9031 PHY")
        [2] Commit 9b23203c ("ravb: Mask PHY mode to avoid inserting
            delays twice").
            https://lore.kernel.org/r/20200529122540.31368-1-geert+renesas@glider.be/
        [3] https://lore.kernel.org/r/CAMuHMdU+MR-2tr3-pH55G0GqPG9HwH3XUd=8HZxprFDMGQeWUw@mail.gmail.com/
        [4] https://lore.kernel.org/linux-devicetree/20200819134344.27813-1-geert+renesas@glider.be/
        [5] https://lore.kernel.org/linux-devicetree/20200706143529.18306-1-geert+renesas@glider.be/
        [6] https://lore.kernel.org/linux-devicetree/20200619191554.24942-1-geert+renesas@glider.be/
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7c89d9d9
    • G
      ravb: Add support for explicit internal clock delay configuration · a6f51f2e
      Geert Uytterhoeven 提交于
      Some EtherAVB variants support internal clock delay configuration, which
      can add larger delays than the delays that are typically supported by
      the PHY (using an "rgmii-*id" PHY mode, and/or "[rt]xc-skew-ps"
      properties).
      
      Historically, the EtherAVB driver configured these delays based on the
      "rgmii-*id" PHY mode.  This caused issues with PHY drivers that
      implement PHY internal delays properly[1].  Hence a backwards-compatible
      workaround was added by masking the PHY mode[2].
      
      Add proper support for explicit configuration of the MAC internal clock
      delays using the new "[rt]x-internal-delay-ps" properties.
      Fall back to the old handling if none of these properties is present.
      
      [1] Commit bcf3440c ("net: phy: micrel: add phy-mode support for
          the KSZ9031 PHY")
      [2] Commit 9b23203c ("ravb: Mask PHY mode to avoid inserting
          delays twice").
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a6f51f2e
    • G
      ravb: Split delay handling in parsing and applying · ce19a9eb
      Geert Uytterhoeven 提交于
      Currently, full delay handling is done in both the probe and resume
      paths.  Split it in two parts, so the resume path doesn't have to redo
      the parsing part over and over again.
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
      Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ce19a9eb