1. 09 4月, 2017 1 次提交
  2. 17 3月, 2017 1 次提交
  3. 03 3月, 2017 1 次提交
    • D
      statx: Add a system call to make enhanced file info available · a528d35e
      David Howells 提交于
      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: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      a528d35e
  4. 02 3月, 2017 3 次提交
  5. 27 2月, 2017 1 次提交
    • R
      cpuidle: menu: Avoid taking spinlock for accessing QoS values · 6dbf5cea
      Rafael J. Wysocki 提交于
      After commit 9908859a (cpuidle/menu: add per CPU PM QoS resume
      latency consideration) the cpuidle menu governor calls
      dev_pm_qos_read_value() on CPU devices to read the current resume
      latency QoS constraint values for them.  That function takes a spinlock
      to prevent the device's power.qos pointer from becoming NULL during
      the access which is a problem for the RT patchset where spinlocks are
      converted into mutexes and the idle loop stops working.
      
      However, it is not even necessary for the menu governor to take
      that spinlock, because the power.qos pointer accessed under it
      cannot be modified during the access anyway.
      
      For this reason, introduce a "raw" routine for accessing device
      QoS resume latency constraints without locking and use it in the
      menu governor.
      
      Fixes: 9908859a (cpuidle/menu: add per CPU PM QoS resume latency consideration)
      Acked-by: NAlex Shi <alex.shi@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      6dbf5cea
  6. 25 2月, 2017 4 次提交
  7. 24 2月, 2017 5 次提交
  8. 18 2月, 2017 1 次提交
    • J
      PM / QoS: Fix memory leak on resume_latency.notifiers · e84b4a84
      John Keeping 提交于
      Since commit 2d984ad1 (PM / QoS: Introcuce latency tolerance device
      PM QoS type) we reassign "c" to point at qos->latency_tolerance before
      freeing c->notifiers, but the notifiers field of latency_tolerance is
      never used.
      
      Restore the original behaviour of freeing the notifiers pointer on
      qos->resume_latency, which is used, and fix the following kmemleak
      warning.
      
      unreferenced object 0xed9dba00 (size 64):
        comm "kworker/0:1", pid 36, jiffies 4294670128 (age 15202.983s)
        hex dump (first 32 bytes):
          00 00 00 00 04 ba 9d ed 04 ba 9d ed 00 00 00 00  ................
          00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
        backtrace:
          [<c06f6084>] kmemleak_alloc+0x74/0xb8
          [<c011c964>] kmem_cache_alloc_trace+0x170/0x25c
          [<c035f448>] dev_pm_qos_constraints_allocate+0x3c/0xe4
          [<c035f574>] __dev_pm_qos_add_request+0x84/0x1a0
          [<c035f6cc>] dev_pm_qos_add_request+0x3c/0x54
          [<c03c3fc4>] usb_hub_create_port_device+0x110/0x2b8
          [<c03b2a60>] hub_probe+0xadc/0xc80
          [<c03bb050>] usb_probe_interface+0x1b4/0x260
          [<c035773c>] driver_probe_device+0x198/0x40c
          [<c0357b14>] __device_attach_driver+0x8c/0x98
          [<c0355bbc>] bus_for_each_drv+0x8c/0x9c
          [<c0357494>] __device_attach+0x98/0x138
          [<c0357c64>] device_initial_probe+0x14/0x18
          [<c03569dc>] bus_probe_device+0x30/0x88
          [<c0354c54>] device_add+0x430/0x554
          [<c03b92d8>] usb_set_configuration+0x660/0x6fc
      
      Fixes: 2d984ad1 (PM / QoS: Introcuce latency tolerance device PM QoS type)
      Signed-off-by: NJohn Keeping <john@metanate.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      e84b4a84
  9. 14 2月, 2017 3 次提交
    • G
      PM / wakeirq: report a wakeup_event on dedicated wekup irq · 09bb6e93
      Grygorii Strashko 提交于
      There are two reasons for reporting wakeup event when dedicated wakeup
      IRQ is triggered:
      
      - wakeup events accounting, so proper statistical data will be
        displayed in sysfs and debugfs;
      
      - there are small window when System is entering suspend during which
        dedicated wakeup IRQ can be lost:
      
      dpm_suspend_noirq()
        |- device_wakeup_arm_wake_irqs()
            |- dev_pm_arm_wake_irq(X)
               |- IRQ is enabled and marked as wakeup source
      [1]...
        |- suspend_device_irqs()
           |- suspend_device_irq(X)
      	|- irqd_set(X, IRQD_WAKEUP_ARMED);
      	   |- wakup IRQ armed
      
      The wakeup IRQ can be lost if it's triggered at point [1]
      and not armed yet.
      
      Hence, fix above cases by adding simple pm_wakeup_event() call in
      handle_threaded_wake_irq().
      
      Fixes: 4990d4fe (PM / Wakeirq: Add automated device wake IRQ handling)
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Tested-by: NKeerthy <j-keerthy@ti.com>
      [ tony@atomide.com: added missing return to avoid warnings ]
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      09bb6e93
    • G
      PM / wakeirq: Fix spurious wake-up events for dedicated wakeirqs · 0bf0ee8e
      Grygorii Strashko 提交于
      Dedicated wakeirq is a one time event to wake-up the system from
      low-power state and then call pm_runtime_resume() on the device wired
      with the dedicated wakeirq.
      
      Sometimes dedicated wakeirqs can get deferred if they trigger after we
      call disable_irq_nosync() in dev_pm_disable_wake_irq(). This can happen
      if pm_runtime_get() is called around the same time a wakeirq fires.
      
      If an interrupt fires after disable_irq_nosync(), by default it will get
      tagged with IRQS_PENDING and will run later on when the interrupt is
      enabled again.
      
      Deferred wakeirqs usually just produce pointless wake-up events. But they
      can also cause suspend to fail if the deferred wakeirq fires during
      dpm_suspend_noirq() for example. So we really don't want to see the
      deferred wakeirqs triggering after the device has resumed.
      
      Let's fix the issue by setting IRQ_DISABLE_UNLAZY flag for the dedicated
      wakeirqs. The other option would be to implement irq_disable() in the
      dedicated wakeirq controller, but that's not a generic solution.
      
      For reference below is what happens with a IRQ_TYPE_EDGE_BOTH IRQ
      type wakeirq:
      
      - resume by dedicated IRQ (EDGE_FALLING)
       - suspend_enter()
        ....
       - arch_suspend_enable_irqs()
         |- dedicated IRQ armed and fired
         |- irq_pm_check_wakeup()
            |- disarm, disable IRQ and mark as IRQS_PENDING
        ....
       - dpm_resume_noirq()
         |- resume_device_irqs()
            |- __enable_irq()
               |- check_irq_resend()
                  |- handle_threaded_wake_irq()
       	       |- dedicated IRQ processed
         |- device_wakeup_disarm_wake_irqs()
            |- disable_irq_wake()
        ....
       !-> dedicated IRQ (EDGE_RISING)
           -| handle_edge_irq()
              |- IRQ disabled: mask_ack_irq and mark as IRQS_PENDING
        ....
      - subsequent suspend
        ....
        |- dpm_suspend_noirq()
           |- device_wakeup_arm_wake_irqs()
              |- __enable_irq()
                 |- check_irq_resend()
      (a)           |- handle_threaded_wake_irq()
                       |- pm_wakeup_event() --> abort suspend
        ....
           |- suspend_device_irqs()
              |- suspend_device_irq()
                 |-  dedicated IRQ armed
        ....
      (b)  |- resend_irqs
              |- irq_pm_check_wakeup()
                 |- IRQ armed -> abort suspend
      
      because of pending IRQ System suspend can be aborted at points
      (a)-not armed or (b)-armed.
      
      Fixes: 4990d4fe (PM / Wakeirq: Add automated device wake IRQ handling)
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      [ tony@atomide.com: added a comment, updated the description ]
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0bf0ee8e
    • G
      PM / wakeirq: Enable dedicated wakeirq for suspend · c8434559
      Grygorii Strashko 提交于
      We currently rely on runtime PM to enable dedicated wakeirq for suspend.
      This assumption fails in the following two cases:
      
      1. If the consumer driver does not have runtime PM implemented, the
         dedicated wakeirq never gets enabled for suspend
      
      2. If the consumer driver has runtime PM implemented, but does not idle
         in suspend
      
      Let's fix the issue by always enabling the dedicated wakeirq during
      suspend.
      
      Depends-on: bed57030 (PM / wakeirq: Fix dedicated wakeirq for drivers not using autosuspend)
      Fixes: 4990d4fe (PM / Wakeirq: Add automated device wake IRQ handling)
      Reported-by: NKeerthy <j-keerthy@ti.com>
      Tested-by: NKeerthy <j-keerthy@ti.com>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      [ tony@atomide.com: updated based on bed57030, added description ]
      Tested-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c8434559
  10. 10 2月, 2017 1 次提交
  11. 09 2月, 2017 1 次提交
  12. 08 2月, 2017 1 次提交
  13. 07 2月, 2017 4 次提交
  14. 04 2月, 2017 2 次提交
    • R
      PM / runtime: Avoid false-positive warnings from might_sleep_if() · a9306a63
      Rafael J. Wysocki 提交于
      The might_sleep_if() assertions in __pm_runtime_idle(),
      __pm_runtime_suspend() and __pm_runtime_resume() may generate
      false-positive warnings in some situations.  For example, that
      happens if a nested pm_runtime_get_sync()/pm_runtime_put() pair
      is executed with disabled interrupts within an outer
      pm_runtime_get_sync()/pm_runtime_put() section for the same device.
      [Generally, pm_runtime_get_sync() may sleep, so it should not be
      called with disabled interrupts, but in this particular case the
      previous pm_runtime_get_sync() guarantees that the device will not
      be suspended, so the inner pm_runtime_get_sync() will return
      immediately after incrementing the device's usage counter.]
      
      That started to happen in the i915 driver in 4.10-rc, leading to
      the following splat:
      
       BUG: sleeping function called from invalid context at drivers/base/power/runtime.c:1032
       in_atomic(): 1, irqs_disabled(): 0, pid: 1500, name: Xorg
       1 lock held by Xorg/1500:
        #0:  (&dev->struct_mutex){+.+.+.}, at:
        [<ffffffffa0680c13>] i915_mutex_lock_interruptible+0x43/0x140 [i915]
       CPU: 0 PID: 1500 Comm: Xorg Not tainted
       Call Trace:
        dump_stack+0x85/0xc2
        ___might_sleep+0x196/0x260
        __might_sleep+0x53/0xb0
        __pm_runtime_resume+0x7a/0x90
        intel_runtime_pm_get+0x25/0x90 [i915]
        aliasing_gtt_bind_vma+0xaa/0xf0 [i915]
        i915_vma_bind+0xaf/0x1e0 [i915]
        i915_gem_execbuffer_relocate_entry+0x513/0x6f0 [i915]
        i915_gem_execbuffer_relocate_vma.isra.34+0x188/0x250 [i915]
        ? trace_hardirqs_on+0xd/0x10
        ? i915_gem_execbuffer_reserve_vma.isra.31+0x152/0x1f0 [i915]
        ? i915_gem_execbuffer_reserve.isra.32+0x372/0x3a0 [i915]
        i915_gem_do_execbuffer.isra.38+0xa70/0x1a40 [i915]
        ? __might_fault+0x4e/0xb0
        i915_gem_execbuffer2+0xc5/0x260 [i915]
        ? __might_fault+0x4e/0xb0
        drm_ioctl+0x206/0x450 [drm]
        ? i915_gem_execbuffer+0x340/0x340 [i915]
        ? __fget+0x5/0x200
        do_vfs_ioctl+0x91/0x6f0
        ? __fget+0x111/0x200
        ? __fget+0x5/0x200
        SyS_ioctl+0x79/0x90
        entry_SYSCALL_64_fastpath+0x23/0xc6
      
      even though the code triggering it is correct.
      
      Unfortunately, the might_sleep_if() assertions in question are
      too coarse-grained to cover such cases correctly, so make them
      a bit less sensitive in order to avoid the false-positives.
      Reported-and-tested-by: NSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      a9306a63
    • T
      base/memory, hotplug: fix a kernel oops in show_valid_zones() · a96dfddb
      Toshi Kani 提交于
      Reading a sysfs "memoryN/valid_zones" file leads to the following oops
      when the first page of a range is not backed by struct page.
      show_valid_zones() assumes that 'start_pfn' is always valid for
      page_zone().
      
       BUG: unable to handle kernel paging request at ffffea017a000000
       IP: show_valid_zones+0x6f/0x160
      
      This issue may happen on x86-64 systems with 64GiB or more memory since
      their memory block size is bumped up to 2GiB.  [1] An example of such
      systems is desribed below.  0x3240000000 is only aligned by 1GiB and
      this memory block starts from 0x3200000000, which is not backed by
      struct page.
      
       BIOS-e820: [mem 0x0000003240000000-0x000000603fffffff] usable
      
      Since test_pages_in_a_zone() already checks holes, fix this issue by
      extending this function to return 'valid_start' and 'valid_end' for a
      given range.  show_valid_zones() then proceeds with the valid range.
      
      [1] 'Commit bdee237c ("x86: mm: Use 2GB memory block size on
          large-memory x86-64 systems")'
      
      Link: http://lkml.kernel.org/r/20170127222149.30893-3-toshi.kani@hpe.comSigned-off-by: NToshi Kani <toshi.kani@hpe.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Zhang Zhen <zhenzhang.zhang@huawei.com>
      Cc: Reza Arbab <arbab@linux.vnet.ibm.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Cc: <stable@vger.kernel.org>	[4.4+]
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      a96dfddb
  15. 03 2月, 2017 1 次提交
  16. 30 1月, 2017 10 次提交