1. 09 Apr, 2016 2 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus-4.6-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux · 67592126
      Linus Torvalds authored
      Pull orangefs fixes from Mike Marshall:
       "Orangefs cleanups and a strncpy vulnerability fix.
      
        Cleanups:
         - remove an unused variable from orangefs_readdir.
         - clean up printk wrapper used for ofs "gossip" debugging.
         - clean up truncate ctime and mtime setting in inode.c
         - remove a useless null check found by coccinelle.
         - optimize some memcpy/memset boilerplate code.
         - remove some useless sanity checks from xattr.c
      
        Fix:
         - fix a potential strncpy vulnerability"
      
      * tag 'for-linus-4.6-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
        orangefs: remove unused variable
        orangefs: Add KERN_<LEVEL> to gossip_<level> macros
        orangefs: strncpy -> strscpy
        orangefs: clean up truncate ctime and mtime setting
        Orangefs: fix ifnullfree.cocci warnings
        Orangefs: optimize boilerplate code.
        Orangefs: xattr.c cleanup
      67592126
    • Linus Torvalds's avatar
      Merge tag 'iommu-fixes-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 1a59c539
      Linus Torvalds authored
      Pull IOMMU fixes from Joerg Roedel:
      
       - compile-time fixes (warnings and failures)
      
       - a bug in iommu core code which could cause the group->domain pointer
         to be falsly cleared
      
       - fix in scatterlist handling of the ARM common DMA-API code
      
       - stall detection fix for the Rockchip IOMMU driver
      
      * tag 'iommu-fixes-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/vt-d: Silence an uninitialized variable warning
        iommu/rockchip: Fix "is stall active" check
        iommu: Don't overwrite domain pointer when there is no default_domain
        iommu/dma: Restore scatterlist offsets correctly
        iommu: provide of_xlate pointer unconditionally
      1a59c539
  2. 08 Apr, 2016 9 commits
    • Martin Brandenburg's avatar
      e56f4981
    • Joe Perches's avatar
      orangefs: Add KERN_<LEVEL> to gossip_<level> macros · 1917a693
      Joe Perches authored
      Emit the logging messages at the appropriate levels.
      
      Miscellanea:
      
      o Change format to fmt
      o Use the more common ##__VA_ARGS__
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
      1917a693
    • Martin Brandenburg's avatar
      orangefs: strncpy -> strscpy · 2eacea74
      Martin Brandenburg authored
      It would have been possible for a rogue client-core to send in a symlink
      target which is not NUL terminated. This returns EIO if the client-core
      gives us corrupt data.
      
      Leave debugfs and superblock code as is for now.
      
      Other dcache.c and namei.c strncpy instances are safe because
      ORANGEFS_NAME_MAX = NAME_MAX + 1; there is always enough space for a
      name plus a NUL byte.
      Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
      Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
      2eacea74
    • Martin Brandenburg's avatar
      orangefs: clean up truncate ctime and mtime setting · f83140c1
      Martin Brandenburg authored
      The ctime and mtime are always updated on a successful ftruncate and
      only updated on a successful truncate where the size changed.
      
      We handle the ``if the size changed'' bit.
      
      This matches FUSE's behavior.
      Signed-off-by: default avatarMartin Brandenburg <martin@omnibond.com>
      Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
      f83140c1
    • kbuild test robot's avatar
      Orangefs: fix ifnullfree.cocci warnings · 2fa37fd7
      kbuild test robot authored
      fs/orangefs/orangefs-debugfs.c:130:2-26: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.
      
       NULL check before some freeing functions is not needed.
      
       Based on checkpatch warning
       "kfree(NULL) is safe this check is probably not required"
       and kfreeaddr.cocci by Julia Lawall.
      
      Generated by: scripts/coccinelle/free/ifnullfree.cocci
      Signed-off-by: default avatarFengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
      2fa37fd7
    • Mike Marshall's avatar
      Orangefs: optimize boilerplate code. · a9bb3ba8
      Mike Marshall authored
      Suggested by David Binderman <dcb314@hotmail.com>
      The former can potentially be a performance win over the latter.
      
      memcpy(d, s, len);
      memset(d+len, c, size-len);
      
      memset(d, c, size);
      memcpy(d, s, len);
      Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
      a9bb3ba8
    • Mike Marshall's avatar
      Orangefs: xattr.c cleanup · 2d09a2ca
      Mike Marshall authored
      1. It is nonsense to test for negative size_t, suggested by
         David Binderman <dcb314@hotmail.com>
      
      2. By the time Orangefs gets called, the vfs has ensured that
         name != NULL, and that buffer and size are sane.
      Signed-off-by: default avatarMike Marshall <hubcap@omnibond.com>
      2d09a2ca
    • Bart Van Assche's avatar
      Revert "ib_srpt: Convert to percpu_ida tag allocation" · 3c968887
      Bart Van Assche authored
      This reverts commit 0fd10721.
      
      That patch causes the ib_srpt driver to crash as soon as the first SCSI
      command is received:
      
        kernel BUG at drivers/infiniband/ulp/srpt/ib_srpt.c:1439!
        invalid opcode: 0000 [#1] SMP
        Workqueue: target_completion target_complete_ok_work [target_core_mod]
        RIP: srpt_queue_response+0x437/0x4a0 [ib_srpt]
        Call Trace:
          srpt_queue_data_in+0x9/0x10 [ib_srpt]
          target_complete_ok_work+0x152/0x2b0 [target_core_mod]
          process_one_work+0x197/0x480
          worker_thread+0x49/0x490
          kthread+0xea/0x100
          ret_from_fork+0x22/0x40
      
      Aside from the crash, the shortcomings of that patch are as follows:
      
       - It makes the ib_srpt driver use I/O contexts allocated by
         transport_alloc_session_tags() but it does not initialize these I/O
         contexts properly.  All the initializations performed by
         srpt_alloc_ioctx() are skipped.
      
       - It swaps the order of the send ioctx allocation and the transition to
         RTR mode which is wrong.
      
       - The amount of memory that is needed for I/O contexts is doubled.
      
       - srpt_rdma_ch.free_list is no longer used but is not removed.
      Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Nicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3c968887
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 93061f39
      Linus Torvalds authored
      Pull ext4 bugfixes from Ted Ts'o:
       "These changes contains a fix for overlayfs interacting with some
        (badly behaved) dentry code in various file systems.  These have been
        reviewed by Al and the respective file system mtinainers and are going
        through the ext4 tree for convenience.
      
        This also has a few ext4 encryption bug fixes that were discovered in
        Android testing (yes, we will need to get these sync'ed up with the
        fs/crypto code; I'll take care of that).  It also has some bug fixes
        and a change to ignore the legacy quota options to allow for xfstests
        regression testing of ext4's internal quota feature and to be more
        consistent with how xfs handles this case"
      
      * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: ignore quota mount options if the quota feature is enabled
        ext4 crypto: fix some error handling
        ext4: avoid calling dquot_get_next_id() if quota is not enabled
        ext4: retry block allocation for failed DIO and DAX writes
        ext4: add lockdep annotations for i_data_sem
        ext4: allow readdir()'s of large empty directories to be interrupted
        btrfs: fix crash/invalid memory access on fsync when using overlayfs
        ext4 crypto: use dget_parent() in ext4_d_revalidate()
        ext4: use file_dentry()
        ext4: use dget_parent() in ext4_file_open()
        nfs: use file_dentry()
        fs: add file_dentry()
        ext4 crypto: don't let data integrity writebacks fail with ENOMEM
        ext4: check if in-inode xattr is corrupted in ext4_expand_extra_isize_ea()
      93061f39
  3. 07 Apr, 2016 11 commits
  4. 06 Apr, 2016 7 commits
    • Dave Airlie's avatar
      Merge branch 'drm-fixes-4.6' of git://people.freedesktop.org/~agd5f/linux into drm-fixes · fd8c61eb
      Dave Airlie authored
      Lots of misc bug fixes for radeon and amdgpu and one for ttm.
      - fix vram info fetching on Fiji and unposted boards
      - additional vblank fixes from the conversion to drm_vblank_on/off
      - UVD dGPU suspend and resume fixes
      - lots of powerplay fixes
      - fix a fence leak in the pageflip code
      - ttm fix for platforms where CPU is 32 bit, but physical addresses are >32bits
      
      * 'drm-fixes-4.6' of git://people.freedesktop.org/~agd5f/linux: (21 commits)
        drm/amdgpu: total vram size also reduces pin size
        drm/amd/powerplay: add uvd/vce dpm enabling flag default.
        drm/amd/powerplay: fix issue that resume back, dpm can't work on FIJI.
        drm/amdgpu: save and restore the firwmware cache part when suspend resume
        drm/amdgpu: save and restore UVD context with suspend and resume
        drm/ttm: use phys_addr_t for ttm_bus_placement
        drm/radeon: Only call drm_vblank_on/off between drm_vblank_init/cleanup
        drm/amdgpu: fence wait old rcu slot
        drm/amdgpu: fix leaking fence in the pageflip code
        drm/amdgpu: print vram type rather than just DDR
        drm/amdgpu/gmc: use proper register for vram type on Fiji
        drm/amdgpu/gmc: move vram type fetching into sw_init
        drm/amdgpu: Set vblank_disable_allowed = true
        drm/radeon: Set vblank_disable_allowed = true
        drm/amd/powerplay: Need to change boot to performance state in resume.
        drm/amd/powerplay: add new Fiji function for not setting same ps.
        drm/amdgpu: check dpm state before pm system fs initialized.
        drm/amd/powerplay: notify amdgpu whether dpm is enabled or not.
        drm/amdgpu: Not support disable dpm in powerplay.
        drm/amdgpu: add an cgs interface to notify amdgpu the dpm state.
        ...
      fd8c61eb
    • Linus Torvalds's avatar
      x86: remove the kernel code/data/bss resources from /proc/iomem · c4004b02
      Linus Torvalds authored
      Let's see if anybody even notices.  I doubt anybody uses this, and it
      does expose addresses that should be randomized, so let's just remove
      the code.  It's old and traditional, and it used to be cute, but we
      should have removed this long ago.
      
      If it turns out anybody notices and this breaks something, we'll have to
      revert this, and maybe we'll end up using other approaches instead
      (using %pK or similar).  But removing unnecessary code is always the
      preferred option.
      Noted-by: default avatarEmrah Demir <ed@abdsec.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c4004b02
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma · 9cb5b787
      Linus Torvalds authored
      Pull rdma fixes from Doug Ledford:
       "I'm back from PTO.  These issues cropped up while I was gone and are
        simple fixes.  I'll have more after I've caught up, but I wanted to
        get these in quick.
      
        Two minor fixes for 4.6-rc2:
      
         - Fix mlx5 build error when on demand paging is not enabled
      
         - Fix possible uninit variable in new i40iw driver"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma:
        i40iw: avoid potential uninitialized variable use
        IB/mlx5: fix VFs callback function prototypes
      9cb5b787
    • Arnd Bergmann's avatar
      i40iw: avoid potential uninitialized variable use · 2fe78571
      Arnd Bergmann authored
      gcc finds that the i40iw_make_cm_node() function in the recently added
      i40iw driver uses an uninitilized variable as an index into an array
      if CONFIG_IPV6 is disabled and the driver uses IPv6 mode:
      
      drivers/infiniband/hw/i40iw/i40iw_cm.c: In function 'i40iw_make_cm_node':
      drivers/infiniband/hw/i40iw/i40iw_cm.c:2206:52: error: 'arpindex' may be used uninitialized in this function [-Werror=maybe-uninitialized]
        ether_addr_copy(cm_node->rem_mac, iwdev->arp_table[arpindex].mac_addr);
      
      As far as I can tell, this code path can not be used because the ipv4
      variable is always set with CONFIG_IPV6 is disabled, but it's better
      to be sure and prevent the undefined behavior, as well as shut up
      that warning in a proper way.
      
      This adds an 'else' clause for the case we get the warning about,
      causing the function to return an error in a controlled way.
      To avoid adding extra mess with combined io()/#ifdef clauses,
      I'm also converting the existing #ifdef into a more readable
      if(IS_ENABLED()) check.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: f27b4746 ("i40iw: add connection management code")
      Acked-by: default avatarMustafa Ismail <Mustafa.ismail@intel.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      2fe78571
    • Arnd Bergmann's avatar
      IB/mlx5: fix VFs callback function prototypes · 9967c70a
      Arnd Bergmann authored
      The previous patch that added a couple of callback functions put
      the declarations inside of an #ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING,
      which causes the build to fail if that option is disabled:
      
      drivers/infiniband/hw/mlx5/main.c: In function 'mlx5_ib_add':
      drivers/infiniband/hw/mlx5/main.c:2358:31: error: 'mlx5_ib_get_vf_config' undeclared (first use in this function)
      
      This moves the four declarations below the #ifdef section so they
      are always available.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Fixes: eff901d3 ("IB/mlx5: Implement callbacks for manipulating VFs")
      Reviewed-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Reviewed-by: default avatarEli Cohen <eli@mellanox.com>
      Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
      9967c70a
    • Dave Airlie's avatar
      Merge branch 'linux-4.6' of git://github.com/skeggsb/linux into drm-fixes · 30aab189
      Dave Airlie authored
      Just a single fix to prevent GM20B systems hanging at boot.
      
      * 'linux-4.6' of git://github.com/skeggsb/linux:
        drm/nouveau/tegra: acquire and enable reference clock if needed
      30aab189
    • Alexandre Courbot's avatar
      drm/nouveau/tegra: acquire and enable reference clock if needed · 34440ed6
      Alexandre Courbot authored
      GM20B requires an extra clock compared to GK20A. Add that information
      into the platform data and acquire and enable this clock if necessary.
      Signed-off-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
      34440ed6
  5. 05 Apr, 2016 11 commits
    • Dave Airlie's avatar
      Merge branch 'for-upstream/hdlcd' of git://linux-arm.org/linux-ld into drm-fixes · 4cf43e0e
      Dave Airlie authored
      arm hdlcd fix.
      * 'for-upstream/hdlcd' of git://linux-arm.org/linux-ld:
        drm: ARM HDLCD - fix an error code
        drm: ARM HDLCD - get rid of devm_clk_put()
      4cf43e0e
    • Dave Airlie's avatar
      Merge tag 'imx-drm-next-2016-04-01' of git://git.pengutronix.de/git/pza/linux into drm-fixes · 915e846d
      Dave Airlie authored
      imx-drm: stricter plane parameter checking, dw_hdmi-imx and dmfc fixes
      
      - Check whether plane parameters comply with IPU IDMAC limitations and
        fix planar YUV 4:2:0 U/V offsets and stride
      - Cleanup encoder in dw_hdmi-imx bind error path and
        remove a superfluous platform_set_drvdata in dw_hdmi-imx
      - DMFC setup fixes: lock the ipu_dmfc_init_channel function against
        concurrent use, rename it to ipu_dmfc_config_wait4eot, and call
        it after the FIFO size has been determined.
      
      * tag 'imx-drm-next-2016-04-01' of git://git.pengutronix.de/git/pza/linux:
        drm/imx: Don't set a gamma table size
        drm/imx: ipuv3-plane: Configure DMFC wait4eot bit after slots are determined
        gpu: ipu-v3: ipu-dmfc: Rename ipu_dmfc_init_channel to ipu_dmfc_config_wait4eot
        gpu: ipu-v3: ipu-dmfc: Make function ipu_dmfc_init_channel() return void
        gpu: ipu-v3: ipu-dmfc: Protect function ipu_dmfc_init_channel() with mutex
        drm/imx: dw_hdmi: Don't call platform_set_drvdata()
        drm/imx: dw_hdmi: Call drm_encoder_cleanup() in error path
        drm/imx: ipuv3-plane: fix planar YUV 4:2:0 support
        drm/imx: ipuv3-plane: Add more thorough checks for plane parameter limitations
        gpu: ipu-cpmem: modify ipu_cpmem_set_yuv_planar_full for better control
      915e846d
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 541d8f4d
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "Miscellaneous bugfixes.
      
        The ARM and s390 fixes are for new regressions from the merge window,
        others are usual stable material"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        compiler-gcc: disable -ftracer for __noclone functions
        kvm: x86: make lapic hrtimer pinned
        s390/mm/kvm: fix mis-merge in gmap handling
        kvm: set page dirty only if page has been writable
        KVM: x86: reduce default value of halt_poll_ns parameter
        KVM: Hyper-V: do not do hypercall userspace exits if SynIC is disabled
        KVM: x86: Inject pending interrupt even if pending nmi exist
        arm64: KVM: Register CPU notifiers when the kernel runs at HYP
        arm64: kvm: 4.6-rc1: Fix VTCR_EL2 VS setting
      541d8f4d
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · 5003bc6c
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A couple of driver specific fixes here that came in since the merge
        window plus one core fix for locking in cases where a client driver
        grabs a lock on the whole bus for an extended series of operations
        that was introduced by the changes to support accelerated flash
        operations"
      
      * tag 'spi-fix-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: rockchip: fix probe deferral handling
        spi: omap2-mcspi: fix dma transfer for vmalloced buffer
        spi: fix possible deadlock between internal bus locks and bus_lock_flag
        spi: imx: Fix possible NULL pointer deref
        spi: imx: only do necessary changes to ECSPIx_CONFIGREG
        spi: rockchip: Spelling s/divsor/divisor/
      5003bc6c
    • David Disseldorp's avatar
      rbd: use GFP_NOIO consistently for request allocations · 2224d879
      David Disseldorp authored
      As of 5a60e876, RBD object request
      allocations are made via rbd_obj_request_create() with GFP_NOIO.
      However, subsequent OSD request allocations in rbd_osd_req_create*()
      use GFP_ATOMIC.
      
      With heavy page cache usage (e.g. OSDs running on same host as krbd
      client), rbd_osd_req_create() order-1 GFP_ATOMIC allocations have been
      observed to fail, where direct reclaim would have allowed GFP_NOIO
      allocations to succeed.
      
      Cc: stable@vger.kernel.org # 3.18+
      Suggested-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Suggested-by: default avatarNeil Brown <neilb@suse.com>
      Signed-off-by: default avatarDavid Disseldorp <ddiss@suse.de>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      2224d879
    • Chunming Zhou's avatar
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 1b5caa3e
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
       "Here is a set of pin control fixes for the v4.6 series.
      
        A bit bigger than what I hoped for, but all fixes are confined to
        drivers, a few of them also targeted to stable.
      
        Summary:
      
         - On Super-H PFC (Renesas) controllers: only use dummies on legacy
           systems.  This fixes a serious ethernet regression on a Renesas
           board.
         - Pistachio: Fix errors in the pin table.
         - Allwinner SunXi: fix the external interrupts to work.
         - Intel: fix so the high level interrupts start working, and fix a
           spurious interrupt issue.
         - Qualcomm ipq4019: fix the number of GPIOs provided (bump to 100),
           correct register offsets and handle GPIO mode properly.
         - Revert the revert on the revert so that Xway has a .to_irq()
           callback again.
         - Minor fixes to errorpaths and debug info.
         - A MAINTAINERS update"
      
      * tag 'pinctrl-v4.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        Revert "Revert "pinctrl: lantiq: Implement gpio_chip.to_irq""
        pinctrl: qcom: ipq4019: fix register offsets
        pinctrl: qcom: ipq4019: fix the function enum for gpio mode
        pinctrl: qcom: ipq4019: set ngpios to correct value
        pinctrl: nomadik: fix pull debug print inversion
        MAINTAINERS: pinctrl: samsung: Add two new maintainers
        pinctrl: intel: implement gpio_irq_enable
        pinctrl: intel: make the high level interrupt working
        pinctrl: freescale: imx: fix bogus check of of_iomap() return value
        pinctrl: sunxi: Fix A33 external interrupts not working
        pinctrl: pistachio: fix mfio84-89 function description and pinmux.
        pinctrl: sh-pfc: only use dummy states for non-DT platforms
      1b5caa3e
    • Linus Torvalds's avatar
      Merge tag 'media/v4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media · 62d2def9
      Linus Torvalds authored
      Pull media fixes from Mauro Carvalho Chehab:
       "Some bug fixes on au0828 and snd-usb-audio:
      
         - the au0828+snd-usb-audio MC patch broke several things and produced
           some race conditions.  Better to revert the patches, and re-work on
           them for a next version
      
         - fix a regression at tuner disable links logic
      
         - properly handle dev_state as a bitmask"
      
      * tag 'media/v4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
        [media] Revert "[media] media: au0828 change to use Managed Media Controller API"
        [media] Revert "[media] sound/usb: Use Media Controller API to share media resources"
        [media] au0828: Fix dev_state handling
        [media] au0828: fix au0828_v4l2_close() dev_state race condition
        [media] media: au0828 fix to clear enable/disable/change source handlers
        [media] v4l2-mc: cleanup a warning
        [media] au0828: disable tuner links and cache tuner/decoder
      62d2def9
    • Robin Murphy's avatar
      iommu/dma: Restore scatterlist offsets correctly · 07b48ac4
      Robin Murphy authored
      With the change to stashing just the IOVA-page-aligned remainder of the
      CPU-page offset rather than the whole thing, the failure path in
      __invalidate_sg() also needs tweaking to account for that in the case of
      differing page sizes where the two offsets may not be equivalent.
      Similarly in __finalise_sg(), lest the architecture-specific wrappers
      later get the wrong address for cache maintenance on sync or unmap.
      
      Fixes: 164afb1d ("iommu/dma: Use correct offset in map_sg")
      Reported-by: default avatarMagnus Damm <damm+renesas@opensource.se>
      Signed-off-by: default avatarRobin Murphy <robin.murphy@arm.com>
      Cc: stable@ver.kernel.org # v4.4+
      Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
      07b48ac4
    • Paolo Bonzini's avatar
      compiler-gcc: disable -ftracer for __noclone functions · 95272c29
      Paolo Bonzini authored
      -ftracer can duplicate asm blocks causing compilation to fail in
      noclone functions.  For example, KVM declares a global variable
      in an asm like
      
          asm("2: ... \n
               .pushsection data \n
               .global vmx_return \n
               vmx_return: .long 2b");
      
      and -ftracer causes a double declaration.
      
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Michal Marek <mmarek@suse.cz>
      Cc: stable@vger.kernel.org
      Cc: kvm@vger.kernel.org
      Reported-by: default avatarLinda Walsh <lkml@tlinx.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      95272c29
    • Luiz Capitulino's avatar
      kvm: x86: make lapic hrtimer pinned · 61abdbe0
      Luiz Capitulino authored
      When a vCPU runs on a nohz_full core, the hrtimer used by
      the lapic emulation code can be migrated to another core.
      When this happens, it's possible to observe milisecond
      latency when delivering timer IRQs to KVM guests.
      
      The huge latency is mainly due to the fact that
      apic_timer_fn() expects to run during a kvm exit. It
      sets KVM_REQ_PENDING_TIMER and let it be handled on kvm
      entry. However, if the timer fires on a different core,
      we have to wait until the next kvm exit for the guest
      to see KVM_REQ_PENDING_TIMER set.
      
      This problem became visible after commit 9642d18e. This
      commit changed the timer migration code to always attempt
      to migrate timers away from nohz_full cores. While it's
      discussable if this is correct/desirable (I don't think
      it is), it's clear that the lapic emulation code has
      a requirement on firing the hrtimer in the same core
      where it was started. This is achieved by making the
      hrtimer pinned.
      
      Lastly, note that KVM has code to migrate timers when a
      vCPU is scheduled to run in different core. However, this
      forced migration may fail. When this happens, we can have
      the same problem. If we want 100% correctness, we'll have
      to modify apic_timer_fn() to cause a kvm exit when it runs
      on a different core than the vCPU. Not sure if this is
      possible.
      
      Here's a reproducer for the issue being fixed:
      
       1. Set all cores but core0 to be nohz_full cores
       2. Start a guest with a single vCPU
       3. Trace apic_timer_fn() and kvm_inject_apic_timer_irqs()
      
      You'll see that apic_timer_fn() will run in core0 while
      kvm_inject_apic_timer_irqs() runs in a different core. If
      you get both on core0, try running a program that takes 100%
      of the CPU and pin it to core0 to force the vCPU out.
      Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      61abdbe0