13 Sep, 2015

1 commit

  • rq_data_dir() returns either READ or WRITE (0 == READ, 1 == WRITE), not
    a boolean value.

    Now, admittedly the "!= 0" doesn't really change the value (0 stays as
    zero, 1 stays as one), but it's not only redundant, it confuses gcc, and
    causes gcc to warn about the construct

    switch (rq_data_dir(req)) {
    case READ:
    ...
    case WRITE:
    ...

    that we have in a few drivers.

    Now, the gcc warning is silly and stupid (it seems to warn not about the
    switch value having a different type from the case statements, but about
    _any_ boolean switch value), but in this case the code itself is silly
    and stupid too, so let's just change it, and get rid of warnings like
    this:

    drivers/block/hd.c: In function ‘hd_request’:
    drivers/block/hd.c:630:11: warning: switch condition has boolean value [-Wswitch-bool]
    switch (rq_data_dir(req)) {

    The odd '!= 0' came in when "cmd_flags" got turned into a "u64" in
    commit 5953316dbf90 ("block: make rq->cmd_flags be 64-bit") and is
    presumably because the old code (that just did a logical 'and' with 1)
    would then end up making the type of rq_data_dir() be u64 too.

    But if we want to retain the old regular integer type, let's just cast
    the result to 'int' rather than use that rather odd '!= 0'.

    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

12 Sep, 2015

11 commits

  • Merge fourth patch-bomb from Andrew Morton:

    - sys_membarier syscall

    - seq_file interface changes

    - a few misc fixups

    * emailed patches from Andrew Morton :
    revert "ocfs2/dlm: use list_for_each_entry instead of list_for_each"
    mm/early_ioremap: add explicit #include of asm/early_ioremap.h
    fs/seq_file: convert int seq_vprint/seq_printf/etc... returns to void
    selftests: enhance membarrier syscall test
    selftests: add membarrier syscall test
    sys_membarrier(): system-wide memory barrier (generic, x86)
    MODSIGN: fix a compilation warning in extract-cert

    Linus Torvalds
     
  • Pull NTB fixes from Jon Mason:
    "NTB bug and documentation fixes, new device IDs, performance
    improvements, and adding a mailing list to MAINTAINERS for NTB"

    * tag 'ntb-4.3' of git://github.com/jonmason/ntb:
    NTB: Fix range check on memory window index
    NTB: Improve index handling in B2B MW workaround
    NTB: Fix documentation for ntb_peer_db_clear.
    NTB: Fix documentation for ntb_link_is_up
    NTB: Use unique DMA channels for TX and RX
    NTB: Remove dma_sync_wait from ntb_async_rx
    NTB: Clean up QP stats info
    NTB: Make the transport list in order of discovery
    NTB: Add PCI Device IDs for Broadwell Xeon
    NTB: Add flow control to the ntb_netdev
    NTB: Add list to MAINTAINERS

    Linus Torvalds
     
  • Pull more power management and ACPI updates from Rafael Wysocki:
    "These are mostly fixes and cleanups on top of the previous PM+ACPI
    pull request (cpufreq core and drivers, cpuidle, generic power domains
    framework). Some of them didn't make to that pull request and some
    fix issues introduced by it.

    The only really new thing is the support for suspend frequency in the
    cpufreq-dt driver, but it is needed to fix an issue with Exynos
    platforms.

    Specifics:

    - build fix for the new Mediatek MT8173 cpufreq driver (Guenter
    Roeck).

    - generic power domains framework fixes (power on error code path,
    subdomain removal) and cleanup of a deprecated API user (Geert
    Uytterhoeven, Jon Hunter, Ulf Hansson).

    - cpufreq-dt driver fixes including two fixes for bugs related to the
    new Operating Performance Points Device Tree bindings introduced
    recently (Viresh Kumar).

    - suspend frequency support for the cpufreq-dt driver (Bartlomiej
    Zolnierkiewicz, Viresh Kumar).

    - cpufreq core cleanups (Viresh Kumar).

    - intel_pstate driver fixes (Chen Yu, Kristen Carlson Accardi).

    - additional sanity check in the cpuidle core (Xunlei Pang).

    - fix for a comment related to CPU power management (Lina Iyer)"

    * tag 'pm+acpi-4.3-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    intel_pstate: fix PCT_TO_HWP macro
    intel_pstate: Fix user input of min/max to legal policy region
    PM / OPP: Return suspend_opp only if it is enabled
    cpufreq-dt: add suspend frequency support
    cpufreq: allow cpufreq_generic_suspend() to work without suspend frequency
    PM / OPP: add dev_pm_opp_get_suspend_opp() helper
    staging: board: Migrate away from __pm_genpd_name_add_device()
    cpufreq: Use __func__ to print function's name
    cpufreq: staticize cpufreq_cpu_get_raw()
    PM / Domains: Ensure subdomain is not in use before removing
    cpufreq: Add ARM_MT8173_CPUFREQ dependency on THERMAL
    cpuidle/coupled: Add sanity check for safe_state_index
    PM / Domains: Try power off masters in error path of __pm_genpd_poweron()
    cpufreq: dt: Tolerance applies on both sides of target voltage
    cpufreq: dt: Print error on failing to mark OPPs as shared
    cpufreq: dt: Check OPP count before marking them shared
    kernel/cpu_pm: fix cpu_cluster_pm_exit comment

    Linus Torvalds
     
  • Pull SCSI target updates from Nicholas Bellinger:
    "Here are the outstanding target-pending updates for v4.3-rc1.

    Mostly bug-fixes and minor changes this round. The fallout from the
    big v4.2-rc1 RCU conversion have (thus far) been minimal.

    The highlights this round include:

    - Move sense handling routines into scsi_common code (Sagi)

    - Return ABORTED_COMMAND sense key for PI errors (Sagi)

    - Add tpg_enabled_sendtargets attribute for disabled iscsi-target
    discovery (David)

    - Shrink target struct se_cmd by rearranging fields (Roland)

    - Drop iSCSI use of mutex around max_cmd_sn increment (Roland)

    - Replace iSCSI __kernel_sockaddr_storage with sockaddr_storage (Andy +
    Chris)

    - Honor fabric max_data_sg_nents I/O transfer limit (Arun + Himanshu +
    nab)

    - Fix EXTENDED_COPY >= v4.1 regression OOPsen (Alex + nab)"

    * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (37 commits)
    target: use stringify.h instead of own definition
    target/user: Fix UFLAG_UNKNOWN_OP handling
    target: Remove no-op conditional
    target/user: Remove unused variable
    target: Fix max_cmd_sn increment w/o cmdsn mutex regressions
    target: Attach EXTENDED_COPY local I/O descriptors to xcopy_pt_sess
    target/qla2xxx: Honor max_data_sg_nents I/O transfer limit
    target/iscsi: Replace __kernel_sockaddr_storage with sockaddr_storage
    target/iscsi: Replace conn->login_ip with login_sockaddr
    target/iscsi: Keep local_ip as the actual sockaddr
    target/iscsi: Fix np_ip bracket issue by removing np_ip
    target: Drop iSCSI use of mutex around max_cmd_sn increment
    qla2xxx: Update tcm_qla2xxx module description to 24xx+
    iscsi-target: Add tpg_enabled_sendtargets for disabled discovery
    drivers: target: Drop unlikely before IS_ERR(_OR_NULL)
    target: check DPO/FUA usage for COMPARE AND WRITE
    target: Shrink struct se_cmd by rearranging fields
    target: Remove cmd->se_ordered_id (unused except debug log lines)
    target: add support for START_STOP_UNIT SCSI opcode
    target: improve unsupported opcode message
    ...

    Linus Torvalds
     
  • Pull second round of SCSI updates from James Bottomley:
    "There's one late arriving patch here (added today), fixing a build
    issue which the scsi_dh patch set in here uncovered. Other than that,
    everything has been incubated in -next and the checkers for a week.

    The major pieces of this patch are a set patches facilitating better
    integration between scsi and scsi_dh (the device handling layer used
    by multi-path; all the dm parts are acked by Mike Snitzer).

    This also includes driver updates for mp3sas, scsi_debug and an
    assortment of bug fixes"

    * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (50 commits)
    scsi_dh: fix randconfig build error
    scsi: fix scsi_error_handler vs. scsi_host_dev_release race
    fcoe: Convert use of __constant_htons to htons
    mpt2sas: setpci reset kernel oops fix
    pm80xx: Don't override ts->stat on IO_OPEN_CNX_ERROR_HW_RESOURCE_BUSY
    lpfc: Fix possible use-after-free and double free in lpfc_mbx_cmpl_rdp_page_a2()
    bfa: Fix incorrect de-reference of pointer
    bfa: Fix indentation
    scsi_transport_sas: Remove check for SAS expander when querying bay/enclosure IDs.
    scsi_debug: resp_request: remove unused variable
    scsi_debug: fix REPORT LUNS Well Known LU
    scsi_debug: schedule_resp fix input variable check
    scsi_debug: make dump_sector static
    scsi_debug: vfree is null safe so drop the check
    scsi_debug: use SCSI_W_LUN_REPORT_LUNS instead of SAM2_WLUN_REPORT_LUNS;
    scsi_debug: define pr_fmt() for consistent logging
    mpt2sas: Refcount fw_events and fix unsafe list usage
    mpt2sas: Refcount sas_device objects and fix unsafe list usage
    scsi_dh: return SCSI_DH_NOTCONN in scsi_dh_activate()
    scsi_dh: don't allow to detach device handlers at runtime
    ...

    Linus Torvalds
     
  • Pull media updates from Mauro Carvalho Chehab:
    "A series of patches that move part of the code used to allocate memory
    from the media subsystem to the mm subsystem"

    [ The mm parts have been acked by VM people, and the series was
    apparently in -mm for a while - Linus ]

    * tag 'media/v4.3-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
    [media] drm/exynos: Convert g2d_userptr_get_dma_addr() to use get_vaddr_frames()
    [media] media: vb2: Remove unused functions
    [media] media: vb2: Convert vb2_dc_get_userptr() to use frame vector
    [media] media: vb2: Convert vb2_vmalloc_get_userptr() to use frame vector
    [media] media: vb2: Convert vb2_dma_sg_get_userptr() to use frame vector
    [media] vb2: Provide helpers for mapping virtual addresses
    [media] media: omap_vout: Convert omap_vout_uservirt_to_phys() to use get_vaddr_pfns()
    [media] mm: Provide new get_vaddr_frames() helper
    [media] vb2: Push mmap_sem down to memops

    Linus Torvalds
     
  • Pull thermal updates from Zhang Rui:

    - use int instead of unsigned long to represent temperature to avoid
    bogus overheat detection when negative temperature reported. From
    Sascha Hauer.

    - export available thermal governors information to user space via
    sysfs. From Wei Ni.

    - introduce new thermal driver for Wildcat Point platform controller
    hub, which uses PCH thermal sensor and associated critical and hot
    trip points. From Tushar Dave.

    - add suuport for Intel Skylake and Denlow platforms in powerclamp
    driver.

    - some small cleanups in thermal core.

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
    thermal: Add Intel PCH thermal driver
    thermal: Add comment explaining test for critical temperature
    thermal: Use IS_ENABLED instead of #ifdef
    thermal: remove unnecessary call to thermal_zone_device_set_polling
    thermal: trivial: fix typo in comment
    thermal: consistently use int for temperatures
    thermal: add available policies sysfs attribute
    thermal/powerclamp: add cpu id for denlow platform
    thermal/powerclamp: add cpu id for Skylake u/y
    thermal/powerclamp: add cpu id for skylake h/s

    Linus Torvalds
     
  • The seq_ function return values were frequently misused.

    See: commit 1f33c41c03da ("seq_file: Rename seq_overflow() to
    seq_has_overflowed() and make public")

    All uses of these return values have been removed, so convert the
    return types to void.

    Miscellanea:

    o Move seq_put_decimal_ and seq_escape prototypes closer the
    other seq_vprintf prototypes
    o Reorder seq_putc and seq_puts to return early on overflow
    o Add argument names to seq_vprintf and seq_printf
    o Update the seq_escape kernel-doc
    o Convert a couple of leading spaces to tabs in seq_escape

    Signed-off-by: Joe Perches
    Cc: Al Viro
    Cc: Steven Rostedt
    Cc: Mark Brown
    Cc: Stephen Rothwell
    Cc: Joerg Roedel
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Joe Perches
     
  • Here is an implementation of a new system call, sys_membarrier(), which
    executes a memory barrier on all threads running on the system. It is
    implemented by calling synchronize_sched(). It can be used to
    distribute the cost of user-space memory barriers asymmetrically by
    transforming pairs of memory barriers into pairs consisting of
    sys_membarrier() and a compiler barrier. For synchronization primitives
    that distinguish between read-side and write-side (e.g. userspace RCU
    [1], rwlocks), the read-side can be accelerated significantly by moving
    the bulk of the memory barrier overhead to the write-side.

    The existing applications of which I am aware that would be improved by
    this system call are as follows:

    * Through Userspace RCU library (http://urcu.so)
    - DNS server (Knot DNS) https://www.knot-dns.cz/
    - Network sniffer (http://netsniff-ng.org/)
    - Distributed object storage (https://sheepdog.github.io/sheepdog/)
    - User-space tracing (http://lttng.org)
    - Network storage system (https://www.gluster.org/)
    - Virtual routers (https://events.linuxfoundation.org/sites/events/files/slides/DPDK_RCU_0MQ.pdf)
    - Financial software (https://lkml.org/lkml/2015/3/23/189)

    Those projects use RCU in userspace to increase read-side speed and
    scalability compared to locking. Especially in the case of RCU used by
    libraries, sys_membarrier can speed up the read-side by moving the bulk of
    the memory barrier cost to synchronize_rcu().

    * Direct users of sys_membarrier
    - core dotnet garbage collector (https://github.com/dotnet/coreclr/issues/198)

    Microsoft core dotnet GC developers are planning to use the mprotect()
    side-effect of issuing memory barriers through IPIs as a way to implement
    Windows FlushProcessWriteBuffers() on Linux. They are referring to
    sys_membarrier in their github thread, specifically stating that
    sys_membarrier() is what they are looking for.

    To explain the benefit of this scheme, let's introduce two example threads:

    Thread A (non-frequent, e.g. executing liburcu synchronize_rcu())
    Thread B (frequent, e.g. executing liburcu
    rcu_read_lock()/rcu_read_unlock())

    In a scheme where all smp_mb() in thread A are ordering memory accesses
    with respect to smp_mb() present in Thread B, we can change each
    smp_mb() within Thread A into calls to sys_membarrier() and each
    smp_mb() within Thread B into compiler barriers "barrier()".

    Before the change, we had, for each smp_mb() pairs:

    Thread A Thread B
    previous mem accesses previous mem accesses
    smp_mb() smp_mb()
    following mem accesses following mem accesses

    After the change, these pairs become:

    Thread A Thread B
    prev mem accesses prev mem accesses
    sys_membarrier() barrier()
    follow mem accesses follow mem accesses

    As we can see, there are two possible scenarios: either Thread B memory
    accesses do not happen concurrently with Thread A accesses (1), or they
    do (2).

    1) Non-concurrent Thread A vs Thread B accesses:

    Thread A Thread B
    prev mem accesses
    sys_membarrier()
    follow mem accesses
    prev mem accesses
    barrier()
    follow mem accesses

    In this case, thread B accesses will be weakly ordered. This is OK,
    because at that point, thread A is not particularly interested in
    ordering them with respect to its own accesses.

    2) Concurrent Thread A vs Thread B accesses

    Thread A Thread B
    prev mem accesses prev mem accesses
    sys_membarrier() barrier()
    follow mem accesses follow mem accesses

    In this case, thread B accesses, which are ensured to be in program
    order thanks to the compiler barrier, will be "upgraded" to full
    smp_mb() by synchronize_sched().

    * Benchmarks

    On Intel Xeon E5405 (8 cores)
    (one thread is calling sys_membarrier, the other 7 threads are busy
    looping)

    1000 non-expedited sys_membarrier calls in 33s =3D 33 milliseconds/call.

    * User-space user of this system call: Userspace RCU library

    Both the signal-based and the sys_membarrier userspace RCU schemes
    permit us to remove the memory barrier from the userspace RCU
    rcu_read_lock() and rcu_read_unlock() primitives, thus significantly
    accelerating them. These memory barriers are replaced by compiler
    barriers on the read-side, and all matching memory barriers on the
    write-side are turned into an invocation of a memory barrier on all
    active threads in the process. By letting the kernel perform this
    synchronization rather than dumbly sending a signal to every process
    threads (as we currently do), we diminish the number of unnecessary wake
    ups and only issue the memory barriers on active threads. Non-running
    threads do not need to execute such barrier anyway, because these are
    implied by the scheduler context switches.

    Results in liburcu:

    Operations in 10s, 6 readers, 2 writers:

    memory barriers in reader: 1701557485 reads, 2202847 writes
    signal-based scheme: 9830061167 reads, 6700 writes
    sys_membarrier: 9952759104 reads, 425 writes
    sys_membarrier (dyn. check): 7970328887 reads, 425 writes

    The dynamic sys_membarrier availability check adds some overhead to
    the read-side compared to the signal-based scheme, but besides that,
    sys_membarrier slightly outperforms the signal-based scheme. However,
    this non-expedited sys_membarrier implementation has a much slower grace
    period than signal and memory barrier schemes.

    Besides diminishing the number of wake-ups, one major advantage of the
    membarrier system call over the signal-based scheme is that it does not
    need to reserve a signal. This plays much more nicely with libraries,
    and with processes injected into for tracing purposes, for which we
    cannot expect that signals will be unused by the application.

    An expedited version of this system call can be added later on to speed
    up the grace period. Its implementation will likely depend on reading
    the cpu_curr()->mm without holding each CPU's rq lock.

    This patch adds the system call to x86 and to asm-generic.

    [1] http://urcu.so

    membarrier(2) man page:

    MEMBARRIER(2) Linux Programmer's Manual MEMBARRIER(2)

    NAME
    membarrier - issue memory barriers on a set of threads

    SYNOPSIS
    #include

    int membarrier(int cmd, int flags);

    DESCRIPTION
    The cmd argument is one of the following:

    MEMBARRIER_CMD_QUERY
    Query the set of supported commands. It returns a bitmask of
    supported commands.

    MEMBARRIER_CMD_SHARED
    Execute a memory barrier on all threads running on the system.
    Upon return from system call, the caller thread is ensured that
    all running threads have passed through a state where all memory
    accesses to user-space addresses match program order between
    entry to and return from the system call (non-running threads
    are de facto in such a state). This covers threads from all pro=E2=80=90
    cesses running on the system. This command returns 0.

    The flags argument needs to be 0. For future extensions.

    All memory accesses performed in program order from each targeted
    thread is guaranteed to be ordered with respect to sys_membarrier(). If
    we use the semantic "barrier()" to represent a compiler barrier forcing
    memory accesses to be performed in program order across the barrier,
    and smp_mb() to represent explicit memory barriers forcing full memory
    ordering across the barrier, we have the following ordering table for
    each pair of barrier(), sys_membarrier() and smp_mb():

    The pair ordering is detailed as (O: ordered, X: not ordered):

    barrier() smp_mb() sys_membarrier()
    barrier() X X O
    smp_mb() X O O
    sys_membarrier() O O O

    RETURN VALUE
    On success, these system calls return zero. On error, -1 is returned,
    and errno is set appropriately. For a given command, with flags
    argument set to 0, this system call is guaranteed to always return the
    same value until reboot.

    ERRORS
    ENOSYS System call is not implemented.

    EINVAL Invalid arguments.

    Linux 2015-04-15 MEMBARRIER(2)

    Signed-off-by: Mathieu Desnoyers
    Reviewed-by: Paul E. McKenney
    Reviewed-by: Josh Triplett
    Cc: KOSAKI Motohiro
    Cc: Steven Rostedt
    Cc: Nicholas Miell
    Cc: Ingo Molnar
    Cc: Alan Cox
    Cc: Lai Jiangshan
    Cc: Stephen Hemminger
    Cc: Thomas Gleixner
    Cc: Peter Zijlstra
    Cc: David Howells
    Cc: Pranith Kumar
    Cc: Michael Kerrisk
    Cc: Shuah Khan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mathieu Desnoyers
     
  • Pull Ceph update from Sage Weil:
    "There are a few fixes for snapshot behavior with CephFS and support
    for the new keepalive protocol from Zheng, a libceph fix that affects
    both RBD and CephFS, a few bug fixes and cleanups for RBD from Ilya,
    and several small fixes and cleanups from Jianpeng and others"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
    ceph: improve readahead for file holes
    ceph: get inode size for each append write
    libceph: check data_len in ->alloc_msg()
    libceph: use keepalive2 to verify the mon session is alive
    rbd: plug rbd_dev->header.object_prefix memory leak
    rbd: fix double free on rbd_dev->header_name
    libceph: set 'exists' flag for newly up osd
    ceph: cleanup use of ceph_msg_get
    ceph: no need to get parent inode in ceph_open
    ceph: remove the useless judgement
    ceph: remove redundant test of head->safe and silence static analysis warnings
    ceph: fix queuing inode to mdsdir's snaprealm
    libceph: rename con_work() to ceph_con_workfn()
    libceph: Avoid holding the zero page on ceph_msgr_slab_init errors
    libceph: remove the unused macro AES_KEY_SIZE
    ceph: invalidate dirty pages after forced umount
    ceph: EIO all operations after forced umount

    Linus Torvalds
     
  • Pull drm fixes from Dave Airlie:
    "Just a bunch of fixes to squeeze in before -rc1:

    - three nouveau regression fixes

    - one qxl regression fix

    - a bunch of i915 fixes

    ... and some core displayport/atomic fixes"

    * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
    drm/nouveau/device: enable c800 quirk for tecra w50
    drm/nouveau/clk/gt215: Unbreak engine pausing for GT21x/MCP7x
    drm/nouveau/gr/nv04: fix big endian setting on gr context
    drm/qxl: validate monitors config modes
    drm/i915: Allow DSI dual link to be configured on any pipe
    drm/i915: Don't try to use DDR DVFS on CHV when disabled in the BIOS
    drm/i915: Fix CSR MMIO address check
    drm/i915: Limit the number of loops for reading a split 64bit register
    drm/i915: Fix broken mst get_hw_state.
    drm/i915: Pass hpd_status_i915[] to intel_get_hpd_pins() in pre-g4x
    uapi/drm/i915_drm.h: fix userspace compilation.
    drm/i915: Always mark the object as dirty when used by the GPU
    drm/dp: Add dp_aux_i2c_speed_khz module param to set the assume i2c bus speed
    drm/dp: Adjust i2c-over-aux retry count based on message size and i2c bus speed
    drm/dp: Define AUX_RETRY_INTERVAL as 500 us
    drm/atomic: Fix bookkeeping with TEST_ONLY, v3.

    Linus Torvalds
     

11 Sep, 2015

28 commits

  • * pm-opp:
    PM / OPP: Return suspend_opp only if it is enabled
    PM / OPP: add dev_pm_opp_get_suspend_opp() helper

    Rafael J. Wysocki
     
  • Signed-off-by: David Disseldorp
    Acked-by: Andy Grover
    Signed-off-by: Nicholas Bellinger

    David Disseldorp
     
  • This patch adds an optional fabric driver provided SGL limit
    that target-core will honor as it's own internal I/O maximum
    transfer length limit, as exposed by EVPD=0xb0 block limits
    parameters.

    This is required for handling cases when host I/O transfer
    length exceeds the requested EVPD block limits maximum
    transfer length. The initial user of this logic is qla2xxx,
    so that we can avoid having to reject I/Os from some legacy
    FC hosts where EVPD=0xb0 parameters are not honored.

    When se_cmd payload length exceeds the provided limit in
    target_check_max_data_sg_nents() code, se_cmd->data_length +
    se_cmd->prot_length are reset with se_cmd->residual_count
    plus underflow bit for outgoing TFO response callbacks.
    It also checks for existing CDB level underflow + overflow
    and recalculates final residual_count as necessary.

    Note this patch currently assumes 1:1 mapping of PAGE_SIZE
    per struct scatterlist entry.

    Reported-by: Craig Watson
    Cc: Craig Watson
    Tested-by: Himanshu Madhani
    Cc: Roland Dreier
    Cc: Arun Easi
    Cc: Giridhar Malavali
    Cc: Andrew Vasquez
    Cc: Christoph Hellwig
    Cc: Hannes Reinecke
    Cc: Martin K. Petersen
    Signed-off-by: Nicholas Bellinger

    Nicholas Bellinger
     
  • Pull blk-cg updates from Jens Axboe:
    "A bit later in the cycle, but this has been in the block tree for a a
    while. This is basically four patchsets from Tejun, that improve our
    buffered cgroup writeback. It was dependent on the other cgroup
    changes, but they went in earlier in this cycle.

    Series 1 is set of 5 patches that has cgroup writeback updates:

    - bdi_writeback iteration fix which could lead to some wb's being
    skipped or repeated during e.g. sync under memory pressure.

    - Simplification of wb work wait mechanism.

    - Writeback tracepoints updated to report cgroup.

    Series 2 is is a set of updates for the CFQ cgroup writeback handling:

    cfq has always charged all async IOs to the root cgroup. It didn't
    have much choice as writeback didn't know about cgroups and there
    was no way to tell who to blame for a given writeback IO.
    writeback finally grew support for cgroups and now tags each
    writeback IO with the appropriate cgroup to charge it against.

    This patchset updates cfq so that it follows the blkcg each bio is
    tagged with. Async cfq_queues are now shared across cfq_group,
    which is per-cgroup, instead of per-request_queue cfq_data. This
    makes all IOs follow the weight based IO resource distribution
    implemented by cfq.

    - Switched from GFP_ATOMIC to GFP_NOWAIT as suggested by Jeff.

    - Other misc review points addressed, acks added and rebased.

    Series 3 is the blkcg policy cleanup patches:

    This patchset contains assorted cleanups for blkcg_policy methods
    and blk[c]g_policy_data handling.

    - alloc/free added for blkg_policy_data. exit dropped.

    - alloc/free added for blkcg_policy_data.

    - blk-throttle's async percpu allocation is replaced with direct
    allocation.

    - all methods now take blk[c]g_policy_data instead of blkcg_gq or
    blkcg.

    And finally, series 4 is a set of patches cleaning up the blkcg stats
    handling:

    blkcg's stats have always been somwhat of a mess. This patchset
    tries to improve the situation a bit.

    - The following patches added to consolidate blkcg entry point and
    blkg creation. This is in itself is an improvement and helps
    colllecting common stats on bio issue.

    - per-blkg stats now accounted on bio issue rather than request
    completion so that bio based and request based drivers can behave
    the same way. The issue was spotted by Vivek.

    - cfq-iosched implements custom recursive stats and blk-throttle
    implements custom per-cpu stats. This patchset make blkcg core
    support both by default.

    - cfq-iosched and blk-throttle keep track of the same stats
    multiple times. Unify them"

    * 'for-4.3/blkcg' of git://git.kernel.dk/linux-block: (45 commits)
    blkcg: use CGROUP_WEIGHT_* scale for io.weight on the unified hierarchy
    blkcg: s/CFQ_WEIGHT_*/CFQ_WEIGHT_LEGACY_*/
    blkcg: implement interface for the unified hierarchy
    blkcg: misc preparations for unified hierarchy interface
    blkcg: separate out tg_conf_updated() from tg_set_conf()
    blkcg: move body parsing from blkg_conf_prep() to its callers
    blkcg: mark existing cftypes as legacy
    blkcg: rename subsystem name from blkio to io
    blkcg: refine error codes returned during blkcg configuration
    blkcg: remove unnecessary NULL checks from __cfqg_set_weight_device()
    blkcg: reduce stack usage of blkg_rwstat_recursive_sum()
    blkcg: remove cfqg_stats->sectors
    blkcg: move io_service_bytes and io_serviced stats into blkcg_gq
    blkcg: make blkg_[rw]stat_recursive_sum() to be able to index into blkcg_gq
    blkcg: make blkcg_[rw]stat per-cpu
    blkcg: add blkg_[rw]stat->aux_cnt and replace cfq_group->dead_stats with it
    blkcg: consolidate blkg creation in blkcg_bio_issue_check()
    blk-throttle: improve queue bypass handling
    blkcg: move root blkg lookup optimization from throtl_lookup_tg() to __blkg_lookup()
    blkcg: inline [__]blkg_lookup()
    ...

    Linus Torvalds
     
  • Merge third patch-bomb from Andrew Morton:

    - even more of the rest of MM

    - lib/ updates

    - checkpatch updates

    - small changes to a few scruffy filesystems

    - kmod fixes/cleanups

    - kexec updates

    - a dma-mapping cleanup series from hch

    * emailed patches from Andrew Morton : (81 commits)
    dma-mapping: consolidate dma_set_mask
    dma-mapping: consolidate dma_supported
    dma-mapping: cosolidate dma_mapping_error
    dma-mapping: consolidate dma_{alloc,free}_noncoherent
    dma-mapping: consolidate dma_{alloc,free}_{attrs,coherent}
    mm: use vma_is_anonymous() in create_huge_pmd() and wp_huge_pmd()
    mm: make sure all file VMAs have ->vm_ops set
    mm, mpx: add "vm_flags_t vm_flags" arg to do_mmap_pgoff()
    mm: mark most vm_operations_struct const
    namei: fix warning while make xmldocs caused by namei.c
    ipc: convert invalid scenarios to use WARN_ON
    zlib_deflate/deftree: remove bi_reverse()
    lib/decompress_unlzma: Do a NULL check for pointer
    lib/decompressors: use real out buf size for gunzip with kernel
    fs/affs: make root lookup from blkdev logical size
    sysctl: fix int -> unsigned long assignments in INT_MIN case
    kexec: export KERNEL_IMAGE_SIZE to vmcoreinfo
    kexec: align crash_notes allocation to make it be inside one physical page
    kexec: remove unnecessary test in kimage_alloc_crash_control_pages()
    kexec: split kexec_load syscall from kexec core code
    ...

    Linus Torvalds
     
  • Pull late ARM SoC updates from Kevin Hilman:
    "This is a collection of a few late fixes and other misc stuff that had
    dependencies on things being merged from other trees.

    The bulk of the changes are for samsung/exynos SoCs for some changes
    that needed a few minor reworks so ended up a bit late. The others
    are mainly for qcom SoCs: a couple fixes and some DTS updates"

    * tag 'armsoc-late' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (37 commits)
    ARM: multi_v7_defconfig: Enable PBIAS regulator
    soc: qcom: smd: Correct fBLOCKREADINTR handling
    soc: qcom: smd: Use correct remote processor ID
    soc: qcom: smem: Fix errant private access
    ARM: dts: qcom: msm8974-sony-xperia-honami: Use stdout-path
    ARM: dts: qcom: msm8960-cdp: Use stdout-path
    ARM: dts: qcom: msm8660-surf: Use stdout-path
    ARM: dts: qcom: ipq8064-ap148: Use stdout-path
    ARM: dts: qcom: apq8084-mtp: Use stdout-path
    ARM: dts: qcom: apq8084-ifc6540: Use stdout-path
    ARM: dts: qcom: apq8074-dragonboard: Use stdout-path
    ARM: dts: qcom: apq8064-ifc6410: Use stdout-path
    ARM: dts: qcom: apq8064-cm-qs600: Use stdout-path
    ARM: dts: qcom: Label serial nodes for aliasing and stdout-path
    reset: ath79: Fix missing spin_lock_init
    reset: Add (devm_)reset_control_get stub functions
    ARM: EXYNOS: switch to using generic cpufreq driver for exynos4x12
    cpufreq: exynos: Remove unselectable rule for arm-exynos-cpufreq.o
    ARM: dts: add iommu property to JPEG device for exynos4
    ARM: dts: enable SPI1 for exynos4412-odroidu3
    ...

    Linus Torvalds
     
  • Fixes headed for v4.3-rc1, including Maarten's DP MST state checker fix
    you requested.

    * tag 'drm-intel-next-fixes-2015-09-10' of git://anongit.freedesktop.org/drm-intel:
    drm/i915: Allow DSI dual link to be configured on any pipe
    drm/i915: Don't try to use DDR DVFS on CHV when disabled in the BIOS
    drm/i915: Fix CSR MMIO address check
    drm/i915: Limit the number of loops for reading a split 64bit register
    drm/i915: Fix broken mst get_hw_state.
    drm/i915: Pass hpd_status_i915[] to intel_get_hpd_pins() in pre-g4x
    uapi/drm/i915_drm.h: fix userspace compilation.
    drm/i915: Always mark the object as dirty when used by the GPU

    Dave Airlie
     
  • Pull more kvm updates from Paolo Bonzini:
    "ARM:
    - Full debug support for arm64
    - Active state switching for timer interrupts
    - Lazy FP/SIMD save/restore for arm64
    - Generic ARMv8 target

    PPC:
    - Book3S: A few bug fixes
    - Book3S: Allow micro-threading on POWER8

    x86:
    - Compiler warnings

    Generic:
    - Adaptive polling for guest halt"

    * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (49 commits)
    kvm: irqchip: fix memory leak
    kvm: move new trace event outside #ifdef CONFIG_KVM_ASYNC_PF
    KVM: trace kvm_halt_poll_ns grow/shrink
    KVM: dynamic halt-polling
    KVM: make halt_poll_ns per-vCPU
    Silence compiler warning in arch/x86/kvm/emulate.c
    kvm: compile process_smi_save_seg_64() only for x86_64
    KVM: x86: avoid uninitialized variable warning
    KVM: PPC: Book3S: Fix typo in top comment about locking
    KVM: PPC: Book3S: Fix size of the PSPB register
    KVM: PPC: Book3S HV: Exit on H_DOORBELL if HOST_IPI is set
    KVM: PPC: Book3S HV: Fix race in starting secondary threads
    KVM: PPC: Book3S: correct width in XER handling
    KVM: PPC: Book3S HV: Fix preempted vcore stolen time calculation
    KVM: PPC: Book3S HV: Fix preempted vcore list locking
    KVM: PPC: Book3S HV: Implement H_CLEAR_REF and H_CLEAR_MOD
    KVM: PPC: Book3S HV: Fix bug in dirty page tracking
    KVM: PPC: Book3S HV: Fix race in reading change bit when removing HPTE
    KVM: PPC: Book3S HV: Implement dynamic micro-threading on POWER8
    KVM: PPC: Book3S HV: Make use of unused threads when running guests
    ...

    Linus Torvalds
     
  • Pull xen terminology fixes from David Vrabel:
    "Use the correct GFN/BFN terms more consistently"

    * tag 'for-linus-4.3-rc0b-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
    xen/xenbus: Rename the variable xen_store_mfn to xen_store_gfn
    xen/privcmd: Further s/MFN/GFN/ clean-up
    hvc/xen: Further s/MFN/GFN clean-up
    video/xen-fbfront: Further s/MFN/GFN clean-up
    xen/tmem: Use xen_page_to_gfn rather than pfn_to_gfn
    xen: Use correctly the Xen memory terminologies
    arm/xen: implement correctly pfn_to_mfn
    xen: Make clear that swiotlb and biomerge are dealing with DMA address

    Linus Torvalds
     
  • Pull microblaze update from Michal Simek.

    * 'next' of git://git.monstr.eu/linux-2.6-microblaze:
    elf-em.h: move EM_MICROBLAZE to the common header

    Linus Torvalds
     
  • Pull networking fixes from David Miller:

    1) Fix out-of-bounds array access in netfilter ipset, from Jozsef
    Kadlecsik.

    2) Use correct free operation on netfilter conntrack templates, from
    Daniel Borkmann.

    3) Fix route leak in SCTP, from Marcelo Ricardo Leitner.

    4) Fix sizeof(pointer) in mac80211, from Thierry Reding.

    5) Fix cache pointer comparison in ip6mr leading to missed unlock of
    mrt_lock. From Richard Laing.

    6) rds_conn_lookup() needs to consider network namespace in key
    comparison, from Sowmini Varadhan.

    7) Fix deadlock in TIPC code wrt broadcast link wakeups, from Kolmakov
    Dmitriy.

    8) Fix fd leaks in bpf syscall, from Daniel Borkmann.

    9) Fix error recovery when installing ipv6 multipath routes, we would
    delete the old route before we would know if we could fully commit
    to the new set of nexthops. Fix from Roopa Prabhu.

    10) Fix run-time suspend problems in r8152, from Hayes Wang.

    11) In fec, don't program the MAC address into the chip when the clocks
    are gated off. From Fugang Duan.

    12) Fix poll behavior for netlink sockets when using rx ring mmap, from
    Daniel Borkmann.

    13) Don't allocate memory with GFP_KERNEL from get_stats64 in r8169
    driver, from Corinna Vinschen.

    14) In TCP Cubic congestion control, handle idle periods better where we
    are application limited, in order to keep cwnd from growing out of
    control. From Eric Dumzet.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (65 commits)
    tcp_cubic: better follow cubic curve after idle period
    tcp: generate CA_EVENT_TX_START on data frames
    xen-netfront: respect user provided max_queues
    xen-netback: respect user provided max_queues
    r8169: Fix sleeping function called during get_stats64, v2
    ether: add IEEE 1722 ethertype - TSN
    netlink, mmap: fix edge-case leakages in nf queue zero-copy
    netlink, mmap: don't walk rx ring on poll if receive queue non-empty
    cxgb4: changes for new firmware 1.14.4.0
    net: fec: add netif status check before set mac address
    r8152: fix the runtime suspend issues
    r8152: split DRIVER_VERSION
    ipv6: fix ifnullfree.cocci warnings
    add microchip LAN88xx phy driver
    stmmac: fix check for phydev being open
    net: qlcnic: delete redundant memsets
    net: mv643xx_eth: use kzalloc
    net: jme: use kzalloc() instead of kmalloc+memset
    net: cavium: liquidio: use kzalloc in setup_glist()
    net: ipv6: use common fib_default_rule_pref
    ...

    Linus Torvalds
     
  • Almost everyone implements dma_set_mask the same way, although some time
    that's hidden in ->set_dma_mask methods.

    This patch consolidates those into a common implementation that either
    calls ->set_dma_mask if present or otherwise uses the default
    implementation. Some architectures used to only call ->set_dma_mask
    after the initial checks, and those instance have been fixed to do the
    full work. h8300 implemented dma_set_mask bogusly as a no-ops and has
    been fixed.

    Unfortunately some architectures overload unrelated semantics like changing
    the dma_ops into it so we still need to allow for an architecture override
    for now.

    [jcmvbkbc@gmail.com: fix xtensa]
    Signed-off-by: Christoph Hellwig
    Cc: Arnd Bergmann
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Cc: Michal Simek
    Cc: Jonas Bonn
    Cc: Chris Metcalf
    Cc: Guan Xuetao
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Andy Shevchenko
    Signed-off-by: Max Filippov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Most architectures just call into ->dma_supported, but some also return 1
    if the method is not present, or 0 if no dma ops are present (although
    that should never happeb). Consolidate this more broad version into
    common code.

    Also fix h8300 which inorrectly always returned 0, which would have been
    a problem if it's dma_set_mask implementation wasn't a similarly buggy
    noop.

    As a few architectures have much more elaborate implementations, we
    still allow for arch overrides.

    [jcmvbkbc@gmail.com: fix xtensa]
    Signed-off-by: Christoph Hellwig
    Cc: Arnd Bergmann
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Cc: Michal Simek
    Cc: Jonas Bonn
    Cc: Chris Metcalf
    Cc: Guan Xuetao
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Andy Shevchenko
    Signed-off-by: Max Filippov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Currently there are three valid implementations of dma_mapping_error:

    (1) call ->mapping_error
    (2) check for a hardcoded error code
    (3) always return 0

    This patch provides a common implementation that calls ->mapping_error
    if present, then checks for DMA_ERROR_CODE if defined or otherwise
    returns 0.

    [jcmvbkbc@gmail.com: fix xtensa]
    Signed-off-by: Christoph Hellwig
    Cc: Arnd Bergmann
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Cc: Michal Simek
    Cc: Jonas Bonn
    Cc: Chris Metcalf
    Cc: Guan Xuetao
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Andy Shevchenko
    Signed-off-by: Max Filippov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Most architectures do not support non-coherent allocations and either
    define dma_{alloc,free}_noncoherent to their coherent versions or stub
    them out.

    Openrisc uses dma_{alloc,free}_attrs to implement them, and only Mips
    implements them directly.

    This patch moves the Openrisc version to common code, and handles the
    DMA_ATTR_NON_CONSISTENT case in the mips dma_map_ops instance.

    Note that actual non-coherent allocations require a dma_cache_sync
    implementation, so if non-coherent allocations didn't work on
    an architecture before this patch they still won't work after it.

    [jcmvbkbc@gmail.com: fix xtensa]
    Signed-off-by: Christoph Hellwig
    Cc: Arnd Bergmann
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Cc: Michal Simek
    Cc: Jonas Bonn
    Cc: Chris Metcalf
    Cc: Guan Xuetao
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Andy Shevchenko
    Signed-off-by: Max Filippov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Since 2009 we have a nice asm-generic header implementing lots of DMA API
    functions for architectures using struct dma_map_ops, but unfortunately
    it's still missing a lot of APIs that all architectures still have to
    duplicate.

    This series consolidates the remaining functions, although we still need
    arch opt outs for two of them as a few architectures have very
    non-standard implementations.

    This patch (of 5):

    The coherent DMA allocator works the same over all architectures supporting
    dma_map operations.

    This patch consolidates them and converges the minor differences:

    - the debug_dma helpers are now called from all architectures, including
    those that were previously missing them
    - dma_alloc_from_coherent and dma_release_from_coherent are now always
    called from the generic alloc/free routines instead of the ops
    dma-mapping-common.h always includes dma-coherent.h to get the defintions
    for them, or the stubs if the architecture doesn't support this feature
    - checks for ->alloc / ->free presence are removed. There is only one
    magic instead of dma_map_ops without them (mic_dma_ops) and that one
    is x86 only anyway.

    Besides that only x86 needs special treatment to replace a default devices
    if none is passed and tweak the gfp_flags. An optional arch hook is provided
    for that.

    [linux@roeck-us.net: fix build]
    [jcmvbkbc@gmail.com: fix xtensa]
    Signed-off-by: Christoph Hellwig
    Cc: Arnd Bergmann
    Cc: Russell King
    Cc: Catalin Marinas
    Cc: Will Deacon
    Cc: Yoshinori Sato
    Cc: Michal Simek
    Cc: Jonas Bonn
    Cc: Chris Metcalf
    Cc: Guan Xuetao
    Cc: Ralf Baechle
    Cc: Benjamin Herrenschmidt
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: "H. Peter Anvin"
    Cc: Andy Shevchenko
    Signed-off-by: Guenter Roeck
    Signed-off-by: Max Filippov
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Hellwig
     
  • Add the additional "vm_flags_t vm_flags" argument to do_mmap_pgoff(),
    rename it to do_mmap(), and re-introduce do_mmap_pgoff() as a simple
    wrapper on top of do_mmap(). Perhaps we should update the callers of
    do_mmap_pgoff() and kill it later.

    This way mpx_mmap() can simply call do_mmap(vm_flags => VM_MPX) and do not
    play with vm internals.

    After this change mmap_region() has a single user outside of mmap.c,
    arch/tile/mm/elf.c:arch_setup_additional_pages(). It would be nice to
    change arch/tile/ and unexport mmap_region().

    [kirill@shutemov.name: fix build]
    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Oleg Nesterov
    Acked-by: Dave Hansen
    Tested-by: Dave Hansen
    Signed-off-by: Kirill A. Shutemov
    Cc: "H. Peter Anvin"
    Cc: Andy Lutomirski
    Cc: Ingo Molnar
    Cc: Minchan Kim
    Cc: Thomas Gleixner
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oleg Nesterov
     
  • There are two kexec load syscalls, kexec_load another and kexec_file_load.
    kexec_file_load has been splited as kernel/kexec_file.c. In this patch I
    split kexec_load syscall code to kernel/kexec.c.

    And add a new kconfig option KEXEC_CORE, so we can disable kexec_load and
    use kexec_file_load only, or vice verse.

    The original requirement is from Ted Ts'o, he want kexec kernel signature
    being checked with CONFIG_KEXEC_VERIFY_SIG enabled. But kexec-tools use
    kexec_load syscall can bypass the checking.

    Vivek Goyal proposed to create a common kconfig option so user can compile
    in only one syscall for loading kexec kernel. KEXEC/KEXEC_FILE selects
    KEXEC_CORE so that old config files still work.

    Because there's general code need CONFIG_KEXEC_CORE, so I updated all the
    architecture Kconfig with a new option KEXEC_CORE, and let KEXEC selects
    KEXEC_CORE in arch Kconfig. Also updated general kernel code with to
    kexec_load syscall.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Dave Young
    Cc: Eric W. Biederman
    Cc: Vivek Goyal
    Cc: Petr Tesarik
    Cc: Theodore Ts'o
    Cc: Josh Boyer
    Cc: David Howells
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Young
     
  • Split kexec_file syscall related code to another file kernel/kexec_file.c
    so that the #ifdef CONFIG_KEXEC_FILE in kexec.c can be dropped.

    Sharing variables and functions are moved to kernel/kexec_internal.h per
    suggestion from Vivek and Petr.

    [akpm@linux-foundation.org: fix bisectability]
    [akpm@linux-foundation.org: declare the various arch_kexec functions]
    [akpm@linux-foundation.org: fix build]
    Signed-off-by: Dave Young
    Cc: Eric W. Biederman
    Cc: Vivek Goyal
    Cc: Petr Tesarik
    Cc: Theodore Ts'o
    Cc: Josh Boyer
    Cc: David Howells
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Dave Young
     
  • This introduces a new helper and switches current users to use it. All
    patches are compiled tested. kmemleak is tested via its own test suite.

    This patch (of 6):

    The new seq_hex_dump() is a complete analogue of print_hex_dump().

    We have few users of this functionality already. It allows to reduce their
    codebase.

    Signed-off-by: Andy Shevchenko
    Cc: Alexander Viro
    Cc: Joe Perches
    Cc: Tadeusz Struk
    Cc: Helge Deller
    Cc: Ingo Tuchscherer
    Cc: Catalin Marinas
    Cc: Vladimir Kondratiev
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     
  • We need to launch the usermodehelper kernel threads with the widest
    affinity and this is partly why we use khelper. This workqueue has
    unbound properties and thus a wide affinity inherited by all its children.

    Now khelper also has special properties that we aren't much interested in:
    ordered and singlethread. There is really no need about ordering as all
    we do is creating kernel threads. This can be done concurrently. And
    singlethread is a useless limitation as well.

    The workqueue engine already proposes generic unbound workqueues that
    don't share these useless properties and handle well parallel jobs.

    The only worrysome specific is their affinity to the node of the current
    CPU. It's fine for creating the usermodehelper kernel threads but those
    inherit this affinity for longer jobs such as requesting modules.

    This patch proposes to use these node affine unbound workqueues assuming
    that a node is sufficient to handle several parallel usermodehelper
    requests.

    Signed-off-by: Frederic Weisbecker
    Cc: Rik van Riel
    Reviewed-by: Oleg Nesterov
    Cc: Christoph Lameter
    Cc: Tejun Heo
    Cc: Rusty Russell
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Frederic Weisbecker
     
  • To further clarify the purpose of the "esc" argument, rename it to "only"
    to reflect that it is a limit, not a list of additional characters to
    escape.

    Signed-off-by: Kees Cook
    Suggested-by: Rasmus Villemoes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     
  • print_hex_dump_debug() is likely supposed to be analogous to pr_debug() or
    dev_dbg() & friends. Currently it will adhere to dynamic debug, but will
    not stub out prints if CONFIG_DEBUG is not set. Let's make it do the
    right thing, because I am tired of having my dmesg buffer full of hex
    dumps on production systems.

    Signed-off-by: Linus Walleij
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Linus Walleij
     
  • The other two implementations of pr_debug_ratelimited include pr_fmt,
    along with every other pr_* function. But pr_debug_ratelimited forgot to
    add it with the CONFIG_DYNAMIC_DEBUG implementation.

    This patch unifies the behavior.

    Signed-off-by: Jason A. Donenfeld
    Cc: Steven Rostedt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jason A. Donenfeld
     
  • Signed-off-by: Vasily Kulikov
    Cc: Solar Designer
    Cc: Thomas Gleixner
    Cc: "Kirill A. Shutemov"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vasily Kulikov
     
  • Poison pointer values should be small enough to find a room in
    non-mmap'able/hardly-mmap'able space. E.g. on x86 "poison pointer space"
    is located starting from 0x0. Given unprivileged users cannot mmap
    anything below mmap_min_addr, it should be safe to use poison pointers
    lower than mmap_min_addr.

    The current poison pointer values of LIST_POISON{1,2} might be too big for
    mmap_min_addr values equal or less than 1 MB (common case, e.g. Ubuntu
    uses only 0x10000). There is little point to use such a big value given
    the "poison pointer space" below 1 MB is not yet exhausted. Changing it
    to a smaller value solves the problem for small mmap_min_addr setups.

    The values are suggested by Solar Designer:
    http://www.openwall.com/lists/oss-security/2015/05/02/6

    Signed-off-by: Vasily Kulikov
    Cc: Solar Designer
    Cc: Thomas Gleixner
    Cc: "Kirill A. Shutemov"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vasily Kulikov
     
  • As noted by Minchan, a benefit of reading idle flag from /proc/kpageflags
    is that one can easily filter dirty and/or unevictable pages while
    estimating the size of unused memory.

    Note that idle flag read from /proc/kpageflags may be stale in case the
    page was accessed via a PTE, because it would be too costly to iterate
    over all page mappings on each /proc/kpageflags read to provide an
    up-to-date value. To make sure the flag is up-to-date one has to read
    /sys/kernel/mm/page_idle/bitmap first.

    Signed-off-by: Vladimir Davydov
    Reviewed-by: Andres Lagar-Cavilla
    Cc: Minchan Kim
    Cc: Raghavendra K T
    Cc: Johannes Weiner
    Cc: Michal Hocko
    Cc: Greg Thelen
    Cc: Michel Lespinasse
    Cc: David Rientjes
    Cc: Pavel Emelyanov
    Cc: Cyrill Gorcunov
    Cc: Jonathan Corbet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vladimir Davydov
     
  • Knowing the portion of memory that is not used by a certain application or
    memory cgroup (idle memory) can be useful for partitioning the system
    efficiently, e.g. by setting memory cgroup limits appropriately.
    Currently, the only means to estimate the amount of idle memory provided
    by the kernel is /proc/PID/{clear_refs,smaps}: the user can clear the
    access bit for all pages mapped to a particular process by writing 1 to
    clear_refs, wait for some time, and then count smaps:Referenced. However,
    this method has two serious shortcomings:

    - it does not count unmapped file pages
    - it affects the reclaimer logic

    To overcome these drawbacks, this patch introduces two new page flags,
    Idle and Young, and a new sysfs file, /sys/kernel/mm/page_idle/bitmap.
    A page's Idle flag can only be set from userspace by setting bit in
    /sys/kernel/mm/page_idle/bitmap at the offset corresponding to the page,
    and it is cleared whenever the page is accessed either through page tables
    (it is cleared in page_referenced() in this case) or using the read(2)
    system call (mark_page_accessed()). Thus by setting the Idle flag for
    pages of a particular workload, which can be found e.g. by reading
    /proc/PID/pagemap, waiting for some time to let the workload access its
    working set, and then reading the bitmap file, one can estimate the amount
    of pages that are not used by the workload.

    The Young page flag is used to avoid interference with the memory
    reclaimer. A page's Young flag is set whenever the Access bit of a page
    table entry pointing to the page is cleared by writing to the bitmap file.
    If page_referenced() is called on a Young page, it will add 1 to its
    return value, therefore concealing the fact that the Access bit was
    cleared.

    Note, since there is no room for extra page flags on 32 bit, this feature
    uses extended page flags when compiled on 32 bit.

    [akpm@linux-foundation.org: fix build]
    [akpm@linux-foundation.org: kpageidle requires an MMU]
    [akpm@linux-foundation.org: decouple from page-flags rework]
    Signed-off-by: Vladimir Davydov
    Reviewed-by: Andres Lagar-Cavilla
    Cc: Minchan Kim
    Cc: Raghavendra K T
    Cc: Johannes Weiner
    Cc: Michal Hocko
    Cc: Greg Thelen
    Cc: Michel Lespinasse
    Cc: David Rientjes
    Cc: Pavel Emelyanov
    Cc: Cyrill Gorcunov
    Cc: Jonathan Corbet
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vladimir Davydov