1. 18 Aug, 2020 10 commits
    • Sergey Senozhatsky's avatar
      serial: 8250: change lock order in serial8250_do_startup() · 205d300a
      Sergey Senozhatsky authored
      We have a number of "uart.port->desc.lock vs desc.lock->uart.port"
      lockdep reports coming from 8250 driver; this causes a bit of trouble
      to people, so let's fix it.
      
      The problem is reverse lock order in two different call paths:
      
      chain #1:
      
       serial8250_do_startup()
        spin_lock_irqsave(&port->lock);
         disable_irq_nosync(port->irq);
          raw_spin_lock_irqsave(&desc->lock)
      
      chain #2:
      
        __report_bad_irq()
         raw_spin_lock_irqsave(&desc->lock)
          for_each_action_of_desc()
           printk()
            spin_lock_irqsave(&port->lock);
      
      Fix this by changing the order of locks in serial8250_do_startup():
       do disable_irq_nosync() first, which grabs desc->lock, and grab
       uart->port after that, so that chain #1 and chain #2 have same lock
       order.
      
      Full lockdep splat:
      
       ======================================================
       WARNING: possible circular locking dependency detected
       5.4.39 #55 Not tainted
       ======================================================
      
       swapper/0/0 is trying to acquire lock:
       ffffffffab65b6c0 (console_owner){-...}, at: console_lock_spinning_enable+0x31/0x57
      
       but task is already holding lock:
       ffff88810a8e34c0 (&irq_desc_lock_class){-.-.}, at: __report_bad_irq+0x5b/0xba
      
       which lock already depends on the new lock.
      
       the existing dependency chain (in reverse order) is:
      
       -> #2 (&irq_desc_lock_class){-.-.}:
              _raw_spin_lock_irqsave+0x61/0x8d
              __irq_get_desc_lock+0x65/0x89
              __disable_irq_nosync+0x3b/0x93
              serial8250_do_startup+0x451/0x75c
              uart_startup+0x1b4/0x2ff
              uart_port_activate+0x73/0xa0
              tty_port_open+0xae/0x10a
              uart_open+0x1b/0x26
              tty_open+0x24d/0x3a0
              chrdev_open+0xd5/0x1cc
              do_dentry_open+0x299/0x3c8
              path_openat+0x434/0x1100
              do_filp_open+0x9b/0x10a
              do_sys_open+0x15f/0x3d7
              kernel_init_freeable+0x157/0x1dd
              kernel_init+0xe/0x105
              ret_from_fork+0x27/0x50
      
       -> #1 (&port_lock_key){-.-.}:
              _raw_spin_lock_irqsave+0x61/0x8d
              serial8250_console_write+0xa7/0x2a0
              console_unlock+0x3b7/0x528
              vprintk_emit+0x111/0x17f
              printk+0x59/0x73
              register_console+0x336/0x3a4
              uart_add_one_port+0x51b/0x5be
              serial8250_register_8250_port+0x454/0x55e
              dw8250_probe+0x4dc/0x5b9
              platform_drv_probe+0x67/0x8b
              really_probe+0x14a/0x422
              driver_probe_device+0x66/0x130
              device_driver_attach+0x42/0x5b
              __driver_attach+0xca/0x139
              bus_for_each_dev+0x97/0xc9
              bus_add_driver+0x12b/0x228
              driver_register+0x64/0xed
              do_one_initcall+0x20c/0x4a6
              do_initcall_level+0xb5/0xc5
              do_basic_setup+0x4c/0x58
              kernel_init_freeable+0x13f/0x1dd
              kernel_init+0xe/0x105
              ret_from_fork+0x27/0x50
      
       -> #0 (console_owner){-...}:
              __lock_acquire+0x118d/0x2714
              lock_acquire+0x203/0x258
              console_lock_spinning_enable+0x51/0x57
              console_unlock+0x25d/0x528
              vprintk_emit+0x111/0x17f
              printk+0x59/0x73
              __report_bad_irq+0xa3/0xba
              note_interrupt+0x19a/0x1d6
              handle_irq_event_percpu+0x57/0x79
              handle_irq_event+0x36/0x55
              handle_fasteoi_irq+0xc2/0x18a
              do_IRQ+0xb3/0x157
              ret_from_intr+0x0/0x1d
              cpuidle_enter_state+0x12f/0x1fd
              cpuidle_enter+0x2e/0x3d
              do_idle+0x1ce/0x2ce
              cpu_startup_entry+0x1d/0x1f
              start_kernel+0x406/0x46a
              secondary_startup_64+0xa4/0xb0
      
       other info that might help us debug this:
      
       Chain exists of:
         console_owner --> &port_lock_key --> &irq_desc_lock_class
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(&irq_desc_lock_class);
                                      lock(&port_lock_key);
                                      lock(&irq_desc_lock_class);
         lock(console_owner);
      
        *** DEADLOCK ***
      
       2 locks held by swapper/0/0:
        #0: ffff88810a8e34c0 (&irq_desc_lock_class){-.-.}, at: __report_bad_irq+0x5b/0xba
        #1: ffffffffab65b5c0 (console_lock){+.+.}, at: console_trylock_spinning+0x20/0x181
      
       stack backtrace:
       CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.4.39 #55
       Hardware name: XXXXXX
       Call Trace:
        <IRQ>
        dump_stack+0xbf/0x133
        ? print_circular_bug+0xd6/0xe9
        check_noncircular+0x1b9/0x1c3
        __lock_acquire+0x118d/0x2714
        lock_acquire+0x203/0x258
        ? console_lock_spinning_enable+0x31/0x57
        console_lock_spinning_enable+0x51/0x57
        ? console_lock_spinning_enable+0x31/0x57
        console_unlock+0x25d/0x528
        ? console_trylock+0x18/0x4e
        vprintk_emit+0x111/0x17f
        ? lock_acquire+0x203/0x258
        printk+0x59/0x73
        __report_bad_irq+0xa3/0xba
        note_interrupt+0x19a/0x1d6
        handle_irq_event_percpu+0x57/0x79
        handle_irq_event+0x36/0x55
        handle_fasteoi_irq+0xc2/0x18a
        do_IRQ+0xb3/0x157
        common_interrupt+0xf/0xf
        </IRQ>
      Signed-off-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Fixes: 768aec0b ("serial: 8250: fix shared interrupts issues with SMP and RT kernels")
      Reported-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Reported-by: default avatarRaul Rangel <rrangel@google.com>
      BugLink: https://bugs.chromium.org/p/chromium/issues/detail?id=1114800
      Link: https://lore.kernel.org/lkml/CAHQZ30BnfX+gxjPm1DUd5psOTqbyDh4EJE=2=VAMW_VDafctkA@mail.gmail.com/T/#uReviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Tested-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200817022646.1484638-1-sergey.senozhatsky@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      205d300a
    • Holger Assmann's avatar
      serial: stm32: avoid kernel warning on absence of optional IRQ · fdf16d78
      Holger Assmann authored
      stm32_init_port() of the stm32-usart may trigger a warning in
      platform_get_irq() when the device tree specifies no wakeup interrupt.
      
      The wakeup interrupt is usually a board-specific GPIO and the driver
      functions correctly in its absence. The mainline stm32mp151.dtsi does
      not specify it, so all mainline device trees trigger an unnecessary
      kernel warning. Use of platform_get_irq_optional() avoids this.
      
      Fixes: 2c58e560 ("serial: stm32: fix the get_irq error case")
      Signed-off-by: default avatarHolger Assmann <h.assmann@pengutronix.de>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200813152757.32751-1-h.assmann@pengutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fdf16d78
    • Lukas Wunner's avatar
      serial: pl011: Fix oops on -EPROBE_DEFER · 27afac93
      Lukas Wunner authored
      If probing of a pl011 gets deferred until after free_initmem(), an oops
      ensues because pl011_console_match() is called which has been freed.
      
      Fix by removing the __init attribute from the function and those it
      calls.
      
      Commit 10879ae5 ("serial: pl011: add console matching function")
      introduced pl011_console_match() not just for early consoles but
      regular preferred consoles, such as those added by acpi_parse_spcr().
      Regular consoles may be registered after free_initmem() for various
      reasons, one being deferred probing, another being dynamic enablement
      of serial ports using a DeviceTree overlay.
      
      Thus, pl011_console_match() must not be declared __init and the
      functions it calls mustn't either.
      
      Stack trace for posterity:
      
      Unable to handle kernel paging request at virtual address 80c38b58
      Internal error: Oops: 8000000d [#1] PREEMPT SMP ARM
      PC is at pl011_console_match+0x0/0xfc
      LR is at register_console+0x150/0x468
      [<80187004>] (register_console)
      [<805a8184>] (uart_add_one_port)
      [<805b2b68>] (pl011_register_port)
      [<805b3ce4>] (pl011_probe)
      [<80569214>] (amba_probe)
      [<805ca088>] (really_probe)
      [<805ca2ec>] (driver_probe_device)
      [<805ca5b0>] (__device_attach_driver)
      [<805c8060>] (bus_for_each_drv)
      [<805c9dfc>] (__device_attach)
      [<805ca630>] (device_initial_probe)
      [<805c90a8>] (bus_probe_device)
      [<805c95a8>] (deferred_probe_work_func)
      
      Fixes: 10879ae5 ("serial: pl011: add console matching function")
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Cc: stable@vger.kernel.org # v4.10+
      Cc: Aleksey Makarov <amakarov@marvell.com>
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Christopher Covington <cov@codeaurora.org>
      Link: https://lore.kernel.org/r/f827ff09da55b8c57d316a1b008a137677b58921.1597315557.git.lukas@wunner.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      27afac93
    • Lukas Wunner's avatar
      serial: pl011: Don't leak amba_ports entry on driver register error · 89efbe70
      Lukas Wunner authored
      pl011_probe() calls pl011_setup_port() to reserve an amba_ports[] entry,
      then calls pl011_register_port() to register the uart driver with the
      tty layer.
      
      If registration of the uart driver fails, the amba_ports[] entry is not
      released.  If this happens 14 times (value of UART_NR macro), then all
      amba_ports[] entries will have been leaked and driver probing is no
      longer possible.  (To be fair, that can only happen if the DeviceTree
      doesn't contain alias IDs since they cause the same entry to be used for
      a given port.)   Fix it.
      
      Fixes: ef2889f7 ("serial: pl011: Move uart_register_driver call to device")
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Cc: stable@vger.kernel.org # v3.15+
      Cc: Tushar Behera <tushar.behera@linaro.org>
      Link: https://lore.kernel.org/r/138f8c15afb2f184d8102583f8301575566064a6.1597316167.git.lukas@wunner.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      89efbe70
    • Valmer Huhn's avatar
      serial: 8250_exar: Fix number of ports for Commtech PCIe cards · c6b9e95d
      Valmer Huhn authored
      The following in 8250_exar.c line 589 is used to determine the number
      of ports for each Exar board:
      
      nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
      
      If the number of ports a card has is not explicitly specified, it defaults
      to the rightmost 4 bits of the PCI device ID. This is prone to error since
      not all PCI device IDs contain a number which corresponds to the number of
      ports that card provides.
      
      This particular case involves COMMTECH_4222PCIE, COMMTECH_4224PCIE and
      COMMTECH_4228PCIE cards with device IDs 0x0022, 0x0020 and 0x0021.
      Currently the multiport cards receive 2, 0 and 1 port instead of 2, 4 and
      8 ports respectively.
      
      To fix this, each Commtech Fastcom PCIe card is given a struct where the
      number of ports is explicitly specified. This ensures 'board->num_ports'
      is used instead of the default 'pcidev->device & 0x0f'.
      
      Fixes: d0aeaa83 ("serial: exar: split out the exar code from 8250_pci")
      Signed-off-by: default avatarValmer Huhn <valmer.huhn@concurrent-rt.com>
      Tested-by: default avatarValmer Huhn <valmer.huhn@concurrent-rt.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20200813165255.GC345440@icarus.concurrent-rt.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c6b9e95d
    • John Stultz's avatar
      tty: serial: qcom_geni_serial: Drop __init from qcom_geni_console_setup · 975efc66
      John Stultz authored
      When booting with heavily modularized config, the serial console
      may not be able to load until after init when modules that
      satisfy needed dependencies have time to load.
      
      Unfortunately, as qcom_geni_console_setup is marked as __init,
      the function may have been freed before we get to run it,
      causing boot time crashes such as:
      
      [    6.469057] Unable to handle kernel paging request at virtual address ffffffe645d4e6cc
      [    6.481623] Mem abort info:
      [    6.484466]   ESR = 0x86000007
      [    6.487557]   EC = 0x21: IABT (current EL), IL = 32 bits
      [    6.492929]   SET = 0, FnV = 0g
      [    6.496016]   EA = 0, S1PTW = 0
      [    6.499202] swapper pgtable: 4k pages, 39-bit VAs, pgdp=000000008151e000
      [    6.501286] ufshcd-qcom 1d84000.ufshc: ufshcd_print_pwr_info:[RX, TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2
      [    6.505977] [ffffffe645d4e6cc] pgd=000000017df9f003, p4d=000000017df9f003, pud=000000017df9f003, pmd=000000017df9c003, pte=0000000000000000
      [    6.505990] Internal error: Oops: 86000007 [#1] PREEMPT SMP
      [    6.505995] Modules linked in: zl10353 zl10039 zl10036 zd1301_demod xc5000 xc4000 ves1x93 ves1820 tuner_xc2028 tuner_simple tuner_types tua9001 tua6100 1
      [    6.506152]  isl6405
      [    6.518104] ufshcd-qcom 1d84000.ufshc: ufshcd_find_max_sup_active_icc_level: Regulator capability was not set, actvIccLevel=0
      [    6.530549]  horus3a helene fc2580 fc0013 fc0012 fc0011 ec100 e4000 dvb_pll ds3000 drxk drxd drx39xyj dib9000 dib8000 dib7000p dib7000m dib3000mc dibx003
      [    6.624271] CPU: 7 PID: 148 Comm: kworker/7:2 Tainted: G        W       5.8.0-mainline-12021-g6defd37ba1cd #3455
      [    6.624273] Hardware name: Thundercomm Dragonboard 845c (DT)
      [    6.624290] Workqueue: events deferred_probe_work_func
      [    6.624296] pstate: 40c00005 (nZcv daif +PAN +UAO BTYPE=--)
      [    6.624307] pc : qcom_geni_console_setup+0x0/0x110
      [    6.624316] lr : try_enable_new_console+0xa0/0x140
      [    6.624318] sp : ffffffc010843a30
      [    6.624320] x29: ffffffc010843a30 x28: ffffffe645c3e7d0
      [    6.624325] x27: ffffff80f8022180 x26: ffffffc010843b28
      [    6.637937] x25: 0000000000000000 x24: ffffffe6462a2000
      [    6.637941] x23: ffffffe646398000 x22: 0000000000000000
      [    6.637945] x21: 0000000000000000 x20: ffffffe6462a5ce8
      [    6.637952] x19: ffffffe646398e38 x18: ffffffffffffffff
      [    6.680296] x17: 0000000000000000 x16: ffffffe64492b900
      [    6.680300] x15: ffffffe6461e9d08 x14: 69202930203d2064
      [    6.680305] x13: 7561625f65736162 x12: 202c363331203d20
      [    6.696434] x11: 0000000000000030 x10: 0101010101010101
      [    6.696438] x9 : 4d4d20746120304d x8 : 7f7f7f7f7f7f7f7f
      [    6.707249] x7 : feff4c524c787373 x6 : 0000000000008080
      [    6.707253] x5 : 0000000000000000 x4 : 8080000000000000
      [    6.707257] x3 : 0000000000000000 x2 : ffffffe645d4e6cc
      [    6.744223] qcom_geni_serial 898000.serial: dev_pm_opp_set_rate: failed to find OPP for freq 102400000 (-34)
      [    6.744966] x1 : fffffffefe74e174 x0 : ffffffe6462a5ce8
      [    6.753580] qcom_geni_serial 898000.serial: dev_pm_opp_set_rate: failed to find OPP for freq 102400000 (-34)
      [    6.761634] Call trace:
      [    6.761639]  qcom_geni_console_setup+0x0/0x110
      [    6.761645]  register_console+0x29c/0x2f8
      [    6.767981] Bluetooth: hci0: Frame reassembly failed (-84)
      [    6.775252]  uart_add_one_port+0x438/0x500
      [    6.775258]  qcom_geni_serial_probe+0x2c4/0x4a8
      [    6.775266]  platform_drv_probe+0x58/0xa8
      [    6.855359]  really_probe+0xec/0x398
      [    6.855362]  driver_probe_device+0x5c/0xb8
      [    6.855367]  __device_attach_driver+0x98/0xb8
      [    7.184945]  bus_for_each_drv+0x74/0xd8
      [    7.188825]  __device_attach+0xec/0x148
      [    7.192705]  device_initial_probe+0x24/0x30
      [    7.196937]  bus_probe_device+0x9c/0xa8
      [    7.200816]  deferred_probe_work_func+0x7c/0xb8
      [    7.205398]  process_one_work+0x20c/0x4b0
      [    7.209456]  worker_thread+0x48/0x460
      [    7.213157]  kthread+0x14c/0x158
      [    7.216432]  ret_from_fork+0x10/0x18
      [    7.220049] Code: bad PC value
      [    7.223139] ---[ end trace 73f3b21e251d5a70 ]---
      
      Thus this patch removes the __init avoiding crash in such
      configs.
      
      Cc: Andy Gross <agross@kernel.org>
      Cc: Jiri Slaby <jirislaby@kernel.org>
      Cc: Saravana Kannan <saravanak@google.com>
      Cc: Todd Kjos <tkjos@google.com>
      Cc: Amit Pundir <amit.pundir@linaro.org>
      Cc: linux-arm-msm@vger.kernel.org
      Cc: linux-serial@vger.kernel.org
      Suggested-by: default avatarSaravana Kannan <saravanak@google.com>
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Reviewed-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
      Link: https://lore.kernel.org/r/20200811025044.70626-1-john.stultz@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      975efc66
    • Douglas Anderson's avatar
      serial: qcom_geni_serial: Fix recent kdb hang · d681a6e4
      Douglas Anderson authored
      The commit e42d6c3e ("serial: qcom_geni_serial: Make kgdb work
      even if UART isn't console") worked pretty well and I've been doing a
      lot of debugging with it.  However, recently I typed "dmesg" in kdb
      and then held the space key down to scroll through the pagination.  My
      device hung.  This was repeatable and I found that it was introduced
      with the aforementioned commit.
      
      It turns out that there are some strange boundary cases in geni where
      in some weird situations it will signal RX_LAST but then will put 0 in
      RX_LAST_BYTE.  This means that the entire last FIFO entry is valid.
      This weird corner case is handled in qcom_geni_serial_handle_rx()
      where you can see that we only honor RX_LAST_BYTE if RX_LAST is set
      _and_ RX_LAST_BYTE is non-zero.  If either of these is not true we use
      BYTES_PER_FIFO_WORD (4) for the size of the last FIFO word.
      
      Let's fix kgdb.  While at it, also use the proper #define for 4.
      
      Fixes: e42d6c3e ("serial: qcom_geni_serial: Make kgdb work even if UART isn't console")
      Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarAkash Asthana <akashast@codeaurora.org>
      Link: https://lore.kernel.org/r/20200806221904.1.I4455ff86f0ef5281c2a0cd0a4712db614548a5ca@changeidSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d681a6e4
    • George Kennedy's avatar
      vt_ioctl: change VT_RESIZEX ioctl to check for error return from vc_resize() · bc5269ca
      George Kennedy authored
      vc_resize() can return with an error after failure. Change VT_RESIZEX ioctl
      to save struct vc_data values that are modified and restore the original
      values in case of error.
      Signed-off-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
      Cc: stable <stable@vger.kernel.org>
      Reported-by: syzbot+38a3699c7eaf165b97a6@syzkaller.appspotmail.com
      Link: https://lore.kernel.org/r/1596213192-6635-2-git-send-email-george.kennedy@oracle.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc5269ca
    • George Kennedy's avatar
      fbcon: prevent user font height or width change from causing potential out-of-bounds access · 39b3cffb
      George Kennedy authored
      Add a check to fbcon_resize() to ensure that a possible change to user font
      height or user font width will not allow a font data out-of-bounds access.
      NOTE: must use original charcount in calculation as font charcount can
      change and cannot be used to determine the font data allocated size.
      Signed-off-by: default avatarGeorge Kennedy <george.kennedy@oracle.com>
      Cc: stable <stable@vger.kernel.org>
      Reported-by: syzbot+38a3699c7eaf165b97a6@syzkaller.appspotmail.com
      Link: https://lore.kernel.org/r/1596213192-6635-1-git-send-email-george.kennedy@oracle.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      39b3cffb
    • Tetsuo Handa's avatar
      vt: defer kfree() of vc_screenbuf in vc_do_resize() · f8d1653d
      Tetsuo Handa authored
      syzbot is reporting UAF bug in set_origin() from vc_do_resize() [1], for
      vc_do_resize() calls kfree(vc->vc_screenbuf) before calling set_origin().
      
      Unfortunately, in set_origin(), vc->vc_sw->con_set_origin() might access
      vc->vc_pos when scroll is involved in order to manipulate cursor, but
      vc->vc_pos refers already released vc->vc_screenbuf until vc->vc_pos gets
      updated based on the result of vc->vc_sw->con_set_origin().
      
      Preserving old buffer and tolerating outdated vc members until set_origin()
      completes would be easier than preventing vc->vc_sw->con_set_origin() from
      accessing outdated vc members.
      
      [1] https://syzkaller.appspot.com/bug?id=6649da2081e2ebdc65c0642c214b27fe91099db3Reported-by: default avatarsyzbot <syzbot+9116ecc1978ca3a12f43@syzkaller.appspotmail.com>
      Signed-off-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/1596034621-4714-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jpSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f8d1653d
  2. 16 Aug, 2020 6 commits
    • Linus Torvalds's avatar
      Linux 5.9-rc1 · 9123e3a7
      Linus Torvalds authored
      9123e3a7
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.9-2020-08-15' of git://git.kernel.dk/linux-block · 2cc3c4b3
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "A few differerent things in here.
      
        Seems like syzbot got some more io_uring bits wired up, and we got a
        handful of reports and the associated fixes are in here.
      
        General fixes too, and a lot of them marked for stable.
      
        Lastly, a bit of fallout from the async buffered reads, where we now
        more easily trigger short reads. Some applications don't really like
        that, so the io_read() code now handles short reads internally, and
        got a cleanup along the way so that it's now easier to read (and
        documented). We're now passing tests that failed before"
      
      * tag 'io_uring-5.9-2020-08-15' of git://git.kernel.dk/linux-block:
        io_uring: short circuit -EAGAIN for blocking read attempt
        io_uring: sanitize double poll handling
        io_uring: internally retry short reads
        io_uring: retain iov_iter state over io_read/io_write calls
        task_work: only grab task signal lock when needed
        io_uring: enable lookup of links holding inflight files
        io_uring: fail poll arm on queue proc failure
        io_uring: hold 'ctx' reference around task_work queue + execute
        fs: RWF_NOWAIT should imply IOCB_NOIO
        io_uring: defer file table grabbing request cleanup for locked requests
        io_uring: add missing REQ_F_COMP_LOCKED for nested requests
        io_uring: fix recursive completion locking on oveflow flush
        io_uring: use TWA_SIGNAL for task_work uncondtionally
        io_uring: account locked memory before potential error case
        io_uring: set ctx sq/cq entry count earlier
        io_uring: Fix NULL pointer dereference in loop_rw_iter()
        io_uring: add comments on how the async buffered read retry works
        io_uring: io_async_buf_func() need not test page bit
      2cc3c4b3
    • Mike Rapoport's avatar
      parisc: fix PMD pages allocation by restoring pmd_alloc_one() · 6f6aea7e
      Mike Rapoport authored
      Commit 1355c31e ("asm-generic: pgalloc: provide generic pmd_alloc_one()
      and pmd_free_one()") converted parisc to use generic version of
      pmd_alloc_one() but it missed the fact that parisc uses order-1 pages for
      PMD.
      
      Restore the original version of pmd_alloc_one() for parisc, just use
      GFP_PGTABLE_KERNEL that implies __GFP_ZERO instead of GFP_KERNEL and
      memset.
      
      Fixes: 1355c31e ("asm-generic: pgalloc: provide generic pmd_alloc_one() and pmd_free_one()")
      Reported-by: default avatarMeelis Roos <mroos@linux.ee>
      Signed-off-by: default avatarMike Rapoport <rppt@linux.ibm.com>
      Tested-by: default avatarMeelis Roos <mroos@linux.ee>
      Reviewed-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Link: https://lkml.kernel.org/r/9f2b5ebd-e4a4-0fa1-6cd3-4b9f6892d1ad@linux.eeSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      6f6aea7e
    • Linus Torvalds's avatar
      Merge tag 'block-5.9-2020-08-14' of git://git.kernel.dk/linux-block · 4b6c093e
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "A few fixes on the block side of things:
      
         - Discard granularity fix (Coly)
      
         - rnbd cleanups (Guoqing)
      
         - md error handling fix (Dan)
      
         - md sysfs fix (Junxiao)
      
         - Fix flush request accounting, which caused an IO slowdown for some
           configurations (Ming)
      
         - Properly propagate loop flag for partition scanning (Lennart)"
      
      * tag 'block-5.9-2020-08-14' of git://git.kernel.dk/linux-block:
        block: fix double account of flush request's driver tag
        loop: unset GENHD_FL_NO_PART_SCAN on LOOP_CONFIGURE
        rnbd: no need to set bi_end_io in rnbd_bio_map_kern
        rnbd: remove rnbd_dev_submit_io
        md-cluster: Fix potential error pointer dereference in resize_bitmaps()
        block: check queue's limits.discard_granularity in __blkdev_issue_discard()
        md: get sysfs entry after redundancy attr group create
      4b6c093e
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.9-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · d84835b1
      Linus Torvalds authored
      Pull RISC-V fix from Palmer Dabbelt:
       "I collected a single fix during the merge window: we managed to break
        the early trap setup on !MMU, this fixes it"
      
      * tag 'riscv-for-linus-5.9-mw1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        riscv: Setup exception vector for nommu platform
      d84835b1
    • Linus Torvalds's avatar
      Merge tag 'sh-for-5.9' of git://git.libc.org/linux-sh · 5bbec3cf
      Linus Torvalds authored
      Pull arch/sh updates from Rich Felker:
       "Cleanup, SECCOMP_FILTER support, message printing fixes, and other
        changes to arch/sh"
      
      * tag 'sh-for-5.9' of git://git.libc.org/linux-sh: (34 commits)
        sh: landisk: Add missing initialization of sh_io_port_base
        sh: bring syscall_set_return_value in line with other architectures
        sh: Add SECCOMP_FILTER
        sh: Rearrange blocks in entry-common.S
        sh: switch to copy_thread_tls()
        sh: use the generic dma coherent remap allocator
        sh: don't allow non-coherent DMA for NOMMU
        dma-mapping: consolidate the NO_DMA definition in kernel/dma/Kconfig
        sh: unexport register_trapped_io and match_trapped_io_handler
        sh: don't include <asm/io_trapped.h> in <asm/io.h>
        sh: move the ioremap implementation out of line
        sh: move ioremap_fixed details out of <asm/io.h>
        sh: remove __KERNEL__ ifdefs from non-UAPI headers
        sh: sort the selects for SUPERH alphabetically
        sh: remove -Werror from Makefiles
        sh: Replace HTTP links with HTTPS ones
        arch/sh/configs: remove obsolete CONFIG_SOC_CAMERA*
        sh: stacktrace: Remove stacktrace_ops.stack()
        sh: machvec: Modernize printing of kernel messages
        sh: pci: Modernize printing of kernel messages
        ...
      5bbec3cf
  3. 15 Aug, 2020 24 commits
    • Jens Axboe's avatar
      io_uring: short circuit -EAGAIN for blocking read attempt · f91daf56
      Jens Axboe authored
      One case was missed in the short IO retry handling, and that's hitting
      -EAGAIN on a blocking attempt read (eg from io-wq context). This is a
      problem on sockets that are marked as non-blocking when created, they
      don't carry any REQ_F_NOWAIT information to help us terminate them
      instead of perpetually retrying.
      
      Fixes: 227c0c96 ("io_uring: internally retry short reads")
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      f91daf56
    • Jens Axboe's avatar
      io_uring: sanitize double poll handling · d4e7cd36
      Jens Axboe authored
      There's a bit of confusion on the matching pairs of poll vs double poll,
      depending on if the request is a pure poll (IORING_OP_POLL_ADD) or
      poll driven retry.
      
      Add io_poll_get_double() that returns the double poll waitqueue, if any,
      and io_poll_get_single() that returns the original poll waitqueue. With
      that, remove the argument to io_poll_remove_double().
      
      Finally ensure that wait->private is cleared once the double poll handler
      has run, so that remove knows it's already been seen.
      
      Cc: stable@vger.kernel.org # v5.8
      Reported-by: syzbot+7f617d4a9369028b8a2c@syzkaller.appspotmail.com
      Fixes: 18bceab1 ("io_uring: allow POLL_ADD with double poll_wait() users")
      Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
      d4e7cd36
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-2020-08-14' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux · 713eee84
      Linus Torvalds authored
      Pull more perf tools updates from Arnaldo Carvalho de Melo:
       "Fixes:
         - Fixes for 'perf bench numa'.
      
         - Always memset source before memcpy in 'perf bench mem'.
      
         - Quote CC and CXX for their arguments to fix build in environments
           using those variables to pass more than just the compiler names.
      
         - Fix module symbol processing, addressing regression detected via
           "perf test".
      
         - Allow multiple probes in record+script_probe_vfs_getname.sh 'perf
           test' entry.
      
        Improvements:
         - Add script to autogenerate socket family name id->string table from
           copy of kernel header, used so far in 'perf trace'.
      
         - 'perf ftrace' improvements to provide similar options for this
           utility so that one can go from 'perf record', 'perf trace', etc to
           'perf ftrace' just by changing the name of the subcommand.
      
         - Prefer new "sched:sched_waking" trace event when it exists in 'perf
           sched' post processing.
      
         - Update POWER9 metrics to utilize other metrics.
      
         - Fall back to querying debuginfod if debuginfo not found locally.
      
        Miscellaneous:
         - Sync various kvm headers with kernel sources"
      
      * tag 'perf-tools-2020-08-14' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (40 commits)
        perf ftrace: Make option description initials all capital letters
        perf build-ids: Fall back to debuginfod query if debuginfo not found
        perf bench numa: Remove dead code in parse_nodes_opt()
        perf stat: Update POWER9 metrics to utilize other metrics
        perf ftrace: Add change log
        perf: ftrace: Add set_tracing_options() to set all trace options
        perf ftrace: Add option --tid to filter by thread id
        perf ftrace: Add option -D/--delay to delay tracing
        perf: ftrace: Allow set graph depth by '--graph-opts'
        perf ftrace: Add support for trace option tracing_thresh
        perf ftrace: Add option 'verbose' to show more info for graph tracer
        perf ftrace: Add support for tracing option 'irq-info'
        perf ftrace: Add support for trace option funcgraph-irqs
        perf ftrace: Add support for trace option sleep-time
        perf ftrace: Add support for tracing option 'func_stack_trace'
        perf tools: Add general function to parse sublevel options
        perf ftrace: Add option '--inherit' to trace children processes
        perf ftrace: Show trace column header
        perf ftrace: Add option '-m/--buffer-size' to set per-cpu buffer size
        perf ftrace: Factor out function write_tracing_file_int()
        ...
      713eee84
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 50f6c7db
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "Misc fixes and small updates all around the place:
      
         - Fix mitigation state sysfs output
      
         - Fix an FPU xstate/sxave code assumption bug triggered by
           Architectural LBR support
      
         - Fix Lightning Mountain SoC TSC frequency enumeration bug
      
         - Fix kexec debug output
      
         - Fix kexec memory range assumption bug
      
         - Fix a boundary condition in the crash kernel code
      
         - Optimize porgatory.ro generation a bit
      
         - Enable ACRN guests to use X2APIC mode
      
         - Reduce a __text_poke() IRQs-off critical section for the benefit of
           PREEMPT_RT"
      
      * tag 'x86-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/alternatives: Acquire pte lock with interrupts enabled
        x86/bugs/multihit: Fix mitigation reporting when VMX is not in use
        x86/fpu/xstate: Fix an xstate size check warning with architectural LBRs
        x86/purgatory: Don't generate debug info for purgatory.ro
        x86/tsr: Fix tsc frequency enumeration bug on Lightning Mountain SoC
        kexec_file: Correctly output debugging information for the PT_LOAD ELF header
        kexec: Improve & fix crash_exclude_mem_range() to handle overlapping ranges
        x86/crash: Correct the address boundary of function parameters
        x86/acrn: Remove redundant chars from ACRN signature
        x86/acrn: Allow ACRN guest to use X2APIC mode
      50f6c7db
    • Linus Torvalds's avatar
      Merge tag 'sched-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1195d58f
      Linus Torvalds authored
      Pull scheduler fixes from Ingo Molnar:
       "Two fixes: fix a new tracepoint's output value, and fix the formatting
        of show-state syslog printouts"
      
      * tag 'sched-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/debug: Fix the alignment of the show-state debug output
        sched: Fix use of count for nr_running tracepoint
      1195d58f
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7f5faaaa
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "Misc fixes, an expansion of perf syscall access to CAP_PERFMON
        privileged tools, plus a RAPL HW-enablement for Intel SPR platforms"
      
      * tag 'perf-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/x86/rapl: Add support for Intel SPR platform
        perf/x86/rapl: Support multiple RAPL unit quirks
        perf/x86/rapl: Fix missing psys sysfs attributes
        hw_breakpoint: Remove unused __register_perf_hw_breakpoint() declaration
        kprobes: Remove show_registers() function prototype
        perf/core: Take over CAP_SYS_PTRACE creds to CAP_PERFMON capability
      7f5faaaa
    • Linus Torvalds's avatar
      Merge tag 'locking-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · eb1319af
      Linus Torvalds authored
      Pull locking fixlets from Ingo Molnar:
       "A documentation fix and a 'fallthrough' macro update"
      
      * tag 'locking-urgent-2020-08-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        futex: Convert to use the preferred 'fallthrough' macro
        Documentation/locking/locktypes: Fix a typo
      eb1319af
    • Linus Torvalds's avatar
      Merge tag '9p-for-5.9-rc1' of git://github.com/martinetd/linux · 410520d0
      Linus Torvalds authored
      Pull 9p updates from Dominique Martinet:
      
       - some code cleanup
      
       - a couple of static analysis fixes
      
       - setattr: try to pick a fid associated with the file rather than the
         dentry, which might sometimes matter
      
      * tag '9p-for-5.9-rc1' of git://github.com/martinetd/linux:
        9p: Remove unneeded cast from memory allocation
        9p: remove unused code in 9p
        net/9p: Fix sparse endian warning in trans_fd.c
        9p: Fix memory leak in v9fs_mount
        9p: retrieve fid from file when file instance exist.
      410520d0
    • Linus Torvalds's avatar
      Merge tag '5.9-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6 · f6513bd3
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Three small cifs/smb3 fixes, one for stable fixing mkdir path with
        the 'idsfromsid' mount option"
      
      * tag '5.9-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
        SMB3: Fix mkdir when idsfromsid configured on mount
        cifs: Convert to use the fallthrough macro
        cifs: Fix an error pointer dereference in cifs_mount()
      f6513bd3
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-5.9-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · 37711e5e
      Linus Torvalds authored
      Pull NFS client updates from Trond Myklebust:
       "Stable fixes:
         - pNFS: Don't return layout segments that are being used for I/O
         - pNFS: Don't move layout segments off the active list when being used for I/O
      
        Features:
         - NFS: Add support for user xattrs through the NFSv4.2 protocol
         - NFS: Allow applications to speed up readdir+statx() using AT_STATX_DONT_SYNC
         - NFSv4.0 allow nconnect for v4.0
      
        Bugfixes and cleanups:
         - nfs: ensure correct writeback errors are returned on close()
         - nfs: nfs_file_write() should check for writeback errors
         - nfs: Fix getxattr kernel panic and memory overflow
         - NFS: Fix the pNFS/flexfiles mirrored read failover code
         - SUNRPC: dont update timeout value on connection reset
         - freezer: Add unsafe versions of freezable_schedule_timeout_interruptible for NFS
         - sunrpc: destroy rpc_inode_cachep after unregister_filesystem"
      
      * tag 'nfs-for-5.9-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (32 commits)
        NFS: Fix flexfiles read failover
        fs: nfs: delete repeated words in comments
        rpc_pipefs: convert comma to semicolon
        nfs: Fix getxattr kernel panic and memory overflow
        NFS: Don't return layout segments that are in use
        NFS: Don't move layouts to plh_return_segs list while in use
        NFS: Add layout segment info to pnfs read/write/commit tracepoints
        NFS: Add tracepoints for layouterror and layoutstats.
        NFS: Report the stateid + status in trace_nfs4_layoutreturn_on_close()
        SUNRPC dont update timeout value on connection reset
        nfs: nfs_file_write() should check for writeback errors
        nfs: ensure correct writeback errors are returned on close()
        NFSv4.2: xattr cache: get rid of cache discard work queue
        NFS: remove redundant initialization of variable result
        NFSv4.0 allow nconnect for v4.0
        freezer: Add unsafe versions of freezable_schedule_timeout_interruptible for NFS
        sunrpc: destroy rpc_inode_cachep after unregister_filesystem
        NFSv4.2: add client side xattr caching.
        NFSv4.2: hook in the user extended attribute handlers
        NFSv4.2: add the extended attribute proc functions.
        ...
      37711e5e
    • Linus Torvalds's avatar
      Merge tag 'edac_updates_for_5.9_pt2' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras · 6ffdcde4
      Linus Torvalds authored
      Pull edac fix from Tony Luck:
       "Fix for the ie31200 driver that missed the first pull"
      
      * tag 'edac_updates_for_5.9_pt2' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras:
        EDAC/ie31200: Fallback if host bridge device is already initialized
      6ffdcde4
    • Linus Torvalds's avatar
      Merge tag 'devicetree-fixes-for-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux · b07175dc
      Linus Torvalds authored
      Pull devicetree fixes from Rob Herring:
       "Another round of 'allOf' removals and whitespace clean-ups of schemas"
      
      * tag 'devicetree-fixes-for-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux:
        dt-bindings: Remove more cases of 'allOf' containing a '$ref'
        dt-bindings: Whitespace clean-ups in schema files
      b07175dc
    • Linus Torvalds's avatar
      Merge tag 'acpi-5.9-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 341323fa
      Linus Torvalds authored
      Pull more ACPI updates from Rafael Wysocki:
       "Add new hardware support to the ACPI driver for AMD SoCs, the x86 clk
        driver and the Designware i2c driver (changes from Akshu Agrawal and
        Pu Wen)"
      
      * tag 'acpi-5.9-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        clk: x86: Support RV architecture
        ACPI: APD: Add a fmw property is_raven
        clk: x86: Change name from ST to FCH
        ACPI: APD: Change name from ST to FCH
        i2c: designware: Add device HID for Hygon I2C controller
      341323fa
    • Linus Torvalds's avatar
      Merge tag 'pm-5.9-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · 1a5d9dbb
      Linus Torvalds authored
      Pull one more power management update from Rafael Wysocki:
       "Modify the intel_pstate driver to allow it to work in the passive mode
        with hardware-managed P-states (HWP) enabled"
      
      * tag 'pm-5.9-rc1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        cpufreq: intel_pstate: Implement passive mode with HWP enabled
      1a5d9dbb
    • Linus Torvalds's avatar
      Merge tag 'mfd-next-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd · 884e0d3d
      Linus Torvalds authored
      Pull MFD updates from Lee Jones:
       "Core Frameworks
         - Make better attempt at matching device with the correct OF node
         - Allow batch removal of hierarchical sub-devices
      
        New Drivers
         - Add STM32 Clocksource driver
         - Add support for Khadas System Control Microcontroller
      
        Driver Removal
         - Remove unused driver for TI's SMSC ECE1099
      
        New Device Support
         - Add support for Intel Emmitsburg PCH to Intel LPSS PCI
         - Add support for Intel Tiger Lake PCH-H to Intel LPSS PCI
         - Add support for Dialog DA revision to Dialog DA9063
      
        New Functionality
         - Add support for AXP803 to be probed by I2C
      
        Fix-ups
         - Numerous W=1 warning fixes
         - Device Tree changes (stm32-lptimer, gateworks-gsc, khadas,mcu, stmfx, cros-ec, j721e-system-controller)
         - Enabled Regmap 'fast I/O' in stm32-lptimer
         - Change BUG_ON to WARN_ON in arizona-core
         - Remove superfluous code/initialisation (madera, max14577)
         - Trivial formatting/spelling issues (madera-core, madera-i2c, da9055, max77693-private)
         - Switch to of_platform_populate() in sprd-sc27xx-spi
         - Expand out set/get brightness/pwm macros in lm3533-ctrlbank
         - Disable IRQs on suspend in motorola-cpcap
         - Clean-up error handling in intel_soc_pmic_mrfld
         - Ensure correct removal order of sub-devices in madera
         - Many s/HTTP/HTTPS/ link changes
         - Ensure name used with Regmap is unique in syscon
      
        Bug Fixes
         - Properly 'put' clock on unbind and error in arizona-core
         - Fix revision handling in da9063
         - Fix 'assignment of read-only location' error in kempld-core
         - Avoid using the Regmap API when atomic in rn5t618
         - Redefine volatile register description in rn5t618
         - Use locking to protect event handler in dln2"
      
      * tag 'mfd-next-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (76 commits)
        mfd: syscon: Use a unique name with regmap_config
        mfd: Replace HTTP links with HTTPS ones
        mfd: dln2: Run event handler loop under spinlock
        mfd: madera: Improve handling of regulator unbinding
        mfd: mfd-core: Add mechanism for removal of a subset of children
        mfd: intel_soc_pmic_mrfld: Simplify the return expression of intel_scu_ipc_dev_iowrite8()
        mfd: max14577: Remove redundant initialization of variable current_bits
        mfd: rn5t618: Fix caching of battery related registers
        mfd: max77693-private: Drop a duplicated word
        mfd: da9055: pdata.h: Drop a duplicated word
        mfd: rn5t618: Make restart handler atomic safe
        mfd: kempld-core: Fix 'assignment of read-only location' error
        mfd: axp20x: Allow the AXP803 to be probed by I2C
        mfd: da9063: Add support for latest DA silicon revision
        mfd: da9063: Fix revision handling to correctly select reg tables
        dt-bindings: mfd: st,stmfx: Remove I2C unit name
        dt-bindings: mfd: ti,j721e-system-controller.yaml: Add J721e system controller
        mfd: motorola-cpcap: Disable interrupt for suspend
        mfd: smsc-ece1099: Remove driver
        mfd: core: Add OF_MFD_CELL_REG() helper
        ...
      884e0d3d
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · 18737f42
      Linus Torvalds authored
      Merge more updates from Andrew Morton:
       "Subsystems affected by this patch series: mm/hotfixes, lz4, exec,
        mailmap, mm/thp, autofs, sysctl, mm/kmemleak, mm/misc and lib"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (35 commits)
        virtio: pci: constify ioreadX() iomem argument (as in generic implementation)
        ntb: intel: constify ioreadX() iomem argument (as in generic implementation)
        rtl818x: constify ioreadX() iomem argument (as in generic implementation)
        iomap: constify ioreadX() iomem argument (as in generic implementation)
        sh: use generic strncpy()
        sh: clkfwk: remove r8/r16/r32
        include/asm-generic/vmlinux.lds.h: align ro_after_init
        mm: annotate a data race in page_zonenum()
        mm/swap.c: annotate data races for lru_rotate_pvecs
        mm/rmap: annotate a data race at tlb_flush_batched
        mm/mempool: fix a data race in mempool_free()
        mm/list_lru: fix a data race in list_lru_count_one
        mm/memcontrol: fix a data race in scan count
        mm/page_counter: fix various data races at memsw
        mm/swapfile: fix and annotate various data races
        mm/filemap.c: fix a data race in filemap_fault()
        mm/swap_state: mark various intentional data races
        mm/page_io: mark various intentional data races
        mm/frontswap: mark various intentional data races
        mm/kmemleak: silence KCSAN splats in checksum
        ...
      18737f42
    • Krzysztof Kozlowski's avatar
      virtio: pci: constify ioreadX() iomem argument (as in generic implementation) · fe0580ac
      Krzysztof Kozlowski authored
      The ioreadX() helpers have inconsistent interface.  On some architectures
      void *__iomem address argument is a pointer to const, on some not.
      
      Implementations of ioreadX() do not modify the memory under the address so
      they can be converted to a "const" version for const-safety and
      consistency among architectures.
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Cc: Allen Hubbe <allenbh@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Jon Mason <jdmason@kudzu.us>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: http://lkml.kernel.org/r/20200709072837.5869-5-krzk@kernel.orgSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fe0580ac
    • Krzysztof Kozlowski's avatar
      ntb: intel: constify ioreadX() iomem argument (as in generic implementation) · 58184e95
      Krzysztof Kozlowski authored
      The ioreadX() helpers have inconsistent interface.  On some architectures
      void *__iomem address argument is a pointer to const, on some not.
      
      Implementations of ioreadX() do not modify the memory under the address so
      they can be converted to a "const" version for const-safety and
      consistency among architectures.
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Acked-by: default avatarDave Jiang <dave.jiang@intel.com>
      Cc: Allen Hubbe <allenbh@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Jon Mason <jdmason@kudzu.us>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: http://lkml.kernel.org/r/20200709072837.5869-4-krzk@kernel.orgSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      58184e95
    • Krzysztof Kozlowski's avatar
      rtl818x: constify ioreadX() iomem argument (as in generic implementation) · 5ca6ad7d
      Krzysztof Kozlowski authored
      The ioreadX() helpers have inconsistent interface.  On some architectures
      void *__iomem address argument is a pointer to const, on some not.
      
      Implementations of ioreadX() do not modify the memory under the address so
      they can be converted to a "const" version for const-safety and
      consistency among architectures.
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Acked-by: default avatarKalle Valo <kvalo@codeaurora.org>
      Cc: Allen Hubbe <allenbh@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Cc: Jon Mason <jdmason@kudzu.us>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: http://lkml.kernel.org/r/20200709072837.5869-3-krzk@kernel.orgSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5ca6ad7d
    • Krzysztof Kozlowski's avatar
      iomap: constify ioreadX() iomem argument (as in generic implementation) · 8f28ca6b
      Krzysztof Kozlowski authored
      Patch series "iomap: Constify ioreadX() iomem argument", v3.
      
      The ioread8/16/32() and others have inconsistent interface among the
      architectures: some taking address as const, some not.
      
      It seems there is nothing really stopping all of them to take pointer to
      const.
      
      This patch (of 4):
      
      The ioreadX() and ioreadX_rep() helpers have inconsistent interface.  On
      some architectures void *__iomem address argument is a pointer to const,
      on some not.
      
      Implementations of ioreadX() do not modify the memory under the address so
      they can be converted to a "const" version for const-safety and
      consistency among architectures.
      
      [krzk@kernel.org: sh: clk: fix assignment from incompatible pointer type for ioreadX()]
        Link: http://lkml.kernel.org/r/20200723082017.24053-1-krzk@kernel.org
      [akpm@linux-foundation.org: fix drivers/mailbox/bcm-pdc-mailbox.c]
        Link: http://lkml.kernel.org/r/202007132209.Rxmv4QyS%25lkp@intel.comSuggested-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarKrzysztof Kozlowski <krzk@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Reviewed-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Kalle Valo <kvalo@codeaurora.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Dave Jiang <dave.jiang@intel.com>
      Cc: Jon Mason <jdmason@kudzu.us>
      Cc: Allen Hubbe <allenbh@gmail.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Link: http://lkml.kernel.org/r/20200709072837.5869-1-krzk@kernel.org
      Link: http://lkml.kernel.org/r/20200709072837.5869-2-krzk@kernel.orgSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8f28ca6b
    • Kuninori Morimoto's avatar
      sh: use generic strncpy() · f9e7ff9c
      Kuninori Morimoto authored
      Current SH will get below warning at strncpy()
      
      In file included from ${LINUX}/arch/sh/include/asm/string.h:3,
                       from ${LINUX}/include/linux/string.h:20,
                       from ${LINUX}/include/linux/bitmap.h:9,
                       from ${LINUX}/include/linux/nodemask.h:95,
                       from ${LINUX}/include/linux/mmzone.h:17,
                       from ${LINUX}/include/linux/gfp.h:6,
                       from ${LINUX}/innclude/linux/slab.h:15,
                       from ${LINUX}/linux/drivers/mmc/host/vub300.c:38:
      ${LINUX}/drivers/mmc/host/vub300.c: In function 'new_system_port_status':
      ${LINUX}/arch/sh/include/asm/string_32.h:51:42: warning: array subscript\
        80 is above array bounds of 'char[26]' [-Warray-bounds]
         : "0" (__dest), "1" (__src), "r" (__src+__n)
                                           ~~~~~^~~~
      
      In general, strncpy() should behave like below.
      
      	char dest[10];
      	char *src = "12345";
      
      	strncpy(dest, src, 10);
      	// dest = {'1', '2', '3', '4', '5',
      	           '\0','\0','\0','\0','\0'}
      
      But, current SH strnpy() has 2 issues.
      1st is it will access to out-of-memory (= src + 10).
      2nd is it needs big fixup for it, and maintenance __asm__
      code is difficult.
      
      To solve these issues, this patch simply uses generic strncpy()
      instead of architecture specific one.
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Alan Modra <amodra@gmail.com>
      Cc: Bin Meng <bin.meng@windriver.com>
      Cc: Chen Zhou <chenzhou10@huawei.com>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Romain Naour <romain.naour@gmail.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Link: https://marc.info/?l=linux-renesas-soc&m=157664657013309Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      f9e7ff9c
    • Kuninori Morimoto's avatar
      sh: clkfwk: remove r8/r16/r32 · a8e3943b
      Kuninori Morimoto authored
      SH will get below warning
      
      ${LINUX}/drivers/sh/clk/cpg.c: In function 'r8':
      ${LINUX}/drivers/sh/clk/cpg.c:41:17: warning: passing argument 1 of 'ioread8'
       discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
        return ioread8(addr);
                       ^~~~
      In file included from ${LINUX}/arch/sh/include/asm/io.h:21,
                       from ${LINUX}/include/linux/io.h:13,
                       from ${LINUX}/drivers/sh/clk/cpg.c:14:
      ${LINUX}/include/asm-generic/iomap.h:29:29: note: expected 'void *' but
      argument is of type 'const void *'
       extern unsigned int ioread8(void __iomem *);
                                   ^~~~~~~~~~~~~~
      
      We don't need "const" for r8/r16/r32.  And we don't need r8/r16/r32
      themselvs.  This patch cleanup these.
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Alan Modra <amodra@gmail.com>
      Cc: Bin Meng <bin.meng@windriver.com>
      Cc: Chen Zhou <chenzhou10@huawei.com>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Romain Naour <romain.naour@gmail.com>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      X-MARC-Message: https://marc.info/?l=linux-renesas-soc&m=157852973916903Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a8e3943b
    • Romain Naour's avatar
      include/asm-generic/vmlinux.lds.h: align ro_after_init · 7f897acb
      Romain Naour authored
      Since the patch [1], building the kernel using a toolchain built with
      binutils 2.33.1 prevents booting a sh4 system under Qemu.  Apply the patch
      provided by Alan Modra [2] that fix alignment of rodata.
      
      [1] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ebd2263ba9a9124d93bbc0ece63d7e0fae89b40e
      [2] https://www.sourceware.org/ml/binutils/2019-12/msg00112.htmlSigned-off-by: default avatarRomain Naour <romain.naour@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Alan Modra <amodra@gmail.com>
      Cc: Bin Meng <bin.meng@windriver.com>
      Cc: Chen Zhou <chenzhou10@huawei.com>
      Cc: Geert Uytterhoeven <geert+renesas@glider.be>
      Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Cc: Krzysztof Kozlowski <krzk@kernel.org>
      Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Sam Ravnborg <sam@ravnborg.org>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: <stable@vger.kernel.org>
      Link: https://marc.info/?l=linux-sh&m=158429470221261Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7f897acb
    • Qian Cai's avatar
      mm: annotate a data race in page_zonenum() · c403f6a3
      Qian Cai authored
       BUG: KCSAN: data-race in page_cpupid_xchg_last / put_page
      
       write (marked) to 0xfffffc0d48ec1a00 of 8 bytes by task 91442 on cpu 3:
        page_cpupid_xchg_last+0x51/0x80
        page_cpupid_xchg_last at mm/mmzone.c:109 (discriminator 11)
        wp_page_reuse+0x3e/0xc0
        wp_page_reuse at mm/memory.c:2453
        do_wp_page+0x472/0x7b0
        do_wp_page at mm/memory.c:2798
        __handle_mm_fault+0xcb0/0xd00
        handle_pte_fault at mm/memory.c:4049
        (inlined by) __handle_mm_fault at mm/memory.c:4163
        handle_mm_fault+0xfc/0x2f0
        handle_mm_fault at mm/memory.c:4200
        do_page_fault+0x263/0x6f9
        do_user_addr_fault at arch/x86/mm/fault.c:1465
        (inlined by) do_page_fault at arch/x86/mm/fault.c:1539
        page_fault+0x34/0x40
      
       read to 0xfffffc0d48ec1a00 of 8 bytes by task 94817 on cpu 69:
        put_page+0x15a/0x1f0
        page_zonenum at include/linux/mm.h:923
        (inlined by) is_zone_device_page at include/linux/mm.h:929
        (inlined by) page_is_devmap_managed at include/linux/mm.h:948
        (inlined by) put_page at include/linux/mm.h:1023
        wp_page_copy+0x571/0x930
        wp_page_copy at mm/memory.c:2615
        do_wp_page+0x107/0x7b0
        __handle_mm_fault+0xcb0/0xd00
        handle_mm_fault+0xfc/0x2f0
        do_page_fault+0x263/0x6f9
        page_fault+0x34/0x40
      
       Reported by Kernel Concurrency Sanitizer on:
       CPU: 69 PID: 94817 Comm: systemd-udevd Tainted: G        W  O L 5.5.0-next-20200204+ #6
       Hardware name: HPE ProLiant DL385 Gen10/ProLiant DL385 Gen10, BIOS A40 07/10/2019
      
      A page never changes its zone number. The zone number happens to be
      stored in the same word as other bits which are modified, but the zone
      number bits will never be modified by any other write, so it can accept
      a reload of the zone bits after an intervening write and it don't need
      to use READ_ONCE(). Thus, annotate this data race using
      ASSERT_EXCLUSIVE_BITS() to also assert that there are no concurrent
      writes to it.
      Suggested-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarQian Cai <cai@lca.pw>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: Ira Weiny <ira.weiny@intel.com>
      Cc: Dan Williams <dan.j.williams@intel.com>
      Link: http://lkml.kernel.org/r/1581619089-14472-1-git-send-email-cai@lca.pwSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c403f6a3