android-sdk/kernel-video.git
6 years agoti_config_fragments/baseport.cfg: explicitly enable DEBUG_FS android-3.14-6AL.1.0
Subramaniam Chanderashekarapuram [Fri, 30 Jan 2015 21:54:32 +0000 (15:54 -0600)]
ti_config_fragments/baseport.cfg: explicitly enable DEBUG_FS

CONFIG_DEBUG_FS gets automatically selected by CONFIG_TRACING. However,
with CONFIG_FTRACE disabled, CONFIG_DEBUG_FS, DEBUG_FS should have
been removed from the final kernel configuration. It is not the case
since defconfig_merge.sh appends config flags added by config fragments
to the end of the omap2plus based generated config options.

In contrast, tools like merge_config.sh (under scripts/kconfig)
take all config and also account for dependencies. Hence disabling
FTRACE causes DEBUG_FS also to be disabled and therefore enabling
DEBUG_FS explicitly.

Change-Id: I97d254fd49665725917af4ea45513a9562acb6d6
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
6 years agoti_config_fragments: android: enable INTERACTIVE governor and set that as default
Subramaniam Chanderashekarapuram [Fri, 6 Feb 2015 19:39:53 +0000 (13:39 -0600)]
ti_config_fragments: android: enable INTERACTIVE governor and set that as default

Enable INTERACTIVE governor and set that as default.

Change-Id: Id476e8c4a99e4cd1253cc18172c8ff8bf7e1d1cd
Signed-off-by: Subramaniam Chanderashekarapuram <subramaniam.ca@ti.com>
6 years agoOMAPDSS: HDMI: Add HPD extcon
Marcus Cooksey [Fri, 5 Dec 2014 21:54:45 +0000 (15:54 -0600)]
OMAPDSS: HDMI: Add HPD extcon

Added support to notify userspace when a HDMI Hotplug (HPD) event
(attach/detached) has occurred through the extcon mechanism.

Change-Id: Ifa92528938ee95864187744f8bb3f2b1592d08e7
Signed-off-by: Marcus Cooksey <mcooksey@ti.com>
Signed-off-by: Misael Lopez Cruz <misael.lopez@ti.com>
6 years agoti_config_fragments: android_build.sh: Add auto.cfg
Praneeth Bajjuri [Thu, 5 Feb 2015 19:28:28 +0000 (13:28 -0600)]
ti_config_fragments: android_build.sh: Add auto.cfg

Auto.cfg contains automotive specific common options which
are not present in foundation .cfg files.

Change-Id: I5b70dcefd624f9396d038f56a8e86d9f9e4bf801
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Praneeth Bajjuri [Thu, 5 Feb 2015 19:27:36 +0000 (13:27 -0600)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common: (31 commits)
  ti_config_fragments: auto: New fragment to hold auto add-on
  ARM: dts: DRA7: Add aliases for all serial ports
  tty: serial: 8250: omap: add ttySx console if the user didn't
  remoteproc/pruss: fix typos in couple of traces
  ARM: dts: am335x-evmsk: fix false pen-ups on touchscreen
  Input: ti_am335x_tsc - read charge delay from DT
  phy: ti-pipe3: Fix SATA across suspend/resume when drive not present
  phy: ti-pipe3: Disable clocks on system suspend
  ARM: dts: beagle-x15: Use tlv320aic3104 compatible mode for audio codec
  ASoC: tlv320aic3x: Fix bad comment before intercon_extra_3104 definition
  ASoC: tlv320aic3x: Add support for tlv320aic3104
  ARM: dts: am57xx-beagle-x15: Change the order of sound cards
  ASoC: tlv320aic3x: Fix data delay configuration
  usb: dwc3: keep a copy of IDDIG status for DRD mode switch
  usb: drd-lib: correct the state checking condition
  Input: palmas-pwrbutton - fix typo in the license string
  input: misc: palmas-pwrbutton: add missing bustype
  ARM: OMAP2+: hwmod: DRA7: fix gmac address space
  ARM: dts: am57xx_beagle_x15: correct pbias regulator name
  ARM: dts: dra7: fix kernel oops when using 8250_omap
  ...

Change-Id: Ie9d09e4107508d99fbf5025df7ae31b336bc4639
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agoti_config_fragments: auto: New fragment to hold auto add-on
Nikhil Devshatwar [Thu, 5 Feb 2015 19:11:00 +0000 (13:11 -0600)]
ti_config_fragments: auto: New fragment to hold auto add-on

auto.cfg is a new fragment to hold auto specific add-on driver
enablement options.

Change-Id: Icb2dcbed95e2dac2b0064e38fd98706561650327
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agoMerge branch 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel...
Praneeth Bajjuri [Thu, 5 Feb 2015 19:04:55 +0000 (13:04 -0600)]
Merge branch 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel into p-ti-linux-3.14.y-common

* 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel: (30 commits)
  ARM: dts: DRA7: Add aliases for all serial ports
  tty: serial: 8250: omap: add ttySx console if the user didn't
  remoteproc/pruss: fix typos in couple of traces
  ARM: dts: am335x-evmsk: fix false pen-ups on touchscreen
  Input: ti_am335x_tsc - read charge delay from DT
  phy: ti-pipe3: Fix SATA across suspend/resume when drive not present
  phy: ti-pipe3: Disable clocks on system suspend
  ARM: dts: beagle-x15: Use tlv320aic3104 compatible mode for audio codec
  ASoC: tlv320aic3x: Fix bad comment before intercon_extra_3104 definition
  ASoC: tlv320aic3x: Add support for tlv320aic3104
  ARM: dts: am57xx-beagle-x15: Change the order of sound cards
  ASoC: tlv320aic3x: Fix data delay configuration
  usb: dwc3: keep a copy of IDDIG status for DRD mode switch
  usb: drd-lib: correct the state checking condition
  Input: palmas-pwrbutton - fix typo in the license string
  input: misc: palmas-pwrbutton: add missing bustype
  ARM: OMAP2+: hwmod: DRA7: fix gmac address space
  ARM: dts: am57xx_beagle_x15: correct pbias regulator name
  ARM: dts: dra7: fix kernel oops when using 8250_omap
  usb: gadget: loopback: don't queue requests to bogus endpoints
  ...

Change-Id: Id36cb52f0378e21fb3b2966570a845d47b5ae53d
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agoMerge branch 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integrat...
Texas Instruments Auto Merger [Thu, 5 Feb 2015 16:20:50 +0000 (10:20 -0600)]
Merge branch 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel into ti-linux-3.14.y

TI-Feature: connectivity
TI-Tree: git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel.git
TI-Branch: connectivity-ti-linux-3.14.y

* 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel:
  ARM: dts: DRA7: Add aliases for all serial ports
  tty: serial: 8250: omap: add ttySx console if the user didn't

Signed-off-by: Texas Instruments Auto Merger <lcpd_integration@list.ti.com>
6 years agoARM: dts: DRA7: Add aliases for all serial ports
Nishanth Menon [Tue, 21 Oct 2014 16:18:15 +0000 (11:18 -0500)]
ARM: dts: DRA7: Add aliases for all serial ports

[ Upstream commit 065bd7fe50de5e6d0fd5034cbc87120a558a1219 ]

Add serial port aliases for consoles > 6.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agotty: serial: 8250: omap: add ttySx console if the user didn't
Sebastian Andrzej Siewior [Thu, 18 Dec 2014 17:47:12 +0000 (18:47 +0100)]
tty: serial: 8250: omap: add ttySx console if the user didn't

[ Upstream commit 00648d0282dcca1da453c0b20d27e24bf901a854 ]

This patch invokes add_preferred_console() with ttyS based on ttyO
arguments if the user didn't specify it on its own. This ensures that
the user will see the kernel booting on his serial console in case he
forgot to update the command line.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Acked-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoMerge branch 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integrat...
Texas Instruments Auto Merger [Thu, 5 Feb 2015 08:21:04 +0000 (02:21 -0600)]
Merge branch 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel into ti-linux-3.14.y

TI-Feature: connectivity
TI-Tree: git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel.git
TI-Branch: connectivity-ti-linux-3.14.y

* 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel:
  ARM: dts: am335x-evmsk: fix false pen-ups on touchscreen
  Input: ti_am335x_tsc - read charge delay from DT

Signed-off-by: Texas Instruments Auto Merger <lcpd_integration@list.ti.com>
6 years agoMerge branch 'rpmsg-ti-linux-3.14.y' of git://git.ti.com/rpmsg/rpmsg into ti-linux...
Texas Instruments Auto Merger [Thu, 5 Feb 2015 03:20:53 +0000 (21:20 -0600)]
Merge branch 'rpmsg-ti-linux-3.14.y' of git://git.ti.com/rpmsg/rpmsg into ti-linux-3.14.y

TI-Feature: rpmsg
TI-Tree: git://git.ti.com/rpmsg/rpmsg.git
TI-Branch: rpmsg-ti-linux-3.14.y

* 'rpmsg-ti-linux-3.14.y' of git://git.ti.com/rpmsg/rpmsg:
  remoteproc/pruss: fix typos in couple of traces
  ARM: dts: AM4372: Correct node addresses for PRU-ICSS1 PRU cores
  remoteproc/pruss: fix the device name for PRU1 on AM33xx

Signed-off-by: Texas Instruments Auto Merger <lcpd_integration@list.ti.com>
6 years agoMerge branch 'rproc-linux-3.14.y' of git://git.ti.com/rpmsg/remoteproc into rpmsg...
Suman Anna [Thu, 5 Feb 2015 02:06:37 +0000 (20:06 -0600)]
Merge branch 'rproc-linux-3.14.y' of git://git.ti.com/rpmsg/remoteproc into rpmsg-ti-linux-3.14.y

Pull in the updated remoteproc feature branch that includes couple
of minor typo fixes in the PRUSS remoteproc driver.

* 'rproc-linux-3.14.y' of git://git.ti.com/rpmsg/remoteproc:
  remoteproc/pruss: fix typos in couple of traces
  ARM: dts: AM4372: Correct node addresses for PRU-ICSS1 PRU cores
  remoteproc/pruss: fix the device name for PRU1 on AM33xx

Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agoremoteproc/pruss: fix typos in couple of traces
Suman Anna [Thu, 5 Feb 2015 01:41:05 +0000 (19:41 -0600)]
remoteproc/pruss: fix typos in couple of traces

Fix the mailbox API name typos in couple of traces.

Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agoMerge branch 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integrat...
Texas Instruments Auto Merger [Wed, 4 Feb 2015 17:22:14 +0000 (11:22 -0600)]
Merge branch 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel into ti-linux-3.14.y

TI-Feature: connectivity
TI-Tree: git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel.git
TI-Branch: connectivity-ti-linux-3.14.y

* 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel:
  phy: ti-pipe3: Fix SATA across suspend/resume when drive not present
  phy: ti-pipe3: Disable clocks on system suspend
  usb: dwc3: keep a copy of IDDIG status for DRD mode switch
  usb: drd-lib: correct the state checking condition
  Input: palmas-pwrbutton - fix typo in the license string
  input: misc: palmas-pwrbutton: add missing bustype
  ARM: OMAP2+: hwmod: DRA7: fix gmac address space
  ARM: dts: am57xx_beagle_x15: correct pbias regulator name

Signed-off-by: Texas Instruments Auto Merger <lcpd_integration@list.ti.com>
6 years agoARM: dts: am335x-evmsk: fix false pen-ups on touchscreen
Franklin S. Cooper Jr [Tue, 3 Feb 2015 22:03:44 +0000 (16:03 -0600)]
ARM: dts: am335x-evmsk: fix false pen-ups on touchscreen

When using the touchscreen, a lot of false touch up events
were being reported.

By increasing the charge delay this problem was no longer seen.
Documentation for ti,charge-delay talks about why it helps in
preventing false pen-ups.

Signed-off-by: Franklin S. Cooper Jr <fcooper@ti.com>
[nsekhar@ti.com: cosmetic fixes to commit text and code]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoInput: ti_am335x_tsc - read charge delay from DT
Vignesh R [Tue, 3 Feb 2015 19:45:34 +0000 (11:45 -0800)]
Input: ti_am335x_tsc - read charge delay from DT

[ Upstream commit bf223612a4cd65d5eb15d6adc8422c7d61ae75dd ]

This patch reads charge delay from tsc DT node and writes to
REG_CHARGEDELAY register. If the charge delay is not specified in DT then
default value of 0x400(CHARGEDLY_OPENDLY) is used.

Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agophy: ti-pipe3: Fix SATA across suspend/resume when drive not present
Roger Quadros [Tue, 16 Dec 2014 12:10:12 +0000 (14:10 +0200)]
phy: ti-pipe3: Fix SATA across suspend/resume when drive not present

Failed test case: Boot without SATA drive connected. Suspend/resume
the board and then connect SATA drive. It fails to enumerate.

Due to Errata i783 "SATA Lockup After SATA DPLL Unlock/Relock"
we can't allow SATA DPLL to be in the unlocked state.
The SATA refclk (sata_ref_clk) is the source of the SATA_DPLL.
Till now this clock was controlled by the AHCI SATA driver and was being
shut off  during system suspend (if the SATA drive was not already attached)
causing the SATA DPLL to be unlocked and so causing errata i783.

To prevent sata_ref_clk from being disabled, we move the control of
this clock from the SATA AHCI driver to the SATA PHY driver and prevent
it from being disabled.

This also fixes the issue of SATA not working on OMAP5/DRA7 when
AHCI platform driver is built as a module.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agophy: ti-pipe3: Disable clocks on system suspend
Roger Quadros [Tue, 16 Dec 2014 12:10:11 +0000 (14:10 +0200)]
phy: ti-pipe3: Disable clocks on system suspend

On system suspend, the runtime_suspend() driver hook doesn't get
called and so the clocks are not disabled in the driver.
This causes the L3INIT_960M_GFCLK and L3INIT_480M_GFCLK to remain
active on the DRA7 platform while in system suspend.

Add suspend/resume hooks to the driver.
In case of pcie-phy, the runtime_suspend hook gets called after
the suspend hook so we introduce a flag phy->enabled to keep
track if our clocks are enabled or not to prevent multiple
enable/disables.

Move enabling/disabling clock code into helper functions.

Reported-by: Nishant Menon <nm@ti.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoMerge branch 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux...
Dan Murphy [Wed, 4 Feb 2015 15:18:42 +0000 (09:18 -0600)]
Merge branch 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree into ti-linux-3.14.y

TI-Feature: audio-display
TI-Tree: git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree.git
TI-Branch: audio-display-ti-linux-3.14.y

* 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree:
  ARM: dts: beagle-x15: Use tlv320aic3104 compatible mode for audio codec
  ASoC: tlv320aic3x: Fix bad comment before intercon_extra_3104 definition
  ASoC: tlv320aic3x: Add support for tlv320aic3104
  ARM: dts: am57xx-beagle-x15: Change the order of sound cards
  ASoC: tlv320aic3x: Fix data delay configuration

Conflicts:
arch/arm/boot/dts/am57xx-beagle-x15.dts

Signed-off-by: Dan Murphy <DMurphy@ti.com>
6 years agoMerge branch 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integrat...
Dan Murphy [Wed, 4 Feb 2015 14:28:28 +0000 (08:28 -0600)]
Merge branch 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel into ti-linux-3.14.y

TI-Feature: connectivity
TI-Tree: git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel.git
TI-Branch: connectivity-ti-linux-3.14.y

* 'connectivity-ti-linux-3.14.y' of git://git.ti.com/connectivity-integration-tree/connectivity-ti-linux-kernel:
  ARM: dts: dra7: fix kernel oops when using 8250_omap
  usb: gadget: loopback: don't queue requests to bogus endpoints
  ti_config_fragments/connectivity.cfg: enable GPIO fan and palmas gpio
  ARM: dts: am57xx-beagle-x15: Add GPIO controlled fan node
  hwmon: (gpio-fan) Add a shutdown handler to poweroff the fans
  hwmon: (gpio-fan) Allow usage of gpio operations that may sleep

Signed-off-by: Dan Murphy <DMurphy@ti.com>
6 years agoMerge branch 'platform-ti-linux-3.14.y' of git://git.ti.com/~rrnayak/ti-linux-kernel...
Dan Murphy [Wed, 4 Feb 2015 13:46:48 +0000 (07:46 -0600)]
Merge branch 'platform-ti-linux-3.14.y' of git://git.ti.com/~rrnayak/ti-linux-kernel/platform-linux-feature-tree into ti-linux-3.14.y

TI-Feature: platform_base
TI-Tree: git://git.ti.com/~rrnayak/ti-linux-kernel/platform-linux-feature-tree.git
TI-Branch: platform-ti-linux-3.14.y

* 'platform-ti-linux-3.14.y' of git://git.ti.com/~rrnayak/ti-linux-kernel/platform-linux-feature-tree:
  ARM: DRA7: hwmod_data: Change locked_class for atl hwmod
  ARM: omap2+: omap_hwmod: Use _nested version of spinlock for oh->_lock
  Revert "ARM: OMAP2+: hwmod: Use spin_lock_irqsave_nested() for locking"
  ARM: dts: dra7: Correct clock tree for sys_32k_ck

Signed-off-by: Dan Murphy <DMurphy@ti.com>
6 years agoARM: dts: beagle-x15: Use tlv320aic3104 compatible mode for audio codec
Jyri Sarha [Fri, 30 Jan 2015 10:02:18 +0000 (12:02 +0200)]
ARM: dts: beagle-x15: Use tlv320aic3104 compatible mode for audio codec

The tlv320aic3x codec driver has been updated with tlv320aic3104
support mode. Make the necessary changes to tlv320aic3104 node for
using the appropriate compatible mode.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoASoC: tlv320aic3x: Fix bad comment before intercon_extra_3104 definition
Jyri Sarha [Wed, 4 Feb 2015 10:08:54 +0000 (12:08 +0200)]
ASoC: tlv320aic3x: Fix bad comment before intercon_extra_3104 definition

The intercon_extra_3104 is obviously for tlv320aic3104.

Reported-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoASoC: tlv320aic3x: Add support for tlv320aic3104
Jyri Sarha [Wed, 28 Jan 2015 17:36:26 +0000 (19:36 +0200)]
ASoC: tlv320aic3x: Add support for tlv320aic3104

Disables GPIO support and LINE2 input and renames Mic3 input to Mic2,
if tlv320aic3104 mode is seleced. Devicetree binding document is
updated accordingly.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoARM: dts: am57xx-beagle-x15: Change the order of sound cards
Peter Ujfalusi [Wed, 28 Jan 2015 13:09:35 +0000 (13:09 +0000)]
ARM: dts: am57xx-beagle-x15: Change the order of sound cards

The order of the audio cards will be:
card0: analog audio McASP <-> tlv320aic3104
card1: HDMI audio

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoASoC: tlv320aic3x: Fix data delay configuration
Peter Ujfalusi [Wed, 4 Feb 2015 15:10:58 +0000 (15:10 +0000)]
ASoC: tlv320aic3x: Fix data delay configuration

In linux-next:
[ upstream commit 0b65ba9981d8fe80fd099f26dd96c60e07729aeb ]

Fix the issue introduced by:
368494093354 ASoC: tlv320aic3x: Add TDM support

The CTRLC register were not receiving the correct delay configuration,
which will corrupt DSP_A audio mode.

Fixes: 368494093354 (ASoC: tlv320aic3x: Add TDM support)
Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agousb: dwc3: keep a copy of IDDIG status for DRD mode switch
Bin Liu [Thu, 15 Jan 2015 21:00:05 +0000 (15:00 -0600)]
usb: dwc3: keep a copy of IDDIG status for DRD mode switch

In some conditions of DRD mode switching transition, for example
plugging in or remove the USB cable slowly, the DWC3 controller can
trigger multiple otg interrupts while the ID status is not changed when
reading the OSTS register bit0.

Then dwc3_otg_thread_interrupt() then will try to stop the hcd or udc
multiple times while processing these OTG events, in which the second
time teardown causes kernel crash since the resource is no longer
available.

Following is an exmaple of crash log, while removing the microA-typeA
adaptor cable triggers the following two interrupts and hangs the kernel.

[   40.010169] dwc3 48390000.usb: OTG thread interrupt, OSTS 0x180f
[   40.020738] xhci-hcd xhci-hcd.0.auto: remove, state 4
[   40.026847] usb usb2: USB disconnect, device number 1
[   40.055775] xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
[   40.067580] xhci-hcd xhci-hcd.0.auto: remove, state 1
[   40.073122] usb usb1: USB disconnect, device number 1
[   40.080046] usb 1-1: USB disconnect, device number 2
[   40.169225] xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
[   40.183931] dwc3 48390000.usb: OTG thread interrupt, OSTS 0x819
[   40.194340] kobject (eb5e4c48): tried to init an initialized object, something is seriously wrong.
[   40.203831] CPU: 0 PID: 1018 Comm: irq/204-dwc3-ot Not tainted 3.14.26-dirty #10
[   40.211653] [<c0015ecc>] (unwind_backtrace) from [<c0012a10>] (show_stack+0x10/0x14)
[   40.219874] [<c0012a10>] (show_stack) from [<c0571244>] (dump_stack+0x78/0x94)
[   40.227556] [<c0571244>] (dump_stack) from [<c02e8e88>] (kobject_init+0x74/0x94)
[   40.235404] [<c02e8e88>] (kobject_init) from [<c036ab18>] (device_initialize+0x20/0xcc)
[   40.243878] [<c036ab18>] (device_initialize) from [<c036bf8c>] (device_register+0xc/0x18)
[   40.252578] [<c036bf8c>] (device_register) from [<c042bcec>] (usb_add_gadget_udc_release+0xbc/0x1ec)
[   40.262276] [<c042bcec>] (usb_add_gadget_udc_release) from [<c042c43c>] (usb_drd_start_udc+0x54/0x9c)
[   40.272056] [<c042c43c>] (usb_drd_start_udc) from [<bf1b3708>] (dwc3_otg_thread_interrupt+0x178/0x198 [dwc3])
[   40.282611] [<bf1b3708>] (dwc3_otg_thread_interrupt [dwc3]) from [<c0095f54>] (irq_thread_fn+0x1c/0x34)
[   40.292584] [<c0095f54>] (irq_thread_fn) from [<c00960e0>] (irq_thread+0x120/0x180)
[   40.300691] [<c00960e0>] (irq_thread) from [<c00650e0>] (kthread+0xc4/0xe0)
[   40.308098] [<c00650e0>] (kthread) from [<c000f068>] (ret_from_fork+0x14/0x2c)

The fix is to add a local copy of iddig in struct dwc3, and dwc3_otg_thread_interrupt()
will not take any action if the iddig is not changed.

Signed-off-by: Bin Liu <b-liu@ti.com>
[nsekhar@ti.com: line over 80 char checkpatch warning fix]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agousb: drd-lib: correct the state checking condition
Bin Liu [Thu, 15 Jan 2015 21:00:04 +0000 (15:00 -0600)]
usb: drd-lib: correct the state checking condition

usb_drd_stop_hcd() should check for DRD_HOST_REGISTERED, not
DRD_HOST_ACTIVE, as other usb_drd_st{art,op}_*() functions do.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoInput: palmas-pwrbutton - fix typo in the license string
Nishanth Menon [Mon, 15 Sep 2014 21:33:37 +0000 (14:33 -0700)]
Input: palmas-pwrbutton - fix typo in the license string

[ Upstream commit 05f7588c3c1641f64af93dc042947bbac35f39f6 ]

Follow the license string convention indicated in include/linux/module.h
(don't capitalize v).

This fixes following randconfig warning:
FATAL: modpost: GPL-incompatible module palmas-pwrbutton.ko uses GPL-only symbol 'platform_driver_unregister'

Fixes: adff5962fdd2 ("Input: introduce palmas-pwrbutton")
Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoinput: misc: palmas-pwrbutton: add missing bustype
Felipe Balbi [Thu, 29 Jan 2015 21:27:32 +0000 (15:27 -0600)]
input: misc: palmas-pwrbutton: add missing bustype

Set bustype to BUS_I2C

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoARM: OMAP2+: hwmod: DRA7: fix gmac address space
Mugunthan V N [Fri, 30 Jan 2015 12:12:32 +0000 (17:42 +0530)]
ARM: OMAP2+: hwmod: DRA7: fix gmac address space

Register target address to be used for gmac is the second device
address space. By default, hwmod picks first address space (0th index)
for register target.

With removal of address space from hwmod and using DT instead, gmac
is getting wrong address space for register target.

Fix it by indicating the address space to be used for register target.

Fixes: 5518f7617b36 ("ARM: OMAP2+: DRA7: hwmod: Add hwmod data for MDIO and CPSW")
[mugunthanvnm@ti.com: based on commit '077c42f75ee3' from mainline]
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoARM: dts: am57xx_beagle_x15: correct pbias regulator name
Grygorii Strashko [Tue, 3 Feb 2015 20:09:29 +0000 (14:09 -0600)]
ARM: dts: am57xx_beagle_x15: correct pbias regulator name

Pbias regulator name specified wrongly, so fix it.

Fixes: a7f89f1f25ce ("ARM: dts: Add am57xx-beagle-x15")
Signed-off-by: Grygorii Strashko <Grygorii.Strashko@linaro.org>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoARM: dts: dra7: fix kernel oops when using 8250_omap
Manish Badarkhe [Thu, 8 Jan 2015 04:44:34 +0000 (10:14 +0530)]
ARM: dts: dra7: fix kernel oops when using 8250_omap

Currently, kernel oops observed after booting up kernel with 8250-omap
serial driver as below:

[    9.297482] /ocp/serial@4806a000: could not get #dma-cells for /ocp/cm_core_aon@4a005000/clocks/mlb_clkin_ck
[    9.307381] ttyS0 - failed to request DMA
[    9.366522] VFS: Mounted root (nfs filesystem) on device 0:14.
[    9.392448] devtmpfs: mounted
[    9.395919] Freeing unused kernel memory: 812K (c0910000 - c09db000)
[    9.560551] Unable to handle kernel NULL pointer dereference at virtual address 00000088
[    9.568682] pgd = ebf94000
[    9.571400] [00000088] *pgd=abf63831, *pte=00000000, *ppte=00000000
[    9.577721] Internal error: Oops: 17 [#1] SMP ARM
[    9.582445] Modules linked in:
[    9.585522] CPU: 0 PID: 1 Comm: init Not tainted 3.14.24-g62deaf4 #2
[    9.591904] task: ecaffb40 ti: ecb00000 task.ti: ecb00000
[    9.597335] PC is at omap_8250_dma_handle_irq+0x6c/0x128
[    9.602675] LR is at serial8250_modem_status+0x1c/0xbc
[    9.607838] pc : [<c03c070c>]    lr : [<c03b96fc>]    psr: 20000193
[    9.607838] sp : ecb01d00  ip : ecb01ce8  fp : ecb01d24
[    9.619369] r10: ebe42bc0  r9 : 00000007  r8 : 00000000
[    9.624616] r7 : 60000193  r6 : 00000060  r5 : 000000c2  r4 : c0ae9d5c
[    9.631172] r3 : 00000000  r2 : 00000002  r1 : fa06a018  r0 : 00000020
[    9.637729] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
[    9.644984] Control: 10c5387d  Table: abf9406a  DAC: 00000015

because 'dma-crossbar-node' reference is missing in current
'dmas' property of serial nodes.
'dmas' property present in serial node should be as below:
dmas = <&dma-controller-node crossbar_req_no  &dma-crossbar-node>

Fix this issue by adding 'dma-crossbar-node' reference in all
serial nodes.

Signed-off-by: Manish Badarkhe <manishvb@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agousb: gadget: loopback: don't queue requests to bogus endpoints
Felipe Balbi [Tue, 6 Jan 2015 17:42:13 +0000 (11:42 -0600)]
usb: gadget: loopback: don't queue requests to bogus endpoints

[ Upstream commit e0857ce58e8658657f5f12fe25272b93cfeb16aa ]

A request allocated from e.g. ep1out cannot
be queued to any other endpoint. This bug has
been in f_loopback at least since mid-2011 and
since nobody has really screamed about it, we're
not backporting to any stable kernels.

Debugged with MUSB since that's the only controller
which complains about this case.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoti_config_fragments/connectivity.cfg: enable GPIO fan and palmas gpio
Nishanth Menon [Wed, 31 Dec 2014 23:07:34 +0000 (17:07 -0600)]
ti_config_fragments/connectivity.cfg: enable GPIO fan and palmas gpio

Enable GPIO fan and palmas gpio for fan control.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoARM: dts: am57xx-beagle-x15: Add GPIO controlled fan node
Nishanth Menon [Wed, 31 Dec 2014 23:07:33 +0000 (17:07 -0600)]
ARM: dts: am57xx-beagle-x15: Add GPIO controlled fan node

TPS gpio now controls a 5v 500mA TL5209 regulator which may be supply
a fan (such as AFB02505HHB) over J1 connector for various purposes.
Provide device tree node to enable the same.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agohwmon: (gpio-fan) Add a shutdown handler to poweroff the fans
Nishanth Menon [Wed, 31 Dec 2014 23:07:32 +0000 (17:07 -0600)]
hwmon: (gpio-fan) Add a shutdown handler to poweroff the fans

[ Upstream commit b95579cd8795442e75c8846fa6eeb4fb442e9d83 ]

Poweroff the fans when shutting down the system. Else,
echo '1' > /sys/class/hwmon/hwmon0/fan1_target; poweroff leaves the
fan running if the System power off does not drive the gpio expander
which might control the fan power supply.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
[nsekhar@ti.com: drop unnecessary conflict information]
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agohwmon: (gpio-fan) Allow usage of gpio operations that may sleep
Nishanth Menon [Wed, 31 Dec 2014 23:07:31 +0000 (17:07 -0600)]
hwmon: (gpio-fan) Allow usage of gpio operations that may sleep

[ Upstream commit  52a95c1185220feb514c8e167bd6033c0da6f576 ]

Certain I2C based GPIO expanders could be used in sleepable context,
this results in:
[  115.890569] ------------[ cut here ]------------
[  115.895422] WARNING: CPU: 0 PID: 1115 at drivers/gpio/gpiolib.c:1370 gpiod_set_raw_value+0x40/0x4c()
[  115.905024] Modules linked in:
[  115.908229] CPU: 0 PID: 1115 Comm: sh Tainted: G        W      3.18.0-rc7-next-20141203-dirty #1
[  115.917461] Hardware name: Generic DRA74X (Flattened Device Tree)
[  115.923876] [<c0015368>] (unwind_backtrace) from [<c00119f4>] (show_stack+0x10/0x14)
[  115.932013] [<c00119f4>] (show_stack) from [<c05b78e8>] (dump_stack+0x78/0x94)
[  115.939594] [<c05b78e8>] (dump_stack) from [<c003de28>] (warn_slowpath_common+0x7c/0xb4)
[  115.948094] [<c003de28>] (warn_slowpath_common) from [<c003de7c>] (warn_slowpath_null+0x1c/0x24)
[  115.957315] [<c003de7c>] (warn_slowpath_null) from [<c03461e8>] (gpiod_set_raw_value+0x40/0x4c)
[  115.966457] [<c03461e8>] (gpiod_set_raw_value) from [<c04866f4>] (set_fan_speed+0x4c/0x64)
[  115.975145] [<c04866f4>] (set_fan_speed) from [<c04868a8>] (set_rpm+0x98/0xac)
[  115.982742] [<c04868a8>] (set_rpm) from [<c039fb4c>] (dev_attr_store+0x18/0x24)
[  115.990426] [<c039fb4c>] (dev_attr_store) from [<c01b0a28>] (sysfs_kf_write+0x4c/0x50)
[  115.998742] [<c01b0a28>] (sysfs_kf_write) from [<c01afe1c>] (kernfs_fop_write+0xbc/0x19c)
[  116.007333] [<c01afe1c>] (kernfs_fop_write) from [<c0148cc4>] (vfs_write+0xb0/0x1a0)
[  116.015461] [<c0148cc4>] (vfs_write) from [<c0148fbc>] (SyS_write+0x44/0x84)
[  116.022881] [<c0148fbc>] (SyS_write) from [<c000e5c0>] (ret_fast_syscall+0x0/0x48)
[  116.030833] ---[ end trace 3a0b636123acab82 ]---

So, switch over to sleepable GPIO operations as there is no mandatory
need for non-sleepable gpio operations in the fan driver.

This allows the fan driver to be used with i2c based gpio expanders such
as palmas_gpio.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
6 years agoARM: DRA7: hwmod_data: Change locked_class for atl hwmod
Peter Ujfalusi [Thu, 29 Jan 2015 14:19:17 +0000 (16:19 +0200)]
ARM: DRA7: hwmod_data: Change locked_class for atl hwmod

The ATL hwmod can be used in nested way when it is selected to be the
functional clock for McASP. For this lockdep validator will trigger false
positive warning.
By assigning separate class to atl locking will sort this out.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
6 years agoARM: omap2+: omap_hwmod: Use _nested version of spinlock for oh->_lock
Peter Ujfalusi [Thu, 29 Jan 2015 14:19:16 +0000 (16:19 +0200)]
ARM: omap2+: omap_hwmod: Use _nested version of spinlock for oh->_lock

Add lockdep_class member to struct omap_hwmod and use this number to
specify the subclass of the given hwmod's lock.
When defining the hwmods the lockdep_level can be initialized to indicate
that this lock might be used in a nested fashion.
DRA7x's ATL hwmod is one example for this since McASP can select ATL clock
as functional clock, which will trigger nested oh->_lock usage. This will
trigger false warning from lockdep validator since it is dealing with
classes and for it all hwmod clocks are the same class.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
6 years agoRevert "ARM: OMAP2+: hwmod: Use spin_lock_irqsave_nested() for locking"
Peter Ujfalusi [Thu, 29 Jan 2015 14:19:15 +0000 (16:19 +0200)]
Revert "ARM: OMAP2+: hwmod: Use spin_lock_irqsave_nested() for locking"

This reverts commit 7dca540329010694ca5f2508bf2359cccabb6228.

Not correct fix, any casted pointer will be bigger than
MAX_LOCKDEP_SUBCLASSES, which is 8

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
6 years agoARM: dts: dra7: Correct clock tree for sys_32k_ck
Keerthy [Mon, 2 Feb 2015 10:28:46 +0000 (15:58 +0530)]
ARM: dts: dra7: Correct clock tree for sys_32k_ck

This is w.r.t J6/J6eco: 32clk is psuedo (erratum i856) - clock source.
Errata i856 for the AM572x (DRA7xx) points out that the 32.768KHz external
crystal is not enabled at power up. Instead the CPU falls back to using
an emulation for the 32KHz clock which is SYSCLK1/610.  SYSCLK1 is usually
20MHz on boards so far (which gives an emulated frequency of 32.786KHz)

Modelling the same in device tree.

Signed-off-by: Keerthy <j-keerthy@ti.com>
6 years agoARM: dts: AM4372: Correct node addresses for PRU-ICSS1 PRU cores
Suman Anna [Tue, 3 Feb 2015 22:09:58 +0000 (16:09 -0600)]
ARM: dts: AM4372: Correct node addresses for PRU-ICSS1 PRU cores

The addresses for the PRU cores in PRU-ICSS on AM437x differs from
that of the corresponding cores on AM33xx family of SoCs. The node
names are incorrectly using the addresses from the AM33xx PRU cores,
even though the reg properties are defined correctly. Fix this typo
in the node addresses.

Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agoremoteproc/pruss: fix the device name for PRU1 on AM33xx
Suman Anna [Tue, 3 Feb 2015 21:37:43 +0000 (15:37 -0600)]
remoteproc/pruss: fix the device name for PRU1 on AM33xx

The device name used in the match data for the PRU1 core
on AM33xx SoCs has been added incorrectly in the patch,
3b0f8768 ("remoteproc/pruss: use match data instead of
platform data for PRUs"). Fix this typo to reflect the
device name properly, so that the PRU1 can be loaded and
booted successfully. Without this fix, the PRU1 probe
fails with the following trace,
"pru-rproc 4a338000.pru1: missing or incomplete PRU-private data"

Reported-by: Alejandro Hernandez <ajhernandez@ti.com>
Fixes: 3b0f8768 ("remoteproc/pruss: use match data instead of platform data for PRUs")
Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Praneeth Bajjuri [Tue, 3 Feb 2015 20:29:32 +0000 (14:29 -0600)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  remoteproc/pruss: fix shutdown for manually booted PRU cores
  remoteproc/pruss: fix the cleanup path in pru_rproc_probe()
  iommu/omap: Fix a sleeping function invocation in atomic context bug
  remoteproc/pruss: use match data instead of platform data for PRUs
  remoteproc/pruss: fix a crash with platform_device_unregister
  iommu/omap: Fix a minor typo in debugfs output

Change-Id: Ic9f05343bab23728c20d6b2f16a516fa4e7ee49e
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agoMerge branch 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel...
Praneeth Bajjuri [Tue, 3 Feb 2015 20:27:36 +0000 (14:27 -0600)]
Merge branch 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel into p-ti-linux-3.14.y-common

* 'ti-linux-3.14.y' of git://git.ti.com/ti-linux-kernel/ti-linux-kernel:
  remoteproc/pruss: fix shutdown for manually booted PRU cores
  remoteproc/pruss: fix the cleanup path in pru_rproc_probe()
  iommu/omap: Fix a sleeping function invocation in atomic context bug
  remoteproc/pruss: use match data instead of platform data for PRUs
  remoteproc/pruss: fix a crash with platform_device_unregister
  iommu/omap: Fix a minor typo in debugfs output

Change-Id: I320e320a4da0b4a44e2eecd60dc4f85b559b3c5b
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Praneeth Bajjuri [Tue, 3 Feb 2015 20:25:00 +0000 (14:25 -0600)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common:
  usb: dwc3: debugfs: dual role switch through debugfs entries
  ARM: DRA7: dts: Add coprocessor nodes for iva
  UAPI: Increasing the max FRAME number to 128.
  gpio: mcp23s08: Set initial direction and value from DT
  firmware: Load VPDMA firmware from kernel
  drivers: power: Introduce TI coprocessor driver

Change-Id: I40081e26ca7b53359f832e76371aaea5b5c08878
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agoMerge branch 'rpmsg-ti-linux-3.14.y' of git://git.ti.com/rpmsg/rpmsg into ti-linux...
Texas Instruments Auto Merger [Tue, 3 Feb 2015 19:24:10 +0000 (13:24 -0600)]
Merge branch 'rpmsg-ti-linux-3.14.y' of git://git.ti.com/rpmsg/rpmsg into ti-linux-3.14.y

TI-Feature: rpmsg
TI-Tree: git://git.ti.com/rpmsg/rpmsg.git
TI-Branch: rpmsg-ti-linux-3.14.y

* 'rpmsg-ti-linux-3.14.y' of git://git.ti.com/rpmsg/rpmsg:
  remoteproc/pruss: fix shutdown for manually booted PRU cores
  remoteproc/pruss: fix the cleanup path in pru_rproc_probe()
  iommu/omap: Fix a sleeping function invocation in atomic context bug
  remoteproc/pruss: use match data instead of platform data for PRUs
  remoteproc/pruss: fix a crash with platform_device_unregister
  iommu/omap: Fix a minor typo in debugfs output

Signed-off-by: Texas Instruments Auto Merger <lcpd_integration@list.ti.com>
6 years agoMerge branch 'rproc-linux-3.14.y' of git://git.ti.com/rpmsg/remoteproc into rpmsg...
Suman Anna [Tue, 3 Feb 2015 17:41:27 +0000 (11:41 -0600)]
Merge branch 'rproc-linux-3.14.y' of git://git.ti.com/rpmsg/remoteproc into rpmsg-ti-linux-3.14.y

Pull in the updated remoteproc feature branch that includes
couple of fixes for the OMAP IOMMU driver.

* 'rproc-linux-3.14.y' of git://git.ti.com/rpmsg/remoteproc:
  iommu/omap: Fix a sleeping function invocation in atomic context bug
  iommu/omap: Fix a minor typo in debugfs output

Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agousb: dwc3: debugfs: dual role switch through debugfs entries
Ravi Babu [Tue, 6 Jan 2015 13:55:16 +0000 (19:25 +0530)]
usb: dwc3: debugfs: dual role switch through debugfs entries

dual role switch through debugfs entries
usage:
1) mount debugfs
# mount -t debugfs debugfs /mnt

2) To switch usb1 to device/host mode
# echo "device" > /mnt/48890000.dwc3/mode
        # echo "host" > /mnt/48890000.dwc3/mode

3) To switch usb2 to device/host mode
        # echo "device" > /mnt/488d0000.dwc3/mode
        # echo "host" > /mnt/488d0000.dwc3/mode

To switch to device mode: make sure previous mode is host.
To switch to host mode: make sure previous mode is device

Change-Id: Ie7f637df45b215b966e9eb17637907a74278aa7e
Signed-off-by: Ravi Babu <ravibabu@ti.com>
6 years agoARM: DRA7: dts: Add coprocessor nodes for iva
Ravikumar Kattekola [Sun, 11 Jan 2015 17:39:05 +0000 (23:09 +0530)]
ARM: DRA7: dts: Add coprocessor nodes for iva

Add coprocessor nodes for IVAHD.
Set initial OPP to OPP_HIGH.

Change-Id: I440ac9ae0fd44d8ba8d6d204d036c6d418aeeba4
Signed-off-by: Ravikumar Kattekola <rk@ti.com>
6 years agoMerge "drivers: power: Introduce TI coprocessor driver" into p-ti-linux-3.14.y-common
A.G. Sriramakrishnan [Tue, 3 Feb 2015 05:12:59 +0000 (23:12 -0600)]
Merge "drivers: power: Introduce TI coprocessor driver" into p-ti-linux-3.14.y-common

6 years agoMerge branch 'rproc-linux-3.14.y' of git://git.ti.com/rpmsg/remoteproc into rpmsg...
Suman Anna [Tue, 3 Feb 2015 01:05:18 +0000 (19:05 -0600)]
Merge branch 'rproc-linux-3.14.y' of git://git.ti.com/rpmsg/remoteproc into rpmsg-ti-linux-3.14.y

Pull in the updated remoteproc feature branch that includes various
bug fixes for the PRUSS remoteproc driver. The fixes are agnostic
of the SoC.

* 'rproc-linux-3.14.y' of git://git.ti.com/rpmsg/remoteproc:
  remoteproc/pruss: fix shutdown for manually booted PRU cores
  remoteproc/pruss: fix the cleanup path in pru_rproc_probe()
  remoteproc/pruss: use match data instead of platform data for PRUs
  remoteproc/pruss: fix a crash with platform_device_unregister

Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agoMerge branch 'iommu-linux-3.14.y' of git://git.ti.com/rpmsg/iommu into rproc-linux...
Suman Anna [Tue, 3 Feb 2015 01:01:09 +0000 (19:01 -0600)]
Merge branch 'iommu-linux-3.14.y' of git://git.ti.com/rpmsg/iommu into rproc-linux-3.14.y

Merge in the updated iommu feature branch into remoteproc tree to
pull in couple of OMAP IOMMU fixes.

* 'iommu-linux-3.14.y' of git://git.ti.com/rpmsg/iommu:
  iommu/omap: Fix a sleeping function invocation in atomic context bug
  iommu/omap: Fix a minor typo in debugfs output

Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agoremoteproc/pruss: fix shutdown for manually booted PRU cores
Suman Anna [Mon, 2 Feb 2015 21:42:51 +0000 (15:42 -0600)]
remoteproc/pruss: fix shutdown for manually booted PRU cores

The remoteproc infrastructure auto-boots the processors that have
support for virtio transports. The remoteproc virtio layer also
handles the shutdown for such remoteproc devices, but not for
processors booted outside the remoteproc virtio layer.

The current PRU remoteproc driver also provides support to manually
boot a PRU processor if there are no virtio devices associated with
the processor (standalone functionality without any communication
with the MPU, usually used in a configuration where one of the PRU
cores is used in a slave-mode and complements the functionality
implemented on the other PRU core). The manual boot is done during
the probe of the PRU rproc driver, but it isn't handling the shutdown
of the PRU processor, so the same has been fixed.

This also fixes an issue with the module reference count of the PRUSS
remoteproc module. The rproc_boot() function holds a reference count
to the module implementing the driver for the corresponding remoteproc
device. The PRUSS remoteproc module implements two platform drivers -
one for the PRUSS subsystem, and the other to deal with the individual
PRU cores, and as such the module reference count module is incremented
for every booted processor, and is decremented properly only when the
corresponding processor is shutdown. Without the fix, the reference
count is never decremented when the PRU rproc device or the parent
PRUSS subsystem device is unbound from their corresponding drivers.

NOTE:
The rmmod of the PRUSS remoteproc module can only succeed when the
PRU/PRUSS devices are unbound from their drivers, if there were any
manually booted PRU cores. Ideally, the boot would have to be
implemented in a different layer to avoid this issue.

Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agoremoteproc/pruss: fix the cleanup path in pru_rproc_probe()
Suman Anna [Mon, 2 Feb 2015 23:08:46 +0000 (17:08 -0600)]
remoteproc/pruss: fix the cleanup path in pru_rproc_probe()

The PRU remoteproc driver can manually boot a processor if
the corresponding firmware doesn't support virtio devices.
However, the current cleanup code doesn't undo the operations
performed by rproc_add() in case the manual boot fails. A
successful rproc_add() requires the corresponding rproc_del()
to be called during cleanup, so fix the same.

Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agoUAPI: Increasing the max FRAME number to 128.
Somnath Mukherjee [Mon, 24 Mar 2014 15:34:56 +0000 (21:04 +0530)]
UAPI: Increasing the max FRAME number to 128.

This is required because on TI SoC, the IVA_HD can consume as many as
32 buffers for some H.264 streams. And each buffer can contain plane/field
data as Y-top, Y-bottom, UV-top and UV-bottom. Each field will be treated
as a separate FRAME.

Change-Id: Ibc004ad6f5c7c92a13cd060a7242a8edaa6b55e3
Signed-off-by: Somnath Mukherjee <somnath@ti.com>
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
6 years agogpio: mcp23s08: Set initial direction and value from DT
Nikhil Devshatwar [Mon, 8 Dec 2014 13:51:56 +0000 (19:21 +0530)]
gpio: mcp23s08: Set initial direction and value from DT

GPIO framework does not allow to set a set of gpios is one shot.
Even the gpio_request_array iterates over each entry and sets up gpio
lines one by one.

For some devices (e.g. FPDlink deserializer), if the gpios are used as
to drive some of the control pins, each combination of the control
pins define a specific behavior, some other combination may lead to
inconsistent state, so it is needed to set all of the gpio pins in one shot.

This can be achieved by reading the initial directions and values
from device tree. Add support for reading the device tree properties
and initialize the gpio pins as specified by the DT.

Change-Id: I54d01396dc1b345c9423e3f1976e3cc14d1e6b6e
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
6 years agofirmware: Load VPDMA firmware from kernel
Nikhil Devshatwar [Tue, 11 Nov 2014 11:25:12 +0000 (16:55 +0530)]
firmware: Load VPDMA firmware from kernel

Created a Kconfig option to load the VPDMA firmware from kernel itself.
When enabled, VIP and VPE modules need not wai for user space to
load the VPDMA firmware
This will help in early initialization of VIP/VPE in bootup sequence.

Change-Id: Id716cb22decf0d5690dac12a5ea2888e29dc0ebd
Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
6 years agoMerge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android
Praneeth Bajjuri [Mon, 2 Feb 2015 19:57:00 +0000 (13:57 -0600)]
Merge branch 'p-ti-linux-3.14.y-common' into p-ti-linux-3.14.y-android

* p-ti-linux-3.14.y-common: (97 commits)
  media: ti-vpe: vpe: Add RGB565 and RGB5551 support
  media: ti-vpe: vpe: Post next descriptor only for list complete IRQ
  media: ti-vpe: vpe: Setup srcdst parameters in streamON
  omapdrm: Expose the OMAP pre-multiplied alpha property through DRM
  omapdrm: Expose the OMAP global alpha property through DRM
  ti_fragments: audio_display: enable BACKLIGHT_GPIO and PANEL_DPI
  ti_fragments: audio_display: clean up
  arm/dts: am57xx-evm: Add LCD support
  backlight: gpio-backlight: Add DT support
  arm/dts: dra7xx: fix display compatible strings
  OMAPDSS: add missing 'omapdss' prefixes to display drivers
  OMAPDSS: add dra7-dss to dt conversion list
  Linux 3.14.31
  md/raid5: fetch_block must fetch all the blocks handle_stripe_dirtying wants.
  mm: get rid of radix tree gfp mask for pagecache_get_page
  mm: page_alloc: reduce cost of the fair zone allocation policy
  mm: page_alloc: abort fair zone allocation policy when remotes nodes are encountered
  mm: vmscan: only update per-cpu thresholds for online CPU
  mm: move zone->pages_scanned into a vmstat counter
  mm: rearrange zone fields into read-only, page alloc, statistics and page reclaim lines
  ...

Change-Id: Ib0c33383880f80ba4468e919de46bbeaf42b1bd5
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agoMerge branch 'p-ti-linux-3.14.y-common/audio-for-next' of git://git.ti.com/android...
Praneeth Bajjuri [Mon, 2 Feb 2015 17:20:52 +0000 (11:20 -0600)]
Merge branch 'p-ti-linux-3.14.y-common/audio-for-next' of git://git.ti.com/android-sdk/kernel-audio into p-ti-linux-3.14.y-common

* 'p-ti-linux-3.14.y-common/audio-for-next' of git://git.ti.com/android-sdk/kernel-audio:
  ARM: dts: dra72-evm: Add reserved memory node for radio
  ARM: dts: dra7-evm: Add reserved memory node for radio

Change-Id: Iedddbcbf1881681a272e48c7ba27dd322d79cb1d
Signed-off-by: Praneeth Bajjuri <praneeth@ti.com>
6 years agoMerge branch 'ti-linux-3.14.y' into p-ti-linux-3.14.y-common
Anand Balagopalakrishnan [Mon, 2 Feb 2015 07:39:43 +0000 (13:09 +0530)]
Merge branch 'ti-linux-3.14.y' into p-ti-linux-3.14.y-common

6 years agoiommu/omap: Fix a sleeping function invocation in atomic context bug
Suman Anna [Fri, 30 Jan 2015 20:34:05 +0000 (14:34 -0600)]
iommu/omap: Fix a sleeping function invocation in atomic context bug

The kzalloc function in the omap_iommu_attach_init() function is
invoked with GFP_KERNEL flag, but the function is called with a
spinlock held (atomic context). This throws up the following warning
with CONFIG_DEBUG_ATOMIC_SLEEP enabled:

 remoteproc0: powering up 58820000.ipu
 remoteproc0: Booting fw image dra7-ipu1-fw.xem4, size 6115639
 BUG: sleeping function called from invalid context at mm/slab.c:2967
 in_atomic(): 1, irqs_disabled(): 0, pid: 65, name: kworker/0:1
 CPU: 0 PID: 65 Comm: kworker/0:1 Not tainted 3.14.30-00284-g46d15f7 #11
 Workqueue: events request_firmware_work_func
 Backtrace:
 [<c0012110>] (dump_backtrace) from [<c00122ac>] (show_stack+0x18/0x1c)
 r6:000080d0 r5:c0900e00 r4:00000000 r3:ec21a000
 [<c0012294>] (show_stack) from [<c0612974>] (dump_stack+0x84/0xb8)
 [<c06128f0>] (dump_stack) from [<c0061ea0>] (__might_sleep+0xcc/0xf8)
 r4:ec21a000 r3:40000013
 [<c0061dd4>] (__might_sleep) from [<c00ef888>] (__kmalloc+0xe4/0x124)
 r5:ec000080 r4:000080d0
 [<c00ef7a4>] (__kmalloc) from [<c0506164>] (omap_iommu_attach_dev+0xd0/0x3e0)
 r7:ec6f6800 r6:eb400994 r5:00000000 r4:ec25ad40
 [<c0506094>] (omap_iommu_attach_dev) from [<c0503f84>] (iommu_attach_device+0x20/0x2c)
 r10:ec247810 r9:eb40098c r8:ec6f6840 r7:eb400828 r6:eb400994 r5:00000000
 r4:eb400800
 [<c0503f64>] (iommu_attach_device) from [<c0509ff8>] (rproc_boot+0x27c/0x4d4)
 [<c0509d7c>] (rproc_boot) from [<c050ad84>] (rproc_virtio_find_vqs+0x1a8/0x204)
 r10:eb16e410 r9:bf001908 r8:ec21bca0 r7:ec21bc8c r6:ec21bc94 r5:ec21bc9c
 r4:00000002
 ....
 ....
 [<c0059e0c>] (kthread) from [<c000eb18>] (ret_from_fork+0x14/0x3c)
 r7:00000000 r6:00000000 r5:c0059e0c r4:ec1ecf40
 omap-iommu 58882000.mmu: 58882000.mmu: version 2.1
 remoteproc0: remote processor 58820000.ipu is now up

Fix the same by using the appropriate GFP_ATOMIC flag. Note that
the fix does not convert the spinlock into a mutex, even though the
attach is done usually in a process context. This is done to keep the
IOMMU API generic and allow them to be called from any context.

Fixes: 6636390de ("iommu/omap: add support to program multiple iommus")
Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
6 years agoMerge branch 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux...
Dan Murphy [Fri, 30 Jan 2015 14:41:06 +0000 (08:41 -0600)]
Merge branch 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree into ti-linux-3.14.y

TI-Feature: audio-display
TI-Tree: git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree.git
TI-Branch: audio-display-ti-linux-3.14.y

* 'audio-display-ti-linux-3.14.y' of git://git.ti.com/~darrene/ti-linux-kernel/audio-display-linux-feature-tree:
  media: ti-vpe: vpe: Add RGB565 and RGB5551 support
  media: ti-vpe: vpe: Post next descriptor only for list complete IRQ
  media: ti-vpe: vpe: Setup srcdst parameters in streamON
  omapdrm: Expose the OMAP pre-multiplied alpha property through DRM
  omapdrm: Expose the OMAP global alpha property through DRM
  ti_fragments: audio_display: enable BACKLIGHT_GPIO and PANEL_DPI
  ti_fragments: audio_display: clean up
  arm/dts: am57xx-evm: Add LCD support
  backlight: gpio-backlight: Add DT support
  arm/dts: dra7xx: fix display compatible strings
  OMAPDSS: add missing 'omapdss' prefixes to display drivers
  OMAPDSS: add dra7-dss to dt conversion list

Signed-off-by: Dan Murphy <DMurphy@ti.com>
6 years agomedia: ti-vpe: vpe: Add RGB565 and RGB5551 support
Nikhil Devshatwar [Thu, 15 Jan 2015 08:06:38 +0000 (13:36 +0530)]
media: ti-vpe: vpe: Add RGB565 and RGB5551 support

VPE hardware can generate output in RGB565 or in RGB5551 format.
Add these formats in the supprorted format list for CAPTURE stream.
Also, for RGB5551 format, the alpha component is not processed,
so the alpha value is taken from the default color.
Set the default color to make alpha component full when the dst
format is of RGB colorspace.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agomedia: ti-vpe: vpe: Post next descriptor only for list complete IRQ
Nikhil Devshatwar [Thu, 15 Jan 2015 08:06:37 +0000 (13:36 +0530)]
media: ti-vpe: vpe: Post next descriptor only for list complete IRQ

vpe_irq checks for the possible interrupt sources and prints the
errors for the DEI_ERROR and DS_UV interrupts. But it also post the
next descriptor list irrespective of whichever interrupt has occured.

Because of this, driver may release the buffers even before DMA is complete
and also schedule next descriptor list.

Fix this by _actually_ handling the IRQ only when ListComplete IRQ occurs.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agomedia: ti-vpe: vpe: Setup srcdst parameters in streamON
Nikhil Devshatwar [Thu, 15 Jan 2015 08:06:36 +0000 (13:36 +0530)]
media: ti-vpe: vpe: Setup srcdst parameters in streamON

For deinterlacing operation, each operation needs 2 fields in the history.
This is achieved by holding three buffers in ctx->src_vbs[0,1,2] (f,f-1,f-2)

This is achieved by using the ctx->sequence which gets reset via the s_fmt ioctl.

These buffers are dequeded in stream OFF by calling free_vbs()
But the corresponding references aren't removed anywhere.

When application tries to stream ON and OFF continuously, s_fmt ioctl won't
be called and it won't setup the srcdst parameters.

Setting source/destination parameters in stream ON ioctl would make sure that
the context is re-initialized before it is being used by the driver.

Signed-off-by: Nikhil Devshatwar <nikhil.nd@ti.com>
Acked-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoomapdrm: Expose the OMAP pre-multiplied alpha property through DRM
alaganraj [Wed, 7 Jan 2015 07:05:43 +0000 (12:35 +0530)]
omapdrm: Expose the OMAP pre-multiplied alpha property through DRM

Added support for pre-multiplied alpha changes through DRM plane properties

Signed-off-by: alaganraj <alaganraj.s@ti.com>
[Reworked and made the pre_mult_alpha an enum property]
Signed-off-by: Somnath Mukherjee <somnath@ti.com>
[tomi.valkeinen@ti.com: removed unneeded enum]
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoomapdrm: Expose the OMAP global alpha property through DRM
alaganraj [Wed, 7 Jan 2015 07:05:42 +0000 (12:35 +0530)]
omapdrm: Expose the OMAP global alpha property through DRM

Added support for global alpha changes through DRM plane properties

Signed-off-by: alaganraj <alaganraj.s@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoti_fragments: audio_display: enable BACKLIGHT_GPIO and PANEL_DPI
Tomi Valkeinen [Tue, 13 Jan 2015 07:44:27 +0000 (09:44 +0200)]
ti_fragments: audio_display: enable BACKLIGHT_GPIO and PANEL_DPI

Set BACKLIGHT_GPIO and DISPLAY_PANEL_DPI as built-in for AM57xx-EVM.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoti_fragments: audio_display: clean up
Tomi Valkeinen [Tue, 13 Jan 2015 07:43:20 +0000 (09:43 +0200)]
ti_fragments: audio_display: clean up

audio_display.cfg contains some config options that are selected
automatically by the kconfig, and thus are not needed in the
audio_display.cfg. This patch removes those.

While at it, reorder the lines a bit to group options properly.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoarm/dts: am57xx-evm: Add LCD support
Tomi Valkeinen [Fri, 5 Dec 2014 11:20:39 +0000 (13:20 +0200)]
arm/dts: am57xx-evm: Add LCD support

Add LCD support to am57xx-evm.dts. The LCD is OSD Displays
OSD070T1718-19TS, a 800x480 panel with touch screen.

This patch does not add the touch screen part, only display.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agobacklight: gpio-backlight: Add DT support
Denis Carikli [Thu, 27 Feb 2014 14:28:33 +0000 (15:28 +0100)]
backlight: gpio-backlight: Add DT support

[ upstream commit 9a6adb339e5d1827da5e8b2459b12863d72ed3e7 ]

Signed-off-by: Denis Carikli <denis@eukrea.com>
Acked-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoarm/dts: dra7xx: fix display compatible strings
Tomi Valkeinen [Fri, 9 Jan 2015 11:38:13 +0000 (13:38 +0200)]
arm/dts: dra7xx: fix display compatible strings

The display nodes are not supposed to have 'omapdss,' prefix. Remove
them.

This has not caused any problems, as the dss driver prefixes the
compatible string dynamically with 'omapdss,', so in this case the
prefixing was done manually in the .dts file, instead of by the dss
driver.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoOMAPDSS: add missing 'omapdss' prefixes to display drivers
Tomi Valkeinen [Fri, 9 Jan 2015 12:28:44 +0000 (14:28 +0200)]
OMAPDSS: add missing 'omapdss' prefixes to display drivers

OMAP's display driver's compatible strings need 'omapdss' prefix, which
was missing for some drivers. Add the prefix.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoOMAPDSS: add dra7-dss to dt conversion list
Tomi Valkeinen [Fri, 9 Jan 2015 11:36:25 +0000 (13:36 +0200)]
OMAPDSS: add dra7-dss to dt conversion list

Add 'ti,dra7-dss' compatible string to DSS's boot init system.

Without this, the display driver's compatible string matching does not
work properly.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tested-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Jyri Sarha <jsarha@ti.com>
6 years agoMerge tag 'v3.14.31' of http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux...
Texas Instruments Auto Merger [Fri, 30 Jan 2015 02:12:15 +0000 (20:12 -0600)]
Merge tag 'v3.14.31' of git./linux/kernel/git/stable/linux-stable into ti-linux-3.14.y

This is the 3.14.31 stable release

* tag 'v3.14.31' of http://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable: (77 commits)
  Linux 3.14.31
  md/raid5: fetch_block must fetch all the blocks handle_stripe_dirtying wants.
  mm: get rid of radix tree gfp mask for pagecache_get_page
  mm: page_alloc: reduce cost of the fair zone allocation policy
  mm: page_alloc: abort fair zone allocation policy when remotes nodes are encountered
  mm: vmscan: only update per-cpu thresholds for online CPU
  mm: move zone->pages_scanned into a vmstat counter
  mm: rearrange zone fields into read-only, page alloc, statistics and page reclaim lines
  mm: pagemap: avoid unnecessary overhead when tracepoints are deactivated
  memcg, vmscan: Fix forced scan of anonymous pages
  vmalloc: use rcu list iterator to reduce vmap_area_lock contention
  mm: make copy_pte_range static again
  mm, thp: only collapse hugepages to nodes with affinity for zone_reclaim_mode
  mm/memory.c: use entry = ACCESS_ONCE(*pte) in handle_pte_fault()
  shmem: fix init_page_accessed use to stop !PageLRU bug
  mm: avoid unnecessary atomic operations during end_page_writeback()
  mm: non-atomically mark page accessed during page cache allocation where possible
  fs: buffer: do not use unnecessary atomic operations when discarding buffers
  mm: do not use unnecessary atomic operations when adding pages to the LRU
  mm: do not use atomic operations when releasing pages
  ...

Signed-off-by: Texas Instruments Auto Merger <lcpd_integration@list.ti.com>
6 years agoLinux 3.14.31
Greg Kroah-Hartman [Fri, 30 Jan 2015 01:41:44 +0000 (17:41 -0800)]
Linux 3.14.31

6 years agomd/raid5: fetch_block must fetch all the blocks handle_stripe_dirtying wants.
NeilBrown [Wed, 3 Dec 2014 05:07:58 +0000 (16:07 +1100)]
md/raid5: fetch_block must fetch all the blocks handle_stripe_dirtying wants.

commit 108cef3aa41669610e1836fe638812dd067d72de upstream.

It is critical that fetch_block() and handle_stripe_dirtying()
are consistent in their analysis of what needs to be loaded.
Otherwise raid5 can wait forever for a block that won't be loaded.

Currently when writing to a RAID5 that is resyncing, to a location
beyond the resync offset, handle_stripe_dirtying chooses a
reconstruct-write cycle, but fetch_block() assumes a
read-modify-write, and a lockup can happen.

So treat that case just like RAID6, just as we do in
handle_stripe_dirtying.  RAID6 always does reconstruct-write.

This bug was introduced when the behaviour of handle_stripe_dirtying
was changed in 3.7, so the patch is suitable for any kernel since,
though it will need careful merging for some versions.

Cc: stable@vger.kernel.org (v3.7+)
Fixes: a7854487cd7128a30a7f4f5259de9f67d5efb95f
Reported-by: Henry Cai <henryplusplus@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: get rid of radix tree gfp mask for pagecache_get_page
Michal Hocko [Mon, 29 Dec 2014 19:30:35 +0000 (20:30 +0100)]
mm: get rid of radix tree gfp mask for pagecache_get_page

commit 45f87de57f8fad59302fd263dd81ffa4843b5b24 upstream.

Commit 2457aec63745 ("mm: non-atomically mark page accessed during page
cache allocation where possible") has added a separate parameter for
specifying gfp mask for radix tree allocations.

Not only this is less than optimal from the API point of view because it
is error prone, it is also buggy currently because
grab_cache_page_write_begin is using GFP_KERNEL for radix tree and if
fgp_flags doesn't contain FGP_NOFS (mostly controlled by fs by
AOP_FLAG_NOFS flag) but the mapping_gfp_mask has __GFP_FS cleared then
the radix tree allocation wouldn't obey the restriction and might
recurse into filesystem and cause deadlocks.  This is the case for most
filesystems unfortunately because only ext4 and gfs2 are using
AOP_FLAG_NOFS.

Let's simply remove radix_gfp_mask parameter because the allocation
context is same for both page cache and for the radix tree.  Just make
sure that the radix tree gets only the sane subset of the mask (e.g.  do
not pass __GFP_WRITE).

Long term it is more preferable to convert remaining users of
AOP_FLAG_NOFS to use mapping_gfp_mask instead and simplify this
interface even further.

Reported-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: page_alloc: reduce cost of the fair zone allocation policy
Mel Gorman [Thu, 28 Aug 2014 18:35:45 +0000 (19:35 +0100)]
mm: page_alloc: reduce cost of the fair zone allocation policy

commit 4ffeaf3560a52b4a69cc7909873d08c0ef5909d4 upstream.

The fair zone allocation policy round-robins allocations between zones
within a node to avoid age inversion problems during reclaim.  If the
first allocation fails, the batch counts are reset and a second attempt
made before entering the slow path.

One assumption made with this scheme is that batches expire at roughly
the same time and the resets each time are justified.  This assumption
does not hold when zones reach their low watermark as the batches will
be consumed at uneven rates.  Allocation failure due to watermark
depletion result in additional zonelist scans for the reset and another
watermark check before hitting the slowpath.

On UMA, the benefit is negligible -- around 0.25%.  On 4-socket NUMA
machine it's variable due to the variability of measuring overhead with
the vmstat changes.  The system CPU overhead comparison looks like

          3.16.0-rc3  3.16.0-rc3  3.16.0-rc3
             vanilla   vmstat-v5 lowercost-v5
User          746.94      774.56      802.00
System      65336.22    32847.27    40852.33
Elapsed     27553.52    27415.04    27368.46

However it is worth noting that the overall benchmark still completed
faster and intuitively it makes sense to take as few passes as possible
through the zonelists.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: page_alloc: abort fair zone allocation policy when remotes nodes are encountered
Mel Gorman [Thu, 28 Aug 2014 18:35:44 +0000 (19:35 +0100)]
mm: page_alloc: abort fair zone allocation policy when remotes nodes are encountered

commit f7b5d647946aae1647bf5cd26c16b3a793c1ac49 upstream.

The purpose of numa_zonelist_order=zone is to preserve lower zones for
use with 32-bit devices.  If locality is preferred then the
numa_zonelist_order=node policy should be used.

Unfortunately, the fair zone allocation policy overrides this by
skipping zones on remote nodes until the lower one is found.  While this
makes sense from a page aging and performance perspective, it breaks the
expected zonelist policy.  This patch restores the expected behaviour
for zone-list ordering.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: vmscan: only update per-cpu thresholds for online CPU
Mel Gorman [Wed, 6 Aug 2014 23:07:18 +0000 (16:07 -0700)]
mm: vmscan: only update per-cpu thresholds for online CPU

commit bb0b6dffa2ccfbd9747ad0cc87c7459622896e60 upstream.

When kswapd is awake reclaiming, the per-cpu stat thresholds are lowered
to get more accurate counts to avoid breaching watermarks.  This
threshold update iterates over all possible CPUs which is unnecessary.
Only online CPUs need to be updated.  If a new CPU is onlined,
refresh_zone_stat_thresholds() will set the thresholds correctly.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: move zone->pages_scanned into a vmstat counter
Mel Gorman [Wed, 6 Aug 2014 23:07:16 +0000 (16:07 -0700)]
mm: move zone->pages_scanned into a vmstat counter

commit 0d5d823ab4e608ec7b52ac4410de4cb74bbe0edd upstream.

zone->pages_scanned is a write-intensive cache line during page reclaim
and it's also updated during page free.  Move the counter into vmstat to
take advantage of the per-cpu updates and do not update it in the free
paths unless necessary.

On a small UMA machine running tiobench the difference is marginal.  On
a 4-node machine the overhead is more noticable.  Note that automatic
NUMA balancing was disabled for this test as otherwise the system CPU
overhead is unpredictable.

          3.16.0-rc3  3.16.0-rc3  3.16.0-rc3
             vanillarearrange-v5   vmstat-v5
User          746.94      759.78      774.56
System      65336.22    58350.98    32847.27
Elapsed     27553.52    27282.02    27415.04

Note that the overhead reduction will vary depending on where exactly
pages are allocated and freed.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: rearrange zone fields into read-only, page alloc, statistics and page reclaim...
Mel Gorman [Wed, 6 Aug 2014 23:07:14 +0000 (16:07 -0700)]
mm: rearrange zone fields into read-only, page alloc, statistics and page reclaim lines

commit 3484b2de9499df23c4604a513b36f96326ae81ad upstream.

The arrangement of struct zone has changed over time and now it has
reached the point where there is some inappropriate sharing going on.
On x86-64 for example

o The zone->node field is shared with the zone lock and zone->node is
  accessed frequently from the page allocator due to the fair zone
  allocation policy.

o span_seqlock is almost never used by shares a line with free_area

o Some zone statistics share a cache line with the LRU lock so
  reclaim-intensive and allocator-intensive workloads can bounce the cache
  line on a stat update

This patch rearranges struct zone to put read-only and read-mostly
fields together and then splits the page allocator intensive fields, the
zone statistics and the page reclaim intensive fields into their own
cache lines.  Note that the type of lowmem_reserve changes due to the
watermark calculations being signed and avoiding a signed/unsigned
conversion there.

On the test configuration I used the overall size of struct zone shrunk
by one cache line.  On smaller machines, this is not likely to be
noticable.  However, on a 4-node NUMA machine running tiobench the
system CPU overhead is reduced by this patch.

          3.16.0-rc3  3.16.0-rc3
             vanillarearrange-v5r9
User          746.94      759.78
System      65336.22    58350.98
Elapsed     27553.52    27282.02

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: pagemap: avoid unnecessary overhead when tracepoints are deactivated
Mel Gorman [Wed, 6 Aug 2014 23:07:11 +0000 (16:07 -0700)]
mm: pagemap: avoid unnecessary overhead when tracepoints are deactivated

commit 24b7e5819ad5cbef2b7c7376510862aa8319d240 upstream.

This was formerly the series "Improve sequential read throughput" which
noted some major differences in performance of tiobench since 3.0.
While there are a number of factors, two that dominated were the
introduction of the fair zone allocation policy and changes to CFQ.

The behaviour of fair zone allocation policy makes more sense than
tiobench as a benchmark and CFQ defaults were not changed due to
insufficient benchmarking.

This series is what's left.  It's one functional fix to the fair zone
allocation policy when used on NUMA machines and a reduction of overhead
in general.  tiobench was used for the comparison despite its flaws as
an IO benchmark as in this case we are primarily interested in the
overhead of page allocator and page reclaim activity.

On UMA, it makes little difference to overhead

          3.16.0-rc3   3.16.0-rc3
             vanilla lowercost-v5
User          383.61      386.77
System        403.83      401.74
Elapsed      5411.50     5413.11

On a 4-socket NUMA machine it's a bit more noticable

          3.16.0-rc3   3.16.0-rc3
             vanilla lowercost-v5
User          746.94      802.00
System      65336.22    40852.33
Elapsed     27553.52    27368.46

This patch (of 6):

The LRU insertion and activate tracepoints take PFN as a parameter
forcing the overhead to the caller.  Move the overhead to the tracepoint
fast-assign method to ensure the cost is only incurred when the
tracepoint is active.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomemcg, vmscan: Fix forced scan of anonymous pages
Jerome Marchand [Wed, 6 Aug 2014 23:08:03 +0000 (16:08 -0700)]
memcg, vmscan: Fix forced scan of anonymous pages

commit 2ab051e11bfa3cbb7b24177f3d6aaed10a0d743e upstream.

When memory cgoups are enabled, the code that decides to force to scan
anonymous pages in get_scan_count() compares global values (free,
high_watermark) to a value that is restricted to a memory cgroup (file).
It make the code over-eager to force anon scan.

For instance, it will force anon scan when scanning a memcg that is
mainly populated by anonymous page, even when there is plenty of file
pages to get rid of in others memcgs, even when swappiness == 0.  It
breaks user's expectation about swappiness and hurts performance.

This patch makes sure that forced anon scan only happens when there not
enough file pages for the all zone, not just in one random memcg.

[hannes@cmpxchg.org: cleanups]
Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Rik van Riel <riel@redhat.com>
Cc: Mel Gorman <mgorman@suse.de>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agovmalloc: use rcu list iterator to reduce vmap_area_lock contention
Joonsoo Kim [Wed, 6 Aug 2014 23:05:06 +0000 (16:05 -0700)]
vmalloc: use rcu list iterator to reduce vmap_area_lock contention

commit 474750aba88817c53f39424e5567b8e4acc4b39b upstream.

Richard Yao reported a month ago that his system have a trouble with
vmap_area_lock contention during performance analysis by /proc/meminfo.
Andrew asked why his analysis checks /proc/meminfo stressfully, but he
didn't answer it.

  https://lkml.org/lkml/2014/4/10/416

Although I'm not sure that this is right usage or not, there is a
solution reducing vmap_area_lock contention with no side-effect.  That
is just to use rcu list iterator in get_vmalloc_info().

rcu can be used in this function because all RCU protocol is already
respected by writers, since Nick Piggin commit db64fe02258f1 ("mm:
rewrite vmap layer") back in linux-2.6.28

Specifically :
   insertions use list_add_rcu(),
   deletions use list_del_rcu() and kfree_rcu().

Note the rb tree is not used from rcu reader (it would not be safe),
only the vmap_area_list has full RCU protection.

Note that __purge_vmap_area_lazy() already uses this rcu protection.

        rcu_read_lock();
        list_for_each_entry_rcu(va, &vmap_area_list, list) {
                if (va->flags & VM_LAZY_FREE) {
                        if (va->va_start < *start)
                                *start = va->va_start;
                        if (va->va_end > *end)
                                *end = va->va_end;
                        nr += (va->va_end - va->va_start) >> PAGE_SHIFT;
                        list_add_tail(&va->purge_list, &valist);
                        va->flags |= VM_LAZY_FREEING;
                        va->flags &= ~VM_LAZY_FREE;
                }
        }
        rcu_read_unlock();

Peter:

: While rcu list traversal over the vmap_area_list is safe, this may
: arrive at different results than the spinlocked version. The rcu list
: traversal version will not be a 'snapshot' of a single, valid instant
: of the entire vmap_area_list, but rather a potential amalgam of
: different list states.

Joonsoo:

: Yes, you are right, but I don't think that we should be strict here.
: Meminfo is already not a 'snapshot' at specific time.  While we try to get
: certain stats, the other stats can change.  And, although we may arrive at
: different results than the spinlocked version, the difference would not be
: large and would not make serious side-effect.

[edumazet@google.com: add more commit description]
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Reported-by: Richard Yao <ryao@gentoo.org>
Acked-by: Eric Dumazet <edumazet@google.com>
Cc: Peter Hurley <peter@hurleysoftware.com>
Cc: Zhang Yanfei <zhangyanfei.yes@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: make copy_pte_range static again
Jerome Marchand [Wed, 6 Aug 2014 23:06:56 +0000 (16:06 -0700)]
mm: make copy_pte_range static again

commit 21bda264f4243f61dfcc485174055f12ad0530b4 upstream.

Commit 71e3aac0724f ("thp: transparent hugepage core") adds
copy_pte_range prototype to huge_mm.h.  I'm not sure why (or if) this
function have been used outside of memory.c, but it currently isn't.
This patch makes copy_pte_range() static again.

Signed-off-by: Jerome Marchand <jmarchan@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm, thp: only collapse hugepages to nodes with affinity for zone_reclaim_mode
David Rientjes [Wed, 6 Aug 2014 23:07:29 +0000 (16:07 -0700)]
mm, thp: only collapse hugepages to nodes with affinity for zone_reclaim_mode

commit 14a4e2141e24304fff2c697be6382ffb83888185 upstream.

Commit 9f1b868a13ac ("mm: thp: khugepaged: add policy for finding target
node") improved the previous khugepaged logic which allocated a
transparent hugepages from the node of the first page being collapsed.

However, it is still possible to collapse pages to remote memory which
may suffer from additional access latency.  With the current policy, it
is possible that 255 pages (with PAGE_SHIFT == 12) will be collapsed
remotely if the majority are allocated from that node.

When zone_reclaim_mode is enabled, it means the VM should make every
attempt to allocate locally to prevent NUMA performance degradation.  In
this case, we do not want to collapse hugepages to remote nodes that
would suffer from increased access latency.  Thus, when
zone_reclaim_mode is enabled, only allow collapsing to nodes with
RECLAIM_DISTANCE or less.

There is no functional change for systems that disable
zone_reclaim_mode.

Signed-off-by: David Rientjes <rientjes@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Rik van Riel <riel@redhat.com>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Bob Liu <bob.liu@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm/memory.c: use entry = ACCESS_ONCE(*pte) in handle_pte_fault()
Hugh Dickins [Wed, 6 Aug 2014 23:05:08 +0000 (16:05 -0700)]
mm/memory.c: use entry = ACCESS_ONCE(*pte) in handle_pte_fault()

commit c0d73261f5c1355a35b8b40e871d31578ce0c044 upstream.

Use ACCESS_ONCE() in handle_pte_fault() when getting the entry or
orig_pte upon which all subsequent decisions and pte_same() tests will
be made.

I have no evidence that its lack is responsible for the mm/filemap.c:202
BUG_ON(page_mapped(page)) in __delete_from_page_cache() found by
trinity, and I am not optimistic that it will fix it.  But I have found
no other explanation, and ACCESS_ONCE() here will surely not hurt.

If gcc does re-access the pte before passing it down, then that would be
disastrous for correct page fault handling, and certainly could explain
the page_mapped() BUGs seen (concurrent fault causing page to be mapped
in a second time on top of itself: mapcount 2 for a single pte).

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agoshmem: fix init_page_accessed use to stop !PageLRU bug
Hugh Dickins [Wed, 2 Jul 2014 22:22:38 +0000 (15:22 -0700)]
shmem: fix init_page_accessed use to stop !PageLRU bug

commit 66d2f4d28cd030220e7ea2a628993fcabcb956d1 upstream.

Under shmem swapping load, I sometimes hit the VM_BUG_ON_PAGE(!PageLRU)
in isolate_lru_pages() at mm/vmscan.c:1281!

Commit 2457aec63745 ("mm: non-atomically mark page accessed during page
cache allocation where possible") looks like interrupted work-in-progress.

mm/filemap.c's call to init_page_accessed() is fine, but not mm/shmem.c's
- shmem_write_begin() is clearly wrong to use it after shmem_getpage(),
when the page is always visible in radix_tree, and often already on LRU.

Revert change to shmem_write_begin(), and use init_page_accessed() or
mark_page_accessed() appropriately for SGP_WRITE in shmem_getpage_gfp().

SGP_WRITE also covers shmem_symlink(), which did not mark_page_accessed()
before; but since many other filesystems use [__]page_symlink(), which did
and does mark the page accessed, consider this as rectifying an oversight.

Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: avoid unnecessary atomic operations during end_page_writeback()
Mel Gorman [Wed, 4 Jun 2014 23:10:34 +0000 (16:10 -0700)]
mm: avoid unnecessary atomic operations during end_page_writeback()

commit 888cf2db475a256fb0cda042140f73d7881f81fe upstream.

If a page is marked for immediate reclaim then it is moved to the tail of
the LRU list.  This occurs when the system is under enough memory pressure
for pages under writeback to reach the end of the LRU but we test for this
using atomic operations on every writeback.  This patch uses an optimistic
non-atomic test first.  It'll miss some pages in rare cases but the
consequences are not severe enough to warrant such a penalty.

While the function does not dominate profiles during a simple dd test the
cost of it is reduced.

73048     0.7428  vmlinux-3.15.0-rc5-mmotm-20140513 end_page_writeback
23740     0.2409  vmlinux-3.15.0-rc5-lessatomic     end_page_writeback

Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: non-atomically mark page accessed during page cache allocation where possible
Mel Gorman [Wed, 4 Jun 2014 23:10:31 +0000 (16:10 -0700)]
mm: non-atomically mark page accessed during page cache allocation where possible

commit 2457aec63745e235bcafb7ef312b182d8682f0fc upstream.

aops->write_begin may allocate a new page and make it visible only to have
mark_page_accessed called almost immediately after.  Once the page is
visible the atomic operations are necessary which is noticable overhead
when writing to an in-memory filesystem like tmpfs but should also be
noticable with fast storage.  The objective of the patch is to initialse
the accessed information with non-atomic operations before the page is
visible.

The bulk of filesystems directly or indirectly use
grab_cache_page_write_begin or find_or_create_page for the initial
allocation of a page cache page.  This patch adds an init_page_accessed()
helper which behaves like the first call to mark_page_accessed() but may
called before the page is visible and can be done non-atomically.

The primary APIs of concern in this care are the following and are used
by most filesystems.

find_get_page
find_lock_page
find_or_create_page
grab_cache_page_nowait
grab_cache_page_write_begin

All of them are very similar in detail to the patch creates a core helper
pagecache_get_page() which takes a flags parameter that affects its
behavior such as whether the page should be marked accessed or not.  Then
old API is preserved but is basically a thin wrapper around this core
function.

Each of the filesystems are then updated to avoid calling
mark_page_accessed when it is known that the VM interfaces have already
done the job.  There is a slight snag in that the timing of the
mark_page_accessed() has now changed so in rare cases it's possible a page
gets to the end of the LRU as PageReferenced where as previously it might
have been repromoted.  This is expected to be rare but it's worth the
filesystem people thinking about it in case they see a problem with the
timing change.  It is also the case that some filesystems may be marking
pages accessed that previously did not but it makes sense that filesystems
have consistent behaviour in this regard.

The test case used to evaulate this is a simple dd of a large file done
multiple times with the file deleted on each iterations.  The size of the
file is 1/10th physical memory to avoid dirty page balancing.  In the
async case it will be possible that the workload completes without even
hitting the disk and will have variable results but highlight the impact
of mark_page_accessed for async IO.  The sync results are expected to be
more stable.  The exception is tmpfs where the normal case is for the "IO"
to not hit the disk.

The test machine was single socket and UMA to avoid any scheduling or NUMA
artifacts.  Throughput and wall times are presented for sync IO, only wall
times are shown for async as the granularity reported by dd and the
variability is unsuitable for comparison.  As async results were variable
do to writback timings, I'm only reporting the maximum figures.  The sync
results were stable enough to make the mean and stddev uninteresting.

The performance results are reported based on a run with no profiling.
Profile data is based on a separate run with oprofile running.

async dd
                                    3.15.0-rc3            3.15.0-rc3
                                       vanilla           accessed-v2
ext3    Max      elapsed     13.9900 (  0.00%)     11.5900 ( 17.16%)
tmpfs Max      elapsed      0.5100 (  0.00%)      0.4900 (  3.92%)
btrfs   Max      elapsed     12.8100 (  0.00%)     12.7800 (  0.23%)
ext4 Max      elapsed     18.6000 (  0.00%)     13.3400 ( 28.28%)
xfs Max      elapsed     12.5600 (  0.00%)      2.0900 ( 83.36%)

The XFS figure is a bit strange as it managed to avoid a worst case by
sheer luck but the average figures looked reasonable.

        samples percentage
ext3       86107    0.9783  vmlinux-3.15.0-rc4-vanilla        mark_page_accessed
ext3       23833    0.2710  vmlinux-3.15.0-rc4-accessed-v3r25 mark_page_accessed
ext3        5036    0.0573  vmlinux-3.15.0-rc4-accessed-v3r25 init_page_accessed
ext4       64566    0.8961  vmlinux-3.15.0-rc4-vanilla        mark_page_accessed
ext4        5322    0.0713  vmlinux-3.15.0-rc4-accessed-v3r25 mark_page_accessed
ext4        2869    0.0384  vmlinux-3.15.0-rc4-accessed-v3r25 init_page_accessed
xfs        62126    1.7675  vmlinux-3.15.0-rc4-vanilla        mark_page_accessed
xfs         1904    0.0554  vmlinux-3.15.0-rc4-accessed-v3r25 init_page_accessed
xfs          103    0.0030  vmlinux-3.15.0-rc4-accessed-v3r25 mark_page_accessed
btrfs      10655    0.1338  vmlinux-3.15.0-rc4-vanilla        mark_page_accessed
btrfs       2020    0.0273  vmlinux-3.15.0-rc4-accessed-v3r25 init_page_accessed
btrfs        587    0.0079  vmlinux-3.15.0-rc4-accessed-v3r25 mark_page_accessed
tmpfs      59562    3.2628  vmlinux-3.15.0-rc4-vanilla        mark_page_accessed
tmpfs       1210    0.0696  vmlinux-3.15.0-rc4-accessed-v3r25 init_page_accessed
tmpfs         94    0.0054  vmlinux-3.15.0-rc4-accessed-v3r25 mark_page_accessed

[akpm@linux-foundation.org: don't run init_page_accessed() against an uninitialised pointer]
Signed-off-by: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Jan Kara <jack@suse.cz>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Tested-by: Prabhakar Lad <prabhakar.csengg@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agofs: buffer: do not use unnecessary atomic operations when discarding buffers
Mel Gorman [Wed, 4 Jun 2014 23:10:29 +0000 (16:10 -0700)]
fs: buffer: do not use unnecessary atomic operations when discarding buffers

commit e7470ee89f003634a88e7b5e5a7b65b3025987de upstream.

Discarding buffers uses a bunch of atomic operations when discarding
buffers because ......  I can't think of a reason.  Use a cmpxchg loop to
clear all the necessary flags.  In most (all?) cases this will be a single
atomic operations.

[akpm@linux-foundation.org: move BUFFER_FLAGS_DISCARD into the .c file]
Signed-off-by: Mel Gorman <mgorman@suse.de>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Jan Kara <jack@suse.cz>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: do not use unnecessary atomic operations when adding pages to the LRU
Mel Gorman [Wed, 4 Jun 2014 23:10:28 +0000 (16:10 -0700)]
mm: do not use unnecessary atomic operations when adding pages to the LRU

commit 6fb81a17d21f2a138b8f424af4cf379f2b694060 upstream.

When adding pages to the LRU we clear the active bit unconditionally.
As the page could be reachable from other paths we cannot use unlocked
operations without risk of corruption such as a parallel
mark_page_accessed.  This patch tests if is necessary to clear the
active flag before using an atomic operation.  This potentially opens a
tiny race when PageActive is checked as mark_page_accessed could be
called after PageActive was checked.  The race already exists but this
patch changes it slightly.  The consequence is that that the page may be
promoted to the active list that might have been left on the inactive
list before the patch.  It's too tiny a race and too marginal a
consequence to always use atomic operations for.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Jan Kara <jack@suse.cz>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: do not use atomic operations when releasing pages
Mel Gorman [Wed, 4 Jun 2014 23:10:26 +0000 (16:10 -0700)]
mm: do not use atomic operations when releasing pages

commit e3741b506c5088fa8c911bb5884c430f770fb49d upstream.

There should be no references to it any more and a parallel mark should
not be reordered against us.  Use non-locked varient to clear page active.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Jan Kara <jack@suse.cz>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: shmem: avoid atomic operation during shmem_getpage_gfp
Mel Gorman [Wed, 4 Jun 2014 23:10:24 +0000 (16:10 -0700)]
mm: shmem: avoid atomic operation during shmem_getpage_gfp

commit 07a427884348d38a6fd56fa4d78249c407196650 upstream.

shmem_getpage_gfp uses an atomic operation to set the SwapBacked field
before it's even added to the LRU or visible.  This is unnecessary as what
could it possible race against?  Use an unlocked variant.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Jan Kara <jack@suse.cz>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6 years agomm: page_alloc: lookup pageblock migratetype with IRQs enabled during free
Mel Gorman [Wed, 4 Jun 2014 23:10:19 +0000 (16:10 -0700)]
mm: page_alloc: lookup pageblock migratetype with IRQs enabled during free

commit cfc47a2803db42140167b92d991ef04018e162c7 upstream.

get_pageblock_migratetype() is called during free with IRQs disabled.
This is unnecessary and disables IRQs for longer than necessary.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Jan Kara <jack@suse.cz>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>