1. 07 3月, 2015 22 次提交
  2. 12 2月, 2015 2 次提交
    • M
      oom, PM: make OOM detection in the freezer path raceless · c32b3cbe
      Michal Hocko 提交于
      Commit 5695be14 ("OOM, PM: OOM killed task shouldn't escape PM
      suspend") has left a race window when OOM killer manages to
      note_oom_kill after freeze_processes checks the counter.  The race
      window is quite small and really unlikely and partial solution deemed
      sufficient at the time of submission.
      
      Tejun wasn't happy about this partial solution though and insisted on a
      full solution.  That requires the full OOM and freezer's task freezing
      exclusion, though.  This is done by this patch which introduces oom_sem
      RW lock and turns oom_killer_disable() into a full OOM barrier.
      
      oom_killer_disabled check is moved from the allocation path to the OOM
      level and we take oom_sem for reading for both the check and the whole
      OOM invocation.
      
      oom_killer_disable() takes oom_sem for writing so it waits for all
      currently running OOM killer invocations.  Then it disable all the further
      OOMs by setting oom_killer_disabled and checks for any oom victims.
      Victims are counted via mark_tsk_oom_victim resp.  unmark_oom_victim.  The
      last victim wakes up all waiters enqueued by oom_killer_disable().
      Therefore this function acts as the full OOM barrier.
      
      The page fault path is covered now as well although it was assumed to be
      safe before.  As per Tejun, "We used to have freezing points deep in file
      system code which may be reacheable from page fault." so it would be
      better and more robust to not rely on freezing points here.  Same applies
      to the memcg OOM killer.
      
      out_of_memory tells the caller whether the OOM was allowed to trigger and
      the callers are supposed to handle the situation.  The page allocation
      path simply fails the allocation same as before.  The page fault path will
      retry the fault (more on that later) and Sysrq OOM trigger will simply
      complain to the log.
      
      Normally there wouldn't be any unfrozen user tasks after
      try_to_freeze_tasks so the function will not block. But if there was an
      OOM killer racing with try_to_freeze_tasks and the OOM victim didn't
      finish yet then we have to wait for it. This should complete in a finite
      time, though, because
      
      	- the victim cannot loop in the page fault handler (it would die
      	  on the way out from the exception)
      	- it cannot loop in the page allocator because all the further
      	  allocation would fail and __GFP_NOFAIL allocations are not
      	  acceptable at this stage
      	- it shouldn't be blocked on any locks held by frozen tasks
      	  (try_to_freeze expects lockless context) and kernel threads and
      	  work queues are not frozen yet
      Signed-off-by: NMichal Hocko <mhocko@suse.cz>
      Suggested-by: NTejun Heo <tj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Cong Wang <xiyou.wangcong@gmail.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c32b3cbe
    • M
      sysrq: convert printk to pr_* equivalent · 401e4a7c
      Michal Hocko 提交于
      While touching this area let's convert printk to pr_*.  This also makes
      the printing of continuation lines done properly.
      Signed-off-by: NMichal Hocko <mhocko@suse.cz>
      Acked-by: NTejun Heo <tj@kernel.org>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Cong Wang <xiyou.wangcong@gmail.com>
      Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      401e4a7c
  3. 07 2月, 2015 2 次提交
  4. 04 2月, 2015 2 次提交
  5. 03 2月, 2015 12 次提交
    • M
      serial: samsung: earlycon support depends on CONFIG_SERIAL_SAMSUNG_CONSOLE · c3bda295
      Marek Szyprowski 提交于
      EarlyCon support depends on serial console infrastructure, so the code
      implementing it should depend on CONFIG_SERIAL_SAMSUNG_CONSOLE.
      
      This patch fixes the following build break:
      CC [M]  drivers/tty/serial/samsung.o
      drivers/tty/serial/samsung.c:2468:1: error: expected declaration specifiers or ‘...’ before string constant
      drivers/tty/serial/samsung.c:2468:1: error: expected declaration specifiers or ‘...’ before ‘s3c2410_setup_earlycon’
      drivers/tty/serial/samsung.c:2487:1: error: expected declaration specifiers or ‘...’ before string constant
      drivers/tty/serial/samsung.c:2487:1: error: expected declaration specifiers or ‘...’ before ‘s3c2412_setup_earlycon’
      drivers/tty/serial/samsung.c:2488:1: error: expected declaration specifiers or ‘...’ before string constant
      drivers/tty/serial/samsung.c:2488:1: error: expected declaration specifiers or ‘...’ before ‘s3c2440_setup_earlycon’
      drivers/tty/serial/samsung.c:2489:1: error: expected declaration specifiers or ‘...’ before string constant
      drivers/tty/serial/samsung.c:2489:1: error: expected declaration specifiers or ‘...’ before ‘s3c6400_setup_earlycon’
      drivers/tty/serial/samsung.c:2506:1: error: expected declaration specifiers or ‘...’ before string constant
      drivers/tty/serial/samsung.c:2506:1: error: expected declaration specifiers or ‘...’ before ‘s5pv210_setup_earlycon’
      drivers/tty/serial/samsung.c:2507:1: error: expected declaration specifiers or ‘...’ before string constant
      drivers/tty/serial/samsung.c:2507:1: error: expected declaration specifiers or ‘...’ before ‘exynos4210_setup_earlycon’
      drivers/tty/serial/samsung.c:2468:1: warning: ‘s3c2410_setup_earlycon’ defined but not used [-Wunused-function]
      drivers/tty/serial/samsung.c:2487:1: warning: ‘s3c2412_setup_earlycon’ defined but not used [-Wunused-function]
      drivers/tty/serial/samsung.c:2488:1: warning: ‘s3c2440_setup_earlycon’ defined but not used [-Wunused-function]
      drivers/tty/serial/samsung.c:2489:1: warning: ‘s3c6400_setup_earlycon’ defined but not used [-Wunused-function]
      drivers/tty/serial/samsung.c:2506:1: warning: ‘s5pv210_setup_earlycon’ defined but not used [-Wunused-function]
      drivers/tty/serial/samsung.c:2507:1: warning: ‘exynos4210_setup_earlycon’ defined but not used [-Wunused-function]
      make[3]: *** [drivers/tty/serial/samsung.o] Error 1
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c3bda295
    • K
      tty/serial: serial8250_set_divisor() can be static · eb1527a8
      kbuild test robot 提交于
      drivers/tty/serial/8250/8250_core.c:2503:6: sparse: symbol 'serial8250_set_divisor' was not declared. Should it be static?
      Signed-off-by: NFengguang Wu <fengguang.wu@intel.com>
      Cc: Peter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eb1527a8
    • C
      tty/serial: Add Spreadtrum sc9836-uart driver support · b7396a38
      Chunyan Zhang 提交于
      Add a full sc9836-uart driver for SC9836 SoC which is based on the
      spreadtrum sharkl64 platform.
      This driver also support earlycon.
      Originally-by: NLanqing Liu <lanqing.liu@spreadtrum.com>
      Signed-off-by: NOrson Zhai <orson.zhai@spreadtrum.com>
      Signed-off-by: NChunyan Zhang <chunyan.zhang@spreadtrum.com>
      Acked-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b7396a38
    • R
      serial: samsung: remove redundant interrupt enabling · ba019a3e
      Robert Baldyga 提交于
      Function s3c24xx_serial_start_tx_pio() enables interrupts if needed,
      so we don't have to (or even we shouldn't) enable them before.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ba019a3e
    • P
      tty: Remove external interface for tty_set_termios() · 632f32e2
      Peter Hurley 提交于
      tty_set_termios() is an internal helper intended for file scope use.
      
      UART drivers which are capable of driving the RTS pin must
      properly handle the tiocmset() method, regardless of termios settings.
      A failure to do so is a UART driver bug and should be fixed there.
      Do not use this interface to workaround UART driver bugs.
      
      Cc: Johan Hedberg <johan.hedberg@gmail.com>
      Cc: <linux-bluetooth@vger.kernel.org>
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      632f32e2
    • P
      serial: omap: Fix RTS handling · 348f9bb3
      Peter Hurley 提交于
      The OMAP UART ignores MCR[1] (ie., RTS) when in autoRTS mode. This
      makes it impossible for either the serial core or userspace to
      manually flow control the sender.
      
      Disable autoRTS mode when RTS is lowered and restore the previous
      mode when RTS is raised.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      348f9bb3
    • P
      serial: 8250_omap: Use UPSTAT_AUTORTS for RTS handling · 9719acce
      Peter Hurley 提交于
      Commit 88838d3112702 ("serial: omap_8250: Fix RTS handling") fixed
      RTS pin control when in autoRTS mode.
      
      New support added in "serial: core: Rework hw-assisted flow control support"
      enables a much simpler approach; rather than masking out autoRTS
      whenever writing the EFR register, use the UPSTAT_* mode to determine if
      autoRTS should be enabled when raising RTS (in omap8250_set_mctrl()).
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9719acce
    • P
      serial: core: Rework hw-assisted flow control support · 391f93f2
      Peter Hurley 提交于
      hw-assisted flow control support was added to the serial core
      in v3.8 with commits,
      dba05832 ("SERIAL: core: add hardware assisted h/w flow control support")
      2cbacafd ("SERIAL: core: add hardware assisted s/w flow control support")
      9aba8d5b ("SERIAL: core: add throttle/unthrottle callbacks for hardware
                      assisted flow control")
      Since then, additional requirements for serial core support have arisen.
      Specifically,
      1. Separate tx and rx flow control settings for UARTs which only support
         tx flow control (ie., autoCTS).
      2. Disable sw-assisted CTS flow control in autoCTS mode
      3. Support for RTS flow control by serial core and userspace in autoRTS mode
      
      Distinguish mode from capability; introduce UPSTAT_AUTORTS, UPSTAT_AUTOCTS
      and UPSTAT_AUTOXOFF which, when set by the uart driver, enable serial core
      support for hw-assisted rx, hw-assisted tx and hw-assisted in-band/IXOFF
      rx flow control, respectively. [Note: hw-assisted in-band/IXON tx flow
      control does not require serial core support/intervention and can be
      enabled by the uart driver when required.]
      
      These modes must be set/reset in the driver's set_termios() method, based
      on termios settings, and thus can be safely queried in any context in which
      one of the port lock, port mutex or termios rwsem are held. Set these modes
      in the 2 in-tree drivers, omap-serial and 8250_omap, which currently
      use UPF_HARD_FLOW/UPF_SOFT_FLOW support.
      
      Retain UPF_HARD_FLOW and UPF_SOFT_FLOW as capabilities; re-define
      UPF_HARD_FLOW as both UPF_AUTO_RTS and UPF_AUTO_CTS to allow for distinct
      and separate rx and tx flow control capabilities.
      
      Disable sw-assisted CTS flow control when UPSTAT_AUTOCTS is enabled.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      391f93f2
    • R
      tty/serial: 8250_early: Add support for PXA UARTs · a4c639b0
      Rob Herring 提交于
      The PXA variant of the 8250 UART adds a UART enable bit which must not
      be cleared. Make the earlycon support maintain this bit if it is set.
      This implies some initialization of the UART, but we cannot
      unconditionally set the bit as some other variants require this bit to
      be clear for other functions.
      Signed-off-by: NRob Herring <robh@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: linux-serial@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4c639b0
    • R
      tty/serial: of_serial: add support for PXA/MMP uarts · 6ad991b6
      Rob Herring 提交于
      Add mrvl,pxa-uart and mrvl,mmp-uart compatible strings for the of_serial
      driver. These are 8250 variants which have a port type of PORT_XSCALE.
      
      There is also the serial driver pxa.c with these compatible strings
      already. However, it can be replaced with the common 8250 driver. It has
      some issues like it cannot coexist with the 8250 driver due to tty name
      collision. That also means adding these compatible strings here should
      not case a problem.
      Signed-off-by: NRob Herring <robh@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: linux-serial@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ad991b6
    • R
      tty/serial: of_serial: add DT alias ID handling · 6d01bb9d
      Rob Herring 提交于
      Add support for alias parsing from the DT. This allows for consistent
      tty numbering.
      Signed-off-by: NRob Herring <robh@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: linux-serial@vger.kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6d01bb9d
    • P
      serial: 8250: Prevent concurrent updates to shadow registers · e9cef862
      Peter Hurley 提交于
      The port shadow registers, ->fcr and ->mcr, must be protected from
      concurrent updates. Relocate the shadow register updates in
      serial8250_do_set_termios() to the port lock critical section.
      Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e9cef862