[PATCH v2] mmc: sdhci-pci: SDIO host controller support for Intel Quark X1000

2014-06-24 Thread Chen, Alvin
From: Derek Browne derek.bro...@intel.com

This patch is to enable SDIO host controller for Intel Quark X1000.

Signed-off-by: Derek Browne derek.bro...@intel.com
Signed-off-by: Alvin (Weike) Chen alvin.c...@intel.com
---
changelog v2:
*Delete '#define PCI_DEVICE_ID_INTEL_QUARK_ILB 0x095E' from 
'include/linux/pci_ids.h'.
*Move '#define PCI_DEVICE_ID_INTEL_QRK_SD 0x08A7' from 
'include/linux/pci_ids.h' 
 to 'driver/mmc/host/sdhci-pci.h'.
*Update the subject and description.

 drivers/mmc/host/sdhci-pci.c |   12 
 drivers/mmc/host/sdhci-pci.h |1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/mmc/host/sdhci-pci.c b/drivers/mmc/host/sdhci-pci.c
index 52c42fc..1aeeefc 100644
--- a/drivers/mmc/host/sdhci-pci.c
+++ b/drivers/mmc/host/sdhci-pci.c
@@ -103,6 +103,10 @@ static const struct sdhci_pci_fixes sdhci_cafe = {
  SDHCI_QUIRK_BROKEN_TIMEOUT_VAL,
 };
 
+static const struct sdhci_pci_fixes sdhci_intel_qrk = {
+   .quirks = SDHCI_QUIRK_NO_HISPD_BIT,
+};
+
 static int mrst_hc_probe_slot(struct sdhci_pci_slot *slot)
 {
slot-host-mmc-caps |= MMC_CAP_8_BIT_DATA;
@@ -753,6 +757,14 @@ static const struct pci_device_id pci_ids[] = {
 
{
.vendor = PCI_VENDOR_ID_INTEL,
+   .device = PCI_DEVICE_ID_INTEL_QRK_SD,
+   .subvendor  = PCI_ANY_ID,
+   .subdevice  = PCI_ANY_ID,
+   .driver_data= (kernel_ulong_t)sdhci_intel_qrk,
+   },
+
+   {
+   .vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_MRST_SD0,
.subvendor  = PCI_ANY_ID,
.subdevice  = PCI_ANY_ID,
diff --git a/drivers/mmc/host/sdhci-pci.h b/drivers/mmc/host/sdhci-pci.h
index 6d71871..c101477 100644
--- a/drivers/mmc/host/sdhci-pci.h
+++ b/drivers/mmc/host/sdhci-pci.h
@@ -17,6 +17,7 @@
 #define PCI_DEVICE_ID_INTEL_CLV_SDIO2  0x08fb
 #define PCI_DEVICE_ID_INTEL_CLV_EMMC0  0x08e5
 #define PCI_DEVICE_ID_INTEL_CLV_EMMC1  0x08e6
+#define PCI_DEVICE_ID_INTEL_QRK_SD 0x08A7
 
 /*
  * PCI registers
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Fix build warning

2014-06-24 Thread Guenter Roeck

On 06/23/2014 10:34 PM, Benjamin Herrenschmidt wrote:

On Mon, 2014-06-23 at 22:05 -0700, Guenter Roeck wrote:

On 06/23/2014 09:35 PM, Benjamin Herrenschmidt wrote:

On Fri, 2014-06-13 at 09:38 -0700, Guenter Roeck wrote:

If compiled with W=1, the following warning is seen in powerpc builds.

arch/powerpc/kernel/smp.c:750:18: warning:
type qualifiers ignored on function return type
static const int powerpc_smt_flags(void)
   ^

This is caused by a function returning 'const int', which doesn't
make sense to gcc. Drop 'const' to fix the problem.


This breaks the 64-bit build:

arch/powerpc/kernel/smp.c:764:2: error: initialization from incompatible 
pointer type [-Werror]
arch/powerpc/kernel/smp.c:764:2: error: (near initialization for 
'powerpc_topology[0].sd_flags') [-Werror]

It appears that the generic definition in sched.h has this function
defined as const int, so that needs to be fixed too along with all
instances in all archs.



https://lkml.org/lkml/2014/6/12/743


Won't the patch above break powerpc then ? IE. The functions signature
won't match anymore ... /me thinks you probably need to fix them all
at once.



I thought that only happens if a const is dropped, but maybe not.

Sigh. Much easier to break something than to fix it. That would mean to get 
approval
from at least three maintainers, and all that to get rid of a warning. I don't
really have time for that. Let's just forget about it and live with the warning.

Guenter

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] mmc: sdhci-pci: Add support for Intel Quark X1000 SDIO host controller

2014-06-24 Thread Chen, Alvin
From: Alvin (Weike) Chen alvin.c...@intel.com

Hi,
Intel Quark X1000 consists of one SDIO host controller which can be PCI 
enumerated. 
SDHCI-PCI layer doesn't support it. Thus, we add support for Intel Quark X1000 
SDIO as well.

Derek Browne (1):
  Quark SDIO host controller

 drivers/mmc/host/sdhci-pci.c |   12 
 drivers/mmc/host/sdhci-pci.h |1 +
 2 files changed, 13 insertions(+)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] mm: update the description for madvise_remove

2014-06-24 Thread Naoya Horiguchi
On Tue, Jun 24, 2014 at 01:49:31PM +0800, Wang Sheng-Hui wrote:
 
 Currently, we have more filesystems supporting fallocate, e.g
 ext4/btrfs. Remove the outdated comment for madvise_remove.
 
 Signed-off-by: Wang Sheng-Hui shh...@gmail.com

Looks good to me.

Reviewed-by: Naoya Horiguchi n-horigu...@ah.jp.nec.com

 ---
  mm/madvise.c | 3 ---
  1 file changed, 3 deletions(-)
 
 diff --git a/mm/madvise.c b/mm/madvise.c
 index a402f8f..0938b30 100644
 --- a/mm/madvise.c
 +++ b/mm/madvise.c
 @@ -292,9 +292,6 @@ static long madvise_dontneed(struct vm_area_struct *vma,
  /*
   * Application wants to free up the pages and associated backing store.
   * This is effectively punching a hole into the middle of a file.
 - *
 - * NOTE: Currently, only shmfs/tmpfs is supported for this operation.
 - * Other filesystems return -ENOSYS.
   */
  static long madvise_remove(struct vm_area_struct *vma,
 struct vm_area_struct **prev,
 -- 
 1.8.3.2
 
 --
 To unsubscribe, send a message with 'unsubscribe linux-mm' in
 the body to majord...@kvack.org.  For more info on Linux MM,
 see: http://www.linux-mm.org/ .
 Don't email: a href=mailto:d...@kvack.org; em...@kvack.org /a
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] usb: host: xhci-plat: Add support to get PHYs

2014-06-24 Thread Vivek Gautam
Hi,


On Tue, Jun 10, 2014 at 1:52 AM, Julius Werner jwer...@chromium.org wrote:
 diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
 index 9ffecd5..453d89e 100644
 --- a/drivers/usb/host/xhci.h
 +++ b/drivers/usb/host/xhci.h
 @@ -1582,6 +1582,9 @@ struct xhci_hcd {
 u32 port_status_u0;
  /* Compliance Mode Timer Triggered every 2 seconds */
  #define COMP_MODE_RCVRY_MSECS 2000
 +   /* phys for the controller */
 +   struct phy  *phy2_gen;
 +   struct phy  *phy3_gen;
  };

 I don't think adding new variables here and restricting most of this
 logic to xhci-plat.c (in the next patch) is the best way to do it.
 There's no conceptual reason why other host controllers (e.g. xhci-pci
 or even EHCI) could not have a similar need to tune their PHY after
 reset. PHYs are universal to all host controllers.

 There is already a 'phy' member in struct usb_hcd which I think is
 mostly unused right now. I think it would be much less
 confusing/redundant to reuse that member for this purpose (you could
 still set it up from xhci_plat_probe(), and then call it from
 hcd_bus_resume() or something like that). Since XHCI host controllers
 already conveniently have two struct usb_hcd (one for 2.0 and one for
 3.0), you can cleanly store references to your two PHYs in there.

Ok, i will look into the suggested approach, and raise flag in case i
have doubts.



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] f2fs: release new entry page correctly in error path of f2fs_rename

2014-06-24 Thread Chao Yu
This patch correct releasing code of new_page to avoid BUG_ON in error patch of
f2fs_rename.

Signed-off-by: Chao Yu chao2...@samsung.com
---
 fs/f2fs/namei.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index 0d55517..f17e34c 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -475,7 +475,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
return 0;
 
 put_out_dir:
-   f2fs_put_page(new_page, 1);
+   kunmap(new_page);
+   f2fs_put_page(new_page, 0);
 out_dir:
if (old_dir_entry) {
kunmap(old_dir_page);
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] f2fs: reduce region of f2fs_lock_op covered for better concurrency

2014-06-24 Thread Chao Yu
In our rename process, region of f2fs_lock_op covered is too big as some of the
code like f2fs_empty_dir/f2fs_find_entry are not needed to protect by this lock.

So in the extreme case like doing checkpoint when we rename old inode to exist
inode in a large directory could cause lower concurrency.

Let's reduce the region of f2fs_lock_op to fix this.

Signed-off-by: Chao Yu chao2...@samsung.com
---
 fs/f2fs/namei.c |   12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c
index f17e34c..143799d 100644
--- a/fs/f2fs/namei.c
+++ b/fs/f2fs/namei.c
@@ -394,8 +394,6 @@ static int f2fs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
goto out_old;
}
 
-   f2fs_lock_op(sbi);
-
if (new_inode) {
 
err = -ENOTEMPTY;
@@ -408,6 +406,8 @@ static int f2fs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
if (!new_entry)
goto out_dir;
 
+   f2fs_lock_op(sbi);
+
err = acquire_orphan_inode(sbi);
if (err)
goto put_out_dir;
@@ -439,9 +439,13 @@ static int f2fs_rename(struct inode *old_dir, struct 
dentry *old_dentry,
update_inode_page(old_inode);
update_inode_page(new_inode);
} else {
+   f2fs_lock_op(sbi);
+
err = f2fs_add_link(new_dentry, old_inode);
-   if (err)
+   if (err) {
+   f2fs_unlock_op(sbi);
goto out_dir;
+   }
 
if (old_dir_entry) {
inc_nlink(new_dir);
@@ -475,6 +479,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry 
*old_dentry,
return 0;
 
 put_out_dir:
+   f2fs_unlock_op(sbi);
kunmap(new_page);
f2fs_put_page(new_page, 0);
 out_dir:
@@ -482,7 +487,6 @@ out_dir:
kunmap(old_dir_page);
f2fs_put_page(old_dir_page, 0);
}
-   f2fs_unlock_op(sbi);
 out_old:
kunmap(old_page);
f2fs_put_page(old_page, 0);
-- 
1.7.9.5


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v2 0/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight
  backlight: add new tps611xx backlight device tree support  This
commit is tps611xx device tree documentation.

 .../video/backlight/tps611xx-backlight.txt |   16 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  494 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 549 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v2 2/2] backlight: device tree: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 .../video/backlight/tps611xx-backlight.txt |   16 
 1 file changed, 16 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..01f110d
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,16 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+It supports tps61158, tps61161, tps61163 and tps61165.
+
+Required properties:
+- compatible: ti,tps61158_bl, ti,tps61161_bl, ti,tps61163_bl, 
ti,tps61165_bl
+- rfa_en: enable request for acknowledge. ( 0 : disable , 1 : enable )
+- en_gpio_num: gpio number for en pin.
+
+Example:
+
+   backlight {
+   compatible = ti,tps61163_bl;
+   rfa_en = 1;
+   en_gpio_num = 45;
+   };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v2 1/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is 
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that 
its bit detection is in a large extent independent from the bit transmission 
rate. 
It can automatically detect bit rates between 1.7kBit/sec and up to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and a 
16-bit data byte.
All of the 24 bits should be transmitted together each time, and the LSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed to 0x8F. 
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information and an 
RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer http://www.ti.com/lit/ds/symlink/tps61163.pdf for more details.

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte and a 
8-bit data byte.
All of the 16 bits should be transmitted together each time, and the MSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed (tps61158 
0x58
tps61161 and tps61165 0x72). The data byte includes an RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer the links below  for more details.
tps61158 : http://www.ti.com/lit/ds/symlink/tps61158.pdf
tps61161 : http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
tps61165 : http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  494 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 533 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate TPS611xx Backlight
+   depends on BACKLIGHT_CLASS_DEVICE  GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate AS3711 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..44f1641 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -52,4 +52,5 @@ obj-$(CONFIG_BACKLIGHT_PWM)   += pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..f7e08a3
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,494 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  gshark.je...@gmail.com
+ *Ldd Mlp ldd-...@list.ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include linux/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/fb.h
+#include linux/gpio.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/platform_data/tps611xx_bl.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID,

[PATCH] powerpc/kvm: Fix build break with CONFIG_KVM_BOOK3S_64_HV=y

2014-06-24 Thread Michael Ellerman
Commit e58e263 PPC, KVM, CMA: use general CMA reserved area management
framework in next-20140624 removed arch/powerpc/kvm/book3s_hv_cma.c but
neglected to update the Makefile, thus breaking the build.

Signed-off-by: Michael Ellerman m...@ellerman.id.au
---

Hi Andrew,

This is in your akpm-current and is breaking some of the builds for
powerpc in linux-next. Squashing this fix into the original patch would
be best for us.

cheers

 arch/powerpc/kvm/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index ce569b6..72905c3 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -90,7 +90,6 @@ kvm-book3s_64-builtin-objs-$(CONFIG_KVM_BOOK3S_64_HANDLER) += 
\
book3s_hv_rm_mmu.o \
book3s_hv_ras.o \
book3s_hv_builtin.o \
-   book3s_hv_cma.o \
$(kvm-book3s_64-builtin-xics-objs-y)
 endif
 
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc: Fix build warning

2014-06-24 Thread Benjamin Herrenschmidt
On Mon, 2014-06-23 at 23:01 -0700, Guenter Roeck wrote:
 I thought that only happens if a const is dropped, but maybe not.
 
 Sigh. Much easier to break something than to fix it. That would mean
 to get approval
 from at least three maintainers, and all that to get rid of a warning.
 I don't
 really have time for that. Let's just forget about it and live with
 the warning.

Well you have my tentative approval :) And trivial ones like that don't
really need the respective maintainers to respond really, I forget
regularly and they still go upstream.

Cheers,
Ben.


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] ARM: dts: Add cros_ec to exynos5420-peach-pit and exynos5800-peach-pi

2014-06-24 Thread Tushar Behera
On 06/24/2014 02:19 AM, Doug Anderson wrote:
 This adds cros_ec to exynos5420-peach-pit and exynos5800-peach-pi,
 including:
 * The keyboard
 * The i2c tunnel
 * The tps65090 under the i2c tunnel
 * The battery under the i2c tunnel
 
 To add extra motivation, it should be noted that tps65090 is one of
 the things needed to get display-related FETs turned on for pit and
 pi.
 
 Note that this relies on a few outstanding changes:
 * Needs (spi: s3c64xx: fix broken cs_gpios usage in the driver) and
   (spi: s3c64xx: for DT platofrms always get the chipselect info from
   DT node) to work properly and match the documented bindings.  See
   https://patchwork.kernel.org/patch/4346701/ and
   https://patchwork.kernel.org/patch/4346711/
 
 Signed-off-by: Doug Anderson diand...@chromium.org
 Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk

Along with the dependency patches on next-20140623, tested keyboard on
Peach-Pi board.

Tested-by: Tushar Behera tusha...@samsung.com

Some comments below.

 ---
 Changes in v2:
 - Now just one patch since mfd patch landed.
 - Rebased to ToT linux-next
 
  arch/arm/boot/dts/exynos5420-peach-pit.dts | 145 
 +
  arch/arm/boot/dts/exynos5800-peach-pi.dts  | 145 
 +
  2 files changed, 290 insertions(+)
 
 diff --git a/arch/arm/boot/dts/exynos5420-peach-pit.dts 
 b/arch/arm/boot/dts/exynos5420-peach-pit.dts
 index 7649982..581f385 100644
 --- a/arch/arm/boot/dts/exynos5420-peach-pit.dts
 +++ b/arch/arm/boot/dts/exynos5420-peach-pit.dts

 + regulators {
 + dcdc1 {
 + ti,enable-ext-control;
 + };
 + dcdc2 {
 + ti,enable-ext-control;
 + };
 + dcdc3 {
 + ti,enable-ext-control;
 + };
 + fet1 {

tps65090_fet1: fet1 { ?

 + regulator-name = vcd_led;
 + };
 + tps65090_fet2: fet2 {

I would suggest we add similar labels to fet1, fet3, fet4, fet5 and fet6
also. That way it would be easy to reference them in subsequent DT nodes.

Same comment for Peach-Pi dts file too.

-- 
Tushar Behera
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 0/4] perf timechart io mode

2014-06-24 Thread Namhyung Kim
Hi Stanislav,

On Fri, 20 Jun 2014 14:29:47 +0400, Stanislav Fomichev wrote:
 This patchset adds IO mode: instead of process time we record io syscalls
 and then draw timechart of writes/reads/tx/rx/polls.

Nice work!  For the series,

Acked-by: Namhyung Kim namhy...@kernel.org

Thanks,
Namhyung



 v4:
   - another attempt for fix segfault when skipping invalid tracepoints
   - added new patch to fix rendering in Firefox

 v3:
   - fixed segfault when skipping invalid tracepoints
   - added ms/us units support for --io-xyz time options
   - fixed missing boxes on Firefox

 v2:
   - separated start_time fix into distinct commit
   - separated --io-xyz options into distinct commit
   - fixed 'error' shadowing
   - initialized variables in declaration when possible
   - removed assert usage
   - fprintf - pr_err
   - removed wrongly placed __maybe_unused

 Stanislav Fomichev (4):
   perf timechart: fix rendering in Firefox
   perf timechart: implement IO mode
   perf timechart: conditionally update start_time on fork
   perf timechart: add more options to IO mode

  tools/perf/Documentation/perf-timechart.txt |  38 +-
  tools/perf/builtin-timechart.c  | 686 
 +++-
  tools/perf/util/svghelper.c | 168 +--
  tools/perf/util/svghelper.h |   6 +-
  4 files changed, 838 insertions(+), 60 deletions(-)
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 1/2] usb: doc: udc-xilinx: Add devicetree bindings

2014-06-24 Thread sundeep subbaraya
Ping

Thanks,
Sundeep.B.S.

On Tue, Jun 10, 2014 at 5:34 PM,  subbaraya.sundeep.bha...@xilinx.com wrote:
 From: Subbaraya Sundeep Bhatta sbha...@xilinx.com

 Add devicetree bindings for Xilinx axi udc driver.

 Signed-off-by: Subbaraya Sundeep Bhatta sbha...@xilinx.com
 ---
 Changes for v3:
 - None
 Changes for v2:
 - replaced xlnx,include-dma with xlnx,has-builtin-dma

  .../devicetree/bindings/usb/udc-xilinx.txt |   20 
 
  1 files changed, 20 insertions(+), 0 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/usb/udc-xilinx.txt

 diff --git a/Documentation/devicetree/bindings/usb/udc-xilinx.txt 
 b/Documentation/devicetree/bindings/usb/udc-xilinx.txt
 new file mode 100644
 index 000..7c24fac
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/usb/udc-xilinx.txt
 @@ -0,0 +1,20 @@
 +Xilinx AXI USB2 device controller
 +
 +Required properties:
 +- compatible   : Should be xlnx,axi-usb2-device-4.00.a
 +- reg  : Physical base address and size of the Axi USB2
 + device registers map.
 +- interrupts   : Property with a value describing the interrupt
 + number.
 +- interrupt-parent : Must be core interrupt controller
 +- xlnx,include-dma : if DMA is included
 +
 +Example:
 +   axi-usb2-device@42e0 {
 +compatible = xlnx,axi-usb2-device-4.00.a;
 +interrupt-parent = 0x1;
 +interrupts = 0x0 0x39 0x1;
 +reg = 0x42e0 0x1;
 +xlnx,has-builtin-dma;
 +};
 +
 --
 1.7.4


 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc/kvm: Fix build break with CONFIG_KVM_BOOK3S_64_HV=y

2014-06-24 Thread Joonsoo Kim
On Tue, Jun 24, 2014 at 04:36:47PM +1000, Michael Ellerman wrote:
 Commit e58e263 PPC, KVM, CMA: use general CMA reserved area management
 framework in next-20140624 removed arch/powerpc/kvm/book3s_hv_cma.c but
 neglected to update the Makefile, thus breaking the build.
 
 Signed-off-by: Michael Ellerman m...@ellerman.id.au
 ---
 
 Hi Andrew,
 
 This is in your akpm-current and is breaking some of the builds for
 powerpc in linux-next. Squashing this fix into the original patch would
 be best for us.
 

I sent really same patch 10 minutes ago. :)

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [BUG] perf: can not resolve symbols for forked threads

2014-06-24 Thread Tony Lu
Thanks for your reply.

-Original Message-
From: Peter Zijlstra [mailto:pet...@infradead.org]
Sent: Monday, June 23, 2014 5:13 PM
To: Tony Lu
Cc: Paul Mackerras; Ingo Molnar; Arnaldo Carvalho de Melo;
linux-kernel@vger.kernel.org; Chris Metcalf
Subject: Re: [BUG] perf: can not resolve symbols for forked threads

On Thu, Jun 19, 2014 at 07:39:42AM +, Tony Lu wrote:
 Hi

 I got the below output that shows perf can not resolve symbols for
 forked threads. I did a system-wide collection from all CPUs after the
 application hello run.

There's no fork() in... :-)

Yes, but perf regards pthread_created threads as forked threads, and a 
PERF_RECORD_FORK event will be delivered when a thread is forked or cloned.


 #include pthread.h
 #include stdio.h
 #include stdlib.h
 #include unistd.h
 #define NUM_THREADS 5

 void foo(void)
 {
   long i = 10;
   while (i--) {
 ;
   }
 }

 void *PrintHello(void *threadid)
 {
long tid;
tid = (long)threadid;
printf(Hello World! It's me, thread #%ld!\n, tid);
foo();
pthread_exit(NULL);
 }

 int main(int argc, char *argv[])
 {
pthread_t threads[NUM_THREADS];
int rc;
long t;
for(t=0;tNUM_THREADS;t++){
  printf(In main: creating thread %ld\n, t);
  rc = pthread_create(threads[t], NULL, PrintHello, (void *)t);
  if (rc){
printf(ERROR; return code from pthread_create() is %d\n, rc);
exit(-1);
}
  }

/* Last thing that main() should do */
pthread_exit(NULL);
 }

That pthread_exit() is the problem; this results in:

29456 pts/23   Zl 0:00  |   \_ [hello] defunct

You want to wait for the threads to complete using pthread_join().

I suspect the defunct state hides the process.

Yes, using pthread_join() can workaround this problem.
Does that mean the parent thread can not exit before the child threads? It 
still seems like a perf bug.

-Thanks
-Tony
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [for-next][PATCH v2 1/3] tracing: Fix syscall_*regfunc() vs copy_process() race

2014-06-24 Thread Namhyung Kim
Hi Steve,

On Fri, 20 Jun 2014 06:45:19 -0400, Steven Rostedt wrote:
 From: Oleg Nesterov o...@redhat.com

 syscall_regfunc() and syscall_unregfunc() should set/clear
 TIF_SYSCALL_TRACEPOINT system-wide, but do_each_thread() can race
 with copy_process() and miss the new child which was not added to
 the process/thread lists yet.

 Change copy_process() to update the child's TIF_SYSCALL_TRACEPOINT
 under tasklist.

s/tasklist/tasklist_lock/ ?

Probably I'm too late..

Thanks,
Namhyung
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] video: OF display-timings support for ocfb

2014-06-24 Thread Stefan Kristiansson
On Mon, Jun 23, 2014 at 03:01:36PM +0300, Tomi Valkeinen wrote:
 On 11/06/14 23:17, Franck Jullien wrote:
  Signed-off-by: Franck Jullien franck.jull...@gmail.com
  ---
   drivers/video/fbdev/Kconfig |2 ++
   drivers/video/fbdev/ocfb.c  |   31 ++-
   2 files changed, 28 insertions(+), 5 deletions(-)
 
 You need to add binding documentation if you add new things to the
 driver's DT support. Actually, we seem to be missing the the binding
 documentation totally, even if the driver has 'of_device_id' table...
 

Right, I'll take the blame for the missing driver binding documentation,
I'll write something up and post a patch for that.
But, where should it go?
Documentation/devicetree/bindings/video/
or
Documentation/devicetree/bindings/fb/

Stefan
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Patch V3 0/5] I2C ACPI operation region handler

2014-06-24 Thread Lan Tianyu
On 2014年05月30日 20:10, Wolfram Sang wrote:
 Hi Wolfram:
 Since this version resolved all comments, it's ok for you?
 
 Sorry, I misunderstood. I thought a V4 was needed, but it isn't. I'll
 try to have a look this weekend.
 

Hi Wolfram:
Sorry to bother you. Could you have a look at patch 4 and patch 5?

-- 
Best regards
Tianyu Lan
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] powerpc/kvm: Fix build break with CONFIG_KVM_BOOK3S_64_HV=y

2014-06-24 Thread Michael Ellerman
On Tue, 2014-06-24 at 15:51 +0900, Joonsoo Kim wrote:
 On Tue, Jun 24, 2014 at 04:36:47PM +1000, Michael Ellerman wrote:
  Commit e58e263 PPC, KVM, CMA: use general CMA reserved area management
  framework in next-20140624 removed arch/powerpc/kvm/book3s_hv_cma.c but
  neglected to update the Makefile, thus breaking the build.
  
  Signed-off-by: Michael Ellerman m...@ellerman.id.au
  ---
  
  Hi Andrew,
  
  This is in your akpm-current and is breaking some of the builds for
  powerpc in linux-next. Squashing this fix into the original patch would
  be best for us.
  
 
 I sent really same patch 10 minutes ago. :)

Haha, oh well, I should have had a coffee instead :)

cheers


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ahci: disable ncq feature for hisilicon sata

2014-06-24 Thread kefeng.wang
On 2014-6-10 21:56, Hans de Goede wrote:
 Hi Kefeng,
 
 On 06/10/2014 12:07 PM, kefeng.wang wrote:
 Hi Tejun,

 I have a question, the hip04 and hix5hd2 soc use the old version of IP, but 
 they
 also have a new version of IP which support FBS and NCQ, and now the new one 
 is
 used by a new soc. How can I distinguish them, use hisilicon,hisi-ahci-vX 
 or just
 add generic-ahci string for the IP which is conformant with spec and has
 no special customization and issue? Any advices, thanks.
 
 Please use hisilicon,hisi-ahci-vX, this way it will be easier to add any
 special behavior in case this turns out to be necessary later.

OK, thanks for your guidance. If necessary, we will use hisi-ahci-vX for hisi's 
IP.

Hi Tejun, could you merger this patch please? thanks.

Regards,
Kefeng

 
 Regards,
 
 Hans
 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/22] Add and use pci_zalloc_consistent

2014-06-24 Thread Joe Perches
On Tue, 2014-06-24 at 07:24 +0200, Julia Lawall wrote
 On Mon, 23 Jun 2014, Joe Perches wrote:
$ cat ./scripts/coccinelle/api/alloc/pci_zalloc_consistent.cocci
///
/// Use pci_zalloc_consistent rather than
/// pci_alloc_consistent followed by memset with 0
///
/// This considers some simple cases that are common and easy to 
validate
/// Note in particular that there are no ...s in the rule, so all of the
/// matched code has to be contiguous
///
/// Blatantly cribbed from: 
scripts/coccinelle/api/alloc/kzalloc-simple.cocci
   
@@
type T, T2;
expression x;
expression E1,E2,E3;
statement S;
@@
   
- x = (T)pci_alloc_consistent(E1,E2,E3);
+ x = pci_zalloc_consistent(E1,E2,E3);
  if ((x==NULL) || ...) S
- memset((T2)x,0,E2);
  
   I don't know much about SmPL, but wouldn't having that if statement
   there reduce your matches?
 
  No, not really.
 
  Almost none of the pci_alloc_consistent calls
  do not have a test for failure immediately after
  them.

 Do not or do?

Sorry, English double negative.

As far as I know, almost every instance of pci_alloc_consistent
is followed by an if.

Exceptions exist in:

drivers/isdn/hardware/eicon/divasmain.c 
drivers/staging/slicoss/slicoss.c
drivers/tty/synclink_gt.c

There might be others, but I didn't look too hard.

 The advantage of the if is that you are sure that nothing strange happens
 to x between alloc and memset.  But a problem can be that sometimes people
 allocate two things, and then do error checking for both of them.  Then
 you rule would not match.  Or the set the return variable to an error code
 before doing the check rather than in the if branch.
 
 You could put the following between the malloc and the memset in stead of
 the if.
 
 ... when != ( f(...,x,...) | +...x...+ = E3 )
 when != ( while(...) S | for(...;...;...) S )
 
 This has given reasonable results for kmalloc and memset.

Thanks for that.

It might be nice to add that to the kzalloc example
in scripts/coccinelle



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 0/7] perf trace pagefaults

2014-06-24 Thread Namhyung Kim
Hi Arnaldo and Stanislav,

On Fri, 20 Jun 2014 10:21:05 -0300, Arnaldo Carvalho de Melo wrote:
 Em Fri, Jun 20, 2014 at 02:49:42PM +0400, Stanislav Fomichev escreveu:
 This patch series adds support for pagefaults tracing to 'perf trace' 
 command.
 It seems this feature was planned by Namhyung Kim 
 (http://events.linuxfoundation.org/images/stories/pdf/klf2012_n_kim.pdf page 
 17/28)
 but I couldn't find any prior patches/discussion and started from scratch.

 Just to clarify here, those slides came from slides I made and in turn
 the whole idea about pagefaults tracing I got from the trace prototype
 that Thomas Gleixner implemented in his 'trace'  utility, described
 here:

   Announcing a new utility: 'trace'
   http://lwn.net/Articles/415728/

Right, I asked to Arnaldo to suggest some cool topics to introduce in
KLF 2012 and that was it.   I had nothing with the features. :)

Keep going nice works, guys!

Thanks,
Namhyung
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v3 0/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol.

Daniel Jeong (2):
  backlight
  backlight: add new tps611xx backlight device tree support  This
commit is tps611xx device tree documentation.

 .../video/backlight/tps611xx-backlight.txt |   16 +
 drivers/video/backlight/Kconfig|7 +
 drivers/video/backlight/Makefile   |1 +
 drivers/video/backlight/tps611xx_bl.c  |  494 
 include/linux/platform_data/tps611xx_bl.h  |   31 ++
 5 files changed, 549 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v3 2/2] backlight: device tree: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This commit is about tps611xx device tree documentation.

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 .../video/backlight/tps611xx-backlight.txt |   16 
 1 file changed, 16 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt

diff --git 
a/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt 
b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
new file mode 100644
index 000..01f110d
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/backlight/tps611xx-backlight.txt
@@ -0,0 +1,16 @@
+TPS611xx family of backlight driver based on EasyScale.
+
+It supports tps61158, tps61161, tps61163 and tps61165.
+
+Required properties:
+- compatible: ti,tps61158_bl, ti,tps61161_bl, ti,tps61163_bl, 
ti,tps61165_bl
+- rfa_en: enable request for acknowledge. ( 0 : disable , 1 : enable )
+- en_gpio_num: gpio number for en pin.
+
+Example:
+
+   backlight {
+   compatible = ti,tps61163_bl;
+   rfa_en = 1;
+   en_gpio_num = 45;
+   };
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC v3 1/2] backlight: add new tps611xx backlight driver

2014-06-24 Thread Daniel Jeong
This driver a general version for tps611xx backlgiht chips of TI.
It supports tps61158, tps61161, tps61163 and tps61165 backlight driver
based on EasyScale protocol(1-Wire Control Interface).

EasyScale
EasyScale is a simple but flexible one pin interface to configure the current.
The interface is based on a master-slave structure, where the master is 
typically a microcontroller or application processor and the IC is the slave.
The advantage of EasyScale compared with other one pin interfaces is that 
its bit detection is in a large extent independent from the bit transmission 
rate. 
It can automatically detect bit rates between 1.7kBit/sec and up to 160kBit/sec.

EasyScale on TPS61163
A command consists of 24 bits, including an 8-bit device address byte and a 
16-bit data byte.
All of the 24 bits should be transmitted together each time, and the LSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed to 0x8F. 
The data byte includes 9 bits D8(MSB)~D0(LSB) for brightness information and an 
RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : D0-D8 | 0 | RFA | 0 | A0-A7
Please refer http://www.ti.com/lit/ds/symlink/tps61163.pdf for more details.

EasyScale on TPS61158/61/65
A command consists of 16 bits, including an 8-bit device address byte and a 
8-bit data byte.
All of the 16 bits should be transmitted together each time, and the MSB bit 
should be 
transmitted first. The device address byte A7(MSB)~A0(LSB) is fixed (tps61158 
0x58
tps61161 and tps61165 0x72). The data byte includes an RFA bit.
The RFA bit set to 1 indicates the Request for Acknowledge condition. The 
Acknowledge
condition is only applied when the protocol is received correctly.
Bit sream : A7-A0 | RFA | 00 | D4-D0
Please refer the links below  for more details.
tps61158 : http://www.ti.com/lit/ds/symlink/tps61158.pdf
tps61161 : http://www.ti.com.cn/cn/lit/ds/symlink/tps61161-q1.pdf
tps61165 : http://www.ti.com/lit/ds/symlink/tps61165.pdf

Signed-off-by: Daniel Jeong gshark.je...@gmail.com
---
 drivers/video/backlight/Kconfig   |7 +
 drivers/video/backlight/Makefile  |1 +
 drivers/video/backlight/tps611xx_bl.c |  494 +
 include/linux/platform_data/tps611xx_bl.h |   31 ++
 4 files changed, 533 insertions(+)
 create mode 100644 drivers/video/backlight/tps611xx_bl.c
 create mode 100644 include/linux/platform_data/tps611xx_bl.h

diff --git a/drivers/video/backlight/Kconfig b/drivers/video/backlight/Kconfig
index 5a3eb2e..c779a85 100644
--- a/drivers/video/backlight/Kconfig
+++ b/drivers/video/backlight/Kconfig
@@ -418,6 +418,13 @@ config BACKLIGHT_TPS65217
  If you have a Texas Instruments TPS65217 say Y to enable the
  backlight driver.
 
+config BACKLIGHT_TPS611xx
+   tristate TPS611xx Backlight
+   depends on BACKLIGHT_CLASS_DEVICE  GPIOLIB
+   help
+ This supports TI TPS61158,TPS61161, TPS61163 and TPS61165
+ backlight driver based on EasyScale Protocol.
+
 config BACKLIGHT_AS3711
tristate AS3711 Backlight
depends on BACKLIGHT_CLASS_DEVICE  MFD_AS3711
diff --git a/drivers/video/backlight/Makefile b/drivers/video/backlight/Makefile
index bb82002..44f1641 100644
--- a/drivers/video/backlight/Makefile
+++ b/drivers/video/backlight/Makefile
@@ -52,4 +52,5 @@ obj-$(CONFIG_BACKLIGHT_PWM)   += pwm_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_TPS65217)   += tps65217_bl.o
+obj-$(CONFIG_BACKLIGHT_TPS611xx)   += tps611xx_bl.o
 obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
diff --git a/drivers/video/backlight/tps611xx_bl.c 
b/drivers/video/backlight/tps611xx_bl.c
new file mode 100644
index 000..8dcc88a
--- /dev/null
+++ b/drivers/video/backlight/tps611xx_bl.c
@@ -0,0 +1,494 @@
+/*
+ * Simple driver for Texas Instruments TPS611XX Backlight driver chip
+ *using EasyScale Interface. It supports TPS61158, TPS61161,
+ *TPS61163 and TPS61165.
+ *
+ * Copyright (C) 2014 Texas Instruments
+ * Author: Daniel Jeong  gshark.je...@gmail.com
+ *Ldd Mlp ldd-...@list.ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include linux/backlight.h
+#include linux/delay.h
+#include linux/err.h
+#include linux/fb.h
+#include linux/gpio.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
+#include linux/platform_data/tps611xx_bl.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+#define CMD_FORWARD 0
+#define CMD_BACKWARD 1
+
+enum tps611xx_id {
+   TPS61158_ID = 0,
+   TPS61161_ID,
+   TPS61163_ID,

Re: [PATCH -mm v3 8/8] slab: do not keep free objects/slabs on dead memcg caches

2014-06-24 Thread Joonsoo Kim
On Fri, Jun 13, 2014 at 12:38:22AM +0400, Vladimir Davydov wrote:
 Since a dead memcg cache is destroyed only after the last slab allocated
 to it is freed, we must disable caching of free objects/slabs for such
 caches, otherwise they will be hanging around forever.
 
 For SLAB that means we must disable per cpu free object arrays and make
 free_block always discard empty slabs irrespective of node's free_limit.
 
 To disable per cpu arrays, we free them on kmem_cache_shrink (see
 drain_cpu_caches - do_drain) and make __cache_free fall back to
 free_block if there is no per cpu array. Also, we have to disable
 allocation of per cpu arrays on cpu hotplug for dead caches (see
 cpuup_prepare, __do_tune_cpucache).
 
 After we disabled free objects/slabs caching, there is no need to reap
 those caches periodically. Moreover, it will only result in slowdown. So
 we also make cache_reap skip then.
 
 Signed-off-by: Vladimir Davydov vdavy...@parallels.com
 ---
  mm/slab.c |   31 ++-
  1 file changed, 30 insertions(+), 1 deletion(-)
 
 diff --git a/mm/slab.c b/mm/slab.c
 index b3af82419251..7e91f5f1341d 100644
 --- a/mm/slab.c
 +++ b/mm/slab.c
 @@ -1210,6 +1210,9 @@ static int cpuup_prepare(long cpu)
   struct array_cache *shared = NULL;
   struct array_cache **alien = NULL;
  
 + if (memcg_cache_dead(cachep))
 + continue;
 +
   nc = alloc_arraycache(node, cachep-limit,
   cachep-batchcount, GFP_KERNEL);
   if (!nc)
 @@ -2411,10 +2414,18 @@ static void do_drain(void *arg)
  
   check_irq_off();
   ac = cpu_cache_get(cachep);
 + if (!ac)
 + return;
 +
   spin_lock(cachep-node[node]-list_lock);
   free_block(cachep, ac-entry, ac-avail, node);
   spin_unlock(cachep-node[node]-list_lock);
   ac-avail = 0;
 +
 + if (memcg_cache_dead(cachep)) {
 + cachep-array[smp_processor_id()] = NULL;
 + kfree(ac);
 + }
  }
  
  static void drain_cpu_caches(struct kmem_cache *cachep)
 @@ -3368,7 +3379,8 @@ static void free_block(struct kmem_cache *cachep, void 
 **objpp, int nr_objects,
  
   /* fixup slab chains */
   if (page-active == 0) {
 - if (n-free_objects  n-free_limit) {
 + if (n-free_objects  n-free_limit ||
 + memcg_cache_dead(cachep)) {

Hello, Vladimir.

I'd like to set 0 to free_limit in __kmem_cache_shrink()
rather than memcg_cache_dead() test here, because memcg_cache_dead()
is more expensive than it. Is there any problem in this way?

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ubi: fix correct rb_tree node comparison in add_vol

2014-06-24 Thread Heiko Schocher
Commit 604b592e6fd3c98f21435e1181ba7723ffc24715 (UBI: fix rb_tree node 
comparison in add_map)

introduced problems with attaching ubi fastmap images,
created with older kernel.

As in ubi_find_av() from attach.c is
[...]
if (vol_id  av-vol_id)
p = p-rb_left;
else
p = p-rb_right;

sync this logic also in add_vol() with this.

With this patch attaching older ubi images works again.

Signed-off-by: Heiko Schocher h...@denx.de

---

Cc: Artem Bityutskiy artem.bityuts...@linux.intel.com
Cc: Richard Weinberger rich...@nod.at
Cc: David Woodhouse dw...@infradead.org
Cc: Brian Norris computersforpe...@gmail.com
Cc: Mike Snitzer snit...@redhat.com
Cc: Wolfgang Denk w...@denx.de
Cc: linux-...@lists.infradead.org
Cc: linux-kernel@vger.kernel.org

 drivers/mtd/ubi/fastmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index b04e7d0..72f39da 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -125,7 +125,7 @@ static struct ubi_ainf_volume *add_vol(struct 
ubi_attach_info *ai, int vol_id,
parent = *p;
av = rb_entry(parent, struct ubi_ainf_volume, rb);
 
-   if (vol_id  av-vol_id)
+   if (vol_id  av-vol_id)
p = (*p)-rb_left;
else
p = (*p)-rb_right;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] cifs: set null to username and iocharset after being freed

2014-06-24 Thread Osmond Sun
In function 'expand_dfs_referral' the volume_info-iocharset and
volume_info-username was used after being freed by calling
cleanup_volume_info_contents. Set null to username and iocharset
after being freed.

Signed-off-by: Osmond Sun osmond@gmail.com
---
 fs/cifs/connect.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 20d75b8..2586a34 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -3251,10 +3251,12 @@ static void
 cleanup_volume_info_contents(struct smb_vol *volume_info)
 {
  kfree(volume_info-username);
+ volume_info-username = NULL;
  kzfree(volume_info-password);
  kfree(volume_info-UNC);
  kfree(volume_info-domainname);
  kfree(volume_info-iocharset);
+ volume_info-iocharset = NULL;
  kfree(volume_info-prepath);
 }

-- 
1.9.0
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -mm v3 8/8] slab: do not keep free objects/slabs on dead memcg caches

2014-06-24 Thread Joonsoo Kim
On Fri, Jun 13, 2014 at 12:38:22AM +0400, Vladimir Davydov wrote:
 Since a dead memcg cache is destroyed only after the last slab allocated
 to it is freed, we must disable caching of free objects/slabs for such
 caches, otherwise they will be hanging around forever.
 
 For SLAB that means we must disable per cpu free object arrays and make
 free_block always discard empty slabs irrespective of node's free_limit.
 
 To disable per cpu arrays, we free them on kmem_cache_shrink (see
 drain_cpu_caches - do_drain) and make __cache_free fall back to
 free_block if there is no per cpu array. Also, we have to disable
 allocation of per cpu arrays on cpu hotplug for dead caches (see
 cpuup_prepare, __do_tune_cpucache).
 
 After we disabled free objects/slabs caching, there is no need to reap
 those caches periodically. Moreover, it will only result in slowdown. So
 we also make cache_reap skip then.
 
 Signed-off-by: Vladimir Davydov vdavy...@parallels.com
 ---
  mm/slab.c |   31 ++-
  1 file changed, 30 insertions(+), 1 deletion(-)
 
 diff --git a/mm/slab.c b/mm/slab.c
 index b3af82419251..7e91f5f1341d 100644
 --- a/mm/slab.c
 +++ b/mm/slab.c
 @@ -1210,6 +1210,9 @@ static int cpuup_prepare(long cpu)
   struct array_cache *shared = NULL;
   struct array_cache **alien = NULL;
  
 + if (memcg_cache_dead(cachep))
 + continue;
 +
   nc = alloc_arraycache(node, cachep-limit,
   cachep-batchcount, GFP_KERNEL);
   if (!nc)
 @@ -2411,10 +2414,18 @@ static void do_drain(void *arg)
  
   check_irq_off();
   ac = cpu_cache_get(cachep);
 + if (!ac)
 + return;
 +
   spin_lock(cachep-node[node]-list_lock);
   free_block(cachep, ac-entry, ac-avail, node);
   spin_unlock(cachep-node[node]-list_lock);
   ac-avail = 0;
 +
 + if (memcg_cache_dead(cachep)) {
 + cachep-array[smp_processor_id()] = NULL;
 + kfree(ac);
 + }
  }
  
  static void drain_cpu_caches(struct kmem_cache *cachep)
 @@ -3368,7 +3379,8 @@ static void free_block(struct kmem_cache *cachep, void 
 **objpp, int nr_objects,
  
   /* fixup slab chains */
   if (page-active == 0) {
 - if (n-free_objects  n-free_limit) {
 + if (n-free_objects  n-free_limit ||
 + memcg_cache_dead(cachep)) {
   n-free_objects -= cachep-num;
   /* No need to drop any previously held
* lock here, even if we have a off-slab slab
 @@ -3462,6 +3474,17 @@ static inline void __cache_free(struct kmem_cache 
 *cachep, void *objp,
  
   kmemcheck_slab_free(cachep, objp, cachep-object_size);
  
 +#ifdef CONFIG_MEMCG_KMEM
 + if (unlikely(!ac)) {
 + int nodeid = page_to_nid(virt_to_page(objp));
 +
 + spin_lock(cachep-node[nodeid]-list_lock);
 + free_block(cachep, objp, 1, nodeid);
 + spin_unlock(cachep-node[nodeid]-list_lock);
 + return;
 + }
 +#endif
 +

And, please document intention of this code. :)

And, you said that this way of implementation would be slow because
there could be many object in dead caches and this implementation
needs node spin_lock on each object freeing. Is it no problem now?

If you have any performance data about this implementation and
alternative one, could you share it?

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH staging-next] staging: gdm72xx: remove blank lines after an open brace

2014-06-24 Thread Ben Chan
This patch fixes the following checkpatch warning:

  CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: Ben Chan benc...@chromium.org
---
 drivers/staging/gdm72xx/gdm_usb.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_usb.c 
b/drivers/staging/gdm72xx/gdm_usb.c
index 78d6667..256059c 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -632,7 +632,6 @@ static void gdm_usb_disconnect(struct usb_interface *intf)
if (idProduct != EMERGENCY_PID 
bConfigurationValue != DOWNLOAD_CONF_VALUE 
(idProduct  B_DOWNLOAD) == 0) {
-
udev = phy_dev-priv_dev;
udev-usbdev = NULL;
 
@@ -710,10 +709,8 @@ static int k_mode_thread(void *arg)
int ret;
 
while (!k_mode_stop) {
-
spin_lock_irqsave(k_lock, flags2);
while (!list_empty(k_list)) {
-
udev = list_entry(k_list.next, struct usbwm_dev, list);
tx = udev-tx;
rx = udev-rx;
-- 
2.0.0.526.g5318336

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Documentation: Update remove_from_page_cache with delete_from_page_cache

2014-06-24 Thread Lei Li


On 06/23/2014 05:23 PM, Michal Hocko wrote:

On Mon 23-06-14 17:11:19, Lei Li wrote:

remove_from_page_cache has been renamed to delete_from_page_cache
since Commit 702cfbf9 (mm: goodbye remove_from_page_cache()), adapt
to it in Memcg documentation.

Signed-off-by: Lei Li li...@linux.vnet.ibm.com

This conflicts with the current mmotm tree because of Johannes' {un}charge 
rewrite.
Anyway the comment is not up-to-date anyway. __delete_from_page_cache is
called from more places and I do not see quite a good reason why to keep
this in the documentation.
I would just remove this note as it doesn't serve any useful purpose.


Thanks for your reply.
Just take a quick look at Johannes' patch of rewriting uncharge API. I'll
resend a patch with the note removed.


Thanks,

Lei




---
  Documentation/cgroups/memcg_test.txt | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/cgroups/memcg_test.txt 
b/Documentation/cgroups/memcg_test.txt
index 80ac454..b2d6ccc 100644
--- a/Documentation/cgroups/memcg_test.txt
+++ b/Documentation/cgroups/memcg_test.txt
@@ -171,10 +171,10 @@ Under below explanation, we assume 
CONFIG_MEM_RES_CTRL_SWAP=y.
- add_to_page_cache_locked().
  
  	uncharged at

-   - __remove_from_page_cache().
+   - __delete_from_page_cache().
  
  	The logic is very clear. (About migration, see below)

-   Note: __remove_from_page_cache() is called by remove_from_page_cache()
+   Note: __delete_from_page_cache() is called by delete_from_page_cache()
and __remove_mapping().
  
  6. Shmem(tmpfs) Page Cache

--
1.8.5.3

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majord...@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: a href=mailto:d...@kvack.org; em...@kvack.org /a


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/8] mm: add page cache limit and reclaim feature

2014-06-24 Thread Michal Hocko
On Tue 24-06-14 10:25:32, Xishi Qiu wrote:
 On 2014/6/23 19:29, Michal Hocko wrote:
[...]
  This doesn't make much sense to me. So you have a problem with latency
  caused by direct reclaim so you add a new way of direct page cache
  reclaim.
  
  A user process produces page cache frequently, so free memory is not
  enough after running a long time. Slow path takes much more time because 
  direct reclaim. And kswapd will reclaim memory too, but not much. Thus it
  always triggers slow path. this will cause performance regression.
  
  If I were you I would focus on why the reclaim doesn't catch up with the
  page cache users. The mechanism you are proposing in unacceptable.
 
 Hi Michal,
 
 Do you mean why the reclaim is slower than page cache increase?
 
 I think there are two reasons:
 1. kswapd and direct_reclaim will be triggered only when there is not 
 enough memory(e.g. __alloc_pages_slowpath()). That means it will not 
 reclaim when memory is enough(e.g. get_page_from_freelist()).

Yeah and that is the whole point. If you want to start to reclaim earlier
because you need a bigger pillow for the free memory for sudden memory
pressure then increase min_free_kbytes.

 2. __alloc_pages_direct_reclaim
   try_to_free_pages
   nr_to_reclaim = SWAP_CLUSTER_MAX
 And #define SWAP_CLUSTER_MAX 32UL, that means it expect to reclaim 32
 pages. It is too few, if we alloc 2^10 pages in one time.

Maybe _userspace_ allocates that much of memory but it is not faulted
in/allocated by kernel in one shot. Besides that at the time you enter
direct reclaim kswapd should be reclaiming memory to balance zones.
So reclaiming SWAP_CLUSTER_MAX from the direct reclaim shouldn't
matter that much. If it does then show us some numbers to prove it.
SWAP_CLUSTER_MAX is kind of arbitrary number but I haven't seen any
reclaim regression becuse of this value being too small AFAIR.

-- 
Michal Hocko
SUSE Labs
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] slub: fix off by one in number of slab tests

2014-06-24 Thread Joonsoo Kim
min_partial means minimum number of slab cached in node partial
list. So, if nr_partial is less than it, we keep newly empty slab
on node partial list rather than freeing it. But if nr_partial is
equal or greater than it, it means that we have enough partial slabs
so should free newly empty slab. Current implementation missed
the equal case so if we set min_partial is 0, then, at least one slab
could be cached. This is critical problem to kmemcg destroying logic
because it doesn't works properly if some slabs is cached. This patch
fixes this problem.

Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com

diff --git a/mm/slub.c b/mm/slub.c
index c567927..67da14d 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1851,7 +1851,7 @@ redo:
 
new.frozen = 0;
 
-   if (!new.inuse  n-nr_partial  s-min_partial)
+   if (!new.inuse  n-nr_partial = s-min_partial)
m = M_FREE;
else if (new.freelist) {
m = M_PARTIAL;
@@ -1962,7 +1962,7 @@ static void unfreeze_partials(struct kmem_cache *s,
new.freelist, new.counters,
unfreezing slab));
 
-   if (unlikely(!new.inuse  n-nr_partial  s-min_partial)) {
+   if (unlikely(!new.inuse  n-nr_partial = s-min_partial)) {
page-next = discard_page;
discard_page = page;
} else {
@@ -2595,7 +2595,7 @@ static void __slab_free(struct kmem_cache *s, struct page 
*page,
 return;
 }
 
-   if (unlikely(!new.inuse  n-nr_partial  s-min_partial))
+   if (unlikely(!new.inuse  n-nr_partial = s-min_partial))
goto slab_empty;
 
/*
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -tip ] [BUGFIX]: Fix to add a missing pair of braces for error path.

2014-06-24 Thread Namhyung Kim
Hi Masami,

On Mon, 23 Jun 2014 03:17:12 +, Masami Hiramatsu wrote:
 Fix to add a missing pair of braces for error path.
 Commit 36d789a4d75f (perf probe: Improve error message for
 unknown member of data structure) introduced this bug.

 Without this fix, defining an event with global variables
 is always failed, because it always returns -ENOENT if
 the argument is not a local variable.

   
   # perf probe -na vfs_read smp_found_config
 Error: Failed to add events.
   

 With this fix, you can set a global variable for the
 argument of new event.

   
   # perf probe -na vfs_read smp_found_config
   Added new event:
 probe:vfs_read   (on vfs_read with smp_found_config)

   You can now use it in all perf tools, such as:

   perf record -e probe:vfs_read -aR sleep 1
   

 Signed-off-by: Masami Hiramatsu masami.hiramatsu...@hitachi.com
 Reported-by: Patrick Palka patr...@parcs.ath.cx
 Cc: Peter Zijlstra a.p.zijls...@chello.nl
 Cc: Paul Mackerras pau...@samba.org
 Cc: Ingo Molnar mi...@redhat.com
 Cc: Arnaldo Carvalho de Melo a...@kernel.org
 Cc: Jiri Olsa jo...@kernel.org

Acked-by: Namhyung Kim namhy...@kernel.org

Thanks,
Namhyung
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -mm v3 8/8] slab: do not keep free objects/slabs on dead memcg caches

2014-06-24 Thread Vladimir Davydov
Hi,

On Tue, Jun 24, 2014 at 04:25:54PM +0900, Joonsoo Kim wrote:
 On Fri, Jun 13, 2014 at 12:38:22AM +0400, Vladimir Davydov wrote:
  @@ -3368,7 +3379,8 @@ static void free_block(struct kmem_cache *cachep, 
  void **objpp, int nr_objects,
   
  /* fixup slab chains */
  if (page-active == 0) {
  -   if (n-free_objects  n-free_limit) {
  +   if (n-free_objects  n-free_limit ||
  +   memcg_cache_dead(cachep)) {
 
 I'd like to set 0 to free_limit in __kmem_cache_shrink()
 rather than memcg_cache_dead() test here, because memcg_cache_dead()
 is more expensive than it. Is there any problem in this way?

We'd have to be careful on cpu hotplug then, because it may update the
free_limit. Not a big problem though. Will fix.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -mm v3 7/8] slub: make dead memcg caches discard free slabs immediately

2014-06-24 Thread Joonsoo Kim
On Fri, Jun 13, 2014 at 12:38:21AM +0400, Vladimir Davydov wrote:
 Since a dead memcg cache is destroyed only after the last slab allocated
 to it is freed, we must disable caching of empty slabs for such caches,
 otherwise they will be hanging around forever.
 
 This patch makes SLUB discard dead memcg caches' slabs as soon as they
 become empty. To achieve that, it disables per cpu partial lists for
 dead caches (see put_cpu_partial) and forbids keeping empty slabs on per
 node partial lists by setting cache's min_partial to 0 on
 kmem_cache_shrink, which is always called on memcg offline (see
 memcg_unregister_all_caches).
 
 Signed-off-by: Vladimir Davydov vdavy...@parallels.com
 Thanks-to: Joonsoo Kim iamjoonsoo@lge.com
 ---
  mm/slub.c |   11 +++
  1 file changed, 11 insertions(+)
 
 diff --git a/mm/slub.c b/mm/slub.c
 index 52565a9426ef..0d2d1978e62c 100644
 --- a/mm/slub.c
 +++ b/mm/slub.c
 @@ -2064,6 +2064,14 @@ static void put_cpu_partial(struct kmem_cache *s, 
 struct page *page, int drain)
  
   } while (this_cpu_cmpxchg(s-cpu_slab-partial, oldpage, page)
   != oldpage);
 +
 + if (memcg_cache_dead(s)) {
 + unsigned long flags;
 +
 + local_irq_save(flags);
 + unfreeze_partials(s, this_cpu_ptr(s-cpu_slab));
 + local_irq_restore(flags);
 + }
  #endif
  }
  
 @@ -3409,6 +3417,9 @@ int __kmem_cache_shrink(struct kmem_cache *s)
   kmalloc(sizeof(struct list_head) * objects, GFP_KERNEL);
   unsigned long flags;
  
 + if (memcg_cache_dead(s))
 + s-min_partial = 0;
 +
   if (!slabs_by_inuse) {
   /*
* Do not fail shrinking empty slabs if allocation of the

I think that you should move down n-nr_partial test after holding the
lock in __kmem_cache_shrink(). Access to n-nr_partial without node lock
is racy and you can see wrong value. It results in skipping to free empty
slab so your destroying logic could fail.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 -next 0/9] CMA: generalize CMA reserved area management code

2014-06-24 Thread Joonsoo Kim
On Wed, Jun 18, 2014 at 01:51:44PM -0700, Andrew Morton wrote:
 On Tue, 17 Jun 2014 10:25:07 +0900 Joonsoo Kim iamjoonsoo@lge.com wrote:
 
   v2:
  - Although this patchset looks very different with v1, the end result,
  that is, mm/cma.c is same with v1's one. So I carry Ack to patch 6-7.
   
   This patchset is based on linux-next 20140610.
   
   Thanks for taking care of this. I will test it with my setup and if
   everything goes well, I will take it to my -next tree. If any branch
   is required for anyone to continue his works on top of those patches,
   let me know, I will also prepare it.
  
  Hello,
  
  I'm glad to hear that. :)
  But, there is one concern. As you already know, I am preparing further
  patches (Aggressively allocate the pages on CMA reserved memory). It
  may be highly related to MM branch and also slightly depends on this CMA
  changes. In this case, what is the best strategy to merge this
  patchset? IMHO, Anrew's tree is more appropriate branch. If there is
  no issue in this case, I am willing to develope further patches based
  on your tree.
 
 That's probably easier.  Marek, I'll merge these into -mm (and hence
 -next and git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git)
 and shall hold them pending you review/ack/test/etc, OK?

Hello, Marek.

Could you share your decision about this patchset?

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/1] sound/soc/omap/mcbsp.c: remove unnecessary null test before kfree

2014-06-24 Thread Peter Ujfalusi
Hi Fabian,

On 06/23/2014 07:33 PM, Fabian Frederick wrote:
 Fix checkpatch warning:
 WARNING: kfree(NULL) is safe this check is probably not required

can you send the same patch to alsa-devel with subject:
ASoC: mcbsp:  remove unnecessary null test before kfree

You can add my:
Acked-by: Peter Ujfalusi peter.ujfal...@ti.com

 
 Cc: Peter Ujfalusi peter.ujfal...@ti.com
 Cc: Jarkko Nikula jarkko.nik...@bitmer.com
 Cc: linux-o...@vger.kernel.org
 Signed-off-by: Fabian Frederick f...@skynet.be
 ---
  sound/soc/omap/mcbsp.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
 
 diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
 index 86c7538..68a1252 100644
 --- a/sound/soc/omap/mcbsp.c
 +++ b/sound/soc/omap/mcbsp.c
 @@ -621,8 +621,7 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
   mcbsp-reg_cache = NULL;
   spin_unlock(mcbsp-lock);
  
 - if (reg_cache)
 - kfree(reg_cache);
 + kfree(reg_cache);
  }
  
  /*
 


-- 
Péter
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] lib: idr: fix out-of-bounds pointer dereference

2014-06-24 Thread Lai Jiangshan

326cf0f0f308 (idr: fix top layer handling) enlarged the pa array.
But the additional +1 space is only used in id-allocation, it is free
in other usage, (paa may point to the additional +1 space, but not 
dereference it).
so you can reuse it.

In the 3 functions your patch touched:
-   struct idr_layer ***paa = pa[0];
+   struct idr_layer ***paa = pa[1];


I don't reject your patch, I had review it.

Reviewed-by: Lai Jiangshan la...@cn.fujitsu.com

The reason why I'm still muttering here is that I wish a simple solution
to fix the problem. And:
1) your patch also makes use of the additional +1 @pa space: *++paa = p
2) your patch may slight enlarge the function body.
3) I think you patch reduces the readability a little although the idr code
   itself is already shit.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -mm v3 8/8] slab: do not keep free objects/slabs on dead memcg caches

2014-06-24 Thread Vladimir Davydov
On Tue, Jun 24, 2014 at 04:38:41PM +0900, Joonsoo Kim wrote:
 On Fri, Jun 13, 2014 at 12:38:22AM +0400, Vladimir Davydov wrote:
  @@ -3462,6 +3474,17 @@ static inline void __cache_free(struct kmem_cache 
  *cachep, void *objp,
   
  kmemcheck_slab_free(cachep, objp, cachep-object_size);
   
  +#ifdef CONFIG_MEMCG_KMEM
  +   if (unlikely(!ac)) {
  +   int nodeid = page_to_nid(virt_to_page(objp));
  +
  +   spin_lock(cachep-node[nodeid]-list_lock);
  +   free_block(cachep, objp, 1, nodeid);
  +   spin_unlock(cachep-node[nodeid]-list_lock);
  +   return;
  +   }
  +#endif
  +
 
 And, please document intention of this code. :)

Sure.

 And, you said that this way of implementation would be slow because
 there could be many object in dead caches and this implementation
 needs node spin_lock on each object freeing. Is it no problem now?

It may be :(

 If you have any performance data about this implementation and
 alternative one, could you share it?

I haven't (shame on me!). I'll do some testing today and send you the
results.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 3/3] sched: Rework check_for_tasks()

2014-06-24 Thread Kirill Tkhai

1)Iterate throw all of threads in the system.
  Check for all threads, not only for group leaders.

2)Check for p-on_rq instead of p-state and cputime.
  Preempted task in !TASK_RUNNING state  OR just
  created task may be queued, that we want to be
  reported too.

3)Use read_lock() instead of write_lock().
  This function does not change any structures, and
  read_lock() is enough.

Signed-off-by: Kirill Tkhai ktk...@parallels.com
CC: Konstantin Khorenko khore...@parallels.com
CC: Ben Segall bseg...@google.com
CC: Paul Turner p...@google.com
CC: Srikar Dronamraju sri...@linux.vnet.ibm.com
CC: Mike Galbraith umgwanakikb...@gmail.com
CC: Peter Zijlstra pet...@infradead.org
CC: Ingo Molnar mi...@kernel.org
---
 kernel/cpu.c |   33 -
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/kernel/cpu.c b/kernel/cpu.c
index a343bde..81e2a38 100644
--- a/kernel/cpu.c
+++ b/kernel/cpu.c
@@ -274,21 +274,28 @@ void clear_tasks_mm_cpumask(int cpu)
rcu_read_unlock();
 }
 
-static inline void check_for_tasks(int cpu)
+static inline void check_for_tasks(int dead_cpu)
 {
-   struct task_struct *p;
-   cputime_t utime, stime;
+   struct task_struct *g, *p;
 
-   write_lock_irq(tasklist_lock);
-   for_each_process(p) {
-   task_cputime(p, utime, stime);
-   if (task_cpu(p) == cpu  p-state == TASK_RUNNING 
-   (utime || stime))
-   pr_warn(Task %s (pid = %d) is on cpu %d (state = %ld, 
flags = %x)\n,
-   p-comm, task_pid_nr(p), cpu,
-   p-state, p-flags);
-   }
-   write_unlock_irq(tasklist_lock);
+   read_lock_irq(tasklist_lock);
+   do_each_thread(g, p) {
+   if (!p-on_rq)
+   continue;
+   /*
+* We do the check with unlocked task_rq(p)-lock.
+* Order the reading to do not warn about a task,
+* which was running on this cpu in the past, and
+* it's just been woken on another cpu.
+*/
+   rmb();
+   if (task_cpu(p) != dead_cpu)
+   continue;
+
+   pr_warn(Task %s (pid=%d) is on cpu %d (state=%ld, flags=%x)\n,
+   p-comm, task_pid_nr(p), dead_cpu, p-state, p-flags);
+   } while_each_thread(g, p);
+   read_unlock_irq(tasklist_lock);
 }
 
 struct take_cpu_down_param {



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 1/3] sched/fair: Disable runtime_enabled on dying rq

2014-06-24 Thread Kirill Tkhai
We kill rq-rd on the CPU_DOWN_PREPARE stage:

cpuset_cpu_inactive - cpuset_update_active_cpus - 
partition_sched_domains -
- cpu_attach_domain - rq_attach_root - set_rq_offline

This unthrottles all throttled cfs_rqs.

But the cpu is still able to call schedule() till

take_cpu_down-__cpu_disable()

is called from stop_machine.

This case the tasks from just unthrottled cfs_rqs are pickable
in a standard scheduler way, and they are picked by dying cpu.
The cfs_rqs becomes throttled again, and migrate_tasks()
in migration_call skips their tasks (one more unthrottle
in migrate_tasks()-CPU_DYING does not happen, because rq-rd
is already NULL).

Patch sets runtime_enabled to zero. This guarantees, the runtime
is not accounted, and the cfs_rqs won't exceed given
cfs_rq-runtime_remaining = 1, and tasks will be pickable
in migrate_tasks(). runtime_enabled is recalculated again
when rq becomes online again.

Ben Segall also noticed, we always enable runtime in
tg_set_cfs_bandwidth(). Actually, we should do that for online
cpus only. To fix that, we check if a cpu is online when
its rq is locked. This guarantees we do not have races with
set_rq_offline(), which also requires rq-lock.

v2: Fix race with tg_set_cfs_bandwidth().
Move cfs_rq-runtime_enabled=0 above unthrottle_cfs_rq().

Signed-off-by: Kirill Tkhai ktk...@parallels.com
CC: Konstantin Khorenko khore...@parallels.com
CC: Ben Segall bseg...@google.com
CC: Paul Turner p...@google.com
CC: Srikar Dronamraju sri...@linux.vnet.ibm.com
CC: Mike Galbraith umgwanakikb...@gmail.com
CC: Peter Zijlstra pet...@infradead.org
CC: Ingo Molnar mi...@kernel.org
---
 kernel/sched/core.c |   15 +++
 kernel/sched/fair.c |   22 ++
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7f3063c..707a3c5 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -7842,11 +7842,18 @@ static int tg_set_cfs_bandwidth(struct task_group *tg, 
u64 period, u64 quota)
struct rq *rq = cfs_rq-rq;
 
raw_spin_lock_irq(rq-lock);
-   cfs_rq-runtime_enabled = runtime_enabled;
-   cfs_rq-runtime_remaining = 0;
+   /*
+* Do not enable runtime on offline runqueues. We specially
+* make it disabled in unthrottle_offline_cfs_rqs().
+*/
+   if (cpu_online(i)) {
+   cfs_rq-runtime_enabled = runtime_enabled;
+   cfs_rq-runtime_remaining = 0;
+
+   if (cfs_rq-throttled)
+   unthrottle_cfs_rq(cfs_rq);
+   }
 
-   if (cfs_rq-throttled)
-   unthrottle_cfs_rq(cfs_rq);
raw_spin_unlock_irq(rq-lock);
}
if (runtime_was_enabled  !runtime_enabled)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1f9c457..5616d23 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3776,6 +3776,19 @@ static void destroy_cfs_bandwidth(struct cfs_bandwidth 
*cfs_b)
hrtimer_cancel(cfs_b-slack_timer);
 }
 
+static void __maybe_unused update_runtime_enabled(struct rq *rq)
+{
+   struct cfs_rq *cfs_rq;
+
+   for_each_leaf_cfs_rq(rq, cfs_rq) {
+   struct cfs_bandwidth *cfs_b = cfs_rq-tg-cfs_bandwidth;
+
+   raw_spin_lock(cfs_b-lock);
+   cfs_rq-runtime_enabled = cfs_b-quota != RUNTIME_INF;
+   raw_spin_unlock(cfs_b-lock);
+   }
+}
+
 static void __maybe_unused unthrottle_offline_cfs_rqs(struct rq *rq)
 {
struct cfs_rq *cfs_rq;
@@ -3789,6 +3802,12 @@ static void __maybe_unused 
unthrottle_offline_cfs_rqs(struct rq *rq)
 * there's some valid quota amount
 */
cfs_rq-runtime_remaining = 1;
+   /*
+* Offline rq is schedulable till cpu is completely disabled
+* in take_cpu_down(), so we prevent new cfs throttling here.
+*/
+   cfs_rq-runtime_enabled = 0;
+
if (cfs_rq_throttled(cfs_rq))
unthrottle_cfs_rq(cfs_rq);
}
@@ -3832,6 +3851,7 @@ static inline struct cfs_bandwidth 
*tg_cfs_bandwidth(struct task_group *tg)
return NULL;
 }
 static inline void destroy_cfs_bandwidth(struct cfs_bandwidth *cfs_b) {}
+static inline void update_runtime_enabled(struct rq *rq) {}
 static inline void unthrottle_offline_cfs_rqs(struct rq *rq) {}
 
 #endif /* CONFIG_CFS_BANDWIDTH */
@@ -7325,6 +7345,8 @@ void trigger_load_balance(struct rq *rq)
 static void rq_online_fair(struct rq *rq)
 {
update_sysctl();
+
+   update_runtime_enabled(rq);
 }
 
 static void rq_offline_fair(struct rq *rq)



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[PATCH v2 2/3] sched/rt: __disable_runtime: Enqueue just unthrottled rt_rq back on the stack

2014-06-24 Thread Kirill Tkhai

Make rt_rq available for pick_next_task(). Otherwise, their tasks
stay prisoned long time till dead cpu becomes alive again.

Signed-off-by: Kirill Tkhai ktk...@parallels.com
CC: Konstantin Khorenko khore...@parallels.com
CC: Ben Segall bseg...@google.com
CC: Paul Turner p...@google.com
CC: Srikar Dronamraju sri...@linux.vnet.ibm.com
CC: Mike Galbraith umgwanakikb...@gmail.com
CC: Peter Zijlstra pet...@infradead.org
CC: Ingo Molnar mi...@kernel.org
---
 kernel/sched/rt.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
index a490831..671a8b5 100644
--- a/kernel/sched/rt.c
+++ b/kernel/sched/rt.c
@@ -740,6 +740,9 @@ static void __disable_runtime(struct rq *rq)
rt_rq-rt_throttled = 0;
raw_spin_unlock(rt_rq-rt_runtime_lock);
raw_spin_unlock(rt_b-rt_runtime_lock);
+
+   /* Make rt_rq available for pick_next_task() */
+   sched_rt_rq_enqueue(rt_rq);
}
 }
 



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 0/3] Fix shutdown of cpu which having throttled rq

2014-06-24 Thread Kirill Tkhai
This is a result of discussion [PATCH 1/2] sched: Rework migrate_tasks():

https://lkml.org/lkml/2014/6/11/166

The problem is cfs_rq and rt_rq may stay throttled in the moment
of task migration from dead cpu. This patch fixes that for fair
and RT classes. No fix for deadline class yet, it's coming soon.

v2: [1/3]Collision with tg_set_cfs_bandwidth() found by Ben Segall.
 Code movement.

---

Kirill Tkhai (3):
  sched/fair: Disable runtime_enabled on dying rq
  sched/rt: __disable_runtime: Enqueue just unthrottled rt_rq back on the 
stack
  sched: Rework check_for_tasks()


 kernel/cpu.c|   33 -
 kernel/sched/core.c |   15 +++
 kernel/sched/fair.c |   22 ++
 kernel/sched/rt.c   |3 +++
 4 files changed, 56 insertions(+), 17 deletions(-)

--
Signed-off-by: Kirill Tkhai ktk...@parallels.com


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: mvebu: Fix the improper use of the compatible string armada38x using a wildcard

2014-06-24 Thread Gregory CLEMENT
Hi Jason,

 This fix should be merged in 3.16 and maybe sent as a fix for 3.15
 too.

[...]

 Applied to mvebu/dt with Andrew's Ack.

I think it should go mvebu/fixes as this patch modifies the binding,
sooner is better.


Thanks,

Gregory



-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 3/10] video: use safer test on the result of find_first_zero_bit

2014-06-24 Thread Tomi Valkeinen
On 23/06/14 17:12, Julia Lawall wrote:
 On Mon, 23 Jun 2014, Tomi Valkeinen wrote:
 
 On 04/06/14 12:07, Julia Lawall wrote:
 From: Julia Lawall julia.law...@lip6.fr

 Find_first_zero_bit considers BITS_PER_LONG bits at a time, and thus may
 return a larger number than the maximum position argument if that position
 is not a multiple of BITS_PER_LONG.

 Thanks, queued for 3.17.
 
 No, sorry you can drop it.  It doesn't hurt anything, but it is not
 necessary either.  Returning a larger number is actually not possible.

Ok, dropped.

 Tomi




signature.asc
Description: OpenPGP digital signature


[PATCH] USB: ehci-pci: USB host controller support for Intel Quark X1000

2014-06-24 Thread Chen, Alvin
From: Bryan O'Donoghue bryan.odonog...@intel.com

This patch is to enable USB host controller for Intel Quark X1000. Add pci 
quirks
to adjust the packet buffer in/out threshold value, and ensure EHCI packet 
buffer
i/o threshold value is reconfigured to half.

Signed-off-by: Bryan O'Donoghue bryan.odonog...@intel.com
Signed-off-by: Alvin (Weike) Chen alvin.c...@intel.com
---
 drivers/usb/host/ehci-pci.c   |4 
 drivers/usb/host/pci-quirks.c |   42 +
 drivers/usb/host/pci-quirks.h |2 ++
 3 files changed, 48 insertions(+)

diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 3e86bf4..33cfa23 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -50,6 +50,10 @@ static int ehci_pci_reinit(struct ehci_hcd *ehci, struct 
pci_dev *pdev)
if (!retval)
ehci_dbg(ehci, MWI active\n);
 
+   /* Reset the threshold limit */
+   if(unlikely(usb_is_intel_qrk(pdev)))
+   usb_set_qrk_bulk_thresh(pdev);
+
return 0;
 }
 
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 00661d3..1ea8803 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -823,6 +823,48 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done,
return -ETIMEDOUT;
 }
 
+#define PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC0x0939
+bool usb_is_intel_qrk(struct pci_dev *pdev)
+{
+   return pdev-vendor == PCI_VENDOR_ID_INTEL 
+   pdev-device == PCI_DEVICE_ID_INTEL_QUARK_X1000_SOC;
+
+}
+EXPORT_SYMBOL_GPL(usb_is_intel_qrk);
+
+#define EHCI_INSNREG01 0x84
+#define EHCI_INSNREG01_THRESH  0x007F007F  /* Threshold value */
+void usb_set_qrk_bulk_thresh(struct pci_dev *pdev)
+{
+   void __iomem *base, *op_reg_base;
+   u8 cap_length;
+   u32 val;
+
+   if (!mmio_resource_enabled(pdev, 0))
+   return;
+
+   base = pci_ioremap_bar(pdev, 0);
+   if (base == NULL)
+   return;
+
+   cap_length = readb(base);
+   op_reg_base = base + cap_length;
+
+   val = readl(op_reg_base + EHCI_INSNREG01);
+   dev_printk(KERN_INFO, pdev-dev, INSNREG01 is 0x%08x\n, val);
+
+   val = EHCI_INSNREG01_THRESH;
+
+   writel(val, op_reg_base + EHCI_INSNREG01);
+
+   val = readl(op_reg_base + EHCI_INSNREG01);
+   dev_printk(KERN_INFO, pdev-dev, INSNREG01 is 0x%08x\n, val);
+
+   iounmap(base);
+
+}
+EXPORT_SYMBOL_GPL(usb_set_qrk_bulk_thresh);
+
 /*
  * Intel's Panther Point chipset has two host controllers (EHCI and xHCI) that
  * share some number of ports.  These ports can be switched between either
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
index c622ddf..617c22b 100644
--- a/drivers/usb/host/pci-quirks.h
+++ b/drivers/usb/host/pci-quirks.h
@@ -14,6 +14,8 @@ void usb_amd_quirk_pll_enable(void);
 void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
 void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
 void sb800_prefetch(struct device *dev, int on);
+bool usb_is_intel_qrk(struct pci_dev *pdev);
+void usb_set_qrk_bulk_thresh(struct pci_dev *pdev);
 #else
 struct pci_dev;
 static inline void usb_amd_quirk_pll_disable(void) {}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH staging-next] staging: gdm72xx: fix block comment style

2014-06-24 Thread Ben Chan
This patch fixes the following checkpatch warnings, which are issued
when the gdm72xx driver is moved out of staging into drivers/net/wimax:

  WARNING: networking block comments don't use an empty /* line, use /* 
Comment...
  WARNING: networking block comments start with * on subsequent lines
  WARNING: networking block comments put the trailing */ on a separate line

Signed-off-by: Ben Chan benc...@chromium.org
---
 drivers/staging/gdm72xx/gdm_sdio.c  | 7 ++-
 drivers/staging/gdm72xx/gdm_usb.c   | 6 ++
 drivers/staging/gdm72xx/gdm_wimax.c | 5 +++--
 drivers/staging/gdm72xx/hci.h   | 4 +---
 4 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/gdm72xx/gdm_sdio.c 
b/drivers/staging/gdm72xx/gdm_sdio.c
index 7398d45..0c6a3eb 100644
--- a/drivers/staging/gdm72xx/gdm_sdio.c
+++ b/drivers/staging/gdm72xx/gdm_sdio.c
@@ -439,9 +439,7 @@ static int gdm_sdio_send(void *priv_dev, void *data, int 
len,
return 0;
 }
 
-/*
- * Handle the HCI, WIMAX_SDU_TX_FLOW.
- */
+/* Handle the HCI, WIMAX_SDU_TX_FLOW. */
 static int control_sdu_tx_flow(struct sdiowm_dev *sdev, u8 *hci_data, int len)
 {
struct tx_cxt *tx = sdev-tx;
@@ -462,8 +460,7 @@ static int control_sdu_tx_flow(struct sdiowm_dev *sdev, u8 
*hci_data, int len)
tx-stop_sdu_tx = 0;
if (tx-can_send)
schedule_work(sdev-ws);
-   /*
-* If free buffer for sdu tx doesn't exist, then tx queue
+   /* If free buffer for sdu tx doesn't exist, then tx queue
 * should not be woken. For this reason, don't pass the command,
 * START_SDU_TX.
 */
diff --git a/drivers/staging/gdm72xx/gdm_usb.c 
b/drivers/staging/gdm72xx/gdm_usb.c
index 78d6667..2325d41 100644
--- a/drivers/staging/gdm72xx/gdm_usb.c
+++ b/drivers/staging/gdm72xx/gdm_usb.c
@@ -338,8 +338,7 @@ static int gdm_usb_send(void *priv_dev, void *data, int len,
t-callback = cb;
t-cb_data = cb_data;
 
-   /*
-* In some cases, USB Module of WiMax is blocked when data size is
+   /* In some cases, USB Module of WiMax is blocked when data size is
 * the multiple of 512. So, increment length by one in that case.
 */
if ((len % 512) == 0)
@@ -439,8 +438,7 @@ static void gdm_usb_rcv_complete(struct urb *urb)
list_for_each_entry(t, tx-sdu_list, list) {
usb_submit_urb(t-urb, GFP_ATOMIC);
}
-   /*
-* If free buffer for sdu tx doesn't
+   /* If free buffer for sdu tx doesn't
 * exist, then tx queue should not be
 * woken. For this reason, don't pass
 * the command, START_SDU_TX.
diff --git a/drivers/staging/gdm72xx/gdm_wimax.c 
b/drivers/staging/gdm72xx/gdm_wimax.c
index e5e5115..833d0d4 100644
--- a/drivers/staging/gdm72xx/gdm_wimax.c
+++ b/drivers/staging/gdm72xx/gdm_wimax.c
@@ -580,8 +580,9 @@ static int gdm_wimax_ioctl(struct net_device *dev, struct 
ifreq *ifr, int cmd)
return ret;
} else if (req-cmd == SIOCS_DATA) {
if (req-data_id == SIOC_DATA_FSM) {
-   /*NOTE: gdm_update_fsm should be called
-   before gdm_wimax_ioctl_set_data is called*/
+   /* NOTE: gdm_update_fsm should be called
+* before gdm_wimax_ioctl_set_data is called.
+*/
gdm_update_fsm(dev,
   (struct fsm_s *)req-data.buf);
}
diff --git a/drivers/staging/gdm72xx/hci.h b/drivers/staging/gdm72xx/hci.h
index 2485a37..059ba00 100644
--- a/drivers/staging/gdm72xx/hci.h
+++ b/drivers/staging/gdm72xx/hci.h
@@ -112,13 +112,11 @@
 #define W_SCAN_ALL_SUBSCRIPTION1
 #define W_SCAN_SPECIFIED_SUBSCRIPTION  2
 
-/*
- * TLV
+/* TLV
  *
  * [31:31] indicates the type is composite.
  * [30:16] is the length of the type. 0 length means length is variable.
  * [15:0] is the actual type.
- *
  */
 #define TLV_L(x)   (((x)  16)  0xff)
 #define TLV_T(x)   ((x)  0xff)
-- 
2.0.0.526.g5318336

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] USB: ehci-pci: Add support for Intel Quark X1000 USB host controller

2014-06-24 Thread Chen, Alvin
From: Alvin (Weike) Chen alvin.c...@intel.com

Hi,
Intel Quark X1000 consists of one USB host controller which can be PCI 
enumerated.
But the exsiting EHCI-PCI framework doesn't support it. Thus, we enable it to 
support
Intel Quark X1000 USB host controller by adding pci quirks to configure buffer 
i/o threshold 
value to half.

Bryan O'Donoghue (1):
  Quark USB host

 drivers/usb/host/ehci-pci.c   |4 
 drivers/usb/host/pci-quirks.c |   42 +
 drivers/usb/host/pci-quirks.h |2 ++
 3 files changed, 48 insertions(+)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] slub: reduce duplicate creation on the first object

2014-06-24 Thread Wei Yang
When a kmem_cache is created with ctor, each object in the kmem_cache will be
initialized before ready to use. While in slub implementation, the first
object will be initialized twice.

This patch reduces the duplication of initialization of the first object.

Fix commit 7656c72b: SLUB: add macros for scanning objects in a slab.

Signed-off-by: Wei Yang weiy...@linux.vnet.ibm.com
---
 mm/slub.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index b2b0473..beefd45 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1433,7 +1433,7 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t 
flags, int node)
memset(start, POISON_INUSE, PAGE_SIZE  order);
 
last = start;
-   for_each_object(p, s, start, page-objects) {
+   for_each_object(p, s, start + s-size, page-objects - 1) {
setup_object(s, page, last);
set_freepointer(s, last, p);
last = p;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/6] OF: Utility helper functions for dynamic nodes

2014-06-24 Thread Alexander Sverdlin
Hi Pantelis, Grant,

On 23/06/14 20:33, Ioan Nicu wrote:
 On 22/06/14 11:40, ext Pantelis Antoniou wrote:
 Introduce helper functions for working with the live DT tree,
 all of them related to dynamically adding/removing nodes and
 properties.

 __of_copy_property() copies a property dynamically
 __of_create_empty_node() creates an empty node

 Bug fix about prop-len == 0 by Ionut Nicu ioan.nicu@nsn.com

 Are you sure about this? (see below...)

 
 Alexander is right, my fix was lost even though it's mentioned in this patch.
 
 Signed-off-by: Pantelis Antoniou pantelis.anton...@konsulko.com
 ---

 [snip]
 +
 +  if (prop-length  0) {
^
 Seems, that length==0 case will still produce value==NULL results,
 which will brake some checks in the kernel... Or am I missing something in
 the new version?


 prop-value will be set to NULL, and length will be set to zero (kzalloc).
 This is a normal zero length property.

 I don't know of any place in the kernel accessing the value if 
 prop-length==0

 
 We have a simple use case. We have an overlay which adds an interrupt 
 controller.
 If you look in drivers/of/irq.c, in of_irq_parse_raw():
 
 [...]
   /* Now start the actual proper walk of the interrupt tree */
   while (ipar != NULL) {
   /* Now check if cursor is an interrupt-controller and if it is
* then we are done
*/
   if (of_get_property(ipar, interrupt-controller, NULL) !=

We have to define, if it's allowed for an empty property to have NULL value.
Several places in the kernel use of_get_property() to check for property 
existence.
We either have to make a tree-wide patch and replace of_get_property() with 
of_find_property() in those cases,
or ensure value != NULL in this copy function...

Grant, what do you think?

   NULL) {
   pr_debug( - got it !\n);
   return 0;
   }
 [...]
 
 A node is identified as an interrupt controller if it has a zero-length 
 property
 called interrupt-controller but with a non-NULL value.
 
 My proposed fix for this was to remove the if () condition. propn-value will 
 be
 allocated with kmalloc(0) which returns ZERO_SIZE_PTR which is != NULL.
 
 

 [snip]

 +
 #endif /* _LINUX_OF_H */


 -- 
 Best regards,
 Alexander Sverdlin.

 Regards

 -- Pantelis

 
 Regards,
 Ionut Nicu
 

-- 
Best regards,
Alexander Sverdlin.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/6] OF: Utility helper functions for dynamic nodes

2014-06-24 Thread Alexander Sverdlin
Hi!

On 23/06/14 21:13, ext Pantelis Antoniou wrote:

[...]

 I don't know of any place in the kernel accessing the value if 
 prop-length==0


 We have a simple use case. We have an overlay which adds an interrupt 
 controller.
 If you look in drivers/of/irq.c, in of_irq_parse_raw():

 [...]
  /* Now start the actual proper walk of the interrupt tree */
  while (ipar != NULL) {
  /* Now check if cursor is an interrupt-controller and if it is
   * then we are done
   */
  if (of_get_property(ipar, interrupt-controller, NULL) !=
  NULL) {
  pr_debug( - got it !\n);
  return 0;
  }
 [...]

 A node is identified as an interrupt controller if it has a zero-length 
 property
 called interrupt-controller but with a non-NULL value.

 My proposed fix for this was to remove the if () condition. propn-value 
 will be
 allocated with kmalloc(0) which returns ZERO_SIZE_PTR which is != NULL.

 
 If that's the case, the code in irq.c is wrong.
 
 interrupt-controller is a bool property; the correct call to use is 
 of_property_read_bool()
 which returns true or false when the value is defined.

No, it's not bool... It's an existence of a void property. 

 The use of of_get_property is a bug here. It is perfectly valid for a 
 property to have a
 NULL value when length = 0.

of_find_property() would be really correct in this particular case...

-- 
Best regards,
Alexander Sverdlin.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v6 net-next 1/4] net: flow_dissector: avoid multiple calls in eBPF

2014-06-24 Thread Daniel Borkmann

On 06/20/2014 11:56 PM, Chema Gonzalez wrote:
...

Anyway as I said before I'm not excited about either.
I don't think we should be adding classic BPF extensions any more.
The long term headache of supporting classic BPF extensions
outweighs the short term benefits.



I see a couple of issues with (effectively) freezing classic BPF
development while waiting for direct eBPF access to happen. The first
one is that the kernel has to accept it. I can see many questions
about this, especially security and usability (I'll send an email
about the split BPF out of core later). Now, the main issue is
whether/when the tools will support it. IMO, this is useful iff I can
quickly write/reuse filters and run tcpdump filters based on them. I'm
trying to get upstream libpcap to accept support for raw (classic) BPF
filters, and it's taking a long time. I can imagine how they may be
less receptive about supporting a Linux-only eBPF mechanism. Tools do
matter.



This is a high-level decision, more than a technical one. Do we want
to freeze classic BPF development in linux, even before we have a
complete eBPF replacement, and zero eBPF tool (libpcap) support?


In my opinion, I don't think we strictly have to hard-freeze it. The
only concern I see is that conceptually hooking into the flow_dissector
to read out all keys for further processing on top of them 1) sort
of breaks/bypasses the concept of BPF (as it's actually the task of
BPF itself for doing this), 2) effectively freezes any changes to the
flow_dissector as BPF applications making use of it now depend on the
provided offsets for doing further processing on top of them, 3) it
can already be resolved by (re-)writing the kernel's flow dissector
in C-like syntax in user space iff eBPF can be loaded from there with
similar performance. So shouldn't we rather work towards that as a
more generic approach/goal in the mid term and w/o having to maintain
a very short term intermediate solution that we need to special case
along the code and have to carry around forever ...


Grepping through libpcap code, which tries to be platform independent,
it seems after all the years, the only thing where you can see support
for in their code is SKF_AD_PKTTYPE and SKF_AD_PROTOCOL. Perhaps they



Actually they recently added MOD/XOR support. Woo-hoo!


Great to hear, still quite some things missing, unfortunately. :/


just don't care, perhaps they do, who knows, but it looks to me a bit
that they are reluctant to these improvements, maybe for one reason
that other OSes don't support it.



 From the comments in the MOD/XOR patch, the latter seem to be the issue.


Yep, that's the pain you need to live with when trying to be multi
OS capable. I assume in its very origin, the [libpcap] compiler was
probably not designed for handling such differences in various
operating systems (likely even ran in user space from libpcap directly).


That was also one of the reasons that
led me to start writing bpf_asm (net/tools/) for having a small DSL
for more easily trying out BPF code while having _full_ control over it.

Maybe someone should start a binary-compatible Linux-only version of
libpcap, where tcpdump will transparently make use of these low level
improvements eventually. /rant ;)



There's too much code dependent on libpcap to make a replacement possible.


Well, I wrote binary-compatible, so applications on top of it won't
care much if it could be used as drop-in replacement. That would perhaps
also allow for fanout and other features to be used ...
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] slub: fix off by one in number of slab tests

2014-06-24 Thread Vladimir Davydov
On Tue, Jun 24, 2014 at 04:44:01PM +0900, Joonsoo Kim wrote:
 min_partial means minimum number of slab cached in node partial
 list. So, if nr_partial is less than it, we keep newly empty slab
 on node partial list rather than freeing it. But if nr_partial is
 equal or greater than it, it means that we have enough partial slabs
 so should free newly empty slab. Current implementation missed
 the equal case so if we set min_partial is 0, then, at least one slab
 could be cached. This is critical problem to kmemcg destroying logic
 because it doesn't works properly if some slabs is cached. This patch
 fixes this problem.

Oops, my fault :-(

Thank you for catching this!

 Signed-off-by: Joonsoo Kim iamjoonsoo@lge.com

Acked-by: Vladimir Davydov vdavy...@parallels.com

 
 diff --git a/mm/slub.c b/mm/slub.c
 index c567927..67da14d 100644
 --- a/mm/slub.c
 +++ b/mm/slub.c
 @@ -1851,7 +1851,7 @@ redo:
  
   new.frozen = 0;
  
 - if (!new.inuse  n-nr_partial  s-min_partial)
 + if (!new.inuse  n-nr_partial = s-min_partial)
   m = M_FREE;
   else if (new.freelist) {
   m = M_PARTIAL;
 @@ -1962,7 +1962,7 @@ static void unfreeze_partials(struct kmem_cache *s,
   new.freelist, new.counters,
   unfreezing slab));
  
 - if (unlikely(!new.inuse  n-nr_partial  s-min_partial)) {
 + if (unlikely(!new.inuse  n-nr_partial = s-min_partial)) {
   page-next = discard_page;
   discard_page = page;
   } else {
 @@ -2595,7 +2595,7 @@ static void __slab_free(struct kmem_cache *s, struct 
 page *page,
  return;
  }
  
 - if (unlikely(!new.inuse  n-nr_partial  s-min_partial))
 + if (unlikely(!new.inuse  n-nr_partial = s-min_partial))
   goto slab_empty;
  
   /*
 -- 
 1.7.9.5
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 02/13] mm, compaction: defer each zone individually instead of preferred zone

2014-06-24 Thread Joonsoo Kim
On Fri, Jun 20, 2014 at 05:49:32PM +0200, Vlastimil Babka wrote:
 When direct sync compaction is often unsuccessful, it may become deferred for
 some time to avoid further useless attempts, both sync and async. Successful
 high-order allocations un-defer compaction, while further unsuccessful
 compaction attempts prolong the copmaction deferred period.
 
 Currently the checking and setting deferred status is performed only on the
 preferred zone of the allocation that invoked direct compaction. But 
 compaction
 itself is attempted on all eligible zones in the zonelist, so the behavior is
 suboptimal and may lead both to scenarios where 1) compaction is attempted
 uselessly, or 2) where it's not attempted despite good chances of succeeding,
 as shown on the examples below:
 
 1) A direct compaction with Normal preferred zone failed and set deferred
compaction for the Normal zone. Another unrelated direct compaction with
DMA32 as preferred zone will attempt to compact DMA32 zone even though
the first compaction attempt also included DMA32 zone.
 
In another scenario, compaction with Normal preferred zone failed to 
 compact
Normal zone, but succeeded in the DMA32 zone, so it will not defer
compaction. In the next attempt, it will try Normal zone which will fail
again, instead of skipping Normal zone and trying DMA32 directly.
 
 2) Kswapd will balance DMA32 zone and reset defer status based on watermarks
looking good. A direct compaction with preferred Normal zone will skip
compaction of all zones including DMA32 because Normal was still deferred.
The allocation might have succeeded in DMA32, but won't.
 
 This patch makes compaction deferring work on individual zone basis instead of
 preferred zone. For each zone, it checks compaction_deferred() to decide if 
 the
 zone should be skipped. If watermarks fail after compacting the zone,
 defer_compaction() is called. The zone where watermarks passed can still be
 deferred when the allocation attempt is unsuccessful. When allocation is
 successful, compaction_defer_reset() is called for the zone containing the
 allocated page. This approach should approximate calling defer_compaction()
 only on zones where compaction was attempted and did not yield allocated page.
 There might be corner cases but that is inevitable as long as the decision
 to stop compacting dues not guarantee that a page will be allocated.
 
 During testing on a two-node machine with a single very small Normal zone on
 node 1, this patch has improved success rates in stress-highalloc mmtests
 benchmark. The success here were previously made worse by commit 3a025760fc
 (mm: page_alloc: spill to remote nodes before waking kswapd) as kswapd was
 no longer resetting often enough the deferred compaction for the Normal zone,
 and DMA32 zones on both nodes were thus not considered for compaction.
 
 Signed-off-by: Vlastimil Babka vba...@suse.cz
 Cc: Minchan Kim minc...@kernel.org
 Cc: Mel Gorman mgor...@suse.de
 Cc: Joonsoo Kim iamjoonsoo@lge.com
 Cc: Michal Nazarewicz min...@mina86.com
 Cc: Naoya Horiguchi n-horigu...@ah.jp.nec.com
 Cc: Christoph Lameter c...@linux.com
 Cc: Rik van Riel r...@redhat.com
 Cc: David Rientjes rient...@google.com
 ---
  include/linux/compaction.h |  6 --
  mm/compaction.c| 29 -
  mm/page_alloc.c| 33 ++---
  3 files changed, 46 insertions(+), 22 deletions(-)
 
 diff --git a/include/linux/compaction.h b/include/linux/compaction.h
 index 01e3132..76f9beb 100644
 --- a/include/linux/compaction.h
 +++ b/include/linux/compaction.h
 @@ -22,7 +22,8 @@ extern int sysctl_extfrag_handler(struct ctl_table *table, 
 int write,
  extern int fragmentation_index(struct zone *zone, unsigned int order);
  extern unsigned long try_to_compact_pages(struct zonelist *zonelist,
   int order, gfp_t gfp_mask, nodemask_t *mask,
 - enum migrate_mode mode, bool *contended);
 + enum migrate_mode mode, bool *contended, bool *deferred,
 + struct zone **candidate_zone);
  extern void compact_pgdat(pg_data_t *pgdat, int order);
  extern void reset_isolation_suitable(pg_data_t *pgdat);
  extern unsigned long compaction_suitable(struct zone *zone, int order);
 @@ -91,7 +92,8 @@ static inline bool compaction_restarting(struct zone *zone, 
 int order)
  #else
  static inline unsigned long try_to_compact_pages(struct zonelist *zonelist,
   int order, gfp_t gfp_mask, nodemask_t *nodemask,
 - enum migrate_mode mode, bool *contended)
 + enum migrate_mode mode, bool *contended, bool *deferred,
 + struct zone **candidate_zone)
  {
   return COMPACT_CONTINUE;
  }
 diff --git a/mm/compaction.c b/mm/compaction.c
 index 5175019..7c491d0 100644
 --- a/mm/compaction.c
 +++ b/mm/compaction.c
 @@ -1122,13 +1122,15 @@ int 

Re: [RFC][PATCH 1/3] trace_seq: Move the trace_seq code to lib/

2014-06-24 Thread Johannes Berg
On Mon, 2014-06-23 at 14:04 -0400, Steven Rostedt wrote:

 Ah! I see what you are saying. You are saying that once you are full
 you need to flush. Honestly, the trace_puts() should check the return.
 Perhaps it wants to try again with a shorter string?

Perhaps, but perhaps not? I don't remember exactly the issue that I saw
without the full flag, and it may very well be a purely theoretical
thing too. I don't think I mind either way.

 The full flag means that once we hit full, we are done, no more can be
 written till the buffer is flushed.

Right. Arguably, it was already full or overflowed, but as it now stands
we make sure the data is consistent with the input (or rejected if the
input didn't fit.)

 Is that what we would want from this utility? Or do we want to allow
 the user to try again with a smaller string?

That's a good question - right now of course the first attempt would
make it full, and then any further attempt would fail.

 I was thinking of reversing the error code and have the trace_seq_*()
 return 0 as success and the remaining buffer size on error.

That would make some sense if we wanted to make it post-determined (you
fail, and then you can use the remaining buffer). Maybe it would make
sense to pre-determine that, e.g. by having a function that can reserve
a range, say

 void trace_seq_put_buf(..., int min_len, int max_len,
int *out_avail, void *out_data_ptr)

(of course that prototype needs to be adjusted appropriately)

If less than min_len is available, we could still have the full
semantics.

Either way, I don't really know or even care. I'm only using this
indirectly through the tracing, where I don't think it makes a lot of
sense without the full semantics since afaik the buffers need to be in
the right order in the page(s), and where you likely don't want to cut a
string short since you couldn't continue it on the next page, but you're
clearly the expert on this and I'm probably wrong anyway :)

johannes

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] perf tests: Add test to hit wrong event sched out

2014-06-24 Thread Jiri Olsa
We create single breakpoint event with inherit = true and
create many workload children.

With some luck (which is directly proportional to number of
children) we hit event optimized sched out moving original
(parent) event into one of the child, closing it and causing
wrong measured numbers.

Cc: Arnaldo Carvalho de Melo a...@kernel.org
Cc: Corey Ashford cjash...@linux.vnet.ibm.com
Cc: David Ahern dsah...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Namhyung Kim namhy...@kernel.org
Cc: Paul Mackerras pau...@samba.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Signed-off-by: Jiri Olsa jo...@kernel.org
---
 tools/perf/Makefile.perf   |  1 +
 tools/perf/tests/builtin-test.c|  4 ++
 tools/perf/tests/optimized-sched-out.c | 90 ++
 tools/perf/tests/tests.h   |  1 +
 4 files changed, 96 insertions(+)
 create mode 100644 tools/perf/tests/optimized-sched-out.c

diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 9670a16..29ff74e 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -419,6 +419,7 @@ endif
 endif
 LIB_OBJS += $(OUTPUT)tests/mmap-thread-lookup.o
 LIB_OBJS += $(OUTPUT)tests/thread-mg-share.o
+LIB_OBJS += $(OUTPUT)tests/optimized-sched-out.o
 
 BUILTIN_OBJS += $(OUTPUT)builtin-annotate.o
 BUILTIN_OBJS += $(OUTPUT)builtin-bench.o
diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c
index 6f8b01b..754dc2a 100644
--- a/tools/perf/tests/builtin-test.c
+++ b/tools/perf/tests/builtin-test.c
@@ -154,6 +154,10 @@ static struct test {
.func = test__hists_cumulate,
},
{
+   .desc = Test optimized event schedule out,
+   .func = test__optimized_sched_out,
+   },
+   {
.func = NULL,
},
 };
diff --git a/tools/perf/tests/optimized-sched-out.c 
b/tools/perf/tests/optimized-sched-out.c
new file mode 100644
index 000..dfbb1b9
--- /dev/null
+++ b/tools/perf/tests/optimized-sched-out.c
@@ -0,0 +1,90 @@
+#include linux/perf_event.h
+#include linux/hw_breakpoint.h
+#include string.h
+#include unistd.h
+#include tests.h
+#include perf.h
+#include debug.h
+
+static void __attribute__ ((noinline)) bp_func(void)
+{
+   asm( : : : memory);
+}
+
+static int bp_event(void *fn)
+{
+   struct perf_event_attr pe;
+   int fd;
+
+   memset(pe, 0, sizeof(struct perf_event_attr));
+   pe.type = PERF_TYPE_BREAKPOINT;
+   pe.size = sizeof(struct perf_event_attr);
+
+   pe.config = 0;
+   pe.bp_type = HW_BREAKPOINT_X;
+   pe.bp_addr = (unsigned long) fn;
+   pe.bp_len = sizeof(long);
+
+   pe.read_format = PERF_FORMAT_ID;
+   pe.inherit = 1;
+   pe.exclude_kernel = 1;
+   pe.exclude_hv = 1;
+   pe.disabled = 1;
+
+   fd = sys_perf_event_open(pe, 0, -1, -1, 0);
+   if (fd  0) {
+   pr_debug(failed opening event %llx\n, pe.config);
+   return TEST_FAIL;
+   }
+
+   return fd;
+}
+
+#define CHILDREN 100
+
+int test__optimized_sched_out(void)
+{
+   struct read_data_t {
+   __u64 val;
+   __u64 id;
+   } read_data = { 0 };
+   int fd, err, i;
+   __u64 id;
+
+   fd = bp_event(bp_func);
+   TEST_ASSERT_VAL(create event, fd = 0);
+
+   err = ioctl(fd, PERF_EVENT_IOC_ID, id);
+   TEST_ASSERT_VAL(id event, !err);
+
+   err = ioctl(fd, PERF_EVENT_IOC_ENABLE, 0);
+   TEST_ASSERT_VAL(enable event, !err);
+
+   for (i = 0; i  CHILDREN; i++) {
+   err = fork();
+   TEST_ASSERT_VAL(failed to fork, err != -1);
+   if (!err) {
+   pr_debug(child %d created\n, getpid());
+   bp_func();
+   exit(0);
+   }
+   }
+
+   while (wait(err)  0)
+   ;
+
+   bp_func();
+
+   /* read */
+   err = read(fd, read_data, sizeof(read_data));
+   TEST_ASSERT_VAL(read values, sizeof(read_data) == err);
+   TEST_ASSERT_VAL(event id, read_data.id  == id);
+
+   pr_debug(read_data.val %llu, expected %u\n,
+ read_data.val, CHILDREN + 1);
+
+   TEST_ASSERT_VAL(event count, read_data.val == CHILDREN + 1);
+
+   close(fd);
+   return 0;
+}
diff --git a/tools/perf/tests/tests.h b/tools/perf/tests/tests.h
index ed64790..a62d58d 100644
--- a/tools/perf/tests/tests.h
+++ b/tools/perf/tests/tests.h
@@ -48,6 +48,7 @@ int test__mmap_thread_lookup(void);
 int test__thread_mg_share(void);
 int test__hists_output(void);
 int test__hists_cumulate(void);
+int test__optimized_sched_out(void);
 
 #if defined(__x86_64__) || defined(__i386__) || defined(__arm__)
 #ifdef HAVE_DWARF_UNWIND_SUPPORT
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  

[PATCH 2/3] perf: Do not allow optimized switch for non-cloned events

2014-06-24 Thread Jiri Olsa
From: Jiri Olsa jo...@redhat.com

The context check in perf_event_context_sched_out allows
non-cloned context to be part of the optimized schedule
out switch.

This could move non-cloned context into another workload
child. Once this child exits, the context is closed and
leaves all original (parent) events in closed state.

Any other new cloned event will have closed state and not
measure anything. And probably causing other odd bugs.

Cc: Arnaldo Carvalho de Melo a...@kernel.org
Cc: Corey Ashford cjash...@linux.vnet.ibm.com
Cc: David Ahern dsah...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Namhyung Kim namhy...@kernel.org
Cc: Paul Mackerras pau...@samba.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Signed-off-by: Jiri Olsa jo...@kernel.org
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index d968008..4e3618e 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -2319,7 +2319,7 @@ static void perf_event_context_sched_out(struct 
task_struct *task, int ctxn,
next_parent = rcu_dereference(next_ctx-parent_ctx);
 
/* If neither context have a parent context; they cannot be clones. */
-   if (!parent  !next_parent)
+   if (!parent || !next_parent)
goto unlock;
 
if (next_parent == ctx || next_ctx == parent || next_parent == parent) {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] perf: Make perf_event_init_context function static

2014-06-24 Thread Jiri Olsa
From: Jiri Olsa jo...@redhat.com

Leftover from '8dc85d5 perf: Multiple task contexts'.

Cc: Arnaldo Carvalho de Melo a...@kernel.org
Cc: Corey Ashford cjash...@linux.vnet.ibm.com
Cc: David Ahern dsah...@gmail.com
Cc: Frederic Weisbecker fweis...@gmail.com
Cc: Ingo Molnar mi...@kernel.org
Cc: Namhyung Kim namhy...@kernel.org
Cc: Paul Mackerras pau...@samba.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Signed-off-by: Jiri Olsa jo...@kernel.org
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index cd28335..d968008 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -7775,7 +7775,7 @@ inherit_task_group(struct perf_event *event, struct 
task_struct *parent,
 /*
  * Initialize the perf_event context in task_struct
  */
-int perf_event_init_context(struct task_struct *child, int ctxn)
+static int perf_event_init_context(struct task_struct *child, int ctxn)
 {
struct perf_event_context *child_ctx, *parent_ctx;
struct perf_event_context *cloned_ctx;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] lib: idr: fix out-of-bounds pointer dereference

2014-06-24 Thread Andrey Ryabinin
On 06/24/14 11:48, Lai Jiangshan wrote:
 
 326cf0f0f308 (idr: fix top layer handling) enlarged the pa array.
 But the additional +1 space is only used in id-allocation, it is free
 in other usage, (paa may point to the additional +1 space, but not 
 dereference it).
 so you can reuse it.
 
 In the 3 functions your patch touched:
 - struct idr_layer ***paa = pa[0];
 + struct idr_layer ***paa = pa[1];
 

Yeah, I thought about such change, but decided this will look very confusing.
Though, this could be made less confusing with good comment why we are assigning
pointer to second element.
I'm think that we should also initialize pa[0] in such case, to avoid possible 
kmemchek's report
about uninitialized memory read.

 
 I don't reject your patch, I had review it.
 
 Reviewed-by: Lai Jiangshan la...@cn.fujitsu.com
 
 The reason why I'm still muttering here is that I wish a simple solution
 to fix the problem. And:
 1) your patch also makes use of the additional +1 @pa space: *++paa = p
 2) your patch may slight enlarge the function body.
 3) I think you patch reduces the readability a little although the idr code
itself is already shit.
 

I have no strong opinion about what change is better. They both looks shitty to 
me.
The best solution here would be to rewrite this whole code from scratch.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 REBASED 01/10] serial/arc: use uart_console_write() helper

2014-06-24 Thread Vineet Gupta
Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 drivers/tty/serial/arc_uart.c | 18 --
 1 file changed, 4 insertions(+), 14 deletions(-)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index c9f5c9dcc15c..32fb8b94ff7c 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -478,14 +478,14 @@ static void arc_serial_config_port(struct uart_port 
*port, int flags)
 
 #if defined(CONFIG_CONSOLE_POLL) || defined(CONFIG_SERIAL_ARC_CONSOLE)
 
-static void arc_serial_poll_putchar(struct uart_port *port, unsigned char chr)
+static void arc_serial_poll_putchar(struct uart_port *port, int chr)
 {
struct arc_uart_port *uart = to_arc_port(port);
 
while (!(UART_GET_STATUS(uart)  TXEMPTY))
cpu_relax();
 
-   UART_SET_DATA(uart, chr);
+   UART_SET_DATA(uart, (unsigned char)chr);
 }
 #endif
 
@@ -622,11 +622,6 @@ static int arc_serial_console_setup(struct console *co, 
char *options)
return uart_set_options(port, co, baud, parity, bits, flow);
 }
 
-static void arc_serial_console_putchar(struct uart_port *port, int ch)
-{
-   arc_serial_poll_putchar(port, (unsigned char)ch);
-}
-
 /*
  * Interrupts are disabled on entering
  */
@@ -637,7 +632,7 @@ static void arc_serial_console_write(struct console *co, 
const char *s,
unsigned long flags;
 
spin_lock_irqsave(port-lock, flags);
-   uart_console_write(port, s, count, arc_serial_console_putchar);
+   uart_console_write(port, s, count, arc_serial_poll_putchar);
spin_unlock_irqrestore(port-lock, flags);
 }
 
@@ -655,13 +650,8 @@ static __init void early_serial_write(struct console *con, 
const char *s,
unsigned int n)
 {
struct uart_port *port = arc_uart_ports[con-index].port;
-   unsigned int i;
 
-   for (i = 0; i  n; i++, s++) {
-   if (*s == '\n')
-   arc_serial_poll_putchar(port, '\r');
-   arc_serial_poll_putchar(port, *s);
-   }
+   uart_console_write(port, s, n, arc_serial_poll_putchar);
 }
 
 static struct console arc_early_serial_console __initdata = {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -mm v3 7/8] slub: make dead memcg caches discard free slabs immediately

2014-06-24 Thread Vladimir Davydov
On Tue, Jun 24, 2014 at 04:50:11PM +0900, Joonsoo Kim wrote:
 On Fri, Jun 13, 2014 at 12:38:21AM +0400, Vladimir Davydov wrote:
  @@ -3409,6 +3417,9 @@ int __kmem_cache_shrink(struct kmem_cache *s)
  kmalloc(sizeof(struct list_head) * objects, GFP_KERNEL);
  unsigned long flags;
   
  +   if (memcg_cache_dead(s))
  +   s-min_partial = 0;
  +
  if (!slabs_by_inuse) {
  /*
   * Do not fail shrinking empty slabs if allocation of the
 
 I think that you should move down n-nr_partial test after holding the
 lock in __kmem_cache_shrink(). Access to n-nr_partial without node lock
 is racy and you can see wrong value. It results in skipping to free empty
 slab so your destroying logic could fail.

You're right! Will fix this.

And there seems to be the same problem in SLAB, where we check
node-slabs_free list emptiness w/o holding node-list_lock (see
drain_freelist) while it can be modified concurrently by free_block.
This will be fixed automatically after we make __kmem_cache_shrink unset
node-free_limit (which must be done under the lock) though.

Thank you!
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 REBASED 00/10] Generic earlyconsole for ARC UART Driver

2014-06-24 Thread Vineet Gupta
Hi,

This is slightly modified repost of series posted last week
http://www.spinics.net/lists/linux-serial/msg12884.html

This series switches ARC UART from custom earlyprintk support to generic
earlycon (many thanks to Rob for doing that). And also build on Grant's recent
work for using DT stdout-path as default console.

The motivation is to get rid of the early platform code, which in turn
would help consolidate the init code across several ARC platforms.

First 3 patches are general cleanup/refactoring, not necesarily related to
earlycon.

v2 - v1

* Rebased on linux-next: 20140623
* Patch 9 split into 9 and 10 for driver/platform changes
* Patch 10 also uses the DT stdout-path so no need for console=


Thx,
-Vineet


Vineet Gupta (10):
  serial/arc: use uart_console_write() helper
  serial/arc: Refactor by referencing to uart_port where possible
  serial/arc: Remove the workaround for legacy ISS
  serial/arc: Use generic earlycon infrastructure
  serial/arc: remove earlyprintk support and switch to earlycon
  serial/arc: remove last remanants of platform data
  serial/arc: inline the probe helper
  ARC: [arcfpga] RIP early uart platform device stuff
  serial/arc: Enable DT based earlycon
  ARC: [arcfpga] stdout-path now suffices for earlycon/console

 arch/arc/boot/dts/angel4.dts |   3 +-
 arch/arc/plat-arcfpga/Kconfig|   7 -
 arch/arc/plat-arcfpga/platform.c |  97 +---
 drivers/tty/serial/Kconfig   |   1 +
 drivers/tty/serial/arc_uart.c| 329 ++-
 5 files changed, 123 insertions(+), 314 deletions(-)

-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 REBASED 02/10] serial/arc: Refactor by referencing to uart_port where possible

2014-06-24 Thread Vineet Gupta
The ARC UART MMIO helpers would take arc_uart_port and then reference
generic uart_port-membase member. So change them to difrectly refer to
uart_port and fix call sites accordingly.

This removes the need for to_arc_port() converion almost eveeywhere and
makes code a bit easier to read.

Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 drivers/tty/serial/arc_uart.c | 155 +++---
 1 file changed, 69 insertions(+), 86 deletions(-)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 32fb8b94ff7c..4d971281e3d9 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -72,7 +72,7 @@
 #define RXOERR  0x02   /* OverFlow Err: Char recv but RXFULL still set */
 
 /* Uart bit fiddling helpers: lowest level */
-#define RBASE(uart, reg)  (uart-port.membase + reg)
+#define RBASE(port, reg)  (port-membase + reg)
 #define UART_REG_SET(u, r, v) writeb((v), RBASE(u, r))
 #define UART_REG_GET(u, r)readb(RBASE(u, r))
 
@@ -129,19 +129,15 @@ static struct uart_driver arc_uart_driver = {
 
 static void arc_serial_stop_rx(struct uart_port *port)
 {
-   struct arc_uart_port *uart = to_arc_port(port);
-
-   UART_RX_IRQ_DISABLE(uart);
+   UART_RX_IRQ_DISABLE(port);
 }
 
 static void arc_serial_stop_tx(struct uart_port *port)
 {
-   struct arc_uart_port *uart = to_arc_port(port);
-
-   while (!(UART_GET_STATUS(uart)  TXEMPTY))
+   while (!(UART_GET_STATUS(port)  TXEMPTY))
cpu_relax();
 
-   UART_TX_IRQ_DISABLE(uart);
+   UART_TX_IRQ_DISABLE(port);
 }
 
 /*
@@ -149,10 +145,9 @@ static void arc_serial_stop_tx(struct uart_port *port)
  */
 static unsigned int arc_serial_tx_empty(struct uart_port *port)
 {
-   struct arc_uart_port *uart = to_arc_port(port);
unsigned int stat;
 
-   stat = UART_GET_STATUS(uart);
+   stat = UART_GET_STATUS(port);
if (stat  TXEMPTY)
return TIOCSER_TEMT;
 
@@ -166,24 +161,24 @@ static unsigned int arc_serial_tx_empty(struct uart_port 
*port)
  * = by uart_start( ) before calling us
  * = tx_ist checks that too before calling
  */
-static void arc_serial_tx_chars(struct arc_uart_port *uart)
+static void arc_serial_tx_chars(struct uart_port *port)
 {
-   struct circ_buf *xmit = uart-port.state-xmit;
+   struct circ_buf *xmit = port-state-xmit;
int sent = 0;
unsigned char ch;
 
-   if (unlikely(uart-port.x_char)) {
-   UART_SET_DATA(uart, uart-port.x_char);
-   uart-port.icount.tx++;
-   uart-port.x_char = 0;
+   if (unlikely(port-x_char)) {
+   UART_SET_DATA(port, port-x_char);
+   port-icount.tx++;
+   port-x_char = 0;
sent = 1;
} else if (xmit-tail != xmit-head) {  /* TODO: uart_circ_empty */
ch = xmit-buf[xmit-tail];
xmit-tail = (xmit-tail + 1)  (UART_XMIT_SIZE - 1);
-   uart-port.icount.tx++;
-   while (!(UART_GET_STATUS(uart)  TXEMPTY))
+   port-icount.tx++;
+   while (!(UART_GET_STATUS(port)  TXEMPTY))
cpu_relax();
-   UART_SET_DATA(uart, ch);
+   UART_SET_DATA(port, ch);
sent = 1;
}
 
@@ -192,10 +187,10 @@ static void arc_serial_tx_chars(struct arc_uart_port 
*uart)
 * By Hard ISR to schedule processing in software interrupt part
 */
if (uart_circ_chars_pending(xmit)  WAKEUP_CHARS)
-   uart_write_wakeup(uart-port);
+   uart_write_wakeup(port);
 
if (sent)
-   UART_TX_IRQ_ENABLE(uart);
+   UART_TX_IRQ_ENABLE(port);
 }
 
 /*
@@ -204,12 +199,10 @@ static void arc_serial_tx_chars(struct arc_uart_port 
*uart)
  */
 static void arc_serial_start_tx(struct uart_port *port)
 {
-   struct arc_uart_port *uart = to_arc_port(port);
-
-   arc_serial_tx_chars(uart);
+   arc_serial_tx_chars(port);
 }
 
-static void arc_serial_rx_chars(struct arc_uart_port *uart, unsigned int 
status)
+static void arc_serial_rx_chars(struct uart_port *port, unsigned int status)
 {
unsigned int ch, flg = 0;
 
@@ -229,15 +222,15 @@ static void arc_serial_rx_chars(struct arc_uart_port 
*uart, unsigned int status)
 */
if (unlikely(status  (RXOERR | RXFERR))) {
if (status  RXOERR) {
-   uart-port.icount.overrun++;
+   port-icount.overrun++;
flg = TTY_OVERRUN;
-   UART_CLR_STATUS(uart, RXOERR);
+   UART_CLR_STATUS(port, RXOERR);
}
 
if (status  RXFERR) {
-   uart-port.icount.frame++;
+   port-icount.frame++;
flg = TTY_FRAME;
-  

[PATCH v2 REBASED 03/10] serial/arc: Remove the workaround for legacy ISS

2014-06-24 Thread Vineet Gupta
Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 drivers/tty/serial/arc_uart.c | 14 --
 1 file changed, 14 deletions(-)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 4d971281e3d9..a6da10f84293 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -102,7 +102,6 @@
 struct arc_uart_port {
struct uart_port port;
unsigned long baud;
-   int is_emulated;/* H/w vs. Instruction Set Simulator */
 };
 
 #define to_arc_port(uport)  container_of(uport, struct arc_uart_port, port)
@@ -387,17 +386,6 @@ arc_serial_set_termios(struct uart_port *port, struct 
ktermios *new,
uartl = hw_val  0xFF;
uarth = (hw_val  8)  0xFF;
 
-   /*
-* UART ISS(Instruction Set simulator) emulation has a subtle bug:
-* A existing value of Baudh = 0 is used as a indication to startup
-* it's internal state machine.
-* Thus if baudh is set to 0, 2 times, it chokes.
-* This happens with BAUD=115200 and the formaula above
-* Until that is fixed, when running on ISS, we will set baudh to !0
-*/
-   if (uart-is_emulated)
-   uarth = 1;
-
spin_lock_irqsave(port-lock, flags);
 
UART_ALL_IRQ_DISABLE(port);
@@ -520,8 +508,6 @@ arc_uart_init_one(struct platform_device *pdev, int dev_id)
if (!plat_data)
return -ENODEV;
 
-   uart-is_emulated = !!plat_data[0]; /* workaround ISS bug */
-
if (is_early_platform_device(pdev)) {
port-uartclk = plat_data[1];
uart-baud = plat_data[2];
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 REBASED 04/10] serial/arc: Use generic earlycon infrastructure

2014-06-24 Thread Vineet Gupta
With this change both earlyprintk and earlycon coexist
We switch over to latter in next patch

Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 drivers/tty/serial/Kconfig|  1 +
 drivers/tty/serial/arc_uart.c | 30 ++
 2 files changed, 31 insertions(+)

diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index fb57159bad3a..2311443be7dc 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -1473,6 +1473,7 @@ config SERIAL_ARC_CONSOLE
bool Console on ARC UART
depends on SERIAL_ARC=y
select SERIAL_CORE_CONSOLE
+   select SERIAL_EARLYCON
help
  Enable system Console on ARC UART
 
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index a6da10f84293..0c8ba5bb97c7 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -646,6 +646,36 @@ static int __init arc_serial_probe_earlyprintk(struct 
platform_device *pdev)
register_console(arc_early_serial_console);
return 0;
 }
+
+static __init void arc_early_serial_write(struct console *con, const char *s,
+ unsigned int n)
+{
+   struct earlycon_device *dev = con-data;
+
+   uart_console_write(dev-port, s, n, arc_serial_poll_putchar);
+}
+
+static int __init arc_early_console_setup(struct earlycon_device *dev,
+ const char *opt)
+{
+   struct uart_port *port = dev-port;
+   unsigned int l, h, hw_val;
+
+   if (!dev-port.membase)
+   return -ENODEV;
+
+   hw_val = port-uartclk / (dev-baud * 4) - 1;
+   l = hw_val  0xFF;
+   h = (hw_val  8)  0xFF;
+
+   UART_SET_BAUDL(port, l);
+   UART_SET_BAUDH(port, h);
+
+   dev-con-write = arc_early_serial_write;
+   return 0;
+}
+EARLYCON_DECLARE(arc_uart, arc_early_console_setup);
+
 #endif /* CONFIG_SERIAL_ARC_CONSOLE */
 
 static int arc_serial_probe(struct platform_device *pdev)
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 REBASED 06/10] serial/arc: remove last remanants of platform data

2014-06-24 Thread Vineet Gupta
Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 drivers/tty/serial/arc_uart.c | 22 ++
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 2ffaf099691a..dc3d5db37dc4 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -37,8 +37,8 @@
 #include linux/tty_flip.h
 #include linux/serial_core.h
 #include linux/io.h
-#include linux/of.h
-#include linux/of_platform.h
+#include linux/of_irq.h
+#include linux/of_address.h
 
 /*
  * ARC UART Hardware Specs
@@ -499,11 +499,9 @@ static struct uart_ops arc_serial_pops = {
 static int
 arc_uart_init_one(struct platform_device *pdev, int dev_id)
 {
-   struct resource *res, *res2;
+   struct device_node *np = pdev-dev.of_node;
struct arc_uart_port *uart = arc_uart_ports[dev_id];
struct uart_port *port = uart-port;
-
-   struct device_node *np = pdev-dev.of_node;
u32 val;
 
if (of_property_read_u32(np, clock-frequency, val)) {
@@ -518,21 +516,13 @@ arc_uart_init_one(struct platform_device *pdev, int 
dev_id)
}
uart-baud = val;
 
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res)
-   return -ENODEV;
-
-   res2 = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-   if (!res2)
-   return -ENODEV;
-
-   port-mapbase = res-start;
-   port-membase = ioremap_nocache(res-start, resource_size(res));
+   port-membase = of_iomap(np, 0);
if (!port-membase)
/* No point of dev_err since UART itself is hosed here */
return -ENXIO;
 
-   port-irq = res2-start;
+   port-irq = irq_of_parse_and_map(np, 0);
+
port-dev = pdev-dev;
port-iotype = UPIO_MEM;
port-flags = UPF_BOOT_AUTOCONF;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 REBASED 05/10] serial/arc: remove earlyprintk support and switch to earlycon

2014-06-24 Thread Vineet Gupta
Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 arch/arc/boot/dts/angel4.dts  |  2 +-
 drivers/tty/serial/arc_uart.c | 87 ++-
 2 files changed, 13 insertions(+), 76 deletions(-)

diff --git a/arch/arc/boot/dts/angel4.dts b/arch/arc/boot/dts/angel4.dts
index 5bb2fdaca02f..6b57475967a6 100644
--- a/arch/arc/boot/dts/angel4.dts
+++ b/arch/arc/boot/dts/angel4.dts
@@ -17,7 +17,7 @@
interrupt-parent = intc;
 
chosen {
-   bootargs = console=ttyARC0,115200n8 earlyprintk=ttyARC0;
+   bootargs = earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 
console=ttyARC0,115200n8;
};
 
aliases {
diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 0c8ba5bb97c7..2ffaf099691a 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -500,33 +500,23 @@ static int
 arc_uart_init_one(struct platform_device *pdev, int dev_id)
 {
struct resource *res, *res2;
-   unsigned long *plat_data;
struct arc_uart_port *uart = arc_uart_ports[dev_id];
struct uart_port *port = uart-port;
 
-   plat_data = dev_get_platdata(pdev-dev);
-   if (!plat_data)
-   return -ENODEV;
+   struct device_node *np = pdev-dev.of_node;
+   u32 val;
 
-   if (is_early_platform_device(pdev)) {
-   port-uartclk = plat_data[1];
-   uart-baud = plat_data[2];
-   } else {
-   struct device_node *np = pdev-dev.of_node;
-   u32 val;
-
-   if (of_property_read_u32(np, clock-frequency, val)) {
-   dev_err(pdev-dev, clock-frequency property 
NOTset\n);
-   return -EINVAL;
-   }
-   port-uartclk = val;
-
-   if (of_property_read_u32(np, current-speed, val)) {
-   dev_err(pdev-dev, current-speed property NOT set\n);
-   return -EINVAL;
-   }
-   uart-baud = val;
+   if (of_property_read_u32(np, clock-frequency, val)) {
+   dev_err(pdev-dev, clock-frequency property NOTset\n);
+   return -EINVAL;
}
+   port-uartclk = val;
+
+   if (of_property_read_u32(np, current-speed, val)) {
+   dev_err(pdev-dev, current-speed property NOT set\n);
+   return -EINVAL;
+   }
+   uart-baud = val;
 
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
@@ -615,38 +605,6 @@ static struct console arc_console = {
.data   = arc_uart_driver
 };
 
-static __init void early_serial_write(struct console *con, const char *s,
-   unsigned int n)
-{
-   struct uart_port *port = arc_uart_ports[con-index].port;
-
-   uart_console_write(port, s, n, arc_serial_poll_putchar);
-}
-
-static struct console arc_early_serial_console __initdata = {
-   .name = early_ARCuart,
-   .write = early_serial_write,
-   .flags = CON_PRINTBUFFER | CON_BOOT,
-   .index = -1
-};
-
-static int __init arc_serial_probe_earlyprintk(struct platform_device *pdev)
-{
-   int dev_id = pdev-id  0 ? 0 : pdev-id;
-   int rc;
-
-   arc_early_serial_console.index = dev_id;
-
-   rc = arc_uart_init_one(pdev, dev_id);
-   if (rc)
-   panic(early console init failed\n);
-
-   arc_serial_console_setup(arc_early_serial_console, NULL);
-
-   register_console(arc_early_serial_console);
-   return 0;
-}
-
 static __init void arc_early_serial_write(struct console *con, const char *s,
  unsigned int n)
 {
@@ -721,27 +679,6 @@ static struct platform_driver arc_platform_driver = {
 },
 };
 
-#ifdef CONFIG_SERIAL_ARC_CONSOLE
-
-static struct platform_driver early_arc_platform_driver __initdata = {
-   .probe = arc_serial_probe_earlyprintk,
-   .remove = arc_serial_remove,
-   .driver = {
-   .name = DRIVER_NAME,
-   .owner = THIS_MODULE,
-},
-};
-/*
- * Register an early platform driver of earlyprintk class.
- * ARCH platform code installs the driver and probes the early devices
- * The installation could rely on user specifying earlyprintk=xyx in cmd line
- * or it could be done independently, for all earlyprintk class drivers.
- * [see arch/arc/plat-arcfpga/platform.c]
- */
-early_platform_init(earlyprintk, early_arc_platform_driver);
-
-#endif  /* CONFIG_SERIAL_ARC_CONSOLE */
-
 static int __init arc_serial_init(void)
 {
int ret;
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 REBASED 08/10] ARC: [arcfpga] RIP early uart platform device stuff

2014-06-24 Thread Vineet Gupta
With ARC uart driver switching to generic earlycon, we no longer need
this ugliness. You won't be missed.

Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 arch/arc/plat-arcfpga/Kconfig|  7 ---
 arch/arc/plat-arcfpga/platform.c | 97 +---
 2 files changed, 2 insertions(+), 102 deletions(-)

diff --git a/arch/arc/plat-arcfpga/Kconfig b/arch/arc/plat-arcfpga/Kconfig
index e27bb5cc3c1e..b9f34cf55acf 100644
--- a/arch/arc/plat-arcfpga/Kconfig
+++ b/arch/arc/plat-arcfpga/Kconfig
@@ -41,11 +41,4 @@ config ISS_SMP_EXTN
  -XTL (To enable CPU start/stop/set-PC for another CPU)
  It doesn't provide coherent Caches and/or Atomic Ops (LLOCK/SCOND)
 
-config ARC_SERIAL_BAUD
-   int UART Baud rate
-   default 115200
-   depends on SERIAL_ARC || SERIAL_ARC_CONSOLE
-   help
- Baud rate for the ARC UART
-
 endif
diff --git a/arch/arc/plat-arcfpga/platform.c b/arch/arc/plat-arcfpga/platform.c
index 61c7e5997387..b8d0d456627f 100644
--- a/arch/arc/plat-arcfpga/platform.c
+++ b/arch/arc/plat-arcfpga/platform.c
@@ -22,115 +22,22 @@
 #include plat/smp.h
 #include plat/irq.h
 
-/*--- Platform Devices -*/
-
-#if IS_ENABLED(CONFIG_SERIAL_ARC)
-static unsigned long arc_uart_info[] = {
-   0,  /* uart-is_emulated (runtime @running_on_hw) */
-   0,  /* uart-port.uartclk */
-   0,  /* uart-baud */
-   0
-};
-
-#if defined(CONFIG_SERIAL_ARC_CONSOLE)
-/*
- * static platform data - but only for early serial
- * TBD: derive this from a special DT node
- */
-static struct resource arc_uart0_res[] = {
-   {
-   .start = UART0_BASE,
-   .end   = UART0_BASE + 0xFF,
-   .flags = IORESOURCE_MEM,
-   },
-   {
-   .start = UART0_IRQ,
-   .end   = UART0_IRQ,
-   .flags = IORESOURCE_IRQ,
-   },
-};
-
-static struct platform_device arc_uart0_dev = {
-   .name = arc-uart,
-   .id = 0,
-   .num_resources = ARRAY_SIZE(arc_uart0_res),
-   .resource = arc_uart0_res,
-   .dev = {
-   .platform_data = arc_uart_info,
-   },
-};
-
-static struct platform_device *fpga_early_devs[] __initdata = {
-   arc_uart0_dev,
-};
-#endif /* CONFIG_SERIAL_ARC_CONSOLE */
-
-static void arc_fpga_serial_init(void)
-{
-   /* To let driver workaround ISS bug: baudh Reg can't be set to 0 */
-   arc_uart_info[0] = !running_on_hw;
-
-   arc_uart_info[1] = arc_get_core_freq();
-
-   arc_uart_info[2] = CONFIG_ARC_SERIAL_BAUD;
-
-#if defined(CONFIG_SERIAL_ARC_CONSOLE)
-   early_platform_add_devices(fpga_early_devs,
-  ARRAY_SIZE(fpga_early_devs));
-
-   /*
-* ARC console driver registers (build time) as an early platform driver
-* of class earlyprintk. However it needs explicit cmdline toggle
-* earlyprintk=ttyARC0 to be successfuly runtime registered.
-* Otherwise the early probe below fails to find the driver
-*/
-   early_platform_driver_probe(earlyprintk, 1, 0);
-
-   /*
-* This is to make sure that arc uart would be preferred console
-* despite one/more of following:
-*   -command line lacked console=ttyARC0 or
-*   -CONFIG_VT_CONSOLE was enabled (for no reason whatsoever)
-* Note that this needs to be done after above early console is reg,
-* otherwise the early console never gets a chance to run.
-*/
-   add_preferred_console(ttyARC, 0, 115200);
-#endif /* CONFIG_SERIAL_ARC_CONSOLE */
-}
-#else  /* !IS_ENABLED(CONFIG_SERIAL_ARC) */
-static void arc_fpga_serial_init(void)
-{
-}
-#endif
-
 static void __init plat_fpga_early_init(void)
 {
pr_info([plat-arcfpga]: registering early dev resources\n);
 
-   arc_fpga_serial_init();
-
 #ifdef CONFIG_ISS_SMP_EXTN
iss_model_init_early_smp();
 #endif
 }
 
-static struct of_dev_auxdata plat_auxdata_lookup[] __initdata = {
-#if IS_ENABLED(CONFIG_SERIAL_ARC)
-   OF_DEV_AUXDATA(snps,arc-uart, UART0_BASE, arc-uart, arc_uart_info),
-#endif
-   {}
-};
-
 static void __init plat_fpga_populate_dev(void)
 {
-   pr_info([plat-arcfpga]: registering device resources\n);
-
/*
 * Traverses flattened DeviceTree - registering platform devices
-* complete with their resources
+* (if any) complete with their resources
 */
-   of_platform_populate(NULL, of_default_bus_match_table,
-plat_auxdata_lookup, NULL);
+   of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
 /*--- Machine Descriptions --
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  

[PATCH v2 REBASED 07/10] serial/arc: inline the probe helper

2014-06-24 Thread Vineet Gupta
Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 drivers/tty/serial/arc_uart.c | 90 +++
 1 file changed, 40 insertions(+), 50 deletions(-)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index dc3d5db37dc4..435de4f2af3b 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -496,50 +496,6 @@ static struct uart_ops arc_serial_pops = {
 #endif
 };
 
-static int
-arc_uart_init_one(struct platform_device *pdev, int dev_id)
-{
-   struct device_node *np = pdev-dev.of_node;
-   struct arc_uart_port *uart = arc_uart_ports[dev_id];
-   struct uart_port *port = uart-port;
-   u32 val;
-
-   if (of_property_read_u32(np, clock-frequency, val)) {
-   dev_err(pdev-dev, clock-frequency property NOTset\n);
-   return -EINVAL;
-   }
-   port-uartclk = val;
-
-   if (of_property_read_u32(np, current-speed, val)) {
-   dev_err(pdev-dev, current-speed property NOT set\n);
-   return -EINVAL;
-   }
-   uart-baud = val;
-
-   port-membase = of_iomap(np, 0);
-   if (!port-membase)
-   /* No point of dev_err since UART itself is hosed here */
-   return -ENXIO;
-
-   port-irq = irq_of_parse_and_map(np, 0);
-
-   port-dev = pdev-dev;
-   port-iotype = UPIO_MEM;
-   port-flags = UPF_BOOT_AUTOCONF;
-   port-line = dev_id;
-   port-ops = arc_serial_pops;
-
-   port-fifosize = ARC_UART_TX_FIFO_SIZE;
-
-   /*
-* uart_insert_char( ) uses it in decideding whether to ignore a
-* char or not. Explicitly setting it here, removes the subtelty
-*/
-   port-ignore_status_mask = 0;
-
-   return 0;
-}
-
 #ifdef CONFIG_SERIAL_ARC_CONSOLE
 
 static int arc_serial_console_setup(struct console *co, char *options)
@@ -628,8 +584,11 @@ EARLYCON_DECLARE(arc_uart, arc_early_console_setup);
 
 static int arc_serial_probe(struct platform_device *pdev)
 {
-   int rc, dev_id;
struct device_node *np = pdev-dev.of_node;
+   struct arc_uart_port *uart;
+   struct uart_port *port;
+   int dev_id;
+   u32 val;
 
/* no device tree device */
if (!np)
@@ -639,12 +598,43 @@ static int arc_serial_probe(struct platform_device *pdev)
if (dev_id  0)
dev_id = 0;
 
-   rc = arc_uart_init_one(pdev, dev_id);
-   if (rc)
-   return rc;
+   uart = arc_uart_ports[dev_id];
+   port = uart-port;
+
+   if (of_property_read_u32(np, clock-frequency, val)) {
+   dev_err(pdev-dev, clock-frequency property NOTset\n);
+   return -EINVAL;
+   }
+   port-uartclk = val;
+
+   if (of_property_read_u32(np, current-speed, val)) {
+   dev_err(pdev-dev, current-speed property NOT set\n);
+   return -EINVAL;
+   }
+   uart-baud = val;
+
+   port-membase = of_iomap(np, 0);
+   if (!port-membase)
+   /* No point of dev_err since UART itself is hosed here */
+   return -ENXIO;
+
+   port-irq = irq_of_parse_and_map(np, 0);
+
+   port-dev = pdev-dev;
+   port-iotype = UPIO_MEM;
+   port-flags = UPF_BOOT_AUTOCONF;
+   port-line = dev_id;
+   port-ops = arc_serial_pops;
+
+   port-fifosize = ARC_UART_TX_FIFO_SIZE;
+
+   /*
+* uart_insert_char( ) uses it in decideding whether to ignore a
+* char or not. Explicitly setting it here, removes the subtelty
+*/
+   port-ignore_status_mask = 0;
 
-   rc = uart_add_one_port(arc_uart_driver, arc_uart_ports[dev_id].port);
-   return rc;
+   return uart_add_one_port(arc_uart_driver, 
arc_uart_ports[dev_id].port);
 }
 
 static int arc_serial_remove(struct platform_device *pdev)
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 REBASED 09/10] serial/arc: Enable DT based earlycon

2014-06-24 Thread Vineet Gupta
This allows a param less earlycon to pick up the earlyconsole from
chosen/stdout-path

Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 drivers/tty/serial/arc_uart.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/arc_uart.c b/drivers/tty/serial/arc_uart.c
index 435de4f2af3b..d9900cb3e7b6 100644
--- a/drivers/tty/serial/arc_uart.c
+++ b/drivers/tty/serial/arc_uart.c
@@ -579,6 +579,7 @@ static int __init arc_early_console_setup(struct 
earlycon_device *dev,
return 0;
 }
 EARLYCON_DECLARE(arc_uart, arc_early_console_setup);
+OF_EARLYCON_DECLARE(arc_uart, snps,arc-uart, arc_early_console_setup);
 
 #endif /* CONFIG_SERIAL_ARC_CONSOLE */
 
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 04/13] mm, compaction: move pageblock checks up from isolate_migratepages_range()

2014-06-24 Thread Joonsoo Kim
On Fri, Jun 20, 2014 at 05:49:34PM +0200, Vlastimil Babka wrote:
 isolate_migratepages_range() is the main function of the compaction scanner,
 called either on a single pageblock by isolate_migratepages() during regular
 compaction, or on an arbitrary range by CMA's __alloc_contig_migrate_range().
 It currently perfoms two pageblock-wide compaction suitability checks, and
 because of the CMA callpath, it tracks if it crossed a pageblock boundary in
 order to repeat those checks.
 
 However, closer inspection shows that those checks are always true for CMA:
 - isolation_suitable() is true because CMA sets cc-ignore_skip_hint to true
 - migrate_async_suitable() check is skipped because CMA uses sync compaction
 
 We can therefore move the checks to isolate_migratepages(), reducing variables
 and simplifying isolate_migratepages_range(). The update_pageblock_skip()
 function also no longer needs set_unsuitable parameter.
 
 Furthermore, going back to compact_zone() and compact_finished() when 
 pageblock
 is unsuitable is wasteful - the checks are meant to skip pageblocks quickly.
 The patch therefore also introduces a simple loop into isolate_migratepages()
 so that it does not return immediately on pageblock checks, but keeps going
 until isolate_migratepages_range() gets called once. Similarily to
 isolate_freepages(), the function periodically checks if it needs to 
 reschedule
 or abort async compaction.
 
 Signed-off-by: Vlastimil Babka vba...@suse.cz
 Cc: Minchan Kim minc...@kernel.org
 Cc: Mel Gorman mgor...@suse.de
 Cc: Joonsoo Kim iamjoonsoo@lge.com
 Cc: Michal Nazarewicz min...@mina86.com
 Cc: Naoya Horiguchi n-horigu...@ah.jp.nec.com
 Cc: Christoph Lameter c...@linux.com
 Cc: Rik van Riel r...@redhat.com
 Cc: David Rientjes rient...@google.com
 ---
  mm/compaction.c | 112 
 +---
  1 file changed, 59 insertions(+), 53 deletions(-)
 
 diff --git a/mm/compaction.c b/mm/compaction.c
 index 3064a7f..ebe30c9 100644
 --- a/mm/compaction.c
 +++ b/mm/compaction.c
 @@ -132,7 +132,7 @@ void reset_isolation_suitable(pg_data_t *pgdat)
   */
  static void update_pageblock_skip(struct compact_control *cc,
   struct page *page, unsigned long nr_isolated,
 - bool set_unsuitable, bool migrate_scanner)
 + bool migrate_scanner)
  {
   struct zone *zone = cc-zone;
   unsigned long pfn;
 @@ -146,12 +146,7 @@ static void update_pageblock_skip(struct compact_control 
 *cc,
   if (nr_isolated)
   return;
  
 - /*
 -  * Only skip pageblocks when all forms of compaction will be known to
 -  * fail in the near future.
 -  */
 - if (set_unsuitable)
 - set_pageblock_skip(page);
 + set_pageblock_skip(page);
  
   pfn = page_to_pfn(page);
  
 @@ -180,7 +175,7 @@ static inline bool isolation_suitable(struct 
 compact_control *cc,
  
  static void update_pageblock_skip(struct compact_control *cc,
   struct page *page, unsigned long nr_isolated,
 - bool set_unsuitable, bool migrate_scanner)
 + bool migrate_scanner)
  {
  }
  #endif /* CONFIG_COMPACTION */
 @@ -345,8 +340,7 @@ isolate_fail:
  
   /* Update the pageblock-skip if the whole pageblock was scanned */
   if (blockpfn == end_pfn)
 - update_pageblock_skip(cc, valid_page, total_isolated, true,
 -   false);
 + update_pageblock_skip(cc, valid_page, total_isolated, false);
  
   count_compact_events(COMPACTFREE_SCANNED, nr_scanned);
   if (total_isolated)
 @@ -474,14 +468,12 @@ unsigned long
  isolate_migratepages_range(struct zone *zone, struct compact_control *cc,
   unsigned long low_pfn, unsigned long end_pfn, bool unevictable)
  {
 - unsigned long last_pageblock_nr = 0, pageblock_nr;
   unsigned long nr_scanned = 0, nr_isolated = 0;
   struct list_head *migratelist = cc-migratepages;
   struct lruvec *lruvec;
   unsigned long flags;
   bool locked = false;
   struct page *page = NULL, *valid_page = NULL;
 - bool set_unsuitable = true;
   const isolate_mode_t mode = (cc-mode == MIGRATE_ASYNC ?
   ISOLATE_ASYNC_MIGRATE : 0) |
   (unevictable ? ISOLATE_UNEVICTABLE : 0);
 @@ -545,28 +537,6 @@ isolate_migratepages_range(struct zone *zone, struct 
 compact_control *cc,
   if (!valid_page)
   valid_page = page;
  
 - /* If isolation recently failed, do not retry */
 - pageblock_nr = low_pfn  pageblock_order;
 - if (last_pageblock_nr != pageblock_nr) {
 - int mt;
 -
 - last_pageblock_nr = pageblock_nr;
 - if (!isolation_suitable(cc, page))
 - goto next_pageblock;
 -
 - /*
 - 

[PATCH 1/1] regulator: as3722: Fix incorrect parameter initialization

2014-06-24 Thread Sachin Kamat
'name' field was re-initialized and getting overwritten in some
cases possibly due to a typo. Code inspection says the second time
it should be 'sname' instead of 'name'. Replace it.

Signed-off-by: Sachin Kamat sachin.ka...@samsung.com
---
Compile tested only.
---
 drivers/regulator/as3722-regulator.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/as3722-regulator.c 
b/drivers/regulator/as3722-regulator.c
index ad9e0c9b7daf..b68f05f38537 100644
--- a/drivers/regulator/as3722-regulator.c
+++ b/drivers/regulator/as3722-regulator.c
@@ -219,7 +219,7 @@ static const struct as3722_register_mapping 
as3722_reg_lookup[] = {
{
.regulator_id = AS3722_REGULATOR_ID_LDO3,
.name = as3722-ldo3,
-   .name = vin-ldo3-4,
+   .sname = vin-ldo3-4,
.vsel_reg = AS3722_LDO3_VOLTAGE_REG,
.vsel_mask = AS3722_LDO3_VSEL_MASK,
.enable_reg = AS3722_LDOCONTROL0_REG,
@@ -231,7 +231,7 @@ static const struct as3722_register_mapping 
as3722_reg_lookup[] = {
{
.regulator_id = AS3722_REGULATOR_ID_LDO4,
.name = as3722-ldo4,
-   .name = vin-ldo3-4,
+   .sname = vin-ldo3-4,
.vsel_reg = AS3722_LDO4_VOLTAGE_REG,
.vsel_mask = AS3722_LDO_VSEL_MASK,
.enable_reg = AS3722_LDOCONTROL0_REG,
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2 REBASED 10/10] ARC: [arcfpga] stdout-path now suffices for earlycon/console

2014-06-24 Thread Vineet Gupta
With recent improvements to serial/of core from Grant and Rob,
stdout-path alone suffices for setting up earlycon/console.

arc_uart driver is already equipped to handle that, switch the DT now.

Signed-off-by: Vineet Gupta vgu...@synopsys.com
---
 arch/arc/boot/dts/angel4.dts | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arc/boot/dts/angel4.dts b/arch/arc/boot/dts/angel4.dts
index 6b57475967a6..298a46daa633 100644
--- a/arch/arc/boot/dts/angel4.dts
+++ b/arch/arc/boot/dts/angel4.dts
@@ -17,7 +17,8 @@
interrupt-parent = intc;
 
chosen {
-   bootargs = earlycon=arc_uart,mmio32,0xc0fc1000,115200n8 
console=ttyARC0,115200n8;
+   bootargs = earlycon;
+   stdout-path = arcuart0;
};
 
aliases {
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] regulator: tps65218: Fix build warnings

2014-06-24 Thread Sachin Kamat
rdev_get_id() returns an int. Convert rid to type int to avoid the
following warnings:
drivers/regulator/tps65218-regulator.c:132:10: warning: comparison of unsigned 
expression  0 is always false [-Wtype-limits]
drivers/regulator/tps65218-regulator.c:146:10: warning: comparison of unsigned 
expression  0 is always false [-Wtype-limits]

Signed-off-by: Sachin Kamat sachin.ka...@samsung.com
---
 drivers/regulator/tps65218-regulator.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/tps65218-regulator.c 
b/drivers/regulator/tps65218-regulator.c
index 69b4b7750410..8b24404be0bd 100644
--- a/drivers/regulator/tps65218-regulator.c
+++ b/drivers/regulator/tps65218-regulator.c
@@ -127,7 +127,7 @@ static int tps65218_pmic_set_voltage_sel(struct 
regulator_dev *dev,
 static int tps65218_pmic_enable(struct regulator_dev *dev)
 {
struct tps65218 *tps = rdev_get_drvdata(dev);
-   unsigned int rid = rdev_get_id(dev);
+   int rid = rdev_get_id(dev);
 
if (rid  TPS65218_DCDC_1 || rid  TPS65218_LDO_1)
return -EINVAL;
@@ -141,7 +141,7 @@ static int tps65218_pmic_enable(struct regulator_dev *dev)
 static int tps65218_pmic_disable(struct regulator_dev *dev)
 {
struct tps65218 *tps = rdev_get_drvdata(dev);
-   unsigned int rid = rdev_get_id(dev);
+   int rid = rdev_get_id(dev);
 
if (rid  TPS65218_DCDC_1 || rid  TPS65218_LDO_1)
return -EINVAL;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] regulator: tps65217: Fix build warnings

2014-06-24 Thread Sachin Kamat
rdev_get_id() returns an int. Convert rid to type int to avoid the
following warnings:

drivers/regulator/tps65217-regulator.c:73:10: warning: comparison of unsigned 
expression  0 is always false [-Wtype-limits]
drivers/regulator/tps65217-regulator.c:87:10: warning: comparison of unsigned 
expression  0 is always false [-Wtype-limits]

Signed-off-by: Sachin Kamat sachin.ka...@samsung.com
---
Series compile tested.
---
 drivers/regulator/tps65217-regulator.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/tps65217-regulator.c 
b/drivers/regulator/tps65217-regulator.c
index f7ed20a5a8b9..d58db72a63b0 100644
--- a/drivers/regulator/tps65217-regulator.c
+++ b/drivers/regulator/tps65217-regulator.c
@@ -68,7 +68,7 @@ static const struct regulator_linear_range 
tps65217_uv2_ranges[] = {
 static int tps65217_pmic_enable(struct regulator_dev *dev)
 {
struct tps65217 *tps = rdev_get_drvdata(dev);
-   unsigned int rid = rdev_get_id(dev);
+   int rid = rdev_get_id(dev);
 
if (rid  TPS65217_DCDC_1 || rid  TPS65217_LDO_4)
return -EINVAL;
@@ -82,7 +82,7 @@ static int tps65217_pmic_enable(struct regulator_dev *dev)
 static int tps65217_pmic_disable(struct regulator_dev *dev)
 {
struct tps65217 *tps = rdev_get_drvdata(dev);
-   unsigned int rid = rdev_get_id(dev);
+   int rid = rdev_get_id(dev);
 
if (rid  TPS65217_DCDC_1 || rid  TPS65217_LDO_4)
return -EINVAL;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 net-next 0/2] split BPF out of core networking

2014-06-24 Thread Daniel Borkmann

On 06/23/2014 11:57 PM, Alexei Starovoitov wrote:

On Fri, Jun 20, 2014 at 9:44 AM, Chema Gonzalez ch...@google.com wrote:

...

   - nop: I'd like to have a nop. Do I know why? Nope.

nope. Let's not add unnecessary instructions.

A valid nop is a useful instruction: padding, filling up arrays of
sock_filter_int correctly (as in lib/test_bpf.c, where we're currently
using a ld #0, which loads zero to register A), and other use cases
(see http://en.wikipedia.org/wiki/NOP ).


especially I don't like to add 'nop' instruction.
code==0 to mean 'ld #0' is one of classic BPF ugliness.


I think it was probably unintended to be able to have unreachable
code e.g. filled with 'nops' where both jt, jf just jump over it,
but that quirk we cannot change anymore in the classic checker
and have to carry onwards.


We're not filling up arrays with nops in lib/test_bpf.c
Zero is invalid opcode in eBPF and should stay so, since it's
an easy check for humans like me who are looking at eBPF in hex.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH V2 Resend] sched/core: fix formatting issues in sched_can_stop_tick()

2014-06-24 Thread Viresh Kumar
sched_can_stop_tick() is using 7 spaces instead of 8 spaces or a 'tab' at the
beginning of few lines. Which doesn't align well with the Coding Guidelines.

Also remove local variable 'rq' as it is used at only one place and we can
directly use this_rq() instead.

Signed-off-by: Viresh Kumar viresh.ku...@linaro.org
---
Rebased again against tip/master ..

 kernel/sched/core.c | 10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 7f3063c..866d840 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -736,19 +736,15 @@ static inline bool got_nohz_idle_kick(void)
 #ifdef CONFIG_NO_HZ_FULL
 bool sched_can_stop_tick(void)
 {
-   struct rq *rq;
-
-   rq = this_rq();
-
/*
 * More than one running task need preemption.
 * nr_running update is assumed to be visible
 * after IPI is sent from wakers.
 */
-   if (rq-nr_running  1)
-   return false;
+   if (this_rq()-nr_running  1)
+   return false;
 
-   return true;
+   return true;
 }
 #endif /* CONFIG_NO_HZ_FULL */
 
-- 
2.0.0.rc2

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/4] perf timechart: implement IO mode

2014-06-24 Thread Jiri Olsa
On Fri, Jun 20, 2014 at 02:29:49PM +0400, Stanislav Fomichev wrote:
 In IO mode timechart shows any disk/network activity.

way too small changelog for the size of the patch ;-)

I'll need some more info (description, usage..) to push this throught

thanks,
jirka

 
 Signed-off-by: Stanislav Fomichev stfomic...@yandex-team.ru
 ---
  tools/perf/Documentation/perf-timechart.txt |  25 +-
  tools/perf/builtin-timechart.c  | 613 
 +++-
  tools/perf/util/svghelper.c |  98 -
  tools/perf/util/svghelper.h |   6 +-
  4 files changed, 718 insertions(+), 24 deletions(-)
 
 diff --git a/tools/perf/Documentation/perf-timechart.txt 
 b/tools/perf/Documentation/perf-timechart.txt
 index 5e0f986dff38..ec6b46c7bca0 100644
 --- a/tools/perf/Documentation/perf-timechart.txt
 +++ b/tools/perf/Documentation/perf-timechart.txt
 @@ -15,10 +15,20 @@ DESCRIPTION
  There are two variants of perf timechart:
  
'perf timechart record command' to record the system level events
 -  of an arbitrary workload.
 +  of an arbitrary workload. By default timechart records only scheduler
 +  and CPU events (task switches, running times, CPU power states, etc),
 +  but it's possible to record IO (disk, network) activity using -I argument.
  
'perf timechart' to turn a trace into a Scalable Vector Graphics file,
 -  that can be viewed with popular SVG viewers such as 'Inkscape'.
 +  that can be viewed with popular SVG viewers such as 'Inkscape'. Depending
 +  on the events in the perf.data file, timechart will contain scheduler/cpu
 +  events or IO events.
 +
 +  In IO mode, every bar has two charts: upper and lower.
 +  Upper bar shows incoming events (disk reads, ingress network packets).
 +  Lower bar shows outgoing events (disk writes, egress network packets).
 +  There are also poll bars which show how much time application spent
 +  in poll/epoll/select syscalls.
  
  TIMECHART OPTIONS
  -
 @@ -63,6 +73,9 @@ RECORD OPTIONS
  -T::
  --tasks-only::
  Record only tasks-related events
 +-I::
 +--io-only::
 +Record only io-related events
  -g::
  --callchain::
  Do call-graph (stack chain/backtrace) recording
 @@ -87,6 +100,14 @@ Record system-wide timechart:
  
$ perf timechart --highlight gcc
  
 +Record system-wide IO events:
 +
 +  $ perf timechart record -I
 +
 +  then generate timechart:
 +
 +  $ perf timechart
 +
  SEE ALSO
  
  linkperf:perf-record[1]
 diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
 index 74db2568b867..8d454c55bc4e 100644
 --- a/tools/perf/builtin-timechart.c
 +++ b/tools/perf/builtin-timechart.c
 @@ -60,10 +60,14 @@ struct timechart {
   tasks_only,
   with_backtrace,
   topology;
 + /* IO related settings */
 + u64 io_events;
 + boolio_only;
  };
  
  struct per_pidcomm;
  struct cpu_sample;
 +struct io_sample;
  
  /*
   * Datastructure layout:
 @@ -84,6 +88,7 @@ struct per_pid {
   u64 start_time;
   u64 end_time;
   u64 total_time;
 + u64 total_bytes;
   int display;
  
   struct per_pidcomm *all;
 @@ -97,6 +102,8 @@ struct per_pidcomm {
   u64 start_time;
   u64 end_time;
   u64 total_time;
 + u64 max_bytes;
 + u64 total_bytes;
  
   int Y;
   int display;
 @@ -107,6 +114,7 @@ struct per_pidcomm {
   char*comm;
  
   struct cpu_sample *samples;
 + struct io_sample  *io_samples;
  };
  
  struct sample_wrapper {
 @@ -131,6 +139,27 @@ struct cpu_sample {
   const char *backtrace;
  };
  
 +enum {
 + IOTYPE_READ,
 + IOTYPE_WRITE,
 + IOTYPE_SYNC,
 + IOTYPE_TX,
 + IOTYPE_RX,
 + IOTYPE_POLL,
 +};
 +
 +struct io_sample {
 + struct io_sample *next;
 +
 + u64 start_time;
 + u64 end_time;
 + u64 bytes;
 + int type;
 + int fd;
 + int err;
 + int merges;
 +};
 +
  #define CSTATE 1
  #define PSTATE 2
  
 @@ -682,6 +711,212 @@ static void end_sample_processing(struct timechart 
 *tchart)
   }
  }
  
 +static int pid_begin_io_sample(struct timechart *tchart, int pid, int type,
 +u64 start, int fd)
 +{
 + struct per_pid *p = find_create_pid(tchart, pid);
 + struct per_pidcomm *c = p-current;
 + struct io_sample *sample;
 + struct io_sample *prev;
 +
 + if (!c) {
 + c = zalloc(sizeof(*c));
 + if (!c)
 + return -ENOMEM;
 + p-current = c;
 + c-next = p-all;
 + p-all = c;
 + }
 +
 + prev = c-io_samples;
 +
 + if (prev  prev-start_time  !prev-end_time) {
 + pr_err(Invalid previous event (duplicate start)!\n);
 +   

Re: [PATCH 1/1] regulator: as3722: Fix incorrect parameter initialization

2014-06-24 Thread Laxman Dewangan

On Tuesday 24 June 2014 01:54 PM, Sachin Kamat wrote:

'name' field was re-initialized and getting overwritten in some
cases possibly due to a typo. Code inspection says the second time
it should be 'sname' instead of 'name'. Replace it.

Signed-off-by: Sachin Kamat sachin.ka...@samsung.com




Agree, thanks for finding this.

Reviewed-by: Laxman Dewangan ldewan...@nvidia.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 0/4] perf timechart io mode

2014-06-24 Thread Jiri Olsa
On Fri, Jun 20, 2014 at 02:29:47PM +0400, Stanislav Fomichev wrote:
 This patchset adds IO mode: instead of process time we record io syscalls
 and then draw timechart of writes/reads/tx/rx/polls.
 
 v4:
   - another attempt for fix segfault when skipping invalid tracepoints
   - added new patch to fix rendering in Firefox

hum, got this when trying:

[jolsa@krava perf]$ sudo ./perf timechart record -I
^C[ perf record: Woken up 2 times to write data ]
[ perf record: Captured and wrote 1.071 MB perf.data (~46806 samples) ]
[jolsa@krava perf]$ ./perf timechart
Invalid previous event (non-zero)!
0x113f80 [0x8]: failed to process type: 68

jirka

 
 v3:
   - fixed segfault when skipping invalid tracepoints
   - added ms/us units support for --io-xyz time options
   - fixed missing boxes on Firefox
 
 v2:
   - separated start_time fix into distinct commit
   - separated --io-xyz options into distinct commit
   - fixed 'error' shadowing
   - initialized variables in declaration when possible
   - removed assert usage
   - fprintf - pr_err
   - removed wrongly placed __maybe_unused
 
 Stanislav Fomichev (4):
   perf timechart: fix rendering in Firefox
   perf timechart: implement IO mode
   perf timechart: conditionally update start_time on fork
   perf timechart: add more options to IO mode
 
  tools/perf/Documentation/perf-timechart.txt |  38 +-
  tools/perf/builtin-timechart.c  | 686 
 +++-
  tools/perf/util/svghelper.c | 168 +--
  tools/perf/util/svghelper.h |   6 +-
  4 files changed, 838 insertions(+), 60 deletions(-)
 
 -- 
 1.8.3.2
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] regulator: s5m8767: Remove unused variable

2014-06-24 Thread Sachin Kamat
'size' is not used in the function. Remove it.

Signed-off-by: Sachin Kamat sachin.ka...@samsung.com
---
 drivers/regulator/s5m8767.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index c79af943a5c0..0ab5cbeeb797 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -686,7 +686,7 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
struct sec_platform_data *pdata = iodev-pdata;
struct regulator_config config = { };
struct s5m8767_info *s5m8767;
-   int i, ret, size, buck_init;
+   int i, ret, buck_init;
 
if (!pdata) {
dev_err(pdev-dev.parent, Platform data not supplied\n);
@@ -725,8 +725,6 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
if (!s5m8767)
return -ENOMEM;
 
-   size = sizeof(struct regulator_dev *) * (S5M8767_REG_MAX - 2);
-
s5m8767-dev = pdev-dev;
s5m8767-iodev = iodev;
s5m8767-num_regulators = pdata-num_regulators;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] [TRIVIAL] fs: Fix comment typo 'CONFIG_LBADF'

2014-06-24 Thread Paul Bolle
Signed-off-by: Paul Bolle pebo...@tiscali.nl
---
 fs/stack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/stack.c b/fs/stack.c
index 5b5388250e29..a54e33ed10f1 100644
--- a/fs/stack.c
+++ b/fs/stack.c
@@ -44,7 +44,7 @@ void fsstack_copy_inode_size(struct inode *dst, struct inode 
*src)
 * include/linux/fs.h).  We don't necessarily hold i_mutex when this
 * is called, so take i_lock for that case.
 *
-* And if CONFIG_LBADF (on 32-bit), continue our effort to keep the
+* And if CONFIG_LBDAF (on 32-bit), continue our effort to keep the
 * two halves of i_blocks in sync despite SMP or PREEMPT: use i_lock
 * for that case too, and do both at once by combining the tests.
 *
-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] arch/mips rb532: replace mac_addr parsing

2014-06-24 Thread Daniel Walter
Replace parse_mac_addr with sscanf.


Signed-off-by: Daniel Walter dwal...@google.com
---
Changes since v1:
  sending in the working patch
Patch applies against current linux-tree
---
 arch/mips/rb532/devices.c | 30 +++---
 1 file changed, 7 insertions(+), 23 deletions(-)
---
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index 3af00b2..6e32819b 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -250,28 +250,6 @@ static struct platform_device *rb532_devs[] = {
rb532_wdt
 };
 
-static void __init parse_mac_addr(char *macstr)
-{
-   int i, h, l;
-
-   for (i = 0; i  6; i++) {
-   if (i != 5  *(macstr + 2) != ':')
-   return;
-
-   h = hex_to_bin(*macstr++);
-   if (h == -1)
-   return;
-
-   l = hex_to_bin(*macstr++);
-   if (l == -1)
-   return;
-
-   macstr++;
-   korina_dev0_data.mac[i] = (h  4) + l;
-   }
-}
-
-
 /* NAND definitions */
 #define NAND_CHIP_DELAY 25
 
@@ -333,7 +311,13 @@ static int __init plat_setup_devices(void)
 static int __init setup_kmac(char *s)
 {
printk(KERN_INFO korina mac = %s\n, s);
-   parse_mac_addr(s);
+   sscanf(s, %hhx:%hhx:%hhx:%hhx:%hhx:%hhx,
+   korina_dev0_data.mac[0],
+   korina_dev0_data.mac[1],
+   korina_dev0_data.mac[2],
+   korina_dev0_data.mac[3],
+   korina_dev0_data.mac[4],
+   korina_dev0_data.mac[5]);
return 0;
 }
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v2] clocksource: document some basic timekeeping concepts

2014-06-24 Thread Linus Walleij
This adds some documentation about clock sources, clock events,
the weak sched_clock() function and delay timers that answers
questions that repeatedly arise on the mailing lists.

Cc: Thomas Gleixner t...@linutronix.de
Cc: Nicolas Pitre n...@fluxnic.net
Cc: Colin Cross ccr...@google.com
Cc: John Stultz john.stu...@linaro.org
Cc: Peter Zijlstra pet...@infradead.org
Cc: Ingo Molnar mi...@redhat.com
Signed-off-by: Linus Walleij linus.wall...@linaro.org
---
ChangeLog v1-v2:
- Included paragraphs and minor edits to account for PeterZ's
  comments on addressing SMP use cases, which makes especially
  the semantics of sched_clock() much clearer.
---
 Documentation/timers/00-INDEX|   2 +
 Documentation/timers/timekeeping.txt | 179 +++
 2 files changed, 181 insertions(+)
 create mode 100644 Documentation/timers/timekeeping.txt

diff --git a/Documentation/timers/00-INDEX b/Documentation/timers/00-INDEX
index 6d042dc1cce0..ee212a27772f 100644
--- a/Documentation/timers/00-INDEX
+++ b/Documentation/timers/00-INDEX
@@ -12,6 +12,8 @@ Makefile
- Build and link hpet_example
 NO_HZ.txt
- Summary of the different methods for the scheduler clock-interrupts 
management.
+timekeeping.txt
+   - Clock sources, clock events, sched_clock() and delay timer notes
 timers-howto.txt
- how to insert delays in the kernel the right (tm) way.
 timer_stats.txt
diff --git a/Documentation/timers/timekeeping.txt 
b/Documentation/timers/timekeeping.txt
new file mode 100644
index ..89ff5c39edcc
--- /dev/null
+++ b/Documentation/timers/timekeeping.txt
@@ -0,0 +1,179 @@
+Clock sources, Clock events, sched_clock() and delay timers
+---
+
+This document tries to briefly explain some basic kernel timekeeping
+abstractions. It partly pertains to the drivers usually found in
+drivers/clocksource in the kernel tree, but the code may be spread out
+across the kernel.
+
+If you grep through the kernel source you will find a number of architecture-
+specific implementations of clock sources, clockevents and several likewise
+architecture-specific overrides of the sched_clock() function and some
+delay timers.
+
+To provide timekeeping for your platform, the clock source provides
+the basic timeline, whereas clock events shoot interrupts on certain points
+on this timeline, providing facilities such as high-resolution timers.
+sched_clock() is used for scheduling and timestamping, and delay timers
+provide an accurate delay source using hardware counters.
+
+
+Clock sources
+-
+
+The purpose of the clock source is to provide a timeline for the system that
+tells you where you are in time. For example issuing the command 'date' on
+a Linux system will eventually read the clock source to determine exactly
+what time it is.
+
+Typically the clock source is a monotonic, atomic counter which will provide
+n bits which count from 0 to 2^(n-1) and then wraps around to 0 and start over.
+It will ideally NEVER stop ticking as long as the system is functional.
+
+The clock source shall have as high resolution as possible, and shall be as
+stable and correct as possible as compared to a real-world wall clock. It
+should not move unpredictably back and forth in time or miss a few cycles
+here and there.
+
+It must be immune to the kind of effects that occur in hardware where e.g.
+the counter register is read in two phases on the bus lowest 16 bits first
+and the higher 16 bits in a second bus cycle with the counter bits
+potentially being updated inbetween leading to the risk of very strange
+values from the counter.
+
+When the wall-clock accuracy of the clock source isn't satisfactory, there
+are various quirks and layers in the timekeeping code for e.g. synchronizing
+the user-visible time to RTC clocks in the system or against networked time
+servers using NTP, but all they do is basically to update an offset against
+the clock source, which provides the fundamental timeline for the system.
+These measures does not affect the clock source per se, they only adapt the
+system to the shortcomings of it.
+
+The clock source struct shall provide means to translate the provided counter
+into a rough nanosecond value as an unsigned long long (unsigned 64 bit) 
number.
+Since this operation may be invoked very often, doing this in a strict
+mathematical sense is not desireable: instead the number is taken as close as
+possible to a nanosecond value using only the arithmetic operations
+mult and shift, so in clocksource_cyc2ns() you find:
+
+  ns ~= (clocksource * mult)  shift
+
+You will find a number of helper functions in the clock source code intended
+to aid in providing these mult and shift values, such as
+clocksource_khz2mult(), clocksource_hz2mult() that help determinining the
+mult factor from a fixed shift, and clocksource_calc_mult_shift() and
+clocksource_register_hz() which will help out assigning both shift 

[git pull] IOMMU Fixes for Linux v3.16-rc2

2014-06-24 Thread Joerg Roedel
Hi Linus,

The following changes since commit 7171511eaec5bf23fb06078f59784a3a0626b38f:

  Linux 3.16-rc1 (2014-06-15 17:45:28 -1000)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git 
tags/iommu-fixes-v3.16-rc1

for you to fetch changes up to d73a6d722a675dbba8f6b52c964a7076a24a12c1:

  iommu/amd: Fix small race between invalidate_range_end/start (2014-06-20 
16:14:22 +0200)


IOMMU Fixes for Linux v3.16-rc1

* Fix VT-d regression with handling multiple RMRR entries per
  device
* Fix a small race that was left in the mmu_notifier handling in
  the AMD IOMMUv2 driver


Jiang Liu (1):
  iommu/vt-d: fix bug in handling multiple RMRRs for the same PCI device

Joerg Roedel (1):
  iommu/amd: Fix small race between invalidate_range_end/start

 drivers/iommu/amd_iommu_v2.c | 18 +-
 drivers/iommu/intel-iommu.c  |  9 +++--
 2 files changed, 16 insertions(+), 11 deletions(-)

Please pull.

Thanks,

Joerg



signature.asc
Description: Digital signature


Re: [PATCH] arm: ptrace: fix syscall modification under PTRACE_O_TRACESECCOMP

2014-06-24 Thread Will Deacon
On Mon, Jun 23, 2014 at 08:46:52PM +0100, Kees Cook wrote:
 On Mon, Jun 23, 2014 at 1:46 AM, Will Deacon will.dea...@arm.com wrote:
  On Fri, Jun 20, 2014 at 07:10:46PM +0100, Kees Cook wrote:
  On Fri, Jun 20, 2014 at 10:36 AM, Kees Cook keesc...@chromium.org wrote:
   On Fri, Jun 20, 2014 at 10:23 AM, Will Deacon will.dea...@arm.com 
   wrote:
   Right, gotcha. Thanks for the explanation. I was confused, because
   tracehook_report_syscall does the right thing (returns
   current_thread_info()-syscall), but if we don't have TIF_SYSCALL_TRACE 
   set,
   then updates during the secure_computing callback will be ignored.
  
   However, my fix to this is significantly smaller than your patch, so I 
   fear
   I'm still missing something.
  
   Oh, yes, that's much smaller. Nice! I will test this and report back.
 
  Yup, I can confirm this works. Thanks!
 
  Tested-by: Kees Cook keesc...@chromium.org
 
  Thanks, Kees. I'll post a patch shortly. I'll try and remember to keep an
  eye out for this when seccomp lands for arm64 too.
 
 Great, thanks!
 
 What's the state of seccomp on arm64? I saw a series back in March,
 but nothing since then? It looked complete, but I haven't set up a
 test environment yet to verify.

I think Akashi was going to repost `real soon now' so we can include them
for 3.17. He missed the merge window last time around.

Will
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Humanitarian Project Offer

2014-06-24 Thread Georgina Hope Rinehart
Greetings in the Name of Our Lord,

I have a charity proposal for you, reply back for more information.

Kind regards.
Gina Rinehart
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] i2c: cros_ec: Remove EC_I2C_FLAG_10BIT

2014-06-24 Thread Lee Jones
On Mon, 23 Jun 2014, Doug Anderson wrote:

 In https://lkml.org/lkml/2014/6/10/265 pointed out that the 10-bit
 flag in the cros_ec_tunnel was useless.  It went into a 16-bit flags
 field but was defined at (1  16).
 
 Since we have no 10-bit i2c devices on the other side of the tunnel on
 any known devices this was never a problem.  Until we do it makes
 sense to remove this code.  On the EC side the code to handle this
 flag was removed in https://chromium-review.googlesource.com/204162.
 
 Reported-by: Dave Jones da...@redhat.com
 Signed-off-by: Doug Anderson diand...@chromium.org
 ---
 Note that this patch is based atop my current series of posts to
 cleanup cros_ec.  It wouldn't be hard to apply it to the current ToT
 if someone wants to land this before the others.
 
  drivers/i2c/busses/i2c-cros-ec-tunnel.c | 6 --
  include/linux/mfd/cros_ec_commands.h| 3 ---

For the MFD part:
  Acked-by: Lee Jones lee.jo...@linaro.org

  2 files changed, 4 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/i2c/busses/i2c-cros-ec-tunnel.c 
 b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
 index 05e033c..6d7d009 100644
 --- a/drivers/i2c/busses/i2c-cros-ec-tunnel.c
 +++ b/drivers/i2c/busses/i2c-cros-ec-tunnel.c
 @@ -94,7 +94,7 @@ static int ec_i2c_construct_message(u8 *buf, const struct 
 i2c_msg i2c_msgs[],
   msg-addr_flags = i2c_msg-addr;
  
   if (i2c_msg-flags  I2C_M_TEN)
 - msg-addr_flags |= EC_I2C_FLAG_10BIT;
 + return -EINVAL;
  
   if (i2c_msg-flags  I2C_M_RD) {
   msg-addr_flags |= EC_I2C_FLAG_READ;
 @@ -218,7 +218,9 @@ static int ec_i2c_xfer(struct i2c_adapter *adap, struct 
 i2c_msg i2c_msgs[],
   }
   }
  
 - ec_i2c_construct_message(request, i2c_msgs, num, bus_num);
 + result = ec_i2c_construct_message(request, i2c_msgs, num, bus_num);
 + if (result)
 + goto exit;
  
   msg.version = 0;
   msg.command = EC_CMD_I2C_PASSTHRU;
 diff --git a/include/linux/mfd/cros_ec_commands.h 
 b/include/linux/mfd/cros_ec_commands.h
 index 7853a64..a49cd41 100644
 --- a/include/linux/mfd/cros_ec_commands.h
 +++ b/include/linux/mfd/cros_ec_commands.h
 @@ -1928,9 +1928,6 @@ struct ec_response_power_info {
  
  #define EC_CMD_I2C_PASSTHRU 0x9e
  
 -/* Slave address is 10 (not 7) bit */
 -#define EC_I2C_FLAG_10BIT(1  16)
 -
  /* Read data; if not present, message is a write */
  #define EC_I2C_FLAG_READ (1  15)
  

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 2/5] acpi, apei, ghes: Introduce ARCH_HAS_ACPI_APEI_NMI to make NMI error notification a GHES feature.

2014-06-24 Thread Tomasz Nowicki



On 19.06.2014 16:27, Borislav Petkov wrote:

On Fri, Jun 13, 2014 at 01:02:57PM +0200, Tomasz Nowicki wrote:

Currently APEI depends on x86 architecture. It is because of NMI hardware
error notification of GHES which is currently supported by x86 only.
However, many other APEI features can be still used perfectly by other
architectures.

This commit adds ARCH_HAS_ACPI_APEI_NMI which will be used in next patches
for NMI related code isolation in ghes.c file. Only NMI error notification
feature depends on x86 so let it be hard selected for x86 arch.

Signed-off-by: Tomasz Nowicki tomasz.nowi...@linaro.org
---
  arch/x86/Kconfig  |1 +
  drivers/acpi/apei/Kconfig |8 +++-
  2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 3fc9b12..e1dc819 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -24,6 +24,7 @@ config X86
select ARCH_HAS_DEBUG_STRICT_USER_COPY_CHECKS
select ARCH_MIGHT_HAVE_PC_PARPORT
select ARCH_MIGHT_HAVE_PC_SERIO
+   select ARCH_HAS_ACPI_APEI_NMI
select HAVE_AOUT if X86_32
select HAVE_UNSTABLE_SCHED_CLOCK
select ARCH_SUPPORTS_NUMA_BALANCING if X86_64
diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig
index c4dac71..9f6c3ec 100644
--- a/drivers/acpi/apei/Kconfig
+++ b/drivers/acpi/apei/Kconfig
@@ -3,7 +3,6 @@ config ACPI_APEI
select MISC_FILESYSTEMS
select PSTORE
select UEFI_CPER
-   depends on X86


Now this can practically be enabled on any architecture, AFAICT. Which
is wrong.

I think a better solution would be to have another HAVE_ symbol which
each arch which sports APEI selects. Like in the diff below ontop of
this patch, also incorporating Robert's comments.

You'll have to do select HAVE_ACPI_APEI on arm too.

Hmm?



Now that it turns out we have to provide at least tlb_flush_... arch 
function, APEI can not be selected by any architecture. So you are right 
I will introduce HAVE_ACPI_APEI in next version of patches. Thanks.


Tomasz
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 1/5] apei, mce: Factor out APEI architecture specific MCE calls.

2014-06-24 Thread Tomasz Nowicki

On 19.06.2014 16:17, Borislav Petkov wrote:

On Fri, Jun 13, 2014 at 01:02:56PM +0200, Tomasz Nowicki wrote:

This commit abstracts MCE calls and provides weak corresponding default
implementation for those architectures which do not need arch specific
actions. Each platform willing to do additional architectural actions
should provides desired function definition. It allows us to avoid wrap
code into #ifdef in generic code and prevent new platform from introducing
dummy stub function too.

Initially, there are two APEI arch-specific calls:
- apei_arch_enable_cmcff()
- apei_arch_report_mem_error()
Both interact with MCE driver for X86 architecture.

Signed-off-by: Tomasz Nowicki tomasz.nowi...@linaro.org


...


diff --git a/arch/x86/kernel/acpi/apei.c b/arch/x86/kernel/acpi/apei.c
new file mode 100644
index 000..dca2852
--- /dev/null
+++ b/arch/x86/kernel/acpi/apei.c
@@ -0,0 +1,56 @@
+/*
+ * Arch-specific APEI-related functions.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include acpi/apei.h
+
+#include asm/mce.h
+
+int apei_arch_enable_cmcff(struct acpi_hest_header *hest_hdr, void *data)


Arch-specific function names usually use the arch_ prefix. Otherwise
it looks ok.


True, will fix that.

Tomasz
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/5] acpi, apei, ghes: Introduce more generic mechanism to init/deinit GHES error notifications.

2014-06-24 Thread Tomasz Nowicki

On 13.06.2014 15:10, Robert Richter wrote:

On 13.06.14 13:02:58, Tomasz Nowicki wrote:


@@ -811,6 +819,8 @@ static int ghes_notify_nmi(unsigned int cmd, struct pt_regs 
*regs)
int sev, sev_global = -1;
int ret = NMI_DONE;

+   BUG_ON(!IS_ENABLED(ARCH_HAS_ACPI_APEI_NMI));
+


Now that we have the ARCH_HAS_ACPI_APEI_NMI option, group nmi code,
put it in an #ifdef ... and make function stubs for the !nmi case
where necessary. That code should moved to patch #2. If an arch does
not support nmi code, we don't want to compile it into the kernel.

Also this patch is quit a bit large and should further split into
moving functional code into separate functions and the introduction of
the notifier setup. This makes review much easier.

I did not yet took a deep look into your notifier framework, but I
don't really see a reason for the dynamic collection of function
pointers in ghes_notify_tab. See below.


raw_spin_lock(ghes_nmi_lock);
list_for_each_entry_rcu(ghes, ghes_nmi, list) {
if (ghes_read_estatus(ghes, 1)) {
@@ -875,10 +885,6 @@ out:
return ret;
  }



+static int ghes_notify_init_nmi(struct ghes *ghes)
+{
+   unsigned long len;
+   int status = 0;
+
+   len = ghes_esource_prealloc_size(ghes-generic);
+   ghes_estatus_pool_expand(len);
+   mutex_lock(ghes_list_mutex);
+   if (list_empty(ghes_nmi))
+   status = register_nmi_handler(NMI_LOCAL, ghes_notify_nmi, 0,
+ ghes);
+   list_add_rcu(ghes-list, ghes_nmi);
+   mutex_unlock(ghes_list_mutex);
+
+   return status;
+}
+
+static void ghes_notify_remove_nmi(struct ghes *ghes)
+{
+   unsigned long len;
+
+   mutex_lock(ghes_list_mutex);
+   list_del_rcu(ghes-list);
+   if (list_empty(ghes_nmi))
+   unregister_nmi_handler(NMI_LOCAL, ghes);
+   mutex_unlock(ghes_list_mutex);
+   /*
+* To synchronize with NMI handler, ghes can only be
+* freed after NMI handler finishes.
+*/
+   synchronize_rcu();
+   len = ghes_esource_prealloc_size(ghes-generic);
+   ghes_estatus_pool_shrink(len);
+}
+
+static void ghes_init_nmi(void)
+{
+   if (!IS_ENABLED(ARCH_HAS_ACPI_APEI_NMI))
+   return;
+
+   init_irq_work(ghes_proc_irq_work, ghes_proc_in_irq);
+   ghes_notify_tab[ACPI_HEST_NOTIFY_NMI].init_call = ghes_notify_init_nmi;
+   ghes_notify_tab[ACPI_HEST_NOTIFY_NMI].remove_call =
+   ghes_notify_remove_nmi;
+}
+


So this is the only code of your whole patch set that actually changes
an entry, and just one time only during nmi init. Thus, there is no
need at all for ghes_notify_tab. Just create function stubs for
ghes_notify_{init,remove}_nmi for the !nmi case with the error message
in it and call the functions directly in the switch/cases.


+static struct ghes_notify_setup
+   ghes_notify_tab[ACPI_HEST_NOTIFY_RESERVED] = {
+   [ACPI_HEST_NOTIFY_POLLED]   = {POLLED,
+  ghes_notify_init_polled,
+  ghes_notify_remove_polled},
+   [ACPI_HEST_NOTIFY_EXTERNAL] = {EXT_IRQ,
+  ghes_notify_init_external,
+  ghes_notify_remove_external},
+   [ACPI_HEST_NOTIFY_LOCAL]= {LOCAL_IRQ, NULL, NULL},
+   [ACPI_HEST_NOTIFY_SCI]  = {SCI,
+  ghes_notify_init_sci,
+  ghes_notify_remove_sci},
+   [ACPI_HEST_NOTIFY_NMI]  = {NMI, NULL, NULL},
+   [ACPI_HEST_NOTIFY_CMCI] = {CMCI, NULL, NULL},
+   [ACPI_HEST_NOTIFY_MCE]  = {MCE, NULL, NULL},
+};


Again, just keep the switch/case statements in the probe and removal
function and call the init/remove functions directly in them. This is
much easier.

If we need dynamic registration of handlers (which I don't see yet)
for the error sources above we could do this with an acpi notify
handler or so.



Without abstraction, notify handler registration seems to be overhead. I 
will modify code as you suggested. Thanks.


Tomasz
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH -tip ] [BUGFIX]: Fix to add a missing pair of braces for error path.

2014-06-24 Thread Jiri Olsa
On Mon, Jun 23, 2014 at 03:17:12AM +, Masami Hiramatsu wrote:
 Fix to add a missing pair of braces for error path.
 Commit 36d789a4d75f (perf probe: Improve error message for
 unknown member of data structure) introduced this bug.
 
 Without this fix, defining an event with global variables
 is always failed, because it always returns -ENOENT if
 the argument is not a local variable.
 
   
   # perf probe -na vfs_read smp_found_config
 Error: Failed to add events.
   
 
 With this fix, you can set a global variable for the
 argument of new event.
 
   
   # perf probe -na vfs_read smp_found_config
   Added new event:
 probe:vfs_read   (on vfs_read with smp_found_config)
 
   You can now use it in all perf tools, such as:
 
   perf record -e probe:vfs_read -aR sleep 1
   

queued for perf/urgent

thanks,
jirka
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 0/4] perf timechart io mode

2014-06-24 Thread Stanislav Fomichev
 hum, got this when trying:
 
 [jolsa@krava perf]$ sudo ./perf timechart record -I
 ^C[ perf record: Woken up 2 times to write data ]
 [ perf record: Captured and wrote 1.071 MB perf.data (~46806 samples) ]
 [jolsa@krava perf]$ ./perf timechart
 Invalid previous event (non-zero)!
 0x113f80 [0x8]: failed to process type: 68
Hm, I added a bunch of consistency checks which I couldn't actually hit
myself. Nice work :-) Can I get you perf.data?
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC] Tux3 for review

2014-06-24 Thread Daniel Phillips

On Monday, June 23, 2014 9:41:30 PM PDT, James Bottomley wrote:


[rhetoric snipped] 


... I'm still arguing the facts: proving
that page forking can be integrated into writeback without adding to the
maintenance burden is a big issue for tux3.


Sorry, I must have missed those facts, I only saw recycled opinions.


We're all still waiting for the patches you were going to produce
showing how this could be done.


That makes sense, because the patches to transform our workarounds
into shiny new kernel hooks are still in progress, as I said. I would
appreciate the courtesy of being permitted to take the time to do the
work to the necessary quality without being subjected to endless
carping about when the patches will be posted.

If there is genuine interest in how we are approaching the new mm
hooks for page forking I will happily to take the time to discuss
it.

Note that I do not complain about Dave Chinner's endless carping, which
contains much the same rhetoric as your posts, the difference being that
Dave has proved himself a good reviewer. Though Dave behaves as caustically
as you or perhaps more so, he always takes care to provide just enough
useful technical sweetener to keep the technical vs toxic balance on the
positive side. Of course, it would be much better for all if he cared to
adopt a collegial manner, like Ted for example, who incidentally can flame
with the best of them when he wants to. But who would want to, other than a
self obsessed moron?

Speaking of Dave, what would be really interesting at this point is the 
long

story of how XFS worked around pretty nearly the same writeback issues that
Tux3 does. We already saw the short story, but it went by pretty fast. 
Color
me truly interested, in part because a good solution to this is probably 
what
we really want for writeback. Not immediately, because re-engineering parts 
of
core kernel unnecessarily during a filesystem merge is simply foolhardy, 
but

at some time in the not too distant future. (CC to Dave added.)

Regards,

Daniel

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/1] mfd: pm8921-core: Remove unused variable

2014-06-24 Thread Sachin Kamat
‘irq_bit’ is unused in the function. Remove it.

Signed-off-by: Sachin Kamat sachin.ka...@samsung.com
---
Compile tested.
---
 drivers/mfd/pm8921-core.c |4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/mfd/pm8921-core.c b/drivers/mfd/pm8921-core.c
index 959513803542..39904f77c049 100644
--- a/drivers/mfd/pm8921-core.c
+++ b/drivers/mfd/pm8921-core.c
@@ -186,11 +186,9 @@ static void pm8xxx_irq_mask_ack(struct irq_data *d)
 {
struct pm_irq_chip *chip = irq_data_get_irq_chip_data(d);
unsigned int pmirq = irqd_to_hwirq(d);
-   int irq_bit;
u8  block, config;
 
block = pmirq / 8;
-   irq_bit = pmirq % 8;
 
config = chip-config[pmirq] | PM_IRQF_MASK_ALL | PM_IRQF_CLR;
pm8xxx_config_irq(chip, block, config);
@@ -200,11 +198,9 @@ static void pm8xxx_irq_unmask(struct irq_data *d)
 {
struct pm_irq_chip *chip = irq_data_get_irq_chip_data(d);
unsigned int pmirq = irqd_to_hwirq(d);
-   int irq_bit;
u8  block, config;
 
block = pmirq / 8;
-   irq_bit = pmirq % 8;
 
config = chip-config[pmirq];
pm8xxx_config_irq(chip, block, config);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] devicetree: Add generic IOMMU device tree bindings

2014-06-24 Thread Will Deacon
On Sat, Jun 21, 2014 at 12:16:25AM +0100, Olav Haugan wrote:
 On 5/30/2014 12:06 PM, Arnd Bergmann wrote:
  On Friday 30 May 2014 08:16:05 Rob Herring wrote:
  Presumably the ID would be the streamID on ARM's SMMU. How would a
  master with 8 streamIDs be described? This is what Calxeda midway has
  for SATA and I would expect that to be somewhat common. Either you
  need some ID masking or you'll have lots of duplication when you have
  windows.
  
  I don't understand the problem. If you have stream IDs 0 through 7,
  you would have
  
  master@a {
  ...
  iommus = smmu 0;
  };
  
  master@b {
  ...
  iommus = smmu 1;
  };
  
  ...
  
  master@12 {
  ...
  iommus = smmu 7;
  };
  
  and you don't need a window at all. Why would you need a mask of
  some sort?
 
 We have multiple-master SMMUs and each master emits a variable number of
 StreamIDs. However, we have to apply a mask (the ARM SMMU spec allows
 for this) to the StreamIDs due to limited number of StreamID 2 Context
 Bank entries in the SMMU. If my understanding is correct we would
 represent this in the DT like this:
 
   iommu {
   #address-cells = 2;
   #size-cells = 0;
   };
 
   master@a {
   ...
   iommus = iommu StreamID0 MASK0,
iommu StreamID1 MASK1,
iommu StreamID2 MASK2;
   };

Stupid question, but why not simply describe the masked IDs? What use does
the `raw' ID have to Linux?

Will
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Documentation: remove remove_from_page_cache note

2014-06-24 Thread Lei Li
Remove this note as remove_from_page_cache has been renamed to
delete_from_page_cache since Commit 702cfbf9 (mm: goodbye
remove_from_page_cache()), and it doesn't serve any useful
purpose.

Signed-off-by: Lei Li li...@linux.vnet.ibm.com
---
 Documentation/cgroups/memcg_test.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/Documentation/cgroups/memcg_test.txt 
b/Documentation/cgroups/memcg_test.txt
index 8870b02..67c11a3 100644
--- a/Documentation/cgroups/memcg_test.txt
+++ b/Documentation/cgroups/memcg_test.txt
@@ -82,8 +82,6 @@ Under below explanation, we assume CONFIG_MEM_RES_CTRL_SWAP=y.
- add_to_page_cache_locked().
 
The logic is very clear. (About migration, see below)
-   Note: __remove_from_page_cache() is called by remove_from_page_cache()
-   and __remove_mapping().
 
 6. Shmem(tmpfs) Page Cache
The best way to understand shmem's page state transition is to read
-- 
1.8.5.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   3   4   5   6   7   8   9   10   >