1. 03 Jun, 2019 3 commits
    • Nicolin Chen's avatar
      dma-contiguous: use fallback alloc_pages for single pages · bd2e7563
      Nicolin Chen authored
      The addresses within a single page are always contiguous, so it's
      not so necessary to always allocate one single page from CMA area.
      Since the CMA area has a limited predefined size of space, it may
      run out of space in heavy use cases, where there might be quite a
      lot CMA pages being allocated for single pages.
      
      However, there is also a concern that a device might care where a
      page comes from -- it might expect the page from CMA area and act
      differently if the page doesn't.
      
      This patch tries to use the fallback alloc_pages path, instead of
      one-page size allocations from the global CMA area in case that a
      device does not have its own CMA area. This'd save resources from
      the CMA global area for more CMA allocations, and also reduce CMA
      fragmentations resulted from trivial allocations.
      Signed-off-by: default avatarNicolin Chen <nicoleotsuka@gmail.com>
      Tested-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      bd2e7563
    • Nicolin Chen's avatar
      dma-contiguous: add dma_{alloc,free}_contiguous() helpers · b1d2dc00
      Nicolin Chen authored
      Both dma_alloc_from_contiguous() and dma_release_from_contiguous() are
      very simply implemented, but requiring callers to pass certain
      parameters like count and align, and taking a boolean parameter to check
      __GFP_NOWARN in the allocation flags. So every function call duplicates
      similar work:
      
      	unsigned long order = get_order(size);
      	size_t count = size >> PAGE_SHIFT;
      
      	page = dma_alloc_from_contiguous(dev, count, order,
      			gfp & __GFP_NOWARN);
      
      	[...]
      
      	dma_release_from_contiguous(dev, page, size >> PAGE_SHIFT);
      
      Additionally, as CMA can be used only in the context which permits
      sleeping, most of callers do a gfpflags_allow_blocking() check and a
      corresponding fallback allocation of normal pages upon any false result:
      
      	if (gfpflags_allow_blocking(flag))
      		page = dma_alloc_from_contiguous();
      	if (!page)
      		page = alloc_pages();
      
      	[...]
      
      	if (!dma_release_from_contiguous(dev, page, count))
      		__free_pages(page, get_order(size));
      
      So this patch simplifies those function calls by abstracting these
      operations into the two new functions: dma_{alloc,free}_contiguous.
      
      As some callers of dma_{alloc,release}_from_contiguous() might be
      complicated, this patch just implements these two new functions to
      kernel/dma/direct.c only as an initial step.
      Suggested-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarNicolin Chen <nicoleotsuka@gmail.com>
      Tested-by: default avatardann frazier <dann.frazier@canonical.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      b1d2dc00
    • Nathan Chancellor's avatar
      iommu/dma: Fix condition check in iommu_dma_unmap_sg · 1b961423
      Nathan Chancellor authored
      Clang warns:
      
      drivers/iommu/dma-iommu.c:897:6: warning: logical not is only applied to
      the left hand side of this comparison [-Wlogical-not-parentheses]
              if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
                  ^                                 ~~
      drivers/iommu/dma-iommu.c:897:6: note: add parentheses after the '!' to
      evaluate the comparison first
              if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
                  ^
                   (                                    )
      drivers/iommu/dma-iommu.c:897:6: note: add parentheses around left hand
      side expression to silence this warning
              if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
                  ^
                  (                                )
      1 warning generated.
      
      Judging from the rest of the commit and the conditional in
      iommu_dma_map_sg, either
      
          if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
      
      or
          if ((attrs & DMA_ATTR_SKIP_CPU_SYNC) == 0)
      
      was intended, not a combination of the two.
      
      I personally think that the former is easier to understand so use that.
      
      Fixes: 06d60728 ("iommu/dma: move the arm64 wrappers to common code")
      Link: https://github.com/ClangBuiltLinux/linux/issues/497Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
      Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      1b961423
  2. 27 May, 2019 23 commits
  3. 26 May, 2019 6 commits
    • Linus Torvalds's avatar
      Linux 5.2-rc2 · cd6c84d8
      Linus Torvalds authored
      cd6c84d8
    • Linus Torvalds's avatar
      Merge tag 'trace-v5.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · c5b44095
      Linus Torvalds authored
      Pull tracing warning fix from Steven Rostedt:
       "Make the GCC 9 warning for sub struct memset go away.
      
        GCC 9 now warns about calling memset() on partial structures when it
        goes across multiple fields. This adds a helper for the place in
        tracing that does this type of clearing of a structure"
      
      * tag 'trace-v5.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        tracing: Silence GCC 9 array bounds warning
      c5b44095
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 862f0a32
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "The usual smattering of fixes and tunings that came in too late for
        the merge window, but should not wait four months before they appear
        in a release.
      
        I also travelled a bit more than usual in the first part of May, which
        didn't help with picking up patches and reports promptly"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (33 commits)
        KVM: x86: fix return value for reserved EFER
        tools/kvm_stat: fix fields filter for child events
        KVM: selftests: Wrap vcpu_nested_state_get/set functions with x86 guard
        kvm: selftests: aarch64: compile with warnings on
        kvm: selftests: aarch64: fix default vm mode
        kvm: selftests: aarch64: dirty_log_test: fix unaligned memslot size
        KVM: s390: fix memory slot handling for KVM_SET_USER_MEMORY_REGION
        KVM: x86/pmu: do not mask the value that is written to fixed PMUs
        KVM: x86/pmu: mask the result of rdpmc according to the width of the counters
        x86/kvm/pmu: Set AMD's virt PMU version to 1
        KVM: x86: do not spam dmesg with VMCS/VMCB dumps
        kvm: Check irqchip mode before assign irqfd
        kvm: svm/avic: fix off-by-one in checking host APIC ID
        KVM: selftests: do not blindly clobber registers in guest asm
        KVM: selftests: Remove duplicated TEST_ASSERT in hyperv_cpuid.c
        KVM: LAPIC: Expose per-vCPU timer_advance_ns to userspace
        KVM: LAPIC: Fix lapic_timer_advance_ns parameter overflow
        kvm: vmx: Fix -Wmissing-prototypes warnings
        KVM: nVMX: Fix using __this_cpu_read() in preemptible context
        kvm: fix compilation on s390
        ...
      862f0a32
    • Linus Torvalds's avatar
      Merge tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random · 128f2bfa
      Linus Torvalds authored
      Pull /dev/random fix from Ted Ts'o:
       "Fix a soft lockup regression when reading from /dev/random in early
        boot"
      
      * tag 'random_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random:
        random: fix soft lockup when trying to read from an uninitialized blocking pool
      128f2bfa
    • Theodore Ts'o's avatar
      random: fix soft lockup when trying to read from an uninitialized blocking pool · 58be0106
      Theodore Ts'o authored
      Fixes: eb9d1bf0: "random: only read from /dev/random after its pool has received 128 bits"
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      58be0106
    • Miguel Ojeda's avatar
      tracing: Silence GCC 9 array bounds warning · 0c97bf86
      Miguel Ojeda authored
      Starting with GCC 9, -Warray-bounds detects cases when memset is called
      starting on a member of a struct but the size to be cleared ends up
      writing over further members.
      
      Such a call happens in the trace code to clear, at once, all members
      after and including `seq` on struct trace_iterator:
      
          In function 'memset',
              inlined from 'ftrace_dump' at kernel/trace/trace.c:8914:3:
          ./include/linux/string.h:344:9: warning: '__builtin_memset' offset
          [8505, 8560] from the object at 'iter' is out of the bounds of
          referenced subobject 'seq' with type 'struct trace_seq' at offset
          4368 [-Warray-bounds]
            344 |  return __builtin_memset(p, c, size);
                |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      In order to avoid GCC complaining about it, we compute the address
      ourselves by adding the offsetof distance instead of referring
      directly to the member.
      
      Since there are two places doing this clear (trace.c and trace_kdb.c),
      take the chance to move the workaround into a single place in
      the internal header.
      
      Link: http://lkml.kernel.org/r/20190523124535.GA12931@gmail.comSigned-off-by: default avatarMiguel Ojeda <miguel.ojeda.sandonis@gmail.com>
      [ Removed unnecessary parenthesis around "iter" ]
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      0c97bf86
  4. 25 May, 2019 5 commits
  5. 24 May, 2019 3 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-20190524' of git://git.kernel.dk/linux-block · 7fbc78e3
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - NVMe pull request from Keith, with fixes from a few folks.
      
       - bio and sbitmap before atomic barrier fixes (Andrea)
      
       - Hang fix for blk-mq freeze and unfreeze (Bob)
      
       - Single segment count regression fix (Christoph)
      
       - AoE now has a new maintainer
      
       - tools/io_uring/ Makefile fix, and sync with liburing (me)
      
      * tag 'for-linus-20190524' of git://git.kernel.dk/linux-block: (23 commits)
        tools/io_uring: sync with liburing
        tools/io_uring: fix Makefile for pthread library link
        blk-mq: fix hang caused by freeze/unfreeze sequence
        block: remove the bi_seg_{front,back}_size fields in struct bio
        block: remove the segment size check in bio_will_gap
        block: force an unlimited segment size on queues with a virt boundary
        block: don't decrement nr_phys_segments for physically contigous segments
        sbitmap: fix improper use of smp_mb__before_atomic()
        bio: fix improper use of smp_mb__before_atomic()
        aoe: list new maintainer for aoe driver
        nvme-pci: use blk-mq mapping for unmanaged irqs
        nvme: update MAINTAINERS
        nvme: copy MTFA field from identify controller
        nvme: fix memory leak for power latency tolerance
        nvme: release namespace SRCU protection before performing controller ioctls
        nvme: merge nvme_ns_ioctl into nvme_ioctl
        nvme: remove the ifdef around nvme_nvm_ioctl
        nvme: fix srcu locking on error return in nvme_get_ns_from_disk
        nvme: Fix known effects
        nvme-pci: Sync queues on reset
        ...
      7fbc78e3
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-5.2-rc2' of... · 7f8b40e3
      Linus Torvalds authored
      Merge tag 'linux-kselftest-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest fixes from Shuah Khan:
      
       - Two fixes to regressions introduced in kselftest Makefile test run
         output refactoring work (Kees Cook)
      
       - Adding Atom support to syscall_arg_fault test (Tong Bo)
      
      * tag 'linux-kselftest-5.2-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/timers: Add missing fflush(stdout) calls
        selftests: Remove forced unbuffering for test running
        selftests/x86: Support Atom for syscall_arg_fault test
      7f8b40e3
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · e7bd3e24
      Linus Torvalds authored
      Pull Devicetree fixes from Rob Herring:
      
       - Update checkpatch.pl to use DT vendor-prefixes.yaml
      
       - Fix DT binding references to files converted to DT schema
      
       - Clean-up Arm CPU binding examples to match schema
      
       - Add Sifive block versioning scheme documentation
      
       - Pass binding directory base to validation tools for reference lookups
      
      * tag 'devicetree-fixes-for-5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        checkpatch.pl: Update DT vendor prefix check
        dt: bindings: mtd: replace references to nand.txt with nand-controller.yaml
        dt-bindings: interrupt-controller: arm,gic: Fix schema errors in example
        dt-bindings: arm: Clean up CPU binding examples
        dt: fix refs that were renamed to json with the same file name
        dt-bindings: Pass binding directory to validation tools
        dt-bindings: sifive: describe sifive-blocks versioning
      e7bd3e24