1. 20 Dec, 2017 3 commits
    • Jens Axboe's avatar
      null_blk: unalign call_single_data · 0864fe09
      Jens Axboe authored
      Commit 966a9671 randomly added alignment to this structure, but
      it's actually detrimental to performance of null_blk. Test case:
      
      Running on both the home and remote node shows a ~5% degradation
      in performance.
      
      While in there, move blk_status_t to the hole after the integer tag
      in the nullb_cmd structure. After this patch, we shrink the size
      from 192 to 152 bytes.
      
      Fixes: 966a9671 ("smp: Avoid using two cache lines for struct call_single_data")
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      0864fe09
    • Jens Axboe's avatar
      block: unalign call_single_data in struct request · 4ccafe03
      Jens Axboe authored
      A previous change blindly added massive alignment to the
      call_single_data structure in struct request. This ballooned it in size
      from 296 to 320 bytes on my setup, for no valid reason at all.
      
      Use the unaligned struct __call_single_data variant instead.
      
      Fixes: 966a9671 ("smp: Avoid using two cache lines for struct call_single_data")
      Cc: stable@vger.kernel.org # v4.14
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      4ccafe03
    • Shaohua Li's avatar
      block-throttle: avoid double charge · 111be883
      Shaohua Li authored
      If a bio is throttled and split after throttling, the bio could be
      resubmited and enters the throttling again. This will cause part of the
      bio to be charged multiple times. If the cgroup has an IO limit, the
      double charge will significantly harm the performance. The bio split
      becomes quite common after arbitrary bio size change.
      
      To fix this, we always set the BIO_THROTTLED flag if a bio is throttled.
      If the bio is cloned/split, we copy the flag to new bio too to avoid a
      double charge. However, cloned bio could be directed to a new disk,
      keeping the flag be a problem. The observation is we always set new disk
      for the bio in this case, so we can clear the flag in bio_set_dev().
      
      This issue exists for a long time, arbitrary bio size change just makes
      it worse, so this should go into stable at least since v4.2.
      
      V1-> V2: Not add extra field in bio based on discussion with Tejun
      
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: stable@vger.kernel.org
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      111be883
  2. 18 Dec, 2017 2 commits
    • Jens Axboe's avatar
      block: fix blk_rq_append_bio · 0abc2a10
      Jens Axboe authored
      Commit caa4b024(blk-map: call blk_queue_bounce from blk_rq_append_bio)
      moves blk_queue_bounce() into blk_rq_append_bio(), but don't consider
      the fact that the bounced bio becomes invisible to caller since the
      parameter type is 'struct bio *'. Make it a pointer to a pointer to
      a bio, so the caller sees the right bio also after a bounce.
      
      Fixes: caa4b024 ("blk-map: call blk_queue_bounce from blk_rq_append_bio")
      Cc: Christoph Hellwig <hch@lst.de>
      Reported-by: default avatarMichele Ballabio <barra_cuda@katamail.com>
      (handling failure of blk_rq_append_bio(), only call bio_get() after
      blk_rq_append_bio() returns OK)
      Tested-by: default avatarMichele Ballabio <barra_cuda@katamail.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      0abc2a10
    • Ming Lei's avatar
      block: don't let passthrough IO go into .make_request_fn() · 14cb0dc6
      Ming Lei authored
      Commit a8821f3f("block: Improvements to bounce-buffer handling") tries
      to make sure that the bio to .make_request_fn won't exceed BIO_MAX_PAGES,
      but ignores that passthrough I/O can use blk_queue_bounce() too.
      Especially, passthrough IO may not be sector-aligned, and the check
      of 'sectors < bio_sectors(*bio_orig)' inside __blk_queue_bounce() may
      become true even though the max bvec number doesn't exceed BIO_MAX_PAGES,
      then cause the bio splitted, and the original passthrough bio is submited
      to generic_make_request().
      
      This patch fixes this issue by checking if the bio is passthrough IO,
      and use bio_kmalloc() to allocate the cloned passthrough bio.
      
      Cc: NeilBrown <neilb@suse.com>
      Fixes: a8821f3f("block: Improvements to bounce-buffer handling")
      Tested-by: default avatarMichele Ballabio <barra_cuda@katamail.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      14cb0dc6
  3. 15 Dec, 2017 6 commits
    • Jens Axboe's avatar
      Merge branch 'nvme-4.15' of git://git.infradead.org/nvme into for-linus · a9fa9914
      Jens Axboe authored
      Pull NVMe fixes from Christoph:
      
      "Below are a couple important one or two liners fixes for Linux 4.15"
      a9fa9914
    • Keith Busch's avatar
      nvme: setup streams after initializing namespace head · 654b4a4a
      Keith Busch authored
      Fixes a NULL pointer dereference.
      Reported-by: default avatarArnav Dawn <a.dawn@samsung.com>
      Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      654b4a4a
    • Keith Busch's avatar
      nvme: check hw sectors before setting chunk sectors · 249159c5
      Keith Busch authored
      Some devices with IDs matching the "stripe" quirk don't actually have
      this quirk, and don't have an MDTS value. When MDTS is not set, the
      driver sets the max sectors to UINT_MAX, which is not a power of 2,
      hitting a BUG_ON from blk_queue_chunk_sectors. This patch skips setting
      chunk sectors for such devices.
      Signed-off-by: default avatarKeith Busch <keith.busch@intel.com>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      249159c5
    • Ming Lei's avatar
      nvme: call blk_integrity_unregister after queue is cleaned up · bd9f5d65
      Ming Lei authored
      During IO complete path, bio_integrity_advance() is often called, and
      blk_get_integrity() is called in this function. But in
      blk_integrity_unregister, the buffer pointed by queue->integrity
      is cleared, and blk_integrity->profile becomes NULL, then blk_get_integrity
      returns NULL, and causes kernel oops[1] finally.
      
      This patch fixes this issue by calling blk_integrity_unregister() after
      blk_cleanup_queue().
      
      [1] kernel oops log
      [  122.068007] BUG: unable to handle kernel NULL pointer dereference at 000000000000000a
      [  122.076760] IP: bio_integrity_advance+0x3d/0xf0
      [  122.081815] PGD 0 P4D 0
      [  122.084641] Oops: 0000 [#1] SMP
      [  122.088142] Modules linked in: sunrpc ipmi_ssif intel_rapl vfat fat x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm irqbypass mei_me ipmi_si crct10dif_pclmul crc32_pclmul sg mei ghash_clmulni_intel mxm_wmi ipmi_devintf iTCO_wdt intel_cstate intel_uncore pcspkr intel_rapl_perf iTCO_vendor_support dcdbas ipmi_msghandler lpc_ich acpi_power_meter shpchp wmi dm_multipath ip_tables xfs libcrc32c sd_mod mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm crc32c_intel ahci nvme tg3 libahci nvme_core i2c_core libata ptp megaraid_sas pps_core dm_mirror dm_region_hash dm_log dm_mod
      [  122.149577] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.0-11.el7a.x86_64 #1
      [  122.157635] Hardware name: Dell Inc. PowerEdge R730xd/072T6D, BIOS 2.5.5 08/16/2017
      [  122.166179] task: ffff8802ff1e8000 task.stack: ffffc90000130000
      [  122.172785] RIP: 0010:bio_integrity_advance+0x3d/0xf0
      [  122.178419] RSP: 0018:ffff88047fc03d70 EFLAGS: 00010006
      [  122.184248] RAX: ffff880473b08000 RBX: ffff880458c71a80 RCX: ffff880473b08248
      [  122.192209] RDX: 0000000000000000 RSI: 000000000000003c RDI: ffffc900038d7ba0
      [  122.200171] RBP: ffff88047fc03d78 R08: 0000000000000001 R09: ffffffffa01a78b5
      [  122.208132] R10: ffff88047fc1eda0 R11: ffff880458c71ad0 R12: 0000000000007800
      [  122.216094] R13: 0000000000000000 R14: 0000000000007800 R15: ffff880473a39b40
      [  122.224056] FS:  0000000000000000(0000) GS:ffff88047fc00000(0000) knlGS:0000000000000000
      [  122.233083] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  122.239494] CR2: 000000000000000a CR3: 0000000001c09002 CR4: 00000000001606e0
      [  122.247455] Call Trace:
      [  122.250183]  <IRQ>
      [  122.252429]  bio_advance+0x28/0xf0
      [  122.256217]  blk_update_request+0xa1/0x310
      [  122.260778]  blk_mq_end_request+0x1e/0x70
      [  122.265256]  nvme_complete_rq+0x1c/0xd0 [nvme_core]
      [  122.270699]  nvme_pci_complete_rq+0x85/0x130 [nvme]
      [  122.276140]  __blk_mq_complete_request+0x8d/0x140
      [  122.281387]  blk_mq_complete_request+0x16/0x20
      [  122.286345]  nvme_process_cq+0xdd/0x1c0 [nvme]
      [  122.291301]  nvme_irq+0x23/0x50 [nvme]
      [  122.295485]  __handle_irq_event_percpu+0x3c/0x190
      [  122.300725]  handle_irq_event_percpu+0x32/0x80
      [  122.305683]  handle_irq_event+0x3b/0x60
      [  122.309964]  handle_edge_irq+0x8f/0x190
      [  122.314247]  handle_irq+0xab/0x120
      [  122.318043]  do_IRQ+0x48/0xd0
      [  122.321355]  common_interrupt+0x9d/0x9d
      [  122.325625]  </IRQ>
      [  122.327967] RIP: 0010:cpuidle_enter_state+0xe9/0x280
      [  122.333504] RSP: 0018:ffffc90000133e68 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff35
      [  122.341952] RAX: ffff88047fc1b900 RBX: ffff88047fc24400 RCX: 000000000000001f
      [  122.349913] RDX: 0000000000000000 RSI: fffffcf2e6007295 RDI: 0000000000000000
      [  122.357874] RBP: ffffc90000133ea0 R08: 000000000000062e R09: 0000000000000253
      [  122.365836] R10: 0000000000000225 R11: 0000000000000018 R12: 0000000000000002
      [  122.373797] R13: 0000000000000001 R14: ffff88047fc24400 R15: 0000001c6bd1d263
      [  122.381762]  ? cpuidle_enter_state+0xc5/0x280
      [  122.386623]  cpuidle_enter+0x17/0x20
      [  122.390611]  call_cpuidle+0x23/0x40
      [  122.394501]  do_idle+0x17e/0x1f0
      [  122.398101]  cpu_startup_entry+0x73/0x80
      [  122.402478]  start_secondary+0x178/0x1c0
      [  122.406854]  secondary_startup_64+0xa5/0xa5
      [  122.411520] Code: 48 8b 5f 68 48 8b 47 08 31 d2 4c 8b 5b 48 48 8b 80 d0 03 00 00 48 83 b8 48 02 00 00 00 48 8d 88 48 02 00 00 48 0f 45 d1 c1 ee 09 <0f> b6 4a 0a 0f b6 52 09 89 f0 48 01 73 08 83 e9 09 d3 e8 0f af
      [  122.432604] RIP: bio_integrity_advance+0x3d/0xf0 RSP: ffff88047fc03d70
      [  122.439888] CR2: 000000000000000a
      Reported-by: default avatarZhang Yi <yizhan@redhat.com>
      Tested-by: default avatarZhang Yi <yizhan@redhat.com>
      Signed-off-by: default avatarMing Lei <ming.lei@redhat.com>
      Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      bd9f5d65
    • James Smart's avatar
      nvme-fc: remove double put reference if admin connect fails · 4596e752
      James Smart authored
      There are two put references in the failure case of initial
      create_association. The first put actually frees the controller, thus the
      second put references freed memory.
      
      Remove the unnecessary 2nd put.
      Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      4596e752
    • David Disseldorp's avatar
      nvme: set discard_alignment to zero · b224f613
      David Disseldorp authored
      Similar to 7c084289 ("rbd: set discard_alignment to zero"), NVMe
      devices are currently incorrectly initialised with the block queue
      discard_alignment set to the NVMe stream alignment.
      
      As per Documentation/ABI/testing/sysfs-block:
        The discard_alignment parameter indicates how many bytes the beginning
        of the device is offset from the internal allocation unit's natural
        alignment.
      
      Correcting the discard_alignment parameter to zero has no effect on how
      discard requests are propagated through the block layer - @alignment in
      __blkdev_issue_discard() remains zero. However, it does fix other
      consumers, such as LIO's Block Limits VPD response.
      Signed-off-by: default avatarDavid Disseldorp <ddiss@suse.de>
      Reviewed-by: default avatarJens Axboe <axboe@kernel.dk>
      Reviewed-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      b224f613
  4. 06 Dec, 2017 1 commit
    • Omar Sandoval's avatar
      kyber: fix another domain token wait queue hang · fcf38cdf
      Omar Sandoval authored
      Commit 8cf46660 ("kyber: fix hang on domain token wait queue") fixed
      a hang caused by leaving wait entries on the domain token wait queue
      after the __sbitmap_queue_get() retry succeeded, making that wait entry
      a "dud" which won't in turn wake more entries up. However, we can also
      get a dud entry if kyber_get_domain_token() fails once but is then
      called again and succeeds. This can happen if the hardware queue is
      rerun for some other reason, or, more likely, kyber_dispatch_request()
      tries the same domain twice.
      
      The fix is to remove our entry from the wait queue whenever we
      successfully get a token. The only complication is that we might be on
      one of many wait queues in the struct sbitmap_queue, but that's easily
      fixed by remembering which wait queue we were put on.
      
      While we're here, only initialize the wait queue entry once instead of
      on every wait, and use spin_lock_irq() instead of spin_lock_irqsave(),
      since this is always called from process context with irqs enabled.
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      fcf38cdf
  5. 03 Dec, 2017 5 commits
  6. 02 Dec, 2017 4 commits
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-4.15-2' of git://git.linux-nfs.org/projects/anna/linux-nfs · 2db767d9
      Linus Torvalds authored
      Pull NFS client fixes from Anna Schumaker:
       "These patches fix a problem with compiling using an old version of
        gcc, and also fix up error handling in the SUNRPC layer.
      
         - NFSv4: Ensure gcc 4.4.4 can compile initialiser for
           "invalid_stateid"
      
         - SUNRPC: Allow connect to return EHOSTUNREACH
      
         - SUNRPC: Handle ENETDOWN errors"
      
      * tag 'nfs-for-4.15-2' of git://git.linux-nfs.org/projects/anna/linux-nfs:
        SUNRPC: Handle ENETDOWN errors
        SUNRPC: Allow connect to return EHOSTUNREACH
        NFSv4: Ensure gcc 4.4.4 can compile initialiser for "invalid_stateid"
      2db767d9
    • Linus Torvalds's avatar
      Merge tag 'xfs-4.15-fixes-4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 788c1da0
      Linus Torvalds authored
      Pull xfs fixes from Darrick Wong:
       "Here are some bug fixes for 4.15-rc2.
      
         - fix memory leaks that appeared after removing ifork inline data
           buffer
      
         - recover deferred rmap update log items in correct order
      
         - fix memory leaks when buffer construction fails
      
         - fix memory leaks when bmbt is corrupt
      
         - fix some uninitialized variables and math problems in the quota
           scrubber
      
         - add some omitted attribution tags on the log replay commit
      
         - fix some UBSAN complaints about integer overflows with large sparse
           files
      
         - implement an effective inode mode check in online fsck
      
         - fix log's inability to retry quota item writeout due to transient
           errors"
      
      * tag 'xfs-4.15-fixes-4' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: Properly retry failed dquot items in case of error during buffer writeback
        xfs: scrub inode mode properly
        xfs: remove unused parameter from xfs_writepage_map
        xfs: ubsan fixes
        xfs: calculate correct offset in xfs_scrub_quota_item
        xfs: fix uninitialized variable in xfs_scrub_quota
        xfs: fix leaks on corruption errors in xfs_bmap.c
        xfs: fortify xfs_alloc_buftarg error handling
        xfs: log recovery should replay deferred ops in order
        xfs: always free inline data before resetting inode fork during ifree
      788c1da0
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-4.15-rc2_cleanups' of... · e1ba1c99
      Linus Torvalds authored
      Merge tag 'riscv-for-linus-4.15-rc2_cleanups' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux
      
      Pull RISC-V cleanups and ABI fixes from Palmer Dabbelt:
       "This contains a handful of small cleanups that are a result of
        feedback that didn't make it into our original patch set, either
        because the feedback hadn't been given yet, I missed the original
        emails, or we weren't ready to submit the changes yet.
      
        I've been maintaining the various cleanup patch sets I have as their
        own branches, which I then merged together and signed. Each merge
        commit has a short summary of the changes, and each branch is based on
        your latest tag (4.15-rc1, in this case). If this isn't the right way
        to do this then feel free to suggest something else, but it seems sane
        to me.
      
        Here's a short summary of the changes, roughly in order of how
        interesting they are.
      
         - libgcc.h has been moved from include/lib, where it's the only
           member, to include/linux. This is meant to avoid tab completion
           conflicts.
      
         - VDSO entries for clock_get/gettimeofday/getcpu have been added.
           These are simple syscalls now, but we want to let glibc use them
           from the start so we can make them faster later.
      
         - A VDSO entry for instruction cache flushing has been added so
           userspace can flush the instruction cache.
      
         - The VDSO symbol versions for __vdso_cmpxchg{32,64} have been
           removed, as those VDSO entries don't actually exist.
      
         - __io_writes has been corrected to respect the given type.
      
         - A new READ_ONCE in arch_spin_is_locked().
      
         - __test_and_op_bit_ord() is now actually ordered.
      
         - Various small fixes throughout the tree to enable allmodconfig to
           build cleanly.
      
         - Removal of some dead code in our atomic support headers.
      
         - Improvements to various comments in our atomic support headers"
      
      * tag 'riscv-for-linus-4.15-rc2_cleanups' of git://git.kernel.org/pub/scm/linux/kernel/git/palmer/linux: (23 commits)
        RISC-V: __io_writes should respect the length argument
        move libgcc.h to include/linux
        RISC-V: Clean up an unused include
        RISC-V: Allow userspace to flush the instruction cache
        RISC-V: Flush I$ when making a dirty page executable
        RISC-V: Add missing include
        RISC-V: Use define for get_cycles like other architectures
        RISC-V: Provide stub of setup_profiling_timer()
        RISC-V: Export some expected symbols for modules
        RISC-V: move empty_zero_page definition to C and export it
        RISC-V: io.h: type fixes for warnings
        RISC-V: use RISCV_{INT,SHORT} instead of {INT,SHORT} for asm macros
        RISC-V: use generic serial.h
        RISC-V: remove spin_unlock_wait()
        RISC-V: `sfence.vma` orderes the instruction cache
        RISC-V: Add READ_ONCE in arch_spin_is_locked()
        RISC-V: __test_and_op_bit_ord should be strongly ordered
        RISC-V: Remove smb_mb__{before,after}_spinlock()
        RISC-V: Remove __smp_bp__{before,after}_atomic
        RISC-V: Comment on why {,cmp}xchg is ordered how it is
        ...
      e1ba1c99
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 4b1967c9
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "The critical one here is a fix for fpsimd register corruption across
        signals which was introduced by the SVE support code (the register
        files overlap), but the others are worth having as well.
      
        Summary:
      
         - Fix FP register corruption when SVE is not available or in use
      
         - Fix out-of-tree module build failure when CONFIG_ARM64_MODULE_PLTS=y
      
         - Missing 'const' generating errors with LTO builds
      
         - Remove unsupported events from Cortex-A73 PMU description
      
         - Removal of stale and incorrect comments"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64: context: Fix comments and remove pointless smp_wmb()
        arm64: cpu_ops: Add missing 'const' qualifiers
        arm64: perf: remove unsupported events for Cortex-A73
        arm64: fpsimd: Fix failure to restore FPSIMD state after signals
        arm64: pgd: Mark pgd_cache as __ro_after_init
        arm64: ftrace: emit ftrace-mod.o contents through code
        arm64: module-plts: factor out PLT generation code for ftrace
        arm64: mm: cleanup stale AIVIVT references
      4b1967c9
  7. 01 Dec, 2017 19 commits
    • Palmer Dabbelt's avatar
      RISC-V: Fixes for clean allmodconfig build · 3b62de26
      Palmer Dabbelt authored
      Olaf said: Here's a short series of patches that produces a working
      allmodconfig. Would be nice to see them go in so we can add build
      coverage.
      
      I've dropped patches 8 and 10 from the original set:
      
      * [PATCH 08/10] (RISC-V: Set __ARCH_WANT_RENAMEAT to pick up generic
        version) has a better fix that I've sent out for review, we don't want
        renameat.
      * [PATCH 10/10] (input: joystick: riscv has get_cycles) has already been
        taken into Dmitry Torokhov's tree.
      3b62de26
    • Palmer Dabbelt's avatar
      move libgcc.h to include/linux · 185e788c
      Palmer Dabbelt authored
      185e788c
    • Palmer Dabbelt's avatar
      7382fbde
    • Palmer Dabbelt's avatar
      RISC-V: User-Visible Changes · 07f8ba74
      Palmer Dabbelt authored
      This merge contains the user-visible, ABI-breaking changes that we want
      to make sure we have in Linux before our first release.   Highlights
      include:
      
      * VDSO entries for clock_get/gettimeofday/getcpu have been added.  These
        are simple syscalls now, but we want to let glibc use them from the
        start so we can make them faster later.
      * A VDSO entry for instruction cache flushing has been added so
        userspace can flush the instruction cache.
      * The VDSO symbol versions for __vdso_cmpxchg{32,64} have been removed,
        as those VDSO entries don't actually exist.
      
      Conflicts:
              arch/riscv/include/asm/tlbflush.h
      07f8ba74
    • Palmer Dabbelt's avatar
      RISC-V Atomic Cleanups · f8182f61
      Palmer Dabbelt authored
      This patch set is the result of some feedback that filtered through
      after our original patch set was reviewed, some of which was the result
      of me missing some email.  It contains:
      
      * A new READ_ONCE in arch_spin_is_locked()
      * __test_and_op_bit_ord() is now actually ordered
      * Improvements to various comments
      * Removal of some dead code
      f8182f61
    • Palmer Dabbelt's avatar
      RISC-V: __io_writes should respect the length argument · da894ff1
      Palmer Dabbelt authored
      Whoops -- I must have just been being an idiot again.  Thanks to Segher
      for finding the bug :).
      
      CC: Segher Boessenkool <segher@kernel.crashing.org>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      da894ff1
    • Christoph Hellwig's avatar
      move libgcc.h to include/linux · 4db2b604
      Christoph Hellwig authored
      Introducing a new include/lib directory just for this file totally
      messes up tab completion for include/linux, which is highly annoying.
      
      Move it to include/linux where we have headers for all kinds of other
      lib/ code as well.
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarPalmer Dabbelt <palmer@sifive.com>
      4db2b604
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · a0651c7f
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
       "Two fixes for nasty kexec/kdump crashes in certain configurations.
      
        A couple of minor fixes for the new TIDR code.
      
        A fix for an oops in a CXL error handling path.
      
        Thanks to: Andrew Donnellan, Christophe Lombard, David Gibson, Mahesh
        Salgaonkar, Vaibhav Jain"
      
      * tag 'powerpc-4.15-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc: Do not assign thread.tidr if already assigned
        powerpc: Avoid signed to unsigned conversion in set_thread_tidr()
        powerpc/kexec: Fix kexec/kdump in P9 guest kernels
        powerpc/powernv: Fix kexec crashes caused by tlbie tracing
        cxl: Check if vphb exists before iterating over AFU devices
      a0651c7f
    • Linus Torvalds's avatar
      Merge tag 'afs-fixes-20171201' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs · ae753ee2
      Linus Torvalds authored
      Pull AFS fixes from David Howells:
       "Two fix patches for the AFS filesystem:
      
         - Fix the refcounting on permit caching.
      
         - AFS inode (afs_vnode) fields need resetting after allocation
           because they're only initialised when slab pages are obtained from
           the page allocator"
      
      * tag 'afs-fixes-20171201' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        afs: Properly reset afs_vnode (inode) fields
        afs: Fix permit refcounting
      ae753ee2
    • Linus Torvalds's avatar
      Merge tag 'mmc-v4.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 3c1c4ddf
      Linus Torvalds authored
      Pull MMC fixes from Ulf Hansson:
       "MMC core:
         - Ensure that debugfs files are removed properly
         - Fix missing blk_put_request()
         - Deal with errors from blk_get_request()
         - Rewind mmc bus suspend operations at failures
         - Prepend '0x' to ocr and pre_eol_info in sysfs to identify as hex
      
        MMC host:
         - sdhci-msm: Make it optional to wait for signal level changes
         - sdhci: Avoid swiotlb buffer being full"
      
      * tag 'mmc-v4.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: core: prepend 0x to OCR entry in sysfs
        mmc: core: prepend 0x to pre_eol_info entry in sysfs
        mmc: sdhci: Avoid swiotlb buffer being full
        mmc: sdhci-msm: Optionally wait for signal level changes
        mmc: block: Ensure that debugfs files are removed
        mmc: core: Do not leave the block driver in a suspended state
        mmc: block: Check return value of blk_get_request()
        mmc: block: Fix missing blk_put_request()
      3c1c4ddf
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-for-v4.15-rc2' of git://people.freedesktop.org/~airlied/linux · 5dc9cbc4
      Linus Torvalds authored
      Pull drm fixes and cleanups from Dave Airlie:
       "The main thing are a bunch of fixes for the new amd display code, a
        bunch of smatch fixes.
      
        core:
         - Atomic helper regression fix.
         - Deferred fbdev fallout regression fix.
      
        amdgpu:
         - New display code (dc) dpms, suspend/resume and smatch fixes, along
           with some others
         - Some regression fixes for amdkfd/radeon.
         - Fix a ttm regression for swiotlb disabled
      
        bridge:
         - A bunch of fixes for the tc358767 bridge
      
        mali-dp + hdlcd:
         - some fixes and internal API catchups.
      
        imx-drm:
         -regression fix in atomic code.
      
        omapdrm:
         - platform detection regression fixes"
      
      * tag 'drm-fixes-for-v4.15-rc2' of git://people.freedesktop.org/~airlied/linux: (76 commits)
        drm/imx: always call wait_for_flip_done in commit_tail
        omapdrm: hdmi4_cec: signedness bug in hdmi4_cec_init()
        drm: omapdrm: Fix DPI on platforms using the DSI VDDS
        omapdrm: hdmi4: Correct the SoC revision matching
        drm/omap: displays: panel-dpi: add backlight dependency
        drm/omap: Fix error handling path in 'omap_dmm_probe()'
        drm/i915: Disable THP until we have a GPU read BW W/A
        drm/bridge: tc358767: fix 1-lane behavior
        drm/bridge: tc358767: fix AUXDATAn registers access
        drm/bridge: tc358767: fix timing calculations
        drm/bridge: tc358767: fix DP0_MISC register set
        drm/bridge: tc358767: filter out too high modes
        drm/bridge: tc358767: do no fail on hi-res displays
        drm/bridge: Fix lvds-encoder since the panel_bridge rework.
        drm/bridge: synopsys/dw-hdmi: Enable cec clock
        drm/bridge: adv7511/33: Fix adv7511_cec_init() failure handling
        drm/radeon: remove init of CIK VMIDs 8-16 for amdkfd
        drm/ttm: fix populate_and_map() functions once more
        drm/fb_helper: Disable all crtc's when initial setup fails.
        drm/atomic: make drm_atomic_helper_wait_for_vblanks more agressive
        ...
      5dc9cbc4
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 75f64f68
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "A selection of fixes/changes that should make it into this series.
        This contains:
      
         - NVMe, two merges, containing:
              - pci-e, rdma, and fc fixes
              - Device quirks
      
         - Fix for a badblocks leak in null_blk
      
         - bcache fix from Rui Hua for a race condition regression where
           -EINTR was returned to upper layers that didn't expect it.
      
         - Regression fix for blktrace for a bug introduced in this series.
      
         - blktrace cleanup for cgroup id.
      
         - bdi registration error handling.
      
         - Small series with cleanups for blk-wbt.
      
         - Various little fixes for typos and the like.
      
        Nothing earth shattering, most important are the NVMe and bcache fixes"
      
      * 'for-linus' of git://git.kernel.dk/linux-block: (34 commits)
        nvme-pci: fix NULL pointer dereference in nvme_free_host_mem()
        nvme-rdma: fix memory leak during queue allocation
        blktrace: fix trace mutex deadlock
        nvme-rdma: Use mr pool
        nvme-rdma: Check remotely invalidated rkey matches our expected rkey
        nvme-rdma: wait for local invalidation before completing a request
        nvme-rdma: don't complete requests before a send work request has completed
        nvme-rdma: don't suppress send completions
        bcache: check return value of register_shrinker
        bcache: recover data from backing when data is clean
        bcache: Fix building error on MIPS
        bcache: add a comment in journal bucket reading
        nvme-fc: don't use bit masks for set/test_bit() numbers
        blk-wbt: fix comments typo
        blk-wbt: move wbt_clear_stat to common place in wbt_done
        blk-sysfs: remove NULL pointer checking in queue_wb_lat_store
        blk-wbt: remove duplicated setting in wbt_init
        nvme-pci: add quirk for delay before CHK RDY for WDC SN200
        block: remove useless assignment in bio_split
        null_blk: fix dev->badblocks leak
        ...
      75f64f68
    • Will Deacon's avatar
      arm64: context: Fix comments and remove pointless smp_wmb() · 3a33c760
      Will Deacon authored
      The comments in the ASID allocator incorrectly hint at an MP-style idiom
      using the asid_generation and the active_asids array. In fact, the
      synchronisation is achieved using a combination of an xchg operation
      and a spinlock, so update the comments and remove the pointless smp_wmb().
      
      Cc: James Morse <james.morse@arm.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      3a33c760
    • Yury Norov's avatar
      arm64: cpu_ops: Add missing 'const' qualifiers · 770ba060
      Yury Norov authored
      Building the kernel with an LTO-enabled GCC spits out the following "const"
      warning for the cpu_ops code:
      
        mm/percpu.c:2168:20: error: pcpu_fc_names causes a section type conflict
        with dt_supported_cpu_ops
        const char * const pcpu_fc_names[PCPU_FC_NR] __initconst = {
                ^
        arch/arm64/kernel/cpu_ops.c:34:37: note: ‘dt_supported_cpu_ops’ was declared here
        static const struct cpu_operations *dt_supported_cpu_ops[] __initconst = {
      
      Fix it by adding missed const qualifiers.
      Signed-off-by: default avatarYury Norov <ynorov@caviumnetworks.com>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      770ba060
    • Xu YiPing's avatar
      arm64: perf: remove unsupported events for Cortex-A73 · f8ada189
      Xu YiPing authored
      bus access read/write events are not supported in A73, based on the
      Cortex-A73 TRM r0p2, section 11.9 Events (pages 11-457 to 11-460).
      
      Fixes: 5561b6c5 "arm64: perf: add support for Cortex-A73"
      Acked-by: default avatarJulien Thierry <julien.thierry@arm.com>
      Signed-off-by: default avatarXu YiPing <xuyiping@hisilicon.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      f8ada189
    • Dave Martin's avatar
      arm64: fpsimd: Fix failure to restore FPSIMD state after signals · 9de52a75
      Dave Martin authored
      The fpsimd_update_current_state() function is responsible for
      loading the FPSIMD state from the user signal frame into the
      current task during sigreturn.  When implementing support for SVE,
      conditional code was added to this function in order to handle the
      case where SVE state need to be loaded for the task and merged with
      the FPSIMD data from the signal frame; however, the FPSIMD-only
      case was unintentionally dropped.
      
      As a result of this, sigreturn does not currently restore the
      FPSIMD state of the task, except in the case where the system
      supports SVE and the signal frame contains SVE state in addition to
      FPSIMD state.
      
      This patch fixes this bug by making the copy-in of the FPSIMD data
      from the signal frame to thread_struct unconditional.
      
      This remains a performance regression from v4.14, since the FPSIMD
      state is now copied into thread_struct and then loaded back,
      instead of _only_ being loaded into the CPU FPSIMD registers.
      However, it is essential to call task_fpsimd_load() here anyway in
      order to ensure that the SVE enable bit in CPACR_EL1 is set
      correctly before returning to userspace.  This could use some
      refactoring, but since sigreturn is not a fast path I have kept
      this patch as a pure fix and left the refactoring for later.
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Fixes: 8cd969d2 ("arm64/sve: Signal handling support")
      Reported-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Tested-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
      Signed-off-by: default avatarDave Martin <Dave.Martin@arm.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      9de52a75
    • Jinbum Park's avatar
      arm64: pgd: Mark pgd_cache as __ro_after_init · a349b302
      Jinbum Park authored
      pgd_cache is setup once while init stage and never changed after
      that, so it is good candidate for __ro_after_init
      Signed-off-by: default avatarJinbum Park <jinb.park7@gmail.com>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      a349b302
    • Ard Biesheuvel's avatar
      arm64: ftrace: emit ftrace-mod.o contents through code · be0f272b
      Ard Biesheuvel authored
      When building the arm64 kernel with both CONFIG_ARM64_MODULE_PLTS and
      CONFIG_DYNAMIC_FTRACE enabled, the ftrace-mod.o object file is built
      with the kernel and contains a trampoline that is linked into each
      module, so that modules can be loaded far away from the kernel and
      still reach the ftrace entry point in the core kernel with an ordinary
      relative branch, as is emitted by the compiler instrumentation code
      dynamic ftrace relies on.
      
      In order to be able to build out of tree modules, this object file
      needs to be included into the linux-headers or linux-devel packages,
      which is undesirable, as it makes arm64 a special case (although a
      precedent does exist for 32-bit PPC).
      
      Given that the trampoline essentially consists of a PLT entry, let's
      not bother with a source or object file for it, and simply patch it
      in whenever the trampoline is being populated, using the existing
      PLT support routines.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      be0f272b
    • Ard Biesheuvel's avatar
      arm64: module-plts: factor out PLT generation code for ftrace · 7e8b9c1d
      Ard Biesheuvel authored
      To allow the ftrace trampoline code to reuse the PLT entry routines,
      factor it out and move it into asm/module.h.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      7e8b9c1d