Skip to content
  1. Jan 24, 2018
    • Prashant Bhole's avatar
      bpf: test_maps: cleanup sockmaps when test ends · 78368781
      Prashant Bhole authored
      Bug: BPF programs and maps related to sockmaps test exist
      in memory even after test_maps ends.
      
      This patch fixes it as a short term workaround (sockmap
      kernel side needs real fixing) by empyting sockmaps when
      test ends.
      
      Fixes: 6f6d33f3
      
       ("bpf: selftests add sockmap tests")
      Signed-off-by: default avatarPrashant Bhole <bhole_prashant_q7@lab.ntt.co.jp>
      [ daniel: Note on workaround. ]
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      78368781
    • Alexei Starovoitov's avatar
      selftests/bpf: fix test_dev_cgroup · 8e687525
      Alexei Starovoitov authored
      The test incorrectly doing
      mkdir /mnt/cgroup-test-work-dirtest-bpf-based-device-cgroup
      instead of
      mkdir /mnt/cgroup-test-work-dir/test-bpf-based-device-cgroup
      
      somehow such mkdir succeeds and new directory appears:
      /mnt/cgroup-test-work-dir/cgroup-test-work-dirtest-bpf-based-device-cgroup
      
      Later cleanup via nftw("/mnt/cgroup-test-work-dir", ...);
      doesn't walk this directory.
      "rmdir /mnt/cgroup-test-work-dir" succeeds, but bpf program and
      dangling cgroup stays in memory.
      That's a separate issue on a cgroup side.
      For now fix the test.
      
      Fixes: 37f1ba09
      
       ("selftests/bpf: add a test for device cgroup controller")
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      8e687525
    • Alexei Starovoitov's avatar
      selftests/bpf: speedup test_maps · 1a97cf1f
      Alexei Starovoitov authored
      
      
      test_hashmap_walk takes very long time on debug kernel with kasan on.
      Reduce the number of iterations in this test without sacrificing
      test coverage.
      Also add printfs as progress indicator.
      
      Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      1a97cf1f
    • Yonghong Song's avatar
      tools/bpf: fix a test failure in selftests prog test_verifier · 35136920
      Yonghong Song authored
      Commit 111e6b45 ("selftests/bpf: make test_verifier run most programs")
      enables tools/testing/selftests/bpf/test_verifier unit cases to run
      via bpf_prog_test_run command. With the latest code base,
      test_verifier had one test case failure:
      
        ...
        #473/p check deducing bounds from const, 2 FAIL retval 1 != 0
        0: (b7) r0 = 1
        1: (75) if r0 s>= 0x1 goto pc+1
         R0=inv1 R1=ctx(id=0,off=0,imm=0) R10=fp0,call_-1
        2: (95) exit
      
        from 1 to 3: R0=inv1 R1=ctx(id=0,off=0,imm=0) R10=fp0,call_-1
        3: (d5) if r0 s<= 0x1 goto pc+1
         R0=inv1 R1=ctx(id=0,off=0,imm=0) R10=fp0,call_-1
        4: (95) exit
      
        from 3 to 5: R0=inv1 R1=ctx(id=0,off=0,imm=0) R10=fp0,call_-1
        5: (1f) r1 -= r0
        6: (95) exit
        processed 7 insns (limit 131072), stack depth 0
        ...
      
      The test case does not set return value in the test
      structure and hence the return value from the prog run
      is assumed to be 0. However, the actual return value is 1.
      As a result, the test failed. The fix is to correctly set
      the return value in the test structure.
      
      Fixes: 111e6b45
      
       ("selftests/bpf: make test_verifier run most programs")
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      35136920
    • Yonghong Song's avatar
      bpf: fix incorrect kmalloc usage in lpm_trie MAP_GET_NEXT_KEY rcu region · 2310035f
      Yonghong Song authored
      In commit b471f2f1 ("bpf: implement MAP_GET_NEXT_KEY command for LPM_TRIE map"),
      the implemented MAP_GET_NEXT_KEY callback function is guarded with rcu read lock.
      In the function body, "kmalloc(size, GFP_USER | __GFP_NOWARN)" is used which may
      sleep and violate rcu read lock region requirements. This patch fixed the issue
      by using GFP_ATOMIC instead to avoid blocking kmalloc. Tested with
      CONFIG_DEBUG_ATOMIC_SLEEP=y as suggested by Eric Dumazet.
      
      Fixes: b471f2f1
      
       ("bpf: implement MAP_GET_NEXT_KEY command for LPM_TRIE map")
      Signed-off-by: default avatarYonghong Song <yhs@fb.com>
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      2310035f
  2. Jan 23, 2018
  3. Jan 22, 2018
    • David S. Miller's avatar
      Merge branch 'mvpp2-Armada-7k-8k-PP2-ACPI-support' · d1b1110f
      David S. Miller authored
      
      
      Marcin Wojtas says:
      
      ====================
      Armada 7k/8k PP2 ACPI support
      
      I quickly resend the series, thanks to Antoine Tenart's remark,
      who spotted !CONFIG_ACPI compilation issue after introducing
      the new fwnode_irq_get() routine. Please see the details in the changelog
      below and the 3/7 commit log.
      
      mvpp2 driver can work with the ACPI representation, as exposed
      on a public branch:
      https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/commits/marvell-armada-wip
      It was compiled together with the most recent Tianocore EDK2 revision.
      Please refer to the firmware build instruction on MacchiatoBin board:
      http://wiki.macchiatobin.net/tiki-index.php?page=Build+from+source+-+UEFI+EDK+II
      
      ACPI representation of PP2 controllers (withouth PHY support) can
      be viewed in the github:
      * MacchiatoBin:
      https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/blob/71ae395da1661374b0f07d1602afb1eee56e9794/Platforms/Marvell/Armada/AcpiTables/Armada80x0McBin/Dsdt.asl#L201
      
      * Armada 7040 DB:
      https://github.com/MarvellEmbeddedProcessors/edk2-open-platform/blob/71ae395da1661374b0f07d1602afb1eee56e9794/Platforms/Marvell/Armada/AcpiTables/Armada70x0/Dsdt.asl#L131
      
      I will appreciate any comments or remarks.
      
      Best regards,
      Marcin
      
      Changelog:
      v3 -> v4:
      * 3/7
          - add new macro (ACPI_HANDLE_FWNODE) and fix
            compilation with !CONFIG_ACPI
          - extend commit log and mention usability of fwnode_irq_get
            for the child nodes as well
      
      v2 -> v3:
      * 1/7, 2/7
          - Add Rafael's Acked-by's
      * 3/7, 4/7
          - New patches
      * 6/7, 7/7
          - Update driver with new helper routines usage
          - Improve commit log.
      
      v1 -> v2:
      * Remove MDIO patches
      * Use PP2 ports only with link interrupts
      * Release second region resources in mvpp2 driver (code moved from
        mvmdio), as explained in details in 5/5 commit message.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d1b1110f
    • Marcin Wojtas's avatar
      net: mvpp2: enable ACPI support in the driver · a75edc7c
      Marcin Wojtas authored
      
      
      This patch introduces an alternative way of obtaining resources - via
      ACPI tables provided by firmware. Enabling coexistence with the DT
      support, in addition to the OF_*->device_*/fwnode_* API replacement,
      required following steps to be taken:
      
      * Add mvpp2_acpi_match table
      * Omit clock configuration and obtain tclk from the property - in ACPI
        world, the firmware is responsible for clock maintenance.
      * Disable comphy and syscon handling as they are not available for ACPI.
      * Modify way of obtaining interrupts - use newly introduced
        fwnode_irq_get() routine
      * Until proper MDIO bus and PHY handling with ACPI is established in the
        kernel, use only link interrupts feature in the driver. For the RGMII
        port it results in depending on GMAC settings done during firmware
        stage.
      * When booting with ACPI MVPP2_QDIST_MULTI_MODE is picked by
        default, as there is no need to keep any kind of the backward
        compatibility.
      
      Moreover, a memory region used by mvmdio driver is usually placed in
      the middle of the address space of the PP2 network controller.
      The MDIO base address is obtained without requesting memory region
      (by devm_ioremap() call) in mvmdio.c, later overlapping resources are
      requested by the network driver, which is responsible for avoiding
      a concurrent access.
      
      In case the MDIO memory region is declared in the ACPI, it can
      already appear as 'in-use' in the OS. Because it is overlapped by second
      region of the network controller, make sure it is released, before
      requesting it again. The care is taken by mvpp2 driver to avoid
      concurrent access to this memory region.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a75edc7c
    • Marcin Wojtas's avatar
      net: mvpp2: use device_*/fwnode_* APIs instead of of_* · 24812221
      Marcin Wojtas authored
      
      
      OF functions can be used only for the driver using DT.
      As a preparation for introducing ACPI support in mvpp2
      driver, use struct fwnode_handle in order to obtain
      properties from the hardware description.
      
      This patch replaces of_* function with device_*/fwnode_*
      where possible in the mvpp2.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      24812221
    • Marcin Wojtas's avatar
      net: mvpp2: simplify maintaining enabled ports' list · bf147153
      Marcin Wojtas authored
      
      
      'port_count' field of the mvpp2 structure holds an overall amount
      of available ports, based on DT nodes status. In order to be prepared
      to support other HW description, obtain the value by incrementing it
      upon each successful port initialization. This allowed for simplifying
      port indexing in the controller's private array, whose size is now not
      dynamically allocated, but fixed to MVPP2_MAX_PORTS.
      
      This patch simplifies creating and filling list of enabled ports and
      is a part of the preparation for adding ACPI support in the mvpp2 driver.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      bf147153
    • Marcin Wojtas's avatar
      device property: Allow iterating over available child fwnodes · 3395de96
      Marcin Wojtas authored
      
      
      Implement a new helper function fwnode_get_next_available_child_node(),
      which enables obtaining next enabled child fwnode, which
      works on a similar basis to OF's of_get_next_available_child().
      
      This commit also introduces a macro, thanks to which it is
      possible to iterate over the available fwnodes, using the
      new function described above.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3395de96
    • Marcin Wojtas's avatar
      device property: Introduce fwnode_irq_get() · 7c6c57f2
      Marcin Wojtas authored
      
      
      Until now there were two very similar functions allowing
      to get Linux IRQ number from ACPI handle (acpi_irq_get())
      and OF node (of_irq_get()). The first one appeared to be used
      only as a subroutine of platform_irq_get(), which (in the generic
      code) limited IRQ obtaining from _CRS method only to nodes
      associated to kernel's struct platform_device.
      
      This patch introduces a new helper routine - fwnode_irq_get(),
      which allows to get the IRQ number directly from the fwnode
      to be used as common for OF/ACPI worlds. It is usable not
      only for the parents fwnodes, but also for the child nodes
      comprising their own _CRS methods with interrupts description.
      
      In order to be able o satisfy compilation with !CONFIG_ACPI
      and also simplify the new code, introduce a helper macro
      (ACPI_HANDLE_FWNODE), with which it is possible to reach
      an ACPI handle directly from its fwnode.
      
      Signed-off-by: default avatarMarcin Wojtas <mw@semihalf.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7c6c57f2