1. 03 Mar, 2017 2 commits
    • David Howells's avatar
      statx: Add a system call to make enhanced file info available · a528d35e
      David Howells authored
      Add a system call to make extended file information available, including
      file creation and some attribute flags where available through the
      underlying filesystem.
      
      The getattr inode operation is altered to take two additional arguments: a
      u32 request_mask and an unsigned int flags that indicate the
      synchronisation mode.  This change is propagated to the vfs_getattr*()
      function.
      
      Functions like vfs_stat() are now inline wrappers around new functions
      vfs_statx() and vfs_statx_fd() to reduce stack usage.
      
      ========
      OVERVIEW
      ========
      
      The idea was initially proposed as a set of xattrs that could be retrieved
      with getxattr(), but the general preference proved to be for a new syscall
      with an extended stat structure.
      
      A number of requests were gathered for features to be included.  The
      following have been included:
      
       (1) Make the fields a consistent size on all arches and make them large.
      
       (2) Spare space, request flags and information flags are provided for
           future expansion.
      
       (3) Better support for the y2038 problem [Arnd Bergmann] (tv_sec is an
           __s64).
      
       (4) Creation time: The SMB protocol carries the creation time, which could
           be exported by Samba, which will in turn help CIFS make use of
           FS-Cache as that can be used for coherency data (stx_btime).
      
           This is also specified in NFSv4 as a recommended attribute and could
           be exported by NFSD [Steve French].
      
       (5) Lightweight stat: Ask for just those details of interest, and allow a
           netfs (such as NFS) to approximate anything not of interest, possibly
           without going to the server [Trond Myklebust, Ulrich Drepper, Andreas
           Dilger] (AT_STATX_DONT_SYNC).
      
       (6) Heavyweight stat: Force a netfs to go to the server, even if it thinks
           its cached attributes are up to date [Trond Myklebust]
           (AT_STATX_FORCE_SYNC).
      
      And the following have been left out for future extension:
      
       (7) Data version number: Could be used by userspace NFS servers [Aneesh
           Kumar].
      
           Can also be used to modify fill_post_wcc() in NFSD which retrieves
           i_version directly, but has just called vfs_getattr().  It could get
           it from the kstat struct if it used vfs_xgetattr() instead.
      
           (There's disagreement on the exact semantics of a single field, since
           not all filesystems do this the same way).
      
       (8) BSD stat compatibility: Including more fields from the BSD stat such
           as creation time (st_btime) and inode generation number (st_gen)
           [Jeremy Allison, Bernd Schubert].
      
       (9) Inode generation number: Useful for FUSE and userspace NFS servers
           [Bernd Schubert].
      
           (This was asked for but later deemed unnecessary with the
           open-by-handle capability available and caused disagreement as to
           whether it's a security hole or not).
      
      (10) Extra coherency data may be useful in making backups [Andreas Dilger].
      
           (No particular data were offered, but things like last backup
           timestamp, the data version number and the DOS archive bit would come
           into this category).
      
      (11) Allow the filesystem to indicate what it can/cannot provide: A
           filesystem can now say it doesn't support a standard stat feature if
           that isn't available, so if, for instance, inode numbers or UIDs don't
           exist or are fabricated locally...
      
           (This requires a separate system call - I have an fsinfo() call idea
           for this).
      
      (12) Store a 16-byte volume ID in the superblock that can be returned in
           struct xstat [Steve French].
      
           (Deferred to fsinfo).
      
      (13) Include granularity fields in the time data to indicate the
           granularity of each of the times (NFSv4 time_delta) [Steve French].
      
           (Deferred to fsinfo).
      
      (14) FS_IOC_GETFLAGS value.  These could be translated to BSD's st_flags.
           Note that the Linux IOC flags are a mess and filesystems such as Ext4
           define flags that aren't in linux/fs.h, so translation in the kernel
           may be a necessity (or, possibly, we provide the filesystem type too).
      
           (Some attributes are made available in stx_attributes, but the general
           feeling was that the IOC flags were to ext[234]-specific and shouldn't
           be exposed through statx this way).
      
      (15) Mask of features available on file (eg: ACLs, seclabel) [Brad Boyer,
           Michael Kerrisk].
      
           (Deferred, probably to fsinfo.  Finding out if there's an ACL or
           seclabal might require extra filesystem operations).
      
      (16) Femtosecond-resolution timestamps [Dave Chinner].
      
           (A __reserved field has been left in the statx_timestamp struct for
           this - if there proves to be a need).
      
      (17) A set multiple attributes syscall to go with this.
      
      ===============
      NEW SYSTEM CALL
      ===============
      
      The new system call is:
      
      	int ret = statx(int dfd,
      			const char *filename,
      			unsigned int flags,
      			unsigned int mask,
      			struct statx *buffer);
      
      The dfd, filename and flags parameters indicate the file to query, in a
      similar way to fstatat().  There is no equivalent of lstat() as that can be
      emulated with statx() by passing AT_SYMLINK_NOFOLLOW in flags.  There is
      also no equivalent of fstat() as that can be emulated by passing a NULL
      filename to statx() with the fd of interest in dfd.
      
      Whether or not statx() synchronises the attributes with the backing store
      can be controlled by OR'ing a value into the flags argument (this typically
      only affects network filesystems):
      
       (1) AT_STATX_SYNC_AS_STAT tells statx() to behave as stat() does in this
           respect.
      
       (2) AT_STATX_FORCE_SYNC will require a network filesystem to synchronise
           its attributes with the server - which might require data writeback to
           occur to get the timestamps correct.
      
       (3) AT_STATX_DONT_SYNC will suppress synchronisation with the server in a
           network filesystem.  The resulting values should be considered
           approximate.
      
      mask is a bitmask indicating the fields in struct statx that are of
      interest to the caller.  The user should set this to STATX_BASIC_STATS to
      get the basic set returned by stat().  It should be noted that asking for
      more information may entail extra I/O operations.
      
      buffer points to the destination for the data.  This must be 256 bytes in
      size.
      
      ======================
      MAIN ATTRIBUTES RECORD
      ======================
      
      The following structures are defined in which to return the main attribute
      set:
      
      	struct statx_timestamp {
      		__s64	tv_sec;
      		__s32	tv_nsec;
      		__s32	__reserved;
      	};
      
      	struct statx {
      		__u32	stx_mask;
      		__u32	stx_blksize;
      		__u64	stx_attributes;
      		__u32	stx_nlink;
      		__u32	stx_uid;
      		__u32	stx_gid;
      		__u16	stx_mode;
      		__u16	__spare0[1];
      		__u64	stx_ino;
      		__u64	stx_size;
      		__u64	stx_blocks;
      		__u64	__spare1[1];
      		struct statx_timestamp	stx_atime;
      		struct statx_timestamp	stx_btime;
      		struct statx_timestamp	stx_ctime;
      		struct statx_timestamp	stx_mtime;
      		__u32	stx_rdev_major;
      		__u32	stx_rdev_minor;
      		__u32	stx_dev_major;
      		__u32	stx_dev_minor;
      		__u64	__spare2[14];
      	};
      
      The defined bits in request_mask and stx_mask are:
      
      	STATX_TYPE		Want/got stx_mode & S_IFMT
      	STATX_MODE		Want/got stx_mode & ~S_IFMT
      	STATX_NLINK		Want/got stx_nlink
      	STATX_UID		Want/got stx_uid
      	STATX_GID		Want/got stx_gid
      	STATX_ATIME		Want/got stx_atime{,_ns}
      	STATX_MTIME		Want/got stx_mtime{,_ns}
      	STATX_CTIME		Want/got stx_ctime{,_ns}
      	STATX_INO		Want/got stx_ino
      	STATX_SIZE		Want/got stx_size
      	STATX_BLOCKS		Want/got stx_blocks
      	STATX_BASIC_STATS	[The stuff in the normal stat struct]
      	STATX_BTIME		Want/got stx_btime{,_ns}
      	STATX_ALL		[All currently available stuff]
      
      stx_btime is the file creation time, stx_mask is a bitmask indicating the
      data provided and __spares*[] are where as-yet undefined fields can be
      placed.
      
      Time fields are structures with separate seconds and nanoseconds fields
      plus a reserved field in case we want to add even finer resolution.  Note
      that times will be negative if before 1970; in such a case, the nanosecond
      fields will also be negative if not zero.
      
      The bits defined in the stx_attributes field convey information about a
      file, how it is accessed, where it is and what it does.  The following
      attributes map to FS_*_FL flags and are the same numerical value:
      
      	STATX_ATTR_COMPRESSED		File is compressed by the fs
      	STATX_ATTR_IMMUTABLE		File is marked immutable
      	STATX_ATTR_APPEND		File is append-only
      	STATX_ATTR_NODUMP		File is not to be dumped
      	STATX_ATTR_ENCRYPTED		File requires key to decrypt in fs
      
      Within the kernel, the supported flags are listed by:
      
      	KSTAT_ATTR_FS_IOC_FLAGS
      
      [Are any other IOC flags of sufficient general interest to be exposed
      through this interface?]
      
      New flags include:
      
      	STATX_ATTR_AUTOMOUNT		Object is an automount trigger
      
      These are for the use of GUI tools that might want to mark files specially,
      depending on what they are.
      
      Fields in struct statx come in a number of classes:
      
       (0) stx_dev_*, stx_blksize.
      
           These are local system information and are always available.
      
       (1) stx_mode, stx_nlinks, stx_uid, stx_gid, stx_[amc]time, stx_ino,
           stx_size, stx_blocks.
      
           These will be returned whether the caller asks for them or not.  The
           corresponding bits in stx_mask will be set to indicate whether they
           actually have valid values.
      
           If the caller didn't ask for them, then they may be approximated.  For
           example, NFS won't waste any time updating them from the server,
           unless as a byproduct of updating something requested.
      
           If the values don't actually exist for the underlying object (such as
           UID or GID on a DOS file), then the bit won't be set in the stx_mask,
           even if the caller asked for the value.  In such a case, the returned
           value will be a fabrication.
      
           Note that there are instances where the type might not be valid, for
           instance Windows reparse points.
      
       (2) stx_rdev_*.
      
           This will be set only if stx_mode indicates we're looking at a
           blockdev or a chardev, otherwise will be 0.
      
       (3) stx_btime.
      
           Similar to (1), except this will be set to 0 if it doesn't exist.
      
      =======
      TESTING
      =======
      
      The following test program can be used to test the statx system call:
      
      	samples/statx/test-statx.c
      
      Just compile and run, passing it paths to the files you want to examine.
      The file is built automatically if CONFIG_SAMPLES is enabled.
      
      Here's some example output.  Firstly, an NFS directory that crosses to
      another FSID.  Note that the AUTOMOUNT attribute is set because transiting
      this directory will cause d_automount to be invoked by the VFS.
      
      	[root@andromeda ~]# /tmp/test-statx -A /warthog/data
      	statx(/warthog/data) = 0
      	results=7ff
      	  Size: 4096            Blocks: 8          IO Block: 1048576  directory
      	Device: 00:26           Inode: 1703937     Links: 125
      	Access: (3777/drwxrwxrwx)  Uid:     0   Gid:  4041
      	Access: 2016-11-24 09:02:12.219699527+0000
      	Modify: 2016-11-17 10:44:36.225653653+0000
      	Change: 2016-11-17 10:44:36.225653653+0000
      	Attributes: 0000000000001000 (-------- -------- -------- -------- -------- -------- ---m---- --------)
      
      Secondly, the result of automounting on that directory.
      
      	[root@andromeda ~]# /tmp/test-statx /warthog/data
      	statx(/warthog/data) = 0
      	results=7ff
      	  Size: 4096            Blocks: 8          IO Block: 1048576  directory
      	Device: 00:27           Inode: 2           Links: 125
      	Access: (3777/drwxrwxrwx)  Uid:     0   Gid:  4041
      	Access: 2016-11-24 09:02:12.219699527+0000
      	Modify: 2016-11-17 10:44:36.225653653+0000
      	Change: 2016-11-17 10:44:36.225653653+0000
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      a528d35e
    • Linus Torvalds's avatar
      Merge branch 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · bbe08c0a
      Linus Torvalds authored
      Pull more btrfs updates from Chris Mason:
       "Btrfs round two.
      
        These are mostly a continuation of Dave Sterba's collection of
        cleanups, but Filipe also has some bug fixes and performance
        improvements"
      
      * 'for-linus-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (69 commits)
        btrfs: add dummy callback for readpage_io_failed and drop checks
        btrfs: drop checks for mandatory extent_io_ops callbacks
        btrfs: document existence of extent_io ops callbacks
        btrfs: let writepage_end_io_hook return void
        btrfs: do proper error handling in btrfs_insert_xattr_item
        btrfs: handle allocation error in update_dev_stat_item
        btrfs: remove BUG_ON from __tree_mod_log_insert
        btrfs: derive maximum output size in the compression implementation
        btrfs: use predefined limits for calculating maximum number of pages for compression
        btrfs: export compression buffer limits in a header
        btrfs: merge nr_pages input and output parameter in compress_pages
        btrfs: merge length input and output parameter in compress_pages
        btrfs: constify name of subvolume in creation helpers
        btrfs: constify buffers used by compression helpers
        btrfs: constify input buffer of btrfs_csum_data
        btrfs: constify device path passed to relevant helpers
        btrfs: make btrfs_inode_resume_unlocked_dio take btrfs_inode
        btrfs: make btrfs_inode_block_unlocked_dio take btrfs_inode
        btrfs: Make btrfs_add_nondir take btrfs_inode
        btrfs: Make btrfs_add_link take btrfs_inode
        ...
      bbe08c0a
  2. 02 Mar, 2017 13 commits
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 94e877d0
      Linus Torvalds authored
      Pull vfs pile two from Al Viro:
      
       - orangefs fix
      
       - series of fs/namei.c cleanups from me
      
       - VFS stuff coming from overlayfs tree
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        orangefs: Use RCU for destroy_inode
        vfs: use helper for calling f_op->fsync()
        mm: use helper for calling f_op->mmap()
        vfs: use helpers for calling f_op->{read,write}_iter()
        vfs: pass type instead of fn to do_{loop,iter}_readv_writev()
        vfs: extract common parts of {compat_,}do_readv_writev()
        vfs: wrap write f_ops with file_{start,end}_write()
        vfs: deny copy_file_range() for non regular files
        vfs: deny fallocate() on directory
        vfs: create vfs helper vfs_tmpfile()
        namei.c: split unlazy_walk()
        namei.c: fold the check for DCACHE_OP_REVALIDATE into d_revalidate()
        lookup_fast(): clean up the logics around the fallback to non-rcu mode
        namei: fold unlazy_link() into its sole caller
      94e877d0
    • Linus Torvalds's avatar
      Merge branch 'work.sendmsg' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 69fd110e
      Linus Torvalds authored
      Pull vfs sendmsg updates from Al Viro:
       "More sendmsg work.
      
        This is a fairly separate isolated stuff (there's a continuation
        around lustre, but that one was too late to soak in -next), thus the
        separate pull request"
      
      * 'work.sendmsg' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        ncpfs: switch to sock_sendmsg()
        ncpfs: don't mess with manually advancing iovec on send
        ncpfs: sendmsg does *not* bugger iovec these days
        ceph_tcp_sendpage(): use ITER_BVEC sendmsg
        afs_send_pages(): use ITER_BVEC
        rds: remove dead code
        ceph: switch to sock_recvmsg()
        usbip_recv(): switch to sock_recvmsg()
        iscsi_target: deal with short writes on the tx side
        [nbd] pass iov_iter to nbd_xmit()
        [nbd] switch sock_xmit() to sock_{send,recv}msg()
        [drbd] use sock_sendmsg()
      69fd110e
    • Linus Torvalds's avatar
      Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending · 821fd6f6
      Linus Torvalds authored
      Pull SCSI target updates from Nicholas Bellinger:
       "The highlights this round include:
      
         - enable dual mode (initiator + target) qla2xxx operation. (Quinn +
           Himanshu)
      
         - add a framework for qla2xxx async fabric discovery. (Quinn +
           Himanshu)
      
         - enable iscsi PDU DDP completion offload in cxgbit/T6 NICs. (Varun)
      
         - fix target-core handling of aborted failed commands. (Bart)
      
         - fix a long standing target-core issue NULL pointer dereference with
           active I/O LUN shutdown. (Rob Millner + Bryant + nab)"
      
      * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (44 commits)
        target: Add counters for ABORT_TASK success + failure
        iscsi-target: Fix early login failure statistics misses
        target: Fix NULL dereference during LUN lookup + active I/O shutdown
        target: Delete tmr from list before processing
        target: Fix handling of aborted failed commands
        uapi: fix linux/target_core_user.h userspace compilation errors
        target: export protocol identifier
        qla2xxx: Fix a warning reported by the "smatch" static checker
        target/iscsi: Fix unsolicited data seq_end_offset calculation
        target/cxgbit: add T6 iSCSI DDP completion feature
        target/cxgbit: Enable DDP for T6 only if data sequence and pdu are in order
        target/cxgbit: Use T6 specific macros to get ETH/IP hdr len
        target/cxgbit: use cxgb4_tp_smt_idx() to get smt idx
        target/iscsi: split iscsit_check_dataout_hdr()
        target: Remove command flag CMD_T_DEV_ACTIVE
        target: Remove command flag CMD_T_BUSY
        target: Move session check from target_put_sess_cmd() into target_release_cmd_kref()
        target: Inline transport_cmd_check_stop()
        target: Remove an overly chatty debug message
        target: Stop execution if CMD_T_STOP has been set
        ...
      821fd6f6
    • Linus Torvalds's avatar
      Merge tag 'dm-4.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm · ca4c7d7c
      Linus Torvalds authored
      Pull device mapper fixes from Mike Snitzer:
      
       - a dm-raid stable@ fix for possible corruption when triggering a raid
         reshape via lvm2; and an additional small patch ontop to bump version
         of the dm-raid target outside of the stable@ fix
      
       - a dm-raid fix for a 'dm-4.11-changes' regression introduced by a
         commit that was meant to only cleanup confusing branching.
      
      * tag 'dm-4.11-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
        dm raid: bump the target version
        dm raid: fix data corruption on reshape request
        dm raid: fix raid "check" regression due to improper cleanup in raid_message()
      ca4c7d7c
    • Linus Torvalds's avatar
      Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost · 54d7989f
      Linus Torvalds authored
      Pull vhost updates from Michael Tsirkin:
       "virtio, vhost: optimizations, fixes
      
        Looks like a quiet cycle for vhost/virtio, just a couple of minor
        tweaks. Most notable is automatic interrupt affinity for blk and scsi.
        Hopefully other devices are not far behind"
      
      * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost:
        virtio-console: avoid DMA from stack
        vhost: introduce O(1) vq metadata cache
        virtio_scsi: use virtio IRQ affinity
        virtio_blk: use virtio IRQ affinity
        blk-mq: provide a default queue mapping for virtio device
        virtio: provide a method to get the IRQ affinity mask for a virtqueue
        virtio: allow drivers to request IRQ affinity when creating VQs
        virtio_pci: simplify MSI-X setup
        virtio_pci: don't duplicate the msix_enable flag in struct pci_dev
        virtio_pci: use shared interrupts for virtqueues
        virtio_pci: remove struct virtio_pci_vq_info
        vhost: try avoiding avail index access when getting descriptor
        virtio_mmio: expose header to userspace
      54d7989f
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security · 0f221a31
      Linus Torvalds authored
      Pull security subsystem fixes from James Morris:
       "Two fixes for the security subsystem:
      
         - keys: split both rcu_dereference_key() and user_key_payload() into
           versions which can be called with or without holding the key
           semaphore.
      
         - SELinux: fix Android init(8) breakage due to new cgroup security
           labeling support when using older policy"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
        selinux: wrap cgroup seclabel support with its own policy capability
        KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload()
      0f221a31
    • Linus Torvalds's avatar
      Merge tag 'watchdog-for-linus-v4.11-2' of... · 4f1f2b8f
      Linus Torvalds authored
      Merge tag 'watchdog-for-linus-v4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull more watchdog updates from Guenter Roeck:
      
       - fix fallout from enabling COMPILE_TEST
      
       - fix gcc-4.3 build of kempld watchdog driver
      
       - use hrtimer in softdog
      
      * tag 'watchdog-for-linus-v4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        watchdog: retu: restore MFD dependency
        watchdog: db8500: add back prmcu dependency
        watchdog: kempld: fix gcc-4.3 build
        watchdog: softdog: fire watchdog even if softirqs do not get to run
        watchdog: kempld: revert to full dependency
        watchdog: bcm2835: add CONFIG_OF dependency
        watchdog: sp805: add back AMBA dependency
        watchdog: menf21bmc: add I2C dependency
        watchdog: geode: restore hard CS5535_MFGPT dependency
        watchdog: wm831x watchdog really needs mfd
      4f1f2b8f
    • Linus Torvalds's avatar
      give up on gcc ilog2() constant optimizations · 474c9015
      Linus Torvalds authored
      gcc-7 has an "optimization" pass that completely screws up, and
      generates the code expansion for the (impossible) case of calling
      ilog2() with a zero constant, even when the code gcc compiles does not
      actually have a zero constant.
      
      And we try to generate a compile-time error for anybody doing ilog2() on
      a constant where that doesn't make sense (be it zero or negative).  So
      now gcc7 will fail the build due to our sanity checking, because it
      created that constant-zero case that didn't actually exist in the source
      code.
      
      There's a whole long discussion on the kernel mailing about how to work
      around this gcc bug.  The gcc people themselevs have discussed their
      "feature" in
      
         https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72785
      
      but it's all water under the bridge, because while it looked at one
      point like it would be solved by the time gcc7 was released, that was
      not to be.
      
      So now we have to deal with this compiler braindamage.
      
      And the only simple approach seems to be to just delete the code that
      tries to warn about bad uses of ilog2().
      
      So now "ilog2()" will just return 0 not just for the value 1, but for
      any non-positive value too.
      
      It's not like I can recall anybody having ever actually tried to use
      this function on any invalid value, but maybe the sanity check just
      meant that such code never made it out in public.
      Reported-by: default avatarLaura Abbott <labbott@redhat.com>
      Cc: John Stultz <john.stultz@linaro.org>,
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      474c9015
    • Al Viro's avatar
      Merge remote-tracking branch 'ovl/for-viro' into for-linus · 653a7746
      Al Viro authored
      Overlayfs-related series from Miklos and Amir
      653a7746
    • Al Viro's avatar
      Merge branch 'work.namei' into for-linus · f6c99aad
      Al Viro authored
      f6c99aad
    • Peter Zijlstra's avatar
      orangefs: Use RCU for destroy_inode · 0695d7dc
      Peter Zijlstra authored
      freeing of inodes must be RCU-delayed on all filesystems
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      0695d7dc
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 4977ab6e
      Linus Torvalds authored
      Pull objtool relocation fixes from Ingo Molnar:
       "Two fixes related to the module loading regression introduced by the
        recent objtool changes"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        objtool, modules: Discard objtool annotation sections for modules
        objtool, compiler.h: Fix __unreachable section relocation size
      4977ab6e
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-4.11-1' of git://git.linux-nfs.org/projects/anna/linux-nfs · 8f03cf50
      Linus Torvalds authored
      Pull NFS client updates from Anna Schumaker:
       "Highlights include:
      
        Stable bugfixes:
         - NFSv4: Fix memory and state leak in _nfs4_open_and_get_state
         - xprtrdma: Fix Read chunk padding
         - xprtrdma: Per-connection pad optimization
         - xprtrdma: Disable pad optimization by default
         - xprtrdma: Reduce required number of send SGEs
         - nlm: Ensure callback code also checks that the files match
         - pNFS/flexfiles: If the layout is invalid, it must be updated before
           retrying
         - NFSv4: Fix reboot recovery in copy offload
         - Revert "NFSv4.1: Handle NFS4ERR_BADSESSION/NFS4ERR_DEADSESSION
           replies to OP_SEQUENCE"
         - NFSv4: fix getacl head length estimation
         - NFSv4: fix getacl ERANGE for sum ACL buffer sizes
      
        Features:
         - Add and use dprintk_cont macros
         - Various cleanups to NFS v4.x to reduce code duplication and
           complexity
         - Remove unused cr_magic related code
         - Improvements to sunrpc "read from buffer" code
         - Clean up sunrpc timeout code and allow changing TCP timeout
           parameters
         - Remove duplicate mw_list management code in xprtrdma
         - Add generic functions for encoding and decoding xdr streams
      
        Bugfixes:
         - Clean up nfs_show_mountd_netid
         - Make layoutreturn_ops static and use NULL instead of 0 to fix
           sparse warnings
         - Properly handle -ERESTARTSYS in nfs_rename()
         - Check if register_shrinker() failed during rpcauth_init()
         - Properly clean up procfs/pipefs entries
         - Various NFS over RDMA related fixes
         - Silence unititialized variable warning in sunrpc"
      
      * tag 'nfs-for-4.11-1' of git://git.linux-nfs.org/projects/anna/linux-nfs: (64 commits)
        NFSv4: fix getacl ERANGE for some ACL buffer sizes
        NFSv4: fix getacl head length estimation
        Revert "NFSv4.1: Handle NFS4ERR_BADSESSION/NFS4ERR_DEADSESSION replies to OP_SEQUENCE"
        NFSv4: Fix reboot recovery in copy offload
        pNFS/flexfiles: If the layout is invalid, it must be updated before retrying
        NFSv4: Clean up owner/group attribute decode
        SUNRPC: Add a helper function xdr_stream_decode_string_dup()
        NFSv4: Remove bogus "struct nfs_client" argument from decode_ace()
        NFSv4: Fix the underestimation of delegation XDR space reservation
        NFSv4: Replace callback string decode function with a generic
        NFSv4: Replace the open coded decode_opaque_inline() with the new generic
        NFSv4: Replace ad-hoc xdr encode/decode helpers with xdr_stream_* generics
        SUNRPC: Add generic helpers for xdr_stream encode/decode
        sunrpc: silence uninitialized variable warning
        nlm: Ensure callback code also checks that the files match
        sunrpc: Allow xprt->ops->timer method to sleep
        xprtrdma: Refactor management of mw_list field
        xprtrdma: Handle stale connection rejection
        xprtrdma: Properly recover FRWRs with in-flight FASTREG WRs
        xprtrdma: Shrink send SGEs array
        ...
      8f03cf50
  3. 01 Mar, 2017 25 commits
    • Linus Torvalds's avatar
      Merge tag 'for-f2fs-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs · 25c4e6c3
      Linus Torvalds authored
      Pull f2fs updates from Jaegeuk Kim:
       "This round introduces several interesting features such as on-disk NAT
        bitmaps, IO alignment, and a discard thread. And it includes a couple
        of major bug fixes as below.
      
        Enhancements:
      
         - introduce on-disk bitmaps to avoid scanning NAT blocks when getting
           free nids
      
         - support IO alignment to prepare open-channel SSD integration in
           future
      
         - introduce a discard thread to avoid long latency during checkpoint
           and fstrim
      
         - use SSR for warm node and enable inline_xattr by default
      
         - introduce in-memory bitmaps to check FS consistency for debugging
      
         - improve write_begin by avoiding needless read IO
      
        Bug fixes:
      
         - fix broken zone_reset behavior for SMR drive
      
         - fix wrong victim selection policy during GC
      
         - fix missing behavior when preparing discard commands
      
         - fix bugs in atomic write support and fiemap
      
         - workaround to handle multiple f2fs_add_link calls having same name
      
        ... and it includes a bunch of clean-up patches as well"
      
      * tag 'for-f2fs-4.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs: (97 commits)
        f2fs: avoid to flush nat journal entries
        f2fs: avoid to issue redundant discard commands
        f2fs: fix a plint compile warning
        f2fs: add f2fs_drop_inode tracepoint
        f2fs: Fix zoned block device support
        f2fs: remove redundant set_page_dirty()
        f2fs: fix to enlarge size of write_io_dummy mempool
        f2fs: fix memory leak of write_io_dummy mempool during umount
        f2fs: fix to update F2FS_{CP_}WB_DATA count correctly
        f2fs: use MAX_FREE_NIDS for the free nids target
        f2fs: introduce free nid bitmap
        f2fs: new helper cur_cp_crc() getting crc in f2fs_checkpoint
        f2fs: update the comment of default nr_pages to skipping
        f2fs: drop the duplicate pval in f2fs_getxattr
        f2fs: Don't update the xattr data that same as the exist
        f2fs: kill __is_extent_same
        f2fs: avoid bggc->fggc when enough free segments are avaliable after cp
        f2fs: select target segment with closer temperature in SSR mode
        f2fs: show simple call stack in fault injection message
        f2fs: no need lock_op in f2fs_write_inline_data
        ...
      25c4e6c3
    • Omar Sandoval's avatar
      virtio-console: avoid DMA from stack · c4baad50
      Omar Sandoval authored
      put_chars() stuffs the buffer it gets into an sg, but that buffer may be
      on the stack. This breaks with CONFIG_VMAP_STACK=y (for me, it
      manifested as printks getting turned into NUL bytes).
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarAmit Shah <amit.shah@redhat.com>
      c4baad50
    • Jason Wang's avatar
      vhost: introduce O(1) vq metadata cache · f8894913
      Jason Wang authored
      When device IOTLB is enabled, all address translations were stored in
      interval tree. O(lgN) searching time could be slow for virtqueue
      metadata (avail, used and descriptors) since they were accessed much
      often than other addresses. So this patch introduces an O(1) array
      which points to the interval tree nodes that store the translations of
      vq metadata. Those array were update during vq IOTLB prefetching and
      were reset during each invalidation and tlb update. Each time we want
      to access vq metadata, this small array were queried before interval
      tree. This would be sufficient for static mappings but not dynamic
      mappings, we could do optimizations on top.
      
      Test were done with l2fwd in guest (2M hugepage):
      
         noiommu  | before        | after
      tx 1.32Mpps | 1.06Mpps(82%) | 1.30Mpps(98%)
      rx 2.33Mpps | 1.46Mpps(63%) | 2.29Mpps(98%)
      
      We can almost reach the same performance as noiommu mode.
      Signed-off-by: default avatarJason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      f8894913
    • Stephen Smalley's avatar
      selinux: wrap cgroup seclabel support with its own policy capability · 2651225b
      Stephen Smalley authored
      commit 1ea0ce40 ("selinux: allow
      changing labels for cgroupfs") broke the Android init program,
      which looks up security contexts whenever creating directories
      and attempts to assign them via setfscreatecon().
      When creating subdirectories in cgroup mounts, this would previously
      be ignored since cgroup did not support userspace setting of security
      contexts.  However, after the commit, SELinux would attempt to honor
      the requested context on cgroup directories and fail due to permission
      denial.  Avoid breaking existing userspace/policy by wrapping this change
      with a conditional on a new cgroup_seclabel policy capability.  This
      preserves existing behavior until/unless a new policy explicitly enables
      this capability.
      Reported-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: default avatarStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
      Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
      2651225b
    • David Howells's avatar
      KEYS: Differentiate uses of rcu_dereference_key() and user_key_payload() · 0837e49a
      David Howells authored
      rcu_dereference_key() and user_key_payload() are currently being used in
      two different, incompatible ways:
      
       (1) As a wrapper to rcu_dereference() - when only the RCU read lock used
           to protect the key.
      
       (2) As a wrapper to rcu_dereference_protected() - when the key semaphor is
           used to protect the key and the may be being modified.
      
      Fix this by splitting both of the key wrappers to produce:
      
       (1) RCU accessors for keys when caller has the key semaphore locked:
      
      	dereference_key_locked()
      	user_key_payload_locked()
      
       (2) RCU accessors for keys when caller holds the RCU read lock:
      
      	dereference_key_rcu()
      	user_key_payload_rcu()
      
      This should fix following warning in the NFS idmapper
      
        ===============================
        [ INFO: suspicious RCU usage. ]
        4.10.0 #1 Tainted: G        W
        -------------------------------
        ./include/keys/user-type.h:53 suspicious rcu_dereference_protected() usage!
        other info that might help us debug this:
        rcu_scheduler_active = 2, debug_locks = 0
        1 lock held by mount.nfs/5987:
          #0:  (rcu_read_lock){......}, at: [<d000000002527abc>] nfs_idmap_get_key+0x15c/0x420 [nfsv4]
        stack backtrace:
        CPU: 1 PID: 5987 Comm: mount.nfs Tainted: G        W       4.10.0 #1
        Call Trace:
          dump_stack+0xe8/0x154 (unreliable)
          lockdep_rcu_suspicious+0x140/0x190
          nfs_idmap_get_key+0x380/0x420 [nfsv4]
          nfs_map_name_to_uid+0x2a0/0x3b0 [nfsv4]
          decode_getfattr_attrs+0xfac/0x16b0 [nfsv4]
          decode_getfattr_generic.constprop.106+0xbc/0x150 [nfsv4]
          nfs4_xdr_dec_lookup_root+0xac/0xb0 [nfsv4]
          rpcauth_unwrap_resp+0xe8/0x140 [sunrpc]
          call_decode+0x29c/0x910 [sunrpc]
          __rpc_execute+0x140/0x8f0 [sunrpc]
          rpc_run_task+0x170/0x200 [sunrpc]
          nfs4_call_sync_sequence+0x68/0xa0 [nfsv4]
          _nfs4_lookup_root.isra.44+0xd0/0xf0 [nfsv4]
          nfs4_lookup_root+0xe0/0x350 [nfsv4]
          nfs4_lookup_root_sec+0x70/0xa0 [nfsv4]
          nfs4_find_root_sec+0xc4/0x100 [nfsv4]
          nfs4_proc_get_rootfh+0x5c/0xf0 [nfsv4]
          nfs4_get_rootfh+0x6c/0x190 [nfsv4]
          nfs4_server_common_setup+0xc4/0x260 [nfsv4]
          nfs4_create_server+0x278/0x3c0 [nfsv4]
          nfs4_remote_mount+0x50/0xb0 [nfsv4]
          mount_fs+0x74/0x210
          vfs_kern_mount+0x78/0x220
          nfs_do_root_mount+0xb0/0x140 [nfsv4]
          nfs4_try_mount+0x60/0x100 [nfsv4]
          nfs_fs_mount+0x5ec/0xda0 [nfs]
          mount_fs+0x74/0x210
          vfs_kern_mount+0x78/0x220
          do_mount+0x254/0xf70
          SyS_mount+0x94/0x100
          system_call+0x38/0xe0
      Reported-by: default avatarJan Stancek <jstancek@redhat.com>
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      Tested-by: default avatarJan Stancek <jstancek@redhat.com>
      Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
      0837e49a
    • Josh Poimboeuf's avatar
      objtool, modules: Discard objtool annotation sections for modules · e390f9a9
      Josh Poimboeuf authored
      The '__unreachable' and '__func_stack_frame_non_standard' sections are
      only used at compile time.  They're discarded for vmlinux but they
      should also be discarded for modules.
      
      Since this is a recurring pattern, prefix the section names with
      ".discard.".  It's a nice convention and vmlinux.lds.h already discards
      such sections.
      
      Also remove the 'a' (allocatable) flag from the __unreachable section
      since it doesn't make sense for a discarded section.
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Jessica Yu <jeyu@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: d1091c7f ("objtool: Improve detection of BUG() and other dead ends")
      Link: http://lkml.kernel.org/r/20170301180444.lhd53c5tibc4ns77@trebleSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      e390f9a9
    • Linus Torvalds's avatar
      Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux · 6053dc98
      Linus Torvalds authored
      Pull arm64 fixes from Will Deacon:
       "The main fix here addresses a kernel panic triggered on Qualcomm
        QDF2400 due to incorrect register usage in an erratum workaround
        introduced during the merge window.
      
        Summary:
      
         - Fix kernel panic on specific Qualcomm platform due to broken
           erratum workaround
      
         - Revert contiguous bit support due to TLB conflict aborts in
           simulation
      
         - Don't treat all CPU ID register fields as 4-bit quantities"
      
      * tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
        arm64/cpufeature: check correct field width when updating sys_val
        Revert "arm64: mm: set the contiguous bit for kernel mappings where appropriate"
        arm64: Avoid clobbering mm in erratum workaround on QDF2400
      6053dc98
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · b286cedd
      Linus Torvalds authored
      Pull more powerpc updates from Michael Ellerman:
       "Highlights include:
      
         - an update of the disassembly code used by xmon to the latest
           versions in binutils. We've received permission from all the
           authors of the relevant binutils changes to relicense their changes
           to the relevant files from GPLv3 to GPLv2, for inclusion in Linux.
           Thanks to Peter Bergner for doing the leg work to get permission
           from everyone.
      
         - addition of the "architected" Power9 CPU table entry, allowing us
           to boot in Power9 architected mode under a hypervisor.
      
         - updates to the Power9 PMU code.
      
         - implementation of clear_bit_unlock_is_negative_byte() to optimise
           unlock_page().
      
         - Freescale updates from Scott: "Highlights include 8xx breakpoints
           and perf, t1042rdb display support, and board updates."
      
        Thanks to:
          Al Viro, Andrew Donnellan, Aneesh Kumar K.V, Balbir Singh, Douglas
          Miller, Frédéric Weisbecker, Gavin Shan, Madhavan Srinivasan,
          Michael Roth, Nathan Fontenot, Naveen N. Rao, Nicholas Piggin, Peter
          Bergner, Paul E. McKenney, Rashmica Gupta, Russell Currey, Sahil
          Mehta, Stewart Smith"
      
      * tag 'powerpc-4.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: (48 commits)
        powerpc: Remove leftover cputime_to_nsecs call causing build error
        powerpc/mm/hash: Always clear UPRT and Host Radix bits when setting up CPU
        powerpc/optprobes: Fix TOC handling in optprobes trampoline
        powerpc/pseries: Advertise Hot Plug Event support to firmware
        cxl: fix nested locking hang during EEH hotplug
        powerpc/xmon: Dump memory in CPU endian format
        powerpc/pseries: Revert 'Auto-online hotplugged memory'
        powerpc/powernv: Make PCI non-optional
        powerpc/64: Implement clear_bit_unlock_is_negative_byte()
        powerpc/powernv: Remove unused variable in pnv_pci_sriov_disable()
        powerpc/kernel: Remove error message in pcibios_setup_phb_resources()
        powerpc/mm: Fix typo in set_pte_at()
        pci/hotplug/pnv-php: Disable MSI and PCI device properly
        pci/hotplug/pnv-php: Disable surprise hotplug capability on conflicts
        pci/hotplug/pnv-php: Remove WARN_ON() in pnv_php_put_slot()
        powerpc: Add POWER9 architected mode to cputable
        powerpc/perf: use is_kernel_addr macro in perf_get_misc_flags()
        powerpc/perf: Avoid FAB_*_MATCH checks for power9
        powerpc/perf: Add restrictions to PMC5 in power9 DD1
        powerpc/perf: Use Instruction Counter value
        ...
      b286cedd
    • Benjamin Tissoires's avatar
      Input: rmi4 - f30: detect INPUT_PROP_BUTTONPAD from the button count · 522214d9
      Benjamin Tissoires authored
      INPUT_PROP_BUTTONPAD is currently only set through the platform data.
      The RMI4 header doc says that this property is there to force the
      buttonpad property, so we also need to detect it by looking at
      the exported buttons count.
      Signed-off-by: default avatarBenjamin Tissoires <benjamin.tissoires@redhat.com>
      Reported-and-tested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      522214d9
    • Linus Torvalds's avatar
      Merge tag 'sound-fix-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 044d5dfd
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "A few last-minute fixes for rc1:
      
         - ALSA core timer and sequencer fixes for bugs spotted by syzkaller
      
         - a couple of trivial HD-audio fixups
      
         - additional PCI / codec IDs for Intel Geminilake
      
         - fixes for CT-XFi DMA mask bugs"
      
      * tag 'sound-fix-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: seq: Fix link corruption by event error handling
        ALSA: hda - Add subwoofer support for Dell Inspiron 17 7000 Gaming
        ALSA: ctxfi: Fallback DMA mask to 32bit
        ALSA: timer: Reject user params with too small ticks
        ALSA: hda: Add Geminilake HDMI codec ID
        ALSA: hda - Fix micmute hotkey problem for a lenovo AIO machine
        ALSA: hda - Add Geminilake PCI ID
      044d5dfd
    • Linus Torvalds's avatar
      Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux · 544a068f
      Linus Torvalds authored
      Pull thermal management updates from Zhang Rui:
      
       - add thermal driver for R-Car Gen3 thermal sensors.
      
       - add thermal driver for ZTE' zx2967 family thermal sensors.
      
       - convert thermal ID allocation from IDR to IDA.
      
       - fix a possible NULL dereference in imx thermal driver.
      
       - fix a ti-soc-thermal driver dependency issue so that critical thermal
         control is still available when CPU_THERMAL is not defined.
      
       - update binding information for QorIQ thermal driver.
      
       - a couple of cleanups in thermal core, intel_powerclamp, exynos,
         dra752-thermal, mtk-thermal driver.
      
      * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
        powerpc/mpc85xx: Update TMU device tree node for T1023/T1024
        powerpc/mpc85xx: Update TMU device tree node for T1040/T1042
        dt-bindings: Update QorIQ TMU thermal bindings
        thermal: mtk_thermal: Staticise a number of data variables
        thermal: arm: dra752: Remove all TSHUT related definitions
        thermal: arm: dra752: Remove TSHUT configuration
        thermal: ti-soc-thermal: Remove CPU_THERMAL Dependency from TI_THERMAL
        thermal: imx: Fix possible NULL dereference.
        thermal: exynos: Remove parsing unused samsung,tmu_cal_mode property
        thermal: zx2967: add thermal driver for ZTE's zx2967 family
        thermal: use cpumask_var_t for on-stack cpu masks
        dt: bindings: add documentation for zx2967 family thermal sensor
        thermal/intel_powerclamp: Remove set-but-not-used variables
        thermal: rcar_gen3_thermal: Add R-Car Gen3 thermal driver
        thermal: rcar_gen3_thermal: Document the R-Car Gen3
        thermal: convert devfreq_cooling to use an IDA
        thermal: convert cpu_cooling to use an IDA
        thermal: convert clock cooling to use an IDA
        thermal core: convert ID allocation to IDA
      544a068f
    • Linus Torvalds's avatar
      Merge tag 'pwm/for-4.11-rc1' of... · 545b2820
      Linus Torvalds authored
      Merge tag 'pwm/for-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm
      
      Pull pwm updates from Thierry Reding:
       "This set contains mostly fixes to existing drivers as well as cleanup
        of code that's not been in active use for a while"
      
      * tag 'pwm/for-4.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/thierry.reding/linux-pwm: (27 commits)
        acpi: lpss: call pwm_add_table() for BSW PWM device
        pwm: Try to load modules during pwm_get()
        pwm: Don't hold pwm_lookup_lock longer than necessary
        pwm: Make the PWM_POLARITY flag in DTB optional
        pwm: Print error messages with pr_err() instead of pr_debug()
        pwm: imx: Add polarity inversion support to i.MX's PWMv2
        pwm: imx: doc: Update imx-pwm.txt documentation entry
        pwm: imx: Remove redundant i.MX PWMv2 code
        pwm: imx: Provide atomic PWM support for i.MX PWMv2
        pwm: imx: Move PWMv2 wait for fifo slot code to a separate function
        pwm: imx: Move PWMv2 software reset code to a separate function
        pwm: imx: Rewrite v1 code to facilitate switch to atomic PWM
        pwm: imx: Add separate set of PWM ops for v1 and v2
        pwm: imx: Remove ipg clock and enable per clock when required
        pwm: lpss: Add Intel Gemini Lake PCI ID
        pwm: lpss: Do not export board infos for different PWM types
        pwm: lpss: Avoid reconfiguring while UPDATE bit is still enabled
        pwm: lpss: Switch to new atomic API
        pwm: lpss: Allow duty cycle to be 0
        pwm: lpss: Avoid potential overflow of base_unit
        ...
      545b2820
    • Linus Torvalds's avatar
      Merge tag 'drm-ast-2500-for-v4.11' of git://people.freedesktop.org/~airlied/linux · 3437f9f0
      Linus Torvalds authored
      Pull drm AST2500 support from Dave Airlie:
       "This is a set of changes to enable the AST2500 BMC hardware, and also
        fix some bugs interacting with the older AST hardware.
      
        Some of the bug fixes are cc'ed to stable"
      
      * tag 'drm-ast-2500-for-v4.11' of git://people.freedesktop.org/~airlied/linux:
        drm/ast: Call open_key before enable_mmio in POST code
        drm/ast: Fix test for VGA enabled
        drm/ast: POST code for the new AST2500
        drm/ast: Rename ast_init_dram_2300 to ast_post_chip_2300
        drm/ast: Factor mmc_test code in POST code
        drm/ast: Fixed vram size incorrect issue on POWER
        drm/ast: Base support for AST2500
        drm/ast: Fix calculation of MCLK
        drm/ast: Remove spurious include
        drm/ast: const'ify mode setting tables
        drm/ast: Handle configuration without P2A bridge
        drm/ast: Fix AST2400 POST failure without BMC FW or VBIOS
      3437f9f0
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-for-v4.11-rc1' of git://people.freedesktop.org/~airlied/linux · f3ecc84b
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Misc fixes for v4.11-rc1.
      
        This is a selection of fixes for recent bugs, the vmwgfx one is
        important to avoid a regression, and compat ioctl one is pretty urgent
        for stable. Otherwise nothing too much.
      
        I've got a separate pull req for some AST hw IBM need to enable"
      
      * tag 'drm-fixes-for-v4.11-rc1' of git://people.freedesktop.org/~airlied/linux:
        dma-buf: add support for compat ioctl
        drm/vmwgfx: Work around drm removal of control nodes
        drm/rockchip: cdn-dp: Fix error handling
        drm/rockchip: add extcon dependency for DP
        drm: zte: fix static checker warning on variable 'fmt'
      f3ecc84b
    • Arnd Bergmann's avatar
      watchdog: retu: restore MFD dependency · 9ad82f11
      Arnd Bergmann authored
      The retu watchdog calls into the respective mfd driver, but fails to
      link if that is diabled:
      
      drivers/watchdog/built-in.o: In function `retu_wdt_set_timeout':
      ziirave_wdt.c:(.text+0x8c88): undefined reference to `retu_write'
      ziirave_wdt.c:(.text+0x8c88): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `retu_write'
      drivers/watchdog/built-in.o: In function `retu_wdt_start':
      ziirave_wdt.c:(.text+0x8cc8): undefined reference to `retu_write'
      ziirave_wdt.c:(.text+0x8cc8): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `retu_write'
      
      This restores the dependency as it was before
      
      Fixes: da2a68b3 ("watchdog: Enable COMPILE_TEST where possible")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      9ad82f11
    • Arnd Bergmann's avatar
      watchdog: db8500: add back prmcu dependency · 9297b652
      Arnd Bergmann authored
      When the db8500 watchdog is enabled without the PRCMU, we get a lot of
      warnings about duplicate or missing helper functions:
      
      In file included from drivers/watchdog/ux500_wdt.c:21:0:
      include/linux/mfd/dbx500-prcmu.h:422:19: error: redefinition of 'prcmu_abb_read'
       static inline int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
      
      This restores the dependency as it was.
      
      Fixes: da2a68b3 ("watchdog: Enable COMPILE_TEST where possible")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      9297b652
    • Arnd Bergmann's avatar
      watchdog: kempld: fix gcc-4.3 build · 3736d4eb
      Arnd Bergmann authored
      gcc-4.3 can't decide whether the constant value in
      kempld_prescaler[PRESCALER_21] is built-time constant or
      not, and gets confused by the logic in do_div():
      
      drivers/watchdog/kempld_wdt.o: In function `kempld_wdt_set_stage_timeout':
      kempld_wdt.c:(.text.kempld_wdt_set_stage_timeout+0x130): undefined reference to `__aeabi_uldivmod'
      
      This adds a call to ACCESS_ONCE() to force it to not consider
      it to be constant, and leaves the more efficient normal case
      in place for modern compilers, using an #ifdef to annotate
      why we do this hack.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      3736d4eb
    • Niklas Cassel's avatar
      watchdog: softdog: fire watchdog even if softirqs do not get to run · 8d5755b3
      Niklas Cassel authored
      Checking for timer expiration is done from the softirq TIMER_SOFTIRQ.
      
      Since commit 4cd13c21 ("softirq: Let ksoftirqd do its job"),
      pending softirqs are no longer always handled immediately, instead,
      if there are pending softirqs, and ksoftirqd is in state TASK_RUNNING,
      the handling of the softirqs are deferred, and are instead supposed
      to be handled by ksoftirqd, when ksoftirqd gets scheduled.
      
      If a user space process with a real-time policy starts to misbehave
      by never relinquishing the CPU while ksoftirqd is in state TASK_RUNNING,
      what will happen is that all softirqs will get deferred, while ksoftirqd,
      which is supposed to handle the deferred softirqs, will never get to run.
      
      To make sure that the watchdog is able to fire even when we do not get
      to run softirqs, replace the timers with hrtimers.
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@axis.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      8d5755b3
    • Arnd Bergmann's avatar
      watchdog: kempld: revert to full dependency · ed4a9eca
      Arnd Bergmann authored
      The kempld watchdog driver requires the respective MFD driver:
      
      drivers/watchdog/built-in.o: In function `kempld_wdt_probe':
      kempld_wdt.c:(.text+0x5c78): undefined reference to `kempld_get_mutex'
      kempld_wdt.c:(.text+0x5c84): undefined reference to `kempld_read8'
      kempld_wdt.c:(.text+0x5c8e): undefined reference to `kempld_release_mutex'
      kempld_wdt.c:(.text+0x5d1c): undefined reference to `kempld_read8'
      kempld_wdt.c:(.text+0x5d2c): undefined reference to `kempld_write8'
      
      This adds the Kconfig dependency back.
      
      Fixes: da2a68b3 ("watchdog: Enable COMPILE_TEST where possible")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      ed4a9eca
    • Arnd Bergmann's avatar
      watchdog: bcm2835: add CONFIG_OF dependency · 2672b7e0
      Arnd Bergmann authored
      Without CONFIG_OF, the driver fails to link:
      
      drivers/watchdog/built-in.o: In function `bcm2835_power_off':
      bcm2835_wdt.c:(.text+0x1946): undefined reference to `of_find_device_by_node'
      
      This adds a new dependency, to allow the COMPILE_TEST check to succeed.
      
      Fixes: da2a68b3 ("watchdog: Enable COMPILE_TEST where possible")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      2672b7e0
    • Arnd Bergmann's avatar
      watchdog: sp805: add back AMBA dependency · 3eafee95
      Arnd Bergmann authored
      The driver fails to link if ARM_AMBA is disabled:
      
      drivers/watchdog/sp805_wdt.o: In function `sp805_wdt_driver_init':
      sp805_wdt.c:(.init.text+0x4): undefined reference to `amba_driver_register'
      
      It seems that the COMPILE_TEST was added in the wrong place, as there
      is no architecture dependency, but a bus dependency. This moves
      the dependency accordingly.
      
      Fixes: da2a68b3 ("watchdog: Enable COMPILE_TEST where possible")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      3eafee95
    • Arnd Bergmann's avatar
      watchdog: menf21bmc: add I2C dependency · 6fb303a8
      Arnd Bergmann authored
      This driver fails to link when CONFIG_I2C is disabled or a loadable module while
      the watchdog is built-in:
      
      drivers/watchdog/built-in.o: In function `menf21bmc_wdt_shutdown':
      menf21bmc_wdt.c:(.text+0x9b44): undefined reference to `i2c_smbus_write_word_data'
      menf21bmc_wdt.c:(.text+0x9b44): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `i2c_smbus_write_word_data'
      
      This adds a Kconfig dependency for it, to enforce a valid configuration.
      
      Fixes: da2a68b3 ("watchdog: Enable COMPILE_TEST where possible")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      6fb303a8
    • Arnd Bergmann's avatar
      watchdog: geode: restore hard CS5535_MFGPT dependency · 0369fdf2
      Arnd Bergmann authored
      Wtihout CONFIG_CS5535_MFGPT, the driver does not link right:
      
      drivers/watchdog/built-in.o: In function `geodewdt_probe':
      geodewdt.c:(.init.text+0xca3): undefined reference to `cs5535_mfgpt_alloc_timer'
      geodewdt.c:(.init.text+0xcd4): undefined reference to `cs5535_mfgpt_write'
      geodewdt.c:(.init.text+0xcef): undefined reference to `cs5535_mfgpt_toggle_event'
      
      This adds back the dependency on this base driver.
      
      Fixes: da2a68b3 ("watchdog: Enable COMPILE_TEST where possible")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      0369fdf2
    • Arnd Bergmann's avatar
      watchdog: wm831x watchdog really needs mfd · d0e32fba
      Arnd Bergmann authored
      The wm831x watchdog driver can now be built without the wm831x mfd
      driver, which results in a link error:
      
      (.text+0x1a95c): undefined reference to `wm831x_set_bits'
      (.text+0x1a95c): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `wm831x_set_bits'
      (.text+0x1a968): undefined reference to `wm831x_reg_lock'
      (.text+0x1a968): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `wm831x_reg_lock'
      (.text+0x1a9dc): undefined reference to `wm831x_reg_unlock'
      (.text+0x1a9dc): relocation truncated to fit: R_AARCH64_CALL26 against undefined symbol `wm831x_reg_unlock'
      
      This adds back the dependency that was removed. We can still build test
      this driver on all architectures by enabling the MFD driver for it first.
      
      Fixes: da2a68b3 ("watchdog: Enable COMPILE_TEST where possible")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      d0e32fba
    • Josh Poimboeuf's avatar
      objtool, compiler.h: Fix __unreachable section relocation size · 55149d06
      Josh Poimboeuf authored
      Linus reported the following commit broke module loading on his laptop:
      
        d1091c7f ("objtool: Improve detection of BUG() and other dead ends")
      
      It showed errors like the following:
      
        module: overflow in relocation type 10 val ffffffffc02afc81
        module: 'nvme' likely not compiled with -mcmodel=kernel
      
      The problem is that the __unreachable section addresses are stored using
      the '.long' asm directive, which isn't big enough for .text section
      kernel addresses.  Use relative addresses instead:
      
        ".long %c0b - .\t\n"
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: d1091c7f ("objtool: Improve detection of BUG() and other dead ends")
      Link: http://lkml.kernel.org/r/20170301060504.oltm3iws6fmubnom@trebleSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      55149d06