[PATCH 1/5] clk: mediatek: Add initial common clock support for Mediatek SoCs.

2015-03-15 Thread Sascha Hauer
From: James Liao 

This patch adds common clock support for Mediatek SoCs, including plls,
muxes and clock gates.

Signed-off-by: James Liao 
Signed-off-by: Henry Chen 
Signed-off-by: Sascha Hauer 
---
 drivers/clk/Makefile|   1 +
 drivers/clk/mediatek/Makefile   |   1 +
 drivers/clk/mediatek/clk-gate.c | 137 +
 drivers/clk/mediatek/clk-gate.h |  49 ++
 drivers/clk/mediatek/clk-mtk.c  | 197 
 drivers/clk/mediatek/clk-mtk.h  | 155 +++
 drivers/clk/mediatek/clk-pll.c  | 325 
 7 files changed, 865 insertions(+)
 create mode 100644 drivers/clk/mediatek/Makefile
 create mode 100644 drivers/clk/mediatek/clk-gate.c
 create mode 100644 drivers/clk/mediatek/clk-gate.h
 create mode 100644 drivers/clk/mediatek/clk-mtk.c
 create mode 100644 drivers/clk/mediatek/clk-mtk.h
 create mode 100644 drivers/clk/mediatek/clk-pll.c

diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile
index d478ceb..6d97203 100644
--- a/drivers/clk/Makefile
+++ b/drivers/clk/Makefile
@@ -49,6 +49,7 @@ obj-$(CONFIG_ARCH_HI3xxx) += hisilicon/
 obj-$(CONFIG_ARCH_HIP04)   += hisilicon/
 obj-$(CONFIG_ARCH_HIX5HD2) += hisilicon/
 obj-$(CONFIG_COMMON_CLK_KEYSTONE)  += keystone/
+obj-$(CONFIG_ARCH_MEDIATEK)+= mediatek/
 ifeq ($(CONFIG_COMMON_CLK), y)
 obj-$(CONFIG_ARCH_MMP) += mmp/
 endif
diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
new file mode 100644
index 000..c384e97
--- /dev/null
+++ b/drivers/clk/mediatek/Makefile
@@ -0,0 +1 @@
+obj-y += clk-mtk.o clk-pll.o clk-gate.o
diff --git a/drivers/clk/mediatek/clk-gate.c b/drivers/clk/mediatek/clk-gate.c
new file mode 100644
index 000..9d77ee3
--- /dev/null
+++ b/drivers/clk/mediatek/clk-gate.c
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014 MediaTek Inc.
+ * Author: James Liao 
+ *
+ * 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.
+ *
+ * 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 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+#include "clk-mtk.h"
+#include "clk-gate.h"
+
+static int mtk_cg_bit_is_cleared(struct clk_hw *hw)
+{
+   struct mtk_clk_gate *cg = to_clk_gate(hw);
+   u32 val;
+
+   regmap_read(cg->regmap, cg->sta_ofs, );
+
+   val &= BIT(cg->bit);
+
+   return val == 0;
+}
+
+static int mtk_cg_bit_is_set(struct clk_hw *hw)
+{
+   struct mtk_clk_gate *cg = to_clk_gate(hw);
+   u32 val;
+
+   regmap_read(cg->regmap, cg->sta_ofs, );
+
+   val &= BIT(cg->bit);
+
+   return val != 0;
+}
+
+static void mtk_cg_set_bit(struct clk_hw *hw)
+{
+   struct mtk_clk_gate *cg = to_clk_gate(hw);
+
+   regmap_write(cg->regmap, cg->set_ofs, BIT(cg->bit));
+}
+
+static void mtk_cg_clr_bit(struct clk_hw *hw)
+{
+   struct mtk_clk_gate *cg = to_clk_gate(hw);
+
+   regmap_write(cg->regmap, cg->clr_ofs, BIT(cg->bit));
+}
+
+static int mtk_cg_enable(struct clk_hw *hw)
+{
+   mtk_cg_clr_bit(hw);
+
+   return 0;
+}
+
+static void mtk_cg_disable(struct clk_hw *hw)
+{
+   mtk_cg_set_bit(hw);
+}
+
+static int mtk_cg_enable_inv(struct clk_hw *hw)
+{
+   mtk_cg_set_bit(hw);
+
+   return 0;
+}
+
+static void mtk_cg_disable_inv(struct clk_hw *hw)
+{
+   mtk_cg_clr_bit(hw);
+}
+
+const struct clk_ops mtk_clk_gate_ops_setclr = {
+   .is_enabled = mtk_cg_bit_is_cleared,
+   .enable = mtk_cg_enable,
+   .disable= mtk_cg_disable,
+};
+
+const struct clk_ops mtk_clk_gate_ops_setclr_inv = {
+   .is_enabled = mtk_cg_bit_is_set,
+   .enable = mtk_cg_enable_inv,
+   .disable= mtk_cg_disable_inv,
+};
+
+struct clk *mtk_clk_register_gate(
+   const char *name,
+   const char *parent_name,
+   struct regmap *regmap,
+   int set_ofs,
+   int clr_ofs,
+   int sta_ofs,
+   u8 bit,
+   const struct clk_ops *ops)
+{
+   struct mtk_clk_gate *cg;
+   struct clk *clk;
+   struct clk_init_data init;
+
+   cg = kzalloc(sizeof(*cg), GFP_KERNEL);
+   if (!cg)
+   return ERR_PTR(-ENOMEM);
+
+   init.name = name;
+   init.flags = CLK_SET_RATE_PARENT;
+   init.parent_names = parent_name ? _name : NULL;
+   init.num_parents = parent_name ? 1 : 0;
+   init.ops = ops;
+
+   cg->regmap = regmap;
+   cg->set_ofs = set_ofs;
+   cg->clr_ofs = clr_ofs;
+   cg->sta_ofs = sta_ofs;
+   cg->bit = bit;
+
+   cg->hw.init = 
+
+   clk = clk_register(NULL, >hw);
+   if 

Re: [PATCH] mmc: dw_mmc: Consider HLE errors to be data and command errors

2015-03-15 Thread Jaehoon Chung
Hi, Doug.

On 03/14/2015 05:27 AM, Doug Anderson wrote:
> Hi,
> 
> On Fri, Mar 13, 2015 at 4:30 AM, Jaehoon Chung  wrote:
>> Hi, Doug.
>>
>> On 03/11/2015 12:48 AM, Doug Anderson wrote:
>>> The dw_mmc driver enables HLE errors as part of DW_MCI_ERROR_FLAGS but
>>> nothing in the interrupt handler actually handles them and ACKs them.
>>> That means that if we ever get an HLE error we'll just keep getting
>>> interrupts and we'll wedge things.
>>>
>>> We really don't expect HLE errors but if we ever get them we shouldn't
>>> silently ignore them.
>>>
>>> Note that I have seen HLE errors while constantly ejecting and
>>> inserting cards (ejecting while inserting, etc).
>>
>> Right, It is occurred when card inserting/ejecting.(This case is the case of 
>> removable card.)
>> Did you test with eMMC? We needs to consider how control HLE error.
> 
> I'm running it on systems with eMMC, SD Cards, and SDIO WiFi.  HLE
> doesn't show up in normal circumstances, only in ejecting the SD card
> at the wrong time.  ...since you can't eject eMMC, I didn't see
> problems there.

When card is inserting/removing, HLE is often occurred.
Since there is some request into queue when card is removed.(in my 
understanding.)
It's also related with controlling clock.

> 
>> But I think this patch can't solve all of HLE problem.
> 
> Agreed.  HLE means that the controller is pretty wedged and (as I
> understand it) means that there's something else we're doing wrong
> elsewhere in the dw_mmc driver (like writing more data to an already
> busy controller).  We should probably track down and find those cases,
> too.
> 
> I agree also that this code probably won't fix the controller in all
> cases of HLE errors.  ...but I'm not 100% certain of the best way to
> really do that, do you know?
> 
> ...but in any case the absolute worst thing to do is what the driver
> is already doing: unmask the HLE interrupt but never handle it
> anywhere...  My patch is at least better than that...

Agreed, your patch should be at least better than now.
But if pending is set HLE error bit,
it should hit the cases of DW_MCI_DATA_ERROR_FLAGS & DW_MCI_CMD_ERROR_FLAGS.
and i think send_stop_abort() can't run, doesn't?
(If HLE is occurred at non-removable card, controller can't do anything.)

If i can reproduce HLE error, i can check more detailedly.(Trying to reproduce 
it.)
I don't find fully solution yet. But finding the solution is my or our(?) 
part/role in future.
Actually, i'm using the ctrl reset at my local tree, when HLE error is occurred.
(Also it's not solution..)
According to TRM, "HLE is raised, software then has to reload the command."
We needs to consider how reload the command without lost previous request.

> 
> If you have another suggested way to make HLE error handling better
> (or avoid them to begin with) I'm happy to test!  :)

I will try to find HLE error handling..if you also have other opinion, let me 
know, plz.
I needs to listen other opinion, it's great helpful to me.. :)

Thank you a lot!

Best Regards,
Jaehoon Chung

> 
> 
> -Doug
> 

--
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/5] clk: mediatek: Add reset controller support

2015-03-15 Thread Sascha Hauer
The pericfg and infracfg units also provide reset lines to several
other SoC internal units. Add support for the reset controller.

Signed-off-by: Sascha Hauer 
---
 drivers/clk/mediatek/Makefile  |  1 +
 drivers/clk/mediatek/clk-mtk.h | 10 +
 drivers/clk/mediatek/reset.c   | 99 ++
 3 files changed, 110 insertions(+)
 create mode 100644 drivers/clk/mediatek/reset.c

diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index c384e97..0b6f1c3 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -1 +1,2 @@
 obj-y += clk-mtk.o clk-pll.o clk-gate.o
+obj-$(CONFIG_RESET_CONTROLLER) += reset.o
diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h
index c660a9e..fc98101 100644
--- a/drivers/clk/mediatek/clk-mtk.h
+++ b/drivers/clk/mediatek/clk-mtk.h
@@ -152,4 +152,14 @@ void __init mtk_clk_register_plls(struct device_node *node,
const struct mtk_pll_data *plls, int num_plls,
struct clk_onecell_data *clk_data);
 
+#ifdef CONFIG_RESET_CONTROLLER
+void mtk_register_reset_controller(struct device_node *np,
+   unsigned int num_regs, int regofs);
+#else
+static inline void mtk_register_reset_controller(struct device_node *np,
+   unsigned int num_regs, int regofs)
+{
+}
+#endif
+
 #endif /* __DRV_CLK_MTK_H */
diff --git a/drivers/clk/mediatek/reset.c b/drivers/clk/mediatek/reset.c
new file mode 100644
index 000..3a85a53
--- /dev/null
+++ b/drivers/clk/mediatek/reset.c
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014 MediaTek Inc.
+ *
+ * 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.
+ *
+ * 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.
+ */
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk-mtk.h"
+
+struct mtk_reset {
+   struct regmap *regmap;
+   int regofs;
+   struct reset_controller_dev rcdev;
+};
+
+static int mtk_reset_assert(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+   struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
+
+   return regmap_update_bits(data->regmap, data->regofs + ((id / 32) << 2),
+   BIT(id % 32), ~0);
+}
+
+static int mtk_reset_deassert(struct reset_controller_dev *rcdev,
+   unsigned long id)
+{
+   struct mtk_reset *data = container_of(rcdev, struct mtk_reset, rcdev);
+
+   return regmap_update_bits(data->regmap, data->regofs + ((id / 32) << 2),
+   BIT(id % 32), 0);
+}
+
+static int mtk_reset(struct reset_controller_dev *rcdev,
+ unsigned long id)
+{
+   int ret;
+
+   ret = mtk_reset_assert(rcdev, id);
+   if (ret)
+   return ret;
+
+   return mtk_reset_deassert(rcdev, id);
+}
+
+static struct reset_control_ops mtk_reset_ops = {
+   .assert = mtk_reset_assert,
+   .deassert = mtk_reset_deassert,
+   .reset = mtk_reset,
+};
+
+void mtk_register_reset_controller(struct device_node *np,
+   unsigned int num_regs, int regofs)
+{
+   struct mtk_reset *data;
+   int ret;
+   struct regmap *regmap;
+
+   regmap = syscon_node_to_regmap(np);
+   if (IS_ERR(regmap)) {
+   pr_err("Cannot find regmap for %s: %ld\n", np->full_name,
+   PTR_ERR(regmap));
+   return;
+   }
+
+   data = kzalloc(sizeof(*data), GFP_KERNEL);
+   if (!data)
+   return;
+
+   data->regmap = regmap;
+   data->regofs = regofs;
+   data->rcdev.owner = THIS_MODULE;
+   data->rcdev.nr_resets = num_regs * 32;
+   data->rcdev.ops = _reset_ops;
+   data->rcdev.of_node = np;
+
+   ret = reset_controller_register(>rcdev);
+   if (ret) {
+   pr_err("could not register reset controller: %d\n", ret);
+   kfree(data);
+   return;
+   }
+}
-- 
2.1.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/


[PATCH 5/5] dt-bindings: ARM: Mediatek: Document devicetree bindings for clock/reset controllers

2015-03-15 Thread Sascha Hauer
Signed-off-by: Sascha Hauer 
---
 .../bindings/arm/mediatek/mediatek,apmixedsys.txt  | 23 +
 .../bindings/arm/mediatek/mediatek,infracfg.txt| 30 ++
 .../bindings/arm/mediatek/mediatek,pericfg.txt | 30 ++
 .../bindings/arm/mediatek/mediatek,topckgen.txt| 23 +
 4 files changed, 106 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,topckgen.txt

diff --git 
a/Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt
new file mode 100644
index 000..5af6d73
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt
@@ -0,0 +1,23 @@
+Mediatek apmixedsys controller
+==
+
+The Mediatek apmixedsys controller provides the PLLs to the system.
+
+Required Properties:
+
+- compatible: Should be:
+   - "mediatek,mt8135-apmixedsys"
+   - "mediatek,mt8173-apmixedsys"
+- #clock-cells: Must be 1
+
+The apmixedsys controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+
+Example:
+
+apmixedsys: apmixedsys@10209000 {
+   compatible = "mediatek,mt8173-apmixedsys";
+   reg = <0 0x10209000 0 0x1000>;
+   #clock-cells = <1>;
+};
diff --git 
a/Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt
new file mode 100644
index 000..684da473
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt
@@ -0,0 +1,30 @@
+Mediatek infracfg controller
+
+
+The Mediatek infracfg controller provides various clocks and reset
+outputs to the system.
+
+Required Properties:
+
+- compatible: Should be:
+   - "mediatek,mt8135-infracfg", "syscon"
+   - "mediatek,mt8173-infracfg", "syscon"
+- #clock-cells: Must be 1
+- #reset-cells: Must be 1
+
+The infracfg controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+Also it uses the common reset controller binding from
+Documentation/devicetree/bindings/reset/reset.txt.
+The available reset outputs are defined in
+dt-bindings/reset-controller/mt*-resets.h
+
+Example:
+
+infracfg: infracfg@10001000 {
+   compatible = "mediatek,mt8173-infracfg", "syscon";
+   reg = <0 0x10001000 0 0x1000>;
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+};
diff --git 
a/Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt
new file mode 100644
index 000..fdb45c6
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt
@@ -0,0 +1,30 @@
+Mediatek pericfg controller
+===
+
+The Mediatek pericfg controller provides various clocks and reset
+outputs to the system.
+
+Required Properties:
+
+- compatible: Should be:
+   - "mediatek,mt8135-pericfg", "syscon"
+   - "mediatek,mt8173-pericfg", "syscon"
+- #clock-cells: Must be 1
+- #reset-cells: Must be 1
+
+The pericfg controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+Also it uses the common reset controller binding from
+Documentation/devicetree/bindings/reset/reset.txt.
+The available reset outputs are defined in
+dt-bindings/reset-controller/mt*-resets.h
+
+Example:
+
+pericfg: pericfg@10003000 {
+   compatible = "mediatek,mt8173-pericfg", "syscon";
+   reg = <0 0x10003000 0 0x1000>;
+   #clock-cells = <1>;
+   #reset-cells = <1>;
+};
diff --git 
a/Documentation/devicetree/bindings/arm/mediatek/mediatek,topckgen.txt 
b/Documentation/devicetree/bindings/arm/mediatek/mediatek,topckgen.txt
new file mode 100644
index 000..a425248
--- /dev/null
+++ b/Documentation/devicetree/bindings/arm/mediatek/mediatek,topckgen.txt
@@ -0,0 +1,23 @@
+Mediatek topckgen controller
+
+
+The Mediatek topckgen controller provides various clocks to the system.
+
+Required Properties:
+
+- compatible: Should be:
+   - "mediatek,mt8135-topckgen"
+   - "mediatek,mt8173-topckgen"
+- #clock-cells: Must be 1
+
+The topckgen controller uses the common clk binding from
+Documentation/devicetree/bindings/clock/clock-bindings.txt
+The available clocks are defined in dt-bindings/clock/mt*-clk.h.
+
+Example:
+
+topckgen: topckgen@1000 

[PATCH 4/5] clk: mediatek: Add basic clocks for Mediatek MT8173.

2015-03-15 Thread Sascha Hauer
From: James Liao 

This patch adds basic clocks for MT8173, including TOPCKGEN, PLLs,
INFRA and PERI clocks.

Signed-off-by: James Liao 
Signed-off-by: Henry Chen 
Signed-off-by: Sascha Hauer 
---
 drivers/clk/mediatek/Makefile  |   1 +
 drivers/clk/mediatek/clk-mt8173.c  | 826 +
 include/dt-bindings/clock/mt8173-clk.h | 231 ++
 .../dt-bindings/reset-controller/mt8173-resets.h   |  63 ++
 4 files changed, 1121 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8173.c
 create mode 100644 include/dt-bindings/clock/mt8173-clk.h
 create mode 100644 include/dt-bindings/reset-controller/mt8173-resets.h

diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index 12ce576..8e4b2a4 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -1,3 +1,4 @@
 obj-y += clk-mtk.o clk-pll.o clk-gate.o
 obj-$(CONFIG_RESET_CONTROLLER) += reset.o
 obj-y += clk-mt8135.o
+obj-y += clk-mt8173.o
diff --git a/drivers/clk/mediatek/clk-mt8173.c 
b/drivers/clk/mediatek/clk-mt8173.c
new file mode 100644
index 000..e674b18
--- /dev/null
+++ b/drivers/clk/mediatek/clk-mt8173.c
@@ -0,0 +1,826 @@
+/*
+ * Copyright (c) 2014 MediaTek Inc.
+ * Author: James Liao 
+ *
+ * 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.
+ *
+ * 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 
+#include 
+#include 
+#include 
+
+#include "clk-mtk.h"
+#include "clk-gate.h"
+
+#include 
+
+static DEFINE_SPINLOCK(lock);
+
+static const struct mtk_fixed_factor root_clk_alias[] __initdata = {
+   FACTOR(TOP_CLKPH_MCK_O, "clkph_mck_o", "clk_null", 1, 1),
+   FACTOR(TOP_DPI_CK, "dpi_ck", "clk_null", 1, 1),
+   FACTOR(TOP_USB_SYSPLL_125M, "usb_syspll_125m", "clk_null", 1, 1),
+   FACTOR(TOP_HDMITX_DIG_CTS, "hdmitx_dig_cts", "clk_null", 1, 1),
+};
+
+static const struct mtk_fixed_factor top_divs[] __initdata = {
+   FACTOR(TOP_ARMCA7PLL_754M, "armca7pll_754m", "armca7pll", 1, 2),
+   FACTOR(TOP_ARMCA7PLL_502M, "armca7pll_502m", "armca7pll", 1, 3),
+
+   FACTOR(TOP_MAIN_H546M, "main_h546m", "mainpll", 1, 2),
+   FACTOR(TOP_MAIN_H364M, "main_h364m", "mainpll", 1, 3),
+   FACTOR(TOP_MAIN_H218P4M, "main_h218p4m", "mainpll", 1, 5),
+   FACTOR(TOP_MAIN_H156M, "main_h156m", "mainpll", 1, 7),
+
+   FACTOR(TOP_TVDPLL_445P5M, "tvdpll_445p5m", "tvdpll", 1, 4),
+   FACTOR(TOP_TVDPLL_594M, "tvdpll_594m", "tvdpll", 1, 3),
+
+   FACTOR(TOP_UNIV_624M, "univ_624m", "univpll", 1, 2),
+   FACTOR(TOP_UNIV_416M, "univ_416m", "univpll", 1, 3),
+   FACTOR(TOP_UNIV_249P6M, "univ_249p6m", "univpll", 1, 5),
+   FACTOR(TOP_UNIV_178P3M, "univ_178p3m", "univpll", 1, 7),
+   FACTOR(TOP_UNIV_48M, "univ_48m", "univpll", 1, 26),
+
+   FACTOR(TOP_CLKRTC_EXT, "clkrtc_ext", "clk32k", 1, 1),
+   FACTOR(TOP_CLKRTC_INT, "clkrtc_int", "clk26m", 1, 793),
+   FACTOR(TOP_FPC_CK, "fpc_ck", "clk26m", 1, 1),
+
+   FACTOR(TOP_HDMITXPLL_D2, "hdmitxpll_d2", "hdmitx_dig_cts", 1, 2),
+   FACTOR(TOP_HDMITXPLL_D3, "hdmitxpll_d3", "hdmitx_dig_cts", 1, 3),
+
+   FACTOR(TOP_ARMCA7PLL_D2, "armca7pll_d2", "armca7pll_754m", 1, 1),
+   FACTOR(TOP_ARMCA7PLL_D3, "armca7pll_d3", "armca7pll_502m", 1, 1),
+
+   FACTOR(TOP_APLL1_CK, "apll1_ck", "apll1", 1, 1),
+   FACTOR(TOP_APLL2_CK, "apll2_ck", "apll2", 1, 1),
+
+   FACTOR(TOP_DMPLL_CK, "dmpll_ck", "clkph_mck_o", 1, 1),
+   FACTOR(TOP_DMPLL_D2, "dmpll_d2", "clkph_mck_o", 1, 2),
+   FACTOR(TOP_DMPLL_D4, "dmpll_d4", "clkph_mck_o", 1, 4),
+   FACTOR(TOP_DMPLL_D8, "dmpll_d8", "clkph_mck_o", 1, 8),
+   FACTOR(TOP_DMPLL_D16, "dmpll_d16", "clkph_mck_o", 1, 16),
+
+   FACTOR(TOP_LVDSPLL_D2, "lvdspll_d2", "lvdspll", 1, 2),
+   FACTOR(TOP_LVDSPLL_D4, "lvdspll_d4", "lvdspll", 1, 4),
+   FACTOR(TOP_LVDSPLL_D8, "lvdspll_d8", "lvdspll", 1, 8),
+
+   FACTOR(TOP_MMPLL_CK, "mmpll_ck", "mmpll", 1, 1),
+   FACTOR(TOP_MMPLL_D2, "mmpll_d2", "mmpll", 1, 2),
+
+   FACTOR(TOP_MSDCPLL_CK, "msdcpll_ck", "msdcpll", 1, 1),
+   FACTOR(TOP_MSDCPLL_D2, "msdcpll_d2", "msdcpll", 1, 2),
+   FACTOR(TOP_MSDCPLL_D4, "msdcpll_d4", "msdcpll", 1, 4),
+   FACTOR(TOP_MSDCPLL2_CK, "msdcpll2_ck", "msdcpll2", 1, 1),
+   FACTOR(TOP_MSDCPLL2_D2, "msdcpll2_d2", "msdcpll2", 1, 2),
+   FACTOR(TOP_MSDCPLL2_D4, "msdcpll2_d4", "msdcpll2", 1, 4),
+
+   FACTOR(TOP_SYSPLL_D2, "syspll_d2", "main_h546m", 1, 1),
+   FACTOR(TOP_SYSPLL1_D2, "syspll1_d2", "main_h546m", 1, 2),
+   FACTOR(TOP_SYSPLL1_D4, "syspll1_d4", "main_h546m", 1, 4),
+   FACTOR(TOP_SYSPLL1_D8, "syspll1_d8", 

[PATCH 3/5] clk: mediatek: Add basic clocks for Mediatek MT8135.

2015-03-15 Thread Sascha Hauer
From: James Liao 

This patch adds basic clocks for MT8135, including TOPCKGEN, PLLs,
INFRA and PERI clocks.

Signed-off-by: James Liao 
Signed-off-by: Henry Chen 
Signed-off-by: Sascha Hauer 
---
 drivers/clk/mediatek/Makefile  |   1 +
 drivers/clk/mediatek/clk-mt8135.c  | 640 +
 include/dt-bindings/clock/mt8135-clk.h | 190 ++
 .../dt-bindings/reset-controller/mt8135-resets.h   |  64 +++
 4 files changed, 895 insertions(+)
 create mode 100644 drivers/clk/mediatek/clk-mt8135.c
 create mode 100644 include/dt-bindings/clock/mt8135-clk.h
 create mode 100644 include/dt-bindings/reset-controller/mt8135-resets.h

diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
index 0b6f1c3..12ce576 100644
--- a/drivers/clk/mediatek/Makefile
+++ b/drivers/clk/mediatek/Makefile
@@ -1,2 +1,3 @@
 obj-y += clk-mtk.o clk-pll.o clk-gate.o
 obj-$(CONFIG_RESET_CONTROLLER) += reset.o
+obj-y += clk-mt8135.o
diff --git a/drivers/clk/mediatek/clk-mt8135.c 
b/drivers/clk/mediatek/clk-mt8135.c
new file mode 100644
index 000..883a161
--- /dev/null
+++ b/drivers/clk/mediatek/clk-mt8135.c
@@ -0,0 +1,640 @@
+/*
+ * Copyright (c) 2014 MediaTek Inc.
+ * Author: James Liao 
+ *
+ * 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.
+ *
+ * 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 
+#include 
+#include 
+#include 
+#include 
+
+#include "clk-mtk.h"
+#include "clk-gate.h"
+
+static DEFINE_SPINLOCK(lock);
+
+static const struct mtk_fixed_factor root_clk_alias[] __initdata = {
+   FACTOR(TOP_DSI0_LNTC_DSICLK, "dsi0_lntc_dsiclk", "clk_null", 1, 1),
+   FACTOR(TOP_HDMITX_CLKDIG_CTS, "hdmitx_clkdig_cts", "clk_null", 1, 1),
+   FACTOR(TOP_CLKPH_MCK, "clkph_mck", "clk_null", 1, 1),
+   FACTOR(TOP_CPUM_TCK_IN, "cpum_tck_in", "clk_null", 1, 1),
+};
+
+static const struct mtk_fixed_factor top_divs[] __initdata = {
+   FACTOR(TOP_MAINPLL_806M, "mainpll_806m", "mainpll", 1, 2),
+   FACTOR(TOP_MAINPLL_537P3M, "mainpll_537p3m", "mainpll", 1, 3),
+   FACTOR(TOP_MAINPLL_322P4M, "mainpll_322p4m", "mainpll", 1, 5),
+   FACTOR(TOP_MAINPLL_230P3M, "mainpll_230p3m", "mainpll", 1, 7),
+
+   FACTOR(TOP_UNIVPLL_624M, "univpll_624m", "univpll", 1, 2),
+   FACTOR(TOP_UNIVPLL_416M, "univpll_416m", "univpll", 1, 3),
+   FACTOR(TOP_UNIVPLL_249P6M, "univpll_249p6m", "univpll", 1, 5),
+   FACTOR(TOP_UNIVPLL_178P3M, "univpll_178p3m", "univpll", 1, 7),
+   FACTOR(TOP_UNIVPLL_48M, "univpll_48m", "univpll", 1, 26),
+
+   FACTOR(TOP_MMPLL_D2, "mmpll_d2", "mmpll", 1, 2),
+   FACTOR(TOP_MMPLL_D3, "mmpll_d3", "mmpll", 1, 3),
+   FACTOR(TOP_MMPLL_D5, "mmpll_d5", "mmpll", 1, 5),
+   FACTOR(TOP_MMPLL_D7, "mmpll_d7", "mmpll", 1, 7),
+   FACTOR(TOP_MMPLL_D4, "mmpll_d4", "mmpll_d2", 1, 2),
+   FACTOR(TOP_MMPLL_D6, "mmpll_d6", "mmpll_d3", 1, 2),
+
+   FACTOR(TOP_SYSPLL_D2, "syspll_d2", "mainpll_806m", 1, 1),
+   FACTOR(TOP_SYSPLL_D4, "syspll_d4", "mainpll_806m", 1, 2),
+   FACTOR(TOP_SYSPLL_D6, "syspll_d6", "mainpll_806m", 1, 3),
+   FACTOR(TOP_SYSPLL_D8, "syspll_d8", "mainpll_806m", 1, 4),
+   FACTOR(TOP_SYSPLL_D10, "syspll_d10", "mainpll_806m", 1, 5),
+   FACTOR(TOP_SYSPLL_D12, "syspll_d12", "mainpll_806m", 1, 6),
+   FACTOR(TOP_SYSPLL_D16, "syspll_d16", "mainpll_806m", 1, 8),
+   FACTOR(TOP_SYSPLL_D24, "syspll_d24", "mainpll_806m", 1, 12),
+
+   FACTOR(TOP_SYSPLL_D3, "syspll_d3", "mainpll_537p3m", 1, 1),
+
+   FACTOR(TOP_SYSPLL_D2P5, "syspll_d2p5", "mainpll_322p4m", 2, 1),
+   FACTOR(TOP_SYSPLL_D5, "syspll_d5", "mainpll_322p4m", 1, 1),
+
+   FACTOR(TOP_SYSPLL_D3P5, "syspll_d3p5", "mainpll_230p3m", 2, 1),
+
+   FACTOR(TOP_UNIVPLL1_D2, "univpll1_d2", "univpll_624m", 1, 2),
+   FACTOR(TOP_UNIVPLL1_D4, "univpll1_d4", "univpll_624m", 1, 4),
+   FACTOR(TOP_UNIVPLL1_D6, "univpll1_d6", "univpll_624m", 1, 6),
+   FACTOR(TOP_UNIVPLL1_D8, "univpll1_d8", "univpll_624m", 1, 8),
+   FACTOR(TOP_UNIVPLL1_D10, "univpll1_d10", "univpll_624m", 1, 10),
+
+   FACTOR(TOP_UNIVPLL2_D2, "univpll2_d2", "univpll_416m", 1, 2),
+   FACTOR(TOP_UNIVPLL2_D4, "univpll2_d4", "univpll_416m", 1, 4),
+   FACTOR(TOP_UNIVPLL2_D6, "univpll2_d6", "univpll_416m", 1, 6),
+   FACTOR(TOP_UNIVPLL2_D8, "univpll2_d8", "univpll_416m", 1, 8),
+
+   FACTOR(TOP_UNIVPLL_D3, "univpll_d3", "univpll_416m", 1, 1),
+   FACTOR(TOP_UNIVPLL_D5, "univpll_d5", "univpll_249p6m", 1, 1),
+   FACTOR(TOP_UNIVPLL_D7, "univpll_d7", "univpll_178p3m", 1, 1),
+   FACTOR(TOP_UNIVPLL_D10, "univpll_d10", "univpll_249p6m", 1, 5),
+   

[PATCH v7]: clk: Add common clock support for Mediatek MT8135 and MT8173

2015-03-15 Thread Sascha Hauer
The following changes since commit 9eccca0843205f87c00404b663188b88eb248051:

  Linux 4.0-rc3 (2015-03-08 16:09:09 -0700)

are available in the git repository at:

  git://git.pengutronix.de/git/imx/linux-2.6.git tags/v4.0-clk-mediatek-v7

for you to fetch changes up to 147dc836b1206e8118509229594d82ff8ad3b99e:

  dt-bindings: ARM: Mediatek: Document devicetree bindings for clock/reset 
controllers (2015-03-16 06:31:37 +0100)


This patchset contains the initial common clock support for Mediatek SoCs.
Mediatek SoC's clock architecture comprises of various PLLs, dividers, muxes
and clock gates.

Sascha

Changes in v7:
- fix duplicate definition/declaration of mtk_register_reset_controller
- fix pd_reg offset of tvdpll
- make clk initialization arrays const

Changes in v6:
- rework PLL support, only a fraction of original size now
- Move binding docs to Documentation/devicetree/bindings/arm/mediatek since
  the units are not really clock specific (they contain reset controllers)

Changes in v5:
- Add reset controller support for pericfg/infracfg
- Use regmap for the gates
- remove now unnecessary spinlock for the gates
- Add PMIC wrapper support as of v3

Changes in v4:
- Support MT8173 platform.
- Re-ordered patchset. driver/clk/Makefile in 2nd patch.
- Extract the common part definition(mtk_gate/mtk_pll/mtk_mux) from
  clk-mt8135.c/clk-mt8173.c to clk-mtk.c.
- Refine code. Rmove unnessacary debug information and unsed defines,
  add prefix "mtk_" for static functions.
- Remove flag CLK_IGNORE_UNUSED and set flag CLK_SET_RATE_PARENT on
  gate/mux/fixed-factor.
- Use spin_lock_irqsave(_ops_lock, flags) instead of mtk_clk_lock.
- Example above include a node for the clock controller itself, followed
  by the i2c controller example above.

Changes in v3:
- Rebase to 3.19-rc1.
- Refine code. Remove unneed functions, debug logs and comments, and fine tune
  error logs.

Changes in v2:
- Re-ordered patchset. Fold include/dt-bindings and DT document in 1st patch.


James Liao (3):
  clk: mediatek: Add initial common clock support for Mediatek SoCs.
  clk: mediatek: Add basic clocks for Mediatek MT8135.
  clk: mediatek: Add basic clocks for Mediatek MT8173.

Sascha Hauer (2):
  clk: mediatek: Add reset controller support
  dt-bindings: ARM: Mediatek: Document devicetree bindings for clock/reset 
controllers

 .../bindings/arm/mediatek/mediatek,apmixedsys.txt  |  23 +
 .../bindings/arm/mediatek/mediatek,infracfg.txt|  30 +
 .../bindings/arm/mediatek/mediatek,pericfg.txt |  30 +
 .../bindings/arm/mediatek/mediatek,topckgen.txt|  23 +
 drivers/clk/Makefile   |   1 +
 drivers/clk/mediatek/Makefile  |   4 +
 drivers/clk/mediatek/clk-gate.c| 137 
 drivers/clk/mediatek/clk-gate.h|  49 ++
 drivers/clk/mediatek/clk-mt8135.c  | 640 
 drivers/clk/mediatek/clk-mt8173.c  | 826 +
 drivers/clk/mediatek/clk-mtk.c | 197 +
 drivers/clk/mediatek/clk-mtk.h | 165 
 drivers/clk/mediatek/clk-pll.c | 325 
 drivers/clk/mediatek/reset.c   |  99 +++
 include/dt-bindings/clock/mt8135-clk.h | 190 +
 include/dt-bindings/clock/mt8173-clk.h | 231 ++
 .../dt-bindings/reset-controller/mt8135-resets.h   |  64 ++
 .../dt-bindings/reset-controller/mt8173-resets.h   |  63 ++
 18 files changed, 3097 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,apmixedsys.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,infracfg.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,pericfg.txt
 create mode 100644 
Documentation/devicetree/bindings/arm/mediatek/mediatek,topckgen.txt
 create mode 100644 drivers/clk/mediatek/Makefile
 create mode 100644 drivers/clk/mediatek/clk-gate.c
 create mode 100644 drivers/clk/mediatek/clk-gate.h
 create mode 100644 drivers/clk/mediatek/clk-mt8135.c
 create mode 100644 drivers/clk/mediatek/clk-mt8173.c
 create mode 100644 drivers/clk/mediatek/clk-mtk.c
 create mode 100644 drivers/clk/mediatek/clk-mtk.h
 create mode 100644 drivers/clk/mediatek/clk-pll.c
 create mode 100644 drivers/clk/mediatek/reset.c
 create mode 100644 include/dt-bindings/clock/mt8135-clk.h
 create mode 100644 include/dt-bindings/clock/mt8173-clk.h
 create mode 100644 include/dt-bindings/reset-controller/mt8135-resets.h
 create mode 100644 include/dt-bindings/reset-controller/mt8173-resets.h
--
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  

Re: [Xen-devel] [PATCH v4] xen-scsiback: define a pr_fmt macro with xen-pvscsi

2015-03-15 Thread Juergen Gross

On 03/10/2015 09:49 PM, Tao Chen wrote:

Add the {xen-pvscsi: } prefix in pr_fmt and remove DPRINTK, then
replace all DPRINTK with pr_debug.

Also fixed up some comments just as eliminate redundant whitespace
and format the code.

These will make the code easier to read.

Signed-off-by: Tao Chen 


Reviewed-by: Juergen Gross 


---
  drivers/xen/xen-scsiback.c | 75 ++
  1 file changed, 36 insertions(+), 39 deletions(-)

diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 9faca6a..d0b0bc5 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -31,6 +31,8 @@
   * IN THE SOFTWARE.
   */

+#define pr_fmt(fmt) "xen-pvscsi: " fmt
+
  #include 

  #include 
@@ -69,9 +71,6 @@
  #include 
  #include 

-#define DPRINTK(_f, _a...) \
-   pr_debug("(file=%s, line=%d) " _f, __FILE__ , __LINE__ , ## _a)
-
  #define VSCSI_VERSION "v0.1"
  #define VSCSI_NAMELEN 32

@@ -271,7 +270,7 @@ static void scsiback_print_status(char *sense_buffer, int 
errors,
  {
struct scsiback_tpg *tpg = pending_req->v2p->tpg;

-   pr_err("xen-pvscsi[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x 
drv=%02x\n",
+   pr_err("[%s:%d] cmnd[0]=%02x -> st=%02x msg=%02x host=%02x drv=%02x\n",
   tpg->tport->tport_name, pending_req->v2p->lun,
   pending_req->cmnd[0], status_byte(errors), msg_byte(errors),
   host_byte(errors), driver_byte(errors));
@@ -427,7 +426,7 @@ static int scsiback_gnttab_data_map_batch(struct 
gnttab_map_grant_ref *map,
BUG_ON(err);
for (i = 0; i < cnt; i++) {
if (unlikely(map[i].status != GNTST_okay)) {
-   pr_err("xen-pvscsi: invalid buffer -- could not remap 
it\n");
+   pr_err("invalid buffer -- could not remap it\n");
map[i].handle = SCSIBACK_INVALID_HANDLE;
err = -ENOMEM;
} else {
@@ -449,7 +448,7 @@ static int scsiback_gnttab_data_map_list(struct 
vscsibk_pend *pending_req,
for (i = 0; i < cnt; i++) {
if (get_free_page(pg + mapcount)) {
put_free_pages(pg, mapcount);
-   pr_err("xen-pvscsi: no grant page\n");
+   pr_err("no grant page\n");
return -ENOMEM;
}
gnttab_set_map_op([mapcount], vaddr_page(pg[mapcount]),
@@ -492,7 +491,7 @@ static int scsiback_gnttab_data_map(struct vscsiif_request 
*ring_req,
return 0;

if (nr_segments > VSCSIIF_SG_TABLESIZE) {
-   DPRINTK("xen-pvscsi: invalid parameter nr_seg = %d\n",
+   pr_debug("invalid parameter nr_seg = %d\n",
ring_req->nr_segments);
return -EINVAL;
}
@@ -516,13 +515,12 @@ static int scsiback_gnttab_data_map(struct 
vscsiif_request *ring_req,
nr_segments += n_segs;
}
if (nr_segments > SG_ALL) {
-   DPRINTK("xen-pvscsi: invalid nr_seg = %d\n",
-   nr_segments);
+   pr_debug("invalid nr_seg = %d\n", nr_segments);
return -EINVAL;
}
}

-   /* free of (sgl) in fast_flush_area()*/
+   /* free of (sgl) in fast_flush_area() */
pending_req->sgl = kmalloc_array(nr_segments,
sizeof(struct scatterlist), GFP_KERNEL);
if (!pending_req->sgl)
@@ -679,7 +677,8 @@ static int prepare_pending_reqs(struct vscsibk_info *info,
v2p = scsiback_do_translation(info, );
if (!v2p) {
pending_req->v2p = NULL;
-   DPRINTK("xen-pvscsi: doesn't exist.\n");
+   pr_debug("the v2p of (chn:%d, tgt:%d, lun:%d) doesn't exist.\n",
+   vir.chn, vir.tgt, vir.lun);
return -ENODEV;
}
pending_req->v2p = v2p;
@@ -690,14 +689,14 @@ static int prepare_pending_reqs(struct vscsibk_info *info,
(pending_req->sc_data_direction != DMA_TO_DEVICE) &&
(pending_req->sc_data_direction != DMA_FROM_DEVICE) &&
(pending_req->sc_data_direction != DMA_NONE)) {
-   DPRINTK("xen-pvscsi: invalid parameter data_dir = %d\n",
+   pr_debug("invalid parameter data_dir = %d\n",
pending_req->sc_data_direction);
return -EINVAL;
}

pending_req->cmd_len = ring_req->cmd_len;
if (pending_req->cmd_len > VSCSIIF_MAX_COMMAND_SIZE) {
-   DPRINTK("xen-pvscsi: invalid parameter cmd_len = %d\n",
+   pr_debug("invalid parameter cmd_len = %d\n",
pending_req->cmd_len);
return -EINVAL;
}
@@ -721,7 +720,7 @@ static int scsiback_do_cmd_fn(struct vscsibk_info *info)

if 

[PATCH 4/4] perf kmem: Support sort keys on page analysis

2015-03-15 Thread Namhyung Kim
Add new sort keys for page: page, order, mtype, gfp - existing
'bytes', 'hit' and 'callsite' sort keys also work for page.  Note that
-s/--sort option should be preceded by either of --slab or --page
option to determine where the sort keys applies.

Now it properly groups and sorts allocation stats - so same
page/caller with different order/mtype/gfp will be printed on a
different line.

  # perf kmem stat --page --caller -l 10 -s order,hit

  

   Total alloc (KB) |  Hits | Order | Migration type | GFP flags | Callsite
  

 64 | 4 | 2 |RECLAIMABLE |  00285250 | new_slab
 50,144 |12,536 | 0 |MOVABLE |  0102005a | 
__page_cache_alloc
 52 |13 | 0 |  UNMOVABLE |  002084d0 | 
pte_alloc_one
 40 |10 | 0 |MOVABLE |  000280da | 
handle_mm_fault
 28 | 7 | 0 |  UNMOVABLE |  00d0 | 
__pollwait
 20 | 5 | 0 |MOVABLE |  000200da | 
do_wp_page
 20 | 5 | 0 |MOVABLE |  000200da | 
do_cow_fault
 16 | 4 | 0 |  UNMOVABLE |  0200 | 
__tlb_remove_page
 16 | 4 | 0 |  UNMOVABLE |  84d0 | 
__pmd_alloc
  8 | 2 | 0 |  UNMOVABLE |  84d0 | 
__pud_alloc
   ...  | ...   | ...   | ...| ...   | ...
  


Signed-off-by: Namhyung Kim 
---
 tools/perf/Documentation/perf-kmem.txt |   6 +-
 tools/perf/builtin-kmem.c  | 396 +++--
 2 files changed, 333 insertions(+), 69 deletions(-)

diff --git a/tools/perf/Documentation/perf-kmem.txt 
b/tools/perf/Documentation/perf-kmem.txt
index 23219c65c16f..0ebd9c8bfdbf 100644
--- a/tools/perf/Documentation/perf-kmem.txt
+++ b/tools/perf/Documentation/perf-kmem.txt
@@ -37,7 +37,11 @@ OPTIONS
 
 -s ::
 --sort=::
-   Sort the output (default: frag,hit,bytes)
+   Sort the output (default: 'frag,hit,bytes' for slab and 'bytes,hit'
+   for page).  Available sort keys are 'ptr, callsite, bytes, hit,
+   pingpong, frag' for slab and 'page, callsite, bytes, hit, order,
+   mtype, gfp' for page.  This option should be preceded by one of the
+   mode selection options - i.e. --slab, --page, --alloc and/or --caller.
 
 -l ::
 --line=::
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index e4914b3a0213..9254980c8000 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -30,7 +30,7 @@ static intkmem_page;
 static longkmem_page_size;
 
 struct alloc_stat;
-typedef int (*sort_fn_t)(struct alloc_stat *, struct alloc_stat *);
+typedef int (*sort_fn_t)(void *, void *);
 
 static int alloc_flag;
 static int caller_flag;
@@ -181,8 +181,8 @@ static int perf_evsel__process_alloc_node_event(struct 
perf_evsel *evsel,
return ret;
 }
 
-static int ptr_cmp(struct alloc_stat *, struct alloc_stat *);
-static int callsite_cmp(struct alloc_stat *, struct alloc_stat *);
+static int ptr_cmp(void *, void *);
+static int slab_callsite_cmp(void *, void *);
 
 static struct alloc_stat *search_alloc_stat(unsigned long ptr,
unsigned long call_site,
@@ -223,7 +223,8 @@ static int perf_evsel__process_free_event(struct perf_evsel 
*evsel,
s_alloc->pingpong++;
 
s_caller = search_alloc_stat(0, s_alloc->call_site,
-_caller_stat, callsite_cmp);
+_caller_stat,
+slab_callsite_cmp);
if (!s_caller)
return -1;
s_caller->pingpong++;
@@ -395,19 +396,35 @@ static u64 find_callsite(struct perf_evsel *evsel, struct 
perf_sample *sample)
return sample->ip;
 }
 
-static struct page_stat *search_page_alloc_stat(u64 page, bool create)
+struct sort_dimension {
+   const char  name[20];
+   sort_fn_t   cmp;
+   struct list_headlist;
+};
+
+static LIST_HEAD(page_alloc_sort_input);
+static LIST_HEAD(page_caller_sort_input);
+
+static struct page_stat *search_page_alloc_stat(struct page_stat *this,
+   bool create)
 {
struct rb_node **node = _alloc_tree.rb_node;
struct rb_node *parent = NULL;
struct page_stat *data;
+   struct sort_dimension *sort;
 
while (*node) {
-   s64 cmp;
+   int cmp = 0;
 
parent = *node;
data = 

[PATCHSET 0/4] perf kmem: Implement page allocation analysis (v2)

2015-03-15 Thread Namhyung Kim
Hello,

Currently perf kmem command only analyzes SLAB memory allocation.  And
I'd like to introduce page allocation analysis also.  Users can use
 --slab and/or --page option to select it.  If none of these options
are used, it does slab allocation analysis for backward compatibility.

 * changes in v2)
  - Use thousand grouping for big numbers - i.e. 12345 -> 12,345  (Ingo)
  - Improve output stat readability  (Ingo)
  - Remove alloc size column as it can be calculated from hits and order

Patch 1 is to support thousand grouping on stat output.  Patch 2
implements basic support for page allocation analysis, patch 3 deals
with the callsite and finally patch 4 implements sorting.

In this patchset, I used two kmem events: kmem:mm_page_alloc and
kmem_page_free for analysis as they can track almost all of memory
allocation/free path AFAIK.  However, unlike slab tracepoint events,
those page allocation events don't provide callsite info directly.  So
I recorded callchains and extracted callsites like below:

Normal page allocation callchains look like this:

  360a7e __alloc_pages_nodemask
  3a711c alloc_pages_current
  357bc7 __page_cache_alloc   <-- callsite
  357cf6 pagecache_get_page
   48b0a prepare_pages
   494d3 __btrfs_buffered_write
   49cdf btrfs_file_write_iter
  3ceb6e new_sync_write
  3cf447 vfs_write
  3cff99 sys_write
  7556e9 system_call
f880 __write_nocancel
   33eb9 cmd_record
   4b38e cmd_kmem
   7aa23 run_builtin
   27a9a main
   20800 __libc_start_main

But first two are internal page allocation functions so it should be
skipped.  To determine such allocation functions, I used following regex:

  ^_?_?(alloc|get_free|get_zeroed)_pages?

This gave me a following list of functions (you can see this with -v):

  alloc func: __get_free_pages
  alloc func: get_zeroed_page
  alloc func: alloc_pages_exact
  alloc func: __alloc_pages_direct_compact
  alloc func: __alloc_pages_nodemask
  alloc func: alloc_page_interleave
  alloc func: alloc_pages_current
  alloc func: alloc_pages_vma
  alloc func: alloc_page_buffers
  alloc func: alloc_pages_exact_nid

After skipping those function, it got '__page_cache_alloc'.

Other information such as allocation order, migration type and gfp
flags are provided by tracepoint events.

Basically the output will be sorted by total allocation bytes, but you
can change it by using -s/--sort option.  The following sort keys are
added to support page analysis: page, order, mtype, gfp.  Existing
'callsite', 'bytes' and 'hit' sort keys also can be used.

An example follows:

  # perf kmem record --slab --page sleep 1
  [ perf record: Woken up 0 times to write data ]
  [ perf record: Captured and wrote 49.277 MB perf.data (191027 samples) ]

  # perf kmem stat --page --caller -l 10 -s order,hit

  

   Total alloc (KB) | Hits  | Order | Migration type | GFP flags | Callsite
  

 64 | 4 | 2 |RECLAIMABLE |  00285250 | new_slab
 50,144 |12,536 | 0 |MOVABLE |  0102005a | 
__page_cache_alloc
 52 |13 | 0 |  UNMOVABLE |  002084d0 | 
pte_alloc_one
 40 |10 | 0 |MOVABLE |  000280da | 
handle_mm_fault
 28 | 7 | 0 |  UNMOVABLE |  00d0 | 
__pollwait
 20 | 5 | 0 |MOVABLE |  000200da | 
do_wp_page
 20 | 5 | 0 |MOVABLE |  000200da | 
do_cow_fault
 16 | 4 | 0 |  UNMOVABLE |  0200 | 
__tlb_remove_page
 16 | 4 | 0 |  UNMOVABLE |  84d0 | 
__pmd_alloc
  8 | 2 | 0 |  UNMOVABLE |  84d0 | 
__pud_alloc
   ...  | ...   | ...   | ...| ...   | ...
  


  SUMMARY (page allocator)
  
  Total allocation requests :   12,594   [   50,420 KB ]
  Total free requests   :  182   [  728 KB ]

  Total alloc+freed requests:  115   [  460 KB ]
  Total alloc-only requests :   12,479   [   49,960 KB ]
  Total free-only requests  :   67   [  268 KB ]

  Total allocation failures :0   [0 KB ]
   
  Order Unmovable   Reclaimable   Movable  Reserved  CMA/Isolated
  -          
  032 .12,558 . .
  1 . . . . .
  2 . 4 . . .
 

[PATCH 2/4] perf kmem: Analyze page allocator events also

2015-03-15 Thread Namhyung Kim
The perf kmem command records and analyze kernel memory allocation
only for SLAB objects.  This patch implement a simple page allocator
analyzer using kmem:mm_page_alloc and kmem:mm_page_free events.

It adds two new options of --slab and --page.  The --slab option is
for analyzing SLAB allocator and that's what perf kmem currently does.

The new --page option enables page allocator events and analyze kernel
memory usage in page unit.  Currently, 'stat --alloc' subcommand is
implemented only.

If none of these --slab nor --page is specified, --slab is implied.

  # perf kmem stat --page --alloc --line 10

  
-
   Page | Total alloc (KB) | Hits | Order | Migration type | 
GFP flags
  
-
   ea0015e48e00 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ea0015e47400 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ea001440f600 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ea001440cc00 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ea00140c6300 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ea00140c5c00 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ea00140c5000 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ea00140c4f00 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ea00140c4e00 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ea00140c4d00 |   16 |1 | 2 |RECLAIMABLE |  
00285250
   ...  | ...  | ...  | ...   | ...| ...
  
-

  SUMMARY (page allocator)
  
  Total allocation requests :   44,260   [  177,256 KB ]
  Total free requests   :  117   [  468 KB ]

  Total alloc+freed requests:   49   [  196 KB ]
  Total alloc-only requests :   44,211   [  177,060 KB ]
  Total free-only requests  :   68   [  272 KB ]

  Total allocation failures :0   [0 KB ]

  Order Unmovable   Reclaimable   Movable  Reserved  CMA/Isolated
  -          
  032 .44,210 . .
  1 . . . . .
  2 .18 . . .
  3 . . . . .
  4 . . . . .
  5 . . . . .
  6 . . . . .
  7 . . . . .
  8 . . . . .
  9 . . . . .
 10 . . . . .

Signed-off-by: Namhyung Kim 
---
 tools/perf/Documentation/perf-kmem.txt |   8 +-
 tools/perf/builtin-kmem.c  | 376 +++--
 2 files changed, 368 insertions(+), 16 deletions(-)

diff --git a/tools/perf/Documentation/perf-kmem.txt 
b/tools/perf/Documentation/perf-kmem.txt
index 150253cc3c97..23219c65c16f 100644
--- a/tools/perf/Documentation/perf-kmem.txt
+++ b/tools/perf/Documentation/perf-kmem.txt
@@ -3,7 +3,7 @@ perf-kmem(1)
 
 NAME
 
-perf-kmem - Tool to trace/measure kernel memory(slab) properties
+perf-kmem - Tool to trace/measure kernel memory properties
 
 SYNOPSIS
 
@@ -46,6 +46,12 @@ OPTIONS
 --raw-ip::
Print raw ip instead of symbol
 
+--slab::
+   Analyze SLAB allocator events.
+
+--page::
+   Analyze page allocator events
+
 SEE ALSO
 
 linkperf:perf-record[1]
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 64d3623d45a0..76a527dc6ba1 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -22,6 +22,11 @@
 #include 
 #include 
 
+static int kmem_slab;
+static int kmem_page;
+
+static longkmem_page_size;
+
 struct alloc_stat;
 typedef int (*sort_fn_t)(struct alloc_stat *, struct alloc_stat *);
 
@@ -226,6 +231,139 @@ static int perf_evsel__process_free_event(struct 
perf_evsel *evsel,
return 0;
 }
 
+static u64 total_page_alloc_bytes;
+static u64 total_page_free_bytes;
+static u64 total_page_nomatch_bytes;
+static u64 total_page_fail_bytes;
+static unsigned long 

[PATCH 1/4] perf kmem: Print big numbers using thousands' group

2015-03-15 Thread Namhyung Kim
Like perf stat, this makes easy to read the numbers on stat like below:

  # perf kmem stat

  SUMMARY
  ===
  Total bytes requested: 9,770,900
  Total bytes allocated: 9,782,712
  Total bytes wasted on internal fragmentation: 11,812
  Internal fragmentation: 0.120744%
  Cross CPU allocations: 74/152,819

Suggested-by: Ingo Molnar 
Signed-off-by: Namhyung Kim 
---
 tools/perf/builtin-kmem.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 8c85aeb3327a..64d3623d45a0 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -20,6 +20,7 @@
 
 #include 
 #include 
+#include 
 
 struct alloc_stat;
 typedef int (*sort_fn_t)(struct alloc_stat *, struct alloc_stat *);
@@ -325,13 +326,13 @@ static void __print_result(struct rb_root *root, struct 
perf_session *session,
 static void print_summary(void)
 {
printf("\nSUMMARY\n===\n");
-   printf("Total bytes requested: %lu\n", total_requested);
-   printf("Total bytes allocated: %lu\n", total_allocated);
-   printf("Total bytes wasted on internal fragmentation: %lu\n",
+   printf("Total bytes requested: %'lu\n", total_requested);
+   printf("Total bytes allocated: %'lu\n", total_allocated);
+   printf("Total bytes wasted on internal fragmentation: %'lu\n",
   total_allocated - total_requested);
printf("Internal fragmentation: %f%%\n",
   fragmentation(total_requested, total_allocated));
-   printf("Cross CPU allocations: %lu/%lu\n", nr_cross_allocs, nr_allocs);
+   printf("Cross CPU allocations: %'lu/%'lu\n", nr_cross_allocs, 
nr_allocs);
 }
 
 static void print_result(struct perf_session *session)
@@ -706,6 +707,8 @@ int cmd_kmem(int argc, const char **argv, const char 
*prefix __maybe_unused)
symbol__init(>header.env);
 
if (!strcmp(argv[0], "stat")) {
+   setlocale(LC_ALL, "");
+
if (cpu__setup_cpunode_map())
goto out_delete;
 
-- 
2.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: linux panic on 4.0.0-rc4

2015-03-15 Thread Pranith Kumar
On Mon, Mar 16, 2015 at 1:11 AM, Pranith Kumar  wrote:
> Hello,
>
> I have a power mac mini 32-bit system.
>
...
> You can see the panic message here: http://imgur.com/s1lH15g. (there
> is no log and I have no serial console).

There was some debug code in there when it hit. The actual hang seems
to be in printk_late_init(). It does not return from this. May be this
is a hint?

Please let me know if you need more information to debug this.

Thanks!

>
> Let me know if you need any more information. Config follows:
>
> #
> # Automatically generated file; DO NOT EDIT.
> # Linux/powerpc 4.0.0-rc4 Kernel Configuration
> #
> # CONFIG_PPC64 is not set
>
> #
> # Processor support
> #
> CONFIG_PPC_BOOK3S_32=y
> # CONFIG_PPC_85xx is not set
> # CONFIG_PPC_8xx is not set
> # CONFIG_40x is not set
> # CONFIG_44x is not set
> # CONFIG_E200 is not set
> CONFIG_PPC_BOOK3S=y
> CONFIG_6xx=y
> CONFIG_PPC_FPU=y
> CONFIG_ALTIVEC=y
> CONFIG_PPC_STD_MMU=y
> CONFIG_PPC_STD_MMU_32=y
> # CONFIG_PPC_MM_SLICES is not set
> CONFIG_PPC_HAVE_PMU_SUPPORT=y
> CONFIG_PPC_PERF_CTRS=y
> # CONFIG_SMP is not set
> # CONFIG_PPC_DOORBELL is not set
> CONFIG_CPU_BIG_ENDIAN=y
> # CONFIG_CPU_LITTLE_ENDIAN is not set
> CONFIG_PPC32=y
> CONFIG_32BIT=y
> CONFIG_WORD_SIZE=32
> # CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
> # CONFIG_ARCH_DMA_ADDR_T_64BIT is not set
> CONFIG_MMU=y
> # CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
> # CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
> CONFIG_NR_IRQS=512
> CONFIG_STACKTRACE_SUPPORT=y
> CONFIG_HAVE_LATENCYTOP_SUPPORT=y
> CONFIG_TRACE_IRQFLAGS_SUPPORT=y
> CONFIG_LOCKDEP_SUPPORT=y
> CONFIG_RWSEM_XCHGADD_ALGORITHM=y
> CONFIG_ARCH_HAS_ILOG2_U32=y
> CONFIG_GENERIC_HWEIGHT=y
> CONFIG_PPC=y
> # CONFIG_GENERIC_CSUM is not set
> CONFIG_EARLY_PRINTK=y
> CONFIG_PANIC_TIMEOUT=0
> CONFIG_GENERIC_NVRAM=y
> CONFIG_SCHED_OMIT_FRAME_POINTER=y
> CONFIG_ARCH_MAY_HAVE_PC_FDC=y
> CONFIG_PPC_OF=y
> CONFIG_PPC_UDBG_16550=y
> # CONFIG_GENERIC_TBSYNC is not set
> CONFIG_AUDIT_ARCH=y
> CONFIG_GENERIC_BUG=y
> # CONFIG_EPAPR_BOOT is not set
> # CONFIG_DEFAULT_UIMAGE is not set
> CONFIG_ARCH_HIBERNATION_POSSIBLE=y
> CONFIG_ARCH_SUSPEND_POSSIBLE=y
> # CONFIG_PPC_DCR_NATIVE is not set
> # CONFIG_PPC_DCR_MMIO is not set
> CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
> CONFIG_ARCH_SUPPORTS_UPROBES=y
> CONFIG_PPC_EMULATE_SSTEP=y
> CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
> CONFIG_IRQ_WORK=y
>
> #
> # General setup
> #
> CONFIG_BROKEN_ON_SMP=y
> CONFIG_INIT_ENV_ARG_LIMIT=32
> CONFIG_CROSS_COMPILE=""
> # CONFIG_COMPILE_TEST is not set
> CONFIG_LOCALVERSION=""
> # CONFIG_LOCALVERSION_AUTO is not set
> CONFIG_DEFAULT_HOSTNAME="(none)"
> CONFIG_SWAP=y
> CONFIG_SYSVIPC=y
> CONFIG_SYSVIPC_SYSCTL=y
> CONFIG_POSIX_MQUEUE=y
> CONFIG_POSIX_MQUEUE_SYSCTL=y
> CONFIG_CROSS_MEMORY_ATTACH=y
> CONFIG_FHANDLE=y
> CONFIG_USELIB=y
> CONFIG_AUDIT=y
> CONFIG_HAVE_ARCH_AUDITSYSCALL=y
> CONFIG_AUDITSYSCALL=y
> CONFIG_AUDIT_WATCH=y
> CONFIG_AUDIT_TREE=y
>
> #
> # IRQ subsystem
> #
> CONFIG_GENERIC_IRQ_SHOW=y
> CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
> CONFIG_IRQ_DOMAIN=y
> CONFIG_GENERIC_MSI_IRQ=y
> CONFIG_IRQ_FORCED_THREADING=y
> CONFIG_SPARSE_IRQ=y
> CONFIG_GENERIC_TIME_VSYSCALL_OLD=y
> CONFIG_GENERIC_CLOCKEVENTS=y
> CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
> CONFIG_GENERIC_CMOS_UPDATE=y
>
> #
> # Timers subsystem
> #
> CONFIG_TICK_ONESHOT=y
> CONFIG_NO_HZ_COMMON=y
> # CONFIG_HZ_PERIODIC is not set
> CONFIG_NO_HZ_IDLE=y
> # CONFIG_NO_HZ is not set
> CONFIG_HIGH_RES_TIMERS=y
>
> #
> # CPU/Task time and stats accounting
> #
> CONFIG_TICK_CPU_ACCOUNTING=y
> CONFIG_BSD_PROCESS_ACCT=y
> CONFIG_BSD_PROCESS_ACCT_V3=y
> CONFIG_TASKSTATS=y
> CONFIG_TASK_DELAY_ACCT=y
> CONFIG_TASK_XACCT=y
> CONFIG_TASK_IO_ACCOUNTING=y
>
> #
> # RCU Subsystem
> #
> CONFIG_TINY_RCU=y
> CONFIG_SRCU=y
> CONFIG_TASKS_RCU=y
> # CONFIG_RCU_STALL_COMMON is not set
> # CONFIG_TREE_RCU_TRACE is not set
> CONFIG_RCU_KTHREAD_PRIO=0
> CONFIG_BUILD_BIN2C=y
> CONFIG_IKCONFIG=m
> # CONFIG_IKCONFIG_PROC is not set
> CONFIG_LOG_BUF_SHIFT=17
> CONFIG_CGROUPS=y
> # CONFIG_CGROUP_DEBUG is not set
> CONFIG_CGROUP_FREEZER=y
> CONFIG_CGROUP_DEVICE=y
> CONFIG_CPUSETS=y
> CONFIG_PROC_PID_CPUSET=y
> CONFIG_CGROUP_CPUACCT=y
> CONFIG_PAGE_COUNTER=y
> CONFIG_MEMCG=y
> CONFIG_MEMCG_SWAP=y
> # CONFIG_MEMCG_SWAP_ENABLED is not set
> CONFIG_CGROUP_PERF=y
> CONFIG_CGROUP_SCHED=y
> CONFIG_FAIR_GROUP_SCHED=y
> # CONFIG_CFS_BANDWIDTH is not set
> # CONFIG_RT_GROUP_SCHED is not set
> CONFIG_BLK_CGROUP=y
> # CONFIG_DEBUG_BLK_CGROUP is not set
> CONFIG_CHECKPOINT_RESTORE=y
> CONFIG_NAMESPACES=y
> CONFIG_UTS_NS=y
> CONFIG_IPC_NS=y
> CONFIG_USER_NS=y
> CONFIG_PID_NS=y
> CONFIG_NET_NS=y
> CONFIG_SCHED_AUTOGROUP=y
> # CONFIG_SYSFS_DEPRECATED is not set
> CONFIG_RELAY=y
> CONFIG_BLK_DEV_INITRD=y
> CONFIG_INITRAMFS_SOURCE=""
> CONFIG_RD_GZIP=y
> CONFIG_RD_BZIP2=y
> CONFIG_RD_LZMA=y
> CONFIG_RD_XZ=y
> CONFIG_RD_LZO=y
> CONFIG_RD_LZ4=y
> # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
> CONFIG_SYSCTL=y
> CONFIG_ANON_INODES=y
> 

Re: [PATCH 3/5] clk: mediatek: Add basic clocks for Mediatek MT8135.

2015-03-15 Thread Sascha Hauer
On Fri, Mar 13, 2015 at 03:44:30PM +0800, Henry Chen wrote:
> On Sun, 2015-02-22 at 12:49 +0100, Sascha Hauer wrote:
> > +#define PLL(_id, _name, _reg, _pwr_reg, _en_mask, _flags, _pcwbits, 
> > _pd_reg, _pd_shift, _tuner_reg, _pcw_reg, _pcw_shift) { \
> > +   .id = _id,  \
> > +   .name = _name,  \
> > +   .reg = _reg,\
> > +   .pwr_reg = _pwr_reg,\
> > +   .en_mask = _en_mask,\
> > +   .flags = _flags,\
> > +   .rst_bar_mask = CON0_MT8135_RST_BAR,\
> > +   .fmax = MT8135_PLL_FMAX,\
> > +   .pcwbits = _pcwbits,\
> > +   .pd_reg = _pd_reg,  \
> > +   .pd_shift = _pd_shift,  \
> > +   .tuner_reg = _tuner_reg,\
> > +   .pcw_reg = _pcw_reg,\
> > +   .pcw_shift = _pcw_shift,\
> > +   }
> > +
> > +static struct mtk_pll_data plls[] = {
> > +   PLL(APMIXED_ARMPLL1, "armpll1", 0x200, 0x218, 0x8001, 0, 21, 0x204, 
> > 24, 0x0, 0x204, 0),
> > +   PLL(APMIXED_ARMPLL2, "armpll2", 0x2cc, 0x2e4, 0x8001, 0, 21, 0x2d0, 
> > 24, 0x0, 0x2d0, 0),
> > +   PLL(APMIXED_MAINPLL, "mainpll", 0x21c, 0x234, 0xf001, HAVE_RST_BAR, 
> > 21, 0x21c, 6, 0x0, 0x220, 0),
> > +   PLL(APMIXED_UNIVPLL, "univpll", 0x238, 0x250, 0xf301, HAVE_RST_BAR, 
> > 7, 0x238, 6, 0x0, 0x238, 9),
> > +   PLL(APMIXED_MMPLL, "mmpll", 0x254, 0x26c, 0xf001, HAVE_RST_BAR, 21, 
> > 0x254, 6, 0x0, 0x258, 0),
> > +   PLL(APMIXED_MSDCPLL, "msdcpll", 0x278, 0x290, 0x8001, 0, 21, 0x278, 
> > 6, 0x0, 0x27c, 0),
> > +   PLL(APMIXED_TVDPLL, "tvdpll", 0x294, 0x2ac, 0x8001, 0, 31, 0x296, 
> > 6, 0x0, 0x298, 0),
> 
> Hi Sasha,
> 
> The pd_reg of tvdpll should be 0x294.

Fixed, thanks

Sascha


-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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/5] clk: mediatek: Add initial common clock support for Mediatek SoCs.

2015-03-15 Thread Sascha Hauer
On Fri, Mar 13, 2015 at 05:46:32PM +0100, Matthias Brugger wrote:
> 
> 
> On 22/02/15 12:49, Sascha Hauer wrote:
> > From: James Liao 
> 
> > diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h
> > new file mode 100644
> > index 000..c7c0d35
> > --- /dev/null
> > +++ b/drivers/clk/mediatek/clk-mtk.h
> 
> [...]
> 
> > +void __init mtk_clk_register_plls(struct device_node *node,
> > +   const struct mtk_pll_data *plls, int num_plls);
> > +
> > +#ifdef CONFIG_RESET_CONTROLLER
> > +void mtk_register_reset_controller(struct device_node *np,
> > +   unsigned int num_regs, int regofs);
> > +#else
> > +static inline void mtk_register_reset_controller(struct device_node *np,
> > +   unsigned int num_regs, int regofs)
> > +{
> > +}
> > +#endif
> 
> This lines should only be added once in [2/5], compiling ends with:
> 
> In file included from drivers/clk/mediatek/clk-mtk.c:24:0:
> drivers/clk/mediatek/clk-mtk.h:168:20: error: redefinition of 
> ‘mtk_register_reset_controller’
> drivers/clk/mediatek/clk-mtk.h:158:20: note: previous definition of 
> ‘mtk_register_reset_controller’ was here

Hm, seems to be a rebase accident. Fixed, thanks

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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/4] perf kmem: Implement stat --page --caller

2015-03-15 Thread Namhyung Kim
It perf kmem support caller statistics for page.  Unlike slab case,
the tracepoints in page allocator don't provide callsite info.  So
it records with callchain and extracts callsite info.

Note that the callchain contains several memory allocation functions
which has no meaning for users.  So skip those functions to get proper
callsites.  I used following regex pattern to skip the allocator
functions:

  ^_?_?(alloc|get_free|get_zeroed)_pages?

This gave me a following list of functions:

  # perf kmem record --page sleep 3
  # perf kmem stat --page -v
  ...
  alloc func: __get_free_pages
  alloc func: get_zeroed_page
  alloc func: alloc_pages_exact
  alloc func: __alloc_pages_direct_compact
  alloc func: __alloc_pages_nodemask
  alloc func: alloc_page_interleave
  alloc func: alloc_pages_current
  alloc func: alloc_pages_vma
  alloc func: alloc_page_buffers
  alloc func: alloc_pages_exact_nid
  ...

The output looks mostly same as --alloc (I also added callsite column
to that) but groups entries by callsite.  Currently, the order,
migrate type and GFP flag info is for the last allocation and not
guaranteed to be same for all allocations from the callsite.

  
-
   Total_alloc (KB) | Hits  | Order | Migration type | GFP flags | Callsite
  
-
  1,064 |   266 | 0 |  UNMOVABLE |  00d0 | 
__pollwait
 52 |13 | 0 |  UNMOVABLE |  002084d0 | 
pte_alloc_one
 44 |11 | 0 |MOVABLE |  000280da | 
handle_mm_fault
 20 | 5 | 0 |MOVABLE |  000200da | 
do_cow_fault
 20 | 5 | 0 |MOVABLE |  000200da | 
do_wp_page
 16 | 4 | 0 |  UNMOVABLE |  84d0 | 
__pmd_alloc
 16 | 4 | 0 |  UNMOVABLE |  0200 | 
__tlb_remove_page
 12 | 3 | 0 |  UNMOVABLE |  84d0 | 
__pud_alloc
  8 | 2 | 0 |  UNMOVABLE |  0010 | 
bio_copy_user_iov
  4 | 1 | 0 |  UNMOVABLE |  000200d2 | 
pipe_write
  4 | 1 | 0 |MOVABLE |  000280da | 
do_wp_page
  4 | 1 | 0 |  UNMOVABLE |  002084d0 | pgd_alloc
  
-

Signed-off-by: Namhyung Kim 
---
 tools/perf/builtin-kmem.c | 298 ++
 1 file changed, 274 insertions(+), 24 deletions(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 76a527dc6ba1..e4914b3a0213 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -10,6 +10,7 @@
 #include "util/header.h"
 #include "util/session.h"
 #include "util/tool.h"
+#include "util/callchain.h"
 
 #include "util/parse-options.h"
 #include "util/trace-event.h"
@@ -21,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static int kmem_slab;
 static int kmem_page;
@@ -240,6 +242,8 @@ static unsigned long nr_page_frees;
 static unsigned long nr_page_fails;
 static unsigned long nr_page_nomatch;
 
+static struct perf_session *kmem_session;
+
 #define MAX_MIGRATE_TYPES  6
 #define MAX_PAGE_ORDER 11
 
@@ -248,6 +252,7 @@ static int order_stats[MAX_PAGE_ORDER][MAX_MIGRATE_TYPES];
 struct page_stat {
struct rb_node  node;
u64 page;
+   u64 callsite;
int order;
unsignedgfp_flags;
unsignedmigrate_type;
@@ -257,12 +262,142 @@ struct page_stat {
int nr_free;
 };
 
-static struct rb_root page_tree;
+static struct rb_root page_alloc_tree;
 static struct rb_root page_alloc_sorted;
+static struct rb_root page_caller_tree;
+static struct rb_root page_caller_sorted;
+
+struct alloc_func {
+   u64 start;
+   u64 end;
+   char *name;
+};
+
+static int nr_alloc_funcs;
+static struct alloc_func *alloc_func_list;
+
+static int funcmp(const void *a, const void *b)
+{
+   const struct alloc_func *fa = a;
+   const struct alloc_func *fb = b;
+
+   if (fa->start > fb->start)
+   return 1;
+   else
+   return -1;
+}
+
+static int callcmp(const void *a, const void *b)
+{
+   const struct alloc_func *fa = a;
+   const struct alloc_func *fb = b;
+
+   if (fb->start <= fa->start && fa->end < fb->end)
+   return 0;
+
+   if (fa->start > fb->start)
+   return 1;
+   else
+   return -1;
+}
 
-static struct page_stat *search_page_stat(unsigned long page, bool create)
+static int build_alloc_func_list(void)
 {
-   struct rb_node **node = _tree.rb_node;
+   int ret;
+   struct map *kernel_map;
+   struct 

Re: [PATCH 3/5] clk: mediatek: Add basic clocks for Mediatek MT8135.

2015-03-15 Thread Sascha Hauer
On Mon, Mar 16, 2015 at 12:27:20AM +0800, Daniel Kurtz wrote:
> Hi Sascha,
> 
> Drive-by review...
> 
> On Sun, Feb 22, 2015 at 7:49 PM, Sascha Hauer  wrote:
> > From: James Liao 
> >
> > This patch adds basic clocks for MT8135, including TOPCKGEN, PLLs,
> > INFRA and PERI clocks.
> >
> > Signed-off-by: James Liao 
> > Signed-off-by: Henry Chen 
> > Signed-off-by: Sascha Hauer 
> > ---
> >  drivers/clk/mediatek/Makefile  |   1 +
> >  drivers/clk/mediatek/clk-mt8135.c  | 634 
> > +
> >  include/dt-bindings/clock/mt8135-clk.h | 190 ++
> >  .../dt-bindings/reset-controller/mt8135-resets.h   |  64 +++
> >  4 files changed, 889 insertions(+)
> >  create mode 100644 drivers/clk/mediatek/clk-mt8135.c
> >  create mode 100644 include/dt-bindings/clock/mt8135-clk.h
> >  create mode 100644 include/dt-bindings/reset-controller/mt8135-resets.h
> >
> > diff --git a/drivers/clk/mediatek/Makefile b/drivers/clk/mediatek/Makefile
> > index 0b6f1c3..12ce576 100644
> > --- a/drivers/clk/mediatek/Makefile
> > +++ b/drivers/clk/mediatek/Makefile
> > @@ -1,2 +1,3 @@
> >  obj-y += clk-mtk.o clk-pll.o clk-gate.o
> >  obj-$(CONFIG_RESET_CONTROLLER) += reset.o
> > +obj-y += clk-mt8135.o
> > diff --git a/drivers/clk/mediatek/clk-mt8135.c 
> > b/drivers/clk/mediatek/clk-mt8135.c
> > new file mode 100644
> > index 000..6157447
> > --- /dev/null
> > +++ b/drivers/clk/mediatek/clk-mt8135.c
> > @@ -0,0 +1,634 @@
> > +/*
> > + * Copyright (c) 2014 MediaTek Inc.
> > + * Author: James Liao 
> > + *
> > + * 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.
> > + *
> > + * 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 
> > +#include 
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#include "clk-mtk.h"
> > +#include "clk-gate.h"
> > +
> > +static DEFINE_SPINLOCK(lock);
> > +
> 
> > +static struct mtk_fixed_factor root_clk_alias[] __initdata = {
> 
> Any reason you can't use "static const" here, and on all of the other
> static constant structures/arrays throughout this patch.

No, there is no reason. Changed it. Thanks

Sascha

-- 
Pengutronix e.K.   | |
Industrial Linux Solutions | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0|
Amtsgericht Hildesheim, HRA 2686   | Fax:   +49-5121-206917- |
--
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] x86, kaslr: Access the correct kaslr_enabled variable

2015-03-15 Thread Baoquan He
On 03/15/15 at 10:04pm, Yinghai Lu wrote:
> On Sun, Mar 15, 2015 at 8:28 PM, Baoquan He  wrote:
> > On 03/15/15 at 12:49am, Yinghai Lu wrote:
> >
> > It's good to check the ret value as Boris suggested. However it could
> > fail since early_memremap self fail, e.g slot not found. In this case
> > making kaslr_enabled true may not be good.
> 
> It should not fail. we always follow map/access/unmap. and sometime
> would have two for copying between them.

Well, then I would say if add checking too in other places for
setup_data handling, e.g parse_setup_data you mentioned. Or don't check
at all place to make them consistent. 

> 
> >
> > As Minfei talked with you kaslr_setup_data is a global variable inside
> > kernel code, it has been ident mapped. Just derefencing the physical
> > address which is virtual address too and getting the real stored value
> > may be safer.
> 
> No.
> That ident mapping is set in arch/x86/kernel/head_64.S and it
> is only for switchover. and it is gone when
> arch/x86/kernel/head64.c::x86_64_start_kernel/reset_early_page_tables
> is called.
> 
> That reset_early_page_tables will only keep kernel high mapping
> and clear all other.

Ah, yes. You are right. I didn't get this clearly, Thanks for telling.

Thanks
Baoquan

> 
> Thanks
> 
> Yinghai
--
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/


linux-next: manual merge of the kdbus tree with the arm-soc tree

2015-03-15 Thread Stephen Rothwell
Hi Greg,

Today's linux-next merge of the kdbus tree got a conflict in
Documentation/Makefile between commit c6535e1e0361 ("Documentation:
Remove ZBOOT MMC/SDHI utility and docs") from the arm-soc tree and
commit 48480f8c402c ("kdbus: add documentation") from the kdbus tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc Documentation/Makefile
index bc0548201755,5e3fde632d03..
--- a/Documentation/Makefile
+++ b/Documentation/Makefile
@@@ -1,4 -1,4 +1,4 @@@
 -subdir-y := accounting arm auxdisplay blackfin connector \
 +subdir-y := accounting auxdisplay blackfin connector \
-   filesystems filesystems ia64 laptops mic misc-devices \
+   filesystems filesystems ia64 kdbus laptops mic misc-devices \
networking pcmcia prctl ptp spi timers vDSO video4linux \
watchdog


pgp4vgHii7vk4.pgp
Description: OpenPGP digital signature


Re: [PATCH v4] x86, kaslr: Access the correct kaslr_enabled variable

2015-03-15 Thread Baoquan He
On 03/15/15 at 09:36pm, Yinghai Lu wrote:
> On Sun, Mar 15, 2015 at 8:28 PM, Baoquan He  wrote:
> > On 03/15/15 at 12:49am, Yinghai Lu wrote:
> > It's good to check the ret value as Boris suggested. However it could
> > fail since early_memremap self fail, e.g slot not found. In this case
> > making kaslr_enabled true may not be good.
> >
> > As Minfei talked with you kaslr_setup_data is a global variable inside
> > kernel code, it has been ident mapped. Just derefencing the physical
> > address which is virtual address too and getting the real stored value
> > may be safer. And also parse_kaslr_setup is a function specified to
> > handle kaslr, it doesn't make me uncomfortable to implement with a
> > specific knowledge which here means the setup_data is a global varialbe
> > in kernel code and no need to do early_memremap since mapping has been
> > built .
> 
> I should not put that checking in. even parse_setup_data does not check
> early_memmap return.

Yes, I think so. Otherwise it involves incorrect handling. 

Still I think no need to do early_memremap. Because kaslr_setup_data is
ident mapped, it's not like other setup_data info which is passed in
from bootloader. But I am fine too if only do early_memremap
without checking.


Thanks
Baoquan

--
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/


linux panic on 4.0.0-rc4

2015-03-15 Thread Pranith Kumar
Hello,

I have a power mac mini 32-bit system.

I am getting a kernel panic with the latest rc kernel. The last kernel
which worked on this which I remember booting was 3.19-rc5.

You can see the panic message here: http://imgur.com/s1lH15g. (there
is no log and I have no serial console).

Let me know if you need any more information. Config follows:

#
# Automatically generated file; DO NOT EDIT.
# Linux/powerpc 4.0.0-rc4 Kernel Configuration
#
# CONFIG_PPC64 is not set

#
# Processor support
#
CONFIG_PPC_BOOK3S_32=y
# CONFIG_PPC_85xx is not set
# CONFIG_PPC_8xx is not set
# CONFIG_40x is not set
# CONFIG_44x is not set
# CONFIG_E200 is not set
CONFIG_PPC_BOOK3S=y
CONFIG_6xx=y
CONFIG_PPC_FPU=y
CONFIG_ALTIVEC=y
CONFIG_PPC_STD_MMU=y
CONFIG_PPC_STD_MMU_32=y
# CONFIG_PPC_MM_SLICES is not set
CONFIG_PPC_HAVE_PMU_SUPPORT=y
CONFIG_PPC_PERF_CTRS=y
# CONFIG_SMP is not set
# CONFIG_PPC_DOORBELL is not set
CONFIG_CPU_BIG_ENDIAN=y
# CONFIG_CPU_LITTLE_ENDIAN is not set
CONFIG_PPC32=y
CONFIG_32BIT=y
CONFIG_WORD_SIZE=32
# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
# CONFIG_ARCH_DMA_ADDR_T_64BIT is not set
CONFIG_MMU=y
# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
CONFIG_NR_IRQS=512
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_ARCH_HAS_ILOG2_U32=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_PPC=y
# CONFIG_GENERIC_CSUM is not set
CONFIG_EARLY_PRINTK=y
CONFIG_PANIC_TIMEOUT=0
CONFIG_GENERIC_NVRAM=y
CONFIG_SCHED_OMIT_FRAME_POINTER=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_PPC_OF=y
CONFIG_PPC_UDBG_16550=y
# CONFIG_GENERIC_TBSYNC is not set
CONFIG_AUDIT_ARCH=y
CONFIG_GENERIC_BUG=y
# CONFIG_EPAPR_BOOT is not set
# CONFIG_DEFAULT_UIMAGE is not set
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
# CONFIG_PPC_DCR_NATIVE is not set
# CONFIG_PPC_DCR_MMIO is not set
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_PPC_EMULATE_SSTEP=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_IRQ_WORK=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
# CONFIG_LOCALVERSION_AUTO is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_CROSS_MEMORY_ATTACH=y
CONFIG_FHANDLE=y
CONFIG_USELIB=y
CONFIG_AUDIT=y
CONFIG_HAVE_ARCH_AUDITSYSCALL=y
CONFIG_AUDITSYSCALL=y
CONFIG_AUDIT_WATCH=y
CONFIG_AUDIT_TREE=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_SHOW_LEVEL=y
CONFIG_IRQ_DOMAIN=y
CONFIG_GENERIC_MSI_IRQ=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_GENERIC_TIME_VSYSCALL_OLD=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_NO_HZ_COMMON=y
# CONFIG_HZ_PERIODIC is not set
CONFIG_NO_HZ_IDLE=y
# CONFIG_NO_HZ is not set
CONFIG_HIGH_RES_TIMERS=y

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
CONFIG_BSD_PROCESS_ACCT=y
CONFIG_BSD_PROCESS_ACCT_V3=y
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
CONFIG_TASK_IO_ACCOUNTING=y

#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
CONFIG_SRCU=y
CONFIG_TASKS_RCU=y
# CONFIG_RCU_STALL_COMMON is not set
# CONFIG_TREE_RCU_TRACE is not set
CONFIG_RCU_KTHREAD_PRIO=0
CONFIG_BUILD_BIN2C=y
CONFIG_IKCONFIG=m
# CONFIG_IKCONFIG_PROC is not set
CONFIG_LOG_BUF_SHIFT=17
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_FREEZER=y
CONFIG_CGROUP_DEVICE=y
CONFIG_CPUSETS=y
CONFIG_PROC_PID_CPUSET=y
CONFIG_CGROUP_CPUACCT=y
CONFIG_PAGE_COUNTER=y
CONFIG_MEMCG=y
CONFIG_MEMCG_SWAP=y
# CONFIG_MEMCG_SWAP_ENABLED is not set
CONFIG_CGROUP_PERF=y
CONFIG_CGROUP_SCHED=y
CONFIG_FAIR_GROUP_SCHED=y
# CONFIG_CFS_BANDWIDTH is not set
# CONFIG_RT_GROUP_SCHED is not set
CONFIG_BLK_CGROUP=y
# CONFIG_DEBUG_BLK_CGROUP is not set
CONFIG_CHECKPOINT_RESTORE=y
CONFIG_NAMESPACES=y
CONFIG_UTS_NS=y
CONFIG_IPC_NS=y
CONFIG_USER_NS=y
CONFIG_PID_NS=y
CONFIG_NET_NS=y
CONFIG_SCHED_AUTOGROUP=y
# CONFIG_SYSFS_DEPRECATED is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_XZ=y
CONFIG_RD_LZO=y
CONFIG_RD_LZ4=y
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_BPF=y
CONFIG_EXPERT=y
CONFIG_SGETMASK_SYSCALL=y
CONFIG_SYSFS_SYSCALL=y
# CONFIG_SYSCTL_SYSCALL is not set
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_PCSPKR_PLATFORM=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_BPF_SYSCALL=y
CONFIG_SHMEM=y
CONFIG_AIO=y
CONFIG_ADVISE_SYSCALLS=y
CONFIG_PCI_QUIRKS=y
# CONFIG_EMBEDDED is not set
CONFIG_HAVE_PERF_EVENTS=y

#
# 

Re: [PATCH v10 00/21] Introduce ACPI for ARM64 based on ACPI 5.1

2015-03-15 Thread Suthikulpanit, Suravee


On 3/12/15, 08:26, "Timur Tabi"  wrote:

>Hanjun Guo wrote:
>> This patch set already tested on multi platforms:
>>   - AMD Seattle board;
>>   - Cavium Thunder board;
>>   - Huawei D02 board;
>>   - Qualcomm ARM64 platform
>>
>> This version 10 patch set address some minor comments and collect ACKs
>>and
>> Reviewed-bys for v9:
>>
>>   - new Acks from Rafael, Olof, Grant, Lorenzo
>>   - new way to handle typdef phys_cpuid_t which suggested by Rafael,
>> but no functional change
>>   - Remove if(!phys) for early ioremappings
>>   - Rework sleep function for ARM64
>>   - Introduce linux/acpi_irq.h to hold acpi_irq_init()
>>   - Disable ACPI if not HW_REDUCED_ACPI compliant
>>   - Remove the doc of why ACPI on ARM
>
>v10 retested and working as before, so ...
>
>   Tested-by: Timur Tabi 
>
>for the whole patchset.


Also retested on AMD Seattle.

Tested-by: Suravee Suthikulpanit 

>
>-- 
>Sent by an employee of the Qualcomm Innovation Center, Inc.
>The Qualcomm Innovation Center, Inc. is a member of the
>Code Aurora Forum, hosted by The Linux Foundation.

--
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 0/9] arm64: Add the support for new Exynos5433 SoC

2015-03-15 Thread Chanwoo Choi
Dear Kukjin,

Gently Ping!

Best Regards
Chanwoo Choi

On 03/10/2015 10:57 AM, Chanwoo Choi wrote:
> This patchset adds new 64-bit Exynos5433 Samsung SoC which contains quad
> Cortex-A57 and quad Cortex-A53. It is desigend with the 20nm low power 
> process.
> 
> Depends on:
> - This patch-set has the dependency on following four patch-set.
> The Exynos5433 clock controller patch-set[1][2] was merged by Michael 
> Turquette.
> and Exynos5433's pinctrl patch[3] was merged by Linus Walleij. Exynos5433's 
> TMU
> patch[4] will be refactoring without feature update.
> 
> [1] [PATCH v5 00/13] clk: samsung: Add the support for exynos5433 clocks
> - https://lkml.org/lkml/2015/2/2/368
> [2] [PATCH v3 0/9] clk: samsung: Add clocks for remaining domains of 
> Exynos5433
> - https://lkml.org/lkml/2015/2/2/784
> [3] [PATCH v4] pinctrl: exynos: Add support for Exynos5433
> - https://lkml.org/lkml/2015/2/23/728
> [4] [PATCH 0/3] thermal: exynos: Add support for Exynos5433 TMU
> - https://lkml.org/lkml/2015/2/26/234
> 
> Changelog:
> 
> Changes from v5:
> (https://lkml.org/lkml/2015/3/5/27)
> - Move 'timer' dt node under root node by Mark Rutland's comment
> 
> Changes from v4:
> (https://lkml.org/lkml/2015/2/24/2)
> - Rebased it on Linux 4.0-rc2
> - Remove CONFIG_ARCH_EXYNOS5433 configuration by Arnd Bergmann's comment
> - Move 'aliases' dt node from SoC dtsi to board dts file by Arnd Bergmann's 
> comment
> - Add Exynos5433 TMU patches which got the Lukasz Majewski's reviewed message
> 
> Changes from v3:
> (https://lkml.org/lkml/2015/2/12/65)
> - Rebased it on Linux 4.0-rc1.
> - Remove ARM_GIC and ARM_AMBA dependency because CONFIG_ARM64 already 
> included them.
> 
> Changes from v2:
> (https://lkml.org/lkml/2014/12/2/134)
> : Fix the range of GICC memory map (0x1000 -> 0x2000)
> : Fix address space of 'range' property under 'soc' node
> : Add ADMA / I2S dt node for sound playback/capture
> - Select ARM_AMBA/ARM_GIC/HAVE_S3C_RTC for Exynos5433 in arch/arm64/Kconfig
> - Send separate patch-set for Exynos5433 clock controller[1][2] and pinctrl[3]
> 
> Changes from v1:
> (https://lkml.org/lkml/2014/11/27/92)
> - Merge two patches (patch2, patch3) to solve incomplete description
> - Exynos5433 Clock driver
>  : Fix wrong register and code clean by using space instead of tab
>  : Add CLK_IGNORE_UNUSED flag to pclk_sysreg_* clock for accessing system 
> control register
>  : Remove duplicate definition on the patch for CMU_BUS{0|1|2} domain
> - Exynos5433 SoC DTS
>  : Remove un-supported properties of arch_timer
>  : Remove 'clock-frequency' property from 'cpus' dt node
>  : Fix interrupt type from edge rising triggering to level high triggering
>because Cortex-A53/A57 use level triggering.
>  : Fix defult address-size/size-celss from 1 to 2 because Exynos5433 is 
> 64-bit SoC
>  : Modify 'fin_pll' dt node to remove un-needed and ugly code
>  : Move 'chipid' dt node under 'soc'
>  : Use lowercase on all case in exynos5433.dtsi
>  : Add PSCI dt node for secondary cpu boot
>  : Add 'samsung,exynos5433' compatible to MCT dt node
> - Divide pinctrl patch from this patchset
> - Add new following patches:
>   : clocksource: exynos_mct: Add the support for Exynos 64bit SoC
>   : arm64: Enable Exynos5433 SoC in the defconfig
> 
> Chanwoo Choi (6):
>   arm64: dts: exynos: Add dts files for 64-bit Exynos5433 SoC
>   arm64: dts: exynos: Add SPI/PDMA dt node for Exynos5433
>   arm64: dts: exynos: Add PMU dt node for Exynos5433
>   arm64: dts: exynos: Add RTC and ADC dt node for Exynos5433 SoC
>   arm64: dts: exynos: Add TMU sensor dt node for Exynos5433 SoC
>   arm64: dts: exynos: Add thermal-zones dt node for Exynos5433 SoC
> 
> Inha Song (2):
>   arm64: dts: exynos: Add ADMA dt node for Exynos5433 SoC
>   arm64: dts: exynos: Add I2S dt node for Exynos5433 SoC
> 
> Jaehoon Chung (1):
>   arm64: dts: exynos: Add MSHC dt node for Exynos5433
> 
>  .../devicetree/bindings/arm/samsung/pmu.txt|   1 +
>  arch/arm64/boot/dts/exynos/exynos5433-pinctrl.dtsi | 698 +++
>  .../dts/exynos/exynos5433-tmu-sensor-conf.dtsi |  22 +
>  arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi | 231 +
>  arch/arm64/boot/dts/exynos/exynos5433.dtsi | 931 
> +
>  5 files changed, 1883 insertions(+)
>  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-pinctrl.dtsi
>  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tmu-sensor-conf.dtsi
>  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433-tmu.dtsi
>  create mode 100644 arch/arm64/boot/dts/exynos/exynos5433.dtsi
> 

--
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] x86, kaslr: Access the correct kaslr_enabled variable

2015-03-15 Thread Yinghai Lu
On Sun, Mar 15, 2015 at 8:28 PM, Baoquan He  wrote:
> On 03/15/15 at 12:49am, Yinghai Lu wrote:
>
> It's good to check the ret value as Boris suggested. However it could
> fail since early_memremap self fail, e.g slot not found. In this case
> making kaslr_enabled true may not be good.

It should not fail. we always follow map/access/unmap. and sometime
would have two for copying between them.

>
> As Minfei talked with you kaslr_setup_data is a global variable inside
> kernel code, it has been ident mapped. Just derefencing the physical
> address which is virtual address too and getting the real stored value
> may be safer.

No.
That ident mapping is set in arch/x86/kernel/head_64.S and it
is only for switchover. and it is gone when
arch/x86/kernel/head64.c::x86_64_start_kernel/reset_early_page_tables
is called.

That reset_early_page_tables will only keep kernel high mapping
and clear all other.

Thanks

Yinghai
--
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/5] drm/msm/mdp5: Add hardware configuration for msm8x16

2015-03-15 Thread Archit Taneja



On 03/14/2015 01:15 AM, "Stéphane Viau" wrote:

Hi,


Hi,

On 03/09/2015 06:41 PM, Stephane Viau wrote:

This change adds the hw configuration for msm8x16 chipsets in
mdp5_cfg module.

Note that only one external display interface is present in this
configuration (DSI) but has not been enabled yet. It will be enabled
once drm/msm driver supports DSI connectors.

Signed-off-by: Stephane Viau 
---
   drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c | 51
-
   1 file changed, 50 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
index 96ea6dd..9ff7ac1 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
@@ -1,5 +1,5 @@
   /*
- * Copyright (c) 2014 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2015 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or
modify
* it under the terms of the GNU General Public License version 2 and
@@ -150,10 +150,59 @@ const struct mdp5_cfg_hw apq8084_config = {
.max_clk = 32000,
   };

+const struct mdp5_cfg_hw msm8x16_config = {
+   .name = "msm8x16",
+   .mdp = {
+   .count = 1,
+   .base = { 0x01000 },
+   },
+   .smp = {
+   .mmb_count = 8,
+   .mmb_size = 8192,
+   .clients = {
+   [SSPP_VIG0] = 1, [SSPP_DMA0] = 4,
+   [SSPP_RGB0] = 7, [SSPP_RGB1] = 8,
+   },
+   },
+   .ctl = {
+   .count = 5,
+   .base = { 0x02000, 0x02200, 0x02400, 0x02600, 0x02800 },
+   },
+   .pipe_vig = {
+   .count = 1,
+   .base = { 0x05000 },
+   },
+   .pipe_rgb = {
+   .count = 2,
+   .base = { 0x15000, 0x17000 },
+   },
+   .pipe_dma = {
+   .count = 1,
+   .base = { 0x25000 },
+   },
+   .lm = {
+   .count = 2, /* LM0 and LM3 */
+   .base = { 0x45000, 0x48000 },
+   .nb_stages = 5,
+   },
+   .dspp = {
+   .count = 1,
+   .base = { 0x55000 },
+
+   },
+   .intf = {
+   .count = 1, /* INTF_1 */
+   .base = { 0x6B800 },


We would need to put the other non-existent INTF_0, INTF_2 and INTF_3
base addresses here too, so that the writes to
REG_MDP5_INTF_TIMING_ENGINE_EN in the patch "Make the intf connection in
config module" access the correct registers.


You are referring here to the discussion we had in "drm/msm/mdp5: Make the
intf connection in config module"[1]...

Let me clarify:
We see these faults when interfaces are *present* but not *supported* by
the driver, where:
  - *present* means that the interfaces are physically implemented in HW
and therefore need to be reflected by "intf.base" addresses
  - *supported* means that the msm KMS driver is actually able to drive an
interface
If you look at mdp5_cfg.c in "drm/msm/mdp5: Make the intf connection in
config module"[1], 4 interfaces (intf.base) are present (for apq8084), but
only 2 are supported (intfs[])...
What I meant is that even though our driver cannot support all interfaces
present in a chip, we still need to disable them in mdp5_kms_init().
(BTW, this is probably due to my bootloader enabling the DSI whereas the
msm KMS driver does not support it as of yet - and thus leads to
artifacts/underflow on my eDP panel.)


Okay, I get it now. I think I wasn't sure about whether INTF_DISABLED 
represents *present* or *supported*. Thanks for the clarification.




So to answer your comment, it doesn't make too much sense to define base
addresses for interfaces that are not present in a chip. Instead I'd
prefer to check if intf.base is not NULL before writing in
REG_MDP5_INTF_TIMING_ENGINE_EN registers.. and avoid some INVALID_INDEX
BUGs ;-).


That sounds good. Thanks.

Archit

--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
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] X86: hyperv: Enable MSR based APIC access

2015-03-15 Thread K. Y. Srinivasan
If the hypervisor supports MSR based access to the APIC registers
(EOI, TPR and ICR), implement the MSR based access.

Signed-off-by: K. Y. Srinivasan 
---
 arch/x86/include/uapi/asm/hyperv.h |5 +++
 arch/x86/kernel/cpu/mshyperv.c |   69 
 2 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/uapi/asm/hyperv.h 
b/arch/x86/include/uapi/asm/hyperv.h
index 90c458e..6ce69e0 100644
--- a/arch/x86/include/uapi/asm/hyperv.h
+++ b/arch/x86/include/uapi/asm/hyperv.h
@@ -140,6 +140,11 @@
  */
 #define HV_X64_RELAXED_TIMING_RECOMMENDED  (1 << 5)
 
+/*
+ * Recommend using x2APIC MSRs.
+ */
+#define HV_X64_X2APIC_MSRS_RECOMMENDED   (1 << 8)
+
 /* MSR used to identify the guest OS. */
 #define HV_X64_MSR_GUEST_OS_ID 0x4000
 
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 939155f..dd2eb49 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -110,6 +110,55 @@ static struct clocksource hyperv_cs = {
.flags  = CLOCK_SOURCE_IS_CONTINUOUS,
 };
 
+static u64 ms_hv_apic_icr_read(void)
+{
+   u64 reg_val;
+
+   rdmsrl(HV_X64_MSR_ICR, reg_val);
+   return reg_val;
+}
+
+static void ms_hv_apic_icr_write(u32 low, u32 id)
+{
+   u64 reg_val;
+
+   reg_val = SET_APIC_DEST_FIELD(id);
+   reg_val = (reg_val << 32);
+   reg_val |= low;
+
+   wrmsrl(HV_X64_MSR_EOI, reg_val);
+}
+
+static u32 ms_hv_apic_read(u32 reg)
+{
+   u64 reg_val;
+
+   switch (reg) {
+   case APIC_EOI:
+   case APIC_TASKPRI:
+   rdmsrl(HV_X64_MSR_EOI, reg_val);
+   return reg_val;
+
+   default:
+   return native_apic_mem_read(reg);
+   }
+}
+
+static void ms_hv_apic_write(u32 reg, u32 val)
+{
+   u64 reg_val;
+
+   reg_val =  val;
+   switch (reg) {
+   case APIC_EOI:
+   case APIC_TASKPRI:
+   wrmsrl(HV_X64_MSR_EOI, reg_val);
+   default:
+   native_apic_mem_write(reg, val);
+   }
+}
+
+
 static void __init ms_hyperv_init_platform(void)
 {
/*
@@ -143,11 +192,31 @@ static void __init ms_hyperv_init_platform(void)
no_timer_check = 1;
 #endif
 
+   if (ms_hyperv.features & HV_X64_MSR_APIC_ACCESS_AVAILABLE) {
+   /*
+* Setup the hooks for optimized APIC read/write.
+*/
+   apic->read = ms_hv_apic_read;
+   apic->write = ms_hv_apic_write;
+   apic->icr_write = ms_hv_apic_icr_write;
+   apic->icr_read = ms_hv_apic_icr_read;
+   apic->eoi_write = ms_hv_apic_write;
+   }
+
+}
+
+static bool ms_hyperv_x2apic(void)
+{
+   if (ms_hyperv.hints & HV_X64_X2APIC_MSRS_RECOMMENDED)
+   return true;
+   else
+   return false;
 }
 
 const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
.name   = "Microsoft HyperV",
.detect = ms_hyperv_platform,
.init_platform  = ms_hyperv_init_platform,
+   .x2apic_available   = ms_hyperv_x2apic
 };
 EXPORT_SYMBOL(x86_hyper_ms_hyperv);
-- 
1.7.4.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 32/35] clockevents: Fix cpu down race for hrtimer based broadcasting

2015-03-15 Thread Preeti U Murthy
Hi Peter, Ingo, Thomas,

Can you please take a look at the conversation on this thread ?
This fix is urgent.

Regards
Preeti U Murthy

On 03/02/2015 08:26 PM, Peter Zijlstra wrote:
> On Fri, Feb 27, 2015 at 02:19:05PM +0530, Preeti U Murthy wrote:
>> The problem reported in the changelog of this patch is causing severe
>> regressions very frequently on our machines for certain usecases. It would
>> help to put in a fix in place first and then follow that up with these
>> cleanups.  A fix on the below lines :
> 
> Regression how? Neither Thomas' Changelog, nor yours mention its a
> regression.
> 
> If its a (recent) Regression you need to have a Fixes tag at the very
> least. So when was this broken and by which patch?
> 

--
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 3/5] staging: rtl8192e: fix coding style errors (macros in parentheses)

2015-03-15 Thread Joe Perches
On Sun, 2015-03-15 at 21:39 +0100, Mateusz Kulikowski wrote:
> Fix checkpatch.pl errors 'Macros with complex values should be enclosed in 
> parentheses'.
[]
> diff --git a/drivers/staging/rtl8192e/rtl819x_HT.h 
> b/drivers/staging/rtl8192e/rtl819x_HT.h
[]
> @@ -78,7 +78,7 @@ enum chnl_op {
>  };
>  
>  #define CHHLOP_IN_PROGRESS(_pHTInfo) \
> - ((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false
> + (((_pHTInfo)->ChnlOp > CHNLOP_NONE) ? true : false)

This would perhaps be better without the ternary as
the compiler might not optimize the ternary away

#define CHHLOP_IN_PROGRESS(_pHTInfo)\
((_pHTInfo)->ChnOp > CHNLOP_NONE)

This would also probably be better as a static inline
not a macro, but as this is never used it's actually
better just to remove it.

> @@ -385,8 +385,8 @@ extern u8 MCS_FILTER_1SS[16];
>  #define  LEGACY_WIRELESS_MODEIEEE_MODE_MASK
>  
>  #define CURRENT_RATE(WirelessMode, LegacyRate, HTRate)   \
> - ((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \
> - (LegacyRate) : (PICK_RATE(LegacyRate, HTRate))
> + (((WirelessMode & (LEGACY_WIRELESS_MODE)) != 0) ? \
> + (LegacyRate) : (PICK_RATE(LegacyRate, HTRate)))

This would be better with the various macro arguments
parenthesized (especially WirelessMode)

#define CURRENT_RATE(WirelessMode, LegacyRate, HTRate)  \
(((WirelessMode) & LEGACY_WIRELESS_MODE)  ? \
(LegacyRate) : PICK_RATE((LegacyRate), HTRate))

As this is used exactly once, it's probably better
expanded in that one place and the macro removed.

That's true for PICK_RATE as well.


--
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 04/13] security/selinux: check for LOOKUP_RCU in _follow_link.

2015-03-15 Thread NeilBrown
Some of dentry_has_perm() is not rcu-safe, so if LOOKUP_RCU
is set in selinux_inode_follow_link(), give up with
-ECHILD.

It is possible that dentry_has_perm could sometimes complete
in RCU more, in which case the flag could be propagated further
down the stack...

Signed-off-by: NeilBrown 
---
 security/selinux/hooks.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index e3074e01f058..5d4de8cbfaa6 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -2866,6 +2866,8 @@ static int selinux_inode_follow_link(struct dentry 
*dentry, int flags)
 {
const struct cred *cred = current_cred();
 
+   if (flags & LOOKUP_RCU)
+   return -ECHILD;
return dentry_has_perm(cred, dentry, FILE__READ);
 }
 


--
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 13/13] NFS: support LOOKUP_RCU in nfs_follow_link.

2015-03-15 Thread NeilBrown
If the inode is valid and the page has been read in,
then we can follow a link in RCU-walk.

Signed-off-by: NeilBrown 
---
 fs/nfs/inode.c |   22 ++
 fs/nfs/symlink.c   |   20 ++--
 include/linux/nfs_fs.h |1 +
 3 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 83107be3dd01..80f192405102 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -1123,6 +1123,28 @@ out:
return ret;
 }
 
+int nfs_revalidate_mapping_rcu(struct inode *inode)
+{
+   struct nfs_inode *nfsi = NFS_I(inode);
+   unsigned long *bitlock = >flags;
+   int ret = 0;
+
+   if (IS_SWAPFILE(inode))
+   goto out;
+   if (nfs_mapping_need_revalidate_inode(inode)) {
+   ret = -ECHILD;
+   goto out;
+   }
+   spin_lock(>i_lock);
+   if (test_bit(NFS_INO_INVALIDATING, bitlock) ||
+   (nfsi->cache_validity & NFS_INO_INVALID_DATA))
+   ret = -ECHILD;
+   spin_unlock(>i_lock);
+out:
+   return ret;
+}
+
+
 static unsigned long nfs_wcc_update_inode(struct inode *inode, struct 
nfs_fattr *fattr)
 {
struct nfs_inode *nfsi = NFS_I(inode);
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c
index 43e43d2c8c5b..849bef4b0ae1 100644
--- a/fs/nfs/symlink.c
+++ b/fs/nfs/symlink.c
@@ -49,8 +49,24 @@ static void *nfs_follow_link(struct dentry *dentry, int 
flags)
struct page *page;
void *err;
 
-   if (flags & LOOKUP_RCU)
-   return ERR_PTR(-ECHILD);
+   if (flags & LOOKUP_RCU) {
+   err = ERR_PTR(nfs_revalidate_mapping_rcu(inode));
+   if (err)
+   goto read_failed;
+   page = find_get_page(inode->i_mapping, 0);
+   if (page &&
+   (!PageUptodate(page) || PageHighMem(page))) {
+   put_page(page);
+   page = NULL;
+   }
+   if (!page) {
+   err = ERR_PTR(-ECHILD);
+   goto read_failed;
+   }
+   nd_set_link(page_address(page));
+   page = (void*)((unsigned long)page | 1);
+   return page;
+   }
err = ERR_PTR(nfs_revalidate_mapping(inode, inode->i_mapping));
if (err)
goto read_failed;
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 2f77e0c651c8..78c2f812eaeb 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -355,6 +355,7 @@ extern int nfs_revalidate_inode(struct nfs_server *server, 
struct inode *inode);
 extern int nfs_revalidate_inode_rcu(struct nfs_server *server, struct inode 
*inode);
 extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
 extern int nfs_revalidate_mapping(struct inode *inode, struct address_space 
*mapping);
+extern int nfs_revalidate_mapping_rcu(struct inode *inode);
 extern int nfs_setattr(struct dentry *, struct iattr *);
 extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
 extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,


--
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 12/13] XFS: allow follow_link to often succeed in RCU-walk.

2015-03-15 Thread NeilBrown
If LOOKUP_RCU is set, use GFP_ATOMIC rather than GFP_KERNEL,
and try to get the ilock without blocking.

When these succeed, follow_link() can succeed without dropping
out of RCU-walk.

Signed-off-by: NeilBrown 
---
 fs/xfs/xfs_ioctl.c   |2 +-
 fs/xfs/xfs_iops.c|   15 ++-
 fs/xfs/xfs_symlink.c |   11 +--
 fs/xfs/xfs_symlink.h |2 +-
 4 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
index ac4feae45eb3..29d95a1b76c0 100644
--- a/fs/xfs/xfs_ioctl.c
+++ b/fs/xfs/xfs_ioctl.c
@@ -303,7 +303,7 @@ xfs_readlink_by_handle(
goto out_dput;
}
 
-   error = xfs_readlink(XFS_I(dentry->d_inode), link);
+   error = xfs_readlink(XFS_I(dentry->d_inode), link, 0);
if (error)
goto out_kfree;
error = readlink_copy(hreq->ohandle, olen, link);
diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c
index 8fd416ae935a..72bc60f09415 100644
--- a/fs/xfs/xfs_iops.c
+++ b/fs/xfs/xfs_iops.c
@@ -415,15 +415,20 @@ xfs_vn_follow_link(
int flags)
 {
char*link;
-   int error = -ENOMEM;
+   int error;
 
-   if (flags & LOOKUP_RCU)
-   return ERR_PTR(-ECHILD);
-   link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
+   if (flags & LOOKUP_RCU) {
+   error = -ECHILD;
+   link = kmalloc(MAXPATHLEN+1, GFP_ATOMIC);
+   } else {
+   error = -ENOMEM;
+   link = kmalloc(MAXPATHLEN+1, GFP_KERNEL);
+   }
if (!link)
goto out_err;
 
-   error = xfs_readlink(XFS_I(dentry->d_inode), link);
+   error = xfs_readlink(XFS_I(dentry->d_inode), link,
+flags & LOOKUP_RCU);
if (unlikely(error))
goto out_kfree;
 
diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index 25791df6f638..87b5b2ba3d38 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -123,7 +123,8 @@ xfs_readlink_bmap(
 int
 xfs_readlink(
struct xfs_inode *ip,
-   char*link)
+   char*link,
+   int rcu)
 {
struct xfs_mount *mp = ip->i_mount;
xfs_fsize_t pathlen;
@@ -134,7 +135,11 @@ xfs_readlink(
if (XFS_FORCED_SHUTDOWN(mp))
return -EIO;
 
-   xfs_ilock(ip, XFS_ILOCK_SHARED);
+   if (rcu) {
+   if (xfs_ilock_nowait(ip, XFS_ILOCK_SHARED) == 0)
+   return -ECHILD;
+   } else
+   xfs_ilock(ip, XFS_ILOCK_SHARED);
 
pathlen = ip->i_d.di_size;
if (!pathlen)
@@ -153,6 +158,8 @@ xfs_readlink(
if (ip->i_df.if_flags & XFS_IFINLINE) {
memcpy(link, ip->i_df.if_u1.if_data, pathlen);
link[pathlen] = '\0';
+   } else if (rcu) {
+   error = -ECHILD;
} else {
error = xfs_readlink_bmap(ip, link);
}
diff --git a/fs/xfs/xfs_symlink.h b/fs/xfs/xfs_symlink.h
index e75245d09116..a71d26643e20 100644
--- a/fs/xfs/xfs_symlink.h
+++ b/fs/xfs/xfs_symlink.h
@@ -21,7 +21,7 @@
 
 int xfs_symlink(struct xfs_inode *dp, struct xfs_name *link_name,
const char *target_path, umode_t mode, struct xfs_inode **ipp);
-int xfs_readlink(struct xfs_inode *ip, char *link);
+int xfs_readlink(struct xfs_inode *ip, char *link, int rcu);
 int xfs_inactive_symlink(struct xfs_inode *ip);
 
 #endif /* __XFS_SYMLINK_H */


--
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 11/13] xfs: use RCU to free 'struct xfs_mount'.

2015-03-15 Thread NeilBrown
In order for ->follow_link to be safe in RCU-walk, any
data structures accessed need to be freed after
an RCU grace period.

'struct xfs_mount' is not currently guaranteed to be delayed
sufficiently, so use kfree_rcu() to free it.

Signed-off-by: NeilBrown 
---
 fs/xfs/xfs_mount.h |2 ++
 fs/xfs/xfs_super.c |2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 0d8abd6364d9..6a1094e493e9 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -185,6 +185,8 @@ typedef struct xfs_mount {
 * to various other kinds of pain inflicted on the pNFS server.
 */
__uint32_t  m_generation;
+
+   struct rcu_head m_rcu;
 } xfs_mount_t;
 
 /*
diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
index 8fcc4ccc5c79..3827be14383c 100644
--- a/fs/xfs/xfs_super.c
+++ b/fs/xfs/xfs_super.c
@@ -1047,7 +1047,7 @@ xfs_fs_put_super(
xfs_destroy_mount_workqueues(mp);
xfs_close_devices(mp);
xfs_free_fsname(mp);
-   kfree(mp);
+   kfree_rcu(mp, m_rcu);
 }
 
 STATIC int


--
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 08/13] VFS/namei: enhance follow_link to support RCU-walk.

2015-03-15 Thread NeilBrown
If LOOKUP_RCU is set, follow_link will not take/drop reference counts.

Replace cond_resched() with _cond_resched() as the latter
is a no-op if rcu_read_lock() is held while the former will
give a warning in that case.

Signed-off-by: NeilBrown 
---
 fs/namei.c |   19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 1663d21a3eb4..536e0254f5f1 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -906,7 +906,8 @@ follow_link(struct path *link, struct nameidata *nd, void 
**p)
if (unlikely(current->nameidata->total_link_count >= 40))
goto out_put_nd_path;
 
-   cond_resched();
+   /* If rcu_read_locked(), this will not resched, and will not warn */
+   _cond_resched();
current->nameidata->total_link_count++;
 
if (nd->flags & LOOKUP_RCU) {
@@ -936,11 +937,17 @@ follow_link(struct path *link, struct nameidata *nd, void 
**p)
return PTR_ERR(s);
}
if (*s == '/') {
-   if (!nd->root.mnt)
-   set_root(nd);
-   path_put(>path);
-   nd->path = nd->root;
-   path_get(>root);
+   if (nd->flags & LOOKUP_RCU) {
+   if (!nd->root.mnt)
+   set_root_rcu(nd);
+   nd->path = nd->root;
+   } else {
+   if (!nd->root.mnt)
+   set_root(nd);
+   path_put(>path);
+   nd->path = nd->root;
+   path_get(>root);
+   }
nd->flags |= LOOKUP_JUMPED;
}
nd->inode = nd->path.dentry->d_inode;


--
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 03/13] VFS: remove nameidata args from ->follow_link and ->put_link

2015-03-15 Thread NeilBrown
Now that current->nameidata is available, nd_set_link() and
nd_get_link() can use that directly, so 'nd' doesn't need to
be passed through ->follow_link and  ->put_link.

->follow_link gains a 'flags' argument instead which will
be useful for adding RCU-walk support.
For now, any filesystem which cannot trivially handle RCU-walk
support simply returns -ECHILD if LOOKUP_RCU is set in 'flags'.

security_inode_follow_link() all gets 'flags' in place of 'nd',
as does the inode_follow_link() security_op.

As a result of this change, 'nameidata' is almost entirely
local to namei.c.  It is only exposed externally as an opaque struct
pointed to by current->nameidata.

Note: Documentation/filesystemd/automount-support.txt mentions
 nameidata in ways that have been wrong for a while and are still
 wrong.

Signed-off-by: NeilBrown 
---
 Documentation/filesystems/Locking   |4 +--
 Documentation/filesystems/automount-support.txt |3 ++
 Documentation/filesystems/porting   |5 +++
 Documentation/filesystems/vfs.txt   |4 +--
 drivers/staging/lustre/lustre/llite/symlink.c   |8 +++--
 fs/9p/v9fs.h|3 +-
 fs/9p/vfs_inode.c   |   13 
 fs/9p/vfs_inode_dotl.c  |8 +++--
 fs/autofs4/symlink.c|4 +--
 fs/befs/linuxvfs.c  |   14 -
 fs/ceph/inode.c |4 +--
 fs/cifs/cifsfs.h|2 +
 fs/cifs/link.c  |6 ++--
 fs/configfs/symlink.c   |   11 +++
 fs/debugfs/file.c   |4 +--
 fs/ecryptfs/inode.c |8 ++---
 fs/exofs/symlink.c  |4 +--
 fs/ext2/symlink.c   |4 +--
 fs/ext3/symlink.c   |4 +--
 fs/ext4/symlink.c   |4 +--
 fs/freevxfs/vxfs_immed.c|8 +++--
 fs/fuse/dir.c   |   10 +++---
 fs/gfs2/inode.c |   10 +++---
 fs/hostfs/hostfs_kern.c |   10 +++---
 fs/hppfs/hppfs.c|9 +++---
 fs/jffs2/symlink.c  |6 ++--
 fs/jfs/symlink.c|4 +--
 fs/kernfs/symlink.c |   11 +++
 fs/libfs.c  |5 +--
 fs/namei.c  |   36 +--
 fs/nfs/symlink.c|8 +++--
 fs/ntfs/namei.c |1 -
 fs/overlayfs/inode.c|   12 
 fs/proc/base.c  |6 ++--
 fs/proc/inode.c |6 ++--
 fs/proc/namespaces.c|6 ++--
 fs/proc/self.c  |6 ++--
 fs/proc/thread_self.c   |6 ++--
 fs/sysv/symlink.c   |4 +--
 fs/ubifs/file.c |4 +--
 fs/ufs/symlink.c|4 +--
 fs/xfs/xfs_iops.c   |8 +++--
 include/linux/fs.h  |   12 +++-
 include/linux/namei.h   |7 ++--
 include/linux/sched.h   |1 +
 include/linux/security.h|9 +++---
 mm/shmem.c  |   14 -
 security/capability.c   |2 +
 security/security.c |4 +--
 security/selinux/hooks.c|2 +
 50 files changed, 175 insertions(+), 173 deletions(-)

diff --git a/Documentation/filesystems/Locking 
b/Documentation/filesystems/Locking
index f91926f2f482..8a772d4bb51f 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -50,8 +50,8 @@ prototypes:
int (*rename2) (struct inode *, struct dentry *,
struct inode *, struct dentry *, unsigned int);
int (*readlink) (struct dentry *, char __user *,int);
-   void * (*follow_link) (struct dentry *, struct nameidata *);
-   void (*put_link) (struct dentry *, struct nameidata *, void *);
+   void * (*follow_link) (struct dentry *, int flags);
+   void (*put_link) (struct dentry *, void *);
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int, unsigned int);
int (*get_acl)(struct inode *, int);
diff --git a/Documentation/filesystems/automount-support.txt 
b/Documentation/filesystems/automount-support.txt
index 7cac200e2a85..b68370fcc8f8 100644
--- 

[PATCH 09/13] VFS/namei: enable RCU-walk when following symlinks.

2015-03-15 Thread NeilBrown
Now that follow_link handles LOOKUP_RCU, we do not need to
'unlazy_walk' when a symlink is found.

Signed-off-by: NeilBrown 
---
 fs/namei.c |   12 
 1 file changed, 12 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 536e0254f5f1..c9c58cd1af2a 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1631,12 +1631,6 @@ static inline int walk_component(struct nameidata *nd, 
struct path *path,
goto out_path_put;
 
if (should_follow_link(path->dentry, follow)) {
-   if (nd->flags & LOOKUP_RCU) {
-   if (unlikely(unlazy_walk(nd, path->dentry))) {
-   err = -ECHILD;
-   goto out_err;
-   }
-   }
BUG_ON(inode != path->dentry->d_inode);
return 1;
}
@@ -3093,12 +3087,6 @@ finish_lookup:
}
 
if (should_follow_link(path->dentry, !symlink_ok)) {
-   if (nd->flags & LOOKUP_RCU) {
-   if (unlikely(unlazy_walk(nd, path->dentry))) {
-   error = -ECHILD;
-   goto out;
-   }
-   }
BUG_ON(inode != path->dentry->d_inode);
return 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 07/13] VFS/namei: abort RCU-walk on symlink if atime needs updating.

2015-03-15 Thread NeilBrown
touch_atime is not RCU-safe, and so cannot be called on an
RCU walk.
However in situations where RCU-walk makes a difference,
the symlink will likely to accessed much more often than
it is useful to update the atime.

So split out the test of "Does the atime actually need to be updated"
into  atime_needs_update(), and only allow RCU-walk on a symlink if
that fails.

Signed-off-by: NeilBrown 
---
 fs/inode.c |   26 +++---
 fs/namei.c |7 ++-
 include/linux/fs.h |1 +
 3 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/fs/inode.c b/fs/inode.c
index f00b16f45507..a0da920e4650 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -1584,30 +1584,41 @@ static int update_time(struct inode *inode, struct 
timespec *time, int flags)
  * This function automatically handles read only file systems and media,
  * as well as the "noatime" flag and inode specific "noatime" markers.
  */
-void touch_atime(const struct path *path)
+int atime_needs_update(const struct path *path)
 {
struct vfsmount *mnt = path->mnt;
struct inode *inode = path->dentry->d_inode;
struct timespec now;
 
if (inode->i_flags & S_NOATIME)
-   return;
+   return 0;
if (IS_NOATIME(inode))
-   return;
+   return 0;
if ((inode->i_sb->s_flags & MS_NODIRATIME) && S_ISDIR(inode->i_mode))
-   return;
+   return 0;
 
if (mnt->mnt_flags & MNT_NOATIME)
-   return;
+   return 0;
if ((mnt->mnt_flags & MNT_NODIRATIME) && S_ISDIR(inode->i_mode))
-   return;
+   return 0;
 
now = current_fs_time(inode->i_sb);
 
if (!relatime_need_update(mnt, inode, now))
-   return;
+   return 0;
 
if (timespec_equal(>i_atime, ))
+   return 0;
+   return 1;
+}
+
+void touch_atime(const struct path *path)
+{
+   struct vfsmount *mnt = path->mnt;
+   struct inode *inode = path->dentry->d_inode;
+   struct timespec now;
+
+   if (!atime_needs_update(path))
return;
 
if (!sb_start_write_trylock(inode->i_sb))
@@ -1624,6 +1635,7 @@ void touch_atime(const struct path *path)
 * We may also fail on filesystems that have the ability to make parts
 * of the fs read only, e.g. subvolumes in Btrfs.
 */
+   now = current_fs_time(inode->i_sb);
update_time(inode, , S_ATIME);
__mnt_drop_write(mnt);
 skip_update:
diff --git a/fs/namei.c b/fs/namei.c
index e0f889192f59..1663d21a3eb4 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -909,7 +909,12 @@ follow_link(struct path *link, struct nameidata *nd, void 
**p)
cond_resched();
current->nameidata->total_link_count++;
 
-   touch_atime(link);
+   if (nd->flags & LOOKUP_RCU) {
+   error = -ECHILD;
+   if (atime_needs_update(link))
+   goto out_put_nd_path;
+   } else
+   touch_atime(link);
nd_set_link(NULL);
 
error = security_inode_follow_link(link->dentry, nd->flags);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b7d578d552bf..41e6d99031dd 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1844,6 +1844,7 @@ enum file_time_flags {
S_VERSION = 8,
 };
 
+extern int atime_needs_update(const struct path *);
 extern void touch_atime(const struct path *);
 static inline void file_accessed(struct file *file)
 {


--
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 06/13] VFS/namei: new flag to support RCU symlinks: LOOKUP_LINK_RCU.

2015-03-15 Thread NeilBrown
When we support ->follow_link in RCU-walk we will not want to
take a reference to the 'struct path *link' passed to follow_link,
and correspondingly will not want to drop that reference.

As link_path_walk will complete_walk() in the case of an error,
and as complete_walk() will clear LOOKUP_RCU, we cannot test
LOOKUP_RCU to determine if the path should be 'put'.

So introduce a new flag: LOOKUP_LINK_RCU.  This is set on
entry to follow_link() if appropriate and put_link() will
only call path_put() if it is clear.

Also, unlazy_walk() will fail if LOOKUP_LINK_RCU is set.
This is because there is no way for unlazy_walk to get references
on all the "struct path *link"s that are protected by that flag.

Signed-off-by: NeilBrown 
---
 fs/namei.c|   18 +-
 include/linux/namei.h |1 +
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 8cb89a0d30ba..e0f889192f59 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -550,6 +550,9 @@ static int unlazy_walk(struct nameidata *nd, struct dentry 
*dentry)
struct dentry *parent = nd->path.dentry;
 
BUG_ON(!(nd->flags & LOOKUP_RCU));
+   if (nd->flags & LOOKUP_LINK_RCU)
+   /* Cannot unlazy in the middle of following a symlink */
+   return -ECHILD;
 
/*
 * After legitimizing the bastards, terminate_walk()
@@ -766,7 +769,8 @@ static inline void put_link(struct nameidata *nd, struct 
path *link, void *cooki
struct inode *inode = link->dentry->d_inode;
if (inode->i_op->put_link)
inode->i_op->put_link(link->dentry, cookie);
-   path_put(link);
+   if (!(nd->flags & LOOKUP_LINK_RCU))
+   path_put(link);
 }
 
 int sysctl_protected_symlinks __read_mostly = 0;
@@ -892,9 +896,10 @@ follow_link(struct path *link, struct nameidata *nd, void 
**p)
int error;
char *s;
 
-   BUG_ON(nd->flags & LOOKUP_RCU);
-
-   if (link->mnt == nd->path.mnt)
+   nd->flags &= ~LOOKUP_LINK_RCU;
+   if (nd->flags & LOOKUP_RCU)
+   nd->flags |= LOOKUP_LINK_RCU;
+   else if (link->mnt == nd->path.mnt)
mntget(link->mnt);
 
error = -ELOOP;
@@ -944,7 +949,8 @@ follow_link(struct path *link, struct nameidata *nd, void 
**p)
 out_put_nd_path:
*p = NULL;
terminate_walk(nd);
-   path_put(link);
+   if (!(nd->flags & LOOKUP_LINK_RCU))
+   path_put(link);
return error;
 }
 
@@ -1667,6 +1673,8 @@ static inline int nested_symlink(struct path *path, 
struct nameidata *nd)
 
current->nameidata->link_count--;
nd->depth--;
+   if (!nd->depth)
+   nd->flags &= ~LOOKUP_LINK_RCU;
return res;
 }
 
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 368eb3d721b8..05b6b9c18801 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -31,6 +31,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
 #define LOOKUP_PARENT  0x0010
 #define LOOKUP_REVAL   0x0020
 #define LOOKUP_RCU 0x0040
+#define LOOKUP_LINK_RCU0x0080
 
 /*
  * Intent 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/


[PATCH 10/13] VFS/namei: handle LOOKUP_RCU in page_follow_link_light.

2015-03-15 Thread NeilBrown
If the symlink has already be been read-in, then
page_follow_link_light can succeed in RCU-walk mode.
page_getlink_rcu() is added to support this.

With this many filesystems can follow links in RCU-walk
mode when everything is cached.  This  includes ext?fs and
others.

If the page is a HighMem page we do *not* try to kmap_atomic,
but simply give up - only page_address() is used.
This is because we need to be able to sleep while holding
the address of the page, particularly over calls to do_last()
which can be quite slow and in particular takes a mutex.

If this were a problem, then copying into a GFP_ATOMIC allocation
might be a workable solution.

This selective calling of kmap requires us to know, in page_put_link,
whether or not kunmap() need to be called.  Pass this information in
the lsb of the cookie.

Signed-off-by: NeilBrown 
---
 fs/namei.c |   35 ++-
 1 file changed, 30 insertions(+), 5 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index c9c58cd1af2a..2602d31ecc99 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -4499,6 +4499,28 @@ static char *page_getlink(struct dentry * dentry, struct 
page **ppage)
return kaddr;
 }
 
+/* get the link contents from pagecache under RCU */
+static char *page_getlink_rcu(struct dentry * dentry, struct page **ppage)
+{
+   char *kaddr;
+   struct page *page;
+   struct address_space *mapping = dentry->d_inode->i_mapping;
+   page = find_get_page(mapping, 0);
+   if (page &&
+   (!PageUptodate(page) || PageHighMem(page))) {
+   put_page(page);
+   page = NULL;
+   }
+   if (!page) {
+   *ppage = ERR_PTR(-ECHILD);
+   return NULL;
+   }
+   *ppage = page;
+   kaddr = page_address(page);
+   nd_terminate_link(kaddr, dentry->d_inode->i_size, PAGE_SIZE - 1);
+   return kaddr;
+}
+
 int page_readlink(struct dentry *dentry, char __user *buffer, int buflen)
 {
struct page *page = NULL;
@@ -4514,19 +4536,22 @@ EXPORT_SYMBOL(page_readlink);
 void *page_follow_link_light(struct dentry *dentry, int flags)
 {
struct page *page = NULL;
-   if (flags & LOOKUP_RCU)
-   return ERR_PTR(-ECHILD);
-   nd_set_link(page_getlink(dentry, ));
+   if (flags & LOOKUP_RCU) {
+   nd_set_link(page_getlink_rcu(dentry, ));
+   page = (void*)((unsigned long)page | 1);
+   } else
+   nd_set_link(page_getlink(dentry, ));
return page;
 }
 EXPORT_SYMBOL(page_follow_link_light);
 
 void page_put_link(struct dentry *dentry, void *cookie)
 {
-   struct page *page = cookie;
+   struct page *page = (void*)((unsigned long)cookie & ~1UL) ;
 
if (page) {
-   kunmap(page);
+   if (page == cookie)
+   kunmap(page);
page_cache_release(page);
}
 }


--
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 05/13] VFS/namei: use terminate_walk when symlink lookup fails.

2015-03-15 Thread NeilBrown
Currently following a symlink never uses rcu-walk, so
terminate_walk isn't needed.
That will change in a future patch.  In preparation, change
some
  path_put_condtional()
  path_put()
sequences to
  path_to_nameidata()
  terminate_walk()

These sequence are identical when in ref-walk, and correct when in
rcu-walk.

Also change two path_put() calls to equivalent terminate_walk().

Signed-off-by: NeilBrown 
---
 fs/namei.c |   40 
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/fs/namei.c b/fs/namei.c
index 9a5d429f2a8a..8cb89a0d30ba 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -749,6 +749,18 @@ char *nd_get_link(void)
 }
 EXPORT_SYMBOL(nd_get_link);
 
+static void terminate_walk(struct nameidata *nd)
+{
+   if (!(nd->flags & LOOKUP_RCU)) {
+   path_put(>path);
+   } else {
+   nd->flags &= ~LOOKUP_RCU;
+   if (!(nd->flags & LOOKUP_ROOT))
+   nd->root.mnt = NULL;
+   rcu_read_unlock();
+   }
+}
+
 static inline void put_link(struct nameidata *nd, struct path *link, void 
*cookie)
 {
struct inode *inode = link->dentry->d_inode;
@@ -799,8 +811,8 @@ static inline int may_follow_link(struct path *link, struct 
nameidata *nd)
return 0;
 
audit_log_link_denied("follow_link", link);
-   path_put_conditional(link, nd);
-   path_put(>path);
+   path_to_nameidata(link, nd);
+   terminate_walk(nd);
return -EACCES;
 }
 
@@ -909,7 +921,7 @@ follow_link(struct path *link, struct nameidata *nd, void 
**p)
s = nd_get_link();
if (s) {
if (unlikely(IS_ERR(s))) {
-   path_put(>path);
+   terminate_walk(nd);
put_link(nd, link, *p);
return PTR_ERR(s);
}
@@ -931,7 +943,7 @@ follow_link(struct path *link, struct nameidata *nd, void 
**p)
 
 out_put_nd_path:
*p = NULL;
-   path_put(>path);
+   terminate_walk(nd);
path_put(link);
return error;
 }
@@ -1562,18 +1574,6 @@ static inline int handle_dots(struct nameidata *nd, int 
type)
return 0;
 }
 
-static void terminate_walk(struct nameidata *nd)
-{
-   if (!(nd->flags & LOOKUP_RCU)) {
-   path_put(>path);
-   } else {
-   nd->flags &= ~LOOKUP_RCU;
-   if (!(nd->flags & LOOKUP_ROOT))
-   nd->root.mnt = NULL;
-   rcu_read_unlock();
-   }
-}
-
 /*
  * Do we need to follow links? We _really_ want to be able
  * to do this check without having to look at inode->i_op,
@@ -1645,8 +1645,8 @@ static inline int nested_symlink(struct path *path, 
struct nameidata *nd)
int res;
 
if (unlikely(current->nameidata->link_count >= MAX_NESTED_LINKS)) {
-   path_put_conditional(path, nd);
-   path_put(>path);
+   path_to_nameidata(path, nd);
+   terminate_walk(nd);
return -ELOOP;
}
BUG_ON(nd->depth >= MAX_NESTED_LINKS);
@@ -3267,8 +3267,8 @@ static struct file *path_openat(int dfd, struct filename 
*pathname,
struct path link = path;
void *cookie;
if (!(nd->flags & LOOKUP_FOLLOW)) {
-   path_put_conditional(, nd);
-   path_put(>path);
+   path_to_nameidata(, nd);
+   terminate_walk(nd);
error = -ELOOP;
break;
}


--
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 02/13] VFS: make all ->follow_link handlers aware for LOOKUP_RCU

2015-03-15 Thread NeilBrown
In preparation for supporting ->follow_link in RCU-walk,
make sure all ->follow_link handers which are not atomic
will fail if LOOKUP_RCU is set.

Later patches will make some of these handle LOOKUP_RCU
more gracefully.

This is current achieved by introducing a new function
"nd_is_rcu" to check if a nameidata has LOOKUP_RCU set.
There must be a better way.

Signed-off-by: NeilBrown 
---
 drivers/staging/lustre/lustre/llite/symlink.c |3 +++
 fs/9p/vfs_inode.c |6 +-
 fs/9p/vfs_inode_dotl.c|5 -
 fs/befs/linuxvfs.c|2 ++
 fs/cifs/link.c|2 ++
 fs/configfs/symlink.c |7 ++-
 fs/ecryptfs/inode.c   |7 ++-
 fs/fuse/dir.c |2 ++
 fs/gfs2/inode.c   |2 ++
 fs/hostfs/hostfs_kern.c   |7 ++-
 fs/kernfs/symlink.c   |7 ++-
 fs/namei.c|8 
 fs/nfs/symlink.c  |2 ++
 fs/overlayfs/inode.c  |3 +++
 fs/proc/base.c|2 ++
 fs/proc/namespaces.c  |3 +++
 fs/proc/self.c|7 ++-
 fs/proc/thread_self.c |   10 --
 fs/xfs/xfs_iops.c |2 ++
 include/linux/fs.h|1 +
 mm/shmem.c|6 +-
 21 files changed, 84 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/symlink.c 
b/drivers/staging/lustre/lustre/llite/symlink.c
index d7a1c6c48846..e8a8d25fcabf 100644
--- a/drivers/staging/lustre/lustre/llite/symlink.c
+++ b/drivers/staging/lustre/lustre/llite/symlink.c
@@ -125,6 +125,9 @@ static void *ll_follow_link(struct dentry *dentry, struct 
nameidata *nd)
int rc;
char *symname = NULL;
 
+   if (nd_is_rcu(nd))
+   return ERR_PTR(-ECHILD);
+
CDEBUG(D_VFSTRACE, "VFS Op\n");
ll_inode_size_lock(inode);
rc = ll_readlink_internal(inode, , );
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 3662f1d1d9cf..8aff5d684154 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -1281,7 +1281,11 @@ done:
 static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
int len = 0;
-   char *link = __getname();
+   char *link;
+
+   if (nd_is_rcu(nd))
+   return ERR_PTR(-ECHILD);
+   link = __getname();
 
p9_debug(P9_DEBUG_VFS, "%pd\n", dentry);
 
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 6054c16b8fae..51776a3cc842 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -914,9 +914,12 @@ v9fs_vfs_follow_link_dotl(struct dentry *dentry, struct 
nameidata *nd)
 {
int retval;
struct p9_fid *fid;
-   char *link = __getname();
+   char *link;
char *target;
 
+   if (nd_is_rcu(nd))
+   return ERR_PTR(-ECHILD);
+   link = __getname();
p9_debug(P9_DEBUG_VFS, "%pd\n", dentry);
 
if (!link) {
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index e089f1985fca..bbe8f90924b2 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -477,6 +477,8 @@ befs_follow_link(struct dentry *dentry, struct nameidata 
*nd)
befs_off_t len = data->size;
char *link;
 
+   if (nd_is_rcu(nd))
+   return ERR_PTR(-ECHILD);
if (len == 0) {
befs_error(sb, "Long symlink with illegal length");
link = ERR_PTR(-EIO);
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 2ec6037f61c7..0dbe1a326632 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -639,6 +639,8 @@ cifs_follow_link(struct dentry *direntry, struct nameidata 
*nd)
struct cifs_tcon *tcon;
struct TCP_Server_Info *server;
 
+   if (nd_is_rcu(nd))
+   return ERR_PTR(-ECHILD);
xid = get_xid();
 
tlink = cifs_sb_tlink(cifs_sb);
diff --git a/fs/configfs/symlink.c b/fs/configfs/symlink.c
index cc9f2546ea4a..1397342aad5b 100644
--- a/fs/configfs/symlink.c
+++ b/fs/configfs/symlink.c
@@ -282,7 +282,12 @@ static int configfs_getlink(struct dentry *dentry, char * 
path)
 static void *configfs_follow_link(struct dentry *dentry, struct nameidata *nd)
 {
int error = -ENOMEM;
-   unsigned long page = get_zeroed_page(GFP_KERNEL);
+   unsigned long page;
+
+   if (nd_is_rcu(nd))
+   return ERR_PTR(-ECHILD);
+
+   page = get_zeroed_page(GFP_KERNEL);
 
if (page) {
error = configfs_getlink(dentry, (char *)page);
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index b08b5187f662..49d3dd96344c 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c

[PATCH 01/13] VFS: replace {, total_}link_count in task_struct with pointer to nameidata

2015-03-15 Thread NeilBrown
task_struct currently contains two ad-hoc members for use by
the VFS: link_count and total_link_count.
These are only interesting to fs/namei.c, so exposing them
explicitly is poor laying - and has resulted in some questionable
code in staging/lustre.

This patches replaces those with a single pointer to 'struct
nameidata'.
This structure represents the current filename lookup of which
there can only be one per process, and is a natural place to
store link_count and total_link_count.

This will allow the current "nameidata" argument to all
follow_link operations to be removed as current->nameidata
can be used instead.

As there are occasional circumstances where pathname lookup can
recurse, such as through kern_path_locked, we always save and old
current->nameidata (if there is one) when setting a new value, and
make sure any active link_counts are preserved.

Suggested-by: Al Viro 
Signed-off-by: NeilBrown 
---
 drivers/staging/lustre/lustre/llite/symlink.c |   16 ++---
 fs/namei.c|   47 +++--
 include/linux/sched.h |2 +
 3 files changed, 41 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/symlink.c 
b/drivers/staging/lustre/lustre/llite/symlink.c
index 686b6a574cc5..d7a1c6c48846 100644
--- a/drivers/staging/lustre/lustre/llite/symlink.c
+++ b/drivers/staging/lustre/lustre/llite/symlink.c
@@ -126,18 +126,10 @@ static void *ll_follow_link(struct dentry *dentry, struct 
nameidata *nd)
char *symname = NULL;
 
CDEBUG(D_VFSTRACE, "VFS Op\n");
-   /* Limit the recursive symlink depth to 5 instead of default
-* 8 links when kernel has 4k stack to prevent stack overflow.
-* For 8k stacks we need to limit it to 7 for local servers. */
-   if (THREAD_SIZE < 8192 && current->link_count >= 6) {
-   rc = -ELOOP;
-   } else if (THREAD_SIZE == 8192 && current->link_count >= 8) {
-   rc = -ELOOP;
-   } else {
-   ll_inode_size_lock(inode);
-   rc = ll_readlink_internal(inode, , );
-   ll_inode_size_unlock(inode);
-   }
+   ll_inode_size_lock(inode);
+   rc = ll_readlink_internal(inode, , );
+   ll_inode_size_unlock(inode);
+
if (rc) {
ptlrpc_req_finished(request);
request = NULL;
diff --git a/fs/namei.c b/fs/namei.c
index c83145af4bfc..184aaafffaa9 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -502,10 +502,27 @@ struct nameidata {
unsignedseq, m_seq;
int last_type;
unsigneddepth;
+   int link_count, total_link_count;
struct file *base;
char *saved_names[MAX_NESTED_LINKS + 1];
 };
 
+static struct nameidata *set_nameidata(struct nameidata *p)
+{
+   struct nameidata *old = current->nameidata;
+   current->nameidata = p;
+   if (p) {
+   if (!old) {
+   p->link_count = 0;
+   p->total_link_count = 0;
+   } else {
+   p->link_count = old->link_count;
+   p->total_link_count = old->total_link_count;
+   }
+   }
+   return old;
+}
+
 /*
  * Path walking has 2 modes, rcu-walk and ref-walk (see
  * Documentation/filesystems/path-lookup.txt).  In situations when we can't
@@ -863,11 +880,11 @@ follow_link(struct path *link, struct nameidata *nd, void 
**p)
mntget(link->mnt);
 
error = -ELOOP;
-   if (unlikely(current->total_link_count >= 40))
+   if (unlikely(current->nameidata->total_link_count >= 40))
goto out_put_nd_path;
 
cond_resched();
-   current->total_link_count++;
+   current->nameidata->total_link_count++;
 
touch_atime(link);
nd_set_link(nd, NULL);
@@ -991,8 +1008,8 @@ static int follow_automount(struct path *path, unsigned 
flags,
path->dentry->d_inode)
return -EISDIR;
 
-   current->total_link_count++;
-   if (current->total_link_count >= 40)
+   current->nameidata->total_link_count++;
+   if (current->nameidata->total_link_count >= 40)
return -ELOOP;
 
mnt = path->dentry->d_op->d_automount(path);
@@ -1621,7 +1638,7 @@ static inline int nested_symlink(struct path *path, 
struct nameidata *nd)
 {
int res;
 
-   if (unlikely(current->link_count >= MAX_NESTED_LINKS)) {
+   if (unlikely(current->nameidata->link_count >= MAX_NESTED_LINKS)) {
path_put_conditional(path, nd);
path_put(>path);
return -ELOOP;
@@ -1629,7 +1646,7 @@ static inline int nested_symlink(struct path *path, 
struct nameidata *nd)
BUG_ON(nd->depth >= MAX_NESTED_LINKS);
 
nd->depth++;
-   current->link_count++;
+   current->nameidata->link_count++;
 
do {
struct path link = *path;
@@ -1642,7 +1659,7 @@ static 

[PATCH 00/13] Support follow_link in RCU-walk. - V2

2015-03-15 Thread NeilBrown
Hi Al,
 I believe this series addresses all your concerns about
 my first attempt.
 The first patch results in nameidata being almost completely
 localized to namei.c :-)  It also highlights out-of-date
 documentation in automount-support.txt :-(

 It also exposes (and removes) some ... interesting code in lustre.
 I'm not sure how safe it is to remove that I didn't think
 recursive symlinks used extra stack.

 I haven't tested extensively yet but will do that before a "final"
 submission.

 If you could confirm that I'm moving in the right direction, I would
 appreciate it.

Thanks,
NeilBrown


---

NeilBrown (13):
  VFS: replace {,total_}link_count in task_struct with pointer to nameidata
  VFS: make all ->follow_link handlers aware for LOOKUP_RCU
  VFS: remove nameidata args from ->follow_link and ->put_link
  security/selinux: check for LOOKUP_RCU in _follow_link.
  VFS/namei: use terminate_walk when symlink lookup fails.
  VFS/namei: new flag to support RCU symlinks: LOOKUP_LINK_RCU.
  VFS/namei: abort RCU-walk on symlink if atime needs updating.
  VFS/namei: enhance follow_link to support RCU-walk.
  VFS/namei: enable RCU-walk when following symlinks.
  VFS/namei: handle LOOKUP_RCU in page_follow_link_light.
  xfs: use RCU to free 'struct xfs_mount'.
  XFS: allow follow_link to often succeed in RCU-walk.
  NFS: support LOOKUP_RCU in nfs_follow_link.


 Documentation/filesystems/Locking   |4 
 Documentation/filesystems/automount-support.txt |3 
 Documentation/filesystems/porting   |5 +
 Documentation/filesystems/vfs.txt   |4 
 drivers/staging/lustre/lustre/llite/symlink.c   |   25 +--
 fs/9p/v9fs.h|3 
 fs/9p/vfs_inode.c   |   17 +-
 fs/9p/vfs_inode_dotl.c  |   11 +
 fs/autofs4/symlink.c|4 
 fs/befs/linuxvfs.c  |   14 +-
 fs/ceph/inode.c |4 
 fs/cifs/cifsfs.h|2 
 fs/cifs/link.c  |6 -
 fs/configfs/symlink.c   |   16 +-
 fs/debugfs/file.c   |4 
 fs/ecryptfs/inode.c |   13 +
 fs/exofs/symlink.c  |4 
 fs/ext2/symlink.c   |4 
 fs/ext3/symlink.c   |4 
 fs/ext4/symlink.c   |4 
 fs/freevxfs/vxfs_immed.c|8 -
 fs/fuse/dir.c   |   10 +
 fs/gfs2/inode.c |   10 +
 fs/hostfs/hostfs_kern.c |   15 +-
 fs/hppfs/hppfs.c|9 -
 fs/inode.c  |   26 ++-
 fs/jffs2/symlink.c  |6 -
 fs/jfs/symlink.c|4 
 fs/kernfs/symlink.c |   16 +-
 fs/libfs.c  |5 -
 fs/namei.c  |  214 +++
 fs/nfs/inode.c  |   22 ++
 fs/nfs/symlink.c|   24 ++-
 fs/ntfs/namei.c |1 
 fs/overlayfs/inode.c|   13 +
 fs/proc/base.c  |6 -
 fs/proc/inode.c |6 -
 fs/proc/namespaces.c|7 +
 fs/proc/self.c  |   11 +
 fs/proc/thread_self.c   |   14 +-
 fs/sysv/symlink.c   |4 
 fs/ubifs/file.c |4 
 fs/ufs/symlink.c|4 
 fs/xfs/xfs_ioctl.c  |2 
 fs/xfs/xfs_iops.c   |   19 +-
 fs/xfs/xfs_mount.h  |2 
 fs/xfs/xfs_super.c  |2 
 fs/xfs/xfs_symlink.c|   11 +
 fs/xfs/xfs_symlink.h|2 
 include/linux/fs.h  |   12 +
 include/linux/namei.h   |8 -
 include/linux/nfs_fs.h  |1 
 include/linux/sched.h   |3 
 include/linux/security.h|9 -
 mm/shmem.c  |   18 +-
 security/capability.c   |2 
 security/security.c |4 
 security/selinux/hooks.c|4 
 58 files changed, 442 insertions(+), 247 deletions(-)

--
Signature

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to 

Re: [PATCH] ath9k_htc: check seq number instead of cmd id for timeout

2015-03-15 Thread Fred Chou

On 15/03/2015 14:48, Oleksij Rempel wrote:
> thank you for your patch. Looks good for me. Did you tested it?

Yes. Working all right for two days.
--
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] x86, kaslr: Access the correct kaslr_enabled variable

2015-03-15 Thread Yinghai Lu
On Sun, Mar 15, 2015 at 8:28 PM, Baoquan He  wrote:
> On 03/15/15 at 12:49am, Yinghai Lu wrote:
> It's good to check the ret value as Boris suggested. However it could
> fail since early_memremap self fail, e.g slot not found. In this case
> making kaslr_enabled true may not be good.
>
> As Minfei talked with you kaslr_setup_data is a global variable inside
> kernel code, it has been ident mapped. Just derefencing the physical
> address which is virtual address too and getting the real stored value
> may be safer. And also parse_kaslr_setup is a function specified to
> handle kaslr, it doesn't make me uncomfortable to implement with a
> specific knowledge which here means the setup_data is a global varialbe
> in kernel code and no need to do early_memremap since mapping has been
> built .

I should not put that checking in. even parse_setup_data does not check
early_memmap return.

Thanks

Yinghai
--
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/


Guten Tag!

2015-03-15 Thread Dr. Henry Cheng Kar-shun
Liebe Freunde,

Guten Tag, ich bin Dr. Henry Cheng Kar-meiden ein Direktor der Non unabhängige 
Non-Vorstand Hang Seng Bank Limited, Hongkong. Ich habe Fonds im Wert von $ 
17,500.000.00 heimlich zu sichern (Transfer)
auf Ihr Konto in Ihrem Land aus unserer Schwesterbank zu unserem Nutzen.

Bitte, wenn Sie interessiert sind, mir zu helfen, zu tun und schreiben Sie mir 
für weitere Details. Hier ist meine E-Mail: henrycheng...@gmail.com

Grüße,
Dr. Henry Cheng Kar-Shun
--
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/


linux-next: manual merge of the irqchip tree with the tegra tree

2015-03-15 Thread Stephen Rothwell
Hi Jason,

Today's linux-next merge of the irqchip tree got a conflict in
arch/arm/mach-tegra/irq.c between commit 0a63e1e0617f ("ARM: tegra: Fix
big-endian issue with IRQ code") from the tegra tree and commit
1a703bffd82e ("ARM: tegra: remove old LIC support") from the irqchip
tree.

I fixed it up (the latter removed the code changed by the former) and
can carry the fix as necessary (no action is required).



-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/


pgpSXpcJfvQza.pgp
Description: OpenPGP digital signature


linux-next: manual merge of the irqchip tree with Linus' tree

2015-03-15 Thread Stephen Rothwell
Hi Jason,

Today's linux-next merge of the irqchip tree got a conflict in
arch/arm/mach-exynos/suspend.c between commit ace283a04a4a ("ARM:
EXYNOS: Fix wrong hwirq of RTC interrupt for Exynos3250 SoC") from
Linus' tree and commit be42c9ea7b5f ("ARM: exynos4/5: convert pmu
wakeup to stacked domains") from the irqchip tree.

I fixed it up (I just randomly chose to use the irqchip tree version)
and can carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpnDbwwii1xp.pgp
Description: OpenPGP digital signature


Re: Question on mutex code

2015-03-15 Thread Matthias Bonne

On 03/16/15 00:10, Rabin Vincent wrote:

On Sun, Mar 15, 2015 at 11:49:07PM +0200, Matthias Bonne wrote:

So the counter is set to 1 before taking the spinlock, which I think
might cause the race. Did I miss something?


Yes, you miss the fact that __mutex_slowpath_needs_to_unlock() is 0 for
the CONFIG_DEBUG_MUTEXES case:

  #ifdef CONFIG_DEBUG_MUTEXES
  # include "mutex-debug.h"
  # include 
  /*
   * Must be 0 for the debug case so we do not do the unlock outside of the
   * wait_lock region. debug_mutex_unlock() will do the actual unlock in this
   * case.
   */
  # undef __mutex_slowpath_needs_to_unlock
  # define  __mutex_slowpath_needs_to_unlock()  0



Right, I overlooked this part. Thanks to both of you for the
clarifications.
--
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] x86, kaslr: Access the correct kaslr_enabled variable

2015-03-15 Thread Baoquan He
On 03/15/15 at 12:49am, Yinghai Lu wrote:

> Index: linux-2.6/arch/x86/kernel/setup.c
> ===
> --- linux-2.6.orig/arch/x86/kernel/setup.c
> +++ linux-2.6/arch/x86/kernel/setup.c
> @@ -429,7 +429,18 @@ static void __init reserve_initrd(void)
>  
>  static void __init parse_kaslr_setup(u64 pa_data, u32 data_len)
>  {
> - kaslr_enabled = (bool)(pa_data + sizeof(struct setup_data));
> + /* kaslr_setup_data is defined in aslr.c */
> + unsigned char *data;
> + unsigned long offset = sizeof(struct setup_data);
> +
> + data = early_memremap(pa_data, offset + 1);
> + if (!data) {

It's good to check the ret value as Boris suggested. However it could
fail since early_memremap self fail, e.g slot not found. In this case
making kaslr_enabled true may not be good.

As Minfei talked with you kaslr_setup_data is a global variable inside
kernel code, it has been ident mapped. Just derefencing the physical
address which is virtual address too and getting the real stored value
may be safer. And also parse_kaslr_setup is a function specified to
handle kaslr, it doesn't make me uncomfortable to implement with a
specific knowledge which here means the setup_data is a global varialbe
in kernel code and no need to do early_memremap since mapping has been
built .

Thanks
Baoquan

> + kaslr_enabled = true;
> + return;
> + }
> +
> + kaslr_enabled = *(data + offset);
> + early_memunmap(data, offset + 1);
>  }
>  
>  static void __init parse_setup_data(void)
--
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 PATCH] sys_membarrier(): system/process-wide memory barrier (x86) (v12)

2015-03-15 Thread Josh Triplett
On Sun, Mar 15, 2015 at 03:24:19PM -0400, Mathieu Desnoyers wrote:
> Here is an implementation of a new system call, sys_membarrier(), which
> executes a memory barrier on either all running threads of the current
> process (MEMBARRIER_PRIVATE_FLAG) or calls synchronize_sched() to issue
> a memory barrier on all threads running on the system. It can be used to
> distribute the cost of user-space memory barriers asymmetrically by
> transforming pairs of memory barriers into pairs consisting of
> sys_membarrier() and a compiler barrier. For synchronization primitives
> that distinguish between read-side and write-side (e.g. userspace RCU,
> rwlocks), the read-side can be accelerated significantly by moving the
> bulk of the memory barrier overhead to the write-side.

>From a quick review, this seems quite reasonable (as it did 5 years
ago).

One request: Could you please add a config option (default y) in the
EXPERT menu to disable this?  You actually seem to already have it
marked as a cond_syscall.

Also, a very minor nit: flags in kernel APIs aren't typically named with
a _FLAG suffix.

With the syscall made optional, and with or without that naming nit
fixed:
Reviewed-by: Josh Triplett 

- Josh Triplett
--
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 v0 PATCH] kvm: powerpc: Allow reuse of vCPU object

2015-03-15 Thread Bharata B Rao
Any feedback on the below patch ?

On Mon, Mar 9, 2015 at 11:00 AM,   wrote:
> From: Bharata B Rao 
>
> Since KVM isn't equipped to handle closure of vcpu fd from userspace(QEMU)
> correctly, certain work arounds have to be employed to allow reuse of
> vcpu array slot in KVM during cpu hot plug/unplug from guest. One such
> proposed workaround is to park the vcpu fd in userspace during cpu unplug
> and reuse it later during next hotplug.
>
> More details can be found here:
> KVM: https://www.mail-archive.com/kvm@vger.kernel.org/msg102839.html
> QEMU: http://lists.gnu.org/archive/html/qemu-devel/2014-12/msg00859.html
>
> In order to support this workaround with PowerPC KVM, don't create or
> initialize ICP if the vCPU is found to be already associated with an ICP.
>
> Signed-off-by: Bharata B Rao 
> ---
> Note: It is not sure at the moment if "park vcpu and reuse" approach will
> be acceptable to KVM/QEMU community, but nevertheless I wanted to check
> if this little patch is harmful or not.
>
>  arch/powerpc/kvm/book3s_xics.c | 9 +++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
> index a4a8d9f..ead3a35 100644
> --- a/arch/powerpc/kvm/book3s_xics.c
> +++ b/arch/powerpc/kvm/book3s_xics.c
> @@ -1313,8 +1313,13 @@ int kvmppc_xics_connect_vcpu(struct kvm_device *dev, 
> struct kvm_vcpu *vcpu,
> return -EPERM;
> if (xics->kvm != vcpu->kvm)
> return -EPERM;
> -   if (vcpu->arch.irq_type)
> -   return -EBUSY;
> +
> +   /*
> +* If irq_type is already set, don't reinialize but
> +* return success allowing this vcpu to be reused.
> +*/
> +   if (vcpu->arch.irq_type != KVMPPC_IRQ_DEFAULT)
> +   return 0;
>
> r = kvmppc_xics_create_icp(vcpu, xcpu);
> if (!r)
> --
> 2.1.0
>



-- 
http://raobharata.wordpress.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 4/9] selftests: Add install target

2015-03-15 Thread Michael Ellerman
On Mon, 2015-03-16 at 14:04 +1100, Michael Ellerman wrote:
> On Fri, 2015-03-13 at 15:32 -0600, Shuah Khan wrote:
> > On 03/13/2015 11:20 AM, Shuah Khan wrote:
> > > On 03/10/2015 10:06 PM, Michael Ellerman wrote:
> > >> This adds make install support to selftests. The basic usage is:
> > >>
> > >> $ cd tools/testing/selftests
> > >> $ make install
> > >>
> > >> That installs into tools/testing/selftests/install, which can then be
> > >> copied where ever necessary.
> > >>
> > >> The install destination is also configurable using eg:
> > >>
> > >> $ INSTALL_PATH=/mnt/selftests make install
> > >>
> > >> The implementation uses two targets in the child makefiles. The first
> > >> "install" is expected to install all files into $(INSTALL_PATH).
> > >>
> > >> The second, "emit_tests", is expected to emit the test instructions (ie.
> > >> bash script) on stdout. Separating this from install means the child
> > >> makefiles need no knowledge of the location of the test script.
> > >>
> > >> Signed-off-by: Michael Ellerman 
> > > 
> > > Thanks for doing the work. This patch will be applied to next and will
> > > be queued for 4.1
> > > 
> > 
> > ok. linux-kselftest next has both shared logic and install patches
> > now.
> 
> Thanks, looks good to me.

And also 6/9 "selftests: Set CC using CROSS_COMPILE once in lib.mk" would be
nice and is uncontroversial, I think:

https://lkml.org/lkml/2015/3/11/5

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 V8 04/10] USB: f81232: implement read IIR/MSR with endpoint

2015-03-15 Thread Peter Hung

Hello,

Johan Hovold 於 2015/3/14 下午 08:02 寫道:

On Thu, Feb 26, 2015 at 06:02:10PM +0800, Peter Hung wrote:

+   if (status != sizeof(*val)) {
+   dev_err(>dev, "%s failed status: %d\n", __func__, status);
+
+   if (status == 0)
+   status = -EIO;
+   else
+   status = usb_translate_errors(status);


Could you rewrite this as

if (status < 0)
status = usb_translate_errors(status);
else
status = 0;


In my definition the return value of set/getregister(), 0 is success, 
negative values are errors. The function usb_control_msg() return value 
is success transmited/received byte. It's maybe return 0. I want to 
treat 0 with error(-EIO). But if pass 0 to usb_translate_errors(), It 
will return 0 back. So I need especially handle with status == 0.


I'll keep this sections.

Thanks for review
--
With Best Regards,
Peter Hung
--
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] x86, kaslr: Access the correct kaslr_enabled variable

2015-03-15 Thread Minfei Huang
On 03/15/15 at 10:02am, Yinghai Lu wrote:
> On Sun, Mar 15, 2015 at 5:18 AM, Minfei Huang  wrote:
> > On 03/15/15 at 12:49am, Yinghai Lu wrote:
> > It confuses me with the virtual address in function parse_kaslr_setup.
> > When we are in here(parse_kaslr_setup), we already use the virtual
> > address, instead of physical address. Is it all right?
> 
> setup_data is using physical address to have linked list.
> 
> we have setup_arch==>parse_setup_data(), that is way before
> init_mem_mapping() to have final kernel mapping setup yet.
> 
> For 64bit, we may use virtual address with help of early mapping with
> #PF handler.
> But 32bit, we don't have that.
> 
> So just use early_memmap to get virtual address to access the value.
> 

Hi, Yinghai!

Thank you for your reply.
I find that the variate kaslr_setup_data is a global variate. Always we
can use physical address to access the value.

But it is more comfortable that we use the early_memmap to access the
value.

Thanks
Minfei

> >
> > In the other words, using physical address in parse_kaslr_setup is
> > always a mistake, whatever the kaslr is on or off.
> >
> 
> The problem is: old code just use physical address as value.
> 
> Thanks
> 
> Yinghai
--
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 4/9] selftests: Add install target

2015-03-15 Thread Michael Ellerman
On Fri, 2015-03-13 at 15:32 -0600, Shuah Khan wrote:
> On 03/13/2015 11:20 AM, Shuah Khan wrote:
> > On 03/10/2015 10:06 PM, Michael Ellerman wrote:
> >> This adds make install support to selftests. The basic usage is:
> >>
> >> $ cd tools/testing/selftests
> >> $ make install
> >>
> >> That installs into tools/testing/selftests/install, which can then be
> >> copied where ever necessary.
> >>
> >> The install destination is also configurable using eg:
> >>
> >> $ INSTALL_PATH=/mnt/selftests make install
> >>
> >> The implementation uses two targets in the child makefiles. The first
> >> "install" is expected to install all files into $(INSTALL_PATH).
> >>
> >> The second, "emit_tests", is expected to emit the test instructions (ie.
> >> bash script) on stdout. Separating this from install means the child
> >> makefiles need no knowledge of the location of the test script.
> >>
> >> Signed-off-by: Michael Ellerman 
> > 
> > Thanks for doing the work. This patch will be applied to next and will
> > be queued for 4.1
> > 
> 
> ok. linux-kselftest next has both shared logic and install patches
> now.

Thanks, looks good to me.

Can you also apply the patch to install the powerpc tests, or was there a
problem with it? It seems to apply cleanly for me.

https://lkml.org/lkml/2015/3/11/9

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/


[PATCH] USB: ftdi_sio: Added custom PID for Synapse Wireless product

2015-03-15 Thread Doug Goldstein
Synapse Wireless uses the FTDI VID with a custom PID of 0x9090 for their
SNAP Stick 200 product.

Signed-off-by: Doug Goldstein 
---
 drivers/usb/serial/ftdi_sio.c | 1 +
 drivers/usb/serial/ftdi_sio_ids.h | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
index 3086dec..247130b 100644
--- a/drivers/usb/serial/ftdi_sio.c
+++ b/drivers/usb/serial/ftdi_sio.c
@@ -997,6 +997,7 @@ static const struct usb_device_id id_table_combined[] = {
{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_DISPLAY_PID) },
{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_LITE_PID) },
{ USB_DEVICE(FTDI_VID, CHETCO_SEASMART_ANALOG_PID) },
+   { USB_DEVICE(FTDI_VID, FTDI_SYNAPSE_SS200_PID) },
{ } /* Terminating entry */
 };
 
diff --git a/drivers/usb/serial/ftdi_sio_ids.h 
b/drivers/usb/serial/ftdi_sio_ids.h
index 56b1b55..4e4f46f 100644
--- a/drivers/usb/serial/ftdi_sio_ids.h
+++ b/drivers/usb/serial/ftdi_sio_ids.h
@@ -561,6 +561,12 @@
  */
 #define FTDI_NT_ORIONLXM_PID   0x7c90  /* OrionLXm Substation Automation 
Platform */
 
+/*
+ * Synapse Wireless product ids (FTDI_VID)
+ * http://www.synapse-wireless.com
+ */
+#define FTDI_SYNAPSE_SS200_PID 0x9090 /* SS200 - SNAP Stick 200 */
+
 
 //
 /** third-party VID/PID combos **/
-- 
2.0.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.0 0/6] ARM: AT91: pm improvement for 4.1

2015-03-15 Thread Yang, Wenyou


> -Original Message-
> From: Ferre, Nicolas
> Sent: 2015年3月13日 18:06
> To: Yang, Wenyou; li...@arm.linux.org.uk
> Cc: linux-arm-ker...@lists.infradead.org; linux-kernel@vger.kernel.org;
> alexandre.bell...@free-electrons.com; sylvain.roc...@finsecur.com;
> p...@axentia.se; sergei.shtyl...@cogentembedded.com; li...@maxim.org.za
> Subject: Re: [PATCH v2.0 0/6] ARM: AT91: pm improvement for 4.1
> 
> Le 09/03/2015 04:47, Wenyou Yang a écrit :
> > Hi,
> >
> > The patch series purpose is to improve the AT91 pm code.
> > Create a procedure to handle the sdram self-fresh mode.
> > The standby mode uses same sram function as the suspend to memory
> > mode,
> >
> > It is based on the branch, at91-4.0-fixes
> > git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git
> > + [PATCH] ARM: AT91: pm cleanup for 4.1
> >
> > Chang log for v2.0
> >  - reserve the at91_xxx_standby() for at91_cpuidle_device.
> >  - rebase
> >
> > Wenyou Yang (6):
> >   pm: at91: pm_slowclock: create the procedure to handle the sdram
> > self-refresh
> >   pm: at91: move the copying the sram function to the sram
> > initializationi phase
> >   pm: at91: standby mode uses the same sram function as suspend to
> > memory mode
> >   pm: at91: rename file name: pm_slowclock.S -->pm_suspend.S
> >   pm: at91: rename function name:
> > at91_slow_clock()-->at91_pm_suspend_sram_fn
> >   pm: at91: remove unused void (*at91_pm_standby)(void)
> 
> Whole series:
> Acked-by: Nicolas Ferre 
> 
> And stacked on top of at91-4.1-cleanup
> 
> Thanks.
> 
> BTW, I had to rework the commit subject as all AT91 patches must begin
> with: "ARM: at91". So I reworked them as "ARM: at91/pm:"
Thank you so much, lesson learned.

> 
> Bye,
> 
> >  arch/arm/mach-at91/Makefile   |2 +-
> >  arch/arm/mach-at91/pm.c   |  121 +++--
> >  arch/arm/mach-at91/pm.h   |   10 ++
> >  arch/arm/mach-at91/pm_slowclock.S |  296 ---
> >  arch/arm/mach-at91/pm_suspend.S   |  349
> +
> >  5 files changed, 420 insertions(+), 358 deletions(-)  delete mode
> > 100644 arch/arm/mach-at91/pm_slowclock.S  create mode 100644
> > arch/arm/mach-at91/pm_suspend.S
> >
> 
> 
> --
> Nicolas Ferre


Best Regards,
Wenyou Yang


Re: [PATCH V8 02/10] USB: f81232: implement RX bulk-in EP

2015-03-15 Thread Peter Hung

Hello,

Johan Hovold 於 2015/3/14 下午 07:48 寫道:

On Thu, Feb 26, 2015 at 06:02:08PM +0800, Peter Hung wrote:

-   if (!urb->actual_length)
+   if ((urb->actual_length < 2) || (urb->actual_length % 2))
return;


Not parsing short data (e.g. not divisible by 2) is OK I guess. You
could also just discard the last odd byte, but that's up to you.

Either way, I think you should add a dev_warn here rather than just
silently drop it.


With F81232, when it first submit with interrupt URB, it will response 
once with 1 bytes data. The data is hw current LSR, but it useless on 
open. It's should necessary with receiving data. When the device is 
working good, it's should acked with even size data.


To avoid confusing to user, I'll keep it without warning message.

Thanks
--
With Best Regards,
Peter Hung
--
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: lustre: echo_client: Use kernel style spacing

2015-03-15 Thread Yogeswaran Thulasidoss
This patch fixes the code style space issues identified by checkpatch.pl in 
drivers/staging/lustre/lustre/obdecho/echo_client.c

Signed-off-by: Yogeswaran Thulasidoss 
---
 .../staging/lustre/lustre/obdecho/echo_client.c| 32 +++---
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c 
b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index 566e646..d542e06 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -1029,7 +1029,7 @@ static int cl_echo_object_put(struct echo_object *eco)
 
 static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco,
u64 start, u64 end, int mode,
-   __u64 *cookie , __u32 enqflags)
+   __u64 *cookie, __u32 enqflags)
 {
struct cl_io *io;
struct cl_lock *lck;
@@ -1274,11 +1274,11 @@ echo_copyout_lsm(struct lov_stripe_md *lsm, void 
*_ulsm, int ulsm_nob)
if (nob > ulsm_nob)
return -EINVAL;
 
-   if(copy_to_user (ulsm, lsm, sizeof(*ulsm)))
+   if (copy_to_user(ulsm, lsm, sizeof(*ulsm)))
return -EFAULT;
 
for (i = 0; i < lsm->lsm_stripe_count; i++) {
-   if(copy_to_user (ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i],
+   if (copy_to_user(ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i],
  sizeof(lsm->lsm_oinfo[0])))
return -EFAULT;
}
@@ -1292,10 +1292,10 @@ echo_copyin_lsm(struct echo_device *ed, struct 
lov_stripe_md *lsm,
struct echo_client_obd *ec = ed->ed_ec;
int  i;
 
-   if(ulsm_nob < sizeof (*lsm))
+   if (ulsm_nob < sizeof(*lsm))
return -EINVAL;
 
-   if(copy_from_user (lsm, ulsm, sizeof (*lsm)))
+   if (copy_from_user(lsm, ulsm, sizeof(*lsm)))
return -EFAULT;
 
if (lsm->lsm_stripe_count > ec->ec_nstripes ||
@@ -1328,7 +1328,7 @@ static int echo_create_object(const struct lu_env *env, 
struct echo_device *ed,
if ((oa->o_valid & OBD_MD_FLID) == 0 && /* no obj id */
(on_target ||  /* set_stripe */
 ec->ec_nstripes != 0)) {  /* LOV */
-   CERROR ("No valid oid\n");
+   CERROR("No valid oid\n");
return -EINVAL;
}
 
@@ -1341,7 +1341,7 @@ static int echo_create_object(const struct lu_env *env, 
struct echo_device *ed,
if (ulsm != NULL) {
int i, idx;
 
-   rc = echo_copyin_lsm (ed, lsm, ulsm, ulsm_nob);
+   rc = echo_copyin_lsm(ed, lsm, ulsm, ulsm_nob);
if (rc != 0)
goto failed;
 
@@ -1417,7 +1417,7 @@ static int echo_get_object(struct echo_object **ecop, 
struct echo_device *ed,
 
if ((oa->o_valid & OBD_MD_FLID) == 0 || ostid_id(>o_oi) == 0) {
/* disallow use of object id 0 */
-   CERROR ("No valid oid\n");
+   CERROR("No valid oid\n");
return -EINVAL;
}
 
@@ -1467,7 +1467,7 @@ echo_get_stripe_off_id(struct lov_stripe_md *lsm, u64 
*offp, u64 *idp)
width = stripe_size * stripe_count;
 
/* woffset = offset within a width; offset = whole number of widths */
-   woffset = do_div (offset, width);
+   woffset = do_div(offset, width);
 
stripe_index = woffset / stripe_size;
 
@@ -1525,13 +1525,13 @@ static int echo_client_page_debug_check(struct 
lov_stripe_md *lsm,
for (rc = delta = 0; delta < PAGE_CACHE_SIZE; delta += 
OBD_ECHO_BLOCK_SIZE) {
stripe_off = offset + delta;
stripe_id = id;
-   echo_get_stripe_off_id (lsm, _off, _id);
+   echo_get_stripe_off_id(lsm, _off, _id);
 
rc2 = block_debug_check("test_brw",
addr + delta, OBD_ECHO_BLOCK_SIZE,
stripe_off, stripe_id);
if (rc2 != 0) {
-   CERROR ("Error in echo object %#llx\n", id);
+   CERROR("Error in echo object %#llx\n", id);
rc = rc2;
}
}
@@ -1591,7 +1591,7 @@ static int echo_client_kbrw(struct echo_device *ed, int 
rw, struct obdo *oa,
 i < npages;
 i++, pgp++, off += PAGE_CACHE_SIZE) {
 
-   LASSERT (pgp->pg == NULL);  /* for cleanup */
+   LASSERT(pgp->pg == NULL);  /* for cleanup */
 
rc = -ENOMEM;
OBD_PAGE_ALLOC(pgp->pg, gfp_mask);
@@ -1821,7 +1821,7 @@ echo_client_enqueue(struct obd_export *exp, struct obdo 
*oa,
(nob & (~CFS_PAGE_MASK)) != 0)
return -EINVAL;
 
-   rc = echo_get_object (, ed, oa);
+   rc = echo_get_object(, ed, oa);
if (rc != 0)
return rc;
 

Re: [PATCH 2/2] selftests/timers: change to use shared logic to run and install tests

2015-03-15 Thread Michael Ellerman
On Fri, 2015-03-13 at 20:14 -0700, John Stultz wrote:
> On Fri, Mar 13, 2015 at 3:57 PM, Shuah Khan  wrote:
> > Change the timers Makefile to make use of shared run and install
> > logic in lib.mk. Destructive tests are installed. Regular tests
> > are emited to run_kselftest script to match the run_tests behavior.
> >
> > Signed-off-by: Shuah Khan 
> > ---
> >  tools/testing/selftests/timers/Makefile | 20 +++-
> >  1 file changed, 11 insertions(+), 9 deletions(-)
> >
> > diff --git a/tools/testing/selftests/timers/Makefile 
> > b/tools/testing/selftests/timers/Makefile
> > index 9da3498..61e7284 100644
> > --- a/tools/testing/selftests/timers/Makefile
> > +++ b/tools/testing/selftests/timers/Makefile
> > @@ -7,19 +7,21 @@ bins = posix_timers nanosleep inconsistency-check 
> > nsleep-lat raw_skew \
> > alarmtimer-suspend change_skew skew_consistency clocksource-switch \
> > leap-a-day leapcrash set-tai set-2038
> >
> > +TEST_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat mqueue-lat \
> > +   inconsistency-check raw_skew
> > +TEST_FILES = threadtest alarmtimer-suspend valid-adjtimex change_skew \
> > +   skew_consistency clocksource-switch leap-a-day leapcrash \
> > +   set-tai set-2038
> > +
> > +RUN_TESTS_WITH_ARGS := ./threadtest -t 30 -n 8 || echo "selftests: 
> > threadtest [FAIL]"
> > +
> > +EMIT_TESTS_WITH_ARGS := echo "$(RUN_TESTS_WITH_ARGS)"
> > +
> 
> So my make-foo isn't very strong, but no objections from me.
> 
> My only thoughts:
> 1) Would it be better if threadtest can be made to have better
> defaults for kselftest so you don't need that extra logic?

That would help. But with the patch I just sent I think it's no bother, it's
only a little extra logic and it's only in the timers Makefile.

> 2) While I get that TEST_FILES is likely going to be used to copy the
> destructive tests over, It feels a little like its being bundled in
> with something like data files that tests might need, which seems sort
> of hackish. Would TEST_PROGS_EXTENDED or something be more clear and
> make more sense?

That doesn't really bother me. You're right that TEST_FILES is originally
intended for data files etc. but I don't think it's a big hack to use it for
other tests that shouldn't be run by default. Still if it bothers you I'm happy
to add a separate variable for it, they are cheap :)

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 2/2] selftests/timers: change to use shared logic to run and install tests

2015-03-15 Thread Michael Ellerman
On Sun, 2015-03-15 at 19:42 +1100, Michael Ellerman wrote:
> 
> On 14 March 2015 09:57:51 GMT+11:00, Shuah Khan  
> wrote:
> >Change the timers Makefile to make use of shared run and install
> >logic in lib.mk. Destructive tests are installed. Regular tests
> >are emited to run_kselftest script to match the run_tests behavior.
> >
> >Signed-off-by: Shuah Khan 
> >---
> > tools/testing/selftests/timers/Makefile | 20 +++-
> > 1 file changed, 11 insertions(+), 9 deletions(-)
> >
> >diff --git a/tools/testing/selftests/timers/Makefile
> >b/tools/testing/selftests/timers/Makefile
> >index 9da3498..61e7284 100644
> >--- a/tools/testing/selftests/timers/Makefile
> >+++ b/tools/testing/selftests/timers/Makefile
> >@@ -7,19 +7,21 @@ bins = posix_timers nanosleep inconsistency-check
> >nsleep-lat raw_skew \
> > alarmtimer-suspend change_skew skew_consistency clocksource-switch \
> > leap-a-day leapcrash set-tai set-2038
> > 
> >+TEST_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat
> >mqueue-lat \
> >+inconsistency-check raw_skew
> >+TEST_FILES = threadtest alarmtimer-suspend valid-adjtimex change_skew
> >\
> >+skew_consistency clocksource-switch leap-a-day leapcrash \
> >+set-tai set-2038
> >+
> >+RUN_TESTS_WITH_ARGS := ./threadtest -t 30 -n 8 || echo "selftests:
> >threadtest [FAIL]"
> 
> You shouldn't need this separate variable. As long as you override RUN_TESTS 
> after you include lib.mk you can include the default value, eg:
> 
> override RUN_TESTS := $(RUN_TESTS) ./threadtest -t 30 -n 8 || echo 
> "selftests: threadtest [FAIL]"
> 
> I'll test that in the morning and send a proper patch.

How's this look?

Contents of install/timers (same as with your patch):

$ ls install/timers/
alarmtimer-suspend*  clocksource-switch*   leap-a-day*  mqueue-lat*  
nsleep-lat*raw_skew*  set-tai*skew_consistency*  valid-adjtimex*
change_skew* inconsistency-check*  leapcrash*   nanosleep*   
posix_timers*  set-2038*  set-timer-lat*  threadtest*

And in run_kselftest.sh:

echo ; echo Running tests in timers
echo 
cd timers
(./posix_timers && echo "selftests: posix_timers [PASS]") || echo "selftests: 
posix_timers [FAIL]"
(./nanosleep && echo "selftests: nanosleep [PASS]") || echo "selftests: 
nanosleep [FAIL]"
(./nsleep-lat && echo "selftests: nsleep-lat [PASS]") || echo "selftests: 
nsleep-lat [FAIL]"
(./set-timer-lat && echo "selftests: set-timer-lat [PASS]") || echo "selftests: 
set-timer-lat [FAIL]"
(./mqueue-lat && echo "selftests: mqueue-lat [PASS]") || echo "selftests: 
mqueue-lat [FAIL]"
(./inconsistency-check && echo "selftests: inconsistency-check [PASS]") || echo 
"selftests: inconsistency-check [FAIL]"
(./raw_skew && echo "selftests: raw_skew [PASS]") || echo "selftests: raw_skew 
[FAIL]"
./threadtest -t 30 -n 8 || echo selftests: threadtest [FAIL]
cd $ROOT


cheers



>From 5ea5ea0e5adee5317978965acc4594dce648da63 Mon Sep 17 00:00:00 2001
From: Michael Ellerman 
Date: Mon, 16 Mar 2015 13:38:06 +1100
Subject: [PATCH] selftests/timers: Use shared logic to run and install tests

Change the timers Makefile to make use of shared run and install logic
in lib.mk. Destructive tests are installed. Regular tests are emited to
run_kselftest script to match the run_tests behavior.

Signed-off-by: Michael Ellerman 
---
 tools/testing/selftests/timers/Makefile | 33 +
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/tools/testing/selftests/timers/Makefile 
b/tools/testing/selftests/timers/Makefile
index 9da3498987c8..8ba056ee8b48 100644
--- a/tools/testing/selftests/timers/Makefile
+++ b/tools/testing/selftests/timers/Makefile
@@ -1,25 +1,26 @@
-CC = $(CROSS_COMPILE)gcc
 BUILD_FLAGS = -DKTEST
 CFLAGS += -O3 -Wl,-no-as-needed -Wall $(BUILD_FLAGS)
 LDFLAGS += -lrt -lpthread
-bins = posix_timers nanosleep inconsistency-check nsleep-lat raw_skew \
-   set-timer-lat threadtest mqueue-lat valid-adjtimex \
-   alarmtimer-suspend change_skew skew_consistency clocksource-switch \
-   leap-a-day leapcrash set-tai set-2038
-
-all: ${bins}
 
 # these are all "safe" tests that don't modify
 # system time or require escalated privledges
-run_tests: all
-   ./posix_timers
-   ./nanosleep
-   ./nsleep-lat
-   ./set-timer-lat
-   ./mqueue-lat
-   ./inconsistency-check
-   ./raw_skew
-   ./threadtest -t 30 -n 8
+TEST_PROGS = posix_timers nanosleep nsleep-lat set-timer-lat mqueue-lat \
+   inconsistency-check raw_skew
+
+TEST_FILES = threadtest alarmtimer-suspend valid-adjtimex change_skew \
+   skew_consistency clocksource-switch leap-a-day leapcrash \
+   set-tai set-2038
+
+bins = $(TEST_PROGS) $(TEST_FILES)
+
+all: ${bins}
+
+include ../lib.mk
+
+THREADTEST := ./threadtest -t 30 -n 8 || echo "selftests: threadtest [FAIL]"
+
+override RUN_TESTS := $(RUN_TESTS) $(THREADTEST)
+override EMIT_TESTS 

linux-next: manual merge of the drm tree with the drm-intel-fixes tree

2015-03-15 Thread Stephen Rothwell
Hi Dave,

Today's linux-next merge of the drm tree got a conflict in
drivers/gpu/drm/i915/intel_display.c between commit 2dccc9898d45
("drm/i915: Ensure plane->state->fb stays in sync with plane->fb") from
the drm-intel-fixes tree and commit afd65eb4cc05 ("drm/i915: Ensure
plane->state->fb stays in sync with plane->fb"), f55548b5af87
("drm/i915: Don't try to reference the fb in
get_initial_plane_config()") and presumably others from the drm tree.

Same patch summary, different authors, committers and added function.

I fixed it up (I effectively used the drm tree version) and can carry
the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


pgpPPLKWejydP.pgp
Description: OpenPGP digital signature


Re: [PATCH] net/mlx4_core: Add configfs entries for setting device specific parameters [net-next: fix err_cast.cocci warnings

2015-03-15 Thread David Miller
From: kbuild test robot 
Date: Mon, 16 Mar 2015 02:01:25 +0800

> drivers/net/ethernet/mellanox/mlx4/conf.c:218:9-16: WARNING: ERR_CAST can be 
> used with pdev
> 
> 
>  Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(...))
> 
> Generated by: scripts/coccinelle/api/err_cast.cocci
> 
> CC: Hadar Hen Zion 
> Signed-off-by: Fengguang Wu 

Doesn't even come close to applying to net-next, please respin.
--
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] perf: report: don't allow empty argument for '-t'.

2015-03-15 Thread Namhyung Kim
On Fri, Mar 13, 2015 at 12:51:54PM +, Wang Nan wrote:
> Without this patch, perf report cause segfault if pass "" as '-t':
> 
>   $ perf report -t ""
> 
># To display the perf.data header info, please use --header/--header-only 
> options.
>#
># Samples: 37  of event 'syscalls:sys_enter_write'
># Event count (approx.): 37
>#
># ChildrenSelfCommand   Shared Object Symbol
>Segmentation fault
> 
> Since -t is used to add field-separator for generate table, -t "" is
> actually meanless. This patch defines a new OPT_STRING_NOEMPTY() option
> generator to ensure user never pass empty string to that option.
> 
> Signed-off-by: Wang Nan 
> ---
>  tools/perf/builtin-report.c |  2 +-

I think perf 'diff' and 'mem' commands also have same problem..

Thanks,
Namhyung


>  tools/perf/util/parse-options.c | 21 +++--
>  tools/perf/util/parse-options.h |  2 ++
>  3 files changed, 22 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index fb35034..2652e52 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -676,7 +676,7 @@ int cmd_report(int argc, const char **argv, const char 
> *prefix __maybe_unused)
>   OPT_STRING('w', "column-widths", _conf.col_width_list_str,
>  "width[,width...]",
>  "don't try to adjust column width, use these fixed values"),
> - OPT_STRING('t', "field-separator", _conf.field_sep, "separator",
> + OPT_STRING_NOEMPTY('t', "field-separator", _conf.field_sep, 
> "separator",
>  "separator for columns, no spaces will be added between "
>  "columns '.' is reserved."),
>   OPT_BOOLEAN('U', "hide-unresolved", _unresolved,
> diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c
> index 1457d66..01626be 100644
> --- a/tools/perf/util/parse-options.c
> +++ b/tools/perf/util/parse-options.c
> @@ -37,6 +37,7 @@ static int get_value(struct parse_opt_ctx_t *p,
>  {
>   const char *s, *arg = NULL;
>   const int unset = flags & OPT_UNSET;
> + int err;
>  
>   if (unset && p->opt)
>   return opterror(opt, "takes no value", flags);
> @@ -114,13 +115,29 @@ static int get_value(struct parse_opt_ctx_t *p,
>   return 0;
>  
>   case OPTION_STRING:
> + err = 0;
>   if (unset)
>   *(const char **)opt->value = NULL;
>   else if (opt->flags & PARSE_OPT_OPTARG && !p->opt)
>   *(const char **)opt->value = (const char *)opt->defval;
>   else
> - return get_arg(p, opt, flags, (const char 
> **)opt->value);
> - return 0;
> + err = get_arg(p, opt, flags, (const char **)opt->value);
> +
> + /* PARSE_OPT_NOEMPTY: Allow NULL but disallow empty string. */
> + if (opt->flags & PARSE_OPT_NOEMPTY) {
> + const char *val = *(const char **)opt->value;
> +
> + if (!val)
> + return err;
> +
> + /* Similar to unset if we are given an empty string. */
> + if (val[0] == '\0') {
> + *(const char **)opt->value = NULL;
> + return 0;
> + }
> + }
> +
> + return err;
>  
>   case OPTION_CALLBACK:
>   if (unset)
> diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h
> index 97b153f..59561fd 100644
> --- a/tools/perf/util/parse-options.h
> +++ b/tools/perf/util/parse-options.h
> @@ -40,6 +40,7 @@ enum parse_opt_option_flags {
>   PARSE_OPT_LASTARG_DEFAULT = 16,
>   PARSE_OPT_DISABLED = 32,
>   PARSE_OPT_EXCLUSIVE = 64,
> + PARSE_OPT_NOEMPTY  = 128,
>  };
>  
>  struct option;
> @@ -122,6 +123,7 @@ struct option {
>  #define OPT_LONG(s, l, v, h){ .type = OPTION_LONG, .short_name = 
> (s), .long_name = (l), .value = check_vtype(v, long *), .help = (h) }
>  #define OPT_U64(s, l, v, h) { .type = OPTION_U64, .short_name = (s), 
> .long_name = (l), .value = check_vtype(v, u64 *), .help = (h) }
>  #define OPT_STRING(s, l, v, a, h)   { .type = OPTION_STRING,  .short_name = 
> (s), .long_name = (l), .value = check_vtype(v, const char **), (a), .help = 
> (h) }
> +#define OPT_STRING_NOEMPTY(s, l, v, a, h)   { .type = OPTION_STRING,  
> .short_name = (s), .long_name = (l), .value = check_vtype(v, const char **), 
> (a), .help = (h), .flags = PARSE_OPT_NOEMPTY}
>  #define OPT_DATE(s, l, v, h) \
>   { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value 
> = (v), .argh = "time", .help = (h), .callback = parse_opt_approxidate_cb }
>  #define OPT_CALLBACK(s, l, v, a, h, f) \
> -- 
> 1.8.3.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to 

Re: [RFC/PATCHSET 0/6] perf kmem: Implement page allocation analysis (v1)

2015-03-15 Thread Namhyung Kim
On Thu, Mar 12, 2015 at 11:58:37PM +0900, Namhyung Kim wrote:
> On Thu, Mar 12, 2015 at 11:41:19AM +0100, Ingo Molnar wrote:
> > So there's one thing that would be useful: to track pages allocated on 
> > one node, but freed on another. Those kinds of allocation/free 
> > patterns are especially expensive and might make sense to visualize.
> 
> I think it can be done easily as slab analysis already contains the info.

Hmm.. it seems slab events provide the node info but page events
don't.  Without it, I don't know which node a page is in so cannot
determine such cross-node alloc+free patterns.

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 1/3] MAINTAINERS: mmc: Update filepath to cover all files for sdhci-s3c

2015-03-15 Thread Jaehoon Chung
Hi, Ulf.

If Ben is oK, I will want to maintain all files of sdhci-s3c*.
(sdhci-s3c is Samsung specific driver code. So i can maintain it.)
I think he didn't maintain sdhci-s3c. How about?

Best Regards,
Jaehoon Chung

On 03/13/2015 09:51 PM, Ulf Hansson wrote:
> Cc: Ben Dooks 
> Signed-off-by: Ulf Hansson 
> ---
>  MAINTAINERS | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 6239a30..78a22aa 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -8680,7 +8680,7 @@ SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) 
> SAMSUNG DRIVER
>  M:   Ben Dooks 
>  L:   linux-...@vger.kernel.org
>  S:   Maintained
> -F:   drivers/mmc/host/sdhci-s3c.c
> +F:   drivers/mmc/host/sdhci-s3c*
>  
>  SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) ST SPEAR DRIVER
>  M:   Viresh Kumar 
> 

--
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/PATCHSET 0/6] perf kmem: Implement page allocation analysis (v1)

2015-03-15 Thread Namhyung Kim
Hi Ingo,

On Fri, Mar 13, 2015 at 01:44:20PM +0100, Ingo Molnar wrote:
> 
> * Namhyung Kim  wrote:
> 
> > Hi Ingo,
> > 
> > On Thu, Mar 12, 2015 at 04:54:22PM +0100, Ingo Molnar wrote:
> > > 
> > > * Namhyung Kim  wrote:
> > > 
> > > > > I.e. something like this (mockup) output:
> > > > > 
> > > > >SUMMARY (page allocator)
> > > > >
> > > > > 
> > > > >Pages allocated+freed:   12,593   [ 51,630,080 bytes ]
> > > > > 
> > > > >Pages allocated-only: 2,342   [  1,235,010 bytes ]
> > > > >Pages freed-only:67   [135,311 bytes ]
> > > > > 
> > > > >Page allocation failures :0
> > > > 
> > > > Looks a lot better!
> > > > 
> > > > One thing I need to tell you is that the numbers are not pages but 
> > > > requests.
> > > 
> > > Yes, but in the MM code we tend to call larger order allocations 
> > > 'pages' as well: higher order pages, such as a 2MB hugepage, or a 8K 
> > > order-1 page. So at least in MM-speak it should be OK to call them 
> > > 'pages'.
> > > 
> > > But your call!
> > 
> > How about this?
> > 
> >   SUMMARY (page allocator)
> >   
> >   Total allocation requests   :9,015  [ 37,200 Kbytes ]  (A)
> >   Total free requests :8,093  [ 33,176 Kbytes ]  (B)
> > 
> >   Total alloc+freed requests  :7,985  [ 32,732 Kbytes ]  (C)
> >   Total alloc-only requests   :1,030  [  4,468 Kbytes ]  (D)
> >   Total free-only requests:  108  [444 Kbytes ]  (E)
> > 
> >   Total allocation failure:0  [  0 Kbytes ]
> 
> s/failure/failures
> s/Kbytes/KB

OK

> 
> I'd leave a bit more space for the numbers, for up into billions of 
> requests and terabytes of data. Other than that, sounds good to me!

I reserved 16 character space for each!

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 v4 1/4] mmc: dw_mmc: Don't try to enable the CD until we're sure we're not deferring

2015-03-15 Thread Jaehoon Chung
Hi, Heiko.


On 03/13/2015 09:10 PM, Heiko Stuebner wrote:
> Hi,
> 
> Am Freitag, 13. März 2015, 20:32:43 schrieb Jaehoon Chung:
>> Hi Doug,
>>
>> Will apply. Thanks!
> 
> just to make sure, you'll take patches 1-3 and I'll take the dts change from 
> patch 4, right?

Right. I will check on today and request pull to ulf on tomorrow.
Will CC'd your email when PR.

Best Regards,
Jaehoon Chung

> 
> 
> Thanks
> Heiko
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

--
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] perf, tool: partial callgrap and time support in perf record

2015-03-15 Thread Namhyung Kim
Hi Kan,

On Fri, Mar 13, 2015 at 02:18:07AM +, kan.li...@intel.com wrote:
> From: Kan Liang 
> 
> When multiple events are sampled it may not be needed to collect
> callgraphs for all of them. The sample sites are usually nearby, and
> it's enough to collect the callgraphs on a reference event (such as
> precise cycles or precise instructions). Similarly we also don't need
> fine grained time stamps on all events, as it's enough to have time
> stamps on the regular reference events. This patchkit adds the ability
> to turn off callgraphs and time stamps per event. This in term can
> reduce sampling overhead and the size of the perf.data (add some data)

Have you taken a look into group sampling feature?
(e.g. perf record -e '{ev1,ev2}:S')

Thanks,
Namhyung


> 
> Here is an example.
> 
> Collect callgrap and time for all events. The perf.data size is ~22M
> 
> $ sudo ./perf record -e
> cpu/cpu-cycles,period=10/,cpu/instructions,period=2/p
> --call-graph fp ./tchain_edit
> [ perf record: Woken up 92 times to write data ]
> [ perf record: Captured and wrote 22.909 MB perf.data (249446 samples) ]
> 
> Only collect callgrap and time on first event. The size is ~12M
> 
> $ sudo ./perf record -e
> cpu/cpu-cycles,callgraph=1,time=1,period=10/,
> cpu/instructions,callgraph=0,time=0,period=2/p
> ./tchain_edit
> [ perf record: Woken up 50 times to write data ]
> [ perf record: Captured and wrote 12.489 MB perf.data (203267 samples) ]
> 
> perf reprot result for the second event.
> Samples: 101K of event
> 'cpu/instructions,callgraph=0,time=0,period=2/p', Event count
> (approx.): 203500
>   Children  Self  Command  Shared Object Symbol
> -   97.79% 0.00%  tchain_edit  libc-2.15.so  [.]
> __libc_start_main
>  __libc_start_main
> -   97.79% 0.00%  tchain_edit  tchain_edit   [.] main
>  main
>  __libc_start_main
> -   97.79% 0.00%  tchain_edit  tchain_edit   [.] f1
>  f1
>  main
>  __libc_start_main
> -   97.79% 0.00%  tchain_edit  tchain_edit   [.] f2
>  f2
>  f1
>  main
>  __libc_start_main
> -   97.79%97.42%  tchain_edit  tchain_edit   [.] f3
>  f3
>  f2
>  f1
>  main
>  __libc_start_main
> 
> Signed-off-by: Kan Liang 
> ---
>  tools/perf/Documentation/perf-record.txt | 13 +
>  tools/perf/builtin-record.c  |  7 +++--
>  tools/perf/perf.h|  2 ++
>  tools/perf/util/evsel.c  | 50 
> ++--
>  tools/perf/util/parse-events.c   | 33 +
>  tools/perf/util/parse-events.h   |  3 ++
>  tools/perf/util/parse-events.l   |  3 ++
>  tools/perf/util/parse-options.c  |  2 ++
>  tools/perf/util/parse-options.h  |  4 +++
>  9 files changed, 111 insertions(+), 6 deletions(-)
> 
> diff --git a/tools/perf/Documentation/perf-record.txt 
> b/tools/perf/Documentation/perf-record.txt
> index 355c4f5..8b3e76c0 100644
> --- a/tools/perf/Documentation/perf-record.txt
> +++ b/tools/perf/Documentation/perf-record.txt
> @@ -45,6 +45,19 @@ OPTIONS
>param1 and param2 are defined as formats for the PMU in:
>/sys/bus/event_sources/devices//format/*
>  
> +  There are also some params which are not defined in 
> ...//format/*.
> +  These params can be used to set event defaults.
> +  Here is a list of the params.
> +  - 'period': Set event sampling period
> +  - 'callgraph': Disable/enable callgraph. Acceptable values are
> + 1 for FP mode, 2 for dwarf mode, 3 for LBR mode,
> + 0 for disabling callgraph.
> +  - 'stack_size': user stack size for dwarf mode
> +  - 'time': Disable/enable time stamping. Acceptable values are
> +1 for enabling time stamping. 0 for disabling time 
> stamping.
> +  Note: If user explicitly sets options which conflict with the 
> params,
> +  the value set by the params will be overridden.
> +
>  - a hardware breakpoint event in the form of 
> '\mem:addr[/len][:access]'
>where addr is the address in memory you want to break in.
>Access is the memory access type (read, write, execute) it can
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 5a2ff51..bf536d1 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -795,10 +795,10 @@ struct option __record_options[] = {
>perf_evlist__parse_mmap_pages),
>   OPT_BOOLEAN(0, "group", ,
>   "put the counters into a counter group"),
> - OPT_CALLBACK_NOOPT('g', NULL, ,
> + OPT_CALLBACK_NOOPT_SET('g', NULL, , 
> _set,
>  NULL, "enables call-graph recording" ,
>  _callchain_opt),
> - OPT_CALLBACK(0, "call-graph", ,
> + OPT_CALLBACK_SET(0, "call-graph", , 
> 

linux-next: manual merge of the net-next tree with the net tree

2015-03-15 Thread Stephen Rothwell
Hi all,

Today's linux-next merge of the net-next tree got a conflict in
net/ipv4/inet_diag.c between commit c8e2c80d7ec0 ("inet_diag: fix
possible overflow in inet_diag_dump_one_icsk()") from the net tree and
commit a4458343ac59 ("inet_diag: factorize code in new
inet_diag_msg_common_fill() helper") from the net-next tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au

diff --cc net/ipv4/inet_diag.c
index 592aff37366b,ac7b5c909fe7..
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@@ -71,27 -66,39 +66,53 @@@ static void inet_diag_unlock_handler(co
mutex_unlock(_diag_table_mutex);
  }
  
 +static size_t inet_sk_attr_size(void)
 +{
 +  returnnla_total_size(sizeof(struct tcp_info))
 +  + nla_total_size(1) /* INET_DIAG_SHUTDOWN */
 +  + nla_total_size(1) /* INET_DIAG_TOS */
 +  + nla_total_size(1) /* INET_DIAG_TCLASS */
 +  + nla_total_size(sizeof(struct inet_diag_meminfo))
 +  + nla_total_size(sizeof(struct inet_diag_msg))
 +  + nla_total_size(SK_MEMINFO_VARS * sizeof(u32))
 +  + nla_total_size(TCP_CA_NAME_MAX)
 +  + nla_total_size(sizeof(struct tcpvegas_info))
 +  + 64;
 +}
 +
+ static void inet_diag_msg_common_fill(struct inet_diag_msg *r, struct sock 
*sk)
+ {
+   r->idiag_family = sk->sk_family;
+ 
+   r->id.idiag_sport = htons(sk->sk_num);
+   r->id.idiag_dport = sk->sk_dport;
+   r->id.idiag_if = sk->sk_bound_dev_if;
+   sock_diag_save_cookie(sk, r->id.idiag_cookie);
+ 
+ #if IS_ENABLED(CONFIG_IPV6)
+   if (sk->sk_family == AF_INET6) {
+   *(struct in6_addr *)r->id.idiag_src = sk->sk_v6_rcv_saddr;
+   *(struct in6_addr *)r->id.idiag_dst = sk->sk_v6_daddr;
+   } else
+ #endif
+   {
+   memset(>id.idiag_src, 0, sizeof(r->id.idiag_src));
+   memset(>id.idiag_dst, 0, sizeof(r->id.idiag_dst));
+ 
+   r->id.idiag_src[0] = sk->sk_rcv_saddr;
+   r->id.idiag_dst[0] = sk->sk_daddr;
+   }
+ }
+ 
  int inet_sk_diag_fill(struct sock *sk, struct inet_connection_sock *icsk,
- struct sk_buff *skb, struct inet_diag_req_v2 *req,
- struct user_namespace *user_ns,   
- u32 portid, u32 seq, u16 nlmsg_flags,
- const struct nlmsghdr *unlh)
+ struct sk_buff *skb, const struct inet_diag_req_v2 *req,
+ struct user_namespace *user_ns,
+ u32 portid, u32 seq, u16 nlmsg_flags,
+ const struct nlmsghdr *unlh)
  {
const struct inet_sock *inet = inet_sk(sk);
+   const struct inet_diag_handler *handler;
+   int ext = req->idiag_ext;
struct inet_diag_msg *r;
struct nlmsghdr  *nlh;
struct nlattr *attr;


pgplAeSbwtKxE.pgp
Description: OpenPGP digital signature


Re: [PATCH v2 net-next 0/2] bpf: allow eBPF access skb fields

2015-03-15 Thread David Miller
From: Alexei Starovoitov 
Date: Fri, 13 Mar 2015 11:57:41 -0700

> Hi All,
> 
> V1->V2:
> - refactored field access converter into common helper convert_skb_access()
>   used in both classic and extended BPF
> - added missing build_bug_on for field 'len'
> - added comment to uapi/linux/bpf.h as suggested by Daniel
> - dropped exposing 'ifindex' field for now
> 
> classic BPF has a way to access skb fields, whereas extended BPF didn't.
> This patch introduces this ability.

I've applied this series.

I guess you guys can argue forever where the SKB offset validation
checks should be, and if you decide to do things differently than
it is done in this series just send me a followup patch.

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 v6 00/30] Refine PCI scan interfaces and make generic pci host bridge

2015-03-15 Thread Yijing Wang
On 2015/3/13 19:31, Liviu Dudau wrote:
> On Thu, Mar 12, 2015 at 04:23:06PM -0500, Bjorn Helgaas wrote:
>> On Mon, Mar 09, 2015 at 10:33:57AM +0800, Yijing Wang wrote:
>>> ...
>>> Yijing Wang (29):
>>>   PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
>>>   PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
>>>   sparc/PCI: Claim bus resources before pci_bus_add_devices()
>>
>> I put the above patches plus a cleanup patch on my pci/enumeration branch.
>> Please rebase your next revision to that.  If there's anything else
>> non-controversial that we can pull in to chip away at this, let me know.
> 
> Hi Bjorn and Yijing,
> 
> Sorry for not providing feedback earlier on this series (or any previous 
> ones),
> I'm just crawling out from under a rock of doing graphics drivers :)
> 
> The patch ripping out pci_bus_add_devices() from pci_scan_root_bus() misses 
> out
> the users of that function from drivers/pci/host. If Yijing is going to 
> refresh
> the series it is probably worth starting with adding back the call into 
> pcie-xilinx.c
> and pci-versatile.c.

Hi Liviu, thanks for your comment. I would add pci_bus_add_devices() for 
pci-versatile.c,
But for pcie-xilinx.c and other host drivers used for arm32, we do not need to 
add
pci_bus_add_devices() for them, because in arm32 pci enumeration, another 
pci_bus_add_devices()
would be called in pci_common_init_dev();

for arm32 pci enumeration:
pci_common_init_dev()
   pcibios_init_hw()
   hw->scan/pci_scan_root_bus()
   pci_bus_size_bridges()
   pci_bus_assign_resources()
   pci_bus_add_devices()

Is there something I have missed ?

Thanks!
Yijing.

> 
> Will try to review (and test) the rest of the series soon.
> 
> Best regards,
> Liviu
> 
>>
>>>   PCI: Export busn_resource to drivers/pci
>>>   PCI: Remove deprecated pci_scan_bus_parented()
>>>   PCI: Combine PCI domain and bus number in u32 arg
>>>   PCI: Pass PCI domain number combined with root bus number
>>>   PCI: Introduce pci_host_assign_domain_nr() to assign domain
>>>   PCI: Separate pci_host_bridge creation out of pci_create_root_bus()
>>>   PCI: Introduce pci_host_bridge_list to manage host bridges
>>>   PCI: Save sysdata in pci_host_bridge drvdata
>>>   PCI: Introduce pci_host_bridge_ops to support host specific
>>> operations
>>>   PCI: Introduce new scan function pci_scan_host_bridge()
>>>   x86/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge
>>>   ia64/PCI: Refine pci_acpi_scan_root() with generic pci_host_bridge
>>>   powerpc/pci: Rename pcibios_root_bridge_prepare()
>>>   powerpc/pci: Use pci_scan_host_bridge() for simplicity
>>>   PCI: Remove weak pcibios_root_bridge_prepare()
>>>   sparc/PCI: Use pci_scan_host_bridge() for simplicity
>>>   PCI: Introduce pci_bus_child_max_busnr()
>>>   parisc/PCI: Use pci_scan_root_bus() for simplicity
>>>   PCI/mvebu: Use pci_common_init_dev() to simplify code
>>>   PCI/tegra: Remove redundant tegra_pcie_scan_bus()
>>>   PCI/designware: Use pci_scan_root_bus() for simplicity
>>>   PCI/xgene: Use pci_scan_root_bus() instead of pci_create_root_bus()
>>>   PCI: Rename __pci_create_root_bus() to pci_create_root_bus()
>>>   PCI: Export find_pci_host_bridge() and rename to
>>> pci_find_host_bridge()
>>>   PCI: Remove platform specific pci_domain_nr()
>>>   PCI: Remove pci_bus_assign_domain_nr()
>>
> 


-- 
Thanks!
Yijing

--
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/2] serial: 8250_pci: Fintek products patches

2015-03-15 Thread Peter Hung

Hello,

Greg KH 於 2015/3/15 下午 05:25 寫道:

Why did you cc: the linux-usb@vger mailing list on these?  Don't you
mean linux-serial@vger?



Sorry for my fault. Should I resend it with correct mail-list with V2 ??
or just send this series patches ?

Thanks
--
With Best Regards,
Peter Hung
--
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 00/30] Refine PCI scan interfaces and make generic pci host bridge

2015-03-15 Thread Yijing Wang
On 2015/3/13 22:48, Bjorn Helgaas wrote:
> On Fri, Mar 13, 2015 at 6:31 AM, Liviu Dudau  wrote:
>> On Thu, Mar 12, 2015 at 04:23:06PM -0500, Bjorn Helgaas wrote:
>>> On Mon, Mar 09, 2015 at 10:33:57AM +0800, Yijing Wang wrote:
 ...
 Yijing Wang (29):
   PCI: Rip out pci_bus_add_devices() from pci_scan_bus()
   PCI: Rip out pci_bus_add_devices() from pci_scan_root_bus()
   sparc/PCI: Claim bus resources before pci_bus_add_devices()
>>>
>>> I put the above patches plus a cleanup patch on my pci/enumeration branch.
>>> Please rebase your next revision to that.  If there's anything else
>>> non-controversial that we can pull in to chip away at this, let me know.
>>
>> Hi Bjorn and Yijing,
>>
>> Sorry for not providing feedback earlier on this series (or any previous 
>> ones),
>> I'm just crawling out from under a rock of doing graphics drivers :)
>>
>> The patch ripping out pci_bus_add_devices() from pci_scan_root_bus() misses 
>> out
>> the users of that function from drivers/pci/host. If Yijing is going to 
>> refresh
>> the series it is probably worth starting with adding back the call into 
>> pcie-xilinx.c
>> and pci-versatile.c.
> 
> Huh, sure enough, I missed those, too.  Yijing, when you add those,
> can you pull my branch, update the patch, and repost it?  That way
> you'll keep my changelog and cleanup updates.

Sure, I will repost it today.

> 
> Bjorn
> 
> .
> 


-- 
Thanks!
Yijing

--
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 10/30] PCI: Introduce pci_host_bridge_list to manage host bridges

2015-03-15 Thread Yijing Wang
>> Currently, if platform does not know the end bus number (not provide the bus 
>> resource),
>> we will update the max bus number returned by pci_scan_child_bus() to the 
>> bus resource end,
>> and I think this is reasonable. I consider to introduce a flag to identify 
>> the bus resource
>> which end bus number is undefined, then we could force all 
>> pci_scan_root_bus()  etc. callers
>> to provide the bus resource, and we could process the bus resource end 
>> according the bus resource flag.
>> Also then we could reduce the bus argument which is the same as 
>> busn_res->start.
>> I would try to provide draft patch, then we could discuss it more clearly.
> 
> Without having seen a patch, my inclination is to avoid a flag because
> flags change the behavior of the code you call, which makes that code
> harder to follow.  Maybe we could require these platforms to
> explicitly update the ending bus number after scanning the bus.

OK, agree, thanks for your suggestion :)

> 
> Bjorn
> 
> .
> 


-- 
Thanks!
Yijing

--
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 report: ordered events and flushing bug

2015-03-15 Thread Namhyung Kim
Hi Arnaldo,

On Thu, Mar 12, 2015 at 05:50:53PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Mar 12, 2015 at 04:06:46PM -0400, Stephane Eranian escreveu:
> > On Thu, Mar 12, 2015 at 3:53 PM, David Ahern  wrote:
> > > On 3/12/15 1:39 PM, Stephane Eranian wrote:
> > >>
> > >> What the point of having all the ordered event logic if you are saying
> > >> events
> > >> must be saved in order. I don't think there is a way to make that
> > >> guarantee
> > >> when monitoring multiple CPUs at the same time.
> > >
> > >
> > > The record command does not analyze the events, it just copies from mmap 
> > > to
> > > file in lumps per mmap. e.g., on a given round the perf data file has 
> > > events
> > > like this:
> > >
> > >1222336F1
> > >|<--- round ->|^
> > >   |
> > > finished round event -|
> > >
> > > where 1 are events read from mmap1,  are events from mmap2, etc. F
> > > is the finished round event which a pass over all mmaps has been done.
> > >
> > > So for mmap1 all of the 1 events are in time order, then jumping to
> > > mmap2 events the  times are time sorted relative to mmap2 but not
> > > relative to mmap1 events.
> > >
> > > The ordered events code sorts the clumps into a time based stream:
> > > 123141641445124564234645656...
> > >
> > In my case I care about time ordering the mmap records between themselves
> > because they overlap on the address range.
> 
> Right, Namhyung, do you keep all the MMAP records as well? Looking at
> the threaded patchkit I see:
> 
> -
> [PATCH 23/38] perf tools: Add a test case for timed map groups handling
> 
> A test case for verifying thread->mg and ->mg_list handling during
> time change and new thread__find_addr_map_time() and friends.
> -
> 
> You said:
> 
> Subject: [PATCH 19/37] perf tools: Introduce 
> thread__find_addr_location_time() and friends
> 
> The *_time() variants are for find appropriate map (and symbol) at the
> given time.  This is based on the fact that map_groups list is sorted
> by time in the previous patch.
> 
> 
> Running out of time here, but I couldn't find code where you keep
> 'struct map' that overlaps and that could then be looked up using
> timestamp in addition to the addr being looked up, that is needed for
> parallely process samples having first processed all PERF_RECORD_MMAP
> events.

It currently keeps only 'map_groups' per fork/exec so overlapped
'struct map' are not treated well assuming it's a rare event.  But
with the JIT map injection, it certainly also needs to keep 'struct
map' by timestamp - I'll work on it for the next spin.

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/


회신: LZ4 : fix the data abort issue.

2015-03-15 Thread Yeon, JeHyeon (Tom)
If the part of the compression data are corrupted, or the compression
data is totally fake, the memory access over the limit is possible.

This is the log from my system usning lz4 decompression.
   [6502]data abort, halting
   [6503]r0  0x r1  0x r2  0xdcea0ffc r3  0xdcea0ffc
   [6509]r4  0xb9ab0bfd r5  0xdcea0ffc r6  0xdcea0ff8 r7  0xdce8
   [6515]r8  0x r9  0x r10 0x r11 0xb9a98000
   [6522]r12 0xdcea1000 usp 0x ulr 0x pc  0x820149bc
   [6528]spsr 0x41f3
and the memory addresses of some variables at the moment are
ref:0xdcea0ffc, op:0xdcea0ffc, oend:0xdcea1000

As you can see, COPYLENGH is 8bytes, so @ref and @op can access the momory
over @oend.

Signed-off-by: JeHyeon Yeon 
---
 lib/lz4/lz4_decompress.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c
index 7a85967..f0f5c5c 100644
--- a/lib/lz4/lz4_decompress.c
+++ b/lib/lz4/lz4_decompress.c
@@ -139,6 +139,9 @@ static int lz4_uncompress(const char *source, char *dest, 
int osize)
/* Error: request to write beyond destination buffer */
if (cpy > oend)
goto _output_error;
+   if ((ref + COPYLENGTH) > oend ||
+   (op + COPYLENGTH) > oend)
+   goto _output_error;
LZ4_SECURECOPY(ref, op, (oend - COPYLENGTH));
while (op < cpy)
*op++ = *ref++;
-- 
1.7.9.5



Dear greg k-h
I usually use my English name as tom.
But my real name is not tom as you told me but JeHyeon Yeon.
So, I changed my signed-off from tom.yeon to JeHyeon Yeon.
Thank you.

보낸 사람: gre...@linuxfoundation.org [gre...@linuxfoundation.org]
보낸 날짜: 2015년 3월 13일 금요일 오후 10:23
받는 사람: Yeon, JeHyeon (Tom)
참조: linux-kernel@vger.kernel.org
제목: Re: LZ4 : fix the data abort issue.

On Thu, Mar 12, 2015 at 08:28:55AM +, Yeon, JeHyeon (Tom) wrote:
> If the part of the compression data are corrupted, or the compression
> data is totally fake, the memory access over the limit is possible.
>
> This is the log from my system usning lz4 decompression.
>[6502]data abort, halting
>[6503]r0  0x r1  0x r2  0xdcea0ffc r3  0xdcea0ffc
>[6509]r4  0xb9ab0bfd r5  0xdcea0ffc r6  0xdcea0ff8 r7  0xdce8
>[6515]r8  0x r9  0x r10 0x r11 0xb9a98000
>[6522]r12 0xdcea1000 usp 0x ulr 0x pc  0x820149bc
>[6528]spsr 0x41f3
> and the memory addresses of some variables at the moment are
> ref:0xdcea0ffc, op:0xdcea0ffc, oend:0xdcea1000
>
> As you can see, COPYLENGH is 8bytes, so @ref and @op can access the momory
> over @oend.
>
> Signed-off-by: tom.yeon 

I need a "real" name here, I somehow doubt that your government
documents has your name as "tom.yeon", right?

Please fix this up and resend so that I can apply it.

thanks,

greg k-h
N떑꿩�r툤y鉉싕b쾊Ф푤v�^�)頻{.n�+돴쪐{콗喩zX㎍썳變}찠꼿쟺�:+v돣�쳭喩zZ+€�+zf"톒쉱�~넮녬i鎬z�췿ⅱ�?솳鈺�&�)刪f뷌^j푹y쬶끷@A첺뛴
0띠h��뭝

Linux 4.0-rc4

2015-03-15 Thread Linus Torvalds
Hmm. Nothing particularly strange going on this week either, with
perhaps just a slightly larger-than-expected ARM SoC update. So "just"
half of the patch is driver updates, with about half of the rest being
ARM changes.

The rest is the usual random mix of fixes - some other architectures
(s390, nios2), some networking, core kernel and vm, some documentation
updates.  Nothing particularly stands out here. Shortlog appended, I
think we're doing fine for where in the release cycle we are.

   Linus

---

Aaro Koskinen (1):
  ARM: OMAP: enable TWL4030_USB in omap2plus_defconfig

Ahmed S. Darwish (2):
  can: kvaser_usb: Avoid double free on URB submission failures
  can: kvaser_usb: Read all messages in a bulk-in URB buffer

Al Viro (8):
  new helper: dup_iter()
  move iov_iter.c from mm/ to lib/
  gadget/function/f_fs.c: close leaks
  gadget/function/f_fs.c: use put iov_iter into io_data
  gadget/function/f_fs.c: switch to ->{read,write}_iter()
  gadgetfs: use-after-free in ->aio_read()
  gadget: switch ep_io_operations to ->read_iter/->write_iter
  gadgetfs: get rid of flipping ->f_op in ep_config()

Alan Stern (1):
  gadgetfs: really get rid of switching ->f_op

Alexander Drozdov (1):
  ipv4: ip_check_defrag should not assume that skb_network_offset is zero

Alexander Stein (1):
  ARM: at91/dt: at91sam9263: Fixup sram1 device tree node

Alexander Sverdlin (1):
  spi: pl022: Fix race in giveback() leading to driver lock-up

Alexandre Belloni (4):
  ARM: at91: pm: fix at91rm9200 standby
  ARM: at91: pm: fix SRAM allocation
  ARM: at91/defconfig: add at91rm9200 ethernet support
  ARM: at91: debug: fix non MMU debug

Alexey Brodkin (1):
  stmmac: check IRQ availability early on probe

Alexey Kardashevskiy (1):
  vfio-pci: Add missing break to enable VFIO_PCI_ERR_IRQ_INDEX

Ameen Ali (1):
  s390/dcss: array index 'i' is used before limits check.

Andrey Ryabinin (2):
  kasan, module, vmalloc: rework shadow allocation for modules
  kasan, module: move MODULE_ALIGN macro into 

Andrzej Hajda (1):
  ARM: dts: add display power domain for exynos5250

Andy Shevchenko (3):
  spi: dw-pci: correct number of chip selects
  spi: dw: revisit FIFO size detection again
  spi: dw-mid: avoid potential NULL dereference

Anthony Harivel (1):
  ARM: at91/defconfig: remove CONFIG_SYSFS_DEPRECATED

Ard Biesheuvel (2):
  efi/arm64: use UEFI for system reset and poweroff
  arm64: put __boot_cpu_mode label after alignment instead of before

Arnd Bergmann (3):
  Input: sun4i-ts - add thermal driver dependency
  ARM: fix typos in smc91x platform data
  of: unittest: fix I2C dependency

Arturo Borrero (1):
  netfilter: nft_compat: don't truncate ethernet protocol type to u8

Baruch Siach (1):
  ARM: digicolor: add the machine directory to Makefile

Boris BREZILLON (2):
  ARM: at91/dt: sama5d4: rename lcd_clk into lcdc_clk
  ARM: at91/dt: sama5d4: fix lcdck clock definition

Boris Brezillon (3):
  ARM: at91/dt: at91sam9261: fix clocks and clock-names in udc definition
  ARM: at91/dt: declare matrix node as a syscon device
  ARM: at91/dt: fix at91 udc compatible strings

Brian King (1):
  bnx2x: Force fundamental reset for EEH recovery

Catalin Marinas (1):
  arm64: Invalidate the TLB corresponding to intermediate page table levels

Chanwoo Choi (1):
  ARM: EXYNOS: Fix wrong hwirq of RTC interrupt for Exynos3250 SoC

Chen Gang (1):
  arch/c6x/include/asm/pgtable.h: define dummy pgprot_writecombine for !MMU

Chris Wilson (3):
  drm: Don't assign fbs for universal cursor support to files
  drm/i915: Make WAIT_IOCTL negative timeouts be indefinite again
  drm/i915: Prevent TLB error on first execution on SNB

Christian Borntraeger (2):
  s390: let the compiler do page clearing
  KVM: s390/cpacf: Fix kernel bug under z/VM

Christian König (1):
  drm/radeon: drop setting UPLL to sleep mode

Chung-Ling Tang (1):
  nios2: update pt_regs

Chunyan Zhang (1):
  Documentation: DT: Renamed of-serial.txt to 8250.txt

Colin Ian King (1):
  drm/vmwgfx: Correctly NULLify dma buffer pointer on failure

Danesh Petigara (1):
  mm: cma: fix CMA aligned offset calculation

Daniel Mack (1):
  ALSA: snd-usb: add quirks for Roland UA-22

Daniel Vetter (1):
  drm/mst: fix recursive sleep warning on qlock

Dave Gerlach (2):
  ARM: dts: am33xx: fix SLEWCTRL_FAST pinctrl binding
  ARM: dts: am43xx: fix SLEWCTRL_FAST pinctrl binding

Dave Gordon (1):
  drm/i915: use in_interrupt() not in_irq() to check context

David Rientjes (1):
  mm, hugetlb: close race when setting PageTail for gigantic pages

David Vrabel (3):
  xen-netback: return correct ethtool stats
  xen-netback: unref frags when handling a from-guest skb with a frag list
  xen-netback: refactor xenvif_handle_frag_list()

Dmitry 

Re: [PATCH] selftests: Fix build failures when invoked from kselftest target

2015-03-15 Thread Michael Ellerman
On Fri, 2015-03-13 at 19:45 -0600, Shuah Khan wrote:
> Several tests that rely on implicit build rules fail to build,
> when invoked from the main Makefile kselftest target. These
> failures are due to --no-builtin-rules and --no-builtin-variables
> options set in the inherited MAKEFLAGS.
> 
> --no-builtin-rules eliminates the use of built-in implicit rules
> and --no-builtin-variables is for not defining built-in variables.
> These two options override the use of implicit rules resulting in
> build failures. In addition, inherited LDFLAGS result in build
> failures and there is no need to define LDFLAGS.  Clear LDFLAGS
> and MAKEFLAG when make is invoked from the main Makefile kselftest
> target. Fixing this at selftests Makefile avoids changing the main
> Makefile and keeps this change self contained at selftests level.
> 
> Signed-off-by: Shuah Khan 
> ---
>  tools/testing/selftests/Makefile | 9 +
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tools/testing/selftests/Makefile 
> b/tools/testing/selftests/Makefile
> index 4e51122..8e09db7 100644
> --- a/tools/testing/selftests/Makefile
> +++ b/tools/testing/selftests/Makefile
> @@ -22,6 +22,15 @@ TARGETS += vm
>  TARGETS_HOTPLUG = cpu-hotplug
>  TARGETS_HOTPLUG += memory-hotplug
>  
> +# Clear LDFLAGS and MAKEFLAGS if called from main
> +# Makefile to avoid test build failures when test
> +# Makefile doesn't have explicit build rules.
> +ifeq (1,$(MAKELEVEL))
> +undefine LDFLAGS
> +override define MAKEFLAGS =
> +endef
> +endif

You shouldn't need to use define/endef here, that is just for multi-line
variables.

This should be equivalent:

  ifeq (1,$(MAKELEVEL))
  undefine LDFLAGS
  override MAKEFLAGS =
  endif

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] code style fix - fixed all spacing issues

2015-03-15 Thread Joe Perches
On Mon, 2015-03-16 at 05:47 +0530, Yogeswaran Thulasidoss wrote:
> ---

3 things:

o You need to use a better subject line
  try something like:
[PATCH] staging: lustre: echo_client: Use kernel style spacing
o There should be some sort of commit message
o You didn't add your "Signed-off-by:"



--
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:sm750fb:Fixed no space and indent warnings

2015-03-15 Thread Ragavendra Nagraj
This patch fixes the no spaces and indent warnings identified by the
checkpath.pl script for the entire ddk750_chip.c file by using appropriate tab
spaces and indents accordingly.

Signed-off-by: Ragavendra Nagraj 
---
 drivers/staging/sm750fb/ddk750_chip.c |  454 -
 1 file changed, 227 insertions(+), 227 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index b71169e..5c9a118 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -20,22 +20,22 @@ logical_chip_type_t getChipType()
physicalID = devId750;//either 0x718 or 0x750
physicalRev = revId750;
 
-if (physicalID == 0x718)
-{
-chip = SM718;
-}
-else if (physicalID == 0x750)
-{
-chip = SM750;
+   if (physicalID == 0x718)
+   {
+   chip = SM718;
+   }
+   else if (physicalID == 0x750)
+   {
+   chip = SM750;
/* SM750 and SM750LE are different in their revision ID only. */
if (physicalRev == SM750LE_REVISION_ID){
chip = SM750LE;
}
-}
-else
-{
-chip = SM_UNKNOWN;
-}
+   }
+   else
+   {
+   chip = SM_UNKNOWN;
+   }
 
return chip;
 }
@@ -43,63 +43,63 @@ logical_chip_type_t getChipType()
 
 inline unsigned int twoToPowerOfx(unsigned long x)
 {
-unsigned long i;
-unsigned long result = 1;
+   unsigned long i;
+   unsigned long result = 1;
 
-for (i=1; i<=x; i++)
-result *= 2;
-return result;
+   for (i=1; i<=x; i++)
+   result *= 2;
+   return result;
 }
 
 inline unsigned int calcPLL(pll_value_t *pPLL)
 {
-return (pPLL->inputFreq * pPLL->M / pPLL->N / twoToPowerOfx(pPLL->OD) / 
twoToPowerOfx(pPLL->POD));
+   return (pPLL->inputFreq * pPLL->M / pPLL->N / twoToPowerOfx(pPLL->OD) / 
twoToPowerOfx(pPLL->POD));
 }
 
 unsigned int getPllValue(clock_type_t clockType, pll_value_t *pPLL)
 {
-unsigned int ulPllReg = 0;
-
-pPLL->inputFreq = DEFAULT_INPUT_CLOCK;
-pPLL->clockType = clockType;
-
-switch (clockType)
-{
-case MXCLK_PLL:
-ulPllReg = PEEK32(MXCLK_PLL_CTRL);
-break;
-case PRIMARY_PLL:
-ulPllReg = PEEK32(PANEL_PLL_CTRL);
-break;
-case SECONDARY_PLL:
-ulPllReg = PEEK32(CRT_PLL_CTRL);
-break;
-case VGA0_PLL:
-ulPllReg = PEEK32(VGA_PLL0_CTRL);
-break;
-case VGA1_PLL:
-ulPllReg = PEEK32(VGA_PLL1_CTRL);
-break;
-}
-
-pPLL->M = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, M);
-pPLL->N = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, N);
-pPLL->OD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, OD);
-pPLL->POD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, POD);
-
-return calcPLL(pPLL);
+   unsigned int ulPllReg = 0;
+
+   pPLL->inputFreq = DEFAULT_INPUT_CLOCK;
+   pPLL->clockType = clockType;
+
+   switch (clockType)
+   {
+   case MXCLK_PLL:
+   ulPllReg = PEEK32(MXCLK_PLL_CTRL);
+   break;
+   case PRIMARY_PLL:
+   ulPllReg = PEEK32(PANEL_PLL_CTRL);
+   break;
+   case SECONDARY_PLL:
+   ulPllReg = PEEK32(CRT_PLL_CTRL);
+   break;
+   case VGA0_PLL:
+   ulPllReg = PEEK32(VGA_PLL0_CTRL);
+   break;
+   case VGA1_PLL:
+   ulPllReg = PEEK32(VGA_PLL1_CTRL);
+   break;
+   }
+
+   pPLL->M = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, M);
+   pPLL->N = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, N);
+   pPLL->OD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, OD);
+   pPLL->POD = FIELD_GET(ulPllReg, PANEL_PLL_CTRL, POD);
+
+   return calcPLL(pPLL);
 }
 
 
 unsigned int getChipClock()
 {
-pll_value_t pll;
+   pll_value_t pll;
 #if 1
if(getChipType() == SM750LE)
return MHz(130);
 #endif
 
-return getPllValue(MXCLK_PLL, );
+   return getPllValue(MXCLK_PLL, );
 }
 
 
@@ -110,75 +110,75 @@ unsigned int getChipClock()
  */
 void setChipClock(unsigned int frequency)
 {
-pll_value_t pll;
-unsigned int ulActualMxClk;
+   pll_value_t pll;
+   unsigned int ulActualMxClk;
 #if 1
/* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to 
set. */
if (getChipType() == SM750LE)
return;
 #endif
 
-if (frequency != 0)
-{
-/*
- * Set up PLL, a structure to hold the value to be set in clocks.
- */
-pll.inputFreq = DEFAULT_INPUT_CLOCK; /* Defined in CLOCK.H */
-pll.clockType = MXCLK_PLL;
-
-/*
- * Call calcPllValue() to fill up the other fields for PLL structure.
- * Sometime, the chip cannot set up the exact clock required by User.
- * Return value from calcPllValue() 

[PATCH] code style fix - fixed all spacing issues

2015-03-15 Thread Yogeswaran Thulasidoss
---
 .../staging/lustre/lustre/obdecho/echo_client.c| 32 +++---
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c 
b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index 566e646..d542e06 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -1029,7 +1029,7 @@ static int cl_echo_object_put(struct echo_object *eco)
 
 static int cl_echo_enqueue0(struct lu_env *env, struct echo_object *eco,
u64 start, u64 end, int mode,
-   __u64 *cookie , __u32 enqflags)
+   __u64 *cookie, __u32 enqflags)
 {
struct cl_io *io;
struct cl_lock *lck;
@@ -1274,11 +1274,11 @@ echo_copyout_lsm(struct lov_stripe_md *lsm, void 
*_ulsm, int ulsm_nob)
if (nob > ulsm_nob)
return -EINVAL;
 
-   if(copy_to_user (ulsm, lsm, sizeof(*ulsm)))
+   if (copy_to_user(ulsm, lsm, sizeof(*ulsm)))
return -EFAULT;
 
for (i = 0; i < lsm->lsm_stripe_count; i++) {
-   if(copy_to_user (ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i],
+   if (copy_to_user(ulsm->lsm_oinfo[i], lsm->lsm_oinfo[i],
  sizeof(lsm->lsm_oinfo[0])))
return -EFAULT;
}
@@ -1292,10 +1292,10 @@ echo_copyin_lsm(struct echo_device *ed, struct 
lov_stripe_md *lsm,
struct echo_client_obd *ec = ed->ed_ec;
int  i;
 
-   if(ulsm_nob < sizeof (*lsm))
+   if (ulsm_nob < sizeof(*lsm))
return -EINVAL;
 
-   if(copy_from_user (lsm, ulsm, sizeof (*lsm)))
+   if (copy_from_user(lsm, ulsm, sizeof(*lsm)))
return -EFAULT;
 
if (lsm->lsm_stripe_count > ec->ec_nstripes ||
@@ -1328,7 +1328,7 @@ static int echo_create_object(const struct lu_env *env, 
struct echo_device *ed,
if ((oa->o_valid & OBD_MD_FLID) == 0 && /* no obj id */
(on_target ||  /* set_stripe */
 ec->ec_nstripes != 0)) {  /* LOV */
-   CERROR ("No valid oid\n");
+   CERROR("No valid oid\n");
return -EINVAL;
}
 
@@ -1341,7 +1341,7 @@ static int echo_create_object(const struct lu_env *env, 
struct echo_device *ed,
if (ulsm != NULL) {
int i, idx;
 
-   rc = echo_copyin_lsm (ed, lsm, ulsm, ulsm_nob);
+   rc = echo_copyin_lsm(ed, lsm, ulsm, ulsm_nob);
if (rc != 0)
goto failed;
 
@@ -1417,7 +1417,7 @@ static int echo_get_object(struct echo_object **ecop, 
struct echo_device *ed,
 
if ((oa->o_valid & OBD_MD_FLID) == 0 || ostid_id(>o_oi) == 0) {
/* disallow use of object id 0 */
-   CERROR ("No valid oid\n");
+   CERROR("No valid oid\n");
return -EINVAL;
}
 
@@ -1467,7 +1467,7 @@ echo_get_stripe_off_id(struct lov_stripe_md *lsm, u64 
*offp, u64 *idp)
width = stripe_size * stripe_count;
 
/* woffset = offset within a width; offset = whole number of widths */
-   woffset = do_div (offset, width);
+   woffset = do_div(offset, width);
 
stripe_index = woffset / stripe_size;
 
@@ -1525,13 +1525,13 @@ static int echo_client_page_debug_check(struct 
lov_stripe_md *lsm,
for (rc = delta = 0; delta < PAGE_CACHE_SIZE; delta += 
OBD_ECHO_BLOCK_SIZE) {
stripe_off = offset + delta;
stripe_id = id;
-   echo_get_stripe_off_id (lsm, _off, _id);
+   echo_get_stripe_off_id(lsm, _off, _id);
 
rc2 = block_debug_check("test_brw",
addr + delta, OBD_ECHO_BLOCK_SIZE,
stripe_off, stripe_id);
if (rc2 != 0) {
-   CERROR ("Error in echo object %#llx\n", id);
+   CERROR("Error in echo object %#llx\n", id);
rc = rc2;
}
}
@@ -1591,7 +1591,7 @@ static int echo_client_kbrw(struct echo_device *ed, int 
rw, struct obdo *oa,
 i < npages;
 i++, pgp++, off += PAGE_CACHE_SIZE) {
 
-   LASSERT (pgp->pg == NULL);  /* for cleanup */
+   LASSERT(pgp->pg == NULL);  /* for cleanup */
 
rc = -ENOMEM;
OBD_PAGE_ALLOC(pgp->pg, gfp_mask);
@@ -1821,7 +1821,7 @@ echo_client_enqueue(struct obd_export *exp, struct obdo 
*oa,
(nob & (~CFS_PAGE_MASK)) != 0)
return -EINVAL;
 
-   rc = echo_get_object (, ed, oa);
+   rc = echo_get_object(, ed, oa);
if (rc != 0)
return rc;
 
@@ -2003,7 +2003,7 @@ echo_client_iocontrol(unsigned int cmd, struct obd_export 
*exp, int len,
goto out;
 
default:
-   CERROR 

Re: [PATCH v4 5/5] usb: gadget: udc-core: independent registration of gadgets and gadget drivers

2015-03-15 Thread Ruslan Bilovol
HI Alan,

On Fri, Mar 13, 2015 at 4:39 PM, Alan Stern  wrote:
> On Thu, 12 Mar 2015, Ruslan Bilovol wrote:
>
>> Change behavior during registration of gadgets and
>> gadget drivers in udc-core. Instead of previous
>> approach when for successful probe of usb gadget driver
>> at least one usb gadget should be already registered
>> use another one where gadget drivers and gadgets
>> can be registered in udc-core independently.
>>
>> Independent registration of gadgets and gadget drivers
>> is useful for built-in into kernel gadget and gadget
>> driver case - because it's possible that gadget is
>> really probed only on late_init stage (due to deferred
>> probe) whereas gadget driver's probe is silently failed
>> on module_init stage due to no any UDC added.
>>
>> Also it is useful for modules case - now there is no
>> difference what module to insert first: gadget module
>> or gadget driver one.
>
>
>> @@ -366,9 +383,16 @@ found:
>>   list_del(>list);
>>   mutex_unlock(_lock);
>>
>> - if (udc->driver)
>> + if (udc->driver) {
>> + struct usb_gadget_driver *driver = udc->driver;
>> +
>>   usb_gadget_remove_driver(udc);
>>
>> + mutex_lock(_lock);
>> + list_add(>pending, _driver_pending_list);
>> + mutex_unlock(_lock);
>> + }
>
> I'm not sure this is a good idea.  Gadget drivers probably don't expect
> to be bound again after they are unbound.

This already has been discussed some time ago:
https://lkml.org/lkml/2015/2/9/497
The bottom line was - such gadget drivers are buggy and need to be fixed
since there is no known restrictions in binding gadget drivers to UDC multiple
times

>
> Besides, when would this gadget driver get bound to a UDC?  Not until
> the next UDC is added -- even if there already are some unbound UDCs.

Currently this gadget driver will get bound to a UDC only when next UDC
is added. It seems there is no users of this feature, so I didn't
add full implementation of this (that I had in version #1 if this patch:
https://lkml.org/lkml/2015/1/28/1079 )

>
>
>> @@ -468,6 +491,16 @@ int usb_gadget_unregister_driver(struct 
>> usb_gadget_driver *driver)
>>   break;
>>   }
>>
>> + if (ret) {
>> + struct usb_gadget_driver *tmp;
>> +
>> + list_for_each_entry(tmp, _driver_pending_list, pending)
>> + if (tmp == driver) {
>> + list_del(>pending);
>> + ret = 0;
>> + break;
>> + }
>> + }
>
> You could avoid this loop and simply do list_del(>pending), if
> you made sure driver->pending was initialized.

It would be good to avoid this loop but the question is how to make sure
that driver->pending is not only initialized (prev and next are not NULL),
but also contains valid data?

Best regards,
Ruslan
--
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: rcu: frequent rcu lockups

2015-03-15 Thread Paul E. McKenney
On Sun, Mar 15, 2015 at 07:32:32PM -0400, Sasha Levin wrote:
> On 03/15/2015 04:43 PM, Paul E. McKenney wrote:
> > But I did find a bug that would result in the other warnings, and could
> > also result in too-short grace periods, which could in turn result in
> > arbitrarily arbitrary misbehavior.  The patch below, which is also on
> > its way into -next, should fix this.  Please let me know how it does
> > for you.
> 
> I've stopped seeing the warnings I've previously reported, but started
> seeing a new one:
> 
> [  788.564596] WARNING: CPU: 12 PID: 9711 at kernel/rcu/tree.c:2201 
> rcu_report_qs_rnp+0x42e/0x5a0()
> [  788.568123] Modules linked in:
> [  788.568123] CPU: 12 PID: 9711 Comm: trinity-main Not tainted 
> 4.0.0-rc3-next-20150313-sasha-00041-g83a3dc8-dirty #2078
> [  788.568123]  8803a1ba 400df16a 880442807cc8 
> b1ab01ca
> [  788.568123]    880442807d18 
> a71e261a
> [  788.568123]  dc00 a733d2ee 880442807d28 
> b4724000
> [  788.568123] Call Trace:
> [  788.568123]  dump_stack (lib/dump_stack.c:52)
> [  788.568123] warn_slowpath_common (kernel/panic.c:447)
> [  788.568123] ? rcu_report_qs_rnp (kernel/rcu/tree.c:2201 (discriminator 3))
> [  788.568123] warn_slowpath_null (kernel/panic.c:481)
> [  788.568123] rcu_report_qs_rnp (kernel/rcu/tree.c:2201 (discriminator 3))
> [  788.568123] rcu_process_callbacks (kernel/rcu/tree.c:2302 
> kernel/rcu/tree.c:2338 kernel/rcu/tree.c:2824 kernel/rcu/tree.c:2857)
> [  788.568123] __do_softirq (kernel/softirq.c:273 
> include/linux/jump_label.h:114 include/trace/events/irq.h:126 
> kernel/softirq.c:274)
> [  788.568123] irq_exit (kernel/softirq.c:350 kernel/softirq.c:391)
> [  788.568123] smp_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:918)
> [  788.568123] apic_timer_interrupt (arch/x86/kernel/entry_64.S:920)
> [  788.568123]  ? mark_held_locks (kernel/locking/lockdep.c:2525)
> [  788.568123] finish_task_switch (kernel/sched/core.c:2231)
> [  788.568123] __schedule (kernel/sched/core.c:2337 kernel/sched/core.c:2795)
> [  788.568123] schedule (./arch/x86/include/asm/bitops.h:311 (discriminator 
> 1) kernel/sched/core.c:2824 (discriminator 1))
> [  788.568123] schedule_preempt_disabled (kernel/sched/core.c:2856)
> [  788.568123] mutex_lock_nested (kernel/locking/mutex.c:585 
> kernel/locking/mutex.c:623)
> [  788.568123] kernfs_iop_permission (fs/kernfs/inode.c:366)
> [  788.568123] __inode_permission (fs/namei.c:374 fs/namei.c:408)
> [  788.568123] inode_permission (fs/namei.c:460)
> [  788.568123] link_path_walk (fs/namei.c:1520 fs/namei.c:1782)
> [  788.568123] path_init (fs/namei.c:1947)
> [  788.568123] path_lookupat (fs/namei.c:1989)
> [  788.568123] filename_lookup (fs/namei.c:2025)
> [  788.568123] user_path_at_empty (fs/namei.c:2189)
> [  788.568123] user_path_at (fs/namei.c:2200)
> [  788.568123] vfs_fstatat (fs/stat.c:106)
> [  788.568123] SYSC_newfstatat (fs/stat.c:298)
> [  788.568123] SyS_newfstatat (fs/stat.c:291)
> [  788.568123] tracesys_phase2 (arch/x86/kernel/entry_64.S:347)

OK, I guess it would help to update the WARN_ON()s while I am at it.  :-/

Here is an updated patch that replaces the one resulting in the above
splat.

Thanx, Paul



rcu: Associate quiescent-state reports with grace period

As noted in earlier commit logs, CPU hotplug operations running
concurrently with grace-period initialization can result in a given
leaf rcu_node structure having all CPUs offline and no blocked readers,
but with this rcu_node structure nevertheless blocking the current
grace period.  Therefore, the quiescent-state forcing code now checks
for this situation and repairs it.

Unfortunately, this checking can result in false positives, for example,
when the last task has just removed itself from this leaf rcu_node
structure, but has not yet started clearing the ->qsmask bits further
up the structure.  This means that the grace-period kthread (which
forces quiescent states) and some other task might be attempting to
concurrently clear these ->qsmask bits.  This is usually not a problem:
One of these tasks will be the first to acquire the upper-level rcu_node
structure's lock and with therefore clear the bit, and the other task,
seeing the bit already cleared, will stop trying to clear bits.

Sadly, this means that the following unusual sequence of events -can-
result in a problem:

1.  The grace-period kthread wins, and clears the ->qsmask bits.

2.  This is the last thing blocking the current grace period, so
that the grace-period kthread clears ->qsmask bits all the way
to the root and finds that the root ->qsmask field is now zero.

3.  Another grace period is required, so that 

Re: udiskd high CPU usage with 4.0 git

2015-03-15 Thread NeilBrown
On Mon, 09 Mar 2015 16:46:41 +0100 Prakash Punnoor  wrote:

> On 09.03.2015 00:30, NeilBrown wrote:
> > On Sun, 08 Mar 2015 18:14:39 +0100 Prakash Punnoor  
> > wrote:
> > 
> >> Hi,
> >>
> >> I noticed the udisks daemon (version 2.1.4) suddenly started using high
> >> cpu (one core at 100%) with linux 4.0 git kernel. I bisected it to:
> >>
> >> 750f199ee8b578062341e6ddfe36c59ac8ff2dcb
> >>
> >> And reverting it from current master (at
> >> 2cf3afcd4cbe0e32b8722fc291e9255de1b4d6c6) fixes my problem indeed.
> >>
> >> I attached dmesg and config from
> >> 2cf3afcd4cbe0e32b8722fc291e9255de1b4d6c6 with
> >> 750f199ee8b578062341e6ddfe36c59ac8ff2dcb reverted. Any more infos
> >> needed? I am actually using a raid5 array, if that matters:
> >>
> >> Personalities : [raid6] [raid5] [raid4]
> >> md127 : active raid5 sdd1[1] sdb1[3] sdc1[0]
> >>   3907023872 blocks super 1.2 level 5, 512k chunk, algorithm 2 [3/3]
> >> [UUU]
> >>
> >> unused devices: 
> >>
> >>
> >> The array uses systemd automount feature (x-systemd.automount).
> >>
> >> Please CC me, as I am not subscribed.
> >>
> >>
> >> Regards,
> >>
> >> Prakash
> > 
> > Thanks for the report.
> > I can't reproduce this, or see what would cause it.
> > 
> > Can you please reproduce the problem and then run
> > 
> >   strace -o /tmp/udisks.trace -f -p `pidof udisksd`
> > 
> > for a few seconds, then interrupt and post the resulting 
> > '/tmp/udisks.trace'.
> 
> Hi, attached the trace.
> 
>

Thanks. 
The significant part is:

329   poll([{fd=4, events=POLLIN}, {fd=8, events=0}, {fd=9, events=0}, {fd=11, 
events=POLLIN}, {fd=13, events=0}, {fd=12, events=0}], 6, 513377) = 2 ([{fd=4, 
revents=POLLIN}, {fd=12, revents=POLLERR}])

repeating frequently, so fd4 and fd12 are always ready.
I don't know about fd4, but fd12 is:

329   read(12, "idle\n", 1024)  = 5


so that is .../md/sync_action
It is simply always readable.  I thought I had checked that, but it seems not.

Anyway I have a fix which I will post shortly.

thanks again,
NeilBrown


pgpGGEau_MQtV.pgp
Description: OpenPGP digital signature


[PATCH] kernfs: handle poll correctly on 'direct_read' files.

2015-03-15 Thread NeilBrown


Kernfs supports two styles of read: direct_read and seqfile_read.

The latter supports 'poll' correctly thanks to the update of
'->event' in kernfs_seq_show.
The former does not as '->event' is never updated on a read.

So add an appropriate update in kernfs_file_direct_read().

This was noticed because some 'md' sysfs attributes were
recently changed to use direct reads.

Reported-by: Prakash Punnoor 
Reported-by: Torsten Kaiser 
Fixes: 750f199ee8b578062341e6ddfe36c59ac8ff2dcb
Signed-off-by: NeilBrown 

diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index b684e8a132e6..2bacb9988566 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -207,6 +207,7 @@ static ssize_t kernfs_file_direct_read(struct 
kernfs_open_file *of,
goto out_free;
}
 
+   of->event = atomic_read(>kn->attr.open->event);
ops = kernfs_ops(of->kn);
if (ops->read)
len = ops->read(of, buf, len, *ppos);


pgpT3BzojXDZ1.pgp
Description: OpenPGP digital signature


Re: udiskd high CPU usage with 4.0 git

2015-03-15 Thread NeilBrown
On Sat, 14 Mar 2015 21:16:51 +0100 Torsten Kaiser
 wrote:

> On Mon, Mar 9, 2015 at 12:30 AM, NeilBrown  wrote:
> > On Sun, 08 Mar 2015 18:14:39 +0100 Prakash Punnoor  
> > wrote:
> >
> >> Hi,
> >>
> >> I noticed the udisks daemon (version 2.1.4) suddenly started using high
> >> cpu (one core at 100%) with linux 4.0 git kernel. I bisected it to:
> >>
> >> 750f199ee8b578062341e6ddfe36c59ac8ff2dcb
> 
> I had the same problem upgrading from 4.0-rc1 to 4.0-rc3.
> I have just finished bisecting and "fixing" it.
> 
> My bisect points to the same commit.
> 
> Looking at udisksd with strace sees a loop of polling and then
> accessing several md related sysfs files.
> The only file that udisksd monitors and was changes by that commit was
> "sync_action".
> 
> If I revert this part of the commit, my system works normal again:
> 
>  static struct md_sysfs_entry md_scan_mode =
> - __ATTR_PREALLOC(sync_action, S_IRUGO|S_IWUSR, action_show, action_store);
> + __ATTR(sync_action, S_IRUGO|S_IWUSR, action_show, action_store);
> 
> It seems that polling is broken for peralloc files.
> 
> The cause seems to be that kernfs_seq_show() updates ->event, while
> the new sysfs_kf_read() does not.
> So the polling will always trigger and udisksd goes into an inifinite
> loop looking for changes that are not there.
> 
> I fixed my local system by copying the line "of->event =
> atomic_read(>kn->attr.open->event);" from kernfs_seq_show() into
> sysfs_kf_read(). (I also needed to move the definition of struct
> kernfs_open_node from kernfs/file.c to kefs-internal.h)
> 
> udisksd now again behaves normal, but I'm not sending this change as a
> patch, because I do not know about the locking and livetime of these
> objects to evaluate, if that is really the correct fix.

Thanks for the bisection and analysis!  Always easier when someone else does
the hard work :-)

There is a much simpler patch (as you probably suspected).  I'll post it in a
moment.

Thank,
NeilBrown


pgpzQf7wIbPmy.pgp
Description: OpenPGP digital signature


Re: [PATCH v2 5/7] clone4: Add a CLONE_AUTOREAP flag to automatically reap the child process

2015-03-15 Thread Josh Triplett
On Sun, Mar 15, 2015 at 08:55:06PM +0100, Oleg Nesterov wrote:
> On 03/15, Josh Triplett wrote:
> > On Sun, Mar 15, 2015 at 03:52:23PM +0100, Oleg Nesterov wrote:
> > > On 03/15, Josh Triplett wrote:
> > > > Add a CLONE_AUTOREAP flag to request this behavior unconditionally,
> > >
> > > Yes, CLONE_AUTOREAP is much better. And I agree (mostly) with that
> > > we should rely on do_notify_parent().
> > >
> > > Howver the patch still doesn't look right. First of all, ->autoreap
> > > should be per-process, not per-thread.
> >
> > Ah, you're thinking of the case where the parent process launches a
> > ...
> 
> Not really, although we probably need more sanity checks.
> 
> It should be per-process simply because this "autoreap" affects the whole
> process. And the sub-threads are already "autoreap". And these 2 autoreap's
> semantics differ, we should not confuse them.

Will the approach I suggested, of having clones with CLONE_THREAD
inherit the autoreap value rather than setting it from CLONE_AUTOREAP,
implement the semantics you're looking for?

Also, are you suggesting that CLONE_AUTOREAP with CLONE_THREAD should
produce -EINVAL, or just that it should be ignored?

> > (As an aside, what *is* the use case for CLONE_PARENT without
> > CLONE_THREAD?)
> 
> To me CLONE_PARENT is another historical mistake and the source of misc
> problems ;)

I kinda figured. :)

> > > And there are ptrace/mt issues,
> > > it seems. Just for example, we should avoid EXIT_TRACE if autoreap in
> > > wait_task_zombie() even if we are going to re-notify parent.
> >
> > I don't see how EXIT_TRACE can happen in wait_task_zombie if autoreap is
> > set.  wait_task_zombie does a cmpxchg with exit_state and doesn't
> > proceed unless exit_state was EXIT_ZOMBIE, and I don't see how we can
> > ever reach the EXIT_ZOMBIE state if autoreap.
> 
> Because you again forgot about ptrace ;)
> 
> Josh. Let me try to summarise this later when I have time. Again, I am
> not sure, perhaps this is even simpler than I currently think. And let
> me apologize in advance, most probably I will be busy tomorrow.

I look forward to your later review and feedback.

- Josh Triplett
--
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: rcu: frequent rcu lockups

2015-03-15 Thread Sasha Levin
On 03/15/2015 04:43 PM, Paul E. McKenney wrote:
> But I did find a bug that would result in the other warnings, and could
> also result in too-short grace periods, which could in turn result in
> arbitrarily arbitrary misbehavior.  The patch below, which is also on
> its way into -next, should fix this.  Please let me know how it does
> for you.

I've stopped seeing the warnings I've previously reported, but started
seeing a new one:

[  788.564596] WARNING: CPU: 12 PID: 9711 at kernel/rcu/tree.c:2201 
rcu_report_qs_rnp+0x42e/0x5a0()
[  788.568123] Modules linked in:
[  788.568123] CPU: 12 PID: 9711 Comm: trinity-main Not tainted 
4.0.0-rc3-next-20150313-sasha-00041-g83a3dc8-dirty #2078
[  788.568123]  8803a1ba 400df16a 880442807cc8 
b1ab01ca
[  788.568123]    880442807d18 
a71e261a
[  788.568123]  dc00 a733d2ee 880442807d28 
b4724000
[  788.568123] Call Trace:
[  788.568123]  dump_stack (lib/dump_stack.c:52)
[  788.568123] warn_slowpath_common (kernel/panic.c:447)
[  788.568123] ? rcu_report_qs_rnp (kernel/rcu/tree.c:2201 (discriminator 3))
[  788.568123] warn_slowpath_null (kernel/panic.c:481)
[  788.568123] rcu_report_qs_rnp (kernel/rcu/tree.c:2201 (discriminator 3))
[  788.568123] rcu_process_callbacks (kernel/rcu/tree.c:2302 
kernel/rcu/tree.c:2338 kernel/rcu/tree.c:2824 kernel/rcu/tree.c:2857)
[  788.568123] __do_softirq (kernel/softirq.c:273 
include/linux/jump_label.h:114 include/trace/events/irq.h:126 
kernel/softirq.c:274)
[  788.568123] irq_exit (kernel/softirq.c:350 kernel/softirq.c:391)
[  788.568123] smp_apic_timer_interrupt (arch/x86/kernel/apic/apic.c:918)
[  788.568123] apic_timer_interrupt (arch/x86/kernel/entry_64.S:920)
[  788.568123]  ? mark_held_locks (kernel/locking/lockdep.c:2525)
[  788.568123] finish_task_switch (kernel/sched/core.c:2231)
[  788.568123] __schedule (kernel/sched/core.c:2337 kernel/sched/core.c:2795)
[  788.568123] schedule (./arch/x86/include/asm/bitops.h:311 (discriminator 1) 
kernel/sched/core.c:2824 (discriminator 1))
[  788.568123] schedule_preempt_disabled (kernel/sched/core.c:2856)
[  788.568123] mutex_lock_nested (kernel/locking/mutex.c:585 
kernel/locking/mutex.c:623)
[  788.568123] kernfs_iop_permission (fs/kernfs/inode.c:366)
[  788.568123] __inode_permission (fs/namei.c:374 fs/namei.c:408)
[  788.568123] inode_permission (fs/namei.c:460)
[  788.568123] link_path_walk (fs/namei.c:1520 fs/namei.c:1782)
[  788.568123] path_init (fs/namei.c:1947)
[  788.568123] path_lookupat (fs/namei.c:1989)
[  788.568123] filename_lookup (fs/namei.c:2025)
[  788.568123] user_path_at_empty (fs/namei.c:2189)
[  788.568123] user_path_at (fs/namei.c:2200)
[  788.568123] vfs_fstatat (fs/stat.c:106)
[  788.568123] SYSC_newfstatat (fs/stat.c:298)
[  788.568123] SyS_newfstatat (fs/stat.c:291)
[  788.568123] tracesys_phase2 (arch/x86/kernel/entry_64.S:347)


Thanks,
Sasha
--
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: Add kdbus branch to linux-next?

2015-03-15 Thread Stephen Rothwell
Hi Greg,

On Sun, 15 Mar 2015 10:34:52 +0100 Greg KH  wrote:
>
> Can you add the:
>   https://git.kernel.org/cgit/linux/kernel/git/gregkh/char-misc.git/ kdbus
> 
> tree to linux-next so that it gets the normal amount of testing that
> linux-next provides?
> 
> The code has been reworked and reviewed many times, and this last round
> seems to have no objections, so I'm queueing it up to be merged for
> 4.1-rc1.

Added from today.

Thanks for adding your subsystem tree as a participant of linux-next.  As
you may know, this is not a judgment of your code.  The purpose of
linux-next is for integration testing and to lower the impact of
conflicts between subsystems in the next merge window. 

You will need to ensure that the patches/commits in your tree/series have
been:
 * submitted under GPL v2 (or later) and include the Contributor's
Signed-off-by,
 * posted to the relevant mailing list,
 * reviewed by you (or another maintainer of your subsystem tree),
 * successfully unit tested, and 
 * destined for the current or next Linux merge window.

Basically, this should be just what you would send to Linus (or ask him
to fetch).  It is allowed to be rebased if you deem it necessary.

-- 
Cheers,
Stephen Rothwell 
s...@canb.auug.org.au


pgpd5UA8XNqEr.pgp
Description: OpenPGP digital signature


Hello

2015-03-15 Thread Sarah Boj
Good day,

I believe that you will be anxious to know the kind of business proposition 
that I have for you. Well, I am soliciting your assistance to be able to 
transfer a huge amount of money $20,500,000.00 from my bank that is lying idle 
with no one ever coming to lay claim to it. Let me know if you are interested.

Regards,
Sarah Bojing
email: sarah-boj...@asia-mail.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: Question on mutex code

2015-03-15 Thread Davidlohr Bueso
On Sun, 2015-03-15 at 15:18 -0700, Davidlohr Bueso wrote:
> Correct, in debug this is most likely true, yet safe because everything
^^^ false, again the same reasoning.

--
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: Question on mutex code

2015-03-15 Thread Davidlohr Bueso
On Sun, 2015-03-15 at 23:49 +0200, Matthias Bonne wrote:
> On 03/15/15 03:09, Davidlohr Bueso wrote:
> > On Sat, 2015-03-14 at 18:03 -0700, Davidlohr Bueso wrote:
> >> Good analysis, but not quite accurate for one simple fact: mutex
> >> trylocks _only_ use fastpaths (obviously just depend on the counter
> >> cmpxchg to 0), so you never fallback to the slowpath you are mentioning,
> >> thus the race is non existent. Please see the arch code.
> >
> > For debug we use the trylock slowpath, but so does everything else, so
> > again you cannot hit this scenario.
> >
> >
> 
> You are correct of course - this is why I said that
> CONFIG_DEBUG_MUTEXES must be enabled for this to happen.

Right, so I just skimmed through the email ;)

>  Can you
> explain why this scenario is still not possible in the debug case?
> 
> The debug case uses mutex-null.h, which contains these macros:
> 
> #define __mutex_fastpath_lock(count, fail_fn)   fail_fn(count)
> #define __mutex_fastpath_lock_retval(count) (-1)
> #define __mutex_fastpath_unlock(count, fail_fn) fail_fn(count)
> #define __mutex_fastpath_trylock(count, fail_fn)fail_fn(count)
> #define __mutex_slowpath_needs_to_unlock()  1
> 
> So both mutex_trylock() and mutex_unlock() always use the slow paths.

Right.

> The slowpath for mutex_unlock() is __mutex_unlock_slowpath(), which
> simply calls __mutex_unlock_common_slowpath(), and the latter starts
> like this:
> 
>  /*
>   * As a performance measurement, release the lock before doing 
> other
>   * wakeup related duties to follow. This allows other tasks to 
> acquire
>   * the lock sooner, while still handling cleanups in past 
> unlock calls.
>   * This can be done as we do not enforce strict equivalence 
> between the
>   * mutex counter and wait_list.
>   *
>   *
>   * Some architectures leave the lock unlocked in the fastpath 
> failure
>   * case, others need to leave it locked. In the later case we 
> have to
>   * unlock it here - as the lock counter is currently 0 or negative.
>   */
>  if (__mutex_slowpath_needs_to_unlock())
>  atomic_set(>count, 1);

Correct, in debug this is most likely true, yet safe because everything
is serialized through the mutex wait_lock. 

> 
>  spin_lock_mutex(>wait_lock, flags);
>  [...]
> 
> So the counter is set to 1 before taking the spinlock, which I think
> might cause the race. Did I miss something?

So in debug we play no counter/wait_list games when trying to grab the
lock, ie things such as lock stealing or optimistic spinning.
Furthermore, it is the unlocker thread's duty to wakeup the next task in
the list, so nothing can jump in and steal the lock. Additionally,
ordering also relies on the wait_queue ticket spinlock.

--
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] Odd interaction between uninterruptible syscall and stack overflow

2015-03-15 Thread Linus Torvalds
On Sun, Mar 15, 2015 at 11:12 AM, Simonas  wrote:
> While working on stack related code in Rust’s stdandard library, I trigerred
> a very odd and amusing issue yesterday.

This sounds like a the subtle backporting issue we had where a subtle
semantic dependency was missed, and as a result 3.18.6 was buggered
for the case of a stack overflow.

Basically, commit 33692f27597f got backported without  commit
7fb08eca45270d, and broke. Normally these dependencies are obvious and
cause the patches to not apply at all, or the result to not work in
obvious ways, but in this case the stable trees were unlucky, and the
patch applied cleanly and everything normal seems to work, but then
stack overflows end up not releasing a semaphore.

It should be fixed in 3.18.7 already, but clearly a few distributions
were unlucky and hit the broken kernel.

 Linus
--
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: Question on mutex code

2015-03-15 Thread Rabin Vincent
On Sun, Mar 15, 2015 at 11:49:07PM +0200, Matthias Bonne wrote:
> So both mutex_trylock() and mutex_unlock() always use the slow paths.
> The slowpath for mutex_unlock() is __mutex_unlock_slowpath(), which
> simply calls __mutex_unlock_common_slowpath(), and the latter starts
> like this:
> 
> /*
>  * As a performance measurement, release the lock before doing other
>  * wakeup related duties to follow. This allows other tasks to
> acquire
>  * the lock sooner, while still handling cleanups in past unlock
> calls.
>  * This can be done as we do not enforce strict equivalence between
> the
>  * mutex counter and wait_list.
>  *
>  *
>  * Some architectures leave the lock unlocked in the fastpath
> failure
>  * case, others need to leave it locked. In the later case we have
> to
>  * unlock it here - as the lock counter is currently 0 or negative.
>  */
> if (__mutex_slowpath_needs_to_unlock())
> atomic_set(>count, 1);
> 
> spin_lock_mutex(>wait_lock, flags);
> [...]
> 
> So the counter is set to 1 before taking the spinlock, which I think
> might cause the race. Did I miss something?

Yes, you miss the fact that __mutex_slowpath_needs_to_unlock() is 0 for
the CONFIG_DEBUG_MUTEXES case:

 #ifdef CONFIG_DEBUG_MUTEXES
 # include "mutex-debug.h"
 # include 
 /*
  * Must be 0 for the debug case so we do not do the unlock outside of the
  * wait_lock region. debug_mutex_unlock() will do the actual unlock in this
  * case.
  */
 # undef __mutex_slowpath_needs_to_unlock
 # define  __mutex_slowpath_needs_to_unlock()   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: [RFC PATCH] sys_membarrier(): system/process-wide memory barrier (x86) (v12)

2015-03-15 Thread Paul E. McKenney
On Sun, Mar 15, 2015 at 03:24:19PM -0400, Mathieu Desnoyers wrote:
> Here is an implementation of a new system call, sys_membarrier(), which
> executes a memory barrier on either all running threads of the current
> process (MEMBARRIER_PRIVATE_FLAG) or calls synchronize_sched() to issue
> a memory barrier on all threads running on the system. It can be used to
> distribute the cost of user-space memory barriers asymmetrically by
> transforming pairs of memory barriers into pairs consisting of
> sys_membarrier() and a compiler barrier. For synchronization primitives
> that distinguish between read-side and write-side (e.g. userspace RCU,
> rwlocks), the read-side can be accelerated significantly by moving the
> bulk of the memory barrier overhead to the write-side.

Acked-by: Paul E. McKenney 

> The first user of this system call is the "liburcu" Userspace RCU
> implementation [1]. It aims at greatly simplifying and enhancing the
> current implementation, which uses a scheme similar to the
> sys_membarrier(), but based on signals sent to each reader thread.
> Liburcu is currently packaged in all major Linux distributions.
> 
> One user of this library is the LTTng-UST (Userspace Tracing) library
> [2]. The impact of two additional memory barriers on the LTTng tracer
> fast path has been benchmarked to 35ns on our reference Intel Core Xeon
> 2.0 GHz, which adds up to about 25% performance degradation.
> 
> This patch mostly sits in kernel/sched.c (it needs to access struct rq).
> It is based on kernel v3.19, and also applies fine to master. I am
> submitting it as RFC.
> 
> Alternative approach: signals. A signal-based alternative proposed by
> Ingo would lead to important scheduler modifications, which involves
> adding context-switch in/out overhead (calling user-space upon scheduler
> switch in and out). In addition to the overhead issue, I am also
> reluctant to base a synchronization primitive on the signals, which, to
> quote Linus, are "already one of our more "exciting" layers out there",
> which does not give me the warm feeling of rock-solidness that's usually
> expected from synchronization primitives.
> 
> Changes since v11:
> - 5 years have passed.
> - Rebase on v3.19 kernel.
> - Add futex-alike PRIVATE vs SHARED semantic: private for per-process
>   barriers, non-private for memory mappings shared between processes.
> - Simplify user API.
> - Code refactoring.
> 
> Changes since v10:
> - Apply Randy's comments.
> - Rebase on 2.6.34-rc4 -tip.
> 
> Changes since v9:
> - Clean up #ifdef CONFIG_SMP.
> 
> Changes since v8:
> - Go back to rq spin locks taken by sys_membarrier() rather than adding
>   memory barriers to the scheduler. It implies a potential RoS
>   (reduction of service) if sys_membarrier() is executed in a busy-loop
>   by a user, but nothing more than what is already possible with other
>   existing system calls, but saves memory barriers in the scheduler fast
>   path.
> - re-add the memory barrier comments to x86 switch_mm() as an example to
>   other architectures.
> - Update documentation of the memory barriers in sys_membarrier and
>   switch_mm().
> - Append execution scenarios to the changelog showing the purpose of
>   each memory barrier.
> 
> Changes since v7:
> - Move spinlock-mb and scheduler related changes to separate patches.
> - Add support for sys_membarrier on x86_32.
> - Only x86 32/64 system calls are reserved in this patch. It is planned
>   to incrementally reserve syscall IDs on other architectures as these
>   are tested.
> 
> Changes since v6:
> - Remove some unlikely() not so unlikely.
> - Add the proper scheduler memory barriers needed to only use the RCU
>   read lock in sys_membarrier rather than take each runqueue spinlock:
> - Move memory barriers from per-architecture switch_mm() to schedule()
>   and finish_lock_switch(), where they clearly document that all data
>   protected by the rq lock is guaranteed to have memory barriers issued
>   between the scheduler update and the task execution. Replacing the
>   spin lock acquire/release barriers with these memory barriers imply
>   either no overhead (x86 spinlock atomic instruction already implies a
>   full mb) or some hopefully small overhead caused by the upgrade of the
>   spinlock acquire/release barriers to more heavyweight smp_mb().
> - The "generic" version of spinlock-mb.h declares both a mapping to
>   standard spinlocks and full memory barriers. Each architecture can
>   specialize this header following their own need and declare
>   CONFIG_HAVE_SPINLOCK_MB to use their own spinlock-mb.h.
> - Note: benchmarks of scheduler overhead with specialized spinlock-mb.h
>   implementations on a wide range of architecture would be welcome.
> 
> Changes since v5:
> - Plan ahead for extensibility by introducing mandatory/optional masks
>   to the "flags" system call parameter. Past experience with accept4(),
>   signalfd4(), eventfd2(), epoll_create1(), dup3(), pipe2(), and
>   inotify_init1() 

[PATCH v4 2/5] ARM: dts: Prepare exynos5410-odroidxu device tree

2015-03-15 Thread Andreas Färber
Derived from exynos5410-smdk5410.dts.

Signed-off-by: Andreas Färber 
---
 v1 -> v2 -> v3: Unchanged
 
 arch/arm/boot/dts/Makefile|  1 +
 arch/arm/boot/dts/exynos5410-odroidxu.dts | 78 +++
 2 files changed, 79 insertions(+)
 create mode 100644 arch/arm/boot/dts/exynos5410-odroidxu.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index a1c776b8dcec..b040737edcbc 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -103,6 +103,7 @@ dtb-$(CONFIG_ARCH_EXYNOS5) += \
exynos5250-snow.dtb \
exynos5250-spring.dtb \
exynos5260-xyref5260.dtb \
+   exynos5410-odroidxu.dtb \
exynos5410-smdk5410.dtb \
exynos5420-arndale-octa.dtb \
exynos5420-peach-pit.dtb \
diff --git a/arch/arm/boot/dts/exynos5410-odroidxu.dts 
b/arch/arm/boot/dts/exynos5410-odroidxu.dts
new file mode 100644
index ..97310bb727e2
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5410-odroidxu.dts
@@ -0,0 +1,78 @@
+/*
+ * Hardkernel ODROID-XU device tree source
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ *
+ * Based on exynos5410-smdk5410.dts:
+ *
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd.
+ * http://www.samsung.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.
+*/
+
+/dts-v1/;
+#include "exynos5410.dtsi"
+/ {
+   model = "ODROID-XU based on EXYNOS5410";
+   compatible = "hardkernel,odroid-xu", "samsung,exynos5410", 
"samsung,exynos5";
+
+   memory {
+   reg = <0x4000 0x8000>;
+   };
+
+   chosen {
+   bootargs = "console=ttySAC2,115200";
+   };
+
+   fin_pll: xxti {
+   compatible = "fixed-clock";
+   clock-frequency = <2400>;
+   clock-output-names = "fin_pll";
+   #clock-cells = <0>;
+   };
+
+   firmware@02037000 {
+   compatible = "samsung,secure-firmware";
+   reg = <0x02037000 0x1000>;
+   };
+
+};
+
+_0 {
+   status = "okay";
+   num-slots = <1>;
+   cap-mmc-highspeed;
+   broken-cd;
+   card-detect-delay = <200>;
+   samsung,dw-mshc-ciu-div = <3>;
+   samsung,dw-mshc-sdr-timing = <2 3>;
+   samsung,dw-mshc-ddr-timing = <1 2>;
+   bus-width = <8>;
+};
+
+_2 {
+   status = "okay";
+   num-slots = <1>;
+   cap-sd-highspeed;
+   card-detect-delay = <200>;
+   samsung,dw-mshc-ciu-div = <3>;
+   samsung,dw-mshc-sdr-timing = <2 3>;
+   samsung,dw-mshc-ddr-timing = <1 2>;
+   bus-width = <4>;
+   disable-wp;
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
+
+ {
+   status = "okay";
+};
-- 
2.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 v4 3/5] pinctrl: exynos: add exynos5410 SoC specific data

2015-03-15 Thread Andreas Färber
From: Hakjoo Kim 

Add Samsung EXYNOS5410 SoC specific data to enable pinctrl
support for all platforms based on EXYNOS5410.

Signed-off-by: Hakjoo Kim 
[AF: Rebased onto Exynos5260, irq_chip consolidation, const'ification]
Signed-off-by: Andreas Färber 
---
 v2 -> v3:
 * Rebased (.svc, .{g,w}eint_{con,mask,pend} fields dropped)
 
 v1 -> v2:
 * Filled in Sob from Hakjoo Kim
 
 .../bindings/pinctrl/samsung-pinctrl.txt   |   1 +
 drivers/pinctrl/samsung/pinctrl-exynos.c   | 103 +
 drivers/pinctrl/samsung/pinctrl-samsung.c  |   2 +
 drivers/pinctrl/samsung/pinctrl-samsung.h  |   1 +
 4 files changed, 107 insertions(+)

diff --git a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt 
b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
index 9d2a995293e6..6db16b90873a 100644
--- a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
+++ b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
@@ -17,6 +17,7 @@ Required Properties:
   - "samsung,exynos4x12-pinctrl": for Exynos4x12 compatible pin-controller.
   - "samsung,exynos5250-pinctrl": for Exynos5250 compatible pin-controller.
   - "samsung,exynos5260-pinctrl": for Exynos5260 compatible pin-controller.
+  - "samsung,exynos5410-pinctrl": for Exynos5410 compatible pin-controller.
   - "samsung,exynos5420-pinctrl": for Exynos5420 compatible pin-controller.
   - "samsung,exynos7-pinctrl": for Exynos7 compatible pin-controller.
 
diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c 
b/drivers/pinctrl/samsung/pinctrl-exynos.c
index c8f83f96546c..fa50fdd74d45 100644
--- a/drivers/pinctrl/samsung/pinctrl-exynos.c
+++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
@@ -1150,6 +1150,109 @@ const struct samsung_pin_ctrl exynos5260_pin_ctrl[] 
__initconst = {
},
 };
 
+/* pin banks of exynos5410 pin-controller 0 */
+static const struct samsung_pin_bank_data exynos5410_pin_banks0[] __initconst 
= {
+   EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpa0", 0x00),
+   EXYNOS_PIN_BANK_EINTG(6, 0x020, "gpa1", 0x04),
+   EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpa2", 0x08),
+   EXYNOS_PIN_BANK_EINTG(5, 0x060, "gpb0", 0x0c),
+   EXYNOS_PIN_BANK_EINTG(5, 0x080, "gpb1", 0x10),
+   EXYNOS_PIN_BANK_EINTG(4, 0x0A0, "gpb2", 0x14),
+   EXYNOS_PIN_BANK_EINTG(4, 0x0C0, "gpb3", 0x18),
+   EXYNOS_PIN_BANK_EINTG(7, 0x0E0, "gpc0", 0x1c),
+   EXYNOS_PIN_BANK_EINTG(4, 0x100, "gpc3", 0x20),
+   EXYNOS_PIN_BANK_EINTG(7, 0x120, "gpc1", 0x24),
+   EXYNOS_PIN_BANK_EINTG(7, 0x140, "gpc2", 0x28),
+   EXYNOS_PIN_BANK_EINTN(2, 0x160, "gpm5"),
+   EXYNOS_PIN_BANK_EINTG(8, 0x180, "gpd1", 0x2c),
+   EXYNOS_PIN_BANK_EINTG(8, 0x1A0, "gpe0", 0x30),
+   EXYNOS_PIN_BANK_EINTG(2, 0x1C0, "gpe1", 0x34),
+   EXYNOS_PIN_BANK_EINTG(6, 0x1E0, "gpf0", 0x38),
+   EXYNOS_PIN_BANK_EINTG(8, 0x200, "gpf1", 0x3c),
+   EXYNOS_PIN_BANK_EINTG(8, 0x220, "gpg0", 0x40),
+   EXYNOS_PIN_BANK_EINTG(8, 0x240, "gpg1", 0x44),
+   EXYNOS_PIN_BANK_EINTG(2, 0x260, "gpg2", 0x48),
+   EXYNOS_PIN_BANK_EINTG(4, 0x280, "gph0", 0x4c),
+   EXYNOS_PIN_BANK_EINTG(8, 0x2A0, "gph1", 0x50),
+   EXYNOS_PIN_BANK_EINTN(8, 0x2C0, "gpm7"),
+   EXYNOS_PIN_BANK_EINTN(6, 0x2E0, "gpy0"),
+   EXYNOS_PIN_BANK_EINTN(4, 0x300, "gpy1"),
+   EXYNOS_PIN_BANK_EINTN(6, 0x320, "gpy2"),
+   EXYNOS_PIN_BANK_EINTN(8, 0x340, "gpy3"),
+   EXYNOS_PIN_BANK_EINTN(8, 0x360, "gpy4"),
+   EXYNOS_PIN_BANK_EINTN(8, 0x380, "gpy5"),
+   EXYNOS_PIN_BANK_EINTN(8, 0x3A0, "gpy6"),
+   EXYNOS_PIN_BANK_EINTN(8, 0x3C0, "gpy7"),
+   EXYNOS_PIN_BANK_EINTW(8, 0xC00, "gpx0", 0x00),
+   EXYNOS_PIN_BANK_EINTW(8, 0xC20, "gpx1", 0x04),
+   EXYNOS_PIN_BANK_EINTW(8, 0xC40, "gpx2", 0x08),
+   EXYNOS_PIN_BANK_EINTW(8, 0xC60, "gpx3", 0x0c),
+};
+
+/* pin banks of exynos5410 pin-controller 1 */
+static const struct samsung_pin_bank_data exynos5410_pin_banks1[] __initconst 
= {
+   EXYNOS_PIN_BANK_EINTG(5, 0x000, "gpj0", 0x00),
+   EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpj1", 0x04),
+   EXYNOS_PIN_BANK_EINTG(8, 0x040, "gpj2", 0x08),
+   EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpj3", 0x0c),
+   EXYNOS_PIN_BANK_EINTG(2, 0x080, "gpj4", 0x10),
+   EXYNOS_PIN_BANK_EINTG(8, 0x0A0, "gpk0", 0x14),
+   EXYNOS_PIN_BANK_EINTG(8, 0x0C0, "gpk1", 0x18),
+   EXYNOS_PIN_BANK_EINTG(8, 0x0E0, "gpk2", 0x1c),
+   EXYNOS_PIN_BANK_EINTG(7, 0x100, "gpk3", 0x20),
+};
+
+/* pin banks of exynos5410 pin-controller 2 */
+static const struct samsung_pin_bank_data exynos5410_pin_banks2[] __initconst 
= {
+   EXYNOS_PIN_BANK_EINTG(8, 0x000, "gpv0", 0x00),
+   EXYNOS_PIN_BANK_EINTG(8, 0x020, "gpv1", 0x04),
+   EXYNOS_PIN_BANK_EINTG(8, 0x060, "gpv2", 0x08),
+   EXYNOS_PIN_BANK_EINTG(8, 0x080, "gpv3", 0x0c),
+   EXYNOS_PIN_BANK_EINTG(2, 0x0C0, "gpv4", 0x10),
+};
+
+/* pin banks of exynos5410 pin-controller 3 */
+static const struct samsung_pin_bank_data exynos5410_pin_banks3[] 

[PATCH v4 5/5] ARM: dts: Add LEDs to exynos5410-odroidxu

2015-03-15 Thread Andreas Färber
Signed-off-by: Hakjoo Kim 
Signed-off-by: Andreas Färber 
---
 v2 -> v3: Unchanged
 
 v1 -> v2:
 * Filled in Sob from Hakjoo Kim
 
 arch/arm/boot/dts/exynos5410-odroidxu.dts | 25 +
 1 file changed, 25 insertions(+)

diff --git a/arch/arm/boot/dts/exynos5410-odroidxu.dts 
b/arch/arm/boot/dts/exynos5410-odroidxu.dts
index 97310bb727e2..b02cd3ab7b38 100644
--- a/arch/arm/boot/dts/exynos5410-odroidxu.dts
+++ b/arch/arm/boot/dts/exynos5410-odroidxu.dts
@@ -15,6 +15,7 @@
 
 /dts-v1/;
 #include "exynos5410.dtsi"
+#include 
 / {
model = "ODROID-XU based on EXYNOS5410";
compatible = "hardkernel,odroid-xu", "samsung,exynos5410", 
"samsung,exynos5";
@@ -39,6 +40,30 @@
reg = <0x02037000 0x1000>;
};
 
+   leds {
+   compatible = "gpio-leds";
+
+   blue {
+   label = "blue:heartbeat";
+   gpios = < 2 GPIO_ACTIVE_HIGH>;
+   default-state = "off";
+   linux,default-trigger = "heartbeat";
+   };
+
+   green {
+   label = "green:activity";
+   gpios = < 1 GPIO_ACTIVE_HIGH>;
+   default-state = "off";
+   linux,default-trigger = "mmc0";
+   };
+
+   red {
+   label = "red:activity";
+   gpios = < 3 GPIO_ACTIVE_HIGH>;
+   default-state = "off";
+   linux,default-trigger = "mmc1";
+   };
+   };
 };
 
 _0 {
-- 
2.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 v4 4/5] ARM: dts: add pinctrl support to Exynos5410

2015-03-15 Thread Andreas Färber
From: Hakjoo Kim 

Add the required pin configuration support to Exynos5410 using pinctrl
interface.

Signed-off-by: Hakjoo Kim 
[AF: Rebased, style changes]
Signed-off-by: Andreas Färber 
---
 v2 -> v3:
 * Added wake-up IRQ controller node (Tomasz Figa)
 
 v1 -> v2:
 * Filled in Sob from Hakjoo Kim
 
 arch/arm/boot/dts/exynos5410-pinctrl.dtsi | 406 ++
 arch/arm/boot/dts/exynos5410.dtsi |  36 +++
 2 files changed, 442 insertions(+)
 create mode 100644 arch/arm/boot/dts/exynos5410-pinctrl.dtsi

diff --git a/arch/arm/boot/dts/exynos5410-pinctrl.dtsi 
b/arch/arm/boot/dts/exynos5410-pinctrl.dtsi
new file mode 100644
index ..f9aa6bb55464
--- /dev/null
+++ b/arch/arm/boot/dts/exynos5410-pinctrl.dtsi
@@ -0,0 +1,406 @@
+/*
+ * Exynos5410 SoC pin-mux and pin-config device tree source
+ *
+ * Copyright (c) 2013 Hardkernel Co., Ltd.
+ *  http://www.hardkernel.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.
+ */
+
+_0 {
+   gpa0: gpa0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpa1: gpa1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpa2: gpa2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb0: gpb0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb1: gpb1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb2: gpb2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpb3: gpb3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc0: gpc0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc3: gpc3 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc1: gpc1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpc2: gpc2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpm5: gpm5 {
+   gpio-controller;
+   #gpio-cells = <2>;
+   };
+
+   gpd1: gpd1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpe0: gpe0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpe1: gpe1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf0: gpf0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpf1: gpf1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg0: gpg0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg1: gpg1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gpg2: gpg2 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gph0: gph0 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   interrupt-controller;
+   #interrupt-cells = <2>;
+   };
+
+   gph1: gph1 {
+   gpio-controller;
+   #gpio-cells = <2>;
+
+   

  1   2   3   4   5   6   >