[PATCH] kvm: irqchip: fix memory leak

2015-09-02 Thread Sudip Mukherjee
We were taking the exit path after checking ue->flags and return value
of setup_routing_entry(), but 'e' was not freed incase of a failure.

Signed-off-by: Sudip Mukherjee 
---
 virt/kvm/irqchip.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 21c1424..c63e54f 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm,
goto out;
 
r = -EINVAL;
-   if (ue->flags)
+   if (ue->flags) {
+   kfree(e);
goto out;
+   }
r = setup_routing_entry(new, e, ue);
-   if (r)
+   if (r) {
+   kfree(e);
goto out;
+   }
++ue;
}
 
-- 
1.9.1

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


Re: [PATCH 2/3] rhashtable-test: retry insert operations in threads

2015-09-02 Thread Thomas Graf
On 09/02/15 at 10:00am, Herbert Xu wrote:
> On Tue, Sep 01, 2015 at 04:51:24PM +0200, Thomas Graf wrote:
> >
> > 1. The current in-kernel self-test
> > 2. bind_netlink.c: https://github.com/tgraf/rhashtable
> 
> Thanks, I will try to reproduce this.

The path in question is:

int rhashtable_insert_rehash(struct rhashtable *ht)
{
[...]

old_tbl = rht_dereference_rcu(ht->tbl, ht);
tbl = rhashtable_last_table(ht, old_tbl);

size = tbl->size;

if (rht_grow_above_75(ht, tbl))
size *= 2;
/* Do not schedule more than one rehash */
else if (old_tbl != tbl)
return -EBUSY;

The behaviour in question is the immediate rehash during
insertion which we want to fail.

Commits:
ccd57b1bd32460d27bbb9c599e795628a3c66983
a87b9ebf1709687ff213091d0fdb4254b1564803
--
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 2/3] mmc: sdhci: add host_ops->voltage_switch callback for all other voltages

2015-09-02 Thread Jisheng Zhang
On Wed, 2 Sep 2015 01:02:17 +0530
Vaibhav Hiremath  wrote:

> Currently, the sdhci_do_start_signal_voltage_switch() function invokes
> controller specific voltage switch configuration only for 1.8v usecase;
> but it is required for others as well.
> 
> For example, in case of PXA1928 SDH controller, we need to set different
> configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power
> control register).
> 
> Signed-off-by: Vaibhav Hiremath 
> ---
> Note:
> Currently ->voltage_switch() callback is only supported
> in f_sdh30 driver. And I am not sure on the dependency of execution
> sequence for that device. I could have moved ->voltage_switch() call
> at one common place (above/below), but was not quite sure about it.
> So, replicated/duplicated the call for other voltages.
> 
>  drivers/mmc/host/sdhci.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 3dd295f..b59b76d 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct 
> sdhci_host *host,
>   /* Wait for 5ms */
>   usleep_range(5000, 5500);
>  
> + /* Some controller need to do more when switching */
> + if (host->ops->voltage_switch)
> + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330);

Could this be implemented by regulator API? From patch set 3/3, the pxa1928
voltage_switch hook is to operate the IO pad registers, this seems not belong
to the SDHC IP core.

Thanks,
Jisheng

> +
>   /* 3.3V regulator output should be stable within 5 ms */
>   ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
>   if (!(ctrl & SDHCI_CTRL_VDD_180))
> @@ -1803,6 +1807,10 @@ static int sdhci_do_start_signal_voltage_switch(struct 
> sdhci_host *host,
>   return -EIO;
>   }
>   }
> + /* Some controller need to do more when switching */
> + if (host->ops->voltage_switch)
> + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_120);
> +
>   return 0;
>   default:
>   /* No signal voltage switch required */

--
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 Resend 3/5] PM / OPP: Move opp core to its own directory

2015-09-02 Thread Viresh Kumar
On 01-09-15, 15:51, Stephen Boyd wrote:
> It's odd that we use CONFIG_DEBUG_DRIVER here when that's talking
> about debugging the driver core. I wonder why this wouldn't be
> some OPP specific debug config option instead. But that was
> already there before so this topic is for another patch.

I agree.. Maybe a separate patch to add Kconfig for both
drivers/base/power and drivers/base/power/opp directories.

-- 
viresh
--
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-next: build failure after merge of the rcu tree

2015-09-02 Thread Paul E. McKenney
On Tue, Sep 01, 2015 at 11:40:51PM -0700, Davidlohr Bueso wrote:
> On Tue, 2015-09-01 at 22:26 -0700, Paul E. McKenney wrote:
> > Davidlohr, the error is due to sched_setscheduler_nocheck() not being
> > exported, so that Stephen gets this failure when building modules.
> > This is 04be76a9b067 (locktorture: Support rtmutex torturing) in -rcu.
> > 
> > Thoughts?
> 
> Right, the below should take care of it. Although I think it makes sense
> to get this into at least 4.3 even if we won't use it until 4.4. Simply
> because we already export sched_setscheduler(). If you agree I guess we
> could route via -tip.

Given an ack from Peter or Ingo, I would happy to queue it.  But we are
talking 4.4 rather than 4.3, sorry!

Thanx, Paul

> Thanks,
> Davidlohr
> 
> 8<
> Subject: [PATCH -next] sched: Export sched_setscheduler_nocheck
> 
> ... just like regular sched_setscheduler(). We need this, for locktorture
> otherwise we can fail to build modules, ie:
> 
> ERROR: "sched_setscheduler_nocheck" [kernel/locking/locktorture.ko] undefined!
> 
> Signed-off-by: Davidlohr Bueso 
> Reported-by: Stephen Rothwell 
> Cc: Ingo Molnar 
> ---
>  kernel/sched/core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 3595403..7b51f64 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4012,6 +4012,7 @@ int sched_setscheduler_nocheck(struct task_struct *p, 
> int policy,
>  {
>   return _sched_setscheduler(p, policy, param, false);
>  }
> +EXPORT_SYMBOL_GPL(sched_setscheduler_nocheck);
> 
>  static int
>  do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user 
> *param)
> -- 
> 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/


Re: [PATCH V2 Resend 2/5] PM / OPP: Prefix exported opp routines with dev_pm_opp_

2015-09-02 Thread Viresh Kumar
On 01-09-15, 21:03, Pavel Machek wrote:
> Is ..._free_table opposite of ..._init_opp? If so, you might want to
> name them such that it is clear...

Yes, it is opposite of that. Okay, so here is a new patch for this,
lemme know if this looks fine. I will then resend the whole series
again..

@Stephen: Thanks for your reviews, just few more to go (in this
series) :).


Message-Id: 

From: Viresh Kumar 
Date: Wed, 2 Sep 2015 11:23:44 +0530
Subject: [PATCH 1/3] PM / OPP: Rename opp init/free table routines

free-table routines are opposite of init-table ones, and must be named
to make that clear. Opposite of 'init' is 'exit', but those doesn't suit
really well.

Replace 'init' with 'add' and 'free' with 'remove'.

Reported-by: Pavel Machek 
Signed-off-by: Viresh Kumar 
---
 arch/arm/mach-imx/mach-imx6q.c   |  2 +-
 drivers/base/power/opp.c | 41 ++--
 drivers/cpufreq/arm_big_little.h |  2 +-
 drivers/cpufreq/arm_big_little_dt.c  |  4 ++--
 drivers/cpufreq/cpufreq-dt.c |  6 +++---
 drivers/cpufreq/exynos5440-cpufreq.c |  6 +++---
 drivers/cpufreq/imx6q-cpufreq.c  |  6 +++---
 drivers/cpufreq/mt8173-cpufreq.c |  6 +++---
 include/linux/pm_opp.h   | 16 +++---
 9 files changed, 44 insertions(+), 45 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 9602cc12d2f1..3286eec91d92 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -350,7 +350,7 @@ static void __init imx6q_opp_init(void)
return;
}
 
-   if (of_init_opp_table(cpu_dev)) {
+   if (of_add_opp_table(cpu_dev)) {
pr_warn("failed to init OPP table\n");
goto put_node;
}
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 4741fdc13e83..1515c05bc579 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -800,8 +800,8 @@ static int _opp_add(struct device *dev, struct dev_pm_opp 
*new_opp,
  * The opp is made available by default and it can be controlled using
  * dev_pm_opp_enable/disable functions and may be removed by dev_pm_opp_remove.
  *
- * NOTE: "dynamic" parameter impacts OPPs added by the of_init_opp_table and
- * freed by of_free_opp_table.
+ * NOTE: "dynamic" parameter impacts OPPs added by the of_add_opp_table and
+ * freed by of_remove_opp_table.
  *
  * Locking: The internal device_opp and opp structures are RCU protected.
  * Hence this function internally uses RCU updater strategy with mutex locks
@@ -1185,7 +1185,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
 
 #ifdef CONFIG_OF
 /**
- * of_free_opp_table() - Free OPP table entries created from static DT entries
+ * of_remove_opp_table() - Free OPP table entries created from static DT 
entries
  * @dev:   device pointer used to lookup device OPPs.
  *
  * Free OPPs created using static entries present in DT.
@@ -1196,7 +1196,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
  * that this function is *NOT* called under RCU protection or in contexts where
  * mutex cannot be locked.
  */
-void of_free_opp_table(struct device *dev)
+void of_remove_opp_table(struct device *dev)
 {
struct device_opp *dev_opp;
struct dev_pm_opp *opp, *tmp;
@@ -1231,9 +1231,9 @@ void of_free_opp_table(struct device *dev)
 unlock:
mutex_unlock(&dev_opp_list_lock);
 }
-EXPORT_SYMBOL_GPL(of_free_opp_table);
+EXPORT_SYMBOL_GPL(of_remove_opp_table);
 
-void of_cpumask_free_opp_table(cpumask_var_t cpumask)
+void of_cpumask_remove_opp_table(cpumask_var_t cpumask)
 {
struct device *cpu_dev;
int cpu;
@@ -1248,10 +1248,10 @@ void of_cpumask_free_opp_table(cpumask_var_t cpumask)
continue;
}
 
-   of_free_opp_table(cpu_dev);
+   of_remove_opp_table(cpu_dev);
}
 }
-EXPORT_SYMBOL_GPL(of_cpumask_free_opp_table);
+EXPORT_SYMBOL_GPL(of_cpumask_remove_opp_table);
 
 /* Returns opp descriptor node for a device, caller must do of_node_put() */
 static struct device_node *_of_get_opp_desc_node(struct device *dev)
@@ -1267,8 +1267,7 @@ static struct device_node *_of_get_opp_desc_node(struct 
device *dev)
 }
 
 /* Initializes OPP tables based on new bindings */
-static int _of_init_opp_table_v2(struct device *dev,
-struct device_node *opp_np)
+static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np)
 {
struct device_node *np;
struct device_opp *dev_opp;
@@ -1310,13 +1309,13 @@ static int _of_init_opp_table_v2(struct device *dev,
return 0;
 
 free_table:
-   of_free_opp_table(dev);
+   of_remove_opp_table(dev);
 
return ret;
 }
 
 /* Initializes OPP tables based on old-deprecated bindings */
-static int _of_init_opp_table_v1(struct device *dev)
+static int _of_add_opp_table_v1(struct device *dev)
 {
const struct property *prop;
const __be32 *val;
@@ -13

Re: [GIT PULL 0/3] perf/urgent fixes

2015-09-02 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> Hi Ingo,
> 
>   Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit 532026612455a4a6fd27c1b2e7111263f63218a2:
> 
>   Merge tag 'perf-core-for-mingo' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent 
> (2015-09-01 10:25:57 +0200)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git 
> tags/perf-urgent-for-mingo
> 
> for you to fetch changes up to af4aeadd8c04303c0aa2d112145c3627e2ebd026:
> 
>   perf tools: Fix link time error with sample_reg_masks on non x86 
> (2015-09-01 13:04:41 -0300)
> 
> 
> perf/urgent fixes:
> 
> - Fix link time error with sample_reg_masks on non x86 (Stephane Eranian)
> 
> - Fix potential array out of bounds access (Wang Nan)
> 
> - Fix Intel PT instruction decoder dependency problem (Wang Nan)
> 
> Signed-off-by: Arnaldo Carvalho de Melo 
> 
> 
> Stephane Eranian (1):
>   perf tools: Fix link time error with sample_reg_masks on non x86
> 
> Wang Nan (2):
>   perf dwarf: Fix potential array out of bounds access
>   perf build: Fix Intel PT instruction decoder dependency problem
> 
>  tools/perf/arch/sh/util/dwarf-regs.c|  2 +-
>  tools/perf/arch/sparc/util/dwarf-regs.c |  2 +-
>  tools/perf/arch/x86/util/dwarf-regs.c   |  2 +-
>  tools/perf/arch/x86/util/perf_regs.c| 44 
> -
>  tools/perf/util/intel-pt-decoder/Build  |  1 +
>  tools/perf/util/perf_regs.c |  4 +++
>  tools/perf/util/perf_regs.h |  2 ++
>  7 files changed, 31 insertions(+), 26 deletions(-)

Pulled, thanks a lot Arnaldo!

Ingo
--
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 Resend 2/5] PM / OPP: Prefix exported opp routines with dev_pm_opp_

2015-09-02 Thread Viresh Kumar
On 02-09-15, 12:52, Viresh Kumar wrote:
> On 01-09-15, 21:03, Pavel Machek wrote:
> > Is ..._free_table opposite of ..._init_opp? If so, you might want to
> > name them such that it is clear...
> 
> Yes, it is opposite of that. Okay, so here is a new patch for this,
> lemme know if this looks fine. I will then resend the whole series
> again..
> 
> @Stephen: Thanks for your reviews, just few more to go (in this
> series) :).
> 
> 
> Message-Id: 
> 
> From: Viresh Kumar 
> Date: Wed, 2 Sep 2015 11:23:44 +0530
> Subject: [PATCH 1/3] PM / OPP: Rename opp init/free table routines

And here is the new updated version of $SUBJECT patch rebased over
above commit:

@Stephen: I have dropped your Reviewed-by tag as this patch got
updated. Please give it again.

8<-

From: Viresh Kumar 
Date: Mon, 3 Aug 2015 14:34:23 +0530
Subject: [PATCH 2/3] PM / OPP: Prefix exported opp routines with dev_pm_opp_

That's the naming convention followed in most of opp core, but few
routines didn't follow this, fix them.

Signed-off-by: Viresh Kumar 
---
 arch/arm/mach-imx/mach-imx6q.c   |  2 +-
 drivers/base/power/opp.c | 41 ++--
 drivers/cpufreq/arm_big_little.h |  2 +-
 drivers/cpufreq/arm_big_little_dt.c  |  4 ++--
 drivers/cpufreq/cpufreq-dt.c | 10 -
 drivers/cpufreq/exynos5440-cpufreq.c |  6 +++---
 drivers/cpufreq/imx6q-cpufreq.c  |  6 +++---
 drivers/cpufreq/mt8173-cpufreq.c |  6 +++---
 include/linux/pm_opp.h   | 24 ++---
 9 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 3286eec91d92..3878494bd118 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -350,7 +350,7 @@ static void __init imx6q_opp_init(void)
return;
}
 
-   if (of_add_opp_table(cpu_dev)) {
+   if (dev_pm_opp_of_add_table(cpu_dev)) {
pr_warn("failed to init OPP table\n");
goto put_node;
}
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 1515c05bc579..f42ffa517156 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -800,8 +800,8 @@ static int _opp_add(struct device *dev, struct dev_pm_opp 
*new_opp,
  * The opp is made available by default and it can be controlled using
  * dev_pm_opp_enable/disable functions and may be removed by dev_pm_opp_remove.
  *
- * NOTE: "dynamic" parameter impacts OPPs added by the of_add_opp_table and
- * freed by of_remove_opp_table.
+ * NOTE: "dynamic" parameter impacts OPPs added by the dev_pm_opp_of_add_table
+ * and freed by dev_pm_opp_of_remove_table.
  *
  * Locking: The internal device_opp and opp structures are RCU protected.
  * Hence this function internally uses RCU updater strategy with mutex locks
@@ -1185,7 +1185,8 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
 
 #ifdef CONFIG_OF
 /**
- * of_remove_opp_table() - Free OPP table entries created from static DT 
entries
+ * dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT
+ *   entries
  * @dev:   device pointer used to lookup device OPPs.
  *
  * Free OPPs created using static entries present in DT.
@@ -1196,7 +1197,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
  * that this function is *NOT* called under RCU protection or in contexts where
  * mutex cannot be locked.
  */
-void of_remove_opp_table(struct device *dev)
+void dev_pm_opp_of_remove_table(struct device *dev)
 {
struct device_opp *dev_opp;
struct dev_pm_opp *opp, *tmp;
@@ -1231,9 +1232,9 @@ void of_remove_opp_table(struct device *dev)
 unlock:
mutex_unlock(&dev_opp_list_lock);
 }
-EXPORT_SYMBOL_GPL(of_remove_opp_table);
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);
 
-void of_cpumask_remove_opp_table(cpumask_var_t cpumask)
+void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask)
 {
struct device *cpu_dev;
int cpu;
@@ -1248,10 +1249,10 @@ void of_cpumask_remove_opp_table(cpumask_var_t cpumask)
continue;
}
 
-   of_remove_opp_table(cpu_dev);
+   dev_pm_opp_of_remove_table(cpu_dev);
}
 }
-EXPORT_SYMBOL_GPL(of_cpumask_remove_opp_table);
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table);
 
 /* Returns opp descriptor node for a device, caller must do of_node_put() */
 static struct device_node *_of_get_opp_desc_node(struct device *dev)
@@ -1309,7 +1310,7 @@ static int _of_add_opp_table_v2(struct device *dev, 
struct device_node *opp_np)
return 0;
 
 free_table:
-   of_remove_opp_table(dev);
+   dev_pm_opp_of_remove_table(dev);
 
return ret;
 }
@@ -1352,7 +1353,7 @@ static int _of_add_opp_table_v1(struct device *dev)
 }
 
 /**
- * of_add_opp_table() - Initialize opp table from device tree
+ * dev_pm_opp_of_add_table() - Initialize opp tabl

[tip:perf/urgent] perf dwarf: Fix potential array out of bounds access

2015-09-02 Thread tip-bot for Wang Nan
Commit-ID:  3b27d13940c3710a1128527c43719cb0bb05d73b
Gitweb: http://git.kernel.org/tip/3b27d13940c3710a1128527c43719cb0bb05d73b
Author: Wang Nan 
AuthorDate: Tue, 1 Sep 2015 03:29:44 +
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 1 Sep 2015 11:33:48 -0300

perf dwarf: Fix potential array out of bounds access

There is a problem in the dwarf-regs.c files for sh, sparc and x86 where
it is possible to make an out-of-bounds array access when searching for
register names.

This patch fixes it by replacing '<=' to '<', so when register (number
== XXX_MAX_REGS), get_arch_regstr() will return NULL.

Signed-off-by: Wang Nan 
Reviewed-by: Matt Fleming 
Acked-by: Jiri Olsa 
Acked-by: Masami Hiramatsu 
Cc: David S. Miller 
Cc: Zefan Li 
Cc: pi3or...@huawei.com
Link: 
http://lkml.kernel.org/r/1441078184-105038-1-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/sh/util/dwarf-regs.c| 2 +-
 tools/perf/arch/sparc/util/dwarf-regs.c | 2 +-
 tools/perf/arch/x86/util/dwarf-regs.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/arch/sh/util/dwarf-regs.c 
b/tools/perf/arch/sh/util/dwarf-regs.c
index 0d0897f..f8dfa89 100644
--- a/tools/perf/arch/sh/util/dwarf-regs.c
+++ b/tools/perf/arch/sh/util/dwarf-regs.c
@@ -51,5 +51,5 @@ const char *sh_regs_table[SH_MAX_REGS] = {
 /* Return architecture dependent register string (for kprobe-tracer) */
 const char *get_arch_regstr(unsigned int n)
 {
-   return (n <= SH_MAX_REGS) ? sh_regs_table[n] : NULL;
+   return (n < SH_MAX_REGS) ? sh_regs_table[n] : NULL;
 }
diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c 
b/tools/perf/arch/sparc/util/dwarf-regs.c
index 92eda41..b704fdb 100644
--- a/tools/perf/arch/sparc/util/dwarf-regs.c
+++ b/tools/perf/arch/sparc/util/dwarf-regs.c
@@ -39,5 +39,5 @@ const char *sparc_regs_table[SPARC_MAX_REGS] = {
  */
 const char *get_arch_regstr(unsigned int n)
 {
-   return (n <= SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
+   return (n < SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
 }
diff --git a/tools/perf/arch/x86/util/dwarf-regs.c 
b/tools/perf/arch/x86/util/dwarf-regs.c
index be22dd4..a08de0a 100644
--- a/tools/perf/arch/x86/util/dwarf-regs.c
+++ b/tools/perf/arch/x86/util/dwarf-regs.c
@@ -71,5 +71,5 @@ const char *x86_64_regs_table[X86_64_MAX_REGS] = {
 /* Return architecture dependent register string (for kprobe-tracer) */
 const char *get_arch_regstr(unsigned int n)
 {
-   return (n <= ARCH_MAX_REGS) ? arch_regs_table[n] : NULL;
+   return (n < ARCH_MAX_REGS) ? arch_regs_table[n] : NULL;
 }
--
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/


[tip:perf/urgent] perf build: Fix Intel PT instruction decoder dependency problem

2015-09-02 Thread tip-bot for Wang Nan
Commit-ID:  04aa90b529ee45c5ee88997bc214202e07b26979
Gitweb: http://git.kernel.org/tip/04aa90b529ee45c5ee88997bc214202e07b26979
Author: Wang Nan 
AuthorDate: Tue, 1 Sep 2015 05:56:45 +
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 1 Sep 2015 13:03:46 -0300

perf build: Fix Intel PT instruction decoder dependency problem

I hit following building error randomly:

...
  /bin/sh: /path/to/kernel/buildperf/util/intel-pt-decoder/inat-tables.c: No 
such file or directory
...
LINK /path/to/kernel/buildperf/plugin_mac80211.so
LINK /path/to/kernel/buildperf/plugin_kmem.so
LINK /path/to/kernel/buildperf/plugin_xen.so
LINK /path/to/kernel/buildperf/plugin_hrtimer.so
  In file included from util/intel-pt-decoder/intel-pt-insn-decoder.c:25:0:
  util/intel-pt-decoder/inat.c:24:25: fatal error: inat-tables.c: No such file 
or directory
   #include "inat-tables.c"
   ^
  compilation terminated.
  make[4]: *** 
[/path/to/kernel/buildperf/util/intel-pt-decoder/intel-pt-insn-decoder.o] Error 
1
  make[4]: *** Waiting for unfinished jobs
LINK /path/to/kernel/buildperf/plugin_function.so

This is caused by tools/perf/util/intel-pt-decoder/Build that, it tries
to generate $(OUTPUT)util/intel-pt-decoder/inat-tables.c atomatically
but forget to ensure the existance of $(OUTPUT)util/intel-pt-decoder
directory.

This patch fixes it by adding $(call rule_mkdir) like other similar rules.

Signed-off-by: Wang Nan 
Acked-by: Adrian Hunter 
Acked-by: Jiri Olsa 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1441087005-107540-1-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/intel-pt-decoder/Build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/intel-pt-decoder/Build 
b/tools/perf/util/intel-pt-decoder/Build
index 240730d..2386322 100644
--- a/tools/perf/util/intel-pt-decoder/Build
+++ b/tools/perf/util/intel-pt-decoder/Build
@@ -4,6 +4,7 @@ inat_tables_script = util/intel-pt-decoder/gen-insn-attr-x86.awk
 inat_tables_maps = util/intel-pt-decoder/x86-opcode-map.txt
 
 $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) 
$(inat_tables_maps)
+   $(call rule_mkdir)
@$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) 
$(inat_tables_maps) > $@ || rm -f $@
 
 $(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: 
util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c
--
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/


[tip:perf/urgent] perf tools: Fix link time error with sample_reg_masks on non x86

2015-09-02 Thread tip-bot for Stephane Eranian
Commit-ID:  af4aeadd8c04303c0aa2d112145c3627e2ebd026
Gitweb: http://git.kernel.org/tip/af4aeadd8c04303c0aa2d112145c3627e2ebd026
Author: Stephane Eranian 
AuthorDate: Tue, 1 Sep 2015 11:30:14 +0200
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 1 Sep 2015 13:04:41 -0300

perf tools: Fix link time error with sample_reg_masks on non x86

This patch makes perf compile on non x86 platforms by defining a weak
symbol for sample_reg_masks[] in util/perf_regs.c.

The patch also moves the REG() and REG_END() macros into the
util/per_regs.h header file. The macros are renamed to
SMPL_REG/SMPL_REG_END to avoid clashes with other header files.

Signed-off-by: Stephane Eranian 
Acked-by: Jiri Olsa 
Cc: Adrian Hunter 
Cc: Andi Kleen 
Cc: David Ahern 
Cc: Kan Liang 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1441099814-26783-1-git-send-email-eran...@google.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/x86/util/perf_regs.c | 44 +---
 tools/perf/util/perf_regs.c  |  4 
 tools/perf/util/perf_regs.h  |  2 ++
 3 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/tools/perf/arch/x86/util/perf_regs.c 
b/tools/perf/arch/x86/util/perf_regs.c
index 087c84e..c5db14f 100644
--- a/tools/perf/arch/x86/util/perf_regs.c
+++ b/tools/perf/arch/x86/util/perf_regs.c
@@ -1,30 +1,28 @@
 #include "../../perf.h"
 #include "../../util/perf_regs.h"
 
-#define REG(n, b) { .name = #n, .mask = 1ULL << (b) }
-#define REG_END { .name = NULL }
 const struct sample_reg sample_reg_masks[] = {
-   REG(AX, PERF_REG_X86_AX),
-   REG(BX, PERF_REG_X86_BX),
-   REG(CX, PERF_REG_X86_CX),
-   REG(DX, PERF_REG_X86_DX),
-   REG(SI, PERF_REG_X86_SI),
-   REG(DI, PERF_REG_X86_DI),
-   REG(BP, PERF_REG_X86_BP),
-   REG(SP, PERF_REG_X86_SP),
-   REG(IP, PERF_REG_X86_IP),
-   REG(FLAGS, PERF_REG_X86_FLAGS),
-   REG(CS, PERF_REG_X86_CS),
-   REG(SS, PERF_REG_X86_SS),
+   SMPL_REG(AX, PERF_REG_X86_AX),
+   SMPL_REG(BX, PERF_REG_X86_BX),
+   SMPL_REG(CX, PERF_REG_X86_CX),
+   SMPL_REG(DX, PERF_REG_X86_DX),
+   SMPL_REG(SI, PERF_REG_X86_SI),
+   SMPL_REG(DI, PERF_REG_X86_DI),
+   SMPL_REG(BP, PERF_REG_X86_BP),
+   SMPL_REG(SP, PERF_REG_X86_SP),
+   SMPL_REG(IP, PERF_REG_X86_IP),
+   SMPL_REG(FLAGS, PERF_REG_X86_FLAGS),
+   SMPL_REG(CS, PERF_REG_X86_CS),
+   SMPL_REG(SS, PERF_REG_X86_SS),
 #ifdef HAVE_ARCH_X86_64_SUPPORT
-   REG(R8, PERF_REG_X86_R8),
-   REG(R9, PERF_REG_X86_R9),
-   REG(R10, PERF_REG_X86_R10),
-   REG(R11, PERF_REG_X86_R11),
-   REG(R12, PERF_REG_X86_R12),
-   REG(R13, PERF_REG_X86_R13),
-   REG(R14, PERF_REG_X86_R14),
-   REG(R15, PERF_REG_X86_R15),
+   SMPL_REG(R8, PERF_REG_X86_R8),
+   SMPL_REG(R9, PERF_REG_X86_R9),
+   SMPL_REG(R10, PERF_REG_X86_R10),
+   SMPL_REG(R11, PERF_REG_X86_R11),
+   SMPL_REG(R12, PERF_REG_X86_R12),
+   SMPL_REG(R13, PERF_REG_X86_R13),
+   SMPL_REG(R14, PERF_REG_X86_R14),
+   SMPL_REG(R15, PERF_REG_X86_R15),
 #endif
-   REG_END
+   SMPL_REG_END
 };
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 43168fb..885e8ac 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -2,6 +2,10 @@
 #include "perf_regs.h"
 #include "event.h"
 
+const struct sample_reg __weak sample_reg_masks[] = {
+   SMPL_REG_END
+};
+
 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
 {
int i, idx = 0;
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index 92c1fff..2984dcc 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -9,6 +9,8 @@ struct sample_reg {
const char *name;
uint64_t mask;
 };
+#define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) }
+#define SMPL_REG_END { .name = NULL }
 
 extern const struct sample_reg sample_reg_masks[];
 
--
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-next: build failure after merge of the rcu tree

2015-09-02 Thread Ingo Molnar

* Paul E. McKenney  wrote:

> On Tue, Sep 01, 2015 at 11:40:51PM -0700, Davidlohr Bueso wrote:
> > On Tue, 2015-09-01 at 22:26 -0700, Paul E. McKenney wrote:
> > > Davidlohr, the error is due to sched_setscheduler_nocheck() not being
> > > exported, so that Stephen gets this failure when building modules.
> > > This is 04be76a9b067 (locktorture: Support rtmutex torturing) in -rcu.
> > > 
> > > Thoughts?
> > 
> > Right, the below should take care of it. Although I think it makes sense
> > to get this into at least 4.3 even if we won't use it until 4.4. Simply
> > because we already export sched_setscheduler(). If you agree I guess we
> > could route via -tip.
> 
> Given an ack from Peter or Ingo, I would happy to queue it.  But we are
> talking 4.4 rather than 4.3, sorry!

The export looks good to me:

Acked-by: Ingo Molnar 

Thanks,

Ingo
--
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 v6 0/3] KVM: Dynamic Halt-Polling

2015-09-02 Thread Wanpeng Li
v5 -> v6:
 * fix wait_ns and poll_ns 

v4 -> v5:
 * set base case 10us and max poll time 500us
 * handle short/long halt, idea from David, many thanks David ;-)

v3 -> v4:
 * bring back grow vcpu->halt_poll_ns when interrupt arrives and shrinks
   when idle VCPU is detected 

v2 -> v3:
 * grow/shrink vcpu->halt_poll_ns by *halt_poll_ns_grow or /halt_poll_ns_shrink
 * drop the macros and hard coding the numbers in the param definitions
 * update the comments "5-7 us"
 * remove halt_poll_ns_max and use halt_poll_ns as the max halt_poll_ns time,
   vcpu->halt_poll_ns start at zero
 * drop the wrappers 
 * move the grow/shrink logic before "out:" w/ "if (waited)"

v1 -> v2:
 * change kvm_vcpu_block to read halt_poll_ns from the vcpu instead of 
   the module parameter
 * use the shrink/grow matrix which is suggested by David
 * set halt_poll_ns_max to 2ms

There is a downside of always-poll since poll is still happened for idle 
vCPUs which can waste cpu usage. This patchset add the ability to adjust 
halt_poll_ns dynamically, to grow halt_poll_ns when shot halt is detected,  
and to shrink halt_poll_ns when long halt is detected.

There are two new kernel parameters for changing the halt_poll_ns:
halt_poll_ns_grow and halt_poll_ns_shrink. 

no-poll  always-polldynamic-poll
---
Idle (nohz) vCPU %c0 0.15%0.3%0.2%  
Idle (250HZ) vCPU %c01.1% 4.6%~14%1.2%
TCP_RR latency   34us 27us26.7us

"Idle (X) vCPU %c0" is the percent of time the physical cpu spent in
c0 over 60 seconds (each vCPU is pinned to a pCPU). (nohz) means the
guest was tickless. (250HZ) means the guest was ticking at 250HZ.

The big win is with ticking operating systems. Running the linux guest
with nohz=off (and HZ=250), we save 3.4%~12.8% CPUs/second and get close 
to no-polling overhead levels by using the dynamic-poll. The savings
should be even higher for higher frequency ticks.


Wanpeng Li (3):
  KVM: make halt_poll_ns per-vCPU
  KVM: dynamic halt_poll_ns adjustment
  KVM: trace kvm_halt_poll_ns grow/shrink

 include/linux/kvm_host.h   |  1 +
 include/trace/events/kvm.h | 30 
 virt/kvm/kvm_main.c| 70 ++
 3 files changed, 96 insertions(+), 5 deletions(-)

-- 
1.9.1

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


[PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread Wanpeng Li
There is a downside of always-poll since poll is still happened for idle 
vCPUs which can waste cpu usage. This patch adds the ability to adjust 
halt_poll_ns dynamically, to grow halt_poll_ns when shot halt is detected,  
and to shrink halt_poll_ns when long halt is detected.

There are two new kernel parameters for changing the halt_poll_ns:
halt_poll_ns_grow and halt_poll_ns_shrink. 

no-poll  always-polldynamic-poll
---
Idle (nohz) vCPU %c0 0.15%0.3%0.2%  
Idle (250HZ) vCPU %c01.1% 4.6%~14%1.2%
TCP_RR latency   34us 27us26.7us

"Idle (X) vCPU %c0" is the percent of time the physical cpu spent in
c0 over 60 seconds (each vCPU is pinned to a pCPU). (nohz) means the
guest was tickless. (250HZ) means the guest was ticking at 250HZ.

The big win is with ticking operating systems. Running the linux guest
with nohz=off (and HZ=250), we save 3.4%~12.8% CPUs/second and get close 
to no-polling overhead levels by using the dynamic-poll. The savings
should be even higher for higher frequency ticks.

Suggested-by: David Matlack 
Signed-off-by: Wanpeng Li 
---
 virt/kvm/kvm_main.c | 61 ++---
 1 file changed, 58 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c06e57c..3cff02f 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -66,9 +66,18 @@
 MODULE_AUTHOR("Qumranet");
 MODULE_LICENSE("GPL");
 
-static unsigned int halt_poll_ns;
+/* halt polling only reduces halt latency by 5-7 us, 500us is enough */
+static unsigned int halt_poll_ns = 50;
 module_param(halt_poll_ns, uint, S_IRUGO | S_IWUSR);
 
+/* Default doubles per-vcpu halt_poll_ns. */
+static unsigned int halt_poll_ns_grow = 2;
+module_param(halt_poll_ns_grow, int, S_IRUGO);
+
+/* Default resets per-vcpu halt_poll_ns . */
+static unsigned int halt_poll_ns_shrink;
+module_param(halt_poll_ns_shrink, int, S_IRUGO);
+
 /*
  * Ordering of locks:
  *
@@ -1907,6 +1916,31 @@ void kvm_vcpu_mark_page_dirty(struct kvm_vcpu *vcpu, 
gfn_t gfn)
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_mark_page_dirty);
 
+static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
+{
+   int val = vcpu->halt_poll_ns;
+
+   /* 10us base */
+   if (val == 0 && halt_poll_ns_grow)
+   val = 1;
+   else
+   val *= halt_poll_ns_grow;
+
+   vcpu->halt_poll_ns = val;
+}
+
+static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu)
+{
+   int val = vcpu->halt_poll_ns;
+
+   if (halt_poll_ns_shrink == 0)
+   val = 0;
+   else
+   val /= halt_poll_ns_shrink;
+
+   vcpu->halt_poll_ns = val;
+}
+
 static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu)
 {
if (kvm_arch_vcpu_runnable(vcpu)) {
@@ -1929,6 +1963,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
ktime_t start, cur;
DEFINE_WAIT(wait);
bool waited = false;
+   u64 poll_ns = 0, wait_ns = 0, block_ns = 0;
 
start = cur = ktime_get();
if (vcpu->halt_poll_ns) {
@@ -1941,10 +1976,15 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
 */
if (kvm_vcpu_check_block(vcpu) < 0) {
++vcpu->stat.halt_successful_poll;
-   goto out;
+   break;
}
cur = ktime_get();
} while (single_task_running() && ktime_before(cur, stop));
+
+   if (ktime_before(cur, stop)) {
+   poll_ns = ktime_to_ns(cur) - ktime_to_ns(start);
+   goto out;
+   }
}
 
for (;;) {
@@ -1959,9 +1999,24 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
 
finish_wait(&vcpu->wq, &wait);
cur = ktime_get();
+   wait_ns = ktime_to_ns(cur) - ktime_to_ns(start);
 
 out:
-   trace_kvm_vcpu_wakeup(ktime_to_ns(cur) - ktime_to_ns(start), waited);
+   block_ns = poll_ns + wait_ns;
+
+   if (halt_poll_ns) {
+   if (block_ns <= vcpu->halt_poll_ns)
+   ;
+   /* we had a long block, shrink polling */
+   else if (vcpu->halt_poll_ns && block_ns > halt_poll_ns)
+   shrink_halt_poll_ns(vcpu);
+   /* we had a short halt and our poll time is too small */
+   else if (vcpu->halt_poll_ns < halt_poll_ns &&
+   block_ns < halt_poll_ns)
+   grow_halt_poll_ns(vcpu);
+   }
+
+   trace_kvm_vcpu_wakeup(block_ns, waited);
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_block);
 
-- 
1.9.1

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

[PATCH v6 1/3] KVM: make halt_poll_ns per-vCPU

2015-09-02 Thread Wanpeng Li
Change halt_poll_ns into per-vCPU variable, seeded from module parameter,
to allow greater flexibility.

Signed-off-by: Wanpeng Li 
---
 include/linux/kvm_host.h | 1 +
 virt/kvm/kvm_main.c  | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 81089cf..1bef9e2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -242,6 +242,7 @@ struct kvm_vcpu {
int sigset_active;
sigset_t sigset;
struct kvm_vcpu_stat stat;
+   unsigned int halt_poll_ns;
 
 #ifdef CONFIG_HAS_IOMEM
int mmio_needed;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index d8db2f8f..c06e57c 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -217,6 +217,7 @@ int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, 
unsigned id)
vcpu->kvm = kvm;
vcpu->vcpu_id = id;
vcpu->pid = NULL;
+   vcpu->halt_poll_ns = 0;
init_waitqueue_head(&vcpu->wq);
kvm_async_pf_vcpu_init(vcpu);
 
@@ -1930,8 +1931,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
bool waited = false;
 
start = cur = ktime_get();
-   if (halt_poll_ns) {
-   ktime_t stop = ktime_add_ns(ktime_get(), halt_poll_ns);
+   if (vcpu->halt_poll_ns) {
+   ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);
 
do {
/*
-- 
1.9.1

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


[tip:x86/urgent] x86/mm/srat: Print non-volatile flag in SRAT

2015-09-02 Thread tip-bot for Linda Knippers
Commit-ID:  31e09b18c863718939e3e9c30eee55f9011d85ee
Gitweb: http://git.kernel.org/tip/31e09b18c863718939e3e9c30eee55f9011d85ee
Author: Linda Knippers 
AuthorDate: Tue, 1 Sep 2015 15:41:55 -0400
Committer:  Ingo Molnar 
CommitDate: Wed, 2 Sep 2015 09:33:25 +0200

x86/mm/srat: Print non-volatile flag in SRAT

With the addition of NVDIMM support, a question came up as to
whether NVDIMM ranges should be in the SRAT with this bit set.
I think the consensus was no because the ranges are in the NFIT
with proximity domain information there.

ACPI is not clear on the meaning of this bit in the SRAT.
If someone is setting it, we might want to ask them what they
expect to happen with it.

Right now this bit is only printed if all the ACPI debug
information is turned on.

Signed-off-by: Linda Knippers 
Acked-by: Thomas Gleixner 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20150901194154.GA4939@ljkz400
Signed-off-by: Ingo Molnar 
---
 arch/x86/mm/srat.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 66338a6..c2aea63 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -192,10 +192,11 @@ acpi_numa_memory_affinity_init(struct 
acpi_srat_mem_affinity *ma)
 
node_set(node, numa_nodes_parsed);
 
-   pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s\n",
+   pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n",
node, pxm,
(unsigned long long) start, (unsigned long long) end - 1,
-   hotpluggable ? " hotplug" : "");
+   hotpluggable ? " hotplug" : "",
+   ma->flags & ACPI_SRAT_MEM_NON_VOLATILE ? " non-volatile" : "");
 
/* Mark hotplug range in memblock. */
if (hotpluggable && memblock_mark_hotplug(start, ma->length))
--
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/2] mmc: sdhci-pxav3: Fix tabbing issue

2015-09-02 Thread Vaibhav Hiremath



On Wednesday 02 September 2015 12:24 PM, Jisheng Zhang wrote:

On Wed, 2 Sep 2015 00:54:13 +0530
Vaibhav Hiremath  wrote:


There were some coding style issues where spaces have been used instead
of tabs, for example, in macro definitions, alignment of function
declarations/definitions, etc...

This patch fixes all such occurrences in the code.
And also use BIT for bit definitions.

Signed-off-by: Vaibhav Hiremath 
---
  drivers/mmc/host/sdhci-pxav3.c | 63 ++
  1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 946d37f..d02bc37 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -39,24 +39,29 @@
  #include "sdhci.h"
  #include "sdhci-pltfm.h"

-#define PXAV3_RPM_DELAY_MS 50
+#define PXAV3_RPM_DELAY_MS 50

-#define SD_CLOCK_BURST_SIZE_SETUP  0x10A
-#define SDCLK_SEL  0x100
-#define SDCLK_DELAY_SHIFT  9
-#define SDCLK_DELAY_MASK   0x1f
+#define SD_CLOCK_BURST_SIZE_SETUP  0x10A
+#define SDCLK_SEL  0x100
+#define  SDCLK_DELAY_SHIFT 9
+#define  SDCLK_DELAY_MASK  0x1f

-#define SD_CFG_FIFO_PARAM   0x100
-#define SDCFG_GEN_PAD_CLK_ON   (1<<6)
-#define SDCFG_GEN_PAD_CLK_CNT_MASK 0xFF
-#define SDCFG_GEN_PAD_CLK_CNT_SHIFT24
+#define SD_CFG_FIFO_PARAM  0x100
+#define  SDCFG_GEN_PAD_CLK_ON  BIT(6)
+#define  SDCFG_GEN_PAD_CLK_CNT_MASK0xFF
+#define  SDCFG_GEN_PAD_CLK_CNT_SHIFT   24

-#define SD_SPI_MODE  0x108
-#define SD_CE_ATA_1  0x10C
+#define SD_SPI_MODE0x108
+#define SD_CE_ATA_10x10C

-#define SD_CE_ATA_2  0x10E
-#define SDCE_MISC_INT  (1<<2)
-#define SDCE_MISC_INT_EN   (1<<1)
+#define SD_CE_ATA_20x10E
+#define  SDCE_MISC_INT BIT(2)
+#define  SDCE_MISC_INT_EN  BIT(1)


BIT or (1 << y) are both fine, is there any reason to change to BIT?
If so, there will be lots of source code need such changes.



I have received comments for my other patches (PMIC/Regulator/mfd),
so applying same here as well before doing any real
functionality/coding changes to the driver.



+
+/* IO Power control */
+#define IO_PWR_AKEY_ASFAR  0xbaba
+#define IO_PWR_AKEY_ASSAR  0xeb10
+#define IO_PWR_MMC1_PAD_1V8BIT(2)

  struct sdhci_pxa {
struct clk *clk_core;
@@ -128,7 +133,7 @@ static int mv_conf_mbus_windows(struct platform_device 
*pdev,
  }

  static int armada_38x_quirks(struct platform_device *pdev,
-struct sdhci_host *host)
+   struct sdhci_host *host)
  {
struct device_node *np = pdev->dev.of_node;
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -136,8 +141,7 @@ static int armada_38x_quirks(struct platform_device *pdev,
struct resource *res;

host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
-   res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-  "conf-sdio3");
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "conf-sdio3");
if (res) {
pxa->sdio3_conf_reg = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pxa->sdio3_conf_reg))
@@ -284,10 +288,10 @@ static void pxav3_set_uhs_signaling(struct sdhci_host 
*host, unsigned int uhs)
 * FE-2946959
 */
if (pxa->sdio3_conf_reg) {
-   u8 reg_val  = readb(pxa->sdio3_conf_reg);
+   u8 reg_val = readb(pxa->sdio3_conf_reg);

if (uhs == MMC_TIMING_UHS_SDR50 ||
-   uhs == MMC_TIMING_UHS_DDR50) {
+   uhs == MMC_TIMING_UHS_DDR50) {
reg_val &= ~SDIO3_CONF_CLK_INV;
reg_val |= SDIO3_CONF_SD_FB_CLK;
} else {
@@ -304,20 +308,20 @@ static void pxav3_set_uhs_signaling(struct sdhci_host 
*host, unsigned int uhs)
  }

  static const struct sdhci_ops pxav3_sdhci_ops = {
-   .set_clock = sdhci_set_clock,
-   .platform_send_init_74_clocks = pxav3_gen_init_74_clocks,
-   .get_max_clock = sdhci_pltfm_clk_get_max_clock,
-   .set_bus_width = sdhci_set_bus_width,
-   .reset = pxav3_reset,
-   .set_uhs_signaling = pxav3_set_uhs_signaling,
+   .set_clock  = sdhci_set_clock,
+   .platform_send_init_74_clocks   = pxav3_gen_init_74_clocks,
+   .get_max_clock  = sdhci_pltfm_clk_get_max_clock,
+   .set_bus_width  = sdhci_set_bus_width,
+   .reset  = pxav3_reset,
+   .set_uhs_signaling  = pxav3_set_uhs_signaling,
  };


IMHO these two styles are both fine. For example, the mmc_sd_ops structure in
drivers/mmc/core/sd.c also follows the sdhci-pxav3's original coding style





Ditto here.

I did

Re: Regression: can't apply frequency offsets above 1000ppm.

2015-09-02 Thread Miroslav Lichvar
On Wed, Sep 02, 2015 at 02:14:21AM +0100, Nuno Gonçalves wrote:
> On Wed, Sep 2, 2015 at 2:03 AM, John Stultz  wrote:
> > On Tue, Sep 1, 2015 at 5:36 PM, Nuno Gonçalves  wrote:
> >> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=dc491596f6394382fbc74ad331156207d619fa0a
> >>
> >> I've triple checked it this time. Not sure where I did the mistake to
> >> get it wrong by 3 commits.
> >
> > This commit is much more believable (though surprising as that change
> > was found to greatly improve results for most uses).
> >
> > Can you provide any more details about how the problem is reproduced
> > (kernel config, what userland images are you using, etc)?  I've got a
> > BBB myself so I can try to see whats going on.

> And just installing chrony from the feeds. With any kernel from 3.17
> you'll have wrong estimates at chronyc sourcestats.

Another reproducer is to disable chronyd, set the adjtimex tick to
9000 (e.g. by the adjtimex utility) and observe how is the offset of
the clock changing over time, e.g. by running periodically ntpdate -q
or chronyd -Q. It should be losing about 0.1 second per second, but
the actual frequency offset seems to be much smaller.

> Miroslav also dismissed this being related to nohz after some tests.

Yeah, the problem didn't disappear when the kernel was booted with
nohz=off, so I thought it was something else. Now that it seems it
indeed is related to nohz, I guess it's not a problem with the clock
update interval being too long (which the referenced commit
addressed).

Anyone knows what values (mask, mult, shift, maxadj) has the
clocksource in this case? I'd like to try to reproduce the problem in
the simulator.

-- 
Miroslav Lichvar
--
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/4] x86/insn: perf tools: Add a few new x86 instructions

2015-09-02 Thread Ingo Molnar

* 平松雅巳 / HIRAMATU,MASAMI  wrote:

> > sure, np you can use my ack
> 
> I'm also OK for this patch. I just concern that is OK for Adrian too? 
> Since this ensures all the copied code should be dead copy (not modified 
> anymore),
> if we want a different instruction decoding routine, we have to break the test
> anyway.

So the idea would be to not break anything, only warn in a non-fatal question. 
This protects against unbisectable universes being created via simple git 
merges 
where updates meet but testing of tooling isn't done.

Thanks,

Ingo
--
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 v6 3/3] KVM: trace kvm_halt_poll_ns grow/shrink

2015-09-02 Thread Wanpeng Li
Tracepoint for dynamic halt_pool_ns, fired on every potential change.

Signed-off-by: Wanpeng Li 
---
 include/trace/events/kvm.h | 30 ++
 virt/kvm/kvm_main.c|  8 ++--
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index a44062d..75ddf80 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -356,6 +356,36 @@ TRACE_EVENT(
  __entry->address)
 );
 
+TRACE_EVENT(kvm_halt_poll_ns,
+   TP_PROTO(bool grow, unsigned int vcpu_id, int new, int old),
+   TP_ARGS(grow, vcpu_id, new, old),
+
+   TP_STRUCT__entry(
+   __field(bool, grow)
+   __field(unsigned int, vcpu_id)
+   __field(int, new)
+   __field(int, old)
+   ),
+
+   TP_fast_assign(
+   __entry->grow   = grow;
+   __entry->vcpu_id= vcpu_id;
+   __entry->new= new;
+   __entry->old= old;
+   ),
+
+   TP_printk("vcpu %u: halt_pool_ns %d (%s %d)",
+   __entry->vcpu_id,
+   __entry->new,
+   __entry->grow ? "grow" : "shrink",
+   __entry->old)
+);
+
+#define trace_kvm_halt_poll_ns_grow(vcpu_id, new, old) \
+   trace_kvm_halt_poll_ns(true, vcpu_id, new, old)
+#define trace_kvm_halt_poll_ns_shrink(vcpu_id, new, old) \
+   trace_kvm_halt_poll_ns(false, vcpu_id, new, old)
+
 #endif
 
 #endif /* _TRACE_KVM_MAIN_H */
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 3cff02f..fee339e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1918,8 +1918,9 @@ EXPORT_SYMBOL_GPL(kvm_vcpu_mark_page_dirty);
 
 static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
 {
-   int val = vcpu->halt_poll_ns;
+   int old, val;
 
+   old = val = vcpu->halt_poll_ns;
/* 10us base */
if (val == 0 && halt_poll_ns_grow)
val = 1;
@@ -1927,18 +1928,21 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
val *= halt_poll_ns_grow;
 
vcpu->halt_poll_ns = val;
+   trace_kvm_halt_poll_ns_grow(vcpu->vcpu_id, val, old);
 }
 
 static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu)
 {
-   int val = vcpu->halt_poll_ns;
+   int old, val;
 
+   old = val = vcpu->halt_poll_ns;
if (halt_poll_ns_shrink == 0)
val = 0;
else
val /= halt_poll_ns_shrink;
 
vcpu->halt_poll_ns = val;
+   trace_kvm_halt_poll_ns_shrink(vcpu->vcpu_id, val, old);
 }
 
 static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu)
-- 
1.9.1

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


Re: [PATCH v2 1/2] ARM: dts: Split audio configuration to separate exynos5422-odroidxu3-audio

2015-09-02 Thread Javier Martinez Canillas
Hello Krzysztof,

On 09/02/2015 03:30 AM, Krzysztof Kozlowski wrote:
> The Odroid XU4 board does not have audio codec so before adding DTS for
> new board split the audio codec to separate DTSI file. Include the audio codec
> DTSI in Odroid XU3 and XU3-Lite boards.
> 
> Signed-off-by: Krzysztof Kozlowski 
> 

Looks good to me.

Reviewed-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
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 01/15] perf tools: Fix parse_events_add_pmu caller

2015-09-02 Thread Jiri Olsa
Following commit changed parse_events_add_pmu interface:
  36adec85a86f perf tools: Change parse_events_add_pmu interface

but forgot to change one caller. Because of lessen compilation
rules for the bison parser, the compiler did not warn on that.

Link: http://lkml.kernel.org/n/tip-fda5a524tfapmpb85bmai...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/perf/util/parse-events.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 591905a02b92..9cd70819c795 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -255,7 +255,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
list_add_tail(&term->list, head);
 
ALLOC_LIST(list);
-   ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head));
+   ABORT_ON(parse_events_add_pmu(data, list, "cpu", head));
parse_events__free_terms(head);
$$ = list;
 }
-- 
2.4.3

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


[PATCH 02/15] perf tools: Remove mountpoint arg from perf_debugfs_mount

2015-09-02 Thread Jiri Olsa
It's not used by any caller. We either detect the mountpoint
or use hardcoded one.

Link: http://lkml.kernel.org/n/tip-7bbr92o7gwv5bkpancqoy...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/perf/perf.c  |  2 +-
 tools/perf/util/util.c | 14 +++---
 tools/perf/util/util.h |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 07dbff5c0e60..f500a4b40722 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -518,7 +518,7 @@ int main(int argc, const char **argv)
if (!cmd)
cmd = "perf-help";
/* get debugfs mount point from /proc/mounts */
-   perf_debugfs_mount(NULL);
+   perf_debugfs_mount();
/*
 * "perf-" is the same as "perf ", but we obviously:
 *
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 7acafb3c5592..74f71f8afcc2 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -398,11 +398,11 @@ static void set_tracing_events_path(const char *tracing, 
const char *mountpoint)
 mountpoint, tracing, "events");
 }
 
-static const char *__perf_tracefs_mount(const char *mountpoint)
+static const char *__perf_tracefs_mount(void)
 {
const char *mnt;
 
-   mnt = tracefs_mount(mountpoint);
+   mnt = tracefs_mount(NULL);
if (!mnt)
return NULL;
 
@@ -411,11 +411,11 @@ static const char *__perf_tracefs_mount(const char 
*mountpoint)
return mnt;
 }
 
-static const char *__perf_debugfs_mount(const char *mountpoint)
+static const char *__perf_debugfs_mount(void)
 {
const char *mnt;
 
-   mnt = debugfs_mount(mountpoint);
+   mnt = debugfs_mount(NULL);
if (!mnt)
return NULL;
 
@@ -424,15 +424,15 @@ static const char *__perf_debugfs_mount(const char 
*mountpoint)
return mnt;
 }
 
-const char *perf_debugfs_mount(const char *mountpoint)
+const char *perf_debugfs_mount(void)
 {
const char *mnt;
 
-   mnt = __perf_tracefs_mount(mountpoint);
+   mnt = __perf_tracefs_mount();
if (mnt)
return mnt;
 
-   mnt = __perf_debugfs_mount(mountpoint);
+   mnt = __perf_debugfs_mount();
 
return mnt;
 }
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 291be1d84bc3..184d40048faa 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -86,7 +86,7 @@ extern char buildid_dir[];
 extern char tracing_path[];
 extern char tracing_events_path[];
 extern void perf_debugfs_set_path(const char *mountpoint);
-const char *perf_debugfs_mount(const char *mountpoint);
+const char *perf_debugfs_mount(void);
 char *get_tracing_file(const char *name);
 void put_tracing_file(char *file);
 
-- 
2.4.3

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


[PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c

2015-09-02 Thread Jiri Olsa
Moving tracing_path interface into api/fs/tracing_path.c
out of util.c. It seems generic enough to be used by
others, and I couldn't think of better place.

Link: http://lkml.kernel.org/n/tip-xqvrud2e3z4uynvnu3iml...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/Build |  1 +
 tools/lib/api/fs/tracing_path.c| 83 ++
 tools/lib/api/fs/tracing_path.h| 13 ++
 tools/perf/perf.c  |  2 +-
 tools/perf/util/parse-events.c |  2 +-
 tools/perf/util/trace-event-info.c |  2 +-
 tools/perf/util/trace-event.c  |  1 +
 tools/perf/util/util.c | 70 
 tools/perf/util/util.h |  6 ---
 9 files changed, 101 insertions(+), 79 deletions(-)
 create mode 100644 tools/lib/api/fs/tracing_path.c
 create mode 100644 tools/lib/api/fs/tracing_path.h

diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build
index 6de5a4f0b501..fa726f679b29 100644
--- a/tools/lib/api/fs/Build
+++ b/tools/lib/api/fs/Build
@@ -1,4 +1,5 @@
 libapi-y += fs.o
+libapi-y += tracing_path.o
 libapi-y += debugfs.o
 libapi-y += findfs.o
 libapi-y += tracefs.o
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
new file mode 100644
index ..1fd6e1f99234
--- /dev/null
+++ b/tools/lib/api/fs/tracing_path.c
@@ -0,0 +1,83 @@
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#include 
+#include 
+#include 
+#include "debugfs.h"
+#include "tracefs.h"
+
+#include "tracing_path.h"
+
+
+char tracing_path[PATH_MAX + 1]= "/sys/kernel/debug/tracing";
+char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
+
+
+static void __tracing_path_set(const char *tracing, const char *mountpoint)
+{
+   snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
+mountpoint, tracing);
+   snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s",
+mountpoint, tracing, "events");
+}
+
+static const char *tracing_path_tracefs_mount(void)
+{
+   const char *mnt;
+
+   mnt = tracefs_mount(NULL);
+   if (!mnt)
+   return NULL;
+
+   __tracing_path_set("", mnt);
+
+   return mnt;
+}
+
+static const char *tracing_path_debugfs_mount(void)
+{
+   const char *mnt;
+
+   mnt = debugfs_mount(NULL);
+   if (!mnt)
+   return NULL;
+
+   __tracing_path_set("tracing/", mnt);
+
+   return mnt;
+}
+
+const char *tracing_path_mount(void)
+{
+   const char *mnt;
+
+   mnt = tracing_path_tracefs_mount();
+   if (mnt)
+   return mnt;
+
+   mnt = tracing_path_debugfs_mount();
+
+   return mnt;
+}
+
+void tracing_path_set(const char *mntpt)
+{
+   __tracing_path_set("tracing/", mntpt);
+}
+
+char *get_tracing_file(const char *name)
+{
+   char *file;
+
+   if (asprintf(&file, "%s/%s", tracing_path, name) < 0)
+   return NULL;
+
+   return file;
+}
+
+void put_tracing_file(char *file)
+{
+   free(file);
+}
diff --git a/tools/lib/api/fs/tracing_path.h b/tools/lib/api/fs/tracing_path.h
new file mode 100644
index ..b132dc599fe5
--- /dev/null
+++ b/tools/lib/api/fs/tracing_path.h
@@ -0,0 +1,13 @@
+#ifndef __API_FS_TRACING_PATH_H
+#define __API_FS_TRACING_PATH_H
+
+extern char tracing_path[];
+extern char tracing_events_path[];
+
+void tracing_path_set(const char *mountpoint);
+const char *tracing_path_mount(void);
+
+char *get_tracing_file(const char *name);
+void put_tracing_file(char *file);
+
+#endif /* __API_FS_TRACING_PATH_H */
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 0e99cd1de9dd..f2fc019b3671 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -15,7 +15,7 @@
 #include "util/parse-events.h"
 #include "util/parse-options.h"
 #include "util/debug.h"
-#include 
+#include 
 #include 
 
 const char perf_usage_string[] =
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index d826e6f515db..3840176642f8 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -11,7 +11,7 @@
 #include "cache.h"
 #include "header.h"
 #include "debug.h"
-#include 
+#include 
 #include "parse-events-bison.h"
 #define YY_EXTRA_TYPE int
 #include "parse-events-flex.h"
diff --git a/tools/perf/util/trace-event-info.c 
b/tools/perf/util/trace-event-info.c
index 22245986e59e..d995743cb673 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -38,7 +38,7 @@
 
 #include "../perf.h"
 #include "trace-event.h"
-#include 
+#include 
 #include "evsel.h"
 #include "debug.h"
 
diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c
index b90e646c7a91..2f4996ab313d 100644
--- a/tools/perf/util/trace-event.c
+++ b/tools/perf/util/trace-event.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "trace-event.h"
 #include "machine.h"
 #include "util.h"
diff --git a/tools/perf/util/util.c b/tools/perf/ut

[PATCH 00/15] perf tools: Cleanup filesystem api

2015-09-02 Thread Jiri Olsa
hi,
this patchset moves all filesystem we use under
api/fs/fs.c framework and adds new tracing_path
object to get tracing area (path).

It unifies the way we use debugfs/tracefs paths
and removes some redundant code.

It's base for the tracepoint parsing error reporting
I posted recently.

jirka


---
Jiri Olsa (15):
  perf tools: Fix parse_events_add_pmu caller
  perf tools: Remove mountpoint arg from perf_debugfs_mount
  perf tools: Move tracing_path stuff under same namespace
  perf tools: Move tracing_path interface into api/fs/tracing_path.c
  tools lib api: Move debugfs__strerror_open into tracing_path.c object
  tools lib api: Make tracing_path_strerror_open message generic
  tools lib api: Add STR and PATH_MAX macros to fs object
  tools lib api: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c
  tools lib api: Add debugfs into fs.c object
  tools lib api: Add tracefs into fs.c object
  tools lib api: Add mount support for fs
  tools lib api: Add configured support for fs
  tools lib api: Replace debugfs/tracefs objects interface with fs.c
  tools lib api: Remove debugfs, tracefs and findfs objects
  perf tools: Switch to tracing_path interface on appropriate places

 tools/lib/api/fs/Build |   4 +--
 tools/lib/api/fs/debugfs.c | 129 
---
 tools/lib/api/fs/debugfs.h |  23 ---
 tools/lib/api/fs/findfs.c  |  63 
-
 tools/lib/api/fs/findfs.h  |  23 ---
 tools/lib/api/fs/fs.c  | 118 

 tools/lib/api/fs/fs.h  |  26 -
 tools/lib/api/fs/tracefs.c |  78 
--
 tools/lib/api/fs/tracefs.h |  21 --
 tools/lib/api/fs/tracing_path.c| 136 

 tools/lib/api/fs/tracing_path.h|  16 +++
 tools/perf/builtin-kvm.c   |   1 -
 tools/perf/builtin-probe.c |   1 -
 tools/perf/builtin-trace.c |   5 ++--
 tools/perf/perf.c  |  12 
 tools/perf/tests/openat-syscall-all-cpus.c |  10 +++
 tools/perf/tests/openat-syscall.c  |  10 +++
 tools/perf/tests/parse-events.c|  19 ++---
 tools/perf/util/evsel.c|   2 +-
 tools/perf/util/parse-events.c |   2 +-
 tools/perf/util/parse-events.y |   2 +-
 tools/perf/util/probe-event.c  |   5 ++--
 tools/perf/util/probe-file.c   |  15 ++
 tools/perf/util/trace-event-info.c |   2 +-
 tools/perf/util/trace-event.c  |   1 +
 tools/perf/util/util.c |  70 
-
 tools/perf/util/util.h |   9 +-
 27 files changed, 310 insertions(+), 493 deletions(-)
 delete mode 100644 tools/lib/api/fs/debugfs.c
 delete mode 100644 tools/lib/api/fs/debugfs.h
 delete mode 100644 tools/lib/api/fs/findfs.c
 delete mode 100644 tools/lib/api/fs/findfs.h
 delete mode 100644 tools/lib/api/fs/tracefs.c
 delete mode 100644 tools/lib/api/fs/tracefs.h
 create mode 100644 tools/lib/api/fs/tracing_path.c
 create mode 100644 tools/lib/api/fs/tracing_path.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 07/15] tools lib api: Add STR and PATH_MAX macros to fs object

2015-09-02 Thread Jiri Olsa
We're going to get rid of findfs.h in following patches,
but we'll still need these macros.

Link: http://lkml.kernel.org/n/tip-mrjj0llsem9pjakkrx9o0...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 3 +++
 tools/lib/api/fs/fs.h | 8 
 2 files changed, 11 insertions(+)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 128ef6332a6b..5e838d3c419d 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -15,6 +15,9 @@
 #include "debugfs.h"
 #include "fs.h"
 
+#define _STR(x) #x
+#define STR(x) _STR(x)
+
 static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 6caa2bbc6cec..fd6288d73383 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -1,6 +1,14 @@
 #ifndef __API_FS__
 #define __API_FS__
 
+/*
+ * On most systems  would have given us this, but  not on some 
systems
+ * (e.g. GNU/Hurd).
+ */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 #ifndef SYSFS_MAGIC
 #define SYSFS_MAGIC0x62656572
 #endif
-- 
2.4.3

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


[PATCH 15/15] perf tools: Switch to tracing_path interface on appropriate places

2015-09-02 Thread Jiri Olsa
Using tracing_path interface on several places, that more or less
copy the functionality of tracing_path interface.

Link: http://lkml.kernel.org/n/tip-nvxvjo2bpsjf3hhz3ylul...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/perf/tests/openat-syscall-all-cpus.c |  9 +++--
 tools/perf/tests/openat-syscall.c  | 11 ---
 tools/perf/tests/parse-events.c| 16 ++--
 tools/perf/util/probe-file.c   | 14 ++
 4 files changed, 11 insertions(+), 39 deletions(-)

diff --git a/tools/perf/tests/openat-syscall-all-cpus.c 
b/tools/perf/tests/openat-syscall-all-cpus.c
index a38adf94c731..495d8126b722 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -15,6 +15,7 @@ int test__openat_syscall_event_on_all_cpus(void)
cpu_set_t cpu_set;
struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
char sbuf[STRERR_BUFSIZE];
+   char errbuf[BUFSIZ];
 
if (threads == NULL) {
pr_debug("thread_map__new\n");
@@ -31,12 +32,8 @@ int test__openat_syscall_event_on_all_cpus(void)
 
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
if (evsel == NULL) {
-   if (tracefs__configured())
-   pr_debug("is tracefs mounted on 
/sys/kernel/tracing?\n");
-   else if (debugfs__configured())
-   pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
-   else
-   pr_debug("Neither tracefs or debugfs is enabled in this 
kernel\n");
+   tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), 
"syscalls", "sys_enter_openat");
+   pr_err("%s\n", errbuf);
goto out_thread_map_delete;
}
 
diff --git a/tools/perf/tests/openat-syscall.c 
b/tools/perf/tests/openat-syscall.c
index 8048c7d7cd67..08ac9d94a050 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -1,4 +1,4 @@
-#include 
+#include 
 #include "thread_map.h"
 #include "evsel.h"
 #include "debug.h"
@@ -11,6 +11,7 @@ int test__openat_syscall_event(void)
unsigned int nr_openat_calls = 111, i;
struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
char sbuf[STRERR_BUFSIZE];
+   char errbuf[BUFSIZ];
 
if (threads == NULL) {
pr_debug("thread_map__new\n");
@@ -19,12 +20,8 @@ int test__openat_syscall_event(void)
 
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
if (evsel == NULL) {
-   if (tracefs__configured())
-   pr_debug("is tracefs mounted on 
/sys/kernel/tracing?\n");
-   else if (debugfs__configured())
-   pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
-   else
-   pr_debug("Neither tracefs or debugfs is enabled in this 
kernel\n");
+   tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), 
"syscalls", "sys_enter_openat");
+   pr_err("%s\n", errbuf);
goto out_thread_map_delete;
}
 
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 91fbfd593c4a..3a2ebe666192 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1261,23 +1261,11 @@ test__checkevent_breakpoint_len_rw_modifier(struct 
perf_evlist *evlist)
 
 static int count_tracepoints(void)
 {
-   char events_path[PATH_MAX];
struct dirent *events_ent;
-   const char *mountpoint;
DIR *events_dir;
int cnt = 0;
 
-   mountpoint = tracefs__mountpoint();
-   if (mountpoint) {
-   scnprintf(events_path, PATH_MAX, "%s/events",
- mountpoint);
-   } else {
-   mountpoint = debugfs__mountpoint();
-   scnprintf(events_path, PATH_MAX, "%s/tracing/events",
- mountpoint);
-   }
-
-   events_dir = opendir(events_path);
+   events_dir = opendir(tracing_events_path);
 
TEST_ASSERT_VAL("Can't open events dir", events_dir);
 
@@ -1294,7 +1282,7 @@ static int count_tracepoints(void)
continue;
 
scnprintf(sys_path, PATH_MAX, "%s/%s",
- events_path, events_ent->d_name);
+ tracing_events_path, events_ent->d_name);
 
sys_dir = opendir(sys_path);
TEST_ASSERT_VAL("Can't open sys dir", sys_dir);
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index de0df1e6222a..cbc5783389f8 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -22,7 +22,7 @@
 #include "color.h"
 #include "symbol.h"
 #include "thread.h"
-#include 
+#include 
 #include "probe-event.h"
 #include "probe-file.h"
 #include "session.h"
@@ -72,21 +72,11 @@ static void print_both_open_warning(int kerr,

[PATCH 12/15] tools lib api: Add configured support for fs

2015-09-02 Thread Jiri Olsa
Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
interface that returns bool state of the filesystem mount:
  true - mounted, false - not mounted

It will not try to mount the filesystem.

Link: http://lkml.kernel.org/n/tip-csvlq2hr43ys3u7nfs2up...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 23 ++-
 tools/lib/api/fs/fs.h |  5 -
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index bc93baf33fff..8afe08a99bc6 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -244,15 +244,20 @@ static const char *fs__mount(int idx)
return fs__check_mounts(fs) ? fs->path : NULL;
 }
 
-#define FS(name, idx)  \
-const char *name##__mountpoint(void)   \
-{  \
-   return fs__mountpoint(idx); \
-}  \
-   \
-const char *name##__mount(void)\
-{  \
-   return fs__mount(idx);  \
+#define FS(name, idx)  \
+const char *name##__mountpoint(void)   \
+{  \
+   return fs__mountpoint(idx); \
+}  \
+   \
+const char *name##__mount(void)\
+{  \
+   return fs__mount(idx);  \
+}  \
+   \
+bool name##__configured(void)  \
+{  \
+   return name##__mountpoint() != NULL;\
 }
 
 FS(sysfs,   FS__SYSFS);
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index a9627ea5e6ae..f654bcb99d1e 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -1,6 +1,8 @@
 #ifndef __API_FS__
 #define __API_FS__
 
+#include 
+
 /*
  * On most systems  would have given us this, but  not on some 
systems
  * (e.g. GNU/Hurd).
@@ -11,7 +13,8 @@
 
 #define FS(name)   \
const char *name##__mountpoint(void);   \
-   const char *name##__mount(void);
+   const char *name##__mount(void);\
+   bool name##__configured(void);  \
 
 FS(sysfs)
 FS(procfs)
-- 
2.4.3

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


[PATCH 13/15] tools lib api: Replace debugfs/tracefs objects interface with fs.c

2015-09-02 Thread Jiri Olsa
Switching to the fs.c related filesystem framework.

Link: http://lkml.kernel.org/n/tip-csvlq2hr43ys3u7nfs2up...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c  |  1 -
 tools/lib/api/fs/tracing_path.c| 15 +++
 tools/perf/builtin-kvm.c   |  1 -
 tools/perf/builtin-probe.c |  1 -
 tools/perf/tests/openat-syscall-all-cpus.c |  5 +++--
 tools/perf/tests/openat-syscall.c  |  5 +++--
 tools/perf/tests/parse-events.c|  7 +++
 tools/perf/util/evsel.c|  2 +-
 tools/perf/util/probe-event.c  |  5 ++---
 tools/perf/util/probe-file.c   |  7 +++
 tools/perf/util/util.h |  3 +--
 11 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 8afe08a99bc6..791509346178 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 
-#include "debugfs.h"
 #include "fs.h"
 
 #define _STR(x) #x
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index b0ee3b3acef0..b53aa9c8d1c8 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -7,8 +7,7 @@
 #include 
 #include 
 #include 
-#include "debugfs.h"
-#include "tracefs.h"
+#include "fs.h"
 
 #include "tracing_path.h"
 
@@ -29,7 +28,7 @@ static const char *tracing_path_tracefs_mount(void)
 {
const char *mnt;
 
-   mnt = tracefs_mount(NULL);
+   mnt = tracefs__mount();
if (!mnt)
return NULL;
 
@@ -42,7 +41,7 @@ static const char *tracing_path_debugfs_mount(void)
 {
const char *mnt;
 
-   mnt = debugfs_mount(NULL);
+   mnt = debugfs__mount();
if (!mnt)
return NULL;
 
@@ -90,7 +89,7 @@ static int strerror_open(int err, char *buf, size_t size, 
const char *filename)
 
switch (err) {
case ENOENT:
-   if (debugfs_configured() || tracefs_configured()) {
+   if (debugfs__configured() || tracefs__configured()) {
snprintf(buf, size,
 "Error:\tFile %s/%s not found.\n"
 "Hint:\tPerhaps this kernel misses some 
CONFIG_ setting to enable this feature?.\n",
@@ -104,13 +103,13 @@ static int strerror_open(int err, char *buf, size_t size, 
const char *filename)
 "Hint:\tTry 'sudo mount -t debugfs nodev 
/sys/kernel/debug'");
break;
case EACCES: {
-   const char *mountpoint = debugfs_find_mountpoint();
+   const char *mountpoint = debugfs__mountpoint();
 
if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 
8) == 0) {
-   const char *tracefs_mntpoint = 
tracefs_find_mountpoint();
+   const char *tracefs_mntpoint = tracefs__mountpoint();
 
if (tracefs_mntpoint)
-   mountpoint = tracefs_find_mountpoint();
+   mountpoint = tracefs__mountpoint();
}
 
snprintf(buf, size,
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index fc1cffb1b7a2..dd94b4ca2213 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -13,7 +13,6 @@
 #include "util/parse-options.h"
 #include "util/trace-event.h"
 #include "util/debug.h"
-#include 
 #include "util/tool.h"
 #include "util/stat.h"
 #include "util/top.h"
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index b81cec33b4b2..310aba2756a8 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -37,7 +37,6 @@
 #include "util/strfilter.h"
 #include "util/symbol.h"
 #include "util/debug.h"
-#include 
 #include "util/parse-options.h"
 #include "util/probe-finder.h"
 #include "util/probe-event.h"
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c 
b/tools/perf/tests/openat-syscall-all-cpus.c
index a572f87e9c8d..a38adf94c731 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -1,3 +1,4 @@
+#include 
 #include "evsel.h"
 #include "tests.h"
 #include "thread_map.h"
@@ -30,9 +31,9 @@ int test__openat_syscall_event_on_all_cpus(void)
 
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
if (evsel == NULL) {
-   if (tracefs_configured())
+   if (tracefs__configured())
pr_debug("is tracefs mounted on 
/sys/kernel/tracing?\n");
-   else if (debugfs_configured())
+   else if (debugfs__configured())
pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
else
pr_debug("Neither tracefs or debugfs is enabled in this 
kernel\n");
diff --git a/tools/perf/tests/openat-syscall.c 
b/tools/perf/tests/openat-syscall.c
inde

[PATCH 11/15] tools lib api: Add mount support for fs

2015-09-02 Thread Jiri Olsa
Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
interface that tries to mount the filesystem in case no mount is found.

Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk2...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 44 +++-
 tools/lib/api/fs/fs.h | 15 +++
 2 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index ef16d2a83a27..bc93baf33fff 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "debugfs.h"
 #include "fs.h"
@@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx)
return fs__get_mountpoint(fs);
 }
 
-#define FS__MOUNTPOINT(name, idx)  \
+static const char *mount_overload(struct fs *fs)
+{
+   size_t name_len = strlen(fs->name);
+   /* "PERF_" + name + "_ENVIRONMENT" + '\0' */
+   char upper_name[5 + name_len + 12 + 1];
+
+   snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name);
+   mem_toupper(upper_name, name_len);
+
+   return getenv(upper_name) ?: *fs->mounts;
+}
+
+static const char *fs__mount(int idx)
+{
+   struct fs *fs = &fs__entries[idx];
+   const char *mountpoint;
+
+   if (fs__mountpoint(idx))
+   return (const char *)fs->path;
+
+   mountpoint = mount_overload(fs);
+
+   if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0)
+   return NULL;
+
+   return fs__check_mounts(fs) ? fs->path : NULL;
+}
+
+#define FS(name, idx)  \
 const char *name##__mountpoint(void)   \
 {  \
return fs__mountpoint(idx); \
+}  \
+   \
+const char *name##__mount(void)\
+{  \
+   return fs__mount(idx);  \
 }
 
-FS__MOUNTPOINT(sysfs,   FS__SYSFS);
-FS__MOUNTPOINT(procfs,  FS__PROCFS);
-FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
-FS__MOUNTPOINT(tracefs, FS__TRACEFS);
+FS(sysfs,   FS__SYSFS);
+FS(procfs,  FS__PROCFS);
+FS(debugfs, FS__DEBUGFS);
+FS(tracefs, FS__TRACEFS);
 
 int filename__read_int(const char *filename, int *value)
 {
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 9013227ae0d1..a9627ea5e6ae 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -9,10 +9,17 @@
 #define PATH_MAX 4096
 #endif
 
-const char *sysfs__mountpoint(void);
-const char *procfs__mountpoint(void);
-const char *debugfs__mountpoint(void);
-const char *tracefs__mountpoint(void);
+#define FS(name)   \
+   const char *name##__mountpoint(void);   \
+   const char *name##__mount(void);
+
+FS(sysfs)
+FS(procfs)
+FS(debugfs)
+FS(tracefs)
+
+#undef FS
+
 
 int filename__read_int(const char *filename, int *value);
 int sysctl__read_int(const char *sysctl, int *value);
-- 
2.4.3

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


Re: [PATCH 2/2] arm64: dts: add dts files for Hisilicon Hip05-D02 Development Board

2015-09-02 Thread Marc Zyngier
[Don't top-post, this is very annoying]

On 02/09/15 05:28, Ding Tianhong wrote:
> Hi,Marc:
> 
> Can you check this, I am not sure whether the GIC_CPU_MASK_SIMPLE(xx)
> is used for gic-v3, maybe we should remove it, thanks.

The binding documentation
(Documentation/devicetree/bindings/arm/gic-v3.txt) is very clear:

  The 3rd cell is the flags, encoded as follows:
bits[3:0] trigger type and level flags.
1 = edge triggered
4 = level triggered

There is no mask whatsoever, because that would restrict the interrupt
to only 32 CPUs at most.

So please remove this, this is just wrong.

Thanks,

M.

> Ding
> 
> On 2015/8/31 21:44, Ding Tianhong wrote:
>> On 2015/8/31 21:12, Leo Yan wrote:
>>> On Sat, Aug 29, 2015 at 04:52:41PM +0800, Ding Tianhong wrote:
 Add initial dtsi file to support Hisilicon Hip05-D02 Board with
 support of CPUs in four clusters and each cluster has quard Cortex-A57.

 Also add dts file to support Hip05-D02 development board.

 Signed-off-by: Ding Tianhong 
 Signed-off-by: Kefeng Wang 
 ---
  arch/arm64/boot/dts/hisilicon/Makefile  |   2 +-
  arch/arm64/boot/dts/hisilicon/hip05-d02.dts |  36 
  arch/arm64/boot/dts/hisilicon/hip05.dtsi| 271 
 
  3 files changed, 308 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm64/boot/dts/hisilicon/hip05-d02.dts
  create mode 100644 arch/arm64/boot/dts/hisilicon/hip05.dtsi

 diff --git a/arch/arm64/boot/dts/hisilicon/Makefile 
 b/arch/arm64/boot/dts/hisilicon/Makefile
 index fa81a6e..cd158b8 100644
 --- a/arch/arm64/boot/dts/hisilicon/Makefile
 +++ b/arch/arm64/boot/dts/hisilicon/Makefile
 @@ -1,4 +1,4 @@
 -dtb-$(CONFIG_ARCH_HISI) += hi6220-hikey.dtb
 +dtb-$(CONFIG_ARCH_HISI) += hi6220-hikey.dtb hip05-d02.dtb
  
  always:= $(dtb-y)
  subdir-y  := $(dts-dirs)
 diff --git a/arch/arm64/boot/dts/hisilicon/hip05-d02.dts 
 b/arch/arm64/boot/dts/hisilicon/hip05-d02.dts
 new file mode 100644
 index 000..ae34e25
 --- /dev/null
 +++ b/arch/arm64/boot/dts/hisilicon/hip05-d02.dts
 @@ -0,0 +1,36 @@
 +/**
 + * dts file for Hisilicon D02 Development Board
 + *
 + * Copyright (C) 2014,2015 Hisilicon Ltd.
 + *
 + * 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
 + * publishhed by the Free Software Foundation.
 + *
 + */
 +
 +/dts-v1/;
 +
 +#include "hip05.dtsi"
 +
 +/ {
 +  model = "Hisilicon Hip05 D02 Development Board";
 +  compatible = "hisilicon,hip05-d02";
 +
 +  memory@ {
 +  device_type = "memory";
 +  reg = <0x0 0x 0x0 0x8000>;
 +  };
 +
 +  aliases {
 +  serial0 = &uart0;
 +  };
 +
 +  chosen {
 +  stdout-path = "serial0:115200n8";
 +  };
 +};
 +
 +&uart0 {
 +  status = "ok";
 +};
 diff --git a/arch/arm64/boot/dts/hisilicon/hip05.dtsi 
 b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
 new file mode 100644
 index 000..da12d94
 --- /dev/null
 +++ b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
 @@ -0,0 +1,271 @@
 +/**
 + * dts file for Hisilicon D02 Development Board
 + *
 + * Copyright (C) 2014,2015 Hisilicon Ltd.
 + *
 + * 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
 + * publishhed by the Free Software Foundation.
 + *
 + */
 +
 +#include 
 +
 +/ {
 +  compatible = "hisilicon,hip05-d02";
 +  interrupt-parent = <&gic>;
 +  #address-cells = <2>;
 +  #size-cells = <2>;
 +
 +  psci {
 +  compatible = "arm,psci-0.2";
 +  method = "smc";
 +  };
 +
 +  cpus {
 +  #address-cells = <1>;
 +  #size-cells = <0>;
 +
 +  cpu-map {
 +  cluster0 {
 +  core0 {
 +  cpu = <&cpu0>;
 +  };
 +  core1 {
 +  cpu = <&cpu1>;
 +  };
 +  core2 {
 +  cpu = <&cpu2>;
 +  };
 +  core3 {
 +  cpu = <&cpu3>;
 +  };
 +  };
 +  cluster1 {
 +  core0 {
 +  cpu = <&cpu4>;
 +  };
 +  core1 {
 +  cpu = <&cpu5>;
 +

[PATCH 09/15] tools lib api: Add debugfs into fs.c object

2015-09-02 Thread Jiri Olsa
Adding debugfs support into fs.c framework. It'll replace
the debugfs object functionality in following patches.

Link: http://lkml.kernel.org/n/tip-6n8d5bxn47oqcvlhzqw09...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 31 +--
 tools/lib/api/fs/fs.h |  1 +
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 0700eb953495..798052cbc7c0 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -1,5 +1,3 @@
-/* TODO merge/factor in debugfs.c here */
-
 #include 
 #include 
 #include 
@@ -26,6 +24,10 @@
 #define PROC_SUPER_MAGIC   0x9fa0
 #endif
 
+#ifndef DEBUGFS_MAGIC
+#define DEBUGFS_MAGIC  0x64626720
+#endif
+
 static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
@@ -36,6 +38,16 @@ static const char * const procfs__known_mountpoints[] = {
0,
 };
 
+#ifndef DEBUGFS_DEFAULT_PATH
+#define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug"
+#endif
+
+static const char * const debugfs__known_mountpoints[] = {
+   DEBUGFS_DEFAULT_PATH,
+   "/debug",
+   0,
+};
+
 struct fs {
const char  *name;
const char * const  *mounts;
@@ -45,8 +57,9 @@ struct fs {
 };
 
 enum {
-   FS__SYSFS  = 0,
-   FS__PROCFS = 1,
+   FS__SYSFS   = 0,
+   FS__PROCFS  = 1,
+   FS__DEBUGFS = 2,
 };
 
 static struct fs fs__entries[] = {
@@ -60,6 +73,11 @@ static struct fs fs__entries[] = {
.mounts = procfs__known_mountpoints,
.magic  = PROC_SUPER_MAGIC,
},
+   [FS__DEBUGFS] = {
+   .name   = "debugfs",
+   .mounts = debugfs__known_mountpoints,
+   .magic  = DEBUGFS_MAGIC,
+   },
 };
 
 static bool fs__read_mounts(struct fs *fs)
@@ -176,8 +194,9 @@ const char *name##__mountpoint(void)\
return fs__mountpoint(idx); \
 }
 
-FS__MOUNTPOINT(sysfs,  FS__SYSFS);
-FS__MOUNTPOINT(procfs, FS__PROCFS);
+FS__MOUNTPOINT(sysfs,   FS__SYSFS);
+FS__MOUNTPOINT(procfs,  FS__PROCFS);
+FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
 
 int filename__read_int(const char *filename, int *value)
 {
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 674efc8dfd9b..a4e6b1d93d2f 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -11,6 +11,7 @@
 
 const char *sysfs__mountpoint(void);
 const char *procfs__mountpoint(void);
+const char *debugfs__mountpoint(void);
 
 int filename__read_int(const char *filename, int *value);
 int sysctl__read_int(const char *sysctl, int *value);
-- 
2.4.3

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


[PATCH 14/15] tools lib api: Remove debugfs, tracefs and findfs objects

2015-09-02 Thread Jiri Olsa
We have all the functionality in fs.c, let's remove unneeded
objects.

Link: http://lkml.kernel.org/n/tip-4ylqs27bec3m6ofefqo0e...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/Build |  3 --
 tools/lib/api/fs/debugfs.c | 77 -
 tools/lib/api/fs/debugfs.h | 23 --
 tools/lib/api/fs/findfs.c  | 63 -
 tools/lib/api/fs/findfs.h  | 23 --
 tools/lib/api/fs/tracefs.c | 78 --
 tools/lib/api/fs/tracefs.h | 21 -
 7 files changed, 288 deletions(-)
 delete mode 100644 tools/lib/api/fs/debugfs.c
 delete mode 100644 tools/lib/api/fs/debugfs.h
 delete mode 100644 tools/lib/api/fs/findfs.c
 delete mode 100644 tools/lib/api/fs/findfs.h
 delete mode 100644 tools/lib/api/fs/tracefs.c
 delete mode 100644 tools/lib/api/fs/tracefs.h

diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build
index fa726f679b29..f4ed9629ae85 100644
--- a/tools/lib/api/fs/Build
+++ b/tools/lib/api/fs/Build
@@ -1,5 +1,2 @@
 libapi-y += fs.o
 libapi-y += tracing_path.o
-libapi-y += debugfs.o
-libapi-y += findfs.o
-libapi-y += tracefs.o
diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c
deleted file mode 100644
index c707cfb32782..
--- a/tools/lib/api/fs/debugfs.c
+++ /dev/null
@@ -1,77 +0,0 @@
-#define _GNU_SOURCE
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "debugfs.h"
-#include "tracefs.h"
-
-#ifndef DEBUGFS_DEFAULT_PATH
-#define DEBUGFS_DEFAULT_PATH   "/sys/kernel/debug"
-#endif
-
-char debugfs_mountpoint[PATH_MAX + 1] = DEBUGFS_DEFAULT_PATH;
-
-static const char * const debugfs_known_mountpoints[] = {
-   DEBUGFS_DEFAULT_PATH,
-   "/debug",
-   0,
-};
-
-static bool debugfs_found;
-
-bool debugfs_configured(void)
-{
-   return debugfs_find_mountpoint() != NULL;
-}
-
-/* find the path to the mounted debugfs */
-const char *debugfs_find_mountpoint(void)
-{
-   const char *ret;
-
-   if (debugfs_found)
-   return (const char *)debugfs_mountpoint;
-
-   ret = find_mountpoint("debugfs", (long) DEBUGFS_MAGIC,
- debugfs_mountpoint, PATH_MAX + 1,
- debugfs_known_mountpoints);
-   if (ret)
-   debugfs_found = true;
-
-   return ret;
-}
-
-/* mount the debugfs somewhere if it's not mounted */
-char *debugfs_mount(const char *mountpoint)
-{
-   /* see if it's already mounted */
-   if (debugfs_find_mountpoint())
-   goto out;
-
-   /* if not mounted and no argument */
-   if (mountpoint == NULL) {
-   /* see if environment variable set */
-   mountpoint = getenv(PERF_DEBUGFS_ENVIRONMENT);
-   /* if no environment variable, use default */
-   if (mountpoint == NULL)
-   mountpoint = DEBUGFS_DEFAULT_PATH;
-   }
-
-   if (mount(NULL, mountpoint, "debugfs", 0, NULL) < 0)
-   return NULL;
-
-   /* save the mountpoint */
-   debugfs_found = true;
-   strncpy(debugfs_mountpoint, mountpoint, sizeof(debugfs_mountpoint));
-out:
-   return debugfs_mountpoint;
-}
diff --git a/tools/lib/api/fs/debugfs.h b/tools/lib/api/fs/debugfs.h
deleted file mode 100644
index 455023698d2b..
--- a/tools/lib/api/fs/debugfs.h
+++ /dev/null
@@ -1,23 +0,0 @@
-#ifndef __API_DEBUGFS_H__
-#define __API_DEBUGFS_H__
-
-#include "findfs.h"
-
-#ifndef DEBUGFS_MAGIC
-#define DEBUGFS_MAGIC  0x64626720
-#endif
-
-#ifndef PERF_DEBUGFS_ENVIRONMENT
-#define PERF_DEBUGFS_ENVIRONMENT "PERF_DEBUGFS_DIR"
-#endif
-
-bool debugfs_configured(void);
-const char *debugfs_find_mountpoint(void);
-char *debugfs_mount(const char *mountpoint);
-
-extern char debugfs_mountpoint[];
-
-int debugfs__strerror_open(int err, char *buf, size_t size, const char 
*filename);
-int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char 
*sys, const char *name);
-
-#endif /* __API_DEBUGFS_H__ */
diff --git a/tools/lib/api/fs/findfs.c b/tools/lib/api/fs/findfs.c
deleted file mode 100644
index 49946cb6d7af..
--- a/tools/lib/api/fs/findfs.c
+++ /dev/null
@@ -1,63 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "findfs.h"
-
-/* verify that a mountpoint is actually the type we want */
-
-int valid_mountpoint(const char *mount, long magic)
-{
-   struct statfs st_fs;
-
-   if (statfs(mount, &st_fs) < 0)
-   return -ENOENT;
-   else if ((long)st_fs.f_type != magic)
-   return -ENOENT;
-
-   return 0;
-}
-
-/* find the path to a mounted file system */
-const char *find_mountpoint(const char *fstype, long magic,
-   char *mountpoint, int len,
-   const char * const *known_mountpoints)
-{
-   const char * const *ptr;

[PATCH 10/15] tools lib api: Add tracefs into fs.c object

2015-09-02 Thread Jiri Olsa
Adding tracefs support into fs.c framework. It'll replace
the tracefs object functionality in following patches.

Link: http://lkml.kernel.org/n/tip-m27bbnbg8s03mt2na6zgh...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 28 
 tools/lib/api/fs/fs.h |  1 +
 2 files changed, 29 insertions(+)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 798052cbc7c0..ef16d2a83a27 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -28,6 +28,10 @@
 #define DEBUGFS_MAGIC  0x64626720
 #endif
 
+#ifndef TRACEFS_MAGIC
+#define TRACEFS_MAGIC  0x74726163
+#endif
+
 static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
@@ -48,6 +52,19 @@ static const char * const debugfs__known_mountpoints[] = {
0,
 };
 
+
+#ifndef TRACEFS_DEFAULT_PATH
+#define TRACEFS_DEFAULT_PATH "/sys/kernel/tracing"
+#endif
+
+static const char * const tracefs__known_mountpoints[] = {
+   TRACEFS_DEFAULT_PATH,
+   "/sys/kernel/debug/tracing",
+   "/tracing",
+   "/trace",
+   0,
+};
+
 struct fs {
const char  *name;
const char * const  *mounts;
@@ -60,8 +77,13 @@ enum {
FS__SYSFS   = 0,
FS__PROCFS  = 1,
FS__DEBUGFS = 2,
+   FS__TRACEFS = 3,
 };
 
+#ifndef TRACEFS_MAGIC
+#define TRACEFS_MAGIC 0x74726163
+#endif
+
 static struct fs fs__entries[] = {
[FS__SYSFS] = {
.name   = "sysfs",
@@ -78,6 +100,11 @@ static struct fs fs__entries[] = {
.mounts = debugfs__known_mountpoints,
.magic  = DEBUGFS_MAGIC,
},
+   [FS__TRACEFS] = {
+   .name   = "tracefs",
+   .mounts = tracefs__known_mountpoints,
+   .magic  = TRACEFS_MAGIC,
+   },
 };
 
 static bool fs__read_mounts(struct fs *fs)
@@ -197,6 +224,7 @@ const char *name##__mountpoint(void)\
 FS__MOUNTPOINT(sysfs,   FS__SYSFS);
 FS__MOUNTPOINT(procfs,  FS__PROCFS);
 FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
+FS__MOUNTPOINT(tracefs, FS__TRACEFS);
 
 int filename__read_int(const char *filename, int *value)
 {
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index a4e6b1d93d2f..9013227ae0d1 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -12,6 +12,7 @@
 const char *sysfs__mountpoint(void);
 const char *procfs__mountpoint(void);
 const char *debugfs__mountpoint(void);
+const char *tracefs__mountpoint(void);
 
 int filename__read_int(const char *filename, int *value);
 int sysctl__read_int(const char *sysctl, int *value);
-- 
2.4.3

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


[PATCH 08/15] tools lib api: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c

2015-09-02 Thread Jiri Olsa
There's no need to export SYSFS_MAGIC PROC_SUPER_MAGIC
in fs.h. Leave them in the fs.c.

Link: http://lkml.kernel.org/n/tip-b2cd1bb7yvbazq5oua24o...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 8 
 tools/lib/api/fs/fs.h | 8 
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 5e838d3c419d..0700eb953495 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -18,6 +18,14 @@
 #define _STR(x) #x
 #define STR(x) _STR(x)
 
+#ifndef SYSFS_MAGIC
+#define SYSFS_MAGIC0x62656572
+#endif
+
+#ifndef PROC_SUPER_MAGIC
+#define PROC_SUPER_MAGIC   0x9fa0
+#endif
+
 static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index fd6288d73383..674efc8dfd9b 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -9,14 +9,6 @@
 #define PATH_MAX 4096
 #endif
 
-#ifndef SYSFS_MAGIC
-#define SYSFS_MAGIC0x62656572
-#endif
-
-#ifndef PROC_SUPER_MAGIC
-#define PROC_SUPER_MAGIC   0x9fa0
-#endif
-
 const char *sysfs__mountpoint(void);
 const char *procfs__mountpoint(void);
 
-- 
2.4.3

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


[PATCH 06/15] tools lib api: Make tracing_path_strerror_open message generic

2015-09-02 Thread Jiri Olsa
Making tracing_path__strerror_open_tp message generic by mentioning
both debugfs/tracefs words in error message plus the tracing_path
instead of debugfs_mountpoint.

Link: http://lkml.kernel.org/n/tip-5y7nboe2xe619hp649ry5...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/tracing_path.c | 20 ++--
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 3b3e4f5fc50b..b0ee3b3acef0 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -90,33 +90,33 @@ static int strerror_open(int err, char *buf, size_t size, 
const char *filename)
 
switch (err) {
case ENOENT:
-   if (debugfs_configured()) {
+   if (debugfs_configured() || tracefs_configured()) {
snprintf(buf, size,
 "Error:\tFile %s/%s not found.\n"
 "Hint:\tPerhaps this kernel misses some 
CONFIG_ setting to enable this feature?.\n",
-debugfs_mountpoint, filename);
+tracing_events_path, filename);
break;
}
snprintf(buf, size, "%s",
-"Error:\tUnable to find debugfs\n"
-"Hint:\tWas your kernel compiled with debugfs 
support?\n"
-"Hint:\tIs the debugfs filesystem mounted?\n"
+"Error:\tUnable to find debugfs/tracefs\n"
+"Hint:\tWas your kernel compiled with debugfs/tracefs 
support?\n"
+"Hint:\tIs the debugfs/tracefs filesystem mounted?\n"
 "Hint:\tTry 'sudo mount -t debugfs nodev 
/sys/kernel/debug'");
break;
case EACCES: {
-   const char *mountpoint = debugfs_mountpoint;
+   const char *mountpoint = debugfs_find_mountpoint();
 
-   if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, 
"tracing/", 8) == 0) {
+   if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 
8) == 0) {
const char *tracefs_mntpoint = 
tracefs_find_mountpoint();
 
if (tracefs_mntpoint)
-   mountpoint = tracefs_mntpoint;
+   mountpoint = tracefs_find_mountpoint();
}
 
snprintf(buf, size,
 "Error:\tNo permissions to read %s/%s\n"
 "Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
-debugfs_mountpoint, filename, mountpoint);
+tracing_events_path, filename, mountpoint);
}
break;
default:
@@ -131,7 +131,7 @@ int tracing_path__strerror_open_tp(int err, char *buf, 
size_t size, const char *
 {
char path[PATH_MAX];
 
-   snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
+   snprintf(path, PATH_MAX, "%s/%s", sys, name ?: "*");
 
return strerror_open(err, buf, size, path);
 }
-- 
2.4.3

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


[PATCH 05/15] tools lib api: Move debugfs__strerror_open into tracing_path.c object

2015-09-02 Thread Jiri Olsa
Moving debugfs__strerror_open out of api/fs/debugfs.c,
because it's not debugfs specific. It'll be changed to
consider tracefs mount as well in following patches.

Renaming it into tracing_path__strerror_open_tp to fit
into the namespace. No functional change is intended.

Link: http://lkml.kernel.org/n/tip-bq0f0l4r0bjvy0pjp4m75...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/debugfs.c  | 52 ---
 tools/lib/api/fs/tracing_path.c | 54 +
 tools/lib/api/fs/tracing_path.h |  3 +++
 tools/perf/builtin-trace.c  |  5 ++--
 4 files changed, 60 insertions(+), 54 deletions(-)

diff --git a/tools/lib/api/fs/debugfs.c b/tools/lib/api/fs/debugfs.c
index eb7cf4d18f8a..c707cfb32782 100644
--- a/tools/lib/api/fs/debugfs.c
+++ b/tools/lib/api/fs/debugfs.c
@@ -75,55 +75,3 @@ char *debugfs_mount(const char *mountpoint)
 out:
return debugfs_mountpoint;
 }
-
-int debugfs__strerror_open(int err, char *buf, size_t size, const char 
*filename)
-{
-   char sbuf[128];
-
-   switch (err) {
-   case ENOENT:
-   if (debugfs_found) {
-   snprintf(buf, size,
-"Error:\tFile %s/%s not found.\n"
-"Hint:\tPerhaps this kernel misses some 
CONFIG_ setting to enable this feature?.\n",
-debugfs_mountpoint, filename);
-   break;
-   }
-   snprintf(buf, size, "%s",
-"Error:\tUnable to find debugfs\n"
-"Hint:\tWas your kernel compiled with debugfs 
support?\n"
-"Hint:\tIs the debugfs filesystem mounted?\n"
-"Hint:\tTry 'sudo mount -t debugfs nodev 
/sys/kernel/debug'");
-   break;
-   case EACCES: {
-   const char *mountpoint = debugfs_mountpoint;
-
-   if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, 
"tracing/", 8) == 0) {
-   const char *tracefs_mntpoint = 
tracefs_find_mountpoint();
-
-   if (tracefs_mntpoint)
-   mountpoint = tracefs_mntpoint;
-   }
-
-   snprintf(buf, size,
-"Error:\tNo permissions to read %s/%s\n"
-"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
-debugfs_mountpoint, filename, mountpoint);
-   }
-   break;
-   default:
-   snprintf(buf, size, "%s", strerror_r(err, sbuf, sizeof(sbuf)));
-   break;
-   }
-
-   return 0;
-}
-
-int debugfs__strerror_open_tp(int err, char *buf, size_t size, const char 
*sys, const char *name)
-{
-   char path[PATH_MAX];
-
-   snprintf(path, PATH_MAX, "tracing/events/%s/%s", sys, name ?: "*");
-
-   return debugfs__strerror_open(err, buf, size, path);
-}
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 1fd6e1f99234..3b3e4f5fc50b 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -5,6 +5,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include "debugfs.h"
 #include "tracefs.h"
 
@@ -81,3 +83,55 @@ void put_tracing_file(char *file)
 {
free(file);
 }
+
+static int strerror_open(int err, char *buf, size_t size, const char *filename)
+{
+   char sbuf[128];
+
+   switch (err) {
+   case ENOENT:
+   if (debugfs_configured()) {
+   snprintf(buf, size,
+"Error:\tFile %s/%s not found.\n"
+"Hint:\tPerhaps this kernel misses some 
CONFIG_ setting to enable this feature?.\n",
+debugfs_mountpoint, filename);
+   break;
+   }
+   snprintf(buf, size, "%s",
+"Error:\tUnable to find debugfs\n"
+"Hint:\tWas your kernel compiled with debugfs 
support?\n"
+"Hint:\tIs the debugfs filesystem mounted?\n"
+"Hint:\tTry 'sudo mount -t debugfs nodev 
/sys/kernel/debug'");
+   break;
+   case EACCES: {
+   const char *mountpoint = debugfs_mountpoint;
+
+   if (!access(debugfs_mountpoint, R_OK) && strncmp(filename, 
"tracing/", 8) == 0) {
+   const char *tracefs_mntpoint = 
tracefs_find_mountpoint();
+
+   if (tracefs_mntpoint)
+   mountpoint = tracefs_mntpoint;
+   }
+
+   snprintf(buf, size,
+"Error:\tNo permissions to read %s/%s\n"
+"Hint:\tTry 'sudo mount -o remount,mode=755 %s'\n",
+debugfs_mountpoint, filename, mountpoint);
+   }
+   break;
+   default:
+   snprintf(

[PATCH 03/15] perf tools: Move tracing_path stuff under same namespace

2015-09-02 Thread Jiri Olsa
Renaming all functions touching tracing_path under same
namespace. New interface is:

  char tracing_path[];
  - tracing mount path

  char tracing_events_path[];
  - tracing mount/events path

  void tracing_path_set(const char *mountpoint);
  - setting directly tracing_path(_events), used by --debugfs-dir option

  const char *tracing_path_mount(void);
  - initial setup of tracing_(events)_path, called from perf.c
mounts debugfs/tracefs if needed and possible

  char *get_tracing_file(const char *name);
  void put_tracing_file(char *file);
  - get/put tracing file path

Link: http://lkml.kernel.org/n/tip-miy6kftxxryjf40b3qb6e...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/perf/perf.c  | 10 ++
 tools/perf/util/util.c | 20 ++--
 tools/perf/util/util.h |  4 ++--
 3 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index f500a4b40722..0e99cd1de9dd 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -214,7 +214,7 @@ static int handle_options(const char ***argv, int *argc, 
int *envchanged)
fprintf(stderr, "No directory given for 
--debugfs-dir.\n");
usage(perf_usage_string);
}
-   perf_debugfs_set_path((*argv)[1]);
+   tracing_path_set((*argv)[1]);
if (envchanged)
*envchanged = 1;
(*argv)++;
@@ -230,7 +230,7 @@ static int handle_options(const char ***argv, int *argc, 
int *envchanged)
(*argv)++;
(*argc)--;
} else if (!prefixcmp(cmd, CMD_DEBUGFS_DIR)) {
-   perf_debugfs_set_path(cmd + strlen(CMD_DEBUGFS_DIR));
+   tracing_path_set(cmd + strlen(CMD_DEBUGFS_DIR));
fprintf(stderr, "dir: %s\n", tracing_path);
if (envchanged)
*envchanged = 1;
@@ -517,8 +517,10 @@ int main(int argc, const char **argv)
cmd = perf_extract_argv0_path(argv[0]);
if (!cmd)
cmd = "perf-help";
-   /* get debugfs mount point from /proc/mounts */
-   perf_debugfs_mount();
+
+   /* get debugfs/tracefs mount point from /proc/mounts */
+   tracing_path_mount();
+
/*
 * "perf-" is the same as "perf ", but we obviously:
 *
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 74f71f8afcc2..b959f783f6cd 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -390,7 +390,7 @@ void set_term_quiet_input(struct termios *old)
tcsetattr(0, TCSANOW, &tc);
 }
 
-static void set_tracing_events_path(const char *tracing, const char 
*mountpoint)
+static void __tracing_path_set(const char *tracing, const char *mountpoint)
 {
snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
 mountpoint, tracing);
@@ -398,7 +398,7 @@ static void set_tracing_events_path(const char *tracing, 
const char *mountpoint)
 mountpoint, tracing, "events");
 }
 
-static const char *__perf_tracefs_mount(void)
+static const char *tracing_path_tracefs_mount(void)
 {
const char *mnt;
 
@@ -406,12 +406,12 @@ static const char *__perf_tracefs_mount(void)
if (!mnt)
return NULL;
 
-   set_tracing_events_path("", mnt);
+   __tracing_path_set("", mnt);
 
return mnt;
 }
 
-static const char *__perf_debugfs_mount(void)
+static const char *tracing_path_debugfs_mount(void)
 {
const char *mnt;
 
@@ -419,27 +419,27 @@ static const char *__perf_debugfs_mount(void)
if (!mnt)
return NULL;
 
-   set_tracing_events_path("tracing/", mnt);
+   __tracing_path_set("tracing/", mnt);
 
return mnt;
 }
 
-const char *perf_debugfs_mount(void)
+const char *tracing_path_mount(void)
 {
const char *mnt;
 
-   mnt = __perf_tracefs_mount();
+   mnt = tracing_path_tracefs_mount();
if (mnt)
return mnt;
 
-   mnt = __perf_debugfs_mount();
+   mnt = tracing_path_debugfs_mount();
 
return mnt;
 }
 
-void perf_debugfs_set_path(const char *mntpt)
+void tracing_path_set(const char *mntpt)
 {
-   set_tracing_events_path("tracing/", mntpt);
+   __tracing_path_set("tracing/", mntpt);
 }
 
 char *get_tracing_file(const char *name)
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 184d40048faa..230c4124bfa7 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -85,8 +85,8 @@ extern const char *graph_dotted_line;
 extern char buildid_dir[];
 extern char tracing_path[];
 extern char tracing_events_path[];
-extern void perf_debugfs_set_path(const char *mountpoint);
-const char *perf_debugfs_mount(void);
+extern void tracing_path_set(const char *mountpoint);
+const char *tracing_path_mount(void);
 char *get_tracing_file

Re: [PATCH v2 2/2] ARM: dts: Add exynos5422-odroidxu4 board

2015-09-02 Thread Javier Martinez Canillas
Hello Krzysztof,

On 09/02/2015 03:30 AM, Krzysztof Kozlowski wrote:
> Add Hardkernel Odroid XU4 board Device Tree sources. The board differs
> from Odroid XU3 and XU3-Lite by:
> 1. No green and red leds (except standard red power led).
> 2. No audio codec.
> 3. Two USB3 ports in host mode (no micro USB3 connector for OTG).
> 4. Realtek RTL8153-CG gigabit network adapter (instead of SMSC9514).
> 5. Additional connector with IO ports (I2S_0, I2C_5).
> 6. No DisplayPort (like XU3-Lite).
> 7. No TI INA231 power measurement sensors (like XU3-Lite).
> 
> Signed-off-by: Krzysztof Kozlowski 
> 

Looks good to me.

Reviewed-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 00/15] perf tools: Cleanup filesystem api

2015-09-02 Thread Jiri Olsa
On Wed, Sep 02, 2015 at 09:56:30AM +0200, Jiri Olsa wrote:
> hi,
> this patchset moves all filesystem we use under
> api/fs/fs.c framework and adds new tracing_path
> object to get tracing area (path).
> 
> It unifies the way we use debugfs/tracefs paths
> and removes some redundant code.
> 
> It's base for the tracepoint parsing error reporting
> I posted recently.

also available in here:
  git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
  perf/tracing_path

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


[PATCH] rtc: Abracon ABX8XX write RTC fix

2015-09-02 Thread Mitja Spes
Fixed RTC write bit as per application manual

Signed-off-by: Mitja Spes 
---
 drivers/rtc/rtc-abx80x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-abx80x.c b/drivers/rtc/rtc-abx80x.c
index 4337c3b..afea84c 100644
--- a/drivers/rtc/rtc-abx80x.c
+++ b/drivers/rtc/rtc-abx80x.c
@@ -28,7 +28,7 @@
 #define ABX8XX_REG_WD  0x07
 
 #define ABX8XX_REG_CTRL1   0x10
-#define ABX8XX_CTRL_WRITE  BIT(1)
+#define ABX8XX_CTRL_WRITE  BIT(0)
 #define ABX8XX_CTRL_12_24  BIT(6)
 
 #define ABX8XX_REG_CFG_KEY 0x1f
-- 
1.9.1

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


Re: [PATCH v4 2/2] dt: power: st: Provide bindings for ST's OPPs

2015-09-02 Thread Viresh Kumar
On 26-08-15, 13:06, Lee Jones wrote:
> On Wed, 12 Aug 2015, Viresh Kumar wrote:
> 
> > On 11-08-15, 16:17, Lee Jones wrote:
> > > This would work if we only had a single variable to contend with, but
> > > what I showed you in my previous example is that we have 3 variables
> > > to consider; cut (version), pcode and substrate.
> > > 
> > > Using the two (simple) examples I provided, how would your suggestion
> > > look in our case?
> > 
> > So the solution I gave is for picking the microvolt based on pcode.
> > The other two (cut, substrate) aren't about picking microvolt, but if
> > the OPP is available or not. Right?
> 
> 'pcode', 'cut' and 'substrate' all determine whether a given set of
> OPPs an be used on the running platform.  I do not believe that you
> can differentiate between them. 
> 
> > If these terms are generic enough, then we can add something similar
> > to what you have added..
> 
> If it makes it easier, you can treat them as version numbers 2.2.1
> , but I don't see how this can help.  Obviously
> this becomes more difficult when you add wild cards to the OPPs, where
> a particular OPP would be suitable for all cuts for example.
> 
> If you still think you can come up with a generic method to lay out
> CPUFreq OPP nodes that will satisfy all vendors and not be a mass of
> 10's of separate nodes, then great.  Again, I'm struggling to see how
> that might be possible.
> 
> What I believe we shouldn't do, is have this blocked forever for the
> sake of adding a couple of vendor properties however.

I agree and can understand the pain you are feeling..

@Rob/Stephen: Please close this thread soon and let Lee get his work
done :)

-- 
viresh
--
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/8] mmc: dw_mmc: dt-binding: Add tuning related things

2015-09-02 Thread Heiko Stuebner
Hi Jaehoon,

Am Mittwoch, 2. September 2015, 14:01:52 schrieb Jaehoon Chung:
> Hi, Heiko.
> 
> On 09/01/2015 03:24 AM, Heiko Stuebner wrote:
> > From: Alexandru M Stan 
> > 
> > Add ciu_drv, ciu_sample clocks and default-sample-phase. This will later
> > be used by tuning code.
> 
> As i know, ciu_drv and ciu_sample clocks are generated with "ciu" clock.
> But in these patch-set, ciu_drv and ciu_sample are controlled by clock
> framework. It's a little strange.
> Are there ciu_drv and ciu_sample clock on Rockchip?

Yes on Rockchip SoCs the drv and sample clock registers are residing inside 
the clock controller and not in the dw_mmc block.

See drivers/clk/rockchip/clk-mmcphase.c and clk-rk3288.c around line 490 .


Heiko

> > We do not touch ciu_drive (and by extension define default-drive-phase).
> > Drive phase is mostly used to define minimum hold times, while one could
> > write some code to determine what phase meets the minimum hold time
> > (ex 10 degrees) this will not work with the current clock phase framework
> > (which floors angles, so we'll get 0 deg, and there's no way to know what
> > resolution the floors happen at). We assume that the default drive angles
> > set by the hardware are good enough.
> > 
> > Signed-off-by: Alexandru M Stan 
> > Signed-off-by: Heiko Stuebner 
> > ---
> > 
> >  Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt | 14
> >  ++ 1 file changed, 10 insertions(+), 4 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
> > b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt index
> > 346c609..5edadc2 100644
> > --- a/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
> > +++ b/Documentation/devicetree/bindings/mmc/synopsys-dw-mshc.txt
> > 
> > @@ -42,11 +42,13 @@ Optional properties:
> >  * clocks: from common clock binding: handle to biu and ciu clocks for the
> >  
> >bus interface unit clock and the card interface unit clock.
> > 
> > -* clock-names: from common clock binding: Shall be "biu" and "ciu".
> > -  If the biu clock is missing we'll simply skip enabling it.  If the
> > -  ciu clock is missing we'll just assume that the clock is running at
> > +* clock-names: from common clock binding: Shall be "biu", "ciu",
> > "ciu_drv" and +  "ciu_sample".  If the biu clock is missing we'll simply
> > skip enabling it. +  If the ciu clock is missing we'll just assume that
> > the clock is running at> 
> >clock-frequency.  It is an error to omit both the ciu clock and the
> > 
> > -  clock-frequency.
> > +  clock-frequency.  "ciu_drv" and "ciu_sample" are used to control the
> > clock +  phases, "ciu_sample" is required for tuning high speed modes (if
> > no other +  custom tuning method is defined).
> > 
> >  * clock-frequency: should be the frequency (in Hz) of the ciu clock.  If
> >  this>  
> >is specified and the ciu clock is specified then we'll try to set the
> >ciu
> > 
> > @@ -75,6 +77,10 @@ Optional properties:
> >  * vmmc-supply: The phandle to the regulator to use for vmmc.  If this is
> >  
> >specified we'll defer probe until we can find this regulator.
> > 
> > +* default-sample-phase: The default phase to set ciu_sample at probing,
> > low +  speeds or in case where all phases work at tuning time. If not
> > specified +  0 deg will be used.
> > +
> > 
> >  Aliases:
> >  
> >  - All the MSHC controller nodes should be represented in the aliases node
> >  using

--
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 5/5] sched: add two functions for att(det)aching a task to(from) a cfs_rq

2015-09-02 Thread Peter Zijlstra
On Wed, Sep 02, 2015 at 11:33:15AM +0900, Byungchul Park wrote:
> +++ b/kernel/sched/fair.c
> @@ -7920,14 +7920,14 @@ prio_changed_fair(struct rq *rq, struct task_struct 
> *p, int oldprio)
>  
>  static inline bool vruntime_normalized(struct task_struct *p)
>  {
>   struct sched_entity *se = &p->se;
>  
>   /*
> +  * In both TASK_ON_RQ_QUEUED case and TASK_ON_RQ_MIGRATING case,
> +  * the dequeue_entity(.flags=0) will already have normalized the
> +  * vruntime.
>*/
> + if (p->on_rq)
>   return true;
>  

You're right. And yes this is nicer. Thanks!

I've folded it into your 5/5 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/


linux-next: Tree for Sep 2

2015-09-02 Thread Stephen Rothwell
Hi all,

There will be no linux-next release this Friday or Monday.

Please do not add material for v4.4 until after v4.3-rc1 is out.

Changes since 20150901:

I used the h8300 tree from next-20150828 since the current tree has been
rebased onto something very old :-(

The block tree gained a conflict against the xfs tree.

The device-mapper tree gained a conflicta against the block tree.

The rcu tree still had its build failure so I used the version from
next-20150831.

The tty tree lost its build failure.

Non-merge commits (relative to Linus' tree): 7381
 6840 files changed, 451330 insertions(+), 183665 deletions(-)



I have created today's linux-next tree at
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
(patches at http://www.kernel.org/pub/linux/kernel/next/ ).  If you
are tracking the linux-next tree using git, you should not use "git pull"
to do so as that will try to merge the new linux-next release with the
old one.  You should use "git fetch" and checkout or reset to the new
master.

You can see which trees have been included by looking in the Next/Trees
file in the source.  There are also quilt-import.log and merge.log
files in the Next directory.  Between each merge, the tree was built
with a ppc64_defconfig for powerpc and an allmodconfig for x86_64,
a multi_v7_defconfig for arm and a native build of tools/perf. After
the final fixups (if any), it is also built with powerpc allnoconfig
(32 and 64 bit), ppc44x_defconfig and allyesconfig (this fails its final
link) and i386, sparc, sparc64 and arm defconfig.

Below is a summary of the state of the merge.

I am currently merging 225 trees (counting Linus' and 33 trees of patches
pending for Linus' tree).

Stats about the size of the tree over time can be seen at
http://neuling.org/linux-next-size.html .

Status of my local build tests will be at
http://kisskb.ellerman.id.au/linux-next .  If maintainers want to give
advice about cross compilers/configs that work, we are always open to add
more builds.

Thanks to Randy Dunlap for doing many randconfig builds.  And to Paul
Gortmaker for triage and bug fixes.

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

$ git checkout master
$ git reset --hard stable
Merging origin/master (8d01b66b4f23 Merge tag 'armsoc-arm64' of 
git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc)
Merging fixes/master (c7e9ad7da219 Merge branch 'perf-urgent-for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip)
Merging kbuild-current/rc-fixes (3d1450d54a4f Makefile: Force gzip and xz on 
module install)
Merging arc-current/for-curr (e4140819dadc ARC: signal handling robustify)
Merging arm-current/fixes (3939f3345050 ARM: 8418/1: add boot image 
dependencies to not generate invalid images)
Merging m68k-current/for-linus (1ecb40643a9a m68k/bootinfo: Use kmemdup rather 
than duplicating its implementation)
Merging metag-fixes/fixes (0164a711c97b metag: Fix ioremap_wc/ioremap_cached 
build errors)
Merging mips-fixes/mips-fixes (1795cd9b3a91 Linux 3.16-rc5)
Merging powerpc-fixes/fixes (4d9aac397a5d powerpc/PCI: Disable MSI/MSI-X 
interrupts at PCI probe time in OF case)
Merging powerpc-merge-mpe/fixes (bc0195aad0da Linux 4.2-rc2)
Merging sparc/master (73958c651fbf sparc64: use ENTRY/ENDPROC in VISsave)
Merging net/master (f892a84cc890 net/smsc911x: Fix deferred probe for interrupt)
Merging ipsec/master (158cd4af8ded packet: missing dev_put() in 
packet_do_bind())
Merging sound-current/for-linus (08ceab9d8758 Merge tag 'asoc-v4.2-rc8' of 
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus)
Merging pci-current/for-linus (45ea2a5fed6d PCI: Don't use 64-bit bus addresses 
on PA-RISC)
Merging wireless-drivers/master (741e3b9902d1 rtlwifi: rtl8723be: Add module 
parameter for MSI interrupts)
Merging driver-core.current/driver-core-linus (cbfe8fa6cd67 Linux 4.2-rc4)
Merging tty.current/tty-linus (cbfe8fa6cd67 Linux 4.2-rc4)
Merging usb.current/usb-linus (f7644cbfcdf0 Linux 4.2-rc6)
Merging usb-gadget-fixes/fixes (c93e64e91248 usb: udc: core: add device_del() 
call to error pathway)
Merging usb-serial-fixes/usb-linus (d071a3cdd2e1 USB: qcserial: add HP lt4111 
LTE/EV-DO/HSPA+ Gobi 4G Module)
Merging staging.current/staging-linus (f7644cbfcdf0 Linux 4.2-rc6)
Merging char-misc.current/char-misc-linus (f7644cbfcdf0 Linux 4.2-rc6)
Merging input-current/for-linus (e51e38494a8e Input: synaptics - fix handling 
of disabling gesture mode)
Merging crypto-current/master (bf433416e675 crypto: algif_aead - fix for 
multiple operations on AF_ALG sockets)
Merging ide/master (d681f1166919 ide: remove deprecated use of pci api)
Merging devicetree-current/devicetree/merge (f76502aa9140 of/dynamic: Fix test 
for PPC_PSERIES)
Merging rr-fixes/fixes (275d7d44d802 module: Fix locking in symbol_put_addr())
Merging vfio-fixes/for-linus (4bc94d5dc95d vfio: Fix lockdep issue)
Merging kselftest-fixes/fi

Re: [PATCH v4 6/8] scsi: ufs: make the UFS variant a platform device

2015-09-02 Thread ygardi
> On Sun, Aug 30, 2015 at 9:52 AM, Yaniv Gardi 
> wrote:
>> This change turns the UFS variant (SCSI_UFS_QCOM) into a UFS
>> a platform device.
>> In order to do so a few additional changes are required:
>> 1. The ufshcd-pltfrm is no longer serves as a platform device.
>>Now it only serves as a group of platform APIs such as PM APIs
>>(runtime suspend/resume, system suspend/resume etc), parsers of
>>clocks, regulators and pm_levels from DT.
>> 2. What used to be the old platform "probe" is now "only"
>>a pltfrm_init() routine, that does exactly the same, but only
>>being called by the new probe function of the UFS variant.
>>
>> Signed-off-by: Yaniv Gardi 
>>
>> ---
>>  Documentation/devicetree/bindings/ufs/ufs-qcom.txt | 57 ++
>>  .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |  4 +-
>
> For the binding:
>
> Reviewed-by: Rob Herring 
>
> A comment on the driver part still.
>
>> diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
>> index 329ac84..8027435 100644
>> --- a/drivers/scsi/ufs/ufs-qcom.c
>> +++ b/drivers/scsi/ufs/ufs-qcom.c
>
> [...]
>
>> +static int ufs_qcom_probe(struct platform_device *pdev)
>> +{
>> +   int err;
>> +   struct device *dev = &pdev->dev;
>> +   struct ufs_hba *hba;
>> +
>> +   /* Perform generic probe */
>> +   err = ufshcd_pltfrm_init(pdev, &ufs_hba_qcom_vops);
>> +   if (err) {
>> +   dev_err(dev, "ufshcd_pltfrm_init() failed %d\n", err);
>> +   goto out;
>> +   }
>> +
>> +   hba = platform_get_drvdata(pdev);
>
> I thought this was not necessary?

skipped my eye. i'm uploading another version without this redundant check

>
>> +   if (unlikely(!hba)) {
>> +   dev_err(dev, "no hba structure after successful
>> probing\n");
>> +   goto dealloc_host;
>> +   }
>> +
>> +   return 0;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


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


[PATCH v2 2/4] perf tests: make objdump disassemble zero blocks

2015-09-02 Thread Jan Stancek
Add -z parameter to avoid skipping zero blocks:

 816704fe :
 816704fe:  7b 34 jnp 81670534 
   ...
 81670501 :
 81670501:  0f ba e2 03   bt  $0x3,%edx
 81670505:  73 11 jae 81670518 

Signed-off-by: Jan Stancek 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Corey Ashford 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
---
 tools/perf/tests/code-reading.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 38ee90bc2228..375ba30e4ed0 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -128,7 +128,8 @@ static int read_via_objdump(const char *filename, u64 addr, 
void *buf,
FILE *f;
int ret;
 
-   fmt = "%s -d --start-address=0x%"PRIx64" --stop-address=0x%"PRIx64" %s";
+   fmt = "%s -z -d --start-address=0x%"PRIx64\
+   " --stop-address=0x%"PRIx64" %s";
ret = snprintf(cmd, sizeof(cmd), fmt, "objdump", addr, addr + len,
   filename);
if (ret <= 0 || (size_t)ret >= sizeof(cmd))
-- 
1.8.3.1

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


[PATCH v2 4/4] perf tests: print objdump/dso buffers if they don't match

2015-09-02 Thread Jan Stancek
Signed-off-by: Jan Stancek 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Corey Ashford 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
---
 tools/perf/tests/code-reading.c | 16 
 1 file changed, 16 insertions(+)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index e6bf47ff7e91..53a04f899d18 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -163,6 +163,18 @@ static int read_via_objdump(const char *filename, u64 
addr, void *buf,
return ret;
 }
 
+static void dump_buf(unsigned char *buf, size_t len)
+{
+   size_t i;
+
+   for (i = 0; i < len; i++) {
+   pr_debug("0x%02x ", buf[i]);
+   if (i % 16 == 15)
+   pr_debug("\n");
+   }
+   pr_debug("\n");
+}
+
 static int read_object_code(u64 addr, size_t len, u8 cpumode,
struct thread *thread, struct state *state)
 {
@@ -265,6 +277,10 @@ static int read_object_code(u64 addr, size_t len, u8 
cpumode,
/* The results should be identical */
if (memcmp(buf1, buf2, len)) {
pr_debug("Bytes read differ from those read by objdump\n");
+   pr_debug("buf1 (dso):\n");
+   dump_buf(buf1, len);
+   pr_debug("buf2 (objdump):\n");
+   dump_buf(buf2, len);
return -1;
}
pr_debug("Bytes read match those read by objdump\n");
-- 
1.8.3.1

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


[PATCH v2 1/4] perf tests: take into account address of each objdump line

2015-09-02 Thread Jan Stancek
objdump output can contain repeated bytes. At the moment test reads
all output sequentially, assuming each address is represented in
output only once:

  8164efb3 :
  8164efb3:  c1 5d 00 ebrcrl   $0xeb,0x0(%rbp)
  8164efb7:  00 4c 8b 5cadd%cl,0x5c(%rbx,%rcx,4)

  8164efb8 :
  8164efb8:  4c 8b 5c 24 30 mov0x30(%rsp),%r11
  8164efbd:  4c 8b 54 24 38 mov0x38(%rsp),%r10

Store objdump output to buffer according to offset calculated
from address on each line.

Signed-off-by: Jan Stancek 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Corey Ashford 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
---
 tools/perf/tests/code-reading.c | 51 ++---
 1 file changed, 38 insertions(+), 13 deletions(-)

Changes in v2:
  patch split into series

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 39c784a100a9..38ee90bc2228 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -33,20 +33,20 @@ static unsigned int hex(char c)
return c - 'A' + 10;
 }
 
-static void read_objdump_line(const char *line, size_t line_len, void **buf,
- size_t *len)
+static size_t read_objdump_line(const char *line, size_t line_len, void *buf,
+ size_t len)
 {
const char *p;
-   size_t i;
+   size_t i, j = 0;
 
/* Skip to a colon */
p = strchr(line, ':');
if (!p)
-   return;
+   return 0;
i = p + 1 - line;
 
/* Read bytes */
-   while (*len) {
+   while (j < len) {
char c1, c2;
 
/* Skip spaces */
@@ -65,20 +65,26 @@ static void read_objdump_line(const char *line, size_t 
line_len, void **buf,
if (i < line_len && line[i] && !isspace(line[i]))
break;
/* Store byte */
-   *(unsigned char *)*buf = (hex(c1) << 4) | hex(c2);
-   *buf += 1;
-   *len -= 1;
+   *(unsigned char *)buf = (hex(c1) << 4) | hex(c2);
+   buf += 1;
+   j++;
}
+   /* return number of successfully read bytes */
+   return j;
 }
 
-static int read_objdump_output(FILE *f, void **buf, size_t *len)
+static int read_objdump_output(FILE *f, void *buf, size_t *len, u64 start_addr)
 {
char *line = NULL;
-   size_t line_len;
+   size_t line_len, off_last = 0;
ssize_t ret;
int err = 0;
+   u64 addr;
+
+   while (off_last < *len) {
+   size_t off, read_bytes, written_bytes;
+   unsigned char tmp[BUFSZ];
 
-   while (1) {
ret = getline(&line, &line_len, f);
if (feof(f))
break;
@@ -87,9 +93,28 @@ static int read_objdump_output(FILE *f, void **buf, size_t 
*len)
err = -1;
break;
}
-   read_objdump_line(line, ret, buf, len);
+
+   /* read objdump data into temporary buffer */
+   read_bytes = read_objdump_line(line, ret, tmp, sizeof(tmp));
+   if (!read_bytes)
+   continue;
+
+   if (sscanf(line, "%"PRIx64, &addr) != 1)
+   continue;
+
+   /* copy it from temporary buffer to 'buf' according
+* to address on current objdump line */
+   off = addr - start_addr;
+   if (off >= *len)
+   break;
+   written_bytes = MIN(read_bytes, *len - off);
+   memcpy(buf + off, tmp, written_bytes);
+   off_last = off + written_bytes;
}
 
+   /* len returns number of bytes that could not be read */
+   *len -= off_last;
+
free(line);
 
return err;
@@ -120,7 +145,7 @@ static int read_via_objdump(const char *filename, u64 addr, 
void *buf,
return -1;
}
 
-   ret = read_objdump_output(f, &buf, &len);
+   ret = read_objdump_output(f, buf, &len, addr);
if (len) {
pr_debug("objdump read too few bytes\n");
if (!ret)
-- 
1.8.3.1

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


Re: [RFC 2/3] mmc: sdhci: add host_ops->voltage_switch callback for all other voltages

2015-09-02 Thread Vaibhav Hiremath



On Wednesday 02 September 2015 12:34 PM, Jisheng Zhang wrote:

On Wed, 2 Sep 2015 01:02:17 +0530
Vaibhav Hiremath  wrote:


Currently, the sdhci_do_start_signal_voltage_switch() function invokes
controller specific voltage switch configuration only for 1.8v usecase;
but it is required for others as well.

For example, in case of PXA1928 SDH controller, we need to set different
configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power
control register).

Signed-off-by: Vaibhav Hiremath 
---
Note:
Currently ->voltage_switch() callback is only supported
in f_sdh30 driver. And I am not sure on the dependency of execution
sequence for that device. I could have moved ->voltage_switch() call
at one common place (above/below), but was not quite sure about it.
So, replicated/duplicated the call for other voltages.

  drivers/mmc/host/sdhci.c | 8 
  1 file changed, 8 insertions(+)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 3dd295f..b59b76d 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct 
sdhci_host *host,
/* Wait for 5ms */
usleep_range(5000, 5500);

+   /* Some controller need to do more when switching */
+   if (host->ops->voltage_switch)
+   host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330);


Could this be implemented by regulator API? From patch set 3/3, the pxa1928
voltage_switch hook is to operate the IO pad registers, this seems not belong
to the SDHC IP core.



Not quite sure whether regulator would be right fit for this.

Initially I was thinking of making use of pinconf framework, using
PIN_CONFIG_POWER_SOURCE, but that too I am not sure is the right way of
doing it.

Probably, question for pinctrl maintainer. Looping Linus Walleji.

Also note that, this configuration is not applicable to all pins/pads,
only handpicked pads have this configuration (voltage selection on
pads).
And this configuration is not part of the same register map.

It is part of separate register map (AIB_EXT_REG_BASE), called IO
domain power control register.
And that

Thanks,
Vaibhav
--
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] QEMU fw_cfg DMA interface documentation

2015-09-02 Thread Stefan Hajnoczi
On Mon, Aug 31, 2015 at 10:11 AM, Marc Marí  wrote:
> Add fw_cfg DMA interface specfication in the fw_cfg documentation.
>
> Signed-off-by: Marc Marí 
> ---
>  Documentation/devicetree/bindings/arm/fw-cfg.txt | 51 
> +++-
>  1 file changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/arm/fw-cfg.txt 
> b/Documentation/devicetree/bindings/arm/fw-cfg.txt
> index 953fb64..766ddbe 100644
> --- a/Documentation/devicetree/bindings/arm/fw-cfg.txt
> +++ b/Documentation/devicetree/bindings/arm/fw-cfg.txt
> @@ -45,6 +45,53 @@ blob to be read from the data register has size 4, and it 
> is to be interpreted
>  as a uint32_t value in little endian byte order. The current value
>  (corresponding to the above outer protocol) is zero.
>
> +If bit 1 of the feature bitmap is set, the DMA interface is present. This
> +can be used through the 64-bit wide address register.
> +
> +The address register is in big-endian format. The value for the register is 0
> +at startup and after an operation. A write to the lower half triggers an
> +operation. This means, that operations with 32-bit addresses can be triggered
> +with just one write, whereas operations with 64-bit addresses can be 
> triggered
> +with one 64-bit write or two 32-bit writes, starting with the higher part.
> +
> +In this register, a physical RAM address to a FWCfgDmaAccess structure should
> +be written. This is the format of the FWCfgDmaAccess structure:
> +
> +typedef struct FWCfgDmaAccess {
> +uint32_t control;
> +uint32_t length;
> +uint64_t address;
> +} FWCfgDmaAccess;

I think including the selector field would be nice to avoid extra
register accesses, but I'm not that familiar with fw_cfg so maybe
there's a reason not to include that field.

> +The fields of the structure are in big endian mode, and the field at the 
> lowest
> +address is the "control" field.
> +
> +The "control" field has the following bits:
> + - Bit 0: Error
> + - Bit 1: Read
> + - Bit 2: Skip
> +
> +When an operation is triggered, if the "control" field has bit 1 set, a read
> +operation will be performed. "length" bytes for the current selector and
> +offset will be copied into the address specified by the "address" field.

Minor clarification:
s/address/physical RAM address/

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


[PATCH v2 3/4] perf tests: stop reading if objdump output crossed sections

2015-09-02 Thread Jan Stancek
objdump output can span across multiple sections:

  Disassembly of section .text:
0008 :
   8:   48 89 e5mov%rsp,%rbp
   b:   53  push   %rbx
   c:   8b 01   mov(%rcx),%eax

  6b:   90  nop

  Disassembly of section .init.text:
0008 :
   8:   00 00   add%al,(%rax)
   a:   00 00   add%al,(%rax)
   c:   48 89 e5

Stop further reading if address starts going backwards,
assuming we crossed sections.

Signed-off-by: Jan Stancek 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Adrian Hunter 
Cc: David Ahern 
Cc: Corey Ashford 
Cc: Frederic Weisbecker 
Cc: Ingo Molnar 
Cc: Namhyung Kim 
Cc: Paul Mackerras 
Cc: Peter Zijlstra 
---
 tools/perf/tests/code-reading.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c
index 375ba30e4ed0..e6bf47ff7e91 100644
--- a/tools/perf/tests/code-reading.c
+++ b/tools/perf/tests/code-reading.c
@@ -79,7 +79,7 @@ static int read_objdump_output(FILE *f, void *buf, size_t 
*len, u64 start_addr)
size_t line_len, off_last = 0;
ssize_t ret;
int err = 0;
-   u64 addr;
+   u64 addr, last_addr = start_addr;
 
while (off_last < *len) {
size_t off, read_bytes, written_bytes;
@@ -101,6 +101,11 @@ static int read_objdump_output(FILE *f, void *buf, size_t 
*len, u64 start_addr)
 
if (sscanf(line, "%"PRIx64, &addr) != 1)
continue;
+   if (addr < last_addr) {
+   pr_debug("addr going backwards, read beyond 
section?\n");
+   break;
+   }
+   last_addr = addr;
 
/* copy it from temporary buffer to 'buf' according
 * to address on current objdump line */
-- 
1.8.3.1

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


Re: [PATCH 2/2] arm64: dts: add dts files for Hisilicon Hip05-D02 Development Board

2015-09-02 Thread Ding Tianhong
On 2015/9/2 15:58, Marc Zyngier wrote:
> [Don't top-post, this is very annoying]
> 
> On 02/09/15 05:28, Ding Tianhong wrote:
>> Hi,Marc:
>>
>> Can you check this, I am not sure whether the GIC_CPU_MASK_SIMPLE(xx)
>> is used for gic-v3, maybe we should remove it, thanks.
> 
> The binding documentation
> (Documentation/devicetree/bindings/arm/gic-v3.txt) is very clear:
> 
>   The 3rd cell is the flags, encoded as follows:
> bits[3:0] trigger type and level flags.
> 1 = edge triggered
> 4 = level triggered
> 
> There is no mask whatsoever, because that would restrict the interrupt
> to only 32 CPUs at most.
> 
> So please remove this, this is just wrong.
> 
> Thanks,
> 
>   M.
> 
Ok, thanks.

Ding

>> Ding
>>
>> On 2015/8/31 21:44, Ding Tianhong wrote:
>>> On 2015/8/31 21:12, Leo Yan wrote:
 On Sat, Aug 29, 2015 at 04:52:41PM +0800, Ding Tianhong wrote:
> Add initial dtsi file to support Hisilicon Hip05-D02 Board with
> support of CPUs in four clusters and each cluster has quard Cortex-A57.
>
> Also add dts file to support Hip05-D02 development board.
>
> Signed-off-by: Ding Tianhong 
> Signed-off-by: Kefeng Wang 
> ---
>  arch/arm64/boot/dts/hisilicon/Makefile  |   2 +-
>  arch/arm64/boot/dts/hisilicon/hip05-d02.dts |  36 
>  arch/arm64/boot/dts/hisilicon/hip05.dtsi| 271 
> 
>  3 files changed, 308 insertions(+), 1 deletion(-)
>  create mode 100644 arch/arm64/boot/dts/hisilicon/hip05-d02.dts
>  create mode 100644 arch/arm64/boot/dts/hisilicon/hip05.dtsi
>
> diff --git a/arch/arm64/boot/dts/hisilicon/Makefile 
> b/arch/arm64/boot/dts/hisilicon/Makefile
> index fa81a6e..cd158b8 100644
> --- a/arch/arm64/boot/dts/hisilicon/Makefile
> +++ b/arch/arm64/boot/dts/hisilicon/Makefile
> @@ -1,4 +1,4 @@
> -dtb-$(CONFIG_ARCH_HISI) += hi6220-hikey.dtb
> +dtb-$(CONFIG_ARCH_HISI) += hi6220-hikey.dtb hip05-d02.dtb
>  
>  always   := $(dtb-y)
>  subdir-y := $(dts-dirs)
> diff --git a/arch/arm64/boot/dts/hisilicon/hip05-d02.dts 
> b/arch/arm64/boot/dts/hisilicon/hip05-d02.dts
> new file mode 100644
> index 000..ae34e25
> --- /dev/null
> +++ b/arch/arm64/boot/dts/hisilicon/hip05-d02.dts
> @@ -0,0 +1,36 @@
> +/**
> + * dts file for Hisilicon D02 Development Board
> + *
> + * Copyright (C) 2014,2015 Hisilicon Ltd.
> + *
> + * 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
> + * publishhed by the Free Software Foundation.
> + *
> + */
> +
> +/dts-v1/;
> +
> +#include "hip05.dtsi"
> +
> +/ {
> + model = "Hisilicon Hip05 D02 Development Board";
> + compatible = "hisilicon,hip05-d02";
> +
> + memory@ {
> + device_type = "memory";
> + reg = <0x0 0x 0x0 0x8000>;
> + };
> +
> + aliases {
> + serial0 = &uart0;
> + };
> +
> + chosen {
> + stdout-path = "serial0:115200n8";
> + };
> +};
> +
> +&uart0 {
> + status = "ok";
> +};
> diff --git a/arch/arm64/boot/dts/hisilicon/hip05.dtsi 
> b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
> new file mode 100644
> index 000..da12d94
> --- /dev/null
> +++ b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
> @@ -0,0 +1,271 @@
> +/**
> + * dts file for Hisilicon D02 Development Board
> + *
> + * Copyright (C) 2014,2015 Hisilicon Ltd.
> + *
> + * 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
> + * publishhed by the Free Software Foundation.
> + *
> + */
> +
> +#include 
> +
> +/ {
> + compatible = "hisilicon,hip05-d02";
> + interrupt-parent = <&gic>;
> + #address-cells = <2>;
> + #size-cells = <2>;
> +
> + psci {
> + compatible = "arm,psci-0.2";
> + method = "smc";
> + };
> +
> + cpus {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + cpu-map {
> + cluster0 {
> + core0 {
> + cpu = <&cpu0>;
> + };
> + core1 {
> + cpu = <&cpu1>;
> + };
> + core2 {
> + cpu = <&cpu2>;
> + };
> + core3 {
> + cpu = <&cpu3>;
> + };
> + };
> + cluster1 {
> + core0 {
> +

RE: [PATCH] [v2] PM / hibernate: Fix hibernation panic caused by inconsistent e820 map

2015-09-02 Thread Chen, Yu C
Hi, all,
I'll do some small modifications on this patch and will
send out a v3 version later. Because:
1.some boudary conditions need to be adjusted and 
2.the page frame  validation code will be moved to the
place where  Joey once put in his patch(which would 
look more reasonable)
Please refer to detail below:
Thanks!
:
> -Original Message-
> From: Chen, Yu C
> Sent: Tuesday, September 01, 2015 6:04 PM
> To: r...@rjwysocki.net; Brown, Len; pa...@ucw.cz
> Cc: mi...@redhat.com; ying...@kernel.org; joeyli.ker...@gmail.com; linux-
> p...@vger.kernel.org; linux-kernel@vger.kernel.org; Chen, Yu C
> Subject: [PATCH] [v2] PM / hibernate: Fix hibernation panic caused by
> inconsistent e820 map
> 
> +static void mark_valid_pages(struct memory_bitmap *bm) {
> + unsigned long start_pfn, end_pfn;
> + int i, j;
> +
> + for (i = 0; i < nr_pfn_mapped; i++) {
> + start_pfn = pfn_mapped[i].start;
> + end_pfn = pfn_mapped[i].end;
> + for (j = start_pfn; j <= end_pfn; j++)

Changed j <= end_pfn to j < end_pfn

> -2427,11 +2526,19 @@ static void *get_buffer(struct memory_bitmap *bm,
> - if (swsusp_page_is_forbidden(page) &&
> swsusp_page_is_free(page))
> + if (swsusp_page_is_forbidden(page) &&
> swsusp_page_is_free(page)) {
> - return page_address(page);
> + if (is_valid_orig_page(pfn))
Moved to mark_unsafe_pages
> + return page_address(page);
> + else
> + return ERR_PTR(-EFAULT);
> + }


Best Regards,
Yu
--
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 5/5] sched: add two functions for att(det)aching a task to(from) a cfs_rq

2015-09-02 Thread Ingo Molnar

* Peter Zijlstra  wrote:

> On Wed, Sep 02, 2015 at 11:33:15AM +0900, Byungchul Park wrote:
> > +++ b/kernel/sched/fair.c
> > @@ -7920,14 +7920,14 @@ prio_changed_fair(struct rq *rq, struct task_struct 
> > *p, int oldprio)
> >  
> >  static inline bool vruntime_normalized(struct task_struct *p)
> >  {
> > struct sched_entity *se = &p->se;
> >  
> > /*
> > +* In both TASK_ON_RQ_QUEUED case and TASK_ON_RQ_MIGRATING case,

s/ In both the TASK_ON_RQ_QUEUED and TASK_ON_RQ_MIGRATING cases,

> > +* the dequeue_entity(.flags=0) will already have normalized the
> > +* vruntime.

Thanks,

Ingo
--
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 2/3] mmc: sdhci: add host_ops->voltage_switch callback for all other voltages

2015-09-02 Thread Jisheng Zhang
On Wed, 2 Sep 2015 13:49:53 +0530
Vaibhav Hiremath  wrote:

> 
> 
> On Wednesday 02 September 2015 12:34 PM, Jisheng Zhang wrote:
> > On Wed, 2 Sep 2015 01:02:17 +0530
> > Vaibhav Hiremath  wrote:
> >
> >> Currently, the sdhci_do_start_signal_voltage_switch() function invokes
> >> controller specific voltage switch configuration only for 1.8v usecase;
> >> but it is required for others as well.
> >>
> >> For example, in case of PXA1928 SDH controller, we need to set different
> >> configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power
> >> control register).
> >>
> >> Signed-off-by: Vaibhav Hiremath 
> >> ---
> >> Note:
> >> Currently ->voltage_switch() callback is only supported
> >> in f_sdh30 driver. And I am not sure on the dependency of execution
> >> sequence for that device. I could have moved ->voltage_switch() call
> >> at one common place (above/below), but was not quite sure about it.
> >> So, replicated/duplicated the call for other voltages.
> >>
> >>   drivers/mmc/host/sdhci.c | 8 
> >>   1 file changed, 8 insertions(+)
> >>
> >> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> >> index 3dd295f..b59b76d 100644
> >> --- a/drivers/mmc/host/sdhci.c
> >> +++ b/drivers/mmc/host/sdhci.c
> >> @@ -1753,6 +1753,10 @@ static int 
> >> sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
> >>/* Wait for 5ms */
> >>usleep_range(5000, 5500);
> >>
> >> +  /* Some controller need to do more when switching */
> >> +  if (host->ops->voltage_switch)
> >> +  host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330);
> >
> > Could this be implemented by regulator API? From patch set 3/3, the pxa1928
> > voltage_switch hook is to operate the IO pad registers, this seems not 
> > belong
> > to the SDHC IP core.
> >
> 
> Not quite sure whether regulator would be right fit for this.

>From the patche[3/3], this can be achieved by abstracting the IO PAD as 
>regulators
then, we may not need to touch the core sdhci.c. But I'm not sure whether this
is the good solution or not. sdhci Maintainers and experts may have better
suggestions.

> 
> Initially I was thinking of making use of pinconf framework, using
> PIN_CONFIG_POWER_SOURCE, but that too I am not sure is the right way of
> doing it.
> 
> Probably, question for pinctrl maintainer. Looping Linus Walleji.
> 
> Also note that, this configuration is not applicable to all pins/pads,
> only handpicked pads have this configuration (voltage selection on
> pads).
> And this configuration is not part of the same register map.
> 
> It is part of separate register map (AIB_EXT_REG_BASE), called IO
> domain power control register.
> And that
> 
> Thanks,
> Vaibhav

--
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 v5 0/8] Fix error message and present UFS variant

2015-09-02 Thread Yaniv Gardi
V5: removed a redundant null check

V4: add file
Documentation/devicetree/bindings/ufs/ufs-qcom.txt
and modify the compatible strings in
Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt

V3: fixes a few minor issues.

V2: fixes a few issues of unnecessary EXPORT_SYMBOL,
types of parameters in routine definition, 
build errors in case CONFIG_PM is not defined and some
other minor fixes.

Yaniv Gardi (8):
  phy: qcom-ufs: fix build error when the component is built as a module
  scsi: ufs-qcom: fix compilation warning if compiled as a module
  scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component
  add ufshcd_get_variant ufshcd_set_variant
  scsi: ufs: creates wrapper functions for vops
  scsi: ufs: make the UFS variant a platform device
  scsi: ufs-qcom: add debug prints for test bus
  scsi: ufs-qcom: add QUniPro hardware support and power optimizations

 Documentation/devicetree/bindings/ufs/ufs-qcom.txt |  57 ++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |   4 +-
 drivers/phy/phy-qcom-ufs.c |  11 +
 drivers/scsi/ufs/Kconfig   |   2 +-
 drivers/scsi/ufs/ufs-qcom.c| 917 -
 drivers/scsi/ufs/ufs-qcom.h|  68 +-
 drivers/scsi/ufs/ufshcd-pltfrm.c   |  92 +--
 drivers/scsi/ufs/ufshcd-pltfrm.h   |  41 +
 drivers/scsi/ufs/ufshcd.c  | 122 ++-
 drivers/scsi/ufs/ufshcd.h  | 149 +++-
 10 files changed, 1127 insertions(+), 336 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-qcom.txt
 create mode 100644 drivers/scsi/ufs/ufshcd-pltfrm.h

-- 
1.8.5.2

-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of 
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] ahci: added a new driver for supporting Freescale AHCI sata

2015-09-02 Thread Hans de Goede

Hi,

On 02-09-15 04:25, yuantian.t...@freescale.com wrote:

From: Tang Yuantian 

Currently Freescale QorIQ series SATA is supported by ahci_platform
driver. Some SoC specific settings have been put in uboot. So whether
SATA works or not heavily depends on uboot.
This patch will add a new driver to support QorIQ sata which removes
the dependency on any other boot loader.
Freescale QorIQ series sata, like ls1021a ls2085a ls1043a, is
compatible with serial ATA 3.0 and AHCI 1.3 specification.

Signed-off-by: Yuantian Tang 


Thanks for the patch looks good overall.

You need to add a Documentation/devicetree/bindings/ata/ahci-fsl-qoriq.txt
(or a similar named file) documenting the compatible strings and
what the devicetree nodes should contain wrt reg, interrupts, etc.
properties. See Documentation/devicetree/bindings/ata/ahci-platform.txt
as an example.

Further comments inline.


---
  drivers/ata/Kconfig |   9 ++
  drivers/ata/Makefile|   1 +
  drivers/ata/ahci_platform.c |   1 -
  drivers/ata/ahci_qoriq.c| 308 
  4 files changed, 318 insertions(+), 1 deletion(-)
  create mode 100644 drivers/ata/ahci_qoriq.c

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 15e40ee..6aaa3f8 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -175,6 +175,15 @@ config AHCI_XGENE
help
 This option enables support for APM X-Gene SoC SATA host controller.

+config AHCI_QORIQ
+   tristate "Freescale QorIQ AHCI SATA support"
+   depends on OF
+   help
+ This option enables support for the Freescale QorIQ AHCI SoC's
+ onboard AHCI SATA.
+
+ If unsure, say N.
+
  config SATA_FSL
tristate "Freescale 3.0Gbps SATA support"
depends on FSL_SOC
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile
index af70919..af45eff 100644
--- a/drivers/ata/Makefile
+++ b/drivers/ata/Makefile
@@ -19,6 +19,7 @@ obj-$(CONFIG_AHCI_SUNXI)  += ahci_sunxi.o libahci.o 
libahci_platform.o
  obj-$(CONFIG_AHCI_ST) += ahci_st.o libahci.o libahci_platform.o
  obj-$(CONFIG_AHCI_TEGRA)  += ahci_tegra.o libahci.o libahci_platform.o
  obj-$(CONFIG_AHCI_XGENE)  += ahci_xgene.o libahci.o libahci_platform.o
+obj-$(CONFIG_AHCI_QORIQ)   += ahci_qoriq.o libahci.o libahci_platform.o

  # SFF w/ custom DMA
  obj-$(CONFIG_PDC_ADMA)+= pdc_adma.o
diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
index 1befb11..04975b8 100644
--- a/drivers/ata/ahci_platform.c
+++ b/drivers/ata/ahci_platform.c
@@ -76,7 +76,6 @@ static const struct of_device_id ahci_of_match[] = {
{ .compatible = "ibm,476gtr-ahci", },
{ .compatible = "snps,dwc-ahci", },
{ .compatible = "hisilicon,hisi-ahci", },
-   { .compatible = "fsl,qoriq-ahci", },
{},
  };
  MODULE_DEVICE_TABLE(of, ahci_of_match);


This will break booting new kernels with old dtb files, something which
in general is considered a big non-no, I suggest adding a comment
that this has been superseded by the new ahci_qoriq.c code, and maybe
add a date to retire the compatible in say a year from now.


diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c
new file mode 100644
index 000..943b783
--- /dev/null
+++ b/drivers/ata/ahci_qoriq.c
@@ -0,0 +1,308 @@
+/*
+ * Freescale QorIQ AHCI SATA platform driver
+ *
+ * Copyright 2015 Freescale, Inc.
+ *   Tang Yuantian 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "ahci.h"
+
+#define DRV_NAME "ahci-qoriq"
+
+#define AHCI_PORT_PHY_1_CFG0xa003fffe
+#define AHCI_PORT_PHY_2_CFG0x28183411
+#define AHCI_PORT_PHY_3_CFG0x0e081004
+#define AHCI_PORT_PHY_4_CFG0x00480811
+#define AHCI_PORT_PHY_5_CFG0x192c96a4
+#define AHCI_PORT_TRANS_CFG0x0825
+
+#define SATA_ECC_REG_ADDR  0x20220520
+#define SATA_ECC_DISABLE   0x0002
+
+enum ahci_qoriq_type {
+   AHCI_LS1021A,
+   AHCI_LS1043A,
+   AHCI_LS2085A,
+};
+
+struct ahci_qoriq_priv {
+   struct ccsr_ahci *reg_base;
+   enum ahci_qoriq_type type;
+   void __iomem *ecc_addr;
+};
+
+/* AHCI (sata) register map */
+struct ccsr_ahci {
+   u32 res1[0xa4/4];   /* 0x0 - 0xa4 */
+   u32 pcfg;   /* port config */
+   u32 ppcfg;  /* port phy1 config */
+   u32 pp2c;   /* port phy2 config */
+   u32 pp3c;   /* port phy3 config */
+   u32 pp4c;   /* port phy4 config */
+   u32 pp5c;   /* port phy5 config */
+   u32 paxic;  /* port AXI config */
+   u32 axicc;  /* AXI cache control */
+   u32 axipc;  /* AXI PROT control */
+   u32 ptc;/* port Tr

[PATCH v5 1/8] phy: qcom-ufs: fix build error when the component is built as a module

2015-09-02 Thread Yaniv Gardi
Export the following functions in order to avoid build errors
when the component PHY_QCOM_UFS is compiled as a module:

ERROR: "ufs_qcom_phy_disable_ref_clk"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_enable_ref_clk"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_is_pcs_ready"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_disable_iface_clk"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_start_serdes"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_calibrate_phy"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_enable_dev_ref_clk"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_set_tx_lane_enable"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_disable_dev_ref_clk"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_save_controller_version"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
ERROR: "ufs_qcom_phy_enable_iface_clk"
[drivers/scsi/ufs/ufs-qcom.ko] undefined!
make[1]: *** [__modpost] Error 1

Signed-off-by: Yaniv Gardi 

---
 drivers/phy/phy-qcom-ufs.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/phy/phy-qcom-ufs.c b/drivers/phy/phy-qcom-ufs.c
index f9c618f..6140a8b 100644
--- a/drivers/phy/phy-qcom-ufs.c
+++ b/drivers/phy/phy-qcom-ufs.c
@@ -432,6 +432,7 @@ out_disable_src:
 out:
return ret;
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_ref_clk);
 
 static
 int ufs_qcom_phy_disable_vreg(struct phy *phy,
@@ -474,6 +475,7 @@ void ufs_qcom_phy_disable_ref_clk(struct phy *generic_phy)
phy->is_ref_clk_enabled = false;
}
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_ref_clk);
 
 #define UFS_REF_CLK_EN (1 << 5)
 
@@ -517,11 +519,13 @@ void ufs_qcom_phy_enable_dev_ref_clk(struct phy 
*generic_phy)
 {
ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, true);
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_dev_ref_clk);
 
 void ufs_qcom_phy_disable_dev_ref_clk(struct phy *generic_phy)
 {
ufs_qcom_phy_dev_ref_clk_ctrl(generic_phy, false);
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_dev_ref_clk);
 
 /* Turn ON M-PHY RMMI interface clocks */
 int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy)
@@ -550,6 +554,7 @@ int ufs_qcom_phy_enable_iface_clk(struct phy *generic_phy)
 out:
return ret;
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_enable_iface_clk);
 
 /* Turn OFF M-PHY RMMI interface clocks */
 void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy)
@@ -562,6 +567,7 @@ void ufs_qcom_phy_disable_iface_clk(struct phy *generic_phy)
phy->is_iface_clk_enabled = false;
}
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_disable_iface_clk);
 
 int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
 {
@@ -578,6 +584,7 @@ int ufs_qcom_phy_start_serdes(struct phy *generic_phy)
 
return ret;
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_start_serdes);
 
 int ufs_qcom_phy_set_tx_lane_enable(struct phy *generic_phy, u32 tx_lanes)
 {
@@ -595,6 +602,7 @@ int ufs_qcom_phy_set_tx_lane_enable(struct phy 
*generic_phy, u32 tx_lanes)
 
return ret;
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_set_tx_lane_enable);
 
 void ufs_qcom_phy_save_controller_version(struct phy *generic_phy,
  u8 major, u16 minor, u16 step)
@@ -605,6 +613,7 @@ void ufs_qcom_phy_save_controller_version(struct phy 
*generic_phy,
ufs_qcom_phy->host_ctrl_rev_minor = minor;
ufs_qcom_phy->host_ctrl_rev_step = step;
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_save_controller_version);
 
 int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, bool is_rate_B)
 {
@@ -625,6 +634,7 @@ int ufs_qcom_phy_calibrate_phy(struct phy *generic_phy, 
bool is_rate_B)
 
return ret;
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_calibrate_phy);
 
 int ufs_qcom_phy_remove(struct phy *generic_phy,
struct ufs_qcom_phy *ufs_qcom_phy)
@@ -662,6 +672,7 @@ int ufs_qcom_phy_is_pcs_ready(struct phy *generic_phy)
return ufs_qcom_phy->phy_spec_ops->
is_physical_coding_sublayer_ready(ufs_qcom_phy);
 }
+EXPORT_SYMBOL_GPL(ufs_qcom_phy_is_pcs_ready);
 
 int ufs_qcom_phy_power_on(struct phy *generic_phy)
 {
-- 
1.8.5.2

-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of 
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/


[PATCH v5 4/8] add ufshcd_get_variant ufshcd_set_variant

2015-09-02 Thread Yaniv Gardi
Signed-off-by: Yaniv Gardi 

---
 drivers/scsi/ufs/ufs-qcom.c | 34 +-
 drivers/scsi/ufs/ufshcd.h   | 21 +
 2 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 6c23bbf..64c54b7 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -155,7 +155,7 @@ out:
 
 static int ufs_qcom_link_startup_post_change(struct ufs_hba *hba)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
struct phy *phy = host->generic_phy;
u32 tx_lanes;
int err = 0;
@@ -211,7 +211,7 @@ static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
 
 static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
struct phy *phy = host->generic_phy;
int ret = 0;
bool is_rate_B = (UFS_QCOM_LIMIT_HS_RATE == PA_HS_MODE_B)
@@ -273,7 +273,7 @@ static void ufs_qcom_enable_hw_clk_gating(struct ufs_hba 
*hba)
 
 static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba, bool status)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
int err = 0;
 
switch (status) {
@@ -307,7 +307,7 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba, 
bool status)
 static unsigned long
 ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear, u32 hs, u32 rate)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
struct ufs_clk_info *clki;
u32 core_clk_period_in_ns;
u32 tx_clk_cycles_per_us = 0;
@@ -448,7 +448,7 @@ static int ufs_qcom_link_startup_notify(struct ufs_hba 
*hba, bool status)
 
 static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
struct phy *phy = host->generic_phy;
int ret = 0;
 
@@ -479,7 +479,7 @@ out:
 
 static int ufs_qcom_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
struct phy *phy = host->generic_phy;
int err;
 
@@ -621,7 +621,7 @@ static int ufs_qcom_pwr_change_notify(struct ufs_hba *hba,
struct ufs_pa_layer_attr *dev_req_params)
 {
u32 val;
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
struct phy *phy = host->generic_phy;
struct ufs_qcom_dev_params ufs_qcom_cap;
int ret = 0;
@@ -696,7 +696,7 @@ out:
 
 static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
 
if (host->hw_ver.major == 0x1)
return UFSHCI_VERSION_11;
@@ -715,7 +715,7 @@ static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba)
  */
 static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
 
if (host->hw_ver.major == 0x01) {
hba->quirks |= UFSHCD_QUIRK_DELAY_BEFORE_DME_CMDS
@@ -740,7 +740,7 @@ static void ufs_qcom_advertise_quirks(struct ufs_hba *hba)
 
 static void ufs_qcom_set_caps(struct ufs_hba *hba)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
 
if (host->hw_ver.major >= 0x2)
host->caps = UFS_QCOM_CAP_QUNIPRO;
@@ -811,7 +811,7 @@ static void ufs_qcom_get_speed_mode(struct 
ufs_pa_layer_attr *p, char *result)
 
 static int ufs_qcom_setup_clocks(struct ufs_hba *hba, bool on)
 {
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
int err = 0;
int vote = 0;
 
@@ -866,7 +866,7 @@ show_ufs_to_mem_max_bus_bw(struct device *dev, struct 
device_attribute *attr,
char *buf)
 {
struct ufs_hba *hba = dev_get_drvdata(dev);
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
 
return snprintf(buf, PAGE_SIZE, "%u\n",
host->bus_vote.is_max_bw_needed);
@@ -877,7 +877,7 @@ store_ufs_to_mem_max_bus_bw(struct device *dev, struct 
device_attribute *attr,
const char *buf, size_t count)
 {
struct ufs_hba *hba = dev_get_drvdata(dev);
-   struct ufs_qcom_host *host = hba->priv;
+   struct ufs_qcom_host *host = ufshcd_get_variant(hba);
uint32_t value;
 
if (!kstrtou32(buf, 0, &value)) {
@@ -954,7 +954,7 @@ static int ufs_qcom_init(struct ufs_hba *hba)
}
 
hos

[PATCH v5 8/8] scsi: ufs-qcom: add QUniPro hardware support and power optimizations

2015-09-02 Thread Yaniv Gardi
New revisions of UFS host controller supports the new UniPro
hardware controller (referred as QUniPro). This patch adds
the support to enable this new UniPro controller hardware.

This change also adds power optimization for bus scaling feature,
as well as support for HS-G3 power mode.

Signed-off-by: Yaniv Gardi 

---
 drivers/scsi/ufs/ufs-qcom.c | 640 
 drivers/scsi/ufs/ufs-qcom.h |  31 ++-
 drivers/scsi/ufs/ufshcd.c   |   8 +-
 drivers/scsi/ufs/ufshcd.h   |  27 +-
 4 files changed, 525 insertions(+), 181 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 86c8399..35cb661 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -44,11 +44,11 @@ enum {
 
 static struct ufs_qcom_host *ufs_qcom_hosts[MAX_UFS_QCOM_HOSTS];
 
-static void ufs_qcom_get_speed_mode(struct ufs_pa_layer_attr *p, char *result);
-static int ufs_qcom_get_bus_vote(struct ufs_qcom_host *host,
-   const char *speed_mode);
 static int ufs_qcom_set_bus_vote(struct ufs_qcom_host *host, int vote);
 static void ufs_qcom_get_default_testbus_cfg(struct ufs_qcom_host *host);
+static int ufs_qcom_set_dme_vs_core_clk_ctrl_clear_div(struct ufs_hba *hba,
+  u32 clk_cycles);
+
 static void ufs_qcom_dump_regs(struct ufs_hba *hba, int offset, int len,
char *prefix)
 {
@@ -177,6 +177,7 @@ static int ufs_qcom_init_lane_clks(struct ufs_qcom_host 
*host)
 
err = ufs_qcom_host_clk_get(dev, "tx_lane1_sync_clk",
&host->tx_l1_sync_clk);
+
 out:
return err;
 }
@@ -209,7 +210,9 @@ static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
 
do {
err = ufshcd_dme_get(hba,
-   UIC_ARG_MIB(MPHY_TX_FSM_STATE), &tx_fsm_val);
+   UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE,
+   UIC_ARG_MPHY_TX_GEN_SEL_INDEX(0)),
+   &tx_fsm_val);
if (err || tx_fsm_val == TX_FSM_HIBERN8)
break;
 
@@ -223,7 +226,9 @@ static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
 */
if (time_after(jiffies, timeout))
err = ufshcd_dme_get(hba,
-   UIC_ARG_MIB(MPHY_TX_FSM_STATE), &tx_fsm_val);
+   UIC_ARG_MIB_SEL(MPHY_TX_FSM_STATE,
+   UIC_ARG_MPHY_TX_GEN_SEL_INDEX(0)),
+   &tx_fsm_val);
 
if (err) {
dev_err(hba->dev, "%s: unable to get TX_FSM_STATE, err %d\n",
@@ -237,6 +242,15 @@ static int ufs_qcom_check_hibern8(struct ufs_hba *hba)
return err;
 }
 
+static void ufs_qcom_select_unipro_mode(struct ufs_qcom_host *host)
+{
+   ufshcd_rmwl(host->hba, QUNIPRO_SEL,
+  ufs_qcom_cap_qunipro(host) ? QUNIPRO_SEL : 0,
+  REG_UFS_CFG1);
+   /* make sure above configuration is applied before we return */
+   mb();
+}
+
 static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
 {
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
@@ -251,9 +265,11 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
usleep_range(1000, 1100);
 
ret = ufs_qcom_phy_calibrate_phy(phy, is_rate_B);
+
if (ret) {
-   dev_err(hba->dev, "%s: ufs_qcom_phy_calibrate_phy() failed, ret 
= %d\n",
-   __func__, ret);
+   dev_err(hba->dev,
+   "%s: ufs_qcom_phy_calibrate_phy()failed, ret = %d\n",
+   __func__, ret);
goto out;
}
 
@@ -274,9 +290,12 @@ static int ufs_qcom_power_up_sequence(struct ufs_hba *hba)
 
ret = ufs_qcom_phy_is_pcs_ready(phy);
if (ret)
-   dev_err(hba->dev, "%s: is_physical_coding_sublayer_ready() 
failed, ret = %d\n",
+   dev_err(hba->dev,
+   "%s: is_physical_coding_sublayer_ready() failed, ret = 
%d\n",
__func__, ret);
 
+   ufs_qcom_select_unipro_mode(host);
+
 out:
return ret;
 }
@@ -299,7 +318,8 @@ static void ufs_qcom_enable_hw_clk_gating(struct ufs_hba 
*hba)
mb();
 }
 
-static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba, bool status)
+static int ufs_qcom_hce_enable_notify(struct ufs_hba *hba,
+ enum ufs_notify_change_status status)
 {
struct ufs_qcom_host *host = ufshcd_get_variant(hba);
int err = 0;
@@ -329,12 +349,12 @@ static int ufs_qcom_hce_enable_notify(struct ufs_hba 
*hba, bool status)
 }
 
 /**
- * Returns non-zero for success (which rate of core_clk) and 0
- * in case of a failure
+ * Returns zero for success and non-zero in case of a failure
  */
-static unsigned long
-ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear, u32 hs, u32 rate)
+static int ufs_qcom_cfg_timers(struct ufs_hba *hba, u32 gear,
+   

[PATCH v5 2/8] scsi: ufs-qcom: fix compilation warning if compiled as a module

2015-09-02 Thread Yaniv Gardi
This change fixes a compilation warning that happens if SCSI_UFS_QCOM
is compiled as a module.
Also this patch fixes an error happens when insmod the module:
"ufs_qcom: module license 'unspecified' taints kernel."

Signed-off-by: Yaniv Gardi 

---
 drivers/scsi/ufs/ufs-qcom.c | 7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 4cdffa4..6c23bbf 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -917,12 +917,15 @@ out:
 
 #defineANDROID_BOOT_DEV_MAX30
 static char android_boot_dev[ANDROID_BOOT_DEV_MAX];
-static int get_android_boot_dev(char *str)
+
+#ifndef MODULE
+static int __init get_android_boot_dev(char *str)
 {
strlcpy(android_boot_dev, str, ANDROID_BOOT_DEV_MAX);
return 1;
 }
 __setup("androidboot.bootdevice=", get_android_boot_dev);
+#endif
 
 /**
  * ufs_qcom_init - bind phy with controller
@@ -1047,3 +1050,5 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops 
= {
.resume = ufs_qcom_resume,
 };
 EXPORT_SYMBOL(ufs_hba_qcom_vops);
+
+MODULE_LICENSE("GPL v2");
-- 
1.8.5.2

-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of 
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/


[PATCH v5 5/8] scsi: ufs: creates wrapper functions for vops

2015-09-02 Thread Yaniv Gardi
In order to simplify the code a set of wrapper functions is created
to test and call each of the variant operations.

Signed-off-by: Yaniv Gardi 

---
 drivers/scsi/ufs/ufs-qcom.c |   1 -
 drivers/scsi/ufs/ufshcd.c   | 104 +---
 drivers/scsi/ufs/ufshcd.h   |  98 +
 3 files changed, 137 insertions(+), 66 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 64c54b7..329ac84 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -1049,6 +1049,5 @@ static const struct ufs_hba_variant_ops ufs_hba_qcom_vops 
= {
.suspend= ufs_qcom_suspend,
.resume = ufs_qcom_resume,
 };
-EXPORT_SYMBOL(ufs_hba_qcom_vops);
 
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b0ade73..9e79c33 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -271,10 +271,8 @@ static inline u32 ufshcd_get_intr_mask(struct ufs_hba *hba)
  */
 static inline u32 ufshcd_get_ufs_version(struct ufs_hba *hba)
 {
-   if (hba->quirks & UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION) {
-   if (hba->vops && hba->vops->get_ufs_hci_version)
-   return hba->vops->get_ufs_hci_version(hba);
-   }
+   if (hba->quirks & UFSHCD_QUIRK_BROKEN_UFS_HCI_VERSION)
+   return ufshcd_vops_get_ufs_hci_version(hba);
 
return ufshcd_readl(hba, REG_UFS_VERSION);
 }
@@ -2473,9 +2471,8 @@ static int ufshcd_change_power_mode(struct ufs_hba *hba,
dev_err(hba->dev,
"%s: power mode change failed %d\n", __func__, ret);
} else {
-   if (hba->vops && hba->vops->pwr_change_notify)
-   hba->vops->pwr_change_notify(hba,
-   POST_CHANGE, NULL, pwr_mode);
+   ufshcd_vops_pwr_change_notify(hba, POST_CHANGE, NULL,
+   pwr_mode);
 
memcpy(&hba->pwr_info, pwr_mode,
sizeof(struct ufs_pa_layer_attr));
@@ -2495,10 +2492,10 @@ static int ufshcd_config_pwr_mode(struct ufs_hba *hba,
struct ufs_pa_layer_attr final_params = { 0 };
int ret;
 
-   if (hba->vops && hba->vops->pwr_change_notify)
-   hba->vops->pwr_change_notify(hba,
-PRE_CHANGE, desired_pwr_mode, &final_params);
-   else
+   ret = ufshcd_vops_pwr_change_notify(hba, PRE_CHANGE,
+   desired_pwr_mode, &final_params);
+
+   if (ret)
memcpy(&final_params, desired_pwr_mode, sizeof(final_params));
 
ret = ufshcd_change_power_mode(hba, &final_params);
@@ -2647,8 +2644,7 @@ static int ufshcd_hba_enable(struct ufs_hba *hba)
/* UniPro link is disabled at this point */
ufshcd_set_link_off(hba);
 
-   if (hba->vops && hba->vops->hce_enable_notify)
-   hba->vops->hce_enable_notify(hba, PRE_CHANGE);
+   ufshcd_vops_hce_enable_notify(hba, PRE_CHANGE);
 
/* start controller initialization sequence */
ufshcd_hba_start(hba);
@@ -2681,8 +2677,7 @@ static int ufshcd_hba_enable(struct ufs_hba *hba)
/* enable UIC related interrupts */
ufshcd_enable_intr(hba, UFSHCD_UIC_MASK);
 
-   if (hba->vops && hba->vops->hce_enable_notify)
-   hba->vops->hce_enable_notify(hba, POST_CHANGE);
+   ufshcd_vops_hce_enable_notify(hba, POST_CHANGE);
 
return 0;
 }
@@ -2735,8 +2730,7 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
int retries = DME_LINKSTARTUP_RETRIES;
 
do {
-   if (hba->vops && hba->vops->link_startup_notify)
-   hba->vops->link_startup_notify(hba, PRE_CHANGE);
+   ufshcd_vops_link_startup_notify(hba, PRE_CHANGE);
 
ret = ufshcd_dme_link_startup(hba);
 
@@ -2767,11 +2761,9 @@ static int ufshcd_link_startup(struct ufs_hba *hba)
}
 
/* Include any host controller configuration via UIC commands */
-   if (hba->vops && hba->vops->link_startup_notify) {
-   ret = hba->vops->link_startup_notify(hba, POST_CHANGE);
-   if (ret)
-   goto out;
-   }
+   ret = ufshcd_vops_link_startup_notify(hba, POST_CHANGE);
+   if (ret)
+   goto out;
 
ret = ufshcd_make_hba_operational(hba);
 out:
@@ -4578,8 +4570,7 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, 
bool on,
}
}
 
-   if (hba->vops && hba->vops->setup_clocks)
-   ret = hba->vops->setup_clocks(hba, on);
+   ret = ufshcd_vops_setup_clocks(hba, on);
 out:
if (ret) {
list_for_each_entry(clki, head, list) {
@@ -4645,27 +4636,22 @@ static int ufshcd_variant_hba_init(struct ufs_hba *hba)
if (!hba->vops)
goto out;
 
-  

[PATCH v5 6/8] scsi: ufs: make the UFS variant a platform device

2015-09-02 Thread Yaniv Gardi
This change turns the UFS variant (SCSI_UFS_QCOM) into a UFS
a platform device.
In order to do so a few additional changes are required:
1. The ufshcd-pltfrm is no longer serves as a platform device.
   Now it only serves as a group of platform APIs such as PM APIs
   (runtime suspend/resume, system suspend/resume etc), parsers of
   clocks, regulators and pm_levels from DT.
2. What used to be the old platform "probe" is now "only"
   a pltfrm_init() routine, that does exactly the same, but only
   being called by the new probe function of the UFS variant.

Signed-off-by: Yaniv Gardi 

---
 Documentation/devicetree/bindings/ufs/ufs-qcom.txt | 57 ++
 .../devicetree/bindings/ufs/ufshcd-pltfrm.txt  |  4 +-
 drivers/scsi/ufs/ufs-qcom.c| 74 -
 drivers/scsi/ufs/ufshcd-pltfrm.c   | 92 ++
 drivers/scsi/ufs/ufshcd-pltfrm.h   | 41 ++
 drivers/scsi/ufs/ufshcd.c  | 10 +++
 drivers/scsi/ufs/ufshcd.h  |  1 +
 7 files changed, 207 insertions(+), 72 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/ufs/ufs-qcom.txt
 create mode 100644 drivers/scsi/ufs/ufshcd-pltfrm.h

diff --git a/Documentation/devicetree/bindings/ufs/ufs-qcom.txt 
b/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
new file mode 100644
index 000..452e4ef
--- /dev/null
+++ b/Documentation/devicetree/bindings/ufs/ufs-qcom.txt
@@ -0,0 +1,57 @@
+* Qualcomm Technologies Inc Universal Flash Storage (UFS) PHY
+
+UFSPHY nodes are defined to describe on-chip UFS PHY hardware macro.
+Each UFS PHY node should have its own node.
+
+To bind UFS PHY with UFS host controller, the controller node should
+contain a phandle reference to UFS PHY node.
+
+Required properties:
+- compatible: compatible list, contains "qcom,ufs-phy-qmp-20nm"
+ or "qcom,ufs-phy-qmp-14nm" according to the relevant phy 
in use.
+- reg   : should contain PHY register address space (mandatory),
+- reg-names : indicates various resources passed to driver (via reg 
proptery) by name.
+  Required "reg-names" is "phy_mem".
+- #phy-cells: This property shall be set to 0
+- vdda-phy-supply   : phandle to main PHY supply for analog domain
+- vdda-pll-supply   : phandle to PHY PLL and Power-Gen block power supply
+- clocks   : List of phandle and clock specifier pairs
+- clock-names   : List of clock input name strings sorted in the same
+ order as the clocks property. "ref_clk_src", "ref_clk",
+ "tx_iface_clk" & "rx_iface_clk" are mandatory but
+ "ref_clk_parent" is optional
+
+Optional properties:
+- vdda-phy-max-microamp : specifies max. load that can be drawn from phy supply
+- vdda-pll-max-microamp : specifies max. load that can be drawn from pll supply
+- vddp-ref-clk-supply   : phandle to UFS device ref_clk pad power supply
+- vddp-ref-clk-max-microamp : specifies max. load that can be drawn from this 
supply
+- vddp-ref-clk-always-on : specifies if this supply needs to be kept always on
+
+Example:
+
+   ufsphy1: ufsphy@0xfc597000 {
+   compatible = "qcom,ufs-phy-qmp-20nm";
+   reg = <0xfc597000 0x800>;
+   reg-names = "phy_mem";
+   #phy-cells = <0>;
+   vdda-phy-supply = <&pma8084_l4>;
+   vdda-pll-supply = <&pma8084_l12>;
+   vdda-phy-max-microamp = <5>;
+   vdda-pll-max-microamp = <1000>;
+   clock-names = "ref_clk_src",
+   "ref_clk_parent",
+   "ref_clk",
+   "tx_iface_clk",
+   "rx_iface_clk";
+   clocks = <&clock_rpm clk_ln_bb_clk>,
+   <&clock_gcc clk_pcie_1_phy_ldo >,
+   <&clock_gcc clk_ufs_phy_ldo>,
+   <&clock_gcc clk_gcc_ufs_tx_cfg_clk>,
+   <&clock_gcc clk_gcc_ufs_rx_cfg_clk>;
+   };
+
+   ufshc@0xfc598000 {
+   ...
+   phys = <&ufsphy1>;
+   };
diff --git a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt 
b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
index 5357919..c0f10d3 100644
--- a/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
+++ b/Documentation/devicetree/bindings/ufs/ufshcd-pltfrm.txt
@@ -4,7 +4,9 @@ UFSHC nodes are defined to describe on-chip UFS host 
controllers.
 Each UFS controller instance should have its own node.
 
 Required properties:
-- compatible: compatible list, contains "jedec,ufs-1.1"
+- compatible: compatible list, contains "jedec,ufs-1.1" or
+ "qcom,msm8994-ufshc" or "qcom,msm8996-ufshc"
+ followed by "qcom,ufshc"
 - interrupts: 
 - reg   : 
 
diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-q

Re: linux-next: build failure after merge of the rcu tree

2015-09-02 Thread Paul E. McKenney
On Wed, Sep 02, 2015 at 09:29:18AM +0200, Ingo Molnar wrote:
> 
> * Paul E. McKenney  wrote:
> 
> > On Tue, Sep 01, 2015 at 11:40:51PM -0700, Davidlohr Bueso wrote:
> > > On Tue, 2015-09-01 at 22:26 -0700, Paul E. McKenney wrote:
> > > > Davidlohr, the error is due to sched_setscheduler_nocheck() not being
> > > > exported, so that Stephen gets this failure when building modules.
> > > > This is 04be76a9b067 (locktorture: Support rtmutex torturing) in -rcu.
> > > > 
> > > > Thoughts?
> > > 
> > > Right, the below should take care of it. Although I think it makes sense
> > > to get this into at least 4.3 even if we won't use it until 4.4. Simply
> > > because we already export sched_setscheduler(). If you agree I guess we
> > > could route via -tip.
> > 
> > Given an ack from Peter or Ingo, I would happy to queue it.  But we are
> > talking 4.4 rather than 4.3, sorry!
> 
> The export looks good to me:
> 
> Acked-by: Ingo Molnar 

Very good, queued for 4.4!

Thanx, Paul



sched: Export sched_setscheduler_nocheck

The new locktorture rtmutex_lock tests exercise priority boosting, which
means that they need to set some tasks to real-time priority.  To do this,
they use sched_setscheduler_nocheck().  However, this is not exported to
modules, which results in the following error when building locktorture
as a module:

ERROR: "sched_setscheduler_nocheck" [kernel/locking/locktorture.ko] undefined!

This commit therefore adds an EXPORT_SYMBOL_GPL() to allow this function
to be invoked from locktorture when built as a module.

Reported-by: Stephen Rothwell 
Signed-off-by: Davidlohr Bueso 
Signed-off-by: Paul E. McKenney 
Acked-by: Ingo Molnar 

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5e73c79fadd0..5eee11b2b4b0 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3960,6 +3960,7 @@ int sched_setscheduler_nocheck(struct task_struct *p, int 
policy,
 {
return _sched_setscheduler(p, policy, param, false);
 }
+EXPORT_SYMBOL_GPL(sched_setscheduler_nocheck);
 
 static int
 do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user *param)

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


Re: [PATCH v2] QEMU fw_cfg DMA interface documentation

2015-09-02 Thread Marc Marí
On Wed, 2 Sep 2015 09:20:12 +0100
Stefan Hajnoczi  wrote:

> On Mon, Aug 31, 2015 at 10:11 AM, Marc Marí  wrote:
> > Add fw_cfg DMA interface specfication in the fw_cfg documentation.
> >
> > Signed-off-by: Marc Marí 
> > ---
> >  Documentation/devicetree/bindings/arm/fw-cfg.txt | 51
> > +++- 1 file changed, 50 insertions(+), 1
> > deletion(-)
> >
> > diff --git a/Documentation/devicetree/bindings/arm/fw-cfg.txt
> > b/Documentation/devicetree/bindings/arm/fw-cfg.txt index
> > 953fb64..766ddbe 100644 ---
> > a/Documentation/devicetree/bindings/arm/fw-cfg.txt +++
> > b/Documentation/devicetree/bindings/arm/fw-cfg.txt @@ -45,6 +45,53
> > @@ blob to be read from the data register has size 4, and it is to
> > be interpreted as a uint32_t value in little endian byte order. The
> > current value (corresponding to the above outer protocol) is zero.
> >
> > +If bit 1 of the feature bitmap is set, the DMA interface is
> > present. This +can be used through the 64-bit wide address register.
> > +
> > +The address register is in big-endian format. The value for the
> > register is 0 +at startup and after an operation. A write to the
> > lower half triggers an +operation. This means, that operations with
> > 32-bit addresses can be triggered +with just one write, whereas
> > operations with 64-bit addresses can be triggered +with one 64-bit
> > write or two 32-bit writes, starting with the higher part. +
> > +In this register, a physical RAM address to a FWCfgDmaAccess
> > structure should +be written. This is the format of the
> > FWCfgDmaAccess structure: +
> > +typedef struct FWCfgDmaAccess {
> > +uint32_t control;
> > +uint32_t length;
> > +uint64_t address;
> > +} FWCfgDmaAccess;
> 
> I think including the selector field would be nice to avoid extra
> register accesses, but I'm not that familiar with fw_cfg so maybe
> there's a reason not to include that field.

It's just simplicity. If you want to read a few times from the same
field (like in ACPI tables, read the data size and then the data), you
need a way to enable and disable the selector and manage the current
offset for that entry. This is already provided with the "old"
interface.

Moreover, if, for some reason, both systems are being used
simultaneously, some way of interacting both selectors and offsets is
needed.

I think the overhead of writing the selector apart is not that big,
compared to the trouble of adding a new one.

Thanks
Marc
 
> > +The fields of the structure are in big endian mode, and the field
> > at the lowest +address is the "control" field.
> > +
> > +The "control" field has the following bits:
> > + - Bit 0: Error
> > + - Bit 1: Read
> > + - Bit 2: Skip
> > +
> > +When an operation is triggered, if the "control" field has bit 1
> > set, a read +operation will be performed. "length" bytes for the
> > current selector and +offset will be copied into the address
> > specified by the "address" field.
> 
> Minor clarification:
> s/address/physical RAM address/
> 
> Reviewed-by: Stefan Hajnoczi 

--
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 v5 7/8] scsi: ufs-qcom: add debug prints for test bus

2015-09-02 Thread Yaniv Gardi
Adds support for configuring and reading the test bus and debug
registers. This change also adds another vops in order to print the
debug registers.

Signed-off-by: Yaniv Gardi 

---
 drivers/scsi/ufs/ufs-qcom.c | 165 +++-
 drivers/scsi/ufs/ufs-qcom.h |  37 +-
 drivers/scsi/ufs/ufshcd.c   |   2 +
 drivers/scsi/ufs/ufshcd.h   |   8 +++
 4 files changed, 208 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c
index 5179250..86c8399 100644
--- a/drivers/scsi/ufs/ufs-qcom.c
+++ b/drivers/scsi/ufs/ufs-qcom.c
@@ -23,6 +23,24 @@
 #include "unipro.h"
 #include "ufs-qcom.h"
 #include "ufshci.h"
+#define UFS_QCOM_DEFAULT_DBG_PRINT_EN  \
+   (UFS_QCOM_DBG_PRINT_REGS_EN | UFS_QCOM_DBG_PRINT_TEST_BUS_EN)
+
+enum {
+   TSTBUS_UAWM,
+   TSTBUS_UARM,
+   TSTBUS_TXUC,
+   TSTBUS_RXUC,
+   TSTBUS_DFC,
+   TSTBUS_TRLUT,
+   TSTBUS_TMRLUT,
+   TSTBUS_OCSC,
+   TSTBUS_UTP_HCI,
+   TSTBUS_COMBINED,
+   TSTBUS_WRAPPER,
+   TSTBUS_UNIPRO,
+   TSTBUS_MAX,
+};
 
 static struct ufs_qcom_host *ufs_qcom_hosts[MAX_UFS_QCOM_HOSTS];
 
@@ -30,6 +48,15 @@ static void ufs_qcom_get_speed_mode(struct ufs_pa_layer_attr 
*p, char *result);
 static int ufs_qcom_get_bus_vote(struct ufs_qcom_host *host,
const char *speed_mode);
 static int ufs_qcom_set_bus_vote(struct ufs_qcom_host *host, int vote);
+static void ufs_qcom_get_default_testbus_cfg(struct ufs_qcom_host *host);
+static void ufs_qcom_dump_regs(struct ufs_hba *hba, int offset, int len,
+   char *prefix)
+{
+   print_hex_dump(KERN_ERR, prefix,
+   len > 4 ? DUMP_PREFIX_OFFSET : DUMP_PREFIX_NONE,
+   16, 4, (void __force *)hba->mmio_base + offset,
+   len * 4, false);
+}
 
 static int ufs_qcom_get_connected_tx_lanes(struct ufs_hba *hba, u32 *tx_lanes)
 {
@@ -996,6 +1023,15 @@ static int ufs_qcom_init(struct ufs_hba *hba)
if (hba->dev->id < MAX_UFS_QCOM_HOSTS)
ufs_qcom_hosts[hba->dev->id] = host;
 
+   host->dbg_print_en |= UFS_QCOM_DEFAULT_DBG_PRINT_EN;
+   ufs_qcom_get_default_testbus_cfg(host);
+   err = ufs_qcom_testbus_config(host);
+   if (err) {
+   dev_warn(dev, "%s: failed to configure the testbus %d\n",
+   __func__, err);
+   err = 0;
+   }
+
goto out;
 
 out_disable_phy:
@@ -1025,12 +1061,134 @@ void ufs_qcom_clk_scale_notify(struct ufs_hba *hba)
 
if (!dev_req_params)
return;
+}
+
+static void ufs_qcom_get_default_testbus_cfg(struct ufs_qcom_host *host)
+{
+   /* provide a legal default configuration */
+   host->testbus.select_major = TSTBUS_UAWM;
+   host->testbus.select_minor = 1;
+}
+
+static bool ufs_qcom_testbus_cfg_is_ok(struct ufs_qcom_host *host)
+{
+   if (host->testbus.select_major >= TSTBUS_MAX) {
+   dev_err(host->hba->dev,
+   "%s: UFS_CFG1[TEST_BUS_SEL} may not equal 0x%05X\n",
+   __func__, host->testbus.select_major);
+   return false;
+   }
+
+   /*
+* Not performing check for each individual select_major
+* mappings of select_minor, since there is no harm in
+* configuring a non-existent select_minor
+*/
+   if (host->testbus.select_minor > 0x1F) {
+   dev_err(host->hba->dev,
+   "%s: 0x%05X is not a legal testbus option\n",
+   __func__, host->testbus.select_minor);
+   return false;
+   }
+
+   return true;
+}
+
+int ufs_qcom_testbus_config(struct ufs_qcom_host *host)
+{
+   int reg;
+   int offset;
+   u32 mask = TEST_BUS_SUB_SEL_MASK;
+
+   if (!host)
+   return -EINVAL;
 
-   ufs_qcom_cfg_timers(hba, dev_req_params->gear_rx,
-   dev_req_params->pwr_rx,
-   dev_req_params->hs_rate);
+   if (!ufs_qcom_testbus_cfg_is_ok(host))
+   return -EPERM;
+
+   switch (host->testbus.select_major) {
+   case TSTBUS_UAWM:
+   reg = UFS_TEST_BUS_CTRL_0;
+   offset = 24;
+   break;
+   case TSTBUS_UARM:
+   reg = UFS_TEST_BUS_CTRL_0;
+   offset = 16;
+   break;
+   case TSTBUS_TXUC:
+   reg = UFS_TEST_BUS_CTRL_0;
+   offset = 8;
+   break;
+   case TSTBUS_RXUC:
+   reg = UFS_TEST_BUS_CTRL_0;
+   offset = 0;
+   break;
+   case TSTBUS_DFC:
+   reg = UFS_TEST_BUS_CTRL_1;
+   offset = 24;
+   break;
+   case TSTBUS_TRLUT:
+   reg = UFS_TEST_BUS_CTRL_1;
+   offset = 16;
+   break;
+   case TSTBUS_TMRLUT:
+   reg = UFS_TEST_BUS_CTRL_1;
+   offset =

Re: [PATCH v4 09/16] drm: rockchip: add bpc and color mode setting

2015-09-02 Thread Thierry Reding
On Wed, Sep 02, 2015 at 10:06:36AM +0800, Yakir Yang wrote:
> 在 09/02/2015 05:00 AM, Heiko Stuebner 写道:
> >Am Dienstag, 1. September 2015, 14:01:48 schrieb Yakir Yang:
[...]
> >>diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> >>b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c index 34b78e7..5d7f9b6 100644
> >>--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> >>+++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c
> >>@@ -811,14 +811,41 @@ static const struct drm_plane_funcs vop_plane_funcs =
> >>{
> >>
> >>  int rockchip_drm_crtc_mode_config(struct drm_crtc *crtc,
> >>  int connector_type,
> >>- int out_mode)
> >>+ int bpc, int color)
> >>  {
> >>struct vop *vop = to_vop(crtc);
> >>-
> >>vop->connector_type = connector_type;
> >>vop->connector_out_mode = out_mode;
> >this line should probably go away, as the source var "out_mode" does not 
> >exist
> >in the function params any more, making the compilation break, and is set
> >below anyway.
> 
> Sorry for the failed, there are must be a problem when I backport those code
> to chrome-3.14 to verify.
> 
> Thanks a lot, I would update next version soon.

*sigh*

I get the feeling that you're going about upstreaming the wrong way. If
you post patches to upstream mailing lists and you expect people to
apply those patches, then your target is the upstream kernel. So you
should be basing all of your work on top of a recent release candidate
directly from Linus or some recent version of linux-next.

Your current approach is already making people waste time trying to
build the patches and fail because you've been testing on something
other than mainline or linux-next.

At the very least your code must compile when applied against a recent
upstream tree. I would also expect you to make sure the code works at
runtime, though, contrary to build testing, not everybody will be able
to verify that you've actually done so. It is ultimately your platform
maintainer's (i.e. Heiko's) responsibility to ensure that because they
will get to deal with user complaints if people can't run an upstream
kernel on the devices.

I realize that the upstream kernel isn't what's going to end up in
products later on, but that doesn't change the fact that you're
submitting code for inclusion in the mainline tree. If you need to
backport code to some ChromeOS tree, then that should be done after
you've verified that things build and run upstream. Doing so makes life
a lot easier for your upstream maintainers, and that in turn makes it
more likely to get your code merged.

Thierry


signature.asc
Description: PGP signature


[PATCH v5 3/8] scsi: ufs-qcom: update configuration option of SCSI_UFS_QCOM component

2015-09-02 Thread Yaniv Gardi
This change is required in order to be able to build the component
as a module.

Signed-off-by: Yaniv Gardi 

---
 drivers/scsi/ufs/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/ufs/Kconfig b/drivers/scsi/ufs/Kconfig
index e945383..5f45307 100644
--- a/drivers/scsi/ufs/Kconfig
+++ b/drivers/scsi/ufs/Kconfig
@@ -72,7 +72,7 @@ config SCSI_UFSHCD_PLATFORM
  If unsure, say N.
 
 config SCSI_UFS_QCOM
-   bool "QCOM specific hooks to UFS controller platform driver"
+   tristate "QCOM specific hooks to UFS controller platform driver"
depends on SCSI_UFSHCD_PLATFORM && ARCH_QCOM
select PHY_QCOM_UFS
help
-- 
1.8.5.2

-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member of 
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/


[PATCH] [PATCH v3] add stealth mode

2015-09-02 Thread Matteo Croce
Add option to disable any reply not related to a listening socket,
like RST/ACK for TCP and ICMP Port-Unreachable for UDP.
Also disables ICMP replies to echo request and timestamp.
The stealth mode can be enabled selectively for a single interface.

Signed-off-by: Matteo Croce 
---
 Documentation/networking/ip-sysctl.txt | 14 ++
 include/linux/inetdevice.h |  1 +
 include/linux/ipv6.h   |  1 +
 include/uapi/linux/ip.h|  1 +
 net/ipv4/devinet.c |  1 +
 net/ipv4/icmp.c|  6 ++
 net/ipv4/ip_input.c|  5 +++--
 net/ipv4/tcp_ipv4.c|  3 ++-
 net/ipv4/udp.c |  4 +++-
 net/ipv6/addrconf.c|  7 +++
 net/ipv6/icmp.c|  3 ++-
 net/ipv6/ip6_input.c   |  5 +++--
 net/ipv6/tcp_ipv6.c|  2 +-
 net/ipv6/udp.c |  3 ++-
 14 files changed, 47 insertions(+), 9 deletions(-)

diff --git a/Documentation/networking/ip-sysctl.txt 
b/Documentation/networking/ip-sysctl.txt
index 5fae770..50fe7df 100644
--- a/Documentation/networking/ip-sysctl.txt
+++ b/Documentation/networking/ip-sysctl.txt
@@ -1181,6 +1181,13 @@ tag - INTEGER
Allows you to write a number, which can be used as required.
Default value is 0.
 
+stealth - BOOLEAN
+   Disable any reply not related to a listening socket,
+   like RST/ACK for TCP and ICMP Port-Unreachable for UDP.
+   Also disables ICMP replies to echo requests and timestamp
+   and ICMP errors for unknown protocols.
+   Default value is 0.
+
 Alexey Kuznetsov.
 kuz...@ms2.inr.ac.ru
 
@@ -1584,6 +1591,13 @@ stable_secret - IPv6 address
 
By default the stable secret is unset.
 
+stealth - BOOLEAN
+   Disable any reply not related to a listening socket,
+   like RST/ACK for TCP and ICMP Port-Unreachable for UDP.
+   Also disables ICMPv6 replies to echo requests
+   and ICMP errors for unknown protocols.
+   Default value is 0.
+
 icmp/*:
 ratelimit - INTEGER
Limit the maximal rates for sending ICMPv6 packets.
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
index a4328ce..a64c01e 100644
--- a/include/linux/inetdevice.h
+++ b/include/linux/inetdevice.h
@@ -128,6 +128,7 @@ static inline void ipv4_devconf_setall(struct in_device 
*in_dev)
 #define IN_DEV_ARP_ANNOUNCE(in_dev)IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
 #define IN_DEV_ARP_IGNORE(in_dev)  IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
 #define IN_DEV_ARP_NOTIFY(in_dev)  IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
+#define IN_DEV_STEALTH(in_dev) IN_DEV_MAXCONF((in_dev), STEALTH)
 
 struct in_ifaddr {
struct hlist_node   hash;
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 82806c6..49494ec 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -53,6 +53,7 @@ struct ipv6_devconf {
__s32   ndisc_notify;
__s32   suppress_frag_ndisc;
__s32   accept_ra_mtu;
+   __s32   stealth;
struct ipv6_stable_secret {
bool initialized;
struct in6_addr secret;
diff --git a/include/uapi/linux/ip.h b/include/uapi/linux/ip.h
index 08f894d..4acbf99 100644
--- a/include/uapi/linux/ip.h
+++ b/include/uapi/linux/ip.h
@@ -165,6 +165,7 @@ enum
IPV4_DEVCONF_IGMPV2_UNSOLICITED_REPORT_INTERVAL,
IPV4_DEVCONF_IGMPV3_UNSOLICITED_REPORT_INTERVAL,
IPV4_DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN,
+   IPV4_DEVCONF_STEALTH,
__IPV4_DEVCONF_MAX
 };
 
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 2d9cb17..6d9c080 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -2190,6 +2190,7 @@ static struct devinet_sysctl_table {
  "promote_secondaries"),
DEVINET_SYSCTL_FLUSHING_ENTRY(ROUTE_LOCALNET,
  "route_localnet"),
+   DEVINET_SYSCTL_RW_ENTRY(STEALTH, "stealth"),
},
 };
 
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index f5203fb..e8e71fb 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -882,6 +882,9 @@ static bool icmp_echo(struct sk_buff *skb)
 {
struct net *net;
 
+   if (IN_DEV_STEALTH(skb->dev->ip_ptr))
+   return true;
+
net = dev_net(skb_dst(skb)->dev);
if (!net->ipv4.sysctl_icmp_echo_ignore_all) {
struct icmp_bxm icmp_param;
@@ -915,6 +918,9 @@ static bool icmp_timestamp(struct sk_buff *skb)
if (skb->len < 4)
goto out_err;
 
+   if (IN_DEV_STEALTH(skb->dev->ip_ptr))
+   return true;
+
/*
 *  Fill in the current time as ms since midnight UT:
 */
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index 2db4c87..c8e0c5b 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -223,8 +223,9 @@

Re: [PATCH] irqchip/gicv3-its: comfort build warnings

2015-09-02 Thread Alex Shi


On 09/02/2015 03:52 PM, Marc Zyngier wrote:
> On 02/09/15 06:16, Alex Shi wrote:
>> There are some warnings in gicv3-its.
>> It looks like they are set in its_lpi_alloc_chunks(), but
>> in fact, both of them(lpi_base/nr_lpis) still have some chances
>> as unset variables. Anyway to comfort gcc if it's not a issue.
> 
> Which compiler are you using? I'm not seeing these warnings here.


aarch64-linux-gnu-gcc (Ubuntu/Linaro 4.8.2-13ubuntu1) 4.8.2 20140110
(prerelease) [ibm/gcc-4_8-branch merged from gcc-4_8-branch, revision
205847]

$make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig

> 
> Thanks,
> 
>   M.
> 
--
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 v17 2/4] ARM: power-domain: rockchip: add all the domain type on RK3288 SoCs

2015-09-02 Thread Caesar Wang
According to a description from TRM, add all the power domains.

At the moment, we can support some domains on RK3288.
We can add more types on RK3288 in the future, that's need to do.

Signed-off-by: Caesar Wang 

---

Changes in v17:
- delete the ugly chart in the commit.

Changes in v16:
- Add more domain decription.

Changes in v15:
- change the comment.

Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9: None
Changes in v8: None
Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3: None
Changes in v2: None

 include/dt-bindings/power-domain/rk3288.h | 31 +++
 1 file changed, 31 insertions(+)
 create mode 100644 include/dt-bindings/power-domain/rk3288.h

diff --git a/include/dt-bindings/power-domain/rk3288.h 
b/include/dt-bindings/power-domain/rk3288.h
new file mode 100644
index 000..db5e810
--- /dev/null
+++ b/include/dt-bindings/power-domain/rk3288.h
@@ -0,0 +1,31 @@
+#ifndef __DT_BINDINGS_POWER_DOMAIN_RK3288_H__
+#define __DT_BINDINGS_POWER_DOMAIN_RK3288_H__
+
+/**
+ * RK3288 Power Domain and Voltage Domain Summary.
+ */
+
+/* VD_CORE */
+#define RK3288_PD_A17_00
+#define RK3288_PD_A17_11
+#define RK3288_PD_A17_22
+#define RK3288_PD_A17_33
+#define RK3288_PD_SCU  4
+#define RK3288_PD_DEBUG5
+#define RK3288_PD_MEM  6
+
+/* VD_LOGIC */
+#define RK3288_PD_BUS  7
+#define RK3288_PD_PERI 8
+#define RK3288_PD_VIO  9
+#define RK3288_PD_ALIVE10
+#define RK3288_PD_HEVC 11
+#define RK3288_PD_VIDEO12
+
+/* VD_GPU */
+#define RK3288_PD_GPU  13
+
+/* VD_PMU */
+#define RK3288_PD_PMU  14
+
+#endif
-- 
1.9.1

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


[PATCH v17 1/4] dt-bindings: add document of Rockchip power domains

2015-09-02 Thread Caesar Wang
This add the necessary binding documentation for the power domains
found on Rockchip SoCs.

Signed-off-by: jinkun.hong 
Signed-off-by: Caesar Wang 

---

Changes in v17:
- add the decription in detail for RK3288 SoCs.

Changes in v16:
- remove the pmu node.

Changes in v15: None
Changes in v14: None
Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10: None
Changes in v9:
- add document decription.

Changes in v8:
- document go back to v2.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- DT structure has changed.

Changes in v2:
- move clocks to "optional".

 .../bindings/soc/rockchip/power_domain.txt | 114 +
 1 file changed, 114 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/soc/rockchip/power_domain.txt

diff --git a/Documentation/devicetree/bindings/soc/rockchip/power_domain.txt 
b/Documentation/devicetree/bindings/soc/rockchip/power_domain.txt
new file mode 100644
index 000..4cf6b27
--- /dev/null
+++ b/Documentation/devicetree/bindings/soc/rockchip/power_domain.txt
@@ -0,0 +1,114 @@
+* Rockchip Power Domains
+
+Rockchip processors include support for multiple power domains which can be
+powered up/down by software based on different application scenes to save 
power.
+
+Required properties for power domain controller:
+- compatible: Should be one of the following.
+   "rockchip,rk3288-power-controller" - for RK3288 SoCs.
+- #power-domain-cells: Number of cells in a power-domain specifier.
+   Should be 1 for multiple PM domains.
+- #address-cells: Should be 1.
+- #size-cells: Should be 0.
+
+Required properties for power domain sub nodes:
+- reg: index of the power domain, should use macros in:
+   "include/dt-bindings/power-domain/rk3288.h" - for RK3288 type power 
domain.
+- clocks (optional): phandles to clocks which need to be enabled while power 
domain
+   switches state.
+
+Example:
+
+   power: power-controller {
+   compatible = "rockchip,rk3288-power-controller";
+   #power-domain-cells = <1>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   pd_gpu {
+   reg = ;
+   clocks = <&cru ACLK_GPU>;
+   };
+   };
+
+Node of a device using power domains must have a power-domains property,
+containing a phandle to the power device node and an index specifying which
+power domain to use.
+The index should use macros in:
+   "include/dt-bindings/power-domain/rk3288.h" - for rk3288 type power 
domain.
+
+Example of the node using power domain:
+
+   node {
+   /* ... */
+   power-domains = <&power RK3288_PD_GPU>;
+   /* ... */
+   };
+
+Others, all the device clocks being listed in the power-domains itself.
+All the device clocks are included in someone domians that need to enable
+before you operate them.
+
+As the chip designs for PM hardware. We need turn on the noc clocks,
+if we are operating the "pd_vio" domain to enter the idle status.
+
+As the following described in detail for every device be included in domains
+on RK3288 SoCs.
+
+   /* GPU's ACLK_GPU on the ACLK_GPU_NIU */
+   pd_gpu {
+   reg = ;
+   clocks = <&cru ACLK_GPU>;
+   };
+
+   /* HEVC AXI clocks */
+   pd_hevc {
+   reg = ;
+   clocks = <&cru ACLK_HEVC>,
+   <&cru SCLK_HEVC_CABAC>,
+   <&cru SCLK_HEVC_CORE>,
+   <&cru HCLK_HEVC>;
+   };
+
+   /*
+* RGA, VOP, MIPI, LVDS, EDP..., says the ACLK* on the ACLK_VIO_NIU,
+* others are on the HCLK_VIO_NIU.
+*/
+   pd_vio {
+   reg = ;
+   clocks = <&cru ACLK_IEP>,
+   <&cru ACLK_ISP>,
+   <&cru ACLK_RGA>,
+   <&cru ACLK_VIP>,
+   <&cru ACLK_VOP0>,
+   <&cru ACLK_VOP1>,
+   <&cru DCLK_VOP0>,
+   <&cru DCLK_VOP1>,
+   <&cru HCLK_IEP>,
+   <&cru HCLK_ISP>,
+   <&cru HCLK_RGA>,
+   <&cru HCLK_VIP>,
+   <&cru HCLK_VOP0>,
+   <&cru HCLK_VOP1>,
+   <&cru PCLK_EDP_CTRL>,
+   <&cru PCLK_HDMI_CTRL>,
+   <&cru PCLK_LVDS_PHY>,
+   <&cru PCLK_MIPI_CSI>,
+   <&cru PCLK_MIPI_DSI0>,
+   <&cru PCLK_MIPI_DSI1>,
+   <&cru SCLK_EDP_24M>,
+   <&cru SCLK_EDP>,
+   <&cru SCLK_ISP_JPE>,
+   <&cru SCLK_ISP>,
+   <&cru SCLK_RGA>;
+   };
+
+   /*
+* Video's ACLK_VCODEC on the ACLK_VCODEC_NIU, Video's HCLK_VCODEC,
+* on the HCLK_VCODEC_NIU.
+*/
+   pd_video {
+   reg = ;
+   clocks = <&cru ACLK_VCODEC>,
+   <&cru HCLK_VCODEC>;
+   };
-- 
1.9.1

--
To unsubscribe from this list: send the l

[PATCH v17 0/4] ARM: rk3288: Add PM Domain support

2015-09-02 Thread Caesar Wang
Thank you all for providing inputs and comments on previous versions of
this patchset.
Especially thanks to the (Kevin, Heiko, Dmitry, Doug, ULF, Michael).

Add power domain drivers based on generic power domain for
Rockchip platform, and support RK3288 SoCs.

Verified on url =
https://chromium.googlesource.com/chromiumos/third_party/kernel/+/v3.14
localhost / # cat /sys/kernel/debug/pm_genpd/pm_genpd_summary
domain  status slaves
/device  runtimestatus
--
pd_videooff
/devices/ff9a0800.iommu suspended
/devices/ff9a.video-codec   suspended
pd_vio  on
/devices/ff930300.iommu suspended
/devices/ff940300.iommu suspended
/devices/ff93.vop   suspended
/devices/ff94.vop   suspended
/devices/ff98.hdmi  unsupported
/devices/rockchip-edp   unsupported
pd_hevc off
pd_gpu  off
/devices/ffa3.gpu   suspended

The following is the easy example.

vopb: vop@ff93 {
compatible = "rockchip,rk3288-vop";
...
iommus = <&vopb_mmu>;
power-domains = <&power RK3288_PD_VIO>;
status = "disabled";
...
};

vopb_mmu: iommu@ff930300 {
compatible = "rockchip,iommu";
...
interrupt-names = "vopb_mmu";
power-domains = <&power RK3288_PD_VIO>;
#iommu-cells = <0>;
status = "disabled";
...
};

vopl: vop@ff94 {
compatible = "rockchip,rk3288-vop";
reg = <0xff94 0x19c>;
...
iommus = <&vopl_mmu>;
power-domains = <&power RK3288_PD_VIO>;
status = "disabled";
...
};

vopl_mmu: iommu@ff940300 {
compatible = "rockchip,iommu";
...
interrupt-names = "vopl_mmu";
power-domains = <&power RK3288_PD_VIO>;
#iommu-cells = <0>;
status = "disabled";
};

Others, we can verify this driver for the EDP.
We can apply the following these patchs.

6967631 New  [v2,1/8] drm: exynos/dp: fix code style
6967741 New  [v2,2/8] drm: exynos/dp: convert to drm bridge mode
6967801 New  [v2,3/8] drm: bridge: analogix_dp: split exynos dp 
driver to bridge dir
6967791 New  [v2,4/8] drm: rockchip/dp: add rockchip platform dp 
driver
6968031 New  [v2,5/8] drm: bridge/analogix_dp: add platform device 
type support
6968141 New  [v2,6/8] drm: bridge: analogix_dp: add some rk3288 
special registers setting
6967941 New  [v2,7/8] drm: bridge: analogix_dp: try force hpd after 
plug in lookup failed
6967971 New  [v2,8/8] drm: bridge/analogix_dp: expand the delay 
time for hpd detect

There is a recent addition from Linus Walleij,
called simple-mfd [a] that is supposed to get added real early for kernel 
4.2

[a]:

https://git.kernel.org/cgit/linux/kernel/git/linusw/linux-integrator.git/commit/?id=fcf294c020ff7ee4e3b1e96159e4dc7a17ad5

Here is my branch, Tested by chromeos-3.14 and next-kernel.

f54144e ARM: dts: add the support power-domain node on RK3288 SoCs
acf07d3 soc: rockchip: power-domain: Add power domain driver
8cc2139 ARM: power-domain: rockchip: add all the domain type on RK3288 SoCs
7114c12 dt-bindings: add document of Rockchip power domains
ae98207 Merge tag 'pm+acpi-4.3-rc1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
f1a3c0b Merge tag 'devicetree-for-4.3' of 
git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux
089b669 Merge branch 'for-next' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
45c680b Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching
851328f Merge branch 'for-linus' of 
git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
..


Changes in v17:
- add the decription in detail for RK3288 SoCs.
- delete the ugly chart in the commit.
- (re)defining config for ROCKCHIP.
- remove clocks of the HDMI ctrl.
- update the description.
- add Reviewed-by: Michale.

Changes in v16:
- remove the pmu node.
- Add more domain decription.
- the driver type from tristate to bool.
- Letter misspelled.
- As Ulf suggestion, remove #include ,
  use "%pC" as the formatting string for the dev_dbg().
- As the Ulf suggestion, set the genpd->flags to assign the
  ->stop|start() callbacks.
- Manually copy the problem in patch v15.
- rebase the description.

Changes in v15:
- change the comment.
- As the kevin suggestion, put the power-domain driver into driver/soc/vendor.
- As Heiko suggestion, Patch 1: binding doc, 2

[PATCH v17 3/4] soc: rockchip: power-domain: Add power domain driver

2015-09-02 Thread Caesar Wang
This driver is found on RK3288 SoCs.

In order to meet high performance and low power requirements, a power
management unit is designed or saving power when RK3288 in low power
mode.
The RK3288 PMU is dedicated for managing the power of the whole chip.

PMU can work in the Low Power Mode by setting bit[0] of PMU_PWRMODE_CON
register. After setting the register, PMU would enter the Low Power mode.
In the low power mode, pmu will auto power on/off the specified power
domain, send idle req to specified power domain, shut down/up pll and
so on. All of above are configurable by setting corresponding registers.

Signed-off-by: jinkun.hong 
Signed-off-by: Caesar Wang 

---

Changes in v17:
- (re)defining config for ROCKCHIP.

Changes in v16:
- the driver type from tristate to bool.
- Letter misspelled.
- As Ulf suggestion, remove #include ,
  use "%pC" as the formatting string for the dev_dbg().
- As the Ulf suggestion, set the genpd->flags to assign the
  ->stop|start() callbacks.

Changes in v15:
- As the kevin suggestion, put the power-domain driver into driver/soc/vendor.
- As Heiko suggestion, Patch 1: binding doc, 2: binding-header, 3: driver,
  4: dts-changes.
- return -ENXIO --> return -ENODEV.

Changes in v14:
- does not need to set an owner,remove the "THIS_MODULE".

Changes in v13:
- Remove essential clocks from rk3288 PD_VIO domain Some clocks are essential
  for the system health and should not be turned down. However there is no owner
  for them so if they listed as belonging to power domain we'll try toggling 
them
  up and down during power domain.
- Device drivers expect their devices to be powered on before their
  probing code is invoked. To achieve that we should start with
  power domains powered on (we may turn them off later once all devices enable
  runtime powermanagment and go idle).
- This change switches Rockchip power domain driver to use updated
  device_attach and device_detach API.
- set the gpu/core power domain power delay time.
- fix enumerating PM clocks for devices.
- fix use after free We can't use clk after we did clk_put(clk).

Changes in v12:
- fix the title doamin->domain.
- updated device_attach and device_detach API,otherwise it will
  compile fail on next kernel.

Changes in v11:
- fix pm_genpd_init(&pd->genpd, NULL, false).

Changes in v10:
- this switches over domain infos to use masks instead of recomputing
  them each time and also gets rid of custom domain translator and
  uses standard onecell on.

Changes in v9:
- fix v8 changes as follows:
- This reconciles the v2 and v7 code so that we power domain have lists of 
clocks
  they trigger on and off during power transitions and independently from power
  domains clocks. We attach clocks to devices comprising power domain and 
prepare
  them so they are turn on and off by runtime PM.
- add rockchip_pm_add_one_domain() to control domains.
- add pd_start/pd_stop interface to control clocks.

Changes in v8:
- This reconciles the v2 and v7 code so that we power domain have
  lists of clocks they toggle on and off during power transitions
  and independently from power domains clocks we attach clocks to
  devices comprising power domain and prepare them so they are
  turn on and off by runtime PM.

Changes in v7:
 - Delete unused variables

Changes in v6:
- delete pmu_lock.
- modify dev_lock using mutex.
- pm_clk_resume(pd->dev) change to pm_clk_resume(ed->dev).
- pm_clk_suspend(pd->dev) change to pm_clk_suspend(ed->dev).
- add devm_kfree(pd->dev, de) in rockchip_pm_domain_detach_dev.

Changes in v5:
- delete idle_lock.
- add timeout in rockchip_pmu_set_idle_request().

Changes in v4:
- use list storage dev.

Changes in v3:
- change use pm_clk_resume() and pm_clk_suspend().

Changes in v2:
- remove the "pd->pd.of_node = np".

 drivers/soc/Kconfig   |   1 +
 drivers/soc/Makefile  |   1 +
 drivers/soc/rockchip/Kconfig  |  14 ++
 drivers/soc/rockchip/Makefile |   4 +
 drivers/soc/rockchip/pm_domains.c | 485 ++
 5 files changed, 505 insertions(+)
 create mode 100644 drivers/soc/rockchip/Kconfig
 create mode 100644 drivers/soc/rockchip/Makefile
 create mode 100644 drivers/soc/rockchip/pm_domains.c

diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index 96ddecb..ecb1a6c 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -2,6 +2,7 @@ menu "SOC (System On Chip) specific Drivers"
 
 source "drivers/soc/mediatek/Kconfig"
 source "drivers/soc/qcom/Kconfig"
+source "drivers/soc/rockchip/Kconfig"
 source "drivers/soc/sunxi/Kconfig"
 source "drivers/soc/ti/Kconfig"
 source "drivers/soc/versatile/Kconfig"
diff --git a/drivers/soc/Makefile b/drivers/soc/Makefile
index 0b12d77..c2b485f 100644
--- a/drivers/soc/Makefile
+++ b/drivers/soc/Makefile
@@ -5,6 +5,7 @@
 obj-$(CONFIG_MACH_DOVE)+= dove/
 obj-$(CONFIG_ARCH_MEDIATEK)+= mediatek/
 obj-$(CONFIG_ARCH_QCOM)+= qcom/
+obj-$(CONFIG_ARCH_ROCKCHIP)+= rockchip/

[PATCH v17 4/4] ARM: dts: add the support power-domain node on RK3288 SoCs

2015-09-02 Thread Caesar Wang
We can add more domains node in the future.
This patch add the needed clocks into power-controller.
As the discuess about all the device clocks being listed in
the power-domains itself.

There are several reasons as follows:

Firstly, the clocks need be turned off to save power when
the system enter the suspend state. So we need to enumerate
the clocks in the dts. In order to power domain can turn on and off.

Secondly, the reset-circuit should reset be synchronous on RK3288,
then sync revoked. So we need to enable clocks of all devices.
In other words, we have to enable the clocks before you operate them
if all the device clocks are included in someone domians.

Thirdly, as the chip designs for PM hardhare. we need turn on the noc
clocks, if we are operating the "pd_vio" domain to enter the idle status.
The device's clock be included in domains that needed turn on if do that.

The clocks in the dts are needed to enable before you want to happy work.
At the moment, This patch is very good work for PM hardware.

Also, we can add it in the future if we have some hidden clocks.

Signed-off-by: jinkun.hong 
Signed-off-by: Caesar Wang 
Reviewed-by: Michael Turquette 

---

Changes in v17:
- remove clocks of the HDMI ctrl.
- update the description.
- add Reviewed-by: Michale.

Changes in v16:
- Manually copy the problem in patch v15.
- rebase the description.

Changes in v15:
- As Tomasz remarked previously the dts should represent the hardware
  and the power-domains are part of the pmu.

Changes in v14:
- Remove essential clocks from rk3288 PD_VIO domain, Some clocks are
  essential for the system health and should not be turned down.
  However there is no owner for them so if they listed as belonging to power
  domain we'll try toggling them up and down during power domain transition.
  As a result we either fail to suspend or resume the system.

Changes in v13: None
Changes in v12: None
Changes in v11: None
Changes in v10:
- fix missing the #include .
- remove the notes.

Changes in v9:
- add decription for power-doamin node.

Changes in v8:
- DTS go back to v2.

Changes in v7: None
Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- Decomposition power-controller, changed to multiple controller
  (gpu-power-controller, hevc-power-controller).

Changes in v2:
- make pd_vio clocks all one entry per line and alphabetize.
- power: power-controller move back to pinctrl: pinctrl.

 arch/arm/boot/dts/rk3288.dtsi | 58 ++-
 1 file changed, 57 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/rk3288.dtsi b/arch/arm/boot/dts/rk3288.dtsi
index 906e938..4ce3099 100644
--- a/arch/arm/boot/dts/rk3288.dtsi
+++ b/arch/arm/boot/dts/rk3288.dtsi
@@ -44,6 +44,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "skeleton.dtsi"
 
 / {
@@ -613,8 +614,63 @@
};
 
pmu: power-management@ff73 {
-   compatible = "rockchip,rk3288-pmu", "syscon";
+   compatible = "rockchip,rk3288-pmu", "syscon", "simple-mfd";
reg = <0xff73 0x100>;
+
+   power: power-controller {
+   compatible = "rockchip,rk3288-power-controller";
+   #power-domain-cells = <1>;
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   pd_gpu {
+   reg = ;
+   clocks = <&cru ACLK_GPU>;
+   };
+
+   pd_hevc {
+   reg = ;
+   clocks = <&cru ACLK_HEVC>,
+<&cru SCLK_HEVC_CABAC>,
+<&cru SCLK_HEVC_CORE>,
+<&cru HCLK_HEVC>;
+   };
+
+   pd_vio {
+   reg = ;
+   clocks = <&cru ACLK_IEP>,
+<&cru ACLK_ISP>,
+<&cru ACLK_RGA>,
+<&cru ACLK_VIP>,
+<&cru ACLK_VOP0>,
+<&cru ACLK_VOP1>,
+<&cru DCLK_VOP0>,
+<&cru DCLK_VOP1>,
+<&cru HCLK_IEP>,
+<&cru HCLK_ISP>,
+<&cru HCLK_RGA>,
+<&cru HCLK_VIP>,
+<&cru HCLK_VOP0>,
+<&cru HCLK_VOP1>,
+<&cru PCLK_EDP_CTRL>,
+<&cru PCLK_HDMI_CTRL>,
+<&cru PCLK_LVDS_PHY>,
+<&cru PCL

Re: [PATCH V4] mm: memory hot-add: memory can not be added to movable zone defaultly

2015-09-02 Thread Changsheng Liu



On 9/1/2015 23:37, Yasuaki Ishimatsu wrote:

On Mon, 31 Aug 2015 01:58:40 -0400
Changsheng Liu  wrote:


From: Changsheng Liu 

After the user config CONFIG_MOVABLE_NODE and movable_node kernel option,
When the memory is hot added, should_add_memory_movable() return 0
because all zones including movable zone are empty,
so the memory that was hot added will be added  to the normal zone
and the normal zone will be created firstly.
But we want the whole node to be added to movable zone defaultly.

So we change should_add_memory_movable(): if the user config
CONFIG_MOVABLE_NODE and movable_node kernel option
it will always return 1 and all zones is empty at the same time,
so that the movable zone will be created firstly
and then the whole node will be added to movable zone defaultly.
If we want the node to be added to normal zone,
we can do it as follows:
"echo online_kernel > /sys/devices/system/memory/memoryXXX/state"

If the memory is added to movable zone defaultly,
the user can offline it and add it to other zone again.
But if the memory is added to normal zone defaultly,
the user will not offline the memory used by kernel.

Reviewed-by: Andrew Morton 
Reviewed-by: Yasuaki Ishimatsu 
Reviewed-by: Vlastimil Babka 
Reviewed-by: Xiaofeng Yan 
Signed-off-by: Changsheng Liu 
Tested-by: Dongdong Fan 
---
  mm/memory_hotplug.c |5 +
  1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 26fbba7..d1149ff 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1197,6 +1197,11 @@ static int should_add_memory_movable(int nid, u64 start, 
u64 size)
unsigned long start_pfn = start >> PAGE_SHIFT;
pg_data_t *pgdat = NODE_DATA(nid);
struct zone *movable_zone = pgdat->node_zones + ZONE_MOVABLE;
+   struct zone *normal_zone = pgdat->node_zones + ZONE_NORMAL;
+
+   if (movable_node_is_enabled()
+   && (zone_end_pfn(normal_zone) <= start_pfn))
+   return 1;

If system boots up without movable_node, kernel behavior is changed by the 
patch.
And you syould consider other zone.

How about it. The patch is no build and test.

Thanks for your suggestion. We will test the patch on our platform



---
  mm/memory_hotplug.c |   36 
  1 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 6da82bc..321595d 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1198,6 +1198,8 @@ static int check_hotplug_memory_range(u64 start, u64 size)
  /*
   * If movable zone has already been setup, newly added memory should be check.
   * If its address is higher than movable zone, it should be added as movable.
+ * And if system boots up with movable_zone and added memory does not overlap
+ * other zone except for movable zone, the memory is added as movable.
   * Without this check, movable zone may overlap with other zone.
   */
  static int should_add_memory_movable(int nid, u64 start, u64 size)
@@ -1205,14 +1207,40 @@ static int should_add_memory_movable(int nid, u64 
start, u64 size)
unsigned long start_pfn = start >> PAGE_SHIFT;
pg_data_t *pgdat = NODE_DATA(nid);
struct zone *movable_zone = pgdat->node_zones + ZONE_MOVABLE;
+   struct zone *zone;
+   enum zone_type zt = ZONE_MOVABLE - 1;
+
+   /*
+* If memory is added after ZONE_MOVALBE, the memory is managed as
+* movable.
+*/
+   if (!zone_is_empty(movable_zone) &&
+   (movable_zone->zone_start_pfn <= start_pfn))
+   return 1;
  
-	if (zone_is_empty(movable_zone))

+   if (!movable_node_is_enabled())
return 0;
  
-	if (movable_zone->zone_start_pfn <= start_pfn)

-   return 1;
+   /*
+* Find enabled zone and check the added memory.
+* If the memory is added after the enabled zone, the memory is
+* managed as movable.
+*
+* If all zones are empty, the memory is also managed as movable.
+*/
+   for (; zt >= ZONE_DMA; zt--) {
+   zone = pgdat->node_zones + zt;
  
-	return 0;

+   if (zone_is_empty(zone))
+   continue;
+
+   if (zone_end_pfn(zone) <= start_pfn)
+   return 1;
+   else
+   return 0;
+   }
+
+   return 1;
  }
  
  int zone_for_memory(int nid, u64 start, u64 size, int zone_default)


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


[PATCH 1/3] cpufreq: dt: Check OPP count before marking them shared

2015-09-02 Thread Viresh Kumar
We need to explicitly mark OPPs as shared, when they are not defined
with OPP-v2 bindings. But this isn't required to be done if we failed to
initialize OPP table.

Reorder code to verify OPP count before marking them shared.

Fixes: 2e02d8723edf ("cpufreq: dt: Add support for operating-points-v2 
bindings")
Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/cpufreq-dt.c | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index c3583cdfadbd..8c38b5192baa 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -239,6 +239,17 @@ static int cpufreq_init(struct cpufreq_policy *policy)
 */
of_cpumask_init_opp_table(policy->cpus);
 
+   /*
+* But we need OPP table to function so if it is not there let's
+* give platform code chance to provide it for us.
+*/
+   ret = dev_pm_opp_get_opp_count(cpu_dev);
+   if (ret <= 0) {
+   pr_debug("OPP table is not ready, deferring probe\n");
+   ret = -EPROBE_DEFER;
+   goto out_free_opp;
+   }
+
if (need_update) {
struct cpufreq_dt_platform_data *pd = cpufreq_get_driver_data();
 
@@ -256,17 +267,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
transition_latency = dev_pm_opp_get_max_clock_latency(cpu_dev);
}
 
-   /*
-* But we need OPP table to function so if it is not there let's
-* give platform code chance to provide it for us.
-*/
-   ret = dev_pm_opp_get_opp_count(cpu_dev);
-   if (ret <= 0) {
-   pr_debug("OPP table is not ready, deferring probe\n");
-   ret = -EPROBE_DEFER;
-   goto out_free_opp;
-   }
-
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
ret = -ENOMEM;
-- 
2.4.0

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


[PATCH 2/3] cpufreq: dt: Print error on failing to mark OPPs as shared

2015-09-02 Thread Viresh Kumar
We need to explicitly mark OPPs as shared, when they are not defined
with OPP-v2 bindings. This operation can potentially fail, and in that
case we should at least print an error message.

Fixes: 2e02d8723edf ("cpufreq: dt: Add support for operating-points-v2 
bindings")
Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/cpufreq-dt.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index 8c38b5192baa..b1131cf89757 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -260,7 +260,10 @@ static int cpufreq_init(struct cpufreq_policy *policy)
 * OPP tables are initialized only for policy->cpu, do it for
 * others as well.
 */
-   set_cpus_sharing_opps(cpu_dev, policy->cpus);
+   ret = set_cpus_sharing_opps(cpu_dev, policy->cpus);
+   if (ret)
+   dev_err(cpu_dev, "%s: failed to mark OPPs as shared: 
%d\n",
+   __func__, ret);
 
of_property_read_u32(np, "clock-latency", &transition_latency);
} else {
-- 
2.4.0

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


[PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage

2015-09-02 Thread Viresh Kumar
Tolerance applies on both sides of the target voltage, i.e. both min and
max sides. But while checking if a voltage is supported by the regulator
or not, we haven't taken care of tolerance on the lower side. Fix that.

Cc: Lucas Stach 
Fixes: 045ee45c4ff2 ("cpufreq: cpufreq-dt: disable unsupported OPPs")
Signed-off-by: Viresh Kumar 
---
 drivers/cpufreq/cpufreq-dt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index b1131cf89757..3b64c203bf99 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -303,7 +303,8 @@ static int cpufreq_init(struct cpufreq_policy *policy)
rcu_read_unlock();
 
tol_uV = opp_uV * priv->voltage_tolerance / 100;
-   if (regulator_is_supported_voltage(cpu_reg, opp_uV,
+   if (regulator_is_supported_voltage(cpu_reg,
+  opp_uV - tol_uV,
   opp_uV + tol_uV)) {
if (opp_uV < min_uV)
min_uV = opp_uV;
-- 
2.4.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: [BUG 4.2-rc8] Interrupt occurs while apply_alternatives() is patching the handler

2015-09-02 Thread Thomas Gleixner
On Tue, 1 Sep 2015, Richard W.M. Jones wrote:
> On Sun, Aug 30, 2015 at 10:37:57PM -0400, Chuck Ebbert wrote:
> > This is from https://bugzilla.redhat.com/show_bug.cgi?id=1258223
> > 
> > [0.036000] BUG: unable to handle kernel paging request at 55501e06
> [...]
> > [0.036000]  [] ? add_nops+0x90/0xa0
> > [0.036000]  [] apply_alternatives+0x274/0x630
> > [0.036000]  [] ? wait_for_xmitr+0xa0/0xa0
> > [0.036000]  [] ? sprintf+0x1c/0x20
> > [0.036000]  [] ? irq_entries_start+0x698/0x698
> > [0.036000]  [] ? memcpy+0xb/0x30
> > [0.036000]  [] ? serial8250_set_termios+0x20/0x20
> [...]
> > Interrupt 0x30 occurred while the alternatives code was replacing the
> > initial 0x90,0x90,0x90 NOPs (from the ASM_CLAC macro) with the optimized
> > version, 0x8d,0x76,0x00. Only the first byte has been replaced so far,
> > and it makes a mess out of the insn decoding.

apply_alternatives() has two ways to modify the code:

1) text_poke_early()

2) optimize_nops()

The former disables interrupts, the latter not. The patch below should
fix the issue.

Thanks,

tglx

diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c
index c42827eb86cf..6a2f93e029f4 100644
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -257,6 +257,9 @@ void __init arch_init_ideal_nops(void)
 /* Use this to add nops to a buffer, then text_poke the whole buffer. */
 static void __init_or_module add_nops(void *insns, unsigned int len)
 {
+   unsigned long flags;
+
+   local_irq_save(flags);
while (len > 0) {
unsigned int noplen = len;
if (noplen > ASM_NOP_MAX)
@@ -265,6 +268,7 @@ static void __init_or_module add_nops(void *insns, unsigned 
int len)
insns += noplen;
len -= noplen;
}
+   local_irq_restore(flags);
 }
 
 extern struct alt_instr __alt_instructions[], __alt_instructions_end[];




--
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] dax, pmem: add support for msync

2015-09-02 Thread Kirill A. Shutemov
On Wed, Sep 02, 2015 at 08:49:22AM +1000, Dave Chinner wrote:
> On Tue, Sep 01, 2015 at 01:08:04PM +0300, Kirill A. Shutemov wrote:
> > On Tue, Sep 01, 2015 at 09:38:03AM +1000, Dave Chinner wrote:
> > > On Mon, Aug 31, 2015 at 12:59:44PM -0600, Ross Zwisler wrote:
> > > Even for DAX, msync has to call vfs_fsync_range() for the filesystem to 
> > > commit
> > > the backing store allocations to stable storage, so there's not
> > > getting around the fact msync is the wrong place to be flushing
> > > DAX mappings to persistent storage.
> > 
> > Why?
> > IIUC, msync() doesn't have any requirements wrt metadata, right?
> 
> Of course it does. If the backing store allocation has not been
> committed, then after a crash there will be a hole in file and
> so it will read as zeroes regardless of what data was written and
> flushed.

Any reason why backing store allocation cannot be committed on *_mkwrite?

> > > I pointed this out almost 6 months ago (i.e. that fsync was broken)
> > > anf hinted at how to solve it. Fix fsync, and msync gets fixed for
> > > free:
> > > 
> > > https://lists.01.org/pipermail/linux-nvdimm/2015-March/000341.html
> > > 
> > > I've also reported to Willy that DAX write page faults don't work
> > > correctly, either. xfstests generic/080 exposes this: a read
> > > from a page followed immediately by a write to that page does not
> > > result in ->page_mkwrite being called on the write and so
> > > backing store is not allocated for the page, nor are the timestamps
> > > for the file updated. This will also result in fsync (and msync)
> > > not working properly.
> > 
> > Is that because XFS doesn't provide vm_ops->pfn_mkwrite?
> 
> I didn't know that had been committed. I don't recall seeing a pull
> request with that in it

It went though -mm tree.

> none of the XFS DAX patches conflicted
> against it and there's been no runtime errors. I'll fix it up.
> 
> As such, shouldn't there be a check in the VM (in ->mmap callers)
> that if we have the vma is returned with VM_MIXEDMODE enabled that
> ->pfn_mkwrite is not NULL?  It's now clear to me that any filesystem
> that sets VM_MIXEDMODE needs to support both page_mkwrite and
> pfn_mkwrite, and such a check would have caught this immediately...

I guess it's "both or none" case. We have VM_MIXEDMAP users who don't care
about *_mkwrite.

I'm not yet sure it would be always correct, but something like this will
catch the XFS case, without false-positive on other stuff in my KVM setup:

diff --git a/mm/mmap.c b/mm/mmap.c
index 3f78bceefe5a..f2e29a541e14 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1645,6 +1645,15 @@ unsigned long mmap_region(struct file *file, unsigned 
long addr,
vma->vm_ops = &dummy_ops;
}
 
+   /*
+* Make sure that for VM_MIXEDMAP VMA has both
+* vm_ops->page_mkwrite and vm_ops->pfn_mkwrite or has none.
+*/
+   if ((vma->vm_ops->page_mkwrite || vma->vm_ops->pfn_mkwrite) &&
+   vma->vm_flags & VM_MIXEDMAP) {
+   VM_BUG_ON_VMA(!vma->vm_ops->page_mkwrite, vma);
+   VM_BUG_ON_VMA(!vma->vm_ops->pfn_mkwrite, vma);
+   }
addr = vma->vm_start;
vm_flags = vma->vm_flags;
} else if (vm_flags & VM_SHARED) {
-- 
 Kirill A. Shutemov
--
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: [regression] x86/signal/64: Fix SS handling for signals delivered to 64-bit programs breaks dosemu

2015-09-02 Thread Stas Sergeev

02.09.2015 08:12, Andy Lutomirski пишет:

On Wed, Aug 19, 2015 at 9:30 AM, Stas Sergeev  wrote:

19.08.2015 18:46, Andy Lutomirski пишет:

On Wed, Aug 19, 2015 at 2:35 AM, Stas Sergeev  wrote:

Incidentally, I tried implementing the sigaction flag approach.  I
think it's no good.  When we return from a signal, there's no concept
of sigaction -- it's just sigreturn.  Sigreturn can't look up the
sigaction flags -- what if the signal handler calls sigaction itself.

How about the SA_hyz flag that does the following:
- Saves SS into sigcontext
- Forces SS to USER_DS on signal delivery
- Sets the uc_flags flag for sigreturn() to take care of the rest.
You'll have both the control on every bit of action, and a simple
detection logic: if SA_hyz didn't set the uc flag - it didn't work.
You can even employ your lar heuristic here for the case when the
aforementioned SA_hyz is not set. But please, please not when it is
set! In fact, I wonder if you had in mind exactly that: using the
lar heuristic only if the SA_hyz is not set. If so - I misunderstood.
Just please don't add it when it is set.

Hmm, interesting.  Maybe that would work for everything.  How's this
to make it concrete?

Add a sigaction flag SA_RESTORE_SS.

On signal delivery, always save SS into sigcontext->ss. if
SA_RESTORE_SS is set, then unconditionally switch HW SS to __USER_DS
and set UC_RESTORE_SS.  If SA_RESTORE_SS is clear, then leave HW SS
alone (i.e. preserve the old behavior).

Either that, or employ the lar heuristic for the "not set" case
(I think its not needed).


On signal return, if UC_RESTORE_SS is set, then restore
sigcontext->ss.  If not, then set SS to __USER_DS (as old kernels
did).

This should change nothing at all (except the initial value of
sigcontext->ss / __pad0) on old kernels.

Agreed.


Let me throw out one more possibility, just for completeness:

We don't add any SA_xyz flags.  On signal delivery, we use the LAR
heuristic.  We always fill in sigcontext->ss, and we set a new
UC_SIGCONTEXT_SS flag to indicate that we support the new behavior.

On sigreturn, we honor the sigcontext's ss, *unless* CS is 64 bit and
SS is invalid.  In the latter case, we replace the saved ss with
__USER_DS.

But this is not a new proposal, see here:
https://lkml.org/lkml/2015/8/13/436
The very last sentence says exactly the same.
I thought this is in the past. :)


This should work for old DOSEMU.  It's a bit gross, but it has the
nice benefit that everyone (even things that aren't DOSEMU) gain the
ability to catch signals thrown from bogus SS contexts, which probably
improves debugability.  It's also nice to not have the SA flag.

Pros:
- No new SA flag
- May improve debugability in some unknown scenario where people
do not want to just use the new flag to get their things improved

Cons:
- Does not allow to cleanly use siglongjmp(), as then there is a risk
to jump to 64bit code with bad SS
- Async signals can silently "validate" SS behind your back
- No way to extend that solution to later fixing the TLS problem
- Many ugly checks in the code, that are not always even obvious
(eg you wanted to try verw instead, and there was a gotcha with
NP bit)

Is the new SA flag such a big deal here to even bother?
--
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] ASoC: bcm2835-i2s: Fix module autoload for OF platform drivers

2015-09-02 Thread Lee Jones
On Thu, 27 Aug 2015, Luis de Bethencourt wrote:

> These platform drivers have a OF device ID table but the OF module
> alias information is not created so module autoloading won't work.
> 
> Signed-off-by: Luis de Bethencourt 
> ---
>  sound/soc/bcm/bcm2835-i2s.c | 2 ++
>  1 file changed, 2 insertions(+)

Acked-by: Lee Jones 

> diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
> index 03fa1cb..8c435be 100644
> --- a/sound/soc/bcm/bcm2835-i2s.c
> +++ b/sound/soc/bcm/bcm2835-i2s.c
> @@ -862,6 +862,8 @@ static const struct of_device_id bcm2835_i2s_of_match[] = 
> {
>   {},
>  };
>  
> +MODULE_DEVICE_TABLE(of, bcm2835_i2s_of_match);
> +
>  static struct platform_driver bcm2835_i2s_driver = {
>   .probe  = bcm2835_i2s_probe,
>   .driver = {
--
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: commit 3c2e7f7de3 (KVM use NPT page attributes) causes boot failures

2015-09-02 Thread Xiao Guangrong



On 09/02/2015 11:50 AM, Markus Trippelsdorf wrote:

On 2015.09.02 at 06:31 +0800, Xiao Guangrong wrote:



On 09/01/2015 09:56 PM, Markus Trippelsdorf wrote:

On 2015.09.01 at 21:00 +0800, Xiao Guangrong wrote:


Did it trigger the BUG()/BUG_ON() in mtrr2protval()/fallback_mtrr_type()?
If yes, could you please print the actual value out?


It is the BUG() in fallback_mtrr_type(). I changed it to a printk and
it prints 1 for the value of mtrr.

   MTRR_TYPE_WRCOMB 1



Then I suspect pat is not enabled in your box, could you please check
CONFIG_X86_PAT is selected in your .config file, pat is shown in
/proc/cpuid, "nopat" kernel parameter is used, and dmesg | grep PAT.


No. PAT is of course enabled and booting is successful sometimes even
with the BUG() in allback_mtrr_type(). I suspect a setup (timing) issue.


Thanks for your confirmation.



markus@x4 linux % cat .config | grep  X86_PAT
CONFIG_X86_PAT=y
markus@x4 linux % dmesg | grep PAT
[0.00] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT


Strange, BP processor has already set WC to PAT1, however KVM does not read it 
out
from PAT MSR on its local CPU.

Hmm... PAT default values do not include WC, it seems initing PAT on SP has not
finished after module_init()?

Could please apply this diff and test it again?

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 189e464..d9d3a30 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -884,6 +884,7 @@ static u8 fallback_mtrr_type(int mtrr)
case MTRR_TYPE_WRPROT:
return MTRR_TYPE_UC_MINUS;
default:
+   printk("BUG in %s, mtrr = %d.\n", __FUNCTION__, mtrr);
BUG();
}
 }
@@ -907,6 +908,8 @@ static void build_mtrr2protval(void)
 * guest.
 */
rdmsrl(MSR_IA32_CR_PAT, pat);
+   printk("KVM PAT: 0x%llx.\n", pat);
+
for (i = 0; i < 8; i++) {
u8 mtrr = pat >> (8 * i);

@@ -914,10 +917,17 @@ static void build_mtrr2protval(void)
mtrr2protval[mtrr] = __cm_idx2pte(i);
}

+   for (i = 0; i < 8; i++)
+   printk("mtrr2protval[%d]:%x.\n", i, mtrr2protval[i]);
+
+
for (i = 0; i < 8; i++) {
if (mtrr2protval[i] == MTRR2PROTVAL_INVALID) {
u8 fallback = fallback_mtrr_type(i);
mtrr2protval[i] = mtrr2protval[fallback];
+   if (mtrr2protval[i] == MTRR2PROTVAL_INVALID)
+   printk("BUG in %s, mtrr2protval[%d] = %x.\n", __FUNCTION__, i, 
mtrr2protval[i]);

+
BUG_ON(mtrr2protval[i] == MTRR2PROTVAL_INVALID);
}
}
--
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] virtio-gpu: fix compilation warnings

2015-09-02 Thread Mike Rapoport
Update snprintf format in virtgpu_fence.c and virtgpu_debugfs.c to fix the
following compilation warnings:

C [M]  drivers/gpu/drm/virtio/virtgpu_fence.o
drivers/gpu/drm/virtio/virtgpu_fence.c: In function ‘virtio_timeline_value_str’ 
:
drivers/gpu/drm/virtio/virtgpu_fence.c:64:2: warning: format ‘%lu’ expects 
argument of type ‘long unsigned int’, but argument 4 has type ‘long long int’ 
[-Wformat=]
  snprintf(str, size, "%lu", atomic64_read(&fence->drv->last_seq));
  ^
  CC [M]  drivers/gpu/drm/virtio/virtgpu_debugfs.o
drivers/gpu/drm/virtio/virtgpu_debugfs.c: In function 
‘virtio_gpu_debugfs_irq_info’:
drivers/gpu/drm/virtio/virtgpu_debugfs.c:39:6: warning: format ‘%ld’ expects 
argument of type ‘long int’, but argument 3 has type ‘long long int’ [-Wformat=]
  vgdev->fence_drv.sync_seq);
  ^

Signed-off-by: Mike Rapoport 
---
 drivers/gpu/drm/virtio/virtgpu_debugfs.c | 2 +-
 drivers/gpu/drm/virtio/virtgpu_fence.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_debugfs.c 
b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
index db8b491..d87b27c 100644
--- a/drivers/gpu/drm/virtio/virtgpu_debugfs.c
+++ b/drivers/gpu/drm/virtio/virtgpu_debugfs.c
@@ -34,7 +34,7 @@ virtio_gpu_debugfs_irq_info(struct seq_file *m, void *data)
struct drm_info_node *node = (struct drm_info_node *) m->private;
struct virtio_gpu_device *vgdev = node->minor->dev->dev_private;
 
-   seq_printf(m, "fence %ld %lld\n",
+   seq_printf(m, "fence %lld %lld\n",
   atomic64_read(&vgdev->fence_drv.last_seq),
   vgdev->fence_drv.sync_seq);
return 0;
diff --git a/drivers/gpu/drm/virtio/virtgpu_fence.c 
b/drivers/gpu/drm/virtio/virtgpu_fence.c
index 1da6326..98dd385 100644
--- a/drivers/gpu/drm/virtio/virtgpu_fence.c
+++ b/drivers/gpu/drm/virtio/virtgpu_fence.c
@@ -61,7 +61,7 @@ static void virtio_timeline_value_str(struct fence *f, char 
*str, int size)
 {
struct virtio_gpu_fence *fence = to_virtio_fence(f);
 
-   snprintf(str, size, "%lu", atomic64_read(&fence->drv->last_seq));
+   snprintf(str, size, "%llu", atomic64_read(&fence->drv->last_seq));
 }
 
 static const struct fence_ops virtio_fence_ops = {
-- 
1.8.3.1

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


Re: [PATCH 2/6] sched/fair: Convert arch_scale_cpu_capacity() from weak function to #define

2015-09-02 Thread Vincent Guittot
Hi Morten,

On 14 August 2015 at 18:23, Morten Rasmussen  wrote:
> Bring arch_scale_cpu_capacity() in line with the recent change of its
> arch_scale_freq_capacity() sibling in commit dfbca41f3479 ("sched:
> Optimize freq invariant accounting") from weak function to #define to
> allow inlining of the function.
>
> While at it, remove the ARCH_CAPACITY sched_feature as well. With the
> change to #define there isn't a straightforward way to allow runtime
> switch between an arch implementation and the default implementation of
> arch_scale_cpu_capacity() using sched_feature. The default was to use
> the arch-specific implementation, but only the arm architecture provides
> one and that is essentially equivalent to the default implementation.
>
> cc: Ingo Molnar 
> cc: Peter Zijlstra 
>
> Signed-off-by: Morten Rasmussen 
> ---
>  kernel/sched/fair.c | 22 +-
>  kernel/sched/features.h |  5 -
>  kernel/sched/sched.h| 11 +++
>  3 files changed, 12 insertions(+), 26 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 1626410..c72223a 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -6016,19 +6016,6 @@ static inline int get_sd_load_idx(struct sched_domain 
> *sd,
> return load_idx;
>  }
>
> -static unsigned long default_scale_cpu_capacity(struct sched_domain *sd, int 
> cpu)
> -{
> -   if ((sd->flags & SD_SHARE_CPUCAPACITY) && (sd->span_weight > 1))
> -   return sd->smt_gain / sd->span_weight;
> -
> -   return SCHED_CAPACITY_SCALE;
> -}
> -
> -unsigned long __weak arch_scale_cpu_capacity(struct sched_domain *sd, int 
> cpu)
> -{
> -   return default_scale_cpu_capacity(sd, cpu);
> -}
> -
>  static unsigned long scale_rt_capacity(int cpu)
>  {
> struct rq *rq = cpu_rq(cpu);
> @@ -6058,16 +6045,9 @@ static unsigned long scale_rt_capacity(int cpu)
>
>  static void update_cpu_capacity(struct sched_domain *sd, int cpu)
>  {
> -   unsigned long capacity = SCHED_CAPACITY_SCALE;
> +   unsigned long capacity = arch_scale_cpu_capacity(sd, cpu);
> struct sched_group *sdg = sd->groups;
>
> -   if (sched_feat(ARCH_CAPACITY))
> -   capacity *= arch_scale_cpu_capacity(sd, cpu);
> -   else
> -   capacity *= default_scale_cpu_capacity(sd, cpu);
> -
> -   capacity >>= SCHED_CAPACITY_SHIFT;
> -
> cpu_rq(cpu)->cpu_capacity_orig = capacity;
>
> capacity *= scale_rt_capacity(cpu);
> diff --git a/kernel/sched/features.h b/kernel/sched/features.h
> index 83a50e7..6565eac 100644
> --- a/kernel/sched/features.h
> +++ b/kernel/sched/features.h
> @@ -36,11 +36,6 @@ SCHED_FEAT(CACHE_HOT_BUDDY, true)
>   */
>  SCHED_FEAT(WAKEUP_PREEMPTION, true)
>
> -/*
> - * Use arch dependent cpu capacity functions
> - */
> -SCHED_FEAT(ARCH_CAPACITY, true)
> -
>  SCHED_FEAT(HRTICK, false)
>  SCHED_FEAT(DOUBLE_TICK, false)
>  SCHED_FEAT(LB_BIAS, true)
> diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
> index 22ccc55..7e6f250 100644
> --- a/kernel/sched/sched.h
> +++ b/kernel/sched/sched.h
> @@ -1402,6 +1402,17 @@ unsigned long arch_scale_freq_capacity(struct 
> sched_domain *sd, int cpu)
>  }
>  #endif
>
> +#ifndef arch_scale_cpu_capacity
> +static __always_inline
> +unsigned long arch_scale_cpu_capacity(struct sched_domain *sd, int cpu)
> +{
> +   if ((sd->flags & SD_SHARE_CPUCAPACITY) && (sd->span_weight > 1))
> +   return sd->smt_gain / sd->span_weight;
> +
> +   return SCHED_CAPACITY_SCALE;
> +}
> +#endif
> +

So you change the way to declare arch_scale_cpu_capacity but i don't
see the update of the arm arch which declare a
arch_scale_cpu_capacity to reflect this change in your series.

Regards,
Vincent

>  static inline void sched_rt_avg_update(struct rq *rq, u64 rt_delta)
>  {
> rq->rt_avg += rt_delta * arch_scale_freq_capacity(NULL, cpu_of(rq));
> --
> 1.9.1
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/2] Fix memcg/memory.high in case kmem accounting is enabled

2015-09-02 Thread Vladimir Davydov
[
  I'll try to summarize my point in one hunk instead of spreading it all
  over the e-mail, because IMO it's becoming a kind of difficult to
  follow. If you think that there's a question I dodge, please let me
  now and I'll try to address it separately.

  Also, adding Johannes to Cc (I noticed that I accidentally left him
  out), because this discussion seems to be fundamental and may affect
  our further steps dramatically.
]

On Tue, Sep 01, 2015 at 08:38:50PM +0200, Michal Hocko wrote:
> On Tue 01-09-15 19:55:54, Vladimir Davydov wrote:
> > On Tue, Sep 01, 2015 at 05:01:20PM +0200, Michal Hocko wrote:
> > > On Tue 01-09-15 16:40:03, Vladimir Davydov wrote:
> > > > On Tue, Sep 01, 2015 at 02:36:12PM +0200, Michal Hocko wrote:
> [...]
> > > > > How the fallback is implemented and whether trying other node before
> > > > > reclaiming from the preferred one is reasonable I dunno. This is for
> > > > > SLAB to decide. But ignoring GFP_NOWAIT for this path makes the 
> > > > > behavior
> > > > > for memcg enabled setups subtly different. And that is bad.
> > > > 
> > > > Quite the contrary. Trying to charge memcg w/o __GFP_WAIT while
> > > > inspecting if a NUMA node has free pages makes SLAB behaviour subtly
> > > > differently: SLAB will walk over all NUMA nodes for nothing instead of
> > > > invoking memcg reclaim once a free page is found.
> > > 
> > > So you are saying that the SLAB kmem accounting in this particular path
> > > is suboptimal because the fallback mode doesn't retry local node with
> > > the reclaim enabled before falling back to other nodes?
> > 
> > I'm just pointing out some subtle behavior changes in slab you were
> > opposed to.
> 
> I guess we are still not at the same page here. If the slab has a subtle
> behavior (and from what you are saying it seems it has the same behavior
> at the global scope) then we should strive to fix it rather than making
> it more obscure just to not expose GFP_NOWAIT to memcg which is not
> handled properly currently wrt. high limit (more on that below) which
> was the primary motivation for the patch AFAIU.

Slab is a kind of abnormal alloc_pages user. By calling alloc_pages_node
with __GFP_THISNODE and w/o __GFP_WAIT before falling back to
alloc_pages with the caller's context, it does the job normally done by
alloc_pages itself. It's not what is done massively.

Leaving slab charge path as is looks really ugly to me. Look, slab
iterates over all nodes, inspecting if they have free pages and fails
even if they do due to the memcg constraint...

My point is that what slab does is a pretty low level thing, normal
users call alloc_pages or kmalloc with flags corresponding to their
context. Of course, there may be special users trying optimistically
GFP_NOWAIT, but they aren't massive, and that simplifies things for
memcg a lot. I mean if we can rely on the fact that the number of
GFP_NOWAIT allocations that can occur in a row is limited we can use
direct reclaim (like memory.high) and/or task_work reclaim to fix
GFP_NOWAIT failures. Otherwise, we have to mimic the global alloc with
most its heuristics. I don't think that copying those heuristics is the
right thing to do, because in memcg case the same problems may be
resolved much easier, because we don't actually experience real memory
shortage when hitting the limit.

Moreover, we already treat some flags not in the same way as in case of
slab for simplicity. E.g. we let __GFP_NOFAIL allocations go uncharged
instead of retrying infinitely. We ignore __GFP_THISNODE thing and we
just cannot take it into account. We ignore allocation order, because
that makes no sense for memcg.

To sum it up. Basically, there are two ways of handling kmemcg charges:

 1. Make the memcg try_charge mimic alloc_pages behavior.
 2. Make API functions (kmalloc, etc) work in memcg as if they were
called from the root cgroup, while keeping interactions between the
low level subsys (slab) and memcg private.

Way 1 might look appealing at the first glance, but at the same time it
is much more complex, because alloc_pages has grown over the years to
handle a lot of subtle situations that may arise on global memory
pressure, but impossible in memcg. What does way 1 give us then? We
can't insert try_charge directly to alloc_pages and have to spread its
calls all over the code anyway, so why is it better? Easier to use it in
places where users depend on buddy allocator peculiarities? There are
not many such users.

I understand that the idea of way 1 is to provide a well-defined memcg
API independent of the rest of the code, but that's just impossible. You
need special casing anyway. E.g. you need those get/put_kmem_cache
helpers, which exist solely for SLAB/SLUB. You need all this special
stuff for growing per-memcg array in list_lru and kmem_cache, which
exists solely for memcg-vs-list_lru and memcg-vs-slab interactions. We
even handle kmem_cache destruction on memcg offline differently for SLAB
and SLUB for performanc

Re: [PATCH 01/10] irqchip: irq-mips-gic: export gic_send_ipi

2015-09-02 Thread Qais Yousef

On 08/28/2015 03:22 PM, Thomas Gleixner wrote:

On Fri, 28 Aug 2015, Qais Yousef wrote:

Thanks a lot for the detailed explanation. I wasn't looking for a quick and
dirty solution but my view of the problem is much simpler than yours so my
idea of a solution would look quick and dirty. I have a better appreciation of
the problem now and a way to approach it :-)

 From DT point of view are we OK with this form then

 coprocessor {
 interrupt-source = <&intc INT_SPEC COP_HWAFFINITY>;
 interrupt-sink = <&intc INT_SPEC CPU_HWAFFINITY>;
 }

and if the root controller sends normal IPI as it sends normal device
interrupts then interrupt-sink can be a standard interrupts property (like in
my case)

 coprocessor {
 interrupt-source = <&intc INT_SPEC COP_HWAFFINITY>;
 interrupts = ;
 }

Does this look right to you? Is there something else that needs to be covered
still?

I'm not an DT wizard. I leave that to the DT experts.
  


Hi Marc Zyngier, Mark Rutland,

Any comments about the DT binding for the IPIs?

To recap, the proposal which is based on Marc Zyngier's is to use 
interrupt-source to represent an IPI from Linux CPU to a coprocessor and 
interrupt-sink to receive an IPI from coprocessor to Linux CPU. 
Hopefully the description above is self explanatory. Please let me know 
if you need more info. Thomas covered the routing, synthesising, and 
requesting parts in the core code. The remaining (high level) issue is 
how to describe the IPIs in DT.


Thanks,
Qais
--
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/3] Disable sched_numa_balancing on uma systems

2015-09-02 Thread Peter Zijlstra
On Tue, Aug 11, 2015 at 04:30:10PM +0530, Srikar Dronamraju wrote:
> With recent commit 2a1ed24 ("sched/numa: Prefer NUMA hotness over cache
> hotness") sets sched feature NUMA to true. This can enable numa hinting
> faults on a uma system.
> 
> This patchset ensures that numa hinting faults occur only on a numa system
> by setting/resetting sched_numa_balancing.
> 
> This patchset
> - Renames numabalancing_enabled to sched_numa_balancing
> - Makes sched_numa_balancing common to CONFIG_SCHED_DEBUG and
>   !CONFIG_SCHED_DEBUG. Earlier it was only in !CONFIG_SCHED_DEBUG
> - Checks for sched_numa_balancing instead of sched_feat(NUMA)
> - Removes NUMA sched feature
> 
> Srikar Dronamraju (3):
>   sched/numa: Rename numabalancing_enabled to sched_numa_balancing
>   sched/numa: Disable sched_numa_balancing on uma systems
>   sched/numa: Remove NUMA sched feature
> 
>  kernel/sched/core.c | 16 +++-
>  kernel/sched/fair.c |  8 
>  kernel/sched/features.h | 16 
>  kernel/sched/sched.h| 10 ++
>  4 files changed, 9 insertions(+), 41 deletions(-)

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/


stop breaking dosemu (Re: x86/kconfig/32: Rename CONFIG_VM86 and default it to 'n')

2015-09-02 Thread Stas Sergeev

https://lkml.org/lkml/2015/7/21/208

Guys, you gonna be kidding.
Is this a new trend of breaking dosemu, or what?


VM86 is entirely broken if ptrace, syscall auditing, or
NOHZ_FULL is in use.  The code is a big undocumented mess, it's
a real PITA to test, and it looks like a big chunk of vm86_32.c


It is a CPU feature that kernel should support, and always
did without any problems. If it started to have problems because
of your actions, then you can as well fix your code.

> No one should be using it anyway. Use DOSBOX or KVM instead.

Have you done the benchmarks between dosbox and dosemu
before saying that? Please do, thanks. (don't forget to include
dosemu2 in your benchmarks too, as it outperforms both)


Let's accelerate its slow death.



> + Enabling this option adds considerable attack surface to the
> + kernel and slows down system calls and exception handling.

Yes, I realize that threatening people with the "considerable attack 
surface"

is a good way to "accelerate its slow death", but please care to explain
that attack surface, thankyou.
--
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] dax, pmem: add support for msync

2015-09-02 Thread Boaz Harrosh
On 09/02/2015 12:13 PM, Kirill A. Shutemov wrote:
> On Wed, Sep 02, 2015 at 08:49:22AM +1000, Dave Chinner wrote:
>> On Tue, Sep 01, 2015 at 01:08:04PM +0300, Kirill A. Shutemov wrote:
>>> On Tue, Sep 01, 2015 at 09:38:03AM +1000, Dave Chinner wrote:
 On Mon, Aug 31, 2015 at 12:59:44PM -0600, Ross Zwisler wrote:
 Even for DAX, msync has to call vfs_fsync_range() for the filesystem to 
 commit
 the backing store allocations to stable storage, so there's not
 getting around the fact msync is the wrong place to be flushing
 DAX mappings to persistent storage.
>>>
>>> Why?
>>> IIUC, msync() doesn't have any requirements wrt metadata, right?
>>
>> Of course it does. If the backing store allocation has not been
>> committed, then after a crash there will be a hole in file and
>> so it will read as zeroes regardless of what data was written and
>> flushed.
> 
> Any reason why backing store allocation cannot be committed on *_mkwrite?
> 
 I pointed this out almost 6 months ago (i.e. that fsync was broken)
 anf hinted at how to solve it. Fix fsync, and msync gets fixed for
 free:

 https://lists.01.org/pipermail/linux-nvdimm/2015-March/000341.html

 I've also reported to Willy that DAX write page faults don't work
 correctly, either. xfstests generic/080 exposes this: a read
 from a page followed immediately by a write to that page does not
 result in ->page_mkwrite being called on the write and so
 backing store is not allocated for the page, nor are the timestamps
 for the file updated. This will also result in fsync (and msync)
 not working properly.
>>>
>>> Is that because XFS doesn't provide vm_ops->pfn_mkwrite?
>>
>> I didn't know that had been committed. I don't recall seeing a pull
>> request with that in it
> 
> It went though -mm tree.
> 
>> none of the XFS DAX patches conflicted
>> against it and there's been no runtime errors. I'll fix it up.
>>
>> As such, shouldn't there be a check in the VM (in ->mmap callers)
>> that if we have the vma is returned with VM_MIXEDMODE enabled that
>> ->pfn_mkwrite is not NULL?  It's now clear to me that any filesystem
>> that sets VM_MIXEDMODE needs to support both page_mkwrite and
>> pfn_mkwrite, and such a check would have caught this immediately...
> 
> I guess it's "both or none" case. We have VM_MIXEDMAP users who don't care
> about *_mkwrite.
> 
> I'm not yet sure it would be always correct, but something like this will
> catch the XFS case, without false-positive on other stuff in my KVM setup:
> 
> diff --git a/mm/mmap.c b/mm/mmap.c
> index 3f78bceefe5a..f2e29a541e14 100644
> --- a/mm/mmap.c
> +++ b/mm/mmap.c
> @@ -1645,6 +1645,15 @@ unsigned long mmap_region(struct file *file, unsigned 
> long addr,
> vma->vm_ops = &dummy_ops;
> }
>  
> +   /*
> +* Make sure that for VM_MIXEDMAP VMA has both
> +* vm_ops->page_mkwrite and vm_ops->pfn_mkwrite or has none.
> +*/
> +   if ((vma->vm_ops->page_mkwrite || vma->vm_ops->pfn_mkwrite) &&
> +   vma->vm_flags & VM_MIXEDMAP) {
> +   VM_BUG_ON_VMA(!vma->vm_ops->page_mkwrite, vma);
> +   VM_BUG_ON_VMA(!vma->vm_ops->pfn_mkwrite, vma);

BTW: the page_mkwrite is used for reading of holes that put zero-pages at the 
radix tree.
 One can just map a single global zero-page in pfn-mode for that.

Kirill Hi. Please don't make these BUG_ONs its counter productive believe me.
Please make them WARN_ON_ONCE() it is not a crashing bug to work like this.
(Actually it is not a bug at all in some cases, but we can relax that when a 
user
 comes up)

Thanks
Boaz

> +   }
> addr = vma->vm_start;
> vm_flags = vma->vm_flags;
> } else if (vm_flags & VM_SHARED) {
> 

--
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/2] nohz: Affine unpinned timers to housekeepers

2015-09-02 Thread Mike Galbraith
On Tue, 2015-09-01 at 22:47 +0200, Frederic Weisbecker wrote:
> On Tue, Sep 01, 2015 at 07:14:13PM +, Jiang, Yunhong wrote:
> > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> > > index 8b864ec..0902e4d 100644
> > > --- a/kernel/sched/core.c
> > > +++ b/kernel/sched/core.c
> > > @@ -623,18 +623,21 @@ int get_nohz_timer_target(void)
> > >   int i, cpu = smp_processor_id();
> > >   struct sched_domain *sd;
> > > 
> > > - if (!idle_cpu(cpu))
> > > + if (!idle_cpu(cpu) && is_housekeeping_cpu(cpu))
> > >   return cpu;
> > > 
> > >   rcu_read_lock();
> > >   for_each_domain(cpu, sd) {
> > >   for_each_cpu(i, sched_domain_span(sd)) {
> > > - if (!idle_cpu(i)) {
> > > + if (!idle_cpu(i) && is_housekeeping_cpu(cpu)) {
> > 
> > Hi, Frederic, sorry for a naive question. Per my understanding, the 
> > tick_nohz_full_mask is added to cpu_isolated_map in
> > sched_init_smp(), and the cpu_isolated_map is excluded from sched_domain in 
> > init_sched_domains(), so why check here?
> 
> Very good observation! But it's better to keep this check in the domain loop 
> in
> case things change in the future such as removing that cpu_isolated_map 
> inclusion
> or other suprises.

IMHO, nohz_full -> cpu_isolated_map removal really wants to happen.
NO_HZ_FULL_ALL currently means "Woohoo, next stop NR_CPUS=0".

-Mike

--
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 02/14] arm64: Handle section maps for swapper/idmap

2015-09-02 Thread Ard Biesheuvel
On 13 August 2015 at 13:33, Suzuki K. Poulose  wrote:
> From: "Suzuki K. Poulose" 
>
> We use section maps with 4K page size to create the
> swapper/idmaps. So far we have used !64K or 4K checks
> to handle the case where we use the section maps. This
> patch adds a symbol to make it clear those cases.
>

That sentence does not make sense.

> Cc: Ard Biesheuvel 
> Cc: Mark Rutland 
> Cc: Catalin Marinas 
> Cc: Will Deacon 
> Signed-off-by: Suzuki K. Poulose 
> ---
>  arch/arm64/include/asm/kernel-pgtable.h |   31 +-
>  arch/arm64/mm/mmu.c |   70 
> ++-
>  2 files changed, 51 insertions(+), 50 deletions(-)
>
> diff --git a/arch/arm64/include/asm/kernel-pgtable.h 
> b/arch/arm64/include/asm/kernel-pgtable.h
> index 622929d..5876a36 100644
> --- a/arch/arm64/include/asm/kernel-pgtable.h
> +++ b/arch/arm64/include/asm/kernel-pgtable.h
> @@ -19,6 +19,13 @@
>  #ifndef __ASM_KERNEL_PGTABLE_H
>  #define __ASM_KERNEL_PGTABLE_H
>
> +/* With 4K pages, we use section maps. */
> +#ifdef CONFIG_ARM64_4K_PAGES
> +#define ARM64_SWAPPER_USES_SECTION_MAPS 1
> +#else
> +#define ARM64_SWAPPER_USES_SECTION_MAPS 0
> +#endif
> +
>  /*
>   * The idmap and swapper page tables need some space reserved in the kernel
>   * image. Both require pgd, pud (4 levels only) and pmd tables to (section)
> @@ -28,26 +35,28 @@
>   * could be increased on the fly if system RAM is out of reach for the 
> default
>   * VA range, so 3 pages are reserved in all cases.
>   */
> -#ifdef CONFIG_ARM64_64K_PAGES
> -#define SWAPPER_PGTABLE_LEVELS (CONFIG_PGTABLE_LEVELS)
> -#else
> +#if ARM64_SWAPPER_USES_SECTION_MAPS
>  #define SWAPPER_PGTABLE_LEVELS (CONFIG_PGTABLE_LEVELS - 1)
> +#else
> +#define SWAPPER_PGTABLE_LEVELS (CONFIG_PGTABLE_LEVELS)
>  #endif
>
>  #define SWAPPER_DIR_SIZE   (SWAPPER_PGTABLE_LEVELS * PAGE_SIZE)
>  #define IDMAP_DIR_SIZE (3 * PAGE_SIZE)
>
>  /* Initial memory map size */
> -#ifdef CONFIG_ARM64_64K_PAGES
> -#define SWAPPER_BLOCK_SHIFTPAGE_SHIFT
> -#define SWAPPER_BLOCK_SIZE PAGE_SIZE
> -#define SWAPPER_TABLE_SHIFTPMD_SHIFT
> -#else
> +#if ARM64_SWAPPER_USES_SECTION_MAPS
>  #define SWAPPER_BLOCK_SHIFTSECTION_SHIFT
>  #define SWAPPER_BLOCK_SIZE SECTION_SIZE
>  #define SWAPPER_TABLE_SHIFTPUD_SHIFT
> +#else
> +#define SWAPPER_BLOCK_SHIFTPAGE_SHIFT
> +#define SWAPPER_BLOCK_SIZE PAGE_SIZE
> +#define SWAPPER_TABLE_SHIFTPMD_SHIFT
>  #endif
>
> +/* The size of the initial kernel direct mapping */
> +#define SWAPPER_INIT_MAP_SIZE  (_AC(1, UL) << SWAPPER_TABLE_SHIFT)
>
>  /*
>   * Initial memory map attributes.
> @@ -55,10 +64,10 @@
>  #define SWAPPER_PTE_FLAGS  PTE_TYPE_PAGE | PTE_AF | PTE_SHARED
>  #define SWAPPER_PMD_FLAGS  PMD_TYPE_SECT | PMD_SECT_AF | PMD_SECT_S
>
> -#ifdef CONFIG_ARM64_64K_PAGES
> -#define SWAPPER_MM_MMUFLAGSPTE_ATTRINDX(MT_NORMAL) | SWAPPER_PTE_FLAGS
> -#else
> +#if ARM64_SWAPPER_USES_SECTION_MAPS
>  #define SWAPPER_MM_MMUFLAGSPMD_ATTRINDX(MT_NORMAL) | SWAPPER_PMD_FLAGS
> +#else
> +#define SWAPPER_MM_MMUFLAGSPTE_ATTRINDX(MT_NORMAL) | SWAPPER_PTE_FLAGS
>  #endif
>
>
> diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
> index 9211b85..71230488 100644
> --- a/arch/arm64/mm/mmu.c
> +++ b/arch/arm64/mm/mmu.c
> @@ -32,6 +32,7 @@
>
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -353,14 +354,11 @@ static void __init map_mem(void)
>  * memory addressable from the initial direct kernel mapping.
>  *
>  * The initial direct kernel mapping, located at swapper_pg_dir, gives
> -* us PUD_SIZE (4K pages) or PMD_SIZE (64K pages) memory starting from
> -* PHYS_OFFSET (which must be aligned to 2MB as per
> -* Documentation/arm64/booting.txt).
> +* us PUD_SIZE (with SECTION maps, i.e, 4K) or PMD_SIZE (without
> +* SECTION maps, i.e, 64K pages) memory starting from PHYS_OFFSET
> +* (which must be aligned to 2MB as per 
> Documentation/arm64/booting.txt).
>  */
> -   if (IS_ENABLED(CONFIG_ARM64_64K_PAGES))
> -   limit = PHYS_OFFSET + PMD_SIZE;
> -   else
> -   limit = PHYS_OFFSET + PUD_SIZE;
> +   limit = PHYS_OFFSET + SWAPPER_INIT_MAP_SIZE;
> memblock_set_current_limit(limit);
>
> /* map all the memory banks */
> @@ -371,21 +369,24 @@ static void __init map_mem(void)
> if (start >= end)
> break;
>
> -#ifndef CONFIG_ARM64_64K_PAGES
> -   /*
> -* For the first memory bank align the start address and
> -* current memblock limit to prevent create_mapping() from
> -* allocating pte page tables from unmapped memory.
> -* When 64K pages are enabled, the pte page table for the
> -* first PGDIR_SIZE is already present in swapper_pg_dir.
> -*/
> -   if (start < limit)
> -   st

Only 1 cpu scheduled in 4.2.0

2015-09-02 Thread Martin van Es
Hi,

I recently compiled 4.2.0 based on my previous 4.1.6 config (make oldconfig).
On 4.1.6 all cores are equally scheduled.

This new 4.2.0 kernel however only schedules cpu0 on my 4 cpu i7-3537U
(which is actually 2 cores x 2HT, as far as I understand the specs).
CPU1 is scheduled for 0.5% now and then, so it's not completely 0.

I tried (re)enabling NUMA support, since that's adviced for 64bit/i7
cpu's according to the help text, but that didn't change anything.

Did I miss a new option for SMP scheduling in 4.2.0?

Best regards,
Martin
--
If 'but' was any useful, it would be a logic operator
--
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: commit 3c2e7f7de3 (KVM use NPT page attributes) causes boot failures

2015-09-02 Thread Markus Trippelsdorf
On 2015.09.02 at 17:17 +0800, Xiao Guangrong wrote:
> >
> > No. PAT is of course enabled and booting is successful sometimes even
> > with the BUG() in allback_mtrr_type(). I suspect a setup (timing) issue.
> 
> Thanks for your confirmation.
> 
> >
> > markus@x4 linux % cat .config | grep  X86_PAT
> > CONFIG_X86_PAT=y
> > markus@x4 linux % dmesg | grep PAT
> > [0.00] x86/PAT: Configuration [0-7]: WB  WC  UC- UC  WB  WC  UC- WT
> 
> Strange, BP processor has already set WC to PAT1, however KVM does not read 
> it out
> from PAT MSR on its local CPU.
> 
> Hmm... PAT default values do not include WC, it seems initing PAT on SP has 
> not
> finished after module_init()?
> 
> Could please apply this diff and test it again?

(Your patch was malformed.)

[2.138098] kvm: Nested Virtualization enabled
[2.138153] kvm: Nested Paging enabled
[2.138204] KVM PAT: 0x7040600070406.
[2.138255] mtrr2protval[0]:18.
[2.138306] mtrr2protval[1]:ff.
[2.138356] mtrr2protval[2]:0.
[2.138408] mtrr2protval[3]:0.
[2.138459] mtrr2protval[4]:8.
[2.138510] mtrr2protval[5]:ff.
[2.138561] mtrr2protval[6]:0.
[2.138612] mtrr2protval[7]:10.
[2.138662] BUG in fallback_mtrr_type, mtrr = 1.

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


Re: [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage

2015-09-02 Thread Lucas Stach
Am Mittwoch, den 02.09.2015, 14:36 +0530 schrieb Viresh Kumar:
> Tolerance applies on both sides of the target voltage, i.e. both min and
> max sides.

While I'm not really comfortable with the above, it is exactly how OPPv1
and the voltage tolerance property are specified.

Reviewed-by: Lucas Stach 

> But while checking if a voltage is supported by the regulator
> or not, we haven't taken care of tolerance on the lower side. Fix that.
> 
> Cc: Lucas Stach 
> Fixes: 045ee45c4ff2 ("cpufreq: cpufreq-dt: disable unsupported OPPs")
> Signed-off-by: Viresh Kumar 
> ---
>  drivers/cpufreq/cpufreq-dt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
> index b1131cf89757..3b64c203bf99 100644
> --- a/drivers/cpufreq/cpufreq-dt.c
> +++ b/drivers/cpufreq/cpufreq-dt.c
> @@ -303,7 +303,8 @@ static int cpufreq_init(struct cpufreq_policy *policy)
>   rcu_read_unlock();
>  
>   tol_uV = opp_uV * priv->voltage_tolerance / 100;
> - if (regulator_is_supported_voltage(cpu_reg, opp_uV,
> + if (regulator_is_supported_voltage(cpu_reg,
> +opp_uV - tol_uV,
>  opp_uV + tol_uV)) {
>   if (opp_uV < min_uV)
>   min_uV = opp_uV;

-- 
Pengutronix e.K. | Lucas Stach |
Industrial Linux Solutions   | http://www.pengutronix.de/  |

--
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] dax, pmem: add support for msync

2015-09-02 Thread Boaz Harrosh
On 09/02/2015 12:37 PM, Boaz Harrosh wrote:
>>  
>> +   /*
>> +* Make sure that for VM_MIXEDMAP VMA has both
>> +* vm_ops->page_mkwrite and vm_ops->pfn_mkwrite or has none.
>> +*/
>> +   if ((vma->vm_ops->page_mkwrite || vma->vm_ops->pfn_mkwrite) 
>> &&
>> +   vma->vm_flags & VM_MIXEDMAP) {
>> +   VM_BUG_ON_VMA(!vma->vm_ops->page_mkwrite, vma);
>> +   VM_BUG_ON_VMA(!vma->vm_ops->pfn_mkwrite, vma);
> 
> BTW: the page_mkwrite is used for reading of holes that put zero-pages at the 
> radix tree.
>  One can just map a single global zero-page in pfn-mode for that.
> 
> Kirill Hi. Please don't make these BUG_ONs its counter productive believe me.
> Please make them WARN_ON_ONCE() it is not a crashing bug to work like this.
> (Actually it is not a bug at all in some cases, but we can relax that when a 
> user
>  comes up)
> 
> Thanks
> Boaz
> 

Second thought I do not like this patch. This is why we have xftests for, the 
fact of it
is that test 080 catches this. For me this is enough.

An FS developer should test his code, and worst case we help him on ML, like we 
did
in this case.

Thanks
Boaz

>> +   }
>> addr = vma->vm_start;
>> vm_flags = vma->vm_flags;
>> } else if (vm_flags & VM_SHARED) {
>>
> 

--
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 02/14] arm64: Handle section maps for swapper/idmap

2015-09-02 Thread Suzuki K. Poulose

On 02/09/15 10:38, Ard Biesheuvel wrote:

On 13 August 2015 at 13:33, Suzuki K. Poulose  wrote:

From: "Suzuki K. Poulose" 

We use section maps with 4K page size to create the
swapper/idmaps. So far we have used !64K or 4K checks
to handle the case where we use the section maps. This
patch adds a symbol to make it clear those cases.



That sentence does not make sense.


I agree. How about :

"This patch adds a new symbol, 'ARM64_SWAPPER_USES_SECTION_MAPS', to
handle cases where we use section maps, instead of using the page size
symbols."

Suzuki


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


Re: [PATCH 3/3] cpufreq: dt: Tolerance applies on both sides of target voltage

2015-09-02 Thread Viresh Kumar
On 02-09-15, 11:39, Lucas Stach wrote:
> Am Mittwoch, den 02.09.2015, 14:36 +0530 schrieb Viresh Kumar:
> > Tolerance applies on both sides of the target voltage, i.e. both min and
> > max sides.
> 
> While I'm not really comfortable with the above, it is exactly how OPPv1
> and the voltage tolerance property are specified.
> 
> Reviewed-by: Lucas Stach 

Thanks.

And this is exactly how the regulator API work:

static inline int regulator_set_voltage_tol(struct regulator *regulator,
int new_uV, int tol_uV)
{
if (regulator_set_voltage(regulator, new_uV, new_uV + tol_uV) == 0)
return 0;
else
return regulator_set_voltage(regulator,
 new_uV - tol_uV, new_uV + tol_uV);
}



But yeah, OPP-v2 is going to take care of this with target/min/max
values..

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


  1   2   3   4   5   6   7   8   >