03 Jun, 2019

1 commit

  • This reverts commit 9b947a13e7f6017f18470f665992dbae267852b3.

    The commit 9b947a13e7f6017f18470f665992dbae267852b3 does not consider power and
    clock when expose the regmap into debugsfs. This may bring some problem for some
    case. E.g., For reset registers (not real GPR, but csi bridge register) for
    MIPI DSI, MIPI CSI and LCDIF on i.mx8mm, they only can be accessed after the
    disp_root clock and dispmix power has been turned on, otherwise the system may
    be stuck.

    on i.mx8mm evk, the command to reproduce (with default dtb, no display/capture
    running):
    cat /sys/kernel/debug/regmap/dummy-display-gpr@32e28000/registers

    This patch reverted previous commit to avoid the exposure.

    Signed-off-by: Robby Cai
    Reviewed-by: Fancy Fang

    Robby Cai
     

18 Apr, 2019

7 commits


24 Mar, 2019

1 commit

  • commit 1fad17fb1bbcd73159c2b992668a6957ecc5af8a upstream.

    If wakeup_source_add() is called right after wakeup_source_remove()
    for the same wakeup source, timer_setup() may be called for a
    potentially scheduled timer which is incorrect.

    To avoid that, move the wakeup source timer cancellation from
    wakeup_source_drop() to wakeup_source_remove().

    Moreover, make wakeup_source_remove() clear the timer function after
    canceling the timer to let wakeup_source_not_registered() treat
    unregistered wakeup sources in the same way as the ones that have
    never been registered.

    Signed-off-by: Viresh Kumar
    Cc: 4.4+ # 4.4+
    [ rjw: Subject, changelog, merged two patches together ]
    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Viresh Kumar
     

14 Mar, 2019

1 commit

  • commit 376991db4b6464e906d699ef07681e2ffa8ab08c upstream.

    When unbinding the (IOMMU-enabled) R-Car SATA device on Salvator-XS
    (R-Car H3 ES2.0), in preparation of rebinding against vfio-platform for
    device pass-through for virtualization:

        echo ee300000.sata > /sys/bus/platform/drivers/sata_rcar/unbind

    the kernel crashes with:

        Unable to handle kernel paging request at virtual address ffffffbf029ffffc
        Mem abort info:
          ESR = 0x96000006
          Exception class = DABT (current EL), IL = 32 bits
          SET = 0, FnV = 0
          EA = 0, S1PTW = 0
        Data abort info:
          ISV = 0, ISS = 0x00000006
          CM = 0, WnR = 0
        swapper pgtable: 4k pages, 39-bit VAs, pgdp = 000000007e8c586c
        [ffffffbf029ffffc] pgd=000000073bfc6003, pud=000000073bfc6003, pmd=0000000000000000
        Internal error: Oops: 96000006 [#1] SMP
        Modules linked in:
        CPU: 0 PID: 1098 Comm: bash Not tainted 5.0.0-rc5-salvator-x-00452-g37596f884f4318ef #287
        Hardware name: Renesas Salvator-X 2nd version board based on r8a7795 ES2.0+ (DT)
        pstate: 60400005 (nZCv daif +PAN -UAO)
        pc : __free_pages+0x8/0x58
        lr : __dma_direct_free_pages+0x50/0x5c
        sp : ffffff801268baa0
        x29: ffffff801268baa0 x28: 0000000000000000
        x27: ffffffc6f9c60bf0 x26: ffffffc6f9c60bf0
        x25: ffffffc6f9c60810 x24: 0000000000000000
        x23: 00000000fffff000 x22: ffffff8012145000
        x21: 0000000000000800 x20: ffffffbf029fffc8
        x19: 0000000000000000 x18: ffffffc6f86c42c8
        x17: 0000000000000000 x16: 0000000000000070
        x15: 0000000000000003 x14: 0000000000000000
        x13: ffffff801103d7f8 x12: 0000000000000028
        x11: ffffff8011117604 x10: 0000000000009ad8
        x9 : ffffff80110126d0 x8 : ffffffc6f7563000
        x7 : 6b6b6b6b6b6b6b6b x6 : 0000000000000018
        x5 : ffffff8011cf3cc8 x4 : 0000000000004000
        x3 : 0000000000080000 x2 : 0000000000000001
        x1 : 0000000000000000 x0 : ffffffbf029fffc8
        Process bash (pid: 1098, stack limit = 0x00000000c38e3e32)
        Call trace:
         __free_pages+0x8/0x58
         __dma_direct_free_pages+0x50/0x5c
         arch_dma_free+0x1c/0x98
         dma_direct_free+0x14/0x24
         dma_free_attrs+0x9c/0xdc
         dmam_release+0x18/0x20
         release_nodes+0x25c/0x28c
         devres_release_all+0x48/0x4c
         device_release_driver_internal+0x184/0x1f0
         device_release_driver+0x14/0x1c
         unbind_store+0x70/0xb8
         drv_attr_store+0x24/0x34
         sysfs_kf_write+0x4c/0x64
         kernfs_fop_write+0x154/0x1c4
         __vfs_write+0x34/0x164
         vfs_write+0xb4/0x16c
         ksys_write+0x5c/0xbc
         __arm64_sys_write+0x14/0x1c
         el0_svc_common+0x98/0x114
         el0_svc_handler+0x1c/0x24
         el0_svc+0x8/0xc
        Code: d51b4234 17fffffa a9bf7bfd 910003fd (b9403404)
        ---[ end trace 8c564cdd3a1a840f ]---

    While I've bisected this to commit e8e683ae9a736407 ("iommu/of: Fix
    probe-deferral"), and reverting that commit on post-v5.0-rc4 kernels
    does fix the problem, this turned out to be a red herring.

    On arm64, arch_teardown_dma_ops() resets dev->dma_ops to NULL.
    Hence if a driver has used a managed DMA allocation API, the allocated
    DMA memory will be freed using the direct DMA ops, while it may have
    been allocated using a custom DMA ops (iommu_dma_ops in this case).

    Fix this by reversing the order of the calls to devres_release_all() and
    arch_teardown_dma_ops().

    Signed-off-by: Geert Uytterhoeven
    Acked-by: Christoph Hellwig
    Reviewed-by: Rafael J. Wysocki
    Cc: stable
    Reviewed-by: Robin Murphy
    [rm: backport for 4.12-4.19 - kernels before 5.0 will not see
    the crash above, but may get silent memory corruption instead]
    Signed-off-by: Robin Murphy
    Signed-off-by: Greg Kroah-Hartman

    Geert Uytterhoeven
     

13 Feb, 2019

4 commits

  • commit 3a34c986324c07dde32903f7bb262e6138e77c2a upstream.

    Commit 448a5a552f336bd7b847b1951 ("drivers: base: cacheinfo: use OF
    property_read_u32 instead of get_property,read_number") makes cache
    size and number_of_sets be 0 if DT doesn't provide there values. I
    think this is unreasonable so make them keep the old values, which is
    the same as old kernels.

    Fixes: 448a5a552f33 ("drivers: base: cacheinfo: use OF property_read_u32 instead of get_property,read_number")
    Cc: stable@vger.kernel.org
    Signed-off-by: Huacai Chen
    Reviewed-by: Sudeep Holla
    Signed-off-by: Greg Kroah-Hartman

    Huacai Chen
     
  • [ Upstream commit df44b479654f62b478c18ee4d8bc4e9f897a9844 ]

    Propagate error code back to userspace if writing the /sys/.../uevent
    file fails. Before, the write operation always returned with success,
    even if we failed to recognize the input string or if we failed to
    generate the uevent itself.

    With the error codes properly propagated back to userspace, we are
    able to react in userspace accordingly by not assuming and awaiting
    a uevent that is not delivered.

    Signed-off-by: Peter Rajnoha
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Peter Rajnoha
     
  • [ Upstream commit c37d721c68ad88925ba0e72f6e14acb829a8c6bb ]

    Move the async_synchronize_full call out of __device_release_driver and
    into driver_detach.

    The idea behind this is that the async_synchronize_full call will only
    guarantee that any existing async operations are flushed. This doesn't do
    anything to guarantee that a hotplug event that may occur while we are
    doing the release of the driver will not be asynchronously scheduled.

    By moving this into the driver_detach path we can avoid potential deadlocks
    as we aren't holding the device lock at this point and we should not have
    the driver we want to flush loaded so the flush will take care of any
    asynchronous events the driver we are detaching might have scheduled.

    Fixes: 765230b5f084 ("driver-core: add asynchronous probing support for drivers")
    Reviewed-by: Bart Van Assche
    Reviewed-by: Dan Williams
    Signed-off-by: Alexander Duyck
    Reviewed-by: Luis Chamberlain
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Alexander Duyck
     
  • commit a66d972465d15b1d89281258805eb8b47d66bd36 upstream.

    Initially we bumped into problem with 32-bit aligned atomic64_t
    on ARC, see [1]. And then during quite lengthly discussion Peter Z.
    mentioned ARCH_KMALLOC_MINALIGN which IMHO makes perfect sense.
    If allocation is done by plain kmalloc() obtained buffer will be
    ARCH_KMALLOC_MINALIGN aligned and then why buffer obtained via
    devm_kmalloc() should have any other alignment?

    This way we at least get the same behavior for both types of
    allocation.

    [1] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004009.html
    [2] http://lists.infradead.org/pipermail/linux-snps-arc/2018-July/004036.html

    Signed-off-by: Alexey Brodkin
    Cc: Greg Kroah-Hartman
    Cc: Geert Uytterhoeven
    Cc: David Laight
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: Vineet Gupta
    Cc: Will Deacon
    Cc: Greg KH
    Cc: # 4.8+
    Signed-off-by: Greg Kroah-Hartman

    Alexey Brodkin
     

26 Jan, 2019

1 commit

  • [ Upstream commit 4f4b374332ec0ae9c738ff8ec9bed5cd97ff9adc ]

    This is the much more correct fix for my earlier attempt at:

    https://lkml.org/lkml/2018/12/10/118

    Short recap:

    - There's not actually a locking issue, it's just lockdep being a bit
    too eager to complain about a possible deadlock.

    - Contrary to what I claimed the real problem is recursion on
    kn->count. Greg pointed me at sysfs_break_active_protection(), used
    by the scsi subsystem to allow a sysfs file to unbind itself. That
    would be a real deadlock, which isn't what's happening here. Also,
    breaking the active protection means we'd need to manually handle
    all the lifetime fun.

    - With Rafael we discussed the task_work approach, which kinda works,
    but has two downsides: It's a functional change for a lockdep
    annotation issue, and it won't work for the bind file (which needs
    to get the errno from the driver load function back to userspace).

    - Greg also asked why this never showed up: To hit this you need to
    unregister a 2nd driver from the unload code of your first driver. I
    guess only gpus do that. The bug has always been there, but only
    with a recent patch series did we add more locks so that lockdep
    built a chain from unbinding the snd-hda driver to the
    acpi_video_unregister call.

    Full lockdep splat:

    [12301.898799] ============================================
    [12301.898805] WARNING: possible recursive locking detected
    [12301.898811] 4.20.0-rc7+ #84 Not tainted
    [12301.898815] --------------------------------------------
    [12301.898821] bash/5297 is trying to acquire lock:
    [12301.898826] 00000000f61c6093 (kn->count#39){++++}, at: kernfs_remove_by_name_ns+0x3b/0x80
    [12301.898841] but task is already holding lock:
    [12301.898847] 000000005f634021 (kn->count#39){++++}, at: kernfs_fop_write+0xdc/0x190
    [12301.898856] other info that might help us debug this:
    [12301.898862] Possible unsafe locking scenario:
    [12301.898867] CPU0
    [12301.898870] ----
    [12301.898874] lock(kn->count#39);
    [12301.898879] lock(kn->count#39);
    [12301.898883] *** DEADLOCK ***
    [12301.898891] May be due to missing lock nesting notation
    [12301.898899] 5 locks held by bash/5297:
    [12301.898903] #0: 00000000cd800e54 (sb_writers#4){.+.+}, at: vfs_write+0x17f/0x1b0
    [12301.898915] #1: 000000000465e7c2 (&of->mutex){+.+.}, at: kernfs_fop_write+0xd3/0x190
    [12301.898925] #2: 000000005f634021 (kn->count#39){++++}, at: kernfs_fop_write+0xdc/0x190
    [12301.898936] #3: 00000000414ef7ac (&dev->mutex){....}, at: device_release_driver_internal+0x34/0x240
    [12301.898950] #4: 000000003218fbdf (register_count_mutex){+.+.}, at: acpi_video_unregister+0xe/0x40
    [12301.898960] stack backtrace:
    [12301.898968] CPU: 1 PID: 5297 Comm: bash Not tainted 4.20.0-rc7+ #84
    [12301.898974] Hardware name: Hewlett-Packard HP EliteBook 8460p/161C, BIOS 68SCF Ver. F.01 03/11/2011
    [12301.898982] Call Trace:
    [12301.898989] dump_stack+0x67/0x9b
    [12301.898997] __lock_acquire+0x6ad/0x1410
    [12301.899003] ? kernfs_remove_by_name_ns+0x3b/0x80
    [12301.899010] ? find_held_lock+0x2d/0x90
    [12301.899017] ? mutex_spin_on_owner+0xe4/0x150
    [12301.899023] ? find_held_lock+0x2d/0x90
    [12301.899030] ? lock_acquire+0x90/0x180
    [12301.899036] lock_acquire+0x90/0x180
    [12301.899042] ? kernfs_remove_by_name_ns+0x3b/0x80
    [12301.899049] __kernfs_remove+0x296/0x310
    [12301.899055] ? kernfs_remove_by_name_ns+0x3b/0x80
    [12301.899060] ? kernfs_name_hash+0xd/0x80
    [12301.899066] ? kernfs_find_ns+0x6c/0x100
    [12301.899073] kernfs_remove_by_name_ns+0x3b/0x80
    [12301.899080] bus_remove_driver+0x92/0xa0
    [12301.899085] acpi_video_unregister+0x24/0x40
    [12301.899127] i915_driver_unload+0x42/0x130 [i915]
    [12301.899160] i915_pci_remove+0x19/0x30 [i915]
    [12301.899169] pci_device_remove+0x36/0xb0
    [12301.899176] device_release_driver_internal+0x185/0x240
    [12301.899183] unbind_store+0xaf/0x180
    [12301.899189] kernfs_fop_write+0x104/0x190
    [12301.899195] __vfs_write+0x31/0x180
    [12301.899203] ? rcu_read_lock_sched_held+0x6f/0x80
    [12301.899209] ? rcu_sync_lockdep_assert+0x29/0x50
    [12301.899216] ? __sb_start_write+0x13c/0x1a0
    [12301.899221] ? vfs_write+0x17f/0x1b0
    [12301.899227] vfs_write+0xb9/0x1b0
    [12301.899233] ksys_write+0x50/0xc0
    [12301.899239] do_syscall_64+0x4b/0x180
    [12301.899247] entry_SYSCALL_64_after_hwframe+0x49/0xbe
    [12301.899253] RIP: 0033:0x7f452ac7f7a4
    [12301.899259] Code: 00 f7 d8 64 89 02 48 c7 c0 ff ff ff ff eb b7 0f 1f 80 00 00 00 00 8b 05 aa f0 2c 00 48 63 ff 85 c0 75 13 b8 01 00 00 00 0f 05 3d 00 f0 ff ff 77 54 f3 c3 66 90 55 53 48 89 d5 48 89 f3 48 83
    [12301.899273] RSP: 002b:00007ffceafa6918 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
    [12301.899282] RAX: ffffffffffffffda RBX: 000000000000000d RCX: 00007f452ac7f7a4
    [12301.899288] RDX: 000000000000000d RSI: 00005612a1abf7c0 RDI: 0000000000000001
    [12301.899295] RBP: 00005612a1abf7c0 R08: 000000000000000a R09: 00005612a1c46730
    [12301.899301] R10: 000000000000000a R11: 0000000000000246 R12: 000000000000000d
    [12301.899308] R13: 0000000000000001 R14: 00007f452af4a740 R15: 000000000000000d

    Looking around I've noticed that usb and i2c already handle similar
    recursion problems, where a sysfs file can unbind the same type of
    sysfs somewhere else in the hierarchy. Relevant commits are:

    commit 356c05d58af05d582e634b54b40050c73609617b
    Author: Alan Stern
    Date: Mon May 14 13:30:03 2012 -0400

    sysfs: get rid of some lockdep false positives

    commit e9b526fe704812364bca07edd15eadeba163ebfb
    Author: Alexander Sverdlin
    Date: Fri May 17 14:56:35 2013 +0200

    i2c: suppress lockdep warning on delete_device

    Implement the same trick for driver bind/unbind.

    v2: Put the macro into bus.c (Greg).

    Reviewed-by: Rafael J. Wysocki
    Cc: Ramalingam C
    Cc: Arend van Spriel
    Cc: Andy Shevchenko
    Cc: Geert Uytterhoeven
    Cc: Bartosz Golaszewski
    Cc: Heikki Krogerus
    Cc: Vivek Gautam
    Cc: Joe Perches
    Signed-off-by: Daniel Vetter
    Signed-off-by: Greg Kroah-Hartman
    Signed-off-by: Sasha Levin

    Daniel Vetter
     

13 Jan, 2019

1 commit

  • commit e121a833745b4708b660e3fe6776129c2956b041 upstream.

    __device_release_driver() has to check dev->bus->need_parent_lock
    before dropping the parent lock and acquiring it again as it may
    attempt to drop a lock that hasn't been acquired or lock a device
    that shouldn't be locked and create a lock imbalance.

    Fixes: 8c97a46af04b (driver core: hold dev's parent lock when needed)
    Signed-off-by: Rafael J. Wysocki
    Cc: stable
    Reviewed-by: Daniel Vetter
    Signed-off-by: Greg Kroah-Hartman

    Rafael J. Wysocki
     

10 Jan, 2019

1 commit

  • commit 81b1e6e6a8590a19257e37a1633bec098d499c57 upstream.

    Since the addition of platform MSI support, there were two helpers
    supposed to allocate/free IRQs for a device:

    platform_msi_domain_alloc_irqs()
    platform_msi_domain_free_irqs()

    In these helpers, IRQ descriptors are allocated in the "alloc" routine
    while they are freed in the "free" one.

    Later, two other helpers have been added to handle IRQ domains on top
    of MSI domains:

    platform_msi_domain_alloc()
    platform_msi_domain_free()

    Seen from the outside, the logic is pretty close with the former
    helpers and people used it with the same logic as before: a
    platform_msi_domain_alloc() call should be balanced with a
    platform_msi_domain_free() call. While this is probably what was
    intended to do, the platform_msi_domain_free() does not remove/free
    the IRQ descriptor(s) created/inserted in
    platform_msi_domain_alloc().

    One effect of such situation is that removing a module that requested
    an IRQ will let one orphaned IRQ descriptor (with an allocated MSI
    entry) in the device descriptors list. Next time the module will be
    inserted back, one will observe that the allocation will happen twice
    in the MSI domain, one time for the remaining descriptor, one time for
    the new one. It also has the side effect to quickly overshoot the
    maximum number of allocated MSI and then prevent any module requesting
    an interrupt in the same domain to be inserted anymore.

    This situation has been met with loops of insertion/removal of the
    mvpp2.ko module (requesting 15 MSIs each time).

    Fixes: 552c494a7666 ("platform-msi: Allow creation of a MSI-based stacked irq domain")
    Cc: stable@vger.kernel.org
    Signed-off-by: Miquel Raynal
    Signed-off-by: Marc Zyngier
    Signed-off-by: Greg Kroah-Hartman

    Miquel Raynal
     

07 Oct, 2018

1 commit

  • I wrote:
    "Char/Misc fixes for 4.19-rc7

    Here are 8 small fixes for some char/misc driver issues

    Included here are:
    - fpga driver fixes
    - thunderbolt bugfixes
    - firmware core revert/fix
    - hv core fix
    - hv tool fix

    All of these have been in linux-next with no reported issues."

    * tag 'char-misc-4.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
    thunderbolt: Initialize after IOMMUs
    thunderbolt: Do not handle ICM events after domain is stopped
    firmware: Always initialize the fw_priv list object
    docs: fpga: document fpga manager flags
    fpga: bridge: fix obvious function documentation error
    tools: hv: fcopy: set 'error' in case an unknown operation was requested
    fpga: do not access region struct after fpga_region_unregister
    Drivers: hv: vmbus: Use get/put_cpu() in vmbus_connect()

    Greg Kroah-Hartman
     

05 Oct, 2018

1 commit

  • If __device_suspend() runs asynchronously (in which case the device
    passed to it is in dpm_suspended_list at that point) and it returns
    early on an error or pending wakeup, and the power.direct_complete
    flag has been set for the device already, the subsequent
    device_resume() will be confused by that and it will call
    pm_runtime_enable() incorrectly, as runtime PM has not been
    disabled for the device by __device_suspend().

    To avoid that, clear power.direct_complete if __device_suspend()
    is not going to disable runtime PM for the device before returning.

    Fixes: aae4518b3124 (PM / sleep: Mechanism to avoid resuming runtime-suspended devices unnecessarily)
    Reported-by: Al Cooper
    Tested-by: Al Cooper
    Reviewed-by: Ulf Hansson
    Cc: 3.16+ # 3.16+
    Signed-off-by: Rafael J. Wysocki

    Rafael J. Wysocki
     

30 Sep, 2018

1 commit

  • When freeing the fw_priv the item is taken off the list. This causes an
    oops in the FW_OPT_NOCACHE case as the list object is not initialized.

    Make sure to initialize the list object regardless of this flag.

    Fixes: 422b3db2a503 ("firmware: Fix security issue with request_firmware_into_buf()")
    Cc: stable@vger.kernel.org
    Cc: Rishabh Bhatnagar
    Signed-off-by: Bjorn Andersson
    Reviewed-by: Rafael J. Wysocki
    Signed-off-by: Greg Kroah-Hartman

    Bjorn Andersson
     

12 Sep, 2018

1 commit

  • When calling request_firmware_into_buf() with the FW_OPT_NOCACHE flag
    it is expected that firmware is loaded into buffer from memory.
    But inside alloc_lookup_fw_priv every new firmware that is loaded is
    added to the firmware cache (fwc) list head. So if any driver requests
    a firmware that is already loaded the code iterates over the above
    mentioned list and it can end up giving a pointer to other device driver's
    firmware buffer.
    Also the existing copy may either be modified by drivers, remote processors
    or even freed. This causes a potential security issue with batched requests
    when using request_firmware_into_buf.

    Fix alloc_lookup_fw_priv to not add to the fwc head list if FW_OPT_NOCACHE
    is set, and also don't do the lookup in the list.

    Fixes: 0e742e9275 ("firmware: provide infrastructure to make fw caching optional")
    [mcgrof: broken since feature introduction on v4.8]

    Cc: stable@vger.kernel.org # v4.8+
    Signed-off-by: Vikram Mulukutla
    Signed-off-by: Rishabh Bhatnagar
    Signed-off-by: Luis Chamberlain
    Signed-off-by: Greg Kroah-Hartman

    Rishabh Bhatnagar
     

05 Sep, 2018

1 commit

  • Within show_valid_zones() the function test_pages_in_a_zone() should be
    called for online memory blocks only.

    Otherwise it might lead to the VM_BUG_ON due to uninitialized struct
    pages (when CONFIG_DEBUG_VM_PGFLAGS kernel option is set):

    page dumped because: VM_BUG_ON_PAGE(PagePoisoned(p))
    ------------[ cut here ]------------
    Call Trace:
    ([] test_pages_in_a_zone+0xe6/0x168)
    [] show_valid_zones+0x5a/0x1a8
    [] dev_attr_show+0x3c/0x78
    [] sysfs_kf_seq_show+0xd0/0x150
    [] seq_read+0x212/0x4b8
    [] __vfs_read+0x3a/0x178
    [] vfs_read+0x8a/0x148
    [] ksys_read+0x62/0xb8
    [] system_call+0xdc/0x2d8

    That VM_BUG_ON was triggered by the page poisoning introduced in
    mm/sparse.c with the git commit d0dc12e86b31 ("mm/memory_hotplug:
    optimize memory hotplug").

    With the same commit the new 'nid' field has been added to the struct
    memory_block in order to store and later on derive the node id for
    offline pages (instead of accessing struct page which might be
    uninitialized). But one reference to nid in show_valid_zones() function
    has been overlooked. Fixed with current commit. Also, nr_pages will
    not be used any more after test_pages_in_a_zone() call, do not update
    it.

    Link: http://lkml.kernel.org/r/20180828090539.41491-1-zaslonko@linux.ibm.com
    Fixes: d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug")
    Signed-off-by: Mikhail Zaslonko
    Acked-by: Michal Hocko
    Reviewed-by: Pavel Tatashin
    Cc: [4.17+]
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mikhail Zaslonko
     

24 Aug, 2018

1 commit


19 Aug, 2018

1 commit

  • Pull driver core updates from Greg KH:
    "Here are all of the driver core and related patches for 4.19-rc1.

    Nothing huge here, just a number of small cleanups and the ability to
    now stop the deferred probing after init happens.

    All of these have been in linux-next for a while with only a merge
    issue reported"

    * tag 'driver-core-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (21 commits)
    base: core: Remove WARN_ON from link dependencies check
    drivers/base: stop new probing during shutdown
    drivers: core: Remove glue dirs from sysfs earlier
    driver core: remove unnecessary function extern declare
    sysfs.h: fix non-kernel-doc comment
    PM / Domains: Stop deferring probe at the end of initcall
    iommu: Remove IOMMU_OF_DECLARE
    iommu: Stop deferring probe at end of initcalls
    pinctrl: Support stopping deferred probe after initcalls
    dt-bindings: pinctrl: add a 'pinctrl-use-default' property
    driver core: allow stopping deferred probe after init
    driver core: add a debugfs entry to show deferred devices
    sysfs: Fix internal_create_group() for named group updates
    base: fix order of OF initialization
    linux/device.h: fix kernel-doc notation warning
    Documentation: update firmware loader fallback reference
    kobject: Replace strncpy with memcpy
    drivers: base: cacheinfo: use OF property_read_u32 instead of get_property,read_number
    kernfs: Replace strncpy with memcpy
    device: Add #define dev_fmt similar to #define pr_fmt
    ...

    Linus Torvalds
     

18 Aug, 2018

4 commits

  • Some architectures do not define certain PAGE_KERNEL_* flags, this is
    either because:

    a) The way to implement some of these flags is *not yet ported*, or
    b) The architecture *has no way* to describe them

    Over time we have accumulated a few PAGE_KERNEL_* fallback workarounds
    for architectures in the kernel which do not define them using
    *relatively safe* equivalents. Move these scattered fallback hacks into
    asm-generic.

    We start off with PAGE_KERNEL_RO using PAGE_KERNEL as a fallback. This
    has been in place on the firmware loader for years. Move the fallback
    into the respective asm-generic header.

    Link: http://lkml.kernel.org/r/20180510185507.2439-2-mcgrof@kernel.org
    Signed-off-by: Luis R. Rodriguez
    Reviewed-by: Andrew Morton
    Cc: Arnd Bergmann
    Cc: Greg Kroah-Hartman
    Cc: Matthew Wilcox
    Cc: Geert Uytterhoeven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Luis R. Rodriguez
     
  • Callers of register_mem_sect_under_node() are always passing a valid
    memory_block (not NULL), so we can safely drop the check for NULL.

    In the same way, register_mem_sect_under_node() is only called in case
    the node is online, so we can safely remove that check as well.

    Link: http://lkml.kernel.org/r/20180622111839.10071-5-osalvador@techadventures.net
    Signed-off-by: Oscar Salvador
    Reviewed-by: Pavel Tatashin
    Tested-by: Reza Arbab
    Tested-by: Jonathan Cameron
    Cc: Pasha Tatashin
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oscar Salvador
     
  • link_mem_sections() and walk_memory_range() share most of the code, so
    we can use convert link_mem_sections() into a dummy function that calls
    walk_memory_range() with a callback to register_mem_sect_under_node().

    This patch converts register_mem_sect_under_node() in order to match a
    walk_memory_range's callback, getting rid of the check_nid argument and
    checking instead if the system is still boothing, since we only have to
    check for the nid if the system is in such state.

    Link: http://lkml.kernel.org/r/20180622111839.10071-4-osalvador@techadventures.net
    Signed-off-by: Oscar Salvador
    Suggested-by: Pavel Tatashin
    Tested-by: Reza Arbab
    Tested-by: Jonathan Cameron
    Reviewed-by: Pavel Tatashin
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oscar Salvador
     
  • When hotplugging memory, it is possible that two calls are being made to
    register_mem_sect_under_node().

    One comes from __add_section()->hotplug_memory_register() and the other
    from add_memory_resource()->link_mem_sections() if we had to register a
    new node.

    In case we had to register a new node, hotplug_memory_register() will
    only handle/allocate the memory_block's since
    register_mem_sect_under_node() will return right away because the node
    it is not online yet.

    I think it is better if we leave hotplug_memory_register() to
    handle/allocate only memory_block's and make link_mem_sections() to call
    register_mem_sect_under_node().

    So this patch removes the call to register_mem_sect_under_node() from
    hotplug_memory_register(), and moves the call to link_mem_sections() out
    of the condition, so it will always be called. In this way we only have
    one place where the memory sections are registered.

    Link: http://lkml.kernel.org/r/20180622111839.10071-3-osalvador@techadventures.net
    Signed-off-by: Oscar Salvador
    Reviewed-by: Pavel Tatashin
    Tested-by: Reza Arbab
    Tested-by: Jonathan Cameron
    Cc: Pasha Tatashin
    Cc: Michal Hocko
    Cc: Vlastimil Babka
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Oscar Salvador
     

16 Aug, 2018

2 commits

  • Pull networking updates from David Miller:
    "Highlights:

    - Gustavo A. R. Silva keeps working on the implicit switch fallthru
    changes.

    - Support 802.11ax High-Efficiency wireless in cfg80211 et al, From
    Luca Coelho.

    - Re-enable ASPM in r8169, from Kai-Heng Feng.

    - Add virtual XFRM interfaces, which avoids all of the limitations of
    existing IPSEC tunnels. From Steffen Klassert.

    - Convert GRO over to use a hash table, so that when we have many
    flows active we don't traverse a long list during accumluation.

    - Many new self tests for routing, TC, tunnels, etc. Too many
    contributors to mention them all, but I'm really happy to keep
    seeing this stuff.

    - Hardware timestamping support for dpaa_eth/fsl-fman from Yangbo Lu.

    - Lots of cleanups and fixes in L2TP code from Guillaume Nault.

    - Add IPSEC offload support to netdevsim, from Shannon Nelson.

    - Add support for slotting with non-uniform distribution to netem
    packet scheduler, from Yousuk Seung.

    - Add UDP GSO support to mlx5e, from Boris Pismenny.

    - Support offloading of Team LAG in NFP, from John Hurley.

    - Allow to configure TX queue selection based upon RX queue, from
    Amritha Nambiar.

    - Support ethtool ring size configuration in aquantia, from Anton
    Mikaev.

    - Support DSCP and flowlabel per-transport in SCTP, from Xin Long.

    - Support list based batching and stack traversal of SKBs, this is
    very exciting work. From Edward Cree.

    - Busyloop optimizations in vhost_net, from Toshiaki Makita.

    - Introduce the ETF qdisc, which allows time based transmissions. IGB
    can offload this in hardware. From Vinicius Costa Gomes.

    - Add parameter support to devlink, from Moshe Shemesh.

    - Several multiplication and division optimizations for BPF JIT in
    nfp driver, from Jiong Wang.

    - Lots of prepatory work to make more of the packet scheduler layer
    lockless, when possible, from Vlad Buslov.

    - Add ACK filter and NAT awareness to sch_cake packet scheduler, from
    Toke Høiland-Jørgensen.

    - Support regions and region snapshots in devlink, from Alex Vesker.

    - Allow to attach XDP programs to both HW and SW at the same time on
    a given device, with initial support in nfp. From Jakub Kicinski.

    - Add TLS RX offload and support in mlx5, from Ilya Lesokhin.

    - Use PHYLIB in r8169 driver, from Heiner Kallweit.

    - All sorts of changes to support Spectrum 2 in mlxsw driver, from
    Ido Schimmel.

    - PTP support in mv88e6xxx DSA driver, from Andrew Lunn.

    - Make TCP_USER_TIMEOUT socket option more accurate, from Jon
    Maxwell.

    - Support for templates in packet scheduler classifier, from Jiri
    Pirko.

    - IPV6 support in RDS, from Ka-Cheong Poon.

    - Native tproxy support in nf_tables, from Máté Eckl.

    - Maintain IP fragment queue in an rbtree, but optimize properly for
    in-order frags. From Peter Oskolkov.

    - Improvde handling of ACKs on hole repairs, from Yuchung Cheng"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1996 commits)
    bpf: test: fix spelling mistake "REUSEEPORT" -> "REUSEPORT"
    hv/netvsc: Fix NULL dereference at single queue mode fallback
    net: filter: mark expected switch fall-through
    xen-netfront: fix warn message as irq device name has '/'
    cxgb4: Add new T5 PCI device ids 0x50af and 0x50b0
    net: dsa: mv88e6xxx: missing unlock on error path
    rds: fix building with IPV6=m
    inet/connection_sock: prefer _THIS_IP_ to current_text_addr
    net: dsa: mv88e6xxx: bitwise vs logical bug
    net: sock_diag: Fix spectre v1 gadget in __sock_diag_cmd()
    ieee802154: hwsim: using right kind of iteration
    net: hns3: Add vlan filter setting by ethtool command -K
    net: hns3: Set tx ring' tc info when netdev is up
    net: hns3: Remove tx ring BD len register in hns3_enet
    net: hns3: Fix desc num set to default when setting channel
    net: hns3: Fix for phy link issue when using marvell phy driver
    net: hns3: Fix for information of phydev lost problem when down/up
    net: hns3: Fix for command format parsing error in hclge_is_all_function_id_zero
    net: hns3: Add support for serdes loopback selftest
    bnxt_en: take coredump_record structure off stack
    ...

    Linus Torvalds
     
  • Pull security subsystem updates from James Morris:

    - kstrdup() return value fix from Eric Biggers

    - Add new security_load_data hook to differentiate security checking of
    kernel-loaded binaries in the case of there being no associated file
    descriptor, from Mimi Zohar.

    - Add ability to IMA to specify a policy at build-time, rather than
    just via command line params or by loading a custom policy, from
    Mimi.

    - Allow IMA and LSMs to prevent sysfs firmware load fallback (e.g. if
    using signed firmware), from Mimi.

    - Allow IMA to deny loading of kexec kernel images, as they cannot be
    measured by IMA, from Mimi.

    * 'next-general' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
    security: check for kstrdup() failure in lsm_append()
    security: export security_kernel_load_data function
    ima: based on policy warn about loading firmware (pre-allocated buffer)
    module: replace the existing LSM hook in init_module
    ima: add build time policy
    ima: based on policy require signed firmware (sysfs fallback)
    firmware: add call to LSM hook before firmware sysfs fallback
    ima: based on policy require signed kexec kernel images
    kexec: add call to LSM hook in original kexec_load syscall
    security: define new LSM hook named security_kernel_load_data
    MAINTAINERS: remove the outdated "LINUX SECURITY MODULE (LSM) FRAMEWORK" entry

    Linus Torvalds
     

15 Aug, 2018

3 commits

  • Pull power management updates from Rafael Wysocki:
    "These add a new framework for CPU idle time injection, to be used by
    all of the idle injection code in the kernel in the future, fix some
    issues and add a number of relatively small extensions in multiple
    places.

    Specifics:

    - Add a new framework for CPU idle time injection (Daniel Lezcano).

    - Add AVS support to the armada-37xx cpufreq driver (Gregory
    CLEMENT).

    - Add support for current CPU frequency reporting to the ACPI CPPC
    cpufreq driver (George Cherian).

    - Rework the cooling device registration in the imx6q/thermal driver
    (Bastian Stender).

    - Make the pcc-cpufreq driver refuse to work with dynamic scaling
    governors on systems with many CPUs to avoid scalability issues
    with it (Rafael Wysocki).

    - Fix the intel_pstate driver to report different maximum CPU
    frequencies on systems where they really are different and to
    ignore the turbo active ratio if hardware-managend P-states (HWP)
    are in use; make it use the match_string() helper (Xie Yisheng,
    Srinivas Pandruvada).

    - Fix a minor deferred probe issue in the qcom-kryo cpufreq driver
    (Niklas Cassel).

    - Add a tracepoint for the tracking of frequency limits changes (from
    Andriod) to the cpufreq core (Ruchi Kandoi).

    - Fix a circular lock dependency between CPU hotplug and sysfs
    locking in the cpufreq core reported by lockdep (Waiman Long).

    - Avoid excessive error reports on driver registration failures in
    the ARM cpuidle driver (Sudeep Holla).

    - Add a new device links flag to the driver core to make links go
    away automatically on supplier driver removal (Vivek Gautam).

    - Eliminate potential race condition between system-wide power
    management transitions and system shutdown (Pingfan Liu).

    - Add a quirk to save NVS memory on system suspend for the ASUS 1025C
    laptop (Willy Tarreau).

    - Make more systems use suspend-to-idle (instead of ACPI S3) by
    default (Tristian Celestin).

    - Get rid of stack VLA usage in the low-level hibernation code on
    64-bit x86 (Kees Cook).

    - Fix error handling in the hibernation core and mark an expected
    fall-through switch in it (Chengguang Xu, Gustavo Silva).

    - Extend the generic power domains (genpd) framework to support
    attaching a device to a power domain by name (Ulf Hansson).

    - Fix device reference counting and user limits initialization in the
    devfreq core (Arvind Yadav, Matthias Kaehlcke).

    - Fix a few issues in the rk3399_dmc devfreq driver and improve its
    documentation (Enric Balletbo i Serra, Lin Huang, Nick Milner).

    - Drop a redundant error message from the exynos-ppmu devfreq driver
    (Markus Elfring)"

    * tag 'pm-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (35 commits)
    PM / reboot: Eliminate race between reboot and suspend
    PM / hibernate: Mark expected switch fall-through
    cpufreq: intel_pstate: Ignore turbo active ratio in HWP
    cpufreq: Fix a circular lock dependency problem
    cpu/hotplug: Add a cpus_read_trylock() function
    x86/power/hibernate_64: Remove VLA usage
    cpufreq: trace frequency limits change
    cpufreq: intel_pstate: Show different max frequency with turbo 3 and HWP
    cpufreq: pcc-cpufreq: Disable dynamic scaling on many-CPU systems
    cpufreq: qcom-kryo: Silently error out on EPROBE_DEFER
    cpufreq / CPPC: Add cpuinfo_cur_freq support for CPPC
    cpufreq: armada-37xx: Add AVS support
    dt-bindings: marvell: Add documentation for the Armada 3700 AVS binding
    PM / devfreq: rk3399_dmc: Fix duplicated opp table on reload.
    PM / devfreq: Init user limits from OPP limits, not viceversa
    PM / devfreq: rk3399_dmc: fix spelling mistakes.
    PM / devfreq: rk3399_dmc: do not print error when get supply and clk defer.
    dt-bindings: devfreq: rk3399_dmc: move interrupts to be optional.
    PM / devfreq: rk3399_dmc: remove wait for dcf irq event.
    dt-bindings: clock: add rk3399 DDR3 standard speed bins.
    ...

    Linus Torvalds
     
  • Pull regulator updates from Mark Brown:
    "The biggest set of changes in here is the addition of the Qualcomm
    RPMH driver. As well as the regualtor driver itself being quite large
    due to the usual involved Qualcomm regulator stuff there's also some
    code shared with the arm-soc tree, a bus driver required to
    communicate with the hardware that actually winds up being much larger
    than the regulator driver itself and a LLCC driver that was part of
    the same signed tag used with the arm-soc tree.

    Other than that it's a fairly standard and quiet release, highlights
    include:

    - Addition of device links from regulator consumers to their
    regulators, helping the core avoid dependency issues during
    suspend.

    - Support for the entertainingly innovative suspend implementation in
    the BD9571MWV.

    - Support for switch regulators on the PFUZE100, this required two
    goes due to backwards compatibility issues with old DTs that were
    discovered.

    - Support for Freescale PFUZE3001 and SocioNext UniPhier.

    - The aforementioned Qualcomm RPMH driver together with the driver
    changes required to support it"

    * tag 'regulator-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (52 commits)
    regulator: add QCOM RPMh regulator driver
    regulator: dt-bindings: add QCOM RPMh regulator bindings
    regulator: samsung: Add SPDX license identifiers
    regulator: maxim: Add SPDX license identifiers
    regulator: bd71837: adobt MFD changes to regulator driver
    regulator: tps65217: Fix NULL pointer dereference on probe
    regulator: Add support for CPCAP regulators on Motorola Xoom devices.
    regulator: Add sw2_sw4 voltage table to cpcap regulator.
    regulator: bd9571mwv: Make symbol 'dev_attr_backup_mode' static
    regulator: pfuze100: add support to en-/disable switch regulators
    regulator: pfuze100: add optional disable switch-regulators binding
    soc: qcom: rmtfs-mem: fix memleak in probe error paths
    soc: qcom: llc-slice: Add missing MODULE_LICENSE()
    drivers: qcom: rpmh: fix unwanted error check for get_tcs_of_type()
    drivers: qcom: rpmh-rsc: fix the loop index check in get_req_from_tcs
    firmware: qcom: scm: add a dummy qcom_scm_assign_mem()
    drivers: qcom: rpmh-rsc: Check cmd_db_ready() to help children
    drivers: qcom: rpmh-rsc: allow active requests from wake TCS
    drivers: qcom: rpmh: add support for batch RPMH request
    drivers: qcom: rpmh: allow requests to be sent asynchronously
    ...

    Linus Torvalds
     
  • Pull regmap updates from Mark Brown:
    "Several small new features for regmap this time around:

    - Support for SCCB, an I2C variant used on some media cards. This has
    also pulled in an I2C commit from Peter Rosin as a dependency.

    - Addition of an API for reading repeatedly from registers where the
    address doesn't automatically increment like some ADC outputs or
    GPIO status registers.

    - Support for bulk I/O on Slimbus"

    * tag 'regmap-v4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap:
    regmap: Add regmap_noinc_read API
    regmap: sccb: fix typo and sort headers alphabetically
    i2c: smbus: add unlocked __i2c_smbus_xfer variant
    regmap: add SCCB support
    regmap: slimbus: add support to multi read/write

    Linus Torvalds
     

14 Aug, 2018

1 commit

  • Merge changes in the PM core, system-wide PM infrastructure, generic
    power domains (genpd) framework, ACPI PM infrastructure and cpuidle
    for 4.19.

    * pm-core:
    driver core: Add flag to autoremove device link on supplier unbind
    driver core: Rename flag AUTOREMOVE to AUTOREMOVE_CONSUMER

    * pm-domains:
    PM / Domains: Introduce dev_pm_domain_attach_by_name()
    PM / Domains: Introduce option to attach a device by name to genpd
    PM / Domains: dt: Add a power-domain-names property

    * pm-sleep:
    PM / reboot: Eliminate race between reboot and suspend
    PM / hibernate: Mark expected switch fall-through
    x86/power/hibernate_64: Remove VLA usage
    PM / hibernate: cast PAGE_SIZE to int when comparing with error code

    * acpi-pm:
    ACPI / PM: save NVS memory for ASUS 1025C laptop
    ACPI / PM: Default to s2idle in all machines supporting LP S0

    * pm-cpuidle:
    ARM: cpuidle: silence error on driver registration failure

    Rafael J. Wysocki
     

11 Aug, 2018

1 commit


09 Aug, 2018

3 commits

  • Mark Brown
     
  • regmap: Support non-incrementing registers

    Some devices have individual registers that don't autoincrement the
    register address during bulk reads but instead repeatedly read the same
    value, for example for monitoring GPIOs or ADCs. Add support for these.

    Mark Brown
     
  • The regmap API usually assumes that bulk read operations will read a
    range of registers but some I2C/SPI devices have certain registers for
    which a such a read operation will return data from an internal FIFO
    instead. Add an explicit API to support bulk read without range semantics.

    Some linux drivers use regmap_bulk_read or regmap_raw_read for such
    registers, for example mpu6050 or bmi150 from IIO. This only happens to
    work because when caching is disabled a single regmap read op will map
    to a single bus read op (as desired). This breaks if caching is enabled and
    reg+1 happens to be a cacheable register.

    Without regmap support refactoring a driver to enable regmap caching
    requires separate I2C and SPI paths. This is exactly what regmap is
    supposed to help avoid.

    Suggested-by: Jonathan Cameron
    Signed-off-by: Crestez Dan Leonard
    Signed-off-by: Stefan Popa
    Signed-off-by: Mark Brown

    Crestez Dan Leonard
     

05 Aug, 2018

1 commit


03 Aug, 2018

1 commit