1. 09 7月, 2021 1 次提交
    • J
      drm/i915: Drop I915_CONTEXT_PARAM_RINGSIZE · fe4751c3
      Jason Ekstrand 提交于
      This reverts commit 88be76cd ("drm/i915: Allow userspace to specify
      ringsize on construction").  This API was originally added for OpenCL
      but the compute-runtime PR has sat open for a year without action so we
      can still pull it out if we want.  I argue we should drop it for three
      reasons:
      
       1. If the compute-runtime PR has sat open for a year, this clearly
          isn't that important.
      
       2. It's a very leaky API.  Ring size is an implementation detail of the
          current execlist scheduler and really only makes sense there.  It
          can't apply to the older ring-buffer scheduler on pre-execlist
          hardware because that's shared across all contexts and it won't
          apply to the GuC scheduler that's in the pipeline.
      
       3. Having userspace set a ring size in bytes is a bad solution to the
          problem of having too small a ring.  There is no way that userspace
          has the information to know how to properly set the ring size so
          it's just going to detect the feature and always set it to the
          maximum of 512K.  This is what the compute-runtime PR does.  The
          scheduler in i915, on the other hand, does have the information to
          make an informed choice.  It could detect if the ring size is a
          problem and grow it itself.  Or, if that's too hard, we could just
          increase the default size from 16K to 32K or even 64K instead of
          relying on userspace to do it.
      
      Let's drop this API for now and, if someone decides they really care
      about solving this problem, they can do it properly.
      Signed-off-by: NJason Ekstrand <jason@jlekstrand.net>
      Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210708154835.528166-2-jason@jlekstrand.net
      fe4751c3
  2. 21 6月, 2021 1 次提交
  3. 14 6月, 2021 1 次提交
  4. 05 6月, 2021 1 次提交
  5. 04 6月, 2021 1 次提交
    • A
      drm/panfrost: Add AFBC_FEATURES parameter · 3e2926f8
      Alyssa Rosenzweig 提交于
      The value of the AFBC_FEATURES register is required by userspace to
      determine AFBC support on Bifrost. A user on our IRC channel (#panfrost)
      reported a workload that raised a fault on one system's Mali G31 but
      worked flawlessly with another system's Mali G31. We determined the
      cause to be missing AFBC support on one vendor's Mali implementation --
      it turns out AFBC is optional on Bifrost!
      
      Whether AFBC is supported or not is exposed in the AFBC_FEATURES
      register on Bifrost, which reads back as 0 on Midgard. A zero value
      indicates AFBC is fully supported, provided the architecture itself
      supports AFBC, allowing backwards-compatibility with Midgard. Bits 0 and
      15 indicate that AFBC support is absent for texturing and rendering
      respectively.
      
      The user experiencing the fault reports that AFBC_FEATURES reads back
      0x10001 on their system, confirming the architectural lack of AFBC.
      Userspace needs this parameter to know to disable AFBC on that
      chip, and perhaps others.
      
      v2: Fix typo from copy-paste fail.
      
      v3: Bump the UABI version. This commit was cherry-picked from another
      series so chalking this up to a rebase fail.
      Signed-off-by: NAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
      Reviewed-by: NSteven Price <steven.price@arm.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
      Signed-off-by: NSteven Price <steven.price@arm.com>
      Link: https://patchwork.freedesktop.org/patch/msgid/20210604130011.3203-1-alyssa.rosenzweig@collabora.com
      3e2926f8
  6. 02 6月, 2021 1 次提交
    • J
      drm/amdgpu: Add vbios info ioctl interface · 29b4c589
      Jiawei Gu 提交于
      Add AMDGPU_INFO_VBIOS_INFO subquery id for detailed vbios info.
      
      Provides a way for the user application to get the VBIOS
      information without having to parse the binary.
      It is useful for the user to be able to display in a simple way the VBIOS
      version in their system if they happen to encounter an issue.
      
      V2:
      Use numeric serial.
      Parse and expose vbios version string.
      
      V3:
      Remove redundant data in drm_amdgpu_info_vbios struct.
      
      V4:
      64 bit alignment in drm_amdgpu_info_vbios.
      
      v5: squash together all the reverts, etc. (Alex)
      Signed-off-by: NJiawei Gu <Jiawei.Gu@amd.com>
      Reviewed-by: NAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
      29b4c589
  7. 01 6月, 2021 3 次提交
  8. 28 5月, 2021 1 次提交
  9. 22 5月, 2021 1 次提交
  10. 19 5月, 2021 3 次提交
  11. 10 5月, 2021 1 次提交
  12. 08 5月, 2021 1 次提交
  13. 07 5月, 2021 1 次提交
  14. 06 5月, 2021 4 次提交
    • D
      mm/vmscan: move RECLAIM* bits to uapi header · b6676de8
      Dave Hansen 提交于
      It is currently not obvious that the RECLAIM_* bits are part of the uapi
      since they are defined in vmscan.c.  Move them to a uapi header to make it
      obvious.
      
      This should have no functional impact.
      
      Link: https://lkml.kernel.org/r/20210219172557.08074910@viggo.jf.intel.comSigned-off-by: NDave Hansen <dave.hansen@linux.intel.com>
      Reviewed-by: NBen Widawsky <ben.widawsky@intel.com>
      Reviewed-by: NOscar Salvador <osalvador@suse.de>
      Acked-by: NDavid Rientjes <rientjes@google.com>
      Acked-by: NChristoph Lameter <cl@linux.com>
      Cc: Alex Shi <alex.shi@linux.alibaba.com>
      Cc: Daniel Wagner <dwagner@suse.de>
      Cc: "Tobin C. Harding" <tobin@kernel.org>
      Cc: Christoph Lameter <cl@linux.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: Qian Cai <cai@lca.pw>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      b6676de8
    • A
      userfaultfd: add UFFDIO_CONTINUE ioctl · f6191471
      Axel Rasmussen 提交于
      This ioctl is how userspace ought to resolve "minor" userfaults.  The
      idea is, userspace is notified that a minor fault has occurred.  It
      might change the contents of the page using its second non-UFFD mapping,
      or not.  Then, it calls UFFDIO_CONTINUE to tell the kernel "I have
      ensured the page contents are correct, carry on setting up the mapping".
      
      Note that it doesn't make much sense to use UFFDIO_{COPY,ZEROPAGE} for
      MINOR registered VMAs.  ZEROPAGE maps the VMA to the zero page; but in
      the minor fault case, we already have some pre-existing underlying page.
      Likewise, UFFDIO_COPY isn't useful if we have a second non-UFFD mapping.
      We'd just use memcpy() or similar instead.
      
      It turns out hugetlb_mcopy_atomic_pte() already does very close to what
      we want, if an existing page is provided via `struct page **pagep`.  We
      already special-case the behavior a bit for the UFFDIO_ZEROPAGE case, so
      just extend that design: add an enum for the three modes of operation,
      and make the small adjustments needed for the MCOPY_ATOMIC_CONTINUE
      case.  (Basically, look up the existing page, and avoid adding the
      existing page to the page cache or calling set_page_huge_active() on
      it.)
      
      Link: https://lkml.kernel.org/r/20210301222728.176417-5-axelrasmussen@google.comSigned-off-by: NAxel Rasmussen <axelrasmussen@google.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Cc: Adam Ruprecht <ruprecht@google.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Cannon Matthews <cannonmatthews@google.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chinwen Chang <chinwen.chang@mediatek.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Cc: Lokesh Gidra <lokeshgidra@google.com>
      Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: "Michal Koutn" <mkoutny@suse.com>
      Cc: Michel Lespinasse <walken@google.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Mina Almasry <almasrymina@google.com>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Oliver Upton <oupton@google.com>
      Cc: Shaohua Li <shli@fb.com>
      Cc: Shawn Anastasio <shawn@anastas.io>
      Cc: Steven Price <steven.price@arm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f6191471
    • A
      userfaultfd: add minor fault registration mode · 7677f7fd
      Axel Rasmussen 提交于
      Patch series "userfaultfd: add minor fault handling", v9.
      
      Overview
      ========
      
      This series adds a new userfaultfd feature, UFFD_FEATURE_MINOR_HUGETLBFS.
      When enabled (via the UFFDIO_API ioctl), this feature means that any
      hugetlbfs VMAs registered with UFFDIO_REGISTER_MODE_MISSING will *also*
      get events for "minor" faults.  By "minor" fault, I mean the following
      situation:
      
      Let there exist two mappings (i.e., VMAs) to the same page(s) (shared
      memory).  One of the mappings is registered with userfaultfd (in minor
      mode), and the other is not.  Via the non-UFFD mapping, the underlying
      pages have already been allocated & filled with some contents.  The UFFD
      mapping has not yet been faulted in; when it is touched for the first
      time, this results in what I'm calling a "minor" fault.  As a concrete
      example, when working with hugetlbfs, we have huge_pte_none(), but
      find_lock_page() finds an existing page.
      
      We also add a new ioctl to resolve such faults: UFFDIO_CONTINUE.  The idea
      is, userspace resolves the fault by either a) doing nothing if the
      contents are already correct, or b) updating the underlying contents using
      the second, non-UFFD mapping (via memcpy/memset or similar, or something
      fancier like RDMA, or etc...).  In either case, userspace issues
      UFFDIO_CONTINUE to tell the kernel "I have ensured the page contents are
      correct, carry on setting up the mapping".
      
      Use Case
      ========
      
      Consider the use case of VM live migration (e.g. under QEMU/KVM):
      
      1. While a VM is still running, we copy the contents of its memory to a
         target machine. The pages are populated on the target by writing to the
         non-UFFD mapping, using the setup described above. The VM is still running
         (and therefore its memory is likely changing), so this may be repeated
         several times, until we decide the target is "up to date enough".
      
      2. We pause the VM on the source, and start executing on the target machine.
         During this gap, the VM's user(s) will *see* a pause, so it is desirable to
         minimize this window.
      
      3. Between the last time any page was copied from the source to the target, and
         when the VM was paused, the contents of that page may have changed - and
         therefore the copy we have on the target machine is out of date. Although we
         can keep track of which pages are out of date, for VMs with large amounts of
         memory, it is "slow" to transfer this information to the target machine. We
         want to resume execution before such a transfer would complete.
      
      4. So, the guest begins executing on the target machine. The first time it
         touches its memory (via the UFFD-registered mapping), userspace wants to
         intercept this fault. Userspace checks whether or not the page is up to date,
         and if not, copies the updated page from the source machine, via the non-UFFD
         mapping. Finally, whether a copy was performed or not, userspace issues a
         UFFDIO_CONTINUE ioctl to tell the kernel "I have ensured the page contents
         are correct, carry on setting up the mapping".
      
      We don't have to do all of the final updates on-demand. The userfaultfd manager
      can, in the background, also copy over updated pages once it receives the map of
      which pages are up-to-date or not.
      
      Interaction with Existing APIs
      ==============================
      
      Because this is a feature, a registered VMA could potentially receive both
      missing and minor faults.  I spent some time thinking through how the
      existing API interacts with the new feature:
      
      UFFDIO_CONTINUE cannot be used to resolve non-minor faults, as it does not
      allocate a new page.  If UFFDIO_CONTINUE is used on a non-minor fault:
      
      - For non-shared memory or shmem, -EINVAL is returned.
      - For hugetlb, -EFAULT is returned.
      
      UFFDIO_COPY and UFFDIO_ZEROPAGE cannot be used to resolve minor faults.
      Without modifications, the existing codepath assumes a new page needs to
      be allocated.  This is okay, since userspace must have a second
      non-UFFD-registered mapping anyway, thus there isn't much reason to want
      to use these in any case (just memcpy or memset or similar).
      
      - If UFFDIO_COPY is used on a minor fault, -EEXIST is returned.
      - If UFFDIO_ZEROPAGE is used on a minor fault, -EEXIST is returned (or -EINVAL
        in the case of hugetlb, as UFFDIO_ZEROPAGE is unsupported in any case).
      - UFFDIO_WRITEPROTECT simply doesn't work with shared memory, and returns
        -ENOENT in that case (regardless of the kind of fault).
      
      Future Work
      ===========
      
      This series only supports hugetlbfs.  I have a second series in flight to
      support shmem as well, extending the functionality.  This series is more
      mature than the shmem support at this point, and the functionality works
      fully on hugetlbfs, so this series can be merged first and then shmem
      support will follow.
      
      This patch (of 6):
      
      This feature allows userspace to intercept "minor" faults.  By "minor"
      faults, I mean the following situation:
      
      Let there exist two mappings (i.e., VMAs) to the same page(s).  One of the
      mappings is registered with userfaultfd (in minor mode), and the other is
      not.  Via the non-UFFD mapping, the underlying pages have already been
      allocated & filled with some contents.  The UFFD mapping has not yet been
      faulted in; when it is touched for the first time, this results in what
      I'm calling a "minor" fault.  As a concrete example, when working with
      hugetlbfs, we have huge_pte_none(), but find_lock_page() finds an existing
      page.
      
      This commit adds the new registration mode, and sets the relevant flag on
      the VMAs being registered.  In the hugetlb fault path, if we find that we
      have huge_pte_none(), but find_lock_page() does indeed find an existing
      page, then we have a "minor" fault, and if the VMA has the userfaultfd
      registration flag, we call into userfaultfd to handle it.
      
      This is implemented as a new registration mode, instead of an API feature.
      This is because the alternative implementation has significant drawbacks
      [1].
      
      However, doing it this was requires we allocate a VM_* flag for the new
      registration mode.  On 32-bit systems, there are no unused bits, so this
      feature is only supported on architectures with
      CONFIG_ARCH_USES_HIGH_VMA_FLAGS.  When attempting to register a VMA in
      MINOR mode on 32-bit architectures, we return -EINVAL.
      
      [1] https://lore.kernel.org/patchwork/patch/1380226/
      
      [peterx@redhat.com: fix minor fault page leak]
        Link: https://lkml.kernel.org/r/20210322175132.36659-1-peterx@redhat.com
      
      Link: https://lkml.kernel.org/r/20210301222728.176417-1-axelrasmussen@google.com
      Link: https://lkml.kernel.org/r/20210301222728.176417-2-axelrasmussen@google.comSigned-off-by: NAxel Rasmussen <axelrasmussen@google.com>
      Reviewed-by: NPeter Xu <peterx@redhat.com>
      Reviewed-by: NMike Kravetz <mike.kravetz@oracle.com>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Chinwen Chang <chinwen.chang@mediatek.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jann Horn <jannh@google.com>
      Cc: Jerome Glisse <jglisse@redhat.com>
      Cc: Lokesh Gidra <lokeshgidra@google.com>
      Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: "Michal Koutn" <mkoutny@suse.com>
      Cc: Michel Lespinasse <walken@google.com>
      Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: Shaohua Li <shli@fb.com>
      Cc: Shawn Anastasio <shawn@anastas.io>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Steven Price <steven.price@arm.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: Adam Ruprecht <ruprecht@google.com>
      Cc: Axel Rasmussen <axelrasmussen@google.com>
      Cc: Cannon Matthews <cannonmatthews@google.com>
      Cc: "Dr . David Alan Gilbert" <dgilbert@redhat.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Mina Almasry <almasrymina@google.com>
      Cc: Oliver Upton <oupton@google.com>
      Cc: Kirill A. Shutemov <kirill@shutemov.name>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7677f7fd
    • A
      vfio/pci: Revert nvlink removal uAPI breakage · 77b8aeb9
      Alex Williamson 提交于
      Revert the uAPI changes from the below commit with notice that these
      regions and capabilities are no longer provided.
      
      Fixes: b392a198 ("vfio/pci: remove vfio_pci_nvlink2")
      Reported-by: NGreg Kurz <groug@kaod.org>
      Signed-off-by: NAlex Williamson <alex.williamson@redhat.com>
      Reviewed-by: NCornelia Huck <cohuck@redhat.com>
      Reviewed-by: NGreg Kurz <groug@kaod.org>
      Tested-by: NGreg Kurz <groug@kaod.org>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Message-Id: <162014341432.3807030.11054087109120670135.stgit@omen>
      77b8aeb9
  15. 04 5月, 2021 4 次提交
  16. 03 5月, 2021 1 次提交
  17. 30 4月, 2021 1 次提交
    • A
      seg6: add counters support for SRv6 Behaviors · 94604548
      Andrea Mayer 提交于
      This patch provides counters for SRv6 Behaviors as defined in [1],
      section 6. For each SRv6 Behavior instance, counters defined in [1] are:
      
       - the total number of packets that have been correctly processed;
       - the total amount of traffic in bytes of all packets that have been
         correctly processed;
      
      In addition, this patch introduces a new counter that counts the number of
      packets that have NOT been properly processed (i.e. errors) by an SRv6
      Behavior instance.
      
      Counters are not only interesting for network monitoring purposes (i.e.
      counting the number of packets processed by a given behavior) but they also
      provide a simple tool for checking whether a behavior instance is working
      as we expect or not.
      Counters can be useful for troubleshooting misconfigured SRv6 networks.
      Indeed, an SRv6 Behavior can silently drop packets for very different
      reasons (i.e. wrong SID configuration, interfaces set with SID addresses,
      etc) without any notification/message to the user.
      
      Due to the nature of SRv6 networks, diagnostic tools such as ping and
      traceroute may be ineffective: paths used for reaching a given router can
      be totally different from the ones followed by probe packets. In addition,
      paths are often asymmetrical and this makes it even more difficult to keep
      up with the journey of the packets and to understand which behaviors are
      actually processing our traffic.
      
      When counters are enabled on an SRv6 Behavior instance, it is possible to
      verify if packets are actually processed by such behavior and what is the
      outcome of the processing. Therefore, the counters for SRv6 Behaviors offer
      an non-invasive observability point which can be leveraged for both traffic
      monitoring and troubleshooting purposes.
      
      [1] https://www.rfc-editor.org/rfc/rfc8986.html#name-counters
      
      Troubleshooting using SRv6 Behavior counters
      --------------------------------------------
      
      Let's make a brief example to see how helpful counters can be for SRv6
      networks. Let's consider a node where an SRv6 End Behavior receives an SRv6
      packet whose Segment Left (SL) is equal to 0. In this case, the End
      Behavior (which accepts only packets with SL >= 1) discards the packet and
      increases the error counter.
      This information can be leveraged by the network operator for
      troubleshooting. Indeed, the error counter is telling the user that the
      packet:
      
        (i) arrived at the node;
       (ii) the packet has been taken into account by the SRv6 End behavior;
      (iii) but an error has occurred during the processing.
      
      The error (iii) could be caused by different reasons, such as wrong route
      settings on the node or due to an invalid SID List carried by the SRv6
      packet. Anyway, the error counter is used to exclude that the packet did
      not arrive at the node or it has not been processed by the behavior at
      all.
      
      Turning on/off counters for SRv6 Behaviors
      ------------------------------------------
      
      Each SRv6 Behavior instance can be configured, at the time of its creation,
      to make use of counters.
      This is done through iproute2 which allows the user to create an SRv6
      Behavior instance specifying the optional "count" attribute as shown in the
      following example:
      
       $ ip -6 route add 2001:db8::1 encap seg6local action End count dev eth0
      
      per-behavior counters can be shown by adding "-s" to the iproute2 command
      line, i.e.:
      
       $ ip -s -6 route show 2001:db8::1
       2001:db8::1 encap seg6local action End packets 0 bytes 0 errors 0 dev eth0
      
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Impact of counters for SRv6 Behaviors on performance
      ====================================================
      
      To determine the performance impact due to the introduction of counters in
      the SRv6 Behavior subsystem, we have carried out extensive tests.
      
      We chose to test the throughput achieved by the SRv6 End.DX2 Behavior
      because, among all the other behaviors implemented so far, it reaches the
      highest throughput which is around 1.5 Mpps (per core at 2.4 GHz on a
      Xeon(R) CPU E5-2630 v3) on kernel 5.12-rc2 using packets of size ~ 100
      bytes.
      
      Three different tests were conducted in order to evaluate the overall
      throughput of the SRv6 End.DX2 Behavior in the following scenarios:
      
       1) vanilla kernel (without the SRv6 Behavior counters patch) and a single
          instance of an SRv6 End.DX2 Behavior;
       2) patched kernel with SRv6 Behavior counters and a single instance of
          an SRv6 End.DX2 Behavior with counters turned off;
       3) patched kernel with SRv6 Behavior counters and a single instance of
          SRv6 End.DX2 Behavior with counters turned on.
      
      All tests were performed on a testbed deployed on the CloudLab facilities
      [2], a flexible infrastructure dedicated to scientific research on the
      future of Cloud Computing.
      
      Results of tests are shown in the following table:
      
      Scenario (1): average 1504764,81 pps (~1504,76 kpps); std. dev 3956,82 pps
      Scenario (2): average 1501469,78 pps (~1501,47 kpps); std. dev 2979,85 pps
      Scenario (3): average 1501315,13 pps (~1501,32 kpps); std. dev 2956,00 pps
      
      As can be observed, throughputs achieved in scenarios (2),(3) did not
      suffer any observable degradation compared to scenario (1).
      
      Thanks to Jakub Kicinski and David Ahern for their valuable suggestions
      and comments provided during the discussion of the proposed RFCs.
      
      [2] https://www.cloudlab.usSigned-off-by: NAndrea Mayer <andrea.mayer@uniroma2.it>
      Reviewed-by: NDavid Ahern <dsahern@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      94604548
  18. 29 4月, 2021 1 次提交
  19. 28 4月, 2021 2 次提交
    • G
      RDMA/nldev: Add copy-on-fork attribute to get sys command · 6cc9e215
      Gal Pressman 提交于
      The new attribute indicates that the kernel copies DMA pages on fork,
      hence libibverbs' fork support through madvise and MADV_DONTFORK is not
      needed.
      
      The introduced attribute is always reported as supported since the kernel
      has the patch that added the copy-on-fork behavior. This allows the
      userspace library to identify older vs newer kernel versions.  Extra care
      should be taken when backporting this patch as it relies on the fact that
      the copy-on-fork patch is merged, hence no check for support is added.
      
      Don't backport this patch unless you also have the following series:
      commit 70e806e4 ("mm: Do early cow for pinned pages during fork() for
      ptes") and commit 4eae4efa ("hugetlb: do early cow when page pinned on
      src mm").
      
      Fixes: 70e806e4 ("mm: Do early cow for pinned pages during fork() for ptes")
      Fixes: 4eae4efa ("hugetlb: do early cow when page pinned on src mm")
      Link: https://lore.kernel.org/r/20210418121025.66849-1-galpress@amazon.comSigned-off-by: NGal Pressman <galpress@amazon.com>
      Reviewed-by: NLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: NJason Gunthorpe <jgg@nvidia.com>
      6cc9e215
    • P
      netfilter: nftables: add catch-all set element support · aaa31047
      Pablo Neira Ayuso 提交于
      This patch extends the set infrastructure to add a special catch-all set
      element. If the lookup fails to find an element (or range) in the set,
      then the catch-all element is selected. Users can specify a mapping,
      expression(s) and timeout to be attached to the catch-all element.
      
      This patch adds a catchall list to the set, this list might contain more
      than one single catch-all element (e.g. in case that the catch-all
      element is removed and a new one is added in the same transaction).
      However, most of the time, there will be either one element or no
      elements at all in this list.
      
      The catch-all element is identified via NFT_SET_ELEM_CATCHALL flag and
      such special element has no NFTA_SET_ELEM_KEY attribute. There is a new
      nft_set_elem_catchall object that stores a reference to the dummy
      catch-all element (catchall->elem) whose layout is the same of the set
      element type to reuse the existing set element codebase.
      
      The set size does not apply to the catch-all element, users can define a
      catch-all element even if the set is full.
      
      The check for valid set element flags hava been updates to report
      EOPNOTSUPP in case userspace requests flags that are not supported when
      using new userspace nftables and old kernel.
      Signed-off-by: NPablo Neira Ayuso <pablo@netfilter.org>
      aaa31047
  20. 26 4月, 2021 7 次提交
  21. 24 4月, 2021 1 次提交
  22. 23 4月, 2021 2 次提交
    • M
      signal, perf: Fix siginfo_t by avoiding u64 on 32-bit architectures · 3ddb3fd8
      Marco Elver 提交于
      The alignment of a structure is that of its largest member. On
      architectures like 32-bit Arm (but not e.g. 32-bit x86) 64-bit integers
      will require 64-bit alignment and not its natural word size.
      
      This means that there is no portable way to add 64-bit integers to
      siginfo_t on 32-bit architectures without breaking the ABI, because
      siginfo_t does not yet (and therefore likely never will) contain 64-bit
      fields on 32-bit architectures. Adding a 64-bit integer could change the
      alignment of the union after the 3 initial int si_signo, si_errno,
      si_code, thus introducing 4 bytes of padding shifting the entire union,
      which would break the ABI.
      
      One alternative would be to use the __packed attribute, however, it is
      non-standard C. Given siginfo_t has definitions outside the Linux kernel
      in various standard libraries that can be compiled with any number of
      different compilers (not just those we rely on), using non-standard
      attributes on siginfo_t should be avoided to ensure portability.
      
      In the case of the si_perf field, word size is sufficient since there is
      no exact requirement on size, given the data it contains is user-defined
      via perf_event_attr::sig_data. On 32-bit architectures, any excess bits
      of perf_event_attr::sig_data will therefore be truncated when copying
      into si_perf.
      
      Since si_perf is intended to disambiguate events (e.g. encoding relevant
      information if there are more events of the same type), 32 bits should
      provide enough entropy to do so on 32-bit architectures.
      
      For 64-bit architectures, no change is intended.
      
      Fixes: fb6cc127 ("signal: Introduce TRAP_PERF si_code and si_perf to siginfo")
      Reported-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Reported-by: NJon Hunter <jonathanh@nvidia.com>
      Signed-off-by: NMarco Elver <elver@google.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Tested-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Tested-by: NJon Hunter <jonathanh@nvidia.com>
      Link: https://lkml.kernel.org/r/20210422191823.79012-1-elver@google.com
      3ddb3fd8
    • M
      landlock: Enable user space to infer supported features · 3532b0b4
      Mickaël Salaün 提交于
      Add a new flag LANDLOCK_CREATE_RULESET_VERSION to
      landlock_create_ruleset(2).  This enables to retreive a Landlock ABI
      version that is useful to efficiently follow a best-effort security
      approach.  Indeed, it would be a missed opportunity to abort the whole
      sandbox building, because some features are unavailable, instead of
      protecting users as much as possible with the subset of features
      provided by the running kernel.
      
      This new flag enables user space to identify the minimum set of Landlock
      features supported by the running kernel without relying on a filesystem
      interface (e.g. /proc/version, which might be inaccessible) nor testing
      multiple syscall argument combinations (i.e. syscall bisection).  New
      Landlock features will be documented and tied to a minimum version
      number (greater than 1).  The current version will be incremented for
      each new kernel release supporting new Landlock features.  User space
      libraries can leverage this information to seamlessly restrict processes
      as much as possible while being compatible with newer APIs.
      
      This is a much more lighter approach than the previous
      landlock_get_features(2): the complexity is pushed to user space
      libraries.  This flag meets similar needs as securityfs versions:
      selinux/policyvers, apparmor/features/*/version* and tomoyo/version.
      
      Supporting this flag now will be convenient for backward compatibility.
      
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: James Morris <jmorris@namei.org>
      Cc: Jann Horn <jannh@google.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Serge E. Hallyn <serge@hallyn.com>
      Signed-off-by: NMickaël Salaün <mic@linux.microsoft.com>
      Link: https://lore.kernel.org/r/20210422154123.13086-14-mic@digikod.netSigned-off-by: NJames Morris <jamorris@linux.microsoft.com>
      3532b0b4