Re: [PATCH 3/3] x86/irq: update first_system_vector only when X86_LOCAL_PIC is on

2016-03-12 Thread Thomas Gleixner
On Sun, 13 Mar 2016, Jianyu Zhan wrote:
> On Sun, Mar 13, 2016 at 2:35 PM, Thomas Gleixner  wrote:
> >> On Sun, Mar 13, 2016 at 4:08 AM, Thomas Gleixner  
> >> wrote:
> >> > This is pointless, because it's only called when local apic is enabled 
> >> > as all
> >> > call sites of alloc_intr_gate() depend on CONFIG_X86_LOCAL_APIC 
> >>
> >> Not exactly,  currently at least  smp_intr_init()  DOES NOT depend on
> >> CONFIG_X86_LOCAL_APIC:
> >>
> >> static void __init smp_intr_init(void)
> >> {
> >> #ifdef CONFIG_SMP
> >
> > It does, because CONFIG_SMP enables CONFIG_X86_LOCAL_APIC
> >
> 
> It is.  Once CONFIG_SMP is on, CONFIG_X86_LOCAL_APIC will be turned on.
> 
> So the situation should be described as:   first_system_vector will be updated
> on system vector init,  on SMP case(which indirectly implies
> CONFIG_X86_LOCAL_APIC)
> and on explicit CONFIG_X86_LOCAL_APIC(X86_UP_APIC).
> 
> So initial code:
> 
> #ifndef CONFIG_X86_LOCAL_APIC
> #define first_system_vector NR_VECTORS
> #endif
> 
> is actually not needed,  becaused it won't ever change on !
> CONFIG_X86_LOCAL_APIC
> case.

It will never ever be updated in that case, simply because nothing uses it.
 
> > Do you actually understand how all that works together?
> >
> 
> So the dependency should be reversed, and it should be like this:
> 
> Currently we have CONFIG_X86_LOCAL_APIC detangle from  CONFIG_SMP
> (we can enable CONFIG_X86_LOCAL_APIC on 32-bit uniprocessor).

And what's the benefit of this?
 
> Among these stands out IRQ_WORK,   which neither depends on SMP nor
> CONFIG_X86_LOCAL_APIC.
> 
> So the new init funciton is look like(from [2/3]):
> 
> static void __init system_intr_init(void)
> {
>smp_intr_init();
> 
> #ifdef CONFIG_IRQ_WORK
>alloc_intr_gate(IRQ_WORK_VECTOR, irq_work_interrupt);
> #endif

And that is completely wrong. IRQ_WORK can work independent of LOCAL_APIC, but
if LOCAL_APIC is disabled it does not use the interrupt, simply because there
is no way to trigger it. That setup is inside #ifdef CONFIG_X86_LOCAL_APIC for
exactly that reason.

Just because IRQ_WORK has no config dependency on LOCAL APIC that does not
mean it uses the interrupt gate unconditionally.

The code is correct as is and there is no reason to shuffle it in circles for
no value.

Thanks,

tglx


Re: [PATCH 3/3] x86/irq: update first_system_vector only when X86_LOCAL_PIC is on

2016-03-12 Thread Thomas Gleixner
On Sun, 13 Mar 2016, Jianyu Zhan wrote:
> On Sun, Mar 13, 2016 at 2:35 PM, Thomas Gleixner  wrote:
> >> On Sun, Mar 13, 2016 at 4:08 AM, Thomas Gleixner  
> >> wrote:
> >> > This is pointless, because it's only called when local apic is enabled 
> >> > as all
> >> > call sites of alloc_intr_gate() depend on CONFIG_X86_LOCAL_APIC 
> >>
> >> Not exactly,  currently at least  smp_intr_init()  DOES NOT depend on
> >> CONFIG_X86_LOCAL_APIC:
> >>
> >> static void __init smp_intr_init(void)
> >> {
> >> #ifdef CONFIG_SMP
> >
> > It does, because CONFIG_SMP enables CONFIG_X86_LOCAL_APIC
> >
> 
> It is.  Once CONFIG_SMP is on, CONFIG_X86_LOCAL_APIC will be turned on.
> 
> So the situation should be described as:   first_system_vector will be updated
> on system vector init,  on SMP case(which indirectly implies
> CONFIG_X86_LOCAL_APIC)
> and on explicit CONFIG_X86_LOCAL_APIC(X86_UP_APIC).
> 
> So initial code:
> 
> #ifndef CONFIG_X86_LOCAL_APIC
> #define first_system_vector NR_VECTORS
> #endif
> 
> is actually not needed,  becaused it won't ever change on !
> CONFIG_X86_LOCAL_APIC
> case.

It will never ever be updated in that case, simply because nothing uses it.
 
> > Do you actually understand how all that works together?
> >
> 
> So the dependency should be reversed, and it should be like this:
> 
> Currently we have CONFIG_X86_LOCAL_APIC detangle from  CONFIG_SMP
> (we can enable CONFIG_X86_LOCAL_APIC on 32-bit uniprocessor).

And what's the benefit of this?
 
> Among these stands out IRQ_WORK,   which neither depends on SMP nor
> CONFIG_X86_LOCAL_APIC.
> 
> So the new init funciton is look like(from [2/3]):
> 
> static void __init system_intr_init(void)
> {
>smp_intr_init();
> 
> #ifdef CONFIG_IRQ_WORK
>alloc_intr_gate(IRQ_WORK_VECTOR, irq_work_interrupt);
> #endif

And that is completely wrong. IRQ_WORK can work independent of LOCAL_APIC, but
if LOCAL_APIC is disabled it does not use the interrupt, simply because there
is no way to trigger it. That setup is inside #ifdef CONFIG_X86_LOCAL_APIC for
exactly that reason.

Just because IRQ_WORK has no config dependency on LOCAL APIC that does not
mean it uses the interrupt gate unconditionally.

The code is correct as is and there is no reason to shuffle it in circles for
no value.

Thanks,

tglx


Re: [PATCH 3/3] x86/irq: update first_system_vector only when X86_LOCAL_PIC is on

2016-03-12 Thread Jianyu Zhan
On Sun, Mar 13, 2016 at 3:25 PM, Jianyu Zhan  wrote:
> My purpose of posting this patch set is trying to make the system vector 
> layout
> reveal this fact.
>
> we have SMP system vector defined first( these may rely on or not rely
> on CONFIG_X86_LOCAL_APIC),
>
> then comes the CONFIG_X86_LOCAL_APIC dependent vector definition.
>
> then comes the rest vector definition that not only depends on
> CONFIG_X86_LOCAL_APIC, but
> also others(like MCE, virtualization).
>
> Among these stands out IRQ_WORK,   which neither depends on SMP nor
> CONFIG_X86_LOCAL_APIC.
>

My wording is incorrect,  should be like this:

The new system vector layout:

First, two special vector:  spurious and error.

Second, we have SMP system vector defined first( these implicitly
reply on CONFIG_X86_LOCAL_APIC),

Third, comes the CONFIG_X86_LOCAL_APIC dependent vector definition,
but not necessary
SMP dependent.( Among these stands out IRQ_WORK,   which neither
depends on SMP nor
CONFIG_X86_LOCAL_APIC.)

Finally,  comes the rest vector definition that not only depends on
CONFIG_X86_LOCAL_APIC, but
also others(like MCE, virtualization).





Regards,
Jianyu Zhan


Re: [PATCH 3/3] x86/irq: update first_system_vector only when X86_LOCAL_PIC is on

2016-03-12 Thread Jianyu Zhan
On Sun, Mar 13, 2016 at 3:25 PM, Jianyu Zhan  wrote:
> My purpose of posting this patch set is trying to make the system vector 
> layout
> reveal this fact.
>
> we have SMP system vector defined first( these may rely on or not rely
> on CONFIG_X86_LOCAL_APIC),
>
> then comes the CONFIG_X86_LOCAL_APIC dependent vector definition.
>
> then comes the rest vector definition that not only depends on
> CONFIG_X86_LOCAL_APIC, but
> also others(like MCE, virtualization).
>
> Among these stands out IRQ_WORK,   which neither depends on SMP nor
> CONFIG_X86_LOCAL_APIC.
>

My wording is incorrect,  should be like this:

The new system vector layout:

First, two special vector:  spurious and error.

Second, we have SMP system vector defined first( these implicitly
reply on CONFIG_X86_LOCAL_APIC),

Third, comes the CONFIG_X86_LOCAL_APIC dependent vector definition,
but not necessary
SMP dependent.( Among these stands out IRQ_WORK,   which neither
depends on SMP nor
CONFIG_X86_LOCAL_APIC.)

Finally,  comes the rest vector definition that not only depends on
CONFIG_X86_LOCAL_APIC, but
also others(like MCE, virtualization).





Regards,
Jianyu Zhan


Re: [PATCH 1/2] tools/power turbostat: bugfix: TDP MSRs print bits fixing

2016-03-12 Thread Len Brown
Applied -- thanks!

-Len


On Sun, Dec 13, 2015 at 8:09 AM, Chen Yu  wrote:
> MSR_CONFIG_TDP_NOMINAL:
> should print all 8 bits of base_ratio (bit 0:7) 0xFF
>
> MSR_CONFIG_TDP_LEVEL_1:
> should print all 15 bits of PKG_MIN_PWR_LVL1 (bit 48:62) 0x7FFF
> should print all 15 bits of PKG_MAX_PWR_LVL1 (bit 32:46) 0x7FFF
> should print all 8 bits of LVL1_RATIO (bit 16:23) 0xFF
> should print all 15 bits of PKG_TDP_LVL1 (bit 0:14) 0x7FFF
>
> And the same modification to MSR_CONFIG_TDP_LEVEL_2.
>
> MSR_TURBO_ACTIVATION_RATIO:
> should print all 8 bits of MAX_NON_TURBO_RATIO (bit 0:7) 0xFF
>
> Signed-off-by: Chen Yu 
> ---
>  tools/power/x86/turbostat/turbostat.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/tools/power/x86/turbostat/turbostat.c 
> b/tools/power/x86/turbostat/turbostat.c
> index 0dac7e0..9854929 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -1409,25 +1409,25 @@ dump_config_tdp(void)
>
> get_msr(base_cpu, MSR_CONFIG_TDP_NOMINAL, );
> fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, 
> msr);
> -   fprintf(stderr, " (base_ratio=%d)\n", (unsigned int)msr & 0xEF);
> +   fprintf(stderr, " (base_ratio=%d)\n", (unsigned int)msr & 0xFF);
>
> get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_1, );
> fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", 
> base_cpu, msr);
> if (msr) {
> -   fprintf(stderr, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 
> 48) & 0xEFFF);
> -   fprintf(stderr, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 
> 32) & 0xEFFF);
> -   fprintf(stderr, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 
> 0xEF);
> -   fprintf(stderr, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 
> 0xEFFF);
> +   fprintf(stderr, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 
> 48) & 0x7FFF);
> +   fprintf(stderr, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 
> 32) & 0x7FFF);
> +   fprintf(stderr, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 
> 0xFF);
> +   fprintf(stderr, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 
> 0x7FFF);
> }
> fprintf(stderr, ")\n");
>
> get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_2, );
> fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", 
> base_cpu, msr);
> if (msr) {
> -   fprintf(stderr, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 
> 48) & 0xEFFF);
> -   fprintf(stderr, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 
> 32) & 0xEFFF);
> -   fprintf(stderr, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 
> 0xEF);
> -   fprintf(stderr, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 
> 0xEFFF);
> +   fprintf(stderr, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 
> 48) & 0x7FFF);
> +   fprintf(stderr, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 
> 32) & 0x7FFF);
> +   fprintf(stderr, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 
> 0xFF);
> +   fprintf(stderr, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 
> 0x7FFF);
> }
> fprintf(stderr, ")\n");
>
> @@ -1440,7 +1440,7 @@ dump_config_tdp(void)
>
> get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, );
> fprintf(stderr, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", 
> base_cpu, msr);
> -   fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0x7F);
> +   fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xFF);
> fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1);
> fprintf(stderr, ")\n");
>  }
> --
> 1.8.4.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Len Brown, Intel Open Source Technology Center


Re: [PATCH 1/2] tools/power turbostat: bugfix: TDP MSRs print bits fixing

2016-03-12 Thread Len Brown
Applied -- thanks!

-Len


On Sun, Dec 13, 2015 at 8:09 AM, Chen Yu  wrote:
> MSR_CONFIG_TDP_NOMINAL:
> should print all 8 bits of base_ratio (bit 0:7) 0xFF
>
> MSR_CONFIG_TDP_LEVEL_1:
> should print all 15 bits of PKG_MIN_PWR_LVL1 (bit 48:62) 0x7FFF
> should print all 15 bits of PKG_MAX_PWR_LVL1 (bit 32:46) 0x7FFF
> should print all 8 bits of LVL1_RATIO (bit 16:23) 0xFF
> should print all 15 bits of PKG_TDP_LVL1 (bit 0:14) 0x7FFF
>
> And the same modification to MSR_CONFIG_TDP_LEVEL_2.
>
> MSR_TURBO_ACTIVATION_RATIO:
> should print all 8 bits of MAX_NON_TURBO_RATIO (bit 0:7) 0xFF
>
> Signed-off-by: Chen Yu 
> ---
>  tools/power/x86/turbostat/turbostat.c | 20 ++--
>  1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/tools/power/x86/turbostat/turbostat.c 
> b/tools/power/x86/turbostat/turbostat.c
> index 0dac7e0..9854929 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -1409,25 +1409,25 @@ dump_config_tdp(void)
>
> get_msr(base_cpu, MSR_CONFIG_TDP_NOMINAL, );
> fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_NOMINAL: 0x%08llx", base_cpu, 
> msr);
> -   fprintf(stderr, " (base_ratio=%d)\n", (unsigned int)msr & 0xEF);
> +   fprintf(stderr, " (base_ratio=%d)\n", (unsigned int)msr & 0xFF);
>
> get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_1, );
> fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_1: 0x%08llx (", 
> base_cpu, msr);
> if (msr) {
> -   fprintf(stderr, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 
> 48) & 0xEFFF);
> -   fprintf(stderr, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 
> 32) & 0xEFFF);
> -   fprintf(stderr, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 
> 0xEF);
> -   fprintf(stderr, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 
> 0xEFFF);
> +   fprintf(stderr, "PKG_MIN_PWR_LVL1=%d ", (unsigned int)(msr >> 
> 48) & 0x7FFF);
> +   fprintf(stderr, "PKG_MAX_PWR_LVL1=%d ", (unsigned int)(msr >> 
> 32) & 0x7FFF);
> +   fprintf(stderr, "LVL1_RATIO=%d ", (unsigned int)(msr >> 16) & 
> 0xFF);
> +   fprintf(stderr, "PKG_TDP_LVL1=%d", (unsigned int)(msr) & 
> 0x7FFF);
> }
> fprintf(stderr, ")\n");
>
> get_msr(base_cpu, MSR_CONFIG_TDP_LEVEL_2, );
> fprintf(stderr, "cpu%d: MSR_CONFIG_TDP_LEVEL_2: 0x%08llx (", 
> base_cpu, msr);
> if (msr) {
> -   fprintf(stderr, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 
> 48) & 0xEFFF);
> -   fprintf(stderr, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 
> 32) & 0xEFFF);
> -   fprintf(stderr, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 
> 0xEF);
> -   fprintf(stderr, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 
> 0xEFFF);
> +   fprintf(stderr, "PKG_MIN_PWR_LVL2=%d ", (unsigned int)(msr >> 
> 48) & 0x7FFF);
> +   fprintf(stderr, "PKG_MAX_PWR_LVL2=%d ", (unsigned int)(msr >> 
> 32) & 0x7FFF);
> +   fprintf(stderr, "LVL2_RATIO=%d ", (unsigned int)(msr >> 16) & 
> 0xFF);
> +   fprintf(stderr, "PKG_TDP_LVL2=%d", (unsigned int)(msr) & 
> 0x7FFF);
> }
> fprintf(stderr, ")\n");
>
> @@ -1440,7 +1440,7 @@ dump_config_tdp(void)
>
> get_msr(base_cpu, MSR_TURBO_ACTIVATION_RATIO, );
> fprintf(stderr, "cpu%d: MSR_TURBO_ACTIVATION_RATIO: 0x%08llx (", 
> base_cpu, msr);
> -   fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0x7F);
> +   fprintf(stderr, "MAX_NON_TURBO_RATIO=%d", (unsigned int)(msr) & 0xFF);
> fprintf(stderr, " lock=%d", (unsigned int)(msr >> 31) & 1);
> fprintf(stderr, ")\n");
>  }
> --
> 1.8.4.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Len Brown, Intel Open Source Technology Center


Re: [RFC PATCH net-next 3/3] net: dsa: refine netdev event notifier

2016-03-12 Thread Ido Schimmel
Hi Vivien,

Sun, Mar 13, 2016 at 08:42:26AM IST, vivien.dide...@savoirfairelinux.com wrote:
>Rework the netdev event handler, similar to what the Mellanox Spectrum
>driver does, to eventually welcome NETDEV_PRECHANGEUPPER actions and use
>netdev helpers, such as netif_is_bridge_master.
>
>Signed-off-by: Vivien Didelot 
>---
> net/dsa/slave.c | 55 +++
> 1 file changed, 31 insertions(+), 24 deletions(-)
>
>diff --git a/net/dsa/slave.c b/net/dsa/slave.c
>index 54976c4..27f7886 100644
>--- a/net/dsa/slave.c
>+++ b/net/dsa/slave.c
>@@ -451,7 +451,7 @@ static int dsa_slave_bridge_port_join(struct net_device 
>*dev,
>   if (ds->drv->port_bridge_join)
>   ret = ds->drv->port_bridge_join(ds, p->port, br);
> 
>-  return ret;
>+  return ret == -EOPNOTSUPP ? 0 : ret;
> }
> 
> static void dsa_slave_bridge_port_leave(struct net_device *dev)
>@@ -1139,40 +1139,47 @@ static bool dsa_slave_dev_check(struct net_device *dev)
>   return dev->netdev_ops == _slave_netdev_ops;
> }
> 
>-static int dsa_slave_master_changed(struct net_device *dev)
>+static int dsa_slave_port_upper_event(struct net_device *dev,
>+unsigned long event, void *ptr)
> {
>-  struct net_device *master = netdev_master_upper_dev_get(dev);
>-  struct dsa_slave_priv *p = netdev_priv(dev);
>+  struct netdev_notifier_changeupper_info *info = ptr;
>+  struct net_device *upper = info->upper_dev;
>   int err = 0;
> 
>-  if (master && master->rtnl_link_ops &&
>-  !strcmp(master->rtnl_link_ops->kind, "bridge"))
>-  err = dsa_slave_bridge_port_join(dev, master);
>-  else if (dsa_port_is_bridged(p))
>-  dsa_slave_bridge_port_leave(dev);
>+  switch (event) {
>+  case NETDEV_CHANGEUPPER:
>+  if (netif_is_bridge_master(upper)) {
>+  if (info->linking)
>+  err = dsa_slave_bridge_port_join(dev, upper);
>+  else
>+  dsa_slave_bridge_port_leave(dev);
>+  }
> 
>-  return err;
>+  break;
>+  }
>+
>+  return notifier_from_errno(err);
> }
> 
>-int dsa_slave_netdevice_event(struct notifier_block *unused,
>-unsigned long event, void *ptr)
>+static int dsa_slave_port_event(struct net_device *dev, unsigned long event,
>+  void *ptr)
> {
>-  struct net_device *dev;
>-  int err = 0;
>-
>   switch (event) {
>+  case NETDEV_PRECHANGEUPPER:

Why do you need this here? It seems you are always ignoring it in
dsa_slave_port_upper_event()? Probably better to introduce it when you
actually need it.

Other than that, it looks good to me.

>   case NETDEV_CHANGEUPPER:
>-  dev = netdev_notifier_info_to_dev(ptr);
>-  if (!dsa_slave_dev_check(dev))
>-  goto out;
>+  return dsa_slave_port_upper_event(dev, event, ptr);
>+  }
> 
>-  err = dsa_slave_master_changed(dev);
>-  if (err && err != -EOPNOTSUPP)
>-  netdev_warn(dev, "failed to reflect master change\n");
>+  return NOTIFY_DONE;
>+}
> 
>-  break;
>-  }
>+int dsa_slave_netdevice_event(struct notifier_block *unused,
>+unsigned long event, void *ptr)
>+{
>+  struct net_device *dev = netdev_notifier_info_to_dev(ptr);
>+
>+  if (dsa_slave_dev_check(dev))
>+  return dsa_slave_port_event(dev, event, ptr);
> 
>-out:
>   return NOTIFY_DONE;
> }
>-- 
>2.7.2
>


Re: [RFC PATCH net-next 3/3] net: dsa: refine netdev event notifier

2016-03-12 Thread Ido Schimmel
Hi Vivien,

Sun, Mar 13, 2016 at 08:42:26AM IST, vivien.dide...@savoirfairelinux.com wrote:
>Rework the netdev event handler, similar to what the Mellanox Spectrum
>driver does, to eventually welcome NETDEV_PRECHANGEUPPER actions and use
>netdev helpers, such as netif_is_bridge_master.
>
>Signed-off-by: Vivien Didelot 
>---
> net/dsa/slave.c | 55 +++
> 1 file changed, 31 insertions(+), 24 deletions(-)
>
>diff --git a/net/dsa/slave.c b/net/dsa/slave.c
>index 54976c4..27f7886 100644
>--- a/net/dsa/slave.c
>+++ b/net/dsa/slave.c
>@@ -451,7 +451,7 @@ static int dsa_slave_bridge_port_join(struct net_device 
>*dev,
>   if (ds->drv->port_bridge_join)
>   ret = ds->drv->port_bridge_join(ds, p->port, br);
> 
>-  return ret;
>+  return ret == -EOPNOTSUPP ? 0 : ret;
> }
> 
> static void dsa_slave_bridge_port_leave(struct net_device *dev)
>@@ -1139,40 +1139,47 @@ static bool dsa_slave_dev_check(struct net_device *dev)
>   return dev->netdev_ops == _slave_netdev_ops;
> }
> 
>-static int dsa_slave_master_changed(struct net_device *dev)
>+static int dsa_slave_port_upper_event(struct net_device *dev,
>+unsigned long event, void *ptr)
> {
>-  struct net_device *master = netdev_master_upper_dev_get(dev);
>-  struct dsa_slave_priv *p = netdev_priv(dev);
>+  struct netdev_notifier_changeupper_info *info = ptr;
>+  struct net_device *upper = info->upper_dev;
>   int err = 0;
> 
>-  if (master && master->rtnl_link_ops &&
>-  !strcmp(master->rtnl_link_ops->kind, "bridge"))
>-  err = dsa_slave_bridge_port_join(dev, master);
>-  else if (dsa_port_is_bridged(p))
>-  dsa_slave_bridge_port_leave(dev);
>+  switch (event) {
>+  case NETDEV_CHANGEUPPER:
>+  if (netif_is_bridge_master(upper)) {
>+  if (info->linking)
>+  err = dsa_slave_bridge_port_join(dev, upper);
>+  else
>+  dsa_slave_bridge_port_leave(dev);
>+  }
> 
>-  return err;
>+  break;
>+  }
>+
>+  return notifier_from_errno(err);
> }
> 
>-int dsa_slave_netdevice_event(struct notifier_block *unused,
>-unsigned long event, void *ptr)
>+static int dsa_slave_port_event(struct net_device *dev, unsigned long event,
>+  void *ptr)
> {
>-  struct net_device *dev;
>-  int err = 0;
>-
>   switch (event) {
>+  case NETDEV_PRECHANGEUPPER:

Why do you need this here? It seems you are always ignoring it in
dsa_slave_port_upper_event()? Probably better to introduce it when you
actually need it.

Other than that, it looks good to me.

>   case NETDEV_CHANGEUPPER:
>-  dev = netdev_notifier_info_to_dev(ptr);
>-  if (!dsa_slave_dev_check(dev))
>-  goto out;
>+  return dsa_slave_port_upper_event(dev, event, ptr);
>+  }
> 
>-  err = dsa_slave_master_changed(dev);
>-  if (err && err != -EOPNOTSUPP)
>-  netdev_warn(dev, "failed to reflect master change\n");
>+  return NOTIFY_DONE;
>+}
> 
>-  break;
>-  }
>+int dsa_slave_netdevice_event(struct notifier_block *unused,
>+unsigned long event, void *ptr)
>+{
>+  struct net_device *dev = netdev_notifier_info_to_dev(ptr);
>+
>+  if (dsa_slave_dev_check(dev))
>+  return dsa_slave_port_event(dev, event, ptr);
> 
>-out:
>   return NOTIFY_DONE;
> }
>-- 
>2.7.2
>


Re: [PATCH 2/2] tools/power turbostat: bugfix: fix several invalid parameters

2016-03-12 Thread Len Brown
Thanks for the patch Yu.

As it turns out, I already had a fix for this in my tree.
I think the compiler complained about these programming errors
when I compiled on a machine different from my standard desktop.

If you know what compiler options cause it to check
for stuff like this by default, I'd welcome a patch to the Makefile to
enable them.

thanks,
-Len


On Sun, Dec 13, 2015 at 8:09 AM, Chen Yu  wrote:
> dump_cstate_pstate_config_info is invoked with no parameters,
> which might cause this function to misjudge the processor family
> and model. Fix this by passing family and model to it.
>
> Besides, fix the compiling warning caused by missing type declaration
> in dump_cstate_pstate_config_info, get_tdp and perf_limit_reasons_probe:
>
> turbostat.c: In function ‘dump_cstate_pstate_config_info’:
> turbostat.c:1973:1: warning: type of ‘family’ defaults to ‘int’ 
> [-Wimplicit-int]
>  dump_cstate_pstate_config_info(family, model)
>  ^
> turbostat.c:1973:1: warning: type of ‘model’ defaults to ‘int’ 
> [-Wimplicit-int]
> turbostat.c: In function ‘get_tdp’:
> turbostat.c:2145:8: warning: type of ‘model’ defaults to ‘int’ 
> [-Wimplicit-int]
>  double get_tdp(model)
> ^
> turbostat.c: In function ‘perf_limit_reasons_probe’:
> turbostat.c:2259:6: warning: type of ‘family’ defaults to ‘int’ 
> [-Wimplicit-int]
>  void perf_limit_reasons_probe(family, model)
>   ^
> turbostat.c:2259:6: warning: type of ‘model’ defaults to ‘int’ 
> [-Wimplicit-int]
>
> Signed-off-by: Chen Yu 
> ---
>  tools/power/x86/turbostat/turbostat.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/power/x86/turbostat/turbostat.c 
> b/tools/power/x86/turbostat/turbostat.c
> index 9854929..47068de 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -1970,7 +1970,7 @@ int has_config_tdp(unsigned int family, unsigned int 
> model)
>  }
>
>  static void
> -dump_cstate_pstate_config_info(family, model)
> +dump_cstate_pstate_config_info(unsigned int family, unsigned int model)
>  {
> if (!do_nhm_platform_info)
> return;
> @@ -2142,7 +2142,7 @@ int print_perf_limit(struct thread_data *t, struct 
> core_data *c, struct pkg_data
>  #defineRAPL_POWER_GRANULARITY  0x7FFF  /* 15 bit power granularity */
>  #defineRAPL_TIME_GRANULARITY   0x3F /* 6 bit time granularity */
>
> -double get_tdp(model)
> +double get_tdp(unsigned int model)
>  {
> unsigned long long msr;
>
> @@ -2256,7 +2256,7 @@ void rapl_probe(unsigned int family, unsigned int model)
> return;
>  }
>
> -void perf_limit_reasons_probe(family, model)
> +void perf_limit_reasons_probe(unsigned int family, unsigned int model)
>  {
> if (!genuine_intel)
> return;
> @@ -2792,7 +2792,7 @@ void process_cpuid()
> perf_limit_reasons_probe(family, model);
>
> if (debug)
> -   dump_cstate_pstate_config_info();
> +   dump_cstate_pstate_config_info(family, model);
>
> if (has_skl_msrs(family, model))
> calculate_tsc_tweak();
> --
> 1.8.4.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Len Brown, Intel Open Source Technology Center


Re: [PATCH 2/2] tools/power turbostat: bugfix: fix several invalid parameters

2016-03-12 Thread Len Brown
Thanks for the patch Yu.

As it turns out, I already had a fix for this in my tree.
I think the compiler complained about these programming errors
when I compiled on a machine different from my standard desktop.

If you know what compiler options cause it to check
for stuff like this by default, I'd welcome a patch to the Makefile to
enable them.

thanks,
-Len


On Sun, Dec 13, 2015 at 8:09 AM, Chen Yu  wrote:
> dump_cstate_pstate_config_info is invoked with no parameters,
> which might cause this function to misjudge the processor family
> and model. Fix this by passing family and model to it.
>
> Besides, fix the compiling warning caused by missing type declaration
> in dump_cstate_pstate_config_info, get_tdp and perf_limit_reasons_probe:
>
> turbostat.c: In function ‘dump_cstate_pstate_config_info’:
> turbostat.c:1973:1: warning: type of ‘family’ defaults to ‘int’ 
> [-Wimplicit-int]
>  dump_cstate_pstate_config_info(family, model)
>  ^
> turbostat.c:1973:1: warning: type of ‘model’ defaults to ‘int’ 
> [-Wimplicit-int]
> turbostat.c: In function ‘get_tdp’:
> turbostat.c:2145:8: warning: type of ‘model’ defaults to ‘int’ 
> [-Wimplicit-int]
>  double get_tdp(model)
> ^
> turbostat.c: In function ‘perf_limit_reasons_probe’:
> turbostat.c:2259:6: warning: type of ‘family’ defaults to ‘int’ 
> [-Wimplicit-int]
>  void perf_limit_reasons_probe(family, model)
>   ^
> turbostat.c:2259:6: warning: type of ‘model’ defaults to ‘int’ 
> [-Wimplicit-int]
>
> Signed-off-by: Chen Yu 
> ---
>  tools/power/x86/turbostat/turbostat.c | 8 
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/power/x86/turbostat/turbostat.c 
> b/tools/power/x86/turbostat/turbostat.c
> index 9854929..47068de 100644
> --- a/tools/power/x86/turbostat/turbostat.c
> +++ b/tools/power/x86/turbostat/turbostat.c
> @@ -1970,7 +1970,7 @@ int has_config_tdp(unsigned int family, unsigned int 
> model)
>  }
>
>  static void
> -dump_cstate_pstate_config_info(family, model)
> +dump_cstate_pstate_config_info(unsigned int family, unsigned int model)
>  {
> if (!do_nhm_platform_info)
> return;
> @@ -2142,7 +2142,7 @@ int print_perf_limit(struct thread_data *t, struct 
> core_data *c, struct pkg_data
>  #defineRAPL_POWER_GRANULARITY  0x7FFF  /* 15 bit power granularity */
>  #defineRAPL_TIME_GRANULARITY   0x3F /* 6 bit time granularity */
>
> -double get_tdp(model)
> +double get_tdp(unsigned int model)
>  {
> unsigned long long msr;
>
> @@ -2256,7 +2256,7 @@ void rapl_probe(unsigned int family, unsigned int model)
> return;
>  }
>
> -void perf_limit_reasons_probe(family, model)
> +void perf_limit_reasons_probe(unsigned int family, unsigned int model)
>  {
> if (!genuine_intel)
> return;
> @@ -2792,7 +2792,7 @@ void process_cpuid()
> perf_limit_reasons_probe(family, model);
>
> if (debug)
> -   dump_cstate_pstate_config_info();
> +   dump_cstate_pstate_config_info(family, model);
>
> if (has_skl_msrs(family, model))
> calculate_tsc_tweak();
> --
> 1.8.4.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pm" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Len Brown, Intel Open Source Technology Center


[PATCH 1/2] aio: use kmem_cache_zalloc

2016-03-12 Thread Geliang Tang
Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.

Signed-off-by: Geliang Tang 
---
 fs/aio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/aio.c b/fs/aio.c
index 56bcdf4..9844ea1 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1053,7 +1053,7 @@ static inline struct aio_kiocb *aio_get_req(struct kioctx 
*ctx)
return NULL;
}
 
-   req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO);
+   req = kmem_cache_zalloc(kiocb_cachep, GFP_KERNEL);
if (unlikely(!req))
goto out_put;
 
-- 
2.5.0




[PATCH 2/2] ceph: use kmem_cache_zalloc

2016-03-12 Thread Geliang Tang
Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.

Signed-off-by: Geliang Tang 
---
 fs/ceph/dir.c  | 2 +-
 fs/ceph/file.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index fd11fb2..ba01851 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -38,7 +38,7 @@ int ceph_init_dentry(struct dentry *dentry)
if (dentry->d_fsdata)
return 0;
 
-   di = kmem_cache_alloc(ceph_dentry_cachep, GFP_KERNEL | __GFP_ZERO);
+   di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL);
if (!di)
return -ENOMEM;  /* oh well */
 
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index eb9028e..bb4950a 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -157,7 +157,7 @@ static int ceph_init_file(struct inode *inode, struct file 
*file, int fmode)
case S_IFDIR:
dout("init_file %p %p 0%o (regular)\n", inode, file,
 inode->i_mode);
-   cf = kmem_cache_alloc(ceph_file_cachep, GFP_KERNEL | 
__GFP_ZERO);
+   cf = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
if (cf == NULL) {
ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
return -ENOMEM;
-- 
2.5.0




[PATCH 1/2] aio: use kmem_cache_zalloc

2016-03-12 Thread Geliang Tang
Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.

Signed-off-by: Geliang Tang 
---
 fs/aio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/aio.c b/fs/aio.c
index 56bcdf4..9844ea1 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1053,7 +1053,7 @@ static inline struct aio_kiocb *aio_get_req(struct kioctx 
*ctx)
return NULL;
}
 
-   req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL|__GFP_ZERO);
+   req = kmem_cache_zalloc(kiocb_cachep, GFP_KERNEL);
if (unlikely(!req))
goto out_put;
 
-- 
2.5.0




[PATCH 2/2] ceph: use kmem_cache_zalloc

2016-03-12 Thread Geliang Tang
Use kmem_cache_zalloc() instead of kmem_cache_alloc() with flag GFP_ZERO.

Signed-off-by: Geliang Tang 
---
 fs/ceph/dir.c  | 2 +-
 fs/ceph/file.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index fd11fb2..ba01851 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -38,7 +38,7 @@ int ceph_init_dentry(struct dentry *dentry)
if (dentry->d_fsdata)
return 0;
 
-   di = kmem_cache_alloc(ceph_dentry_cachep, GFP_KERNEL | __GFP_ZERO);
+   di = kmem_cache_zalloc(ceph_dentry_cachep, GFP_KERNEL);
if (!di)
return -ENOMEM;  /* oh well */
 
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index eb9028e..bb4950a 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -157,7 +157,7 @@ static int ceph_init_file(struct inode *inode, struct file 
*file, int fmode)
case S_IFDIR:
dout("init_file %p %p 0%o (regular)\n", inode, file,
 inode->i_mode);
-   cf = kmem_cache_alloc(ceph_file_cachep, GFP_KERNEL | 
__GFP_ZERO);
+   cf = kmem_cache_zalloc(ceph_file_cachep, GFP_KERNEL);
if (cf == NULL) {
ceph_put_fmode(ceph_inode(inode), fmode); /* clean up */
return -ENOMEM;
-- 
2.5.0




Re: [PATCH 3/3] x86/irq: update first_system_vector only when X86_LOCAL_PIC is on

2016-03-12 Thread Jianyu Zhan
On Sun, Mar 13, 2016 at 2:35 PM, Thomas Gleixner  wrote:
>> On Sun, Mar 13, 2016 at 4:08 AM, Thomas Gleixner  wrote:
>> > This is pointless, because it's only called when local apic is enabled as 
>> > all
>> > call sites of alloc_intr_gate() depend on CONFIG_X86_LOCAL_APIC 
>>
>> Not exactly,  currently at least  smp_intr_init()  DOES NOT depend on
>> CONFIG_X86_LOCAL_APIC:
>>
>> static void __init smp_intr_init(void)
>> {
>> #ifdef CONFIG_SMP
>
> It does, because CONFIG_SMP enables CONFIG_X86_LOCAL_APIC
>

It is.  Once CONFIG_SMP is on, CONFIG_X86_LOCAL_APIC will be turned on.

So the situation should be described as:   first_system_vector will be updated
on system vector init,  on SMP case(which indirectly implies
CONFIG_X86_LOCAL_APIC)
and on explicit CONFIG_X86_LOCAL_APIC(X86_UP_APIC).

So initial code:

#ifndef CONFIG_X86_LOCAL_APIC
#define first_system_vector NR_VECTORS
#endif

is actually not needed,  becaused it won't ever change on !
CONFIG_X86_LOCAL_APIC
case.

I will clarify this in v2.

>> I know this is weird, because modern SMP machines implies Local APIC.
>> But currently we have CONFIG_SMP detangle from CONFIG_X86_LOCAL_APIC,
>> which I think is fine.
>
> Do you actually understand how all that works together?
>

So the dependency should be reversed, and it should be like this:

Currently we have CONFIG_X86_LOCAL_APIC detangle from  CONFIG_SMP
(we can enable CONFIG_X86_LOCAL_APIC on 32-bit uniprocessor).


>> Another place which is weird is CONFIG_IRQ_WORK.  Technically,  it
>> does not depend
>> on SMP,   nor even necessary Local APIC.  Actually, it is just a base
>> configuration selected
>> by others.  But currently we have the
>
> Have you tried to enable it independent from CONFIG_X86_LOCAL_APIC?
>

I did.  I can turn off SMP and  did not use UP_APIC.  But IRQ_WORK is still
able be turn on(by selected by other subsystem).

My purpose of posting this patch set is trying to make the system vector layout
reveal this fact.

we have SMP system vector defined first( these may rely on or not rely
on CONFIG_X86_LOCAL_APIC),

then comes the CONFIG_X86_LOCAL_APIC dependent vector definition.

then comes the rest vector definition that not only depends on
CONFIG_X86_LOCAL_APIC, but
also others(like MCE, virtualization).

Among these stands out IRQ_WORK,   which neither depends on SMP nor
CONFIG_X86_LOCAL_APIC.

So the new init funciton is look like(from [2/3]):

static void __init system_intr_init(void)
{
   smp_intr_init();

#ifdef CONFIG_IRQ_WORK
   alloc_intr_gate(IRQ_WORK_VECTOR, irq_work_interrupt);
#endif

   apic_intr_init();
}


>> >>   i = FIRST_EXTERNAL_VECTOR;
>> >> -#ifndef CONFIG_X86_LOCAL_APIC
>> >> -#define first_system_vector NR_VECTORS
>> >> -#endif
>> >>   for_each_clear_bit_from(i, used_vectors, first_system_vector) {
>> >
>> > And how exactly is this here supposed to compile when 
>> > CONFIG_X86_LOCAL_APIC=n?
>>
>> Dunno.  I guess this code on !CONFIG_X86_LOCAL_APIC case hasn't been
>> tested yet ?
>
> It's your job to at least compile test your patches not the job of others.
>

Will do in next round.






Regards,
Jianyu Zhan


Re: [PATCH 3/3] x86/irq: update first_system_vector only when X86_LOCAL_PIC is on

2016-03-12 Thread Jianyu Zhan
On Sun, Mar 13, 2016 at 2:35 PM, Thomas Gleixner  wrote:
>> On Sun, Mar 13, 2016 at 4:08 AM, Thomas Gleixner  wrote:
>> > This is pointless, because it's only called when local apic is enabled as 
>> > all
>> > call sites of alloc_intr_gate() depend on CONFIG_X86_LOCAL_APIC 
>>
>> Not exactly,  currently at least  smp_intr_init()  DOES NOT depend on
>> CONFIG_X86_LOCAL_APIC:
>>
>> static void __init smp_intr_init(void)
>> {
>> #ifdef CONFIG_SMP
>
> It does, because CONFIG_SMP enables CONFIG_X86_LOCAL_APIC
>

It is.  Once CONFIG_SMP is on, CONFIG_X86_LOCAL_APIC will be turned on.

So the situation should be described as:   first_system_vector will be updated
on system vector init,  on SMP case(which indirectly implies
CONFIG_X86_LOCAL_APIC)
and on explicit CONFIG_X86_LOCAL_APIC(X86_UP_APIC).

So initial code:

#ifndef CONFIG_X86_LOCAL_APIC
#define first_system_vector NR_VECTORS
#endif

is actually not needed,  becaused it won't ever change on !
CONFIG_X86_LOCAL_APIC
case.

I will clarify this in v2.

>> I know this is weird, because modern SMP machines implies Local APIC.
>> But currently we have CONFIG_SMP detangle from CONFIG_X86_LOCAL_APIC,
>> which I think is fine.
>
> Do you actually understand how all that works together?
>

So the dependency should be reversed, and it should be like this:

Currently we have CONFIG_X86_LOCAL_APIC detangle from  CONFIG_SMP
(we can enable CONFIG_X86_LOCAL_APIC on 32-bit uniprocessor).


>> Another place which is weird is CONFIG_IRQ_WORK.  Technically,  it
>> does not depend
>> on SMP,   nor even necessary Local APIC.  Actually, it is just a base
>> configuration selected
>> by others.  But currently we have the
>
> Have you tried to enable it independent from CONFIG_X86_LOCAL_APIC?
>

I did.  I can turn off SMP and  did not use UP_APIC.  But IRQ_WORK is still
able be turn on(by selected by other subsystem).

My purpose of posting this patch set is trying to make the system vector layout
reveal this fact.

we have SMP system vector defined first( these may rely on or not rely
on CONFIG_X86_LOCAL_APIC),

then comes the CONFIG_X86_LOCAL_APIC dependent vector definition.

then comes the rest vector definition that not only depends on
CONFIG_X86_LOCAL_APIC, but
also others(like MCE, virtualization).

Among these stands out IRQ_WORK,   which neither depends on SMP nor
CONFIG_X86_LOCAL_APIC.

So the new init funciton is look like(from [2/3]):

static void __init system_intr_init(void)
{
   smp_intr_init();

#ifdef CONFIG_IRQ_WORK
   alloc_intr_gate(IRQ_WORK_VECTOR, irq_work_interrupt);
#endif

   apic_intr_init();
}


>> >>   i = FIRST_EXTERNAL_VECTOR;
>> >> -#ifndef CONFIG_X86_LOCAL_APIC
>> >> -#define first_system_vector NR_VECTORS
>> >> -#endif
>> >>   for_each_clear_bit_from(i, used_vectors, first_system_vector) {
>> >
>> > And how exactly is this here supposed to compile when 
>> > CONFIG_X86_LOCAL_APIC=n?
>>
>> Dunno.  I guess this code on !CONFIG_X86_LOCAL_APIC case hasn't been
>> tested yet ?
>
> It's your job to at least compile test your patches not the job of others.
>

Will do in next round.






Regards,
Jianyu Zhan


[PATCH 1/3] rbd: use KMEM_CACHE macro

2016-03-12 Thread Geliang Tang
Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.

Signed-off-by: Geliang Tang 
---
 drivers/block/rbd.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4a87678..70eba86 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5643,18 +5643,12 @@ static void rbd_sysfs_cleanup(void)
 static int rbd_slab_init(void)
 {
rbd_assert(!rbd_img_request_cache);
-   rbd_img_request_cache = kmem_cache_create("rbd_img_request",
-   sizeof (struct rbd_img_request),
-   __alignof__(struct rbd_img_request),
-   0, NULL);
+   rbd_img_request_cache = KMEM_CACHE(rbd_img_request, 0);
if (!rbd_img_request_cache)
return -ENOMEM;
 
rbd_assert(!rbd_obj_request_cache);
-   rbd_obj_request_cache = kmem_cache_create("rbd_obj_request",
-   sizeof (struct rbd_obj_request),
-   __alignof__(struct rbd_obj_request),
-   0, NULL);
+   rbd_obj_request_cache = KMEM_CACHE(rbd_obj_request, 0);
if (!rbd_obj_request_cache)
goto out_err;
 
-- 
2.5.0




[PATCH 1/3] rbd: use KMEM_CACHE macro

2016-03-12 Thread Geliang Tang
Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.

Signed-off-by: Geliang Tang 
---
 drivers/block/rbd.c | 10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4a87678..70eba86 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -5643,18 +5643,12 @@ static void rbd_sysfs_cleanup(void)
 static int rbd_slab_init(void)
 {
rbd_assert(!rbd_img_request_cache);
-   rbd_img_request_cache = kmem_cache_create("rbd_img_request",
-   sizeof (struct rbd_img_request),
-   __alignof__(struct rbd_img_request),
-   0, NULL);
+   rbd_img_request_cache = KMEM_CACHE(rbd_img_request, 0);
if (!rbd_img_request_cache)
return -ENOMEM;
 
rbd_assert(!rbd_obj_request_cache);
-   rbd_obj_request_cache = kmem_cache_create("rbd_obj_request",
-   sizeof (struct rbd_obj_request),
-   __alignof__(struct rbd_obj_request),
-   0, NULL);
+   rbd_obj_request_cache = KMEM_CACHE(rbd_obj_request, 0);
if (!rbd_obj_request_cache)
goto out_err;
 
-- 
2.5.0




[PATCH 2/3] dlm: use KMEM_CACHE macro

2016-03-12 Thread Geliang Tang
Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.

Signed-off-by: Geliang Tang 
---
 fs/dlm/memory.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
index 7cd24bc..6baa721 100644
--- a/fs/dlm/memory.c
+++ b/fs/dlm/memory.c
@@ -21,13 +21,11 @@ static struct kmem_cache *rsb_cache;
 
 int __init dlm_memory_init(void)
 {
-   lkb_cache = kmem_cache_create("dlm_lkb", sizeof(struct dlm_lkb),
-   __alignof__(struct dlm_lkb), 0, NULL);
+   lkb_cache = KMEM_CACHE(dlm_lkb, 0);
if (!lkb_cache)
return -ENOMEM;
 
-   rsb_cache = kmem_cache_create("dlm_rsb", sizeof(struct dlm_rsb),
-   __alignof__(struct dlm_rsb), 0, NULL);
+   rsb_cache = KMEM_CACHE(dlm_rsb, 0);
if (!rsb_cache) {
kmem_cache_destroy(lkb_cache);
return -ENOMEM;
-- 
2.5.0




[PATCH 3/3] libceph: use KMEM_CACHE macro

2016-03-12 Thread Geliang Tang
Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.

Signed-off-by: Geliang Tang 
---
 net/ceph/messenger.c  | 10 ++
 net/ceph/osd_client.c |  5 +
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 9382619..32c997e 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -235,18 +235,12 @@ static struct workqueue_struct *ceph_msgr_wq;
 static int ceph_msgr_slab_init(void)
 {
BUG_ON(ceph_msg_cache);
-   ceph_msg_cache = kmem_cache_create("ceph_msg",
-   sizeof (struct ceph_msg),
-   __alignof__(struct ceph_msg), 0, NULL);
-
+   ceph_msg_cache = KMEM_CACHE(ceph_msg, 0);
if (!ceph_msg_cache)
return -ENOMEM;
 
BUG_ON(ceph_msg_data_cache);
-   ceph_msg_data_cache = kmem_cache_create("ceph_msg_data",
-   sizeof (struct ceph_msg_data),
-   __alignof__(struct ceph_msg_data),
-   0, NULL);
+   ceph_msg_data_cache = KMEM_CACHE(ceph_msg_data, 0);
if (ceph_msg_data_cache)
return 0;
 
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 5bc0537..7558855 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -2783,10 +2783,7 @@ EXPORT_SYMBOL(ceph_osdc_writepages);
 int ceph_osdc_setup(void)
 {
BUG_ON(ceph_osd_request_cache);
-   ceph_osd_request_cache = kmem_cache_create("ceph_osd_request",
-   sizeof (struct ceph_osd_request),
-   __alignof__(struct ceph_osd_request),
-   0, NULL);
+   ceph_osd_request_cache = KMEM_CACHE(ceph_osd_request, 0);
 
return ceph_osd_request_cache ? 0 : -ENOMEM;
 }
-- 
2.5.0




[PATCH 2/3] dlm: use KMEM_CACHE macro

2016-03-12 Thread Geliang Tang
Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.

Signed-off-by: Geliang Tang 
---
 fs/dlm/memory.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
index 7cd24bc..6baa721 100644
--- a/fs/dlm/memory.c
+++ b/fs/dlm/memory.c
@@ -21,13 +21,11 @@ static struct kmem_cache *rsb_cache;
 
 int __init dlm_memory_init(void)
 {
-   lkb_cache = kmem_cache_create("dlm_lkb", sizeof(struct dlm_lkb),
-   __alignof__(struct dlm_lkb), 0, NULL);
+   lkb_cache = KMEM_CACHE(dlm_lkb, 0);
if (!lkb_cache)
return -ENOMEM;
 
-   rsb_cache = kmem_cache_create("dlm_rsb", sizeof(struct dlm_rsb),
-   __alignof__(struct dlm_rsb), 0, NULL);
+   rsb_cache = KMEM_CACHE(dlm_rsb, 0);
if (!rsb_cache) {
kmem_cache_destroy(lkb_cache);
return -ENOMEM;
-- 
2.5.0




[PATCH 3/3] libceph: use KMEM_CACHE macro

2016-03-12 Thread Geliang Tang
Use KMEM_CACHE() instead of kmem_cache_create() to simplify the code.

Signed-off-by: Geliang Tang 
---
 net/ceph/messenger.c  | 10 ++
 net/ceph/osd_client.c |  5 +
 2 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 9382619..32c997e 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -235,18 +235,12 @@ static struct workqueue_struct *ceph_msgr_wq;
 static int ceph_msgr_slab_init(void)
 {
BUG_ON(ceph_msg_cache);
-   ceph_msg_cache = kmem_cache_create("ceph_msg",
-   sizeof (struct ceph_msg),
-   __alignof__(struct ceph_msg), 0, NULL);
-
+   ceph_msg_cache = KMEM_CACHE(ceph_msg, 0);
if (!ceph_msg_cache)
return -ENOMEM;
 
BUG_ON(ceph_msg_data_cache);
-   ceph_msg_data_cache = kmem_cache_create("ceph_msg_data",
-   sizeof (struct ceph_msg_data),
-   __alignof__(struct ceph_msg_data),
-   0, NULL);
+   ceph_msg_data_cache = KMEM_CACHE(ceph_msg_data, 0);
if (ceph_msg_data_cache)
return 0;
 
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 5bc0537..7558855 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -2783,10 +2783,7 @@ EXPORT_SYMBOL(ceph_osdc_writepages);
 int ceph_osdc_setup(void)
 {
BUG_ON(ceph_osd_request_cache);
-   ceph_osd_request_cache = kmem_cache_create("ceph_osd_request",
-   sizeof (struct ceph_osd_request),
-   __alignof__(struct ceph_osd_request),
-   0, NULL);
+   ceph_osd_request_cache = KMEM_CACHE(ceph_osd_request, 0);
 
return ceph_osd_request_cache ? 0 : -ENOMEM;
 }
-- 
2.5.0




Re: [RFC PATCH net-next 0/3] net: dsa: finer bridging control

2016-03-12 Thread Vivien Didelot
Hi David,

Vivien Didelot  writes:

> This patchset renames the bridging routines of the DSA layer, make the
> unbridging routine return void, and rework the DSA netdev notifier handler,
> similar to what the Mellanox Spectrum driver does.

This is not an RFC, but a normal patchset. I badly reused a previous
git-format-patch command. Please let me know if I need to resend.

Thank you,
Vivien


Re: [RFC PATCH net-next 0/3] net: dsa: finer bridging control

2016-03-12 Thread Vivien Didelot
Hi David,

Vivien Didelot  writes:

> This patchset renames the bridging routines of the DSA layer, make the
> unbridging routine return void, and rework the DSA netdev notifier handler,
> similar to what the Mellanox Spectrum driver does.

This is not an RFC, but a normal patchset. I badly reused a previous
git-format-patch command. Please let me know if I need to resend.

Thank you,
Vivien


[RFC PATCH net-next 3/3] net: dsa: refine netdev event notifier

2016-03-12 Thread Vivien Didelot
Rework the netdev event handler, similar to what the Mellanox Spectrum
driver does, to eventually welcome NETDEV_PRECHANGEUPPER actions and use
netdev helpers, such as netif_is_bridge_master.

Signed-off-by: Vivien Didelot 
---
 net/dsa/slave.c | 55 +++
 1 file changed, 31 insertions(+), 24 deletions(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 54976c4..27f7886 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -451,7 +451,7 @@ static int dsa_slave_bridge_port_join(struct net_device 
*dev,
if (ds->drv->port_bridge_join)
ret = ds->drv->port_bridge_join(ds, p->port, br);
 
-   return ret;
+   return ret == -EOPNOTSUPP ? 0 : ret;
 }
 
 static void dsa_slave_bridge_port_leave(struct net_device *dev)
@@ -1139,40 +1139,47 @@ static bool dsa_slave_dev_check(struct net_device *dev)
return dev->netdev_ops == _slave_netdev_ops;
 }
 
-static int dsa_slave_master_changed(struct net_device *dev)
+static int dsa_slave_port_upper_event(struct net_device *dev,
+ unsigned long event, void *ptr)
 {
-   struct net_device *master = netdev_master_upper_dev_get(dev);
-   struct dsa_slave_priv *p = netdev_priv(dev);
+   struct netdev_notifier_changeupper_info *info = ptr;
+   struct net_device *upper = info->upper_dev;
int err = 0;
 
-   if (master && master->rtnl_link_ops &&
-   !strcmp(master->rtnl_link_ops->kind, "bridge"))
-   err = dsa_slave_bridge_port_join(dev, master);
-   else if (dsa_port_is_bridged(p))
-   dsa_slave_bridge_port_leave(dev);
+   switch (event) {
+   case NETDEV_CHANGEUPPER:
+   if (netif_is_bridge_master(upper)) {
+   if (info->linking)
+   err = dsa_slave_bridge_port_join(dev, upper);
+   else
+   dsa_slave_bridge_port_leave(dev);
+   }
 
-   return err;
+   break;
+   }
+
+   return notifier_from_errno(err);
 }
 
-int dsa_slave_netdevice_event(struct notifier_block *unused,
- unsigned long event, void *ptr)
+static int dsa_slave_port_event(struct net_device *dev, unsigned long event,
+   void *ptr)
 {
-   struct net_device *dev;
-   int err = 0;
-
switch (event) {
+   case NETDEV_PRECHANGEUPPER:
case NETDEV_CHANGEUPPER:
-   dev = netdev_notifier_info_to_dev(ptr);
-   if (!dsa_slave_dev_check(dev))
-   goto out;
+   return dsa_slave_port_upper_event(dev, event, ptr);
+   }
 
-   err = dsa_slave_master_changed(dev);
-   if (err && err != -EOPNOTSUPP)
-   netdev_warn(dev, "failed to reflect master change\n");
+   return NOTIFY_DONE;
+}
 
-   break;
-   }
+int dsa_slave_netdevice_event(struct notifier_block *unused,
+ unsigned long event, void *ptr)
+{
+   struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+
+   if (dsa_slave_dev_check(dev))
+   return dsa_slave_port_event(dev, event, ptr);
 
-out:
return NOTIFY_DONE;
 }
-- 
2.7.2



[RFC PATCH net-next 2/3] net: dsa: make port_bridge_leave return void

2016-03-12 Thread Vivien Didelot
netdev_upper_dev_unlink() which notifies NETDEV_CHANGEUPPER, returns
void, as well as del_nbp(). So there's no advantage to catch an eventual
error from the port_bridge_leave routine at the DSA level.

Make this routine void for the DSA layer and its existing drivers.

Signed-off-by: Vivien Didelot 
---
 drivers/net/dsa/bcm_sf2.c   |  4 +---
 drivers/net/dsa/mv88e6xxx.c | 28 +---
 drivers/net/dsa/mv88e6xxx.h |  2 +-
 include/net/dsa.h   |  2 +-
 net/dsa/slave.c |  9 +++--
 5 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 4bcc9eb..95944d5 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -516,7 +516,7 @@ static int bcm_sf2_sw_br_join(struct dsa_switch *ds, int 
port,
return 0;
 }
 
-static int bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port)
+static void bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port)
 {
struct bcm_sf2_priv *priv = ds_to_priv(ds);
struct net_device *bridge = priv->port_sts[port].bridge_dev;
@@ -543,8 +543,6 @@ static int bcm_sf2_sw_br_leave(struct dsa_switch *ds, int 
port)
core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(port));
priv->port_sts[port].vlan_ctl_mask = p_ctl;
priv->port_sts[port].bridge_dev = NULL;
-
-   return 0;
 }
 
 static int bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port,
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index 5f07524..448d4ef 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -2219,39 +2219,29 @@ unlock:
return err;
 }
 
-int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
+void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
 {
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
struct net_device *bridge = ps->ports[port].bridge_dev;
u16 fid;
-   int i, err;
+   int i;
 
mutex_lock(>smi_mutex);
 
/* Give the port a fresh Filtering Information Database */
-   err = _mv88e6xxx_fid_new(ds, );
-   if (err)
-   goto unlock;
-
-   err = _mv88e6xxx_port_fid_set(ds, port, fid);
-   if (err)
-   goto unlock;
+   if (_mv88e6xxx_fid_new(ds, ) ||
+   _mv88e6xxx_port_fid_set(ds, port, fid))
+   netdev_warn(ds->ports[port], "failed to assign a new FID\n");
 
/* Unassign the bridge and remap each port's VLANTable */
ps->ports[port].bridge_dev = NULL;
 
-   for (i = 0; i < ps->num_ports; ++i) {
-   if (i == port || ps->ports[i].bridge_dev == bridge) {
-   err = _mv88e6xxx_port_based_vlan_map(ds, i);
-   if (err)
-   break;
-   }
-   }
+   for (i = 0; i < ps->num_ports; ++i)
+   if (i == port || ps->ports[i].bridge_dev == bridge)
+   if (_mv88e6xxx_port_based_vlan_map(ds, i))
+   netdev_warn(ds->ports[i], "failed to remap\n");
 
-unlock:
mutex_unlock(>smi_mutex);
-
-   return err;
 }
 
 static void mv88e6xxx_bridge_work(struct work_struct *work)
diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
index 3425616..afd495c 100644
--- a/drivers/net/dsa/mv88e6xxx.h
+++ b/drivers/net/dsa/mv88e6xxx.h
@@ -488,7 +488,7 @@ int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
  struct phy_device *phydev, struct ethtool_eee *e);
 int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
   struct net_device *bridge);
-int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port);
+void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port);
 int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state);
 int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port,
  bool vlan_filtering);
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 004e034..6463bb2 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -298,7 +298,7 @@ struct dsa_switch_driver {
 */
int (*port_bridge_join)(struct dsa_switch *ds, int port,
struct net_device *bridge);
-   int (*port_bridge_leave)(struct dsa_switch *ds, int port);
+   void(*port_bridge_leave)(struct dsa_switch *ds, int port);
int (*port_stp_update)(struct dsa_switch *ds, int port,
   u8 state);
 
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index b997ee1..54976c4 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -454,15 +454,14 @@ static int dsa_slave_bridge_port_join(struct net_device 
*dev,
return ret;
 }
 
-static int dsa_slave_bridge_port_leave(struct net_device *dev)
+static void dsa_slave_bridge_port_leave(struct net_device *dev)
 {

[RFC PATCH net-next 0/3] net: dsa: finer bridging control

2016-03-12 Thread Vivien Didelot
This patchset renames the bridging routines of the DSA layer, make the
unbridging routine return void, and rework the DSA netdev notifier handler,
similar to what the Mellanox Spectrum driver does.

Vivien Didelot (3):
  net: dsa: rename port_*_bridge routines
  net: dsa: make port_bridge_leave return void
  net: dsa: refine netdev event notifier

 Documentation/networking/dsa/dsa.txt |  4 +--
 drivers/net/dsa/bcm_sf2.c|  8 ++---
 drivers/net/dsa/mv88e6171.c  |  4 +--
 drivers/net/dsa/mv88e6352.c  |  4 +--
 drivers/net/dsa/mv88e6xxx.c  | 28 +--
 drivers/net/dsa/mv88e6xxx.h  |  2 +-
 include/net/dsa.h|  4 +--
 net/dsa/slave.c  | 68 +++-
 8 files changed, 57 insertions(+), 65 deletions(-)

-- 
2.7.2



[RFC PATCH net-next 3/3] net: dsa: refine netdev event notifier

2016-03-12 Thread Vivien Didelot
Rework the netdev event handler, similar to what the Mellanox Spectrum
driver does, to eventually welcome NETDEV_PRECHANGEUPPER actions and use
netdev helpers, such as netif_is_bridge_master.

Signed-off-by: Vivien Didelot 
---
 net/dsa/slave.c | 55 +++
 1 file changed, 31 insertions(+), 24 deletions(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 54976c4..27f7886 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -451,7 +451,7 @@ static int dsa_slave_bridge_port_join(struct net_device 
*dev,
if (ds->drv->port_bridge_join)
ret = ds->drv->port_bridge_join(ds, p->port, br);
 
-   return ret;
+   return ret == -EOPNOTSUPP ? 0 : ret;
 }
 
 static void dsa_slave_bridge_port_leave(struct net_device *dev)
@@ -1139,40 +1139,47 @@ static bool dsa_slave_dev_check(struct net_device *dev)
return dev->netdev_ops == _slave_netdev_ops;
 }
 
-static int dsa_slave_master_changed(struct net_device *dev)
+static int dsa_slave_port_upper_event(struct net_device *dev,
+ unsigned long event, void *ptr)
 {
-   struct net_device *master = netdev_master_upper_dev_get(dev);
-   struct dsa_slave_priv *p = netdev_priv(dev);
+   struct netdev_notifier_changeupper_info *info = ptr;
+   struct net_device *upper = info->upper_dev;
int err = 0;
 
-   if (master && master->rtnl_link_ops &&
-   !strcmp(master->rtnl_link_ops->kind, "bridge"))
-   err = dsa_slave_bridge_port_join(dev, master);
-   else if (dsa_port_is_bridged(p))
-   dsa_slave_bridge_port_leave(dev);
+   switch (event) {
+   case NETDEV_CHANGEUPPER:
+   if (netif_is_bridge_master(upper)) {
+   if (info->linking)
+   err = dsa_slave_bridge_port_join(dev, upper);
+   else
+   dsa_slave_bridge_port_leave(dev);
+   }
 
-   return err;
+   break;
+   }
+
+   return notifier_from_errno(err);
 }
 
-int dsa_slave_netdevice_event(struct notifier_block *unused,
- unsigned long event, void *ptr)
+static int dsa_slave_port_event(struct net_device *dev, unsigned long event,
+   void *ptr)
 {
-   struct net_device *dev;
-   int err = 0;
-
switch (event) {
+   case NETDEV_PRECHANGEUPPER:
case NETDEV_CHANGEUPPER:
-   dev = netdev_notifier_info_to_dev(ptr);
-   if (!dsa_slave_dev_check(dev))
-   goto out;
+   return dsa_slave_port_upper_event(dev, event, ptr);
+   }
 
-   err = dsa_slave_master_changed(dev);
-   if (err && err != -EOPNOTSUPP)
-   netdev_warn(dev, "failed to reflect master change\n");
+   return NOTIFY_DONE;
+}
 
-   break;
-   }
+int dsa_slave_netdevice_event(struct notifier_block *unused,
+ unsigned long event, void *ptr)
+{
+   struct net_device *dev = netdev_notifier_info_to_dev(ptr);
+
+   if (dsa_slave_dev_check(dev))
+   return dsa_slave_port_event(dev, event, ptr);
 
-out:
return NOTIFY_DONE;
 }
-- 
2.7.2



[RFC PATCH net-next 2/3] net: dsa: make port_bridge_leave return void

2016-03-12 Thread Vivien Didelot
netdev_upper_dev_unlink() which notifies NETDEV_CHANGEUPPER, returns
void, as well as del_nbp(). So there's no advantage to catch an eventual
error from the port_bridge_leave routine at the DSA level.

Make this routine void for the DSA layer and its existing drivers.

Signed-off-by: Vivien Didelot 
---
 drivers/net/dsa/bcm_sf2.c   |  4 +---
 drivers/net/dsa/mv88e6xxx.c | 28 +---
 drivers/net/dsa/mv88e6xxx.h |  2 +-
 include/net/dsa.h   |  2 +-
 net/dsa/slave.c |  9 +++--
 5 files changed, 15 insertions(+), 30 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 4bcc9eb..95944d5 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -516,7 +516,7 @@ static int bcm_sf2_sw_br_join(struct dsa_switch *ds, int 
port,
return 0;
 }
 
-static int bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port)
+static void bcm_sf2_sw_br_leave(struct dsa_switch *ds, int port)
 {
struct bcm_sf2_priv *priv = ds_to_priv(ds);
struct net_device *bridge = priv->port_sts[port].bridge_dev;
@@ -543,8 +543,6 @@ static int bcm_sf2_sw_br_leave(struct dsa_switch *ds, int 
port)
core_writel(priv, p_ctl, CORE_PORT_VLAN_CTL_PORT(port));
priv->port_sts[port].vlan_ctl_mask = p_ctl;
priv->port_sts[port].bridge_dev = NULL;
-
-   return 0;
 }
 
 static int bcm_sf2_sw_br_set_stp_state(struct dsa_switch *ds, int port,
diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index 5f07524..448d4ef 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -2219,39 +2219,29 @@ unlock:
return err;
 }
 
-int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
+void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port)
 {
struct mv88e6xxx_priv_state *ps = ds_to_priv(ds);
struct net_device *bridge = ps->ports[port].bridge_dev;
u16 fid;
-   int i, err;
+   int i;
 
mutex_lock(>smi_mutex);
 
/* Give the port a fresh Filtering Information Database */
-   err = _mv88e6xxx_fid_new(ds, );
-   if (err)
-   goto unlock;
-
-   err = _mv88e6xxx_port_fid_set(ds, port, fid);
-   if (err)
-   goto unlock;
+   if (_mv88e6xxx_fid_new(ds, ) ||
+   _mv88e6xxx_port_fid_set(ds, port, fid))
+   netdev_warn(ds->ports[port], "failed to assign a new FID\n");
 
/* Unassign the bridge and remap each port's VLANTable */
ps->ports[port].bridge_dev = NULL;
 
-   for (i = 0; i < ps->num_ports; ++i) {
-   if (i == port || ps->ports[i].bridge_dev == bridge) {
-   err = _mv88e6xxx_port_based_vlan_map(ds, i);
-   if (err)
-   break;
-   }
-   }
+   for (i = 0; i < ps->num_ports; ++i)
+   if (i == port || ps->ports[i].bridge_dev == bridge)
+   if (_mv88e6xxx_port_based_vlan_map(ds, i))
+   netdev_warn(ds->ports[i], "failed to remap\n");
 
-unlock:
mutex_unlock(>smi_mutex);
-
-   return err;
 }
 
 static void mv88e6xxx_bridge_work(struct work_struct *work)
diff --git a/drivers/net/dsa/mv88e6xxx.h b/drivers/net/dsa/mv88e6xxx.h
index 3425616..afd495c 100644
--- a/drivers/net/dsa/mv88e6xxx.h
+++ b/drivers/net/dsa/mv88e6xxx.h
@@ -488,7 +488,7 @@ int mv88e6xxx_set_eee(struct dsa_switch *ds, int port,
  struct phy_device *phydev, struct ethtool_eee *e);
 int mv88e6xxx_port_bridge_join(struct dsa_switch *ds, int port,
   struct net_device *bridge);
-int mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port);
+void mv88e6xxx_port_bridge_leave(struct dsa_switch *ds, int port);
 int mv88e6xxx_port_stp_update(struct dsa_switch *ds, int port, u8 state);
 int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port,
  bool vlan_filtering);
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 004e034..6463bb2 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -298,7 +298,7 @@ struct dsa_switch_driver {
 */
int (*port_bridge_join)(struct dsa_switch *ds, int port,
struct net_device *bridge);
-   int (*port_bridge_leave)(struct dsa_switch *ds, int port);
+   void(*port_bridge_leave)(struct dsa_switch *ds, int port);
int (*port_stp_update)(struct dsa_switch *ds, int port,
   u8 state);
 
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index b997ee1..54976c4 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -454,15 +454,14 @@ static int dsa_slave_bridge_port_join(struct net_device 
*dev,
return ret;
 }
 
-static int dsa_slave_bridge_port_leave(struct net_device *dev)
+static void dsa_slave_bridge_port_leave(struct net_device *dev)
 {
struct dsa_slave_priv *p = 

[RFC PATCH net-next 0/3] net: dsa: finer bridging control

2016-03-12 Thread Vivien Didelot
This patchset renames the bridging routines of the DSA layer, make the
unbridging routine return void, and rework the DSA netdev notifier handler,
similar to what the Mellanox Spectrum driver does.

Vivien Didelot (3):
  net: dsa: rename port_*_bridge routines
  net: dsa: make port_bridge_leave return void
  net: dsa: refine netdev event notifier

 Documentation/networking/dsa/dsa.txt |  4 +--
 drivers/net/dsa/bcm_sf2.c|  8 ++---
 drivers/net/dsa/mv88e6171.c  |  4 +--
 drivers/net/dsa/mv88e6352.c  |  4 +--
 drivers/net/dsa/mv88e6xxx.c  | 28 +--
 drivers/net/dsa/mv88e6xxx.h  |  2 +-
 include/net/dsa.h|  4 +--
 net/dsa/slave.c  | 68 +++-
 8 files changed, 57 insertions(+), 65 deletions(-)

-- 
2.7.2



[RFC PATCH net-next 1/3] net: dsa: rename port_*_bridge routines

2016-03-12 Thread Vivien Didelot
Rename DSA port_join_bridge and port_leave_bridge routines to
respectively port_bridge_join and port_bridge_leave in order to respect
an implicit Port::Bridge namespace.

Signed-off-by: Vivien Didelot 
---
 Documentation/networking/dsa/dsa.txt | 4 ++--
 drivers/net/dsa/bcm_sf2.c| 4 ++--
 drivers/net/dsa/mv88e6171.c  | 4 ++--
 drivers/net/dsa/mv88e6352.c  | 4 ++--
 include/net/dsa.h| 4 ++--
 net/dsa/slave.c  | 8 
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Documentation/networking/dsa/dsa.txt 
b/Documentation/networking/dsa/dsa.txt
index 974e9c3..3b196c3 100644
--- a/Documentation/networking/dsa/dsa.txt
+++ b/Documentation/networking/dsa/dsa.txt
@@ -521,12 +521,12 @@ See Documentation/hwmon/sysfs-interface for details.
 Bridge layer
 
 
-- port_join_bridge: bridge layer function invoked when a given switch port is
+- port_bridge_join: bridge layer function invoked when a given switch port is
   added to a bridge, this function should be doing the necessary at the switch
   level to permit the joining port from being added to the relevant logical
   domain for it to ingress/egress traffic with other members of the bridge.
 
-- port_leave_bridge: bridge layer function invoked when a given switch port is
+- port_bridge_leave: bridge layer function invoked when a given switch port is
   removed from a bridge, this function should be doing the necessary at the
   switch level to deny the leaving port from ingress/egress traffic from the
   remaining bridge members. When the port leaves the bridge, it should be aged
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 3f62759..4bcc9eb 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1387,8 +1387,8 @@ static struct dsa_switch_driver bcm_sf2_switch_driver = {
.port_disable   = bcm_sf2_port_disable,
.get_eee= bcm_sf2_sw_get_eee,
.set_eee= bcm_sf2_sw_set_eee,
-   .port_join_bridge   = bcm_sf2_sw_br_join,
-   .port_leave_bridge  = bcm_sf2_sw_br_leave,
+   .port_bridge_join   = bcm_sf2_sw_br_join,
+   .port_bridge_leave  = bcm_sf2_sw_br_leave,
.port_stp_update= bcm_sf2_sw_br_set_stp_state,
.port_fdb_prepare   = bcm_sf2_sw_fdb_prepare,
.port_fdb_add   = bcm_sf2_sw_fdb_add,
diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c
index d72ccbd..c0164b9 100644
--- a/drivers/net/dsa/mv88e6171.c
+++ b/drivers/net/dsa/mv88e6171.c
@@ -103,8 +103,8 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
 #endif
.get_regs_len   = mv88e6xxx_get_regs_len,
.get_regs   = mv88e6xxx_get_regs,
-   .port_join_bridge   = mv88e6xxx_port_bridge_join,
-   .port_leave_bridge  = mv88e6xxx_port_bridge_leave,
+   .port_bridge_join   = mv88e6xxx_port_bridge_join,
+   .port_bridge_leave  = mv88e6xxx_port_bridge_leave,
.port_stp_update= mv88e6xxx_port_stp_update,
.port_vlan_filtering= mv88e6xxx_port_vlan_filtering,
.port_vlan_prepare  = mv88e6xxx_port_vlan_prepare,
diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c
index a41fa50..5f528ab 100644
--- a/drivers/net/dsa/mv88e6352.c
+++ b/drivers/net/dsa/mv88e6352.c
@@ -324,8 +324,8 @@ struct dsa_switch_driver mv88e6352_switch_driver = {
.set_eeprom = mv88e6352_set_eeprom,
.get_regs_len   = mv88e6xxx_get_regs_len,
.get_regs   = mv88e6xxx_get_regs,
-   .port_join_bridge   = mv88e6xxx_port_bridge_join,
-   .port_leave_bridge  = mv88e6xxx_port_bridge_leave,
+   .port_bridge_join   = mv88e6xxx_port_bridge_join,
+   .port_bridge_leave  = mv88e6xxx_port_bridge_leave,
.port_stp_update= mv88e6xxx_port_stp_update,
.port_vlan_filtering= mv88e6xxx_port_vlan_filtering,
.port_vlan_prepare  = mv88e6xxx_port_vlan_prepare,
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 26c0a3f..004e034 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -296,9 +296,9 @@ struct dsa_switch_driver {
/*
 * Bridge integration
 */
-   int (*port_join_bridge)(struct dsa_switch *ds, int port,
+   int (*port_bridge_join)(struct dsa_switch *ds, int port,
struct net_device *bridge);
-   int (*port_leave_bridge)(struct dsa_switch *ds, int port);
+   int (*port_bridge_leave)(struct dsa_switch *ds, int port);
int (*port_stp_update)(struct dsa_switch *ds, int port,
   u8 state);
 
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 27bf03d..b997ee1 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -448,8 +448,8 @@ static int 

[RFC PATCH net-next 1/3] net: dsa: rename port_*_bridge routines

2016-03-12 Thread Vivien Didelot
Rename DSA port_join_bridge and port_leave_bridge routines to
respectively port_bridge_join and port_bridge_leave in order to respect
an implicit Port::Bridge namespace.

Signed-off-by: Vivien Didelot 
---
 Documentation/networking/dsa/dsa.txt | 4 ++--
 drivers/net/dsa/bcm_sf2.c| 4 ++--
 drivers/net/dsa/mv88e6171.c  | 4 ++--
 drivers/net/dsa/mv88e6352.c  | 4 ++--
 include/net/dsa.h| 4 ++--
 net/dsa/slave.c  | 8 
 6 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/Documentation/networking/dsa/dsa.txt 
b/Documentation/networking/dsa/dsa.txt
index 974e9c3..3b196c3 100644
--- a/Documentation/networking/dsa/dsa.txt
+++ b/Documentation/networking/dsa/dsa.txt
@@ -521,12 +521,12 @@ See Documentation/hwmon/sysfs-interface for details.
 Bridge layer
 
 
-- port_join_bridge: bridge layer function invoked when a given switch port is
+- port_bridge_join: bridge layer function invoked when a given switch port is
   added to a bridge, this function should be doing the necessary at the switch
   level to permit the joining port from being added to the relevant logical
   domain for it to ingress/egress traffic with other members of the bridge.
 
-- port_leave_bridge: bridge layer function invoked when a given switch port is
+- port_bridge_leave: bridge layer function invoked when a given switch port is
   removed from a bridge, this function should be doing the necessary at the
   switch level to deny the leaving port from ingress/egress traffic from the
   remaining bridge members. When the port leaves the bridge, it should be aged
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 3f62759..4bcc9eb 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -1387,8 +1387,8 @@ static struct dsa_switch_driver bcm_sf2_switch_driver = {
.port_disable   = bcm_sf2_port_disable,
.get_eee= bcm_sf2_sw_get_eee,
.set_eee= bcm_sf2_sw_set_eee,
-   .port_join_bridge   = bcm_sf2_sw_br_join,
-   .port_leave_bridge  = bcm_sf2_sw_br_leave,
+   .port_bridge_join   = bcm_sf2_sw_br_join,
+   .port_bridge_leave  = bcm_sf2_sw_br_leave,
.port_stp_update= bcm_sf2_sw_br_set_stp_state,
.port_fdb_prepare   = bcm_sf2_sw_fdb_prepare,
.port_fdb_add   = bcm_sf2_sw_fdb_add,
diff --git a/drivers/net/dsa/mv88e6171.c b/drivers/net/dsa/mv88e6171.c
index d72ccbd..c0164b9 100644
--- a/drivers/net/dsa/mv88e6171.c
+++ b/drivers/net/dsa/mv88e6171.c
@@ -103,8 +103,8 @@ struct dsa_switch_driver mv88e6171_switch_driver = {
 #endif
.get_regs_len   = mv88e6xxx_get_regs_len,
.get_regs   = mv88e6xxx_get_regs,
-   .port_join_bridge   = mv88e6xxx_port_bridge_join,
-   .port_leave_bridge  = mv88e6xxx_port_bridge_leave,
+   .port_bridge_join   = mv88e6xxx_port_bridge_join,
+   .port_bridge_leave  = mv88e6xxx_port_bridge_leave,
.port_stp_update= mv88e6xxx_port_stp_update,
.port_vlan_filtering= mv88e6xxx_port_vlan_filtering,
.port_vlan_prepare  = mv88e6xxx_port_vlan_prepare,
diff --git a/drivers/net/dsa/mv88e6352.c b/drivers/net/dsa/mv88e6352.c
index a41fa50..5f528ab 100644
--- a/drivers/net/dsa/mv88e6352.c
+++ b/drivers/net/dsa/mv88e6352.c
@@ -324,8 +324,8 @@ struct dsa_switch_driver mv88e6352_switch_driver = {
.set_eeprom = mv88e6352_set_eeprom,
.get_regs_len   = mv88e6xxx_get_regs_len,
.get_regs   = mv88e6xxx_get_regs,
-   .port_join_bridge   = mv88e6xxx_port_bridge_join,
-   .port_leave_bridge  = mv88e6xxx_port_bridge_leave,
+   .port_bridge_join   = mv88e6xxx_port_bridge_join,
+   .port_bridge_leave  = mv88e6xxx_port_bridge_leave,
.port_stp_update= mv88e6xxx_port_stp_update,
.port_vlan_filtering= mv88e6xxx_port_vlan_filtering,
.port_vlan_prepare  = mv88e6xxx_port_vlan_prepare,
diff --git a/include/net/dsa.h b/include/net/dsa.h
index 26c0a3f..004e034 100644
--- a/include/net/dsa.h
+++ b/include/net/dsa.h
@@ -296,9 +296,9 @@ struct dsa_switch_driver {
/*
 * Bridge integration
 */
-   int (*port_join_bridge)(struct dsa_switch *ds, int port,
+   int (*port_bridge_join)(struct dsa_switch *ds, int port,
struct net_device *bridge);
-   int (*port_leave_bridge)(struct dsa_switch *ds, int port);
+   int (*port_bridge_leave)(struct dsa_switch *ds, int port);
int (*port_stp_update)(struct dsa_switch *ds, int port,
   u8 state);
 
diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 27bf03d..b997ee1 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -448,8 +448,8 @@ static int dsa_slave_bridge_port_join(struct net_device 
*dev,
 

Re: [PATCH 3/3] x86/irq: update first_system_vector only when X86_LOCAL_PIC is on

2016-03-12 Thread Thomas Gleixner
On Sun, 13 Mar 2016, Jianyu Zhan wrote:

> On Sun, Mar 13, 2016 at 4:08 AM, Thomas Gleixner  wrote:
> > This is pointless, because it's only called when local apic is enabled as 
> > all
> > call sites of alloc_intr_gate() depend on CONFIG_X86_LOCAL_APIC 
> 
> Not exactly,  currently at least  smp_intr_init()  DOES NOT depend on
> CONFIG_X86_LOCAL_APIC:
> 
> static void __init smp_intr_init(void)
> {
> #ifdef CONFIG_SMP

It does, because CONFIG_SMP enables CONFIG_X86_LOCAL_APIC

> I know this is weird, because modern SMP machines implies Local APIC.
> But currently we have CONFIG_SMP detangle from CONFIG_X86_LOCAL_APIC,
> which I think is fine.

Do you actually understand how all that works together?
 
> Another place which is weird is CONFIG_IRQ_WORK.  Technically,  it
> does not depend
> on SMP,   nor even necessary Local APIC.  Actually, it is just a base
> configuration selected
> by others.  But currently we have the

Have you tried to enable it independent from CONFIG_X86_LOCAL_APIC?
 
> >>   i = FIRST_EXTERNAL_VECTOR;
> >> -#ifndef CONFIG_X86_LOCAL_APIC
> >> -#define first_system_vector NR_VECTORS
> >> -#endif
> >>   for_each_clear_bit_from(i, used_vectors, first_system_vector) {
> >
> > And how exactly is this here supposed to compile when 
> > CONFIG_X86_LOCAL_APIC=n?
> 
> Dunno.  I guess this code on !CONFIG_X86_LOCAL_APIC case hasn't been
> tested yet ?

It's your job to at least compile test your patches not the job of others.
 
> For CONFIG_X86_LOCAL_APIC case,  the define makes sense.
> But for ! CONFIG_X86_LOCAL_APIC case,  why we confine it to NR_VECTORS
> is a mystery
> to me.  Have digged into git history, but found no proof.

And because it's a mystery you can just change it as you think it's fine and
thereby break the build?
 
> So to maintain consistency, this patch just retain what it is,  but we
> do not bother update it for
> !CONFIG_X86_LOCAL_APIC case.

To maintain consistency we leave it as is, because that actually compiles AND
works.

Thanks,

tglx


Re: [PATCH 3/3] x86/irq: update first_system_vector only when X86_LOCAL_PIC is on

2016-03-12 Thread Thomas Gleixner
On Sun, 13 Mar 2016, Jianyu Zhan wrote:

> On Sun, Mar 13, 2016 at 4:08 AM, Thomas Gleixner  wrote:
> > This is pointless, because it's only called when local apic is enabled as 
> > all
> > call sites of alloc_intr_gate() depend on CONFIG_X86_LOCAL_APIC 
> 
> Not exactly,  currently at least  smp_intr_init()  DOES NOT depend on
> CONFIG_X86_LOCAL_APIC:
> 
> static void __init smp_intr_init(void)
> {
> #ifdef CONFIG_SMP

It does, because CONFIG_SMP enables CONFIG_X86_LOCAL_APIC

> I know this is weird, because modern SMP machines implies Local APIC.
> But currently we have CONFIG_SMP detangle from CONFIG_X86_LOCAL_APIC,
> which I think is fine.

Do you actually understand how all that works together?
 
> Another place which is weird is CONFIG_IRQ_WORK.  Technically,  it
> does not depend
> on SMP,   nor even necessary Local APIC.  Actually, it is just a base
> configuration selected
> by others.  But currently we have the

Have you tried to enable it independent from CONFIG_X86_LOCAL_APIC?
 
> >>   i = FIRST_EXTERNAL_VECTOR;
> >> -#ifndef CONFIG_X86_LOCAL_APIC
> >> -#define first_system_vector NR_VECTORS
> >> -#endif
> >>   for_each_clear_bit_from(i, used_vectors, first_system_vector) {
> >
> > And how exactly is this here supposed to compile when 
> > CONFIG_X86_LOCAL_APIC=n?
> 
> Dunno.  I guess this code on !CONFIG_X86_LOCAL_APIC case hasn't been
> tested yet ?

It's your job to at least compile test your patches not the job of others.
 
> For CONFIG_X86_LOCAL_APIC case,  the define makes sense.
> But for ! CONFIG_X86_LOCAL_APIC case,  why we confine it to NR_VECTORS
> is a mystery
> to me.  Have digged into git history, but found no proof.

And because it's a mystery you can just change it as you think it's fine and
thereby break the build?
 
> So to maintain consistency, this patch just retain what it is,  but we
> do not bother update it for
> !CONFIG_X86_LOCAL_APIC case.

To maintain consistency we leave it as is, because that actually compiles AND
works.

Thanks,

tglx


[PATCH] mmc: atmel-mci: Check pdata for NULL before dereferencing it

2016-03-12 Thread Brent Taylor
I'm using an at91sam9g20ek development board, and I ran into a kernel
panic with 4.5.0-rc7:

atmel_mci fffa8000.mmc: version: 0x210
Unable to handle kernel NULL pointer dereference at virtual address 0004
pgd = c0004000
[0004] *pgd=
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.5.0-rc7 #5
Hardware name: Atmel AT91SAM9
task: c3838000 ti: c383c000 task.ti: c383c000
PC is at atmci_probe+0x3f8/0x7c4
LR is at dma_request_chan+0x134/0x158
pc : []lr : []psr: 6013
sp : c383de40  ip : 6013  fp : 0022
r10: c3910b60  r9 : c38da900  r8 : 0210
r7 : c38da910  r6 : c38c14d0  r5 :   r4 : c398b110
r3 :   r2 :   r1 : 0001  r0 : ffed
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 0005317f  Table: 20004000  DAC: 0053
Process swapper (pid: 1, stack limit = 0xc383c190)
Stack: (0xc383de40 to 0xc383e000)
de40: c38db360 c398b110 c38dc5f0 c0404386 c398dfa0  c0486838 c38da910
de60: c04ae2d0 c04ce424   c0486838 c04bbec0  c01e2318
de80: c38da910 c04ae2d0 c04ce424 c01e0c54 c04ae2d0 c38da910 c38da910 c38da944
dea0: c04ae2d0 c04a6568 c04b81c8 c01e0ee8  c04ae2d0 c01e0e80 c01df188
dec0: c382d58c c38d8570 c04ae2d0  c398c180 c01e0194 c0418298 c041829b
dee0: c04ae2d0 c047b1f4  c0497ea0 c0497ea0 c01e147c c39108a0 c047b1f4
df00:  c00096c4 c382cb40 c387a280 c387a280 c0332170 c3ffcb00 c3ffcb83
df20: c044baac c002a2a4 c03e5ae4 c382cb40 c382cb40 c044b2dc 0065 0006
df40: 0006 c044bac0 0064 c044bac0  0006 c048682c 0006
df60: c0486830 0065 c0492978 c04bbec0 c0486838 c0468d20 0006 0006
df80:  c046859c  c032c81c    
dfa0:  c032c824  c000a290    
dfc0:        
dfe0:     0013   
[] (atmci_probe) from [] (platform_drv_probe+0x38/0x6c)
[] (platform_drv_probe) from []
(driver_probe_device+0x1ac/0x3d8)
[] (driver_probe_device) from [] (__driver_attach+0x68/0x8c)
[] (__driver_attach) from [] (bus_for_each_dev+0x68/0x8c)
[] (bus_for_each_dev) from [] (bus_add_driver+0x110/0x23c)
[] (bus_add_driver) from [] (driver_register+0x9c/0xe0)
[] (driver_register) from [] (do_one_initcall+0x118/0x1dc)
[] (do_one_initcall) from []
(kernel_init_freeable+0xfc/0x1c0)
[] (kernel_init_freeable) from [] (kernel_init+0x8/0xe4)
[] (kernel_init) from [] (ret_from_fork+0x14/0x24)
Code: e5840030 1a14 e59430c8 e5933058 (e5932004)
---[ end trace 607b62d4422f7087 ]---

This occurs because the "host->pdev->dev.patform_data" is NULL because
I'm using a device tree to setup all the devices.

This patch checks pdata before dereferencing it.

Signed-off-by: Brent Taylor  gmail.com>

--- a/drivers/mmc/host/atmel-mci.c2016-03-13 00:10:57.527773324 -0600
+++ b/drivers/mmc/host/atmel-mci.c2016-03-13 00:10:44.903433138 -0600
@@ -2443,7 +2443,7 @@ static int atmci_configure_dma(struct at
struct mci_platform_data *pdata = host->pdev->dev.platform_data;
dma_cap_mask_t mask;

-   if (!pdata->dma_filter)
+   if (!pdata || !pdata->dma_filter)
return -ENODEV;

dma_cap_zero(mask);


[PATCH] mmc: atmel-mci: Check pdata for NULL before dereferencing it

2016-03-12 Thread Brent Taylor
I'm using an at91sam9g20ek development board, and I ran into a kernel
panic with 4.5.0-rc7:

atmel_mci fffa8000.mmc: version: 0x210
Unable to handle kernel NULL pointer dereference at virtual address 0004
pgd = c0004000
[0004] *pgd=
Internal error: Oops: 5 [#1] ARM
Modules linked in:
CPU: 0 PID: 1 Comm: swapper Not tainted 4.5.0-rc7 #5
Hardware name: Atmel AT91SAM9
task: c3838000 ti: c383c000 task.ti: c383c000
PC is at atmci_probe+0x3f8/0x7c4
LR is at dma_request_chan+0x134/0x158
pc : []lr : []psr: 6013
sp : c383de40  ip : 6013  fp : 0022
r10: c3910b60  r9 : c38da900  r8 : 0210
r7 : c38da910  r6 : c38c14d0  r5 :   r4 : c398b110
r3 :   r2 :   r1 : 0001  r0 : ffed
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 0005317f  Table: 20004000  DAC: 0053
Process swapper (pid: 1, stack limit = 0xc383c190)
Stack: (0xc383de40 to 0xc383e000)
de40: c38db360 c398b110 c38dc5f0 c0404386 c398dfa0  c0486838 c38da910
de60: c04ae2d0 c04ce424   c0486838 c04bbec0  c01e2318
de80: c38da910 c04ae2d0 c04ce424 c01e0c54 c04ae2d0 c38da910 c38da910 c38da944
dea0: c04ae2d0 c04a6568 c04b81c8 c01e0ee8  c04ae2d0 c01e0e80 c01df188
dec0: c382d58c c38d8570 c04ae2d0  c398c180 c01e0194 c0418298 c041829b
dee0: c04ae2d0 c047b1f4  c0497ea0 c0497ea0 c01e147c c39108a0 c047b1f4
df00:  c00096c4 c382cb40 c387a280 c387a280 c0332170 c3ffcb00 c3ffcb83
df20: c044baac c002a2a4 c03e5ae4 c382cb40 c382cb40 c044b2dc 0065 0006
df40: 0006 c044bac0 0064 c044bac0  0006 c048682c 0006
df60: c0486830 0065 c0492978 c04bbec0 c0486838 c0468d20 0006 0006
df80:  c046859c  c032c81c    
dfa0:  c032c824  c000a290    
dfc0:        
dfe0:     0013   
[] (atmci_probe) from [] (platform_drv_probe+0x38/0x6c)
[] (platform_drv_probe) from []
(driver_probe_device+0x1ac/0x3d8)
[] (driver_probe_device) from [] (__driver_attach+0x68/0x8c)
[] (__driver_attach) from [] (bus_for_each_dev+0x68/0x8c)
[] (bus_for_each_dev) from [] (bus_add_driver+0x110/0x23c)
[] (bus_add_driver) from [] (driver_register+0x9c/0xe0)
[] (driver_register) from [] (do_one_initcall+0x118/0x1dc)
[] (do_one_initcall) from []
(kernel_init_freeable+0xfc/0x1c0)
[] (kernel_init_freeable) from [] (kernel_init+0x8/0xe4)
[] (kernel_init) from [] (ret_from_fork+0x14/0x24)
Code: e5840030 1a14 e59430c8 e5933058 (e5932004)
---[ end trace 607b62d4422f7087 ]---

This occurs because the "host->pdev->dev.patform_data" is NULL because
I'm using a device tree to setup all the devices.

This patch checks pdata before dereferencing it.

Signed-off-by: Brent Taylor  gmail.com>

--- a/drivers/mmc/host/atmel-mci.c2016-03-13 00:10:57.527773324 -0600
+++ b/drivers/mmc/host/atmel-mci.c2016-03-13 00:10:44.903433138 -0600
@@ -2443,7 +2443,7 @@ static int atmci_configure_dma(struct at
struct mci_platform_data *pdata = host->pdev->dev.platform_data;
dma_cap_mask_t mask;

-   if (!pdata->dma_filter)
+   if (!pdata || !pdata->dma_filter)
return -ENODEV;

dma_cap_zero(mask);


Re: [PATCH V2] proc-vmcore: wrong data type casting fix

2016-03-12 Thread Xunlei Pang
On 2016/03/12 at 21:59, Baoquan He wrote:
> On 03/12/16 at 08:43pm, Xunlei Pang wrote:
>> On 2016/03/12 at 12:49, Dave Young wrote:
>>> Hi, Andrew
>>>
>>> On 03/11/16 at 12:27pm, Andrew Morton wrote:
 On Fri, 11 Mar 2016 16:42:48 +0800 Dave Young  wrote:

> On i686 PAE enabled machine the contiguous physical area could be large
> and it can cause trimming down variables in below calculation in
> read_vmcore() and mmap_vmcore():
>
>   tsz = min_t(size_t, m->offset + m->size - *fpos, buflen);
>
> Then the real size passed down is not correct any more.
> Suppose m->offset + m->size - *fpos being truncated to 0, buflen >0 then
> we will get tsz = 0. It is of course not an expected result.
 I don't really understand this.

 vmcore.offset if loff_t which is 64-bit
 vmcore.size is long long
 *fpos is loff_t

 so the expression should all be done with 64-bit arithmetic anyway.
>>> #define min_t(type, x, y) ({\
>>> type __min1 = (x);  \
>>> type __min2 = (y);  \
>>> __min1 < __min2 ? __min1: __min2; })
>>>
>>> Here x = m->offset + m->size - *fpos; the expression is done with 64bit
>>> arithmetic, it is true. But x will be cast to size_t then compare x with y
>>> The casting will cause problem.
>>>
 Maybe buflen (size_t) has the wrong type, but the result of the other
 expression should be in-range by the time we come to doing the
 comparison.

> During our tests there are two problems caused by it:
> 1) read_vmcore will refuse to continue so makedumpfile fails.
> 2) mmap_vmcore will trigger BUG_ON() in remap_pfn_range().
>
> Use unsigned long long in min_t instead so that the variables are not
> truncated.
>
> Signed-off-by: Baoquan He 
> Signed-off-by: Dave Young 
 I think we'll need a cc:stable here.
>>> Agreed. Do you think I need repost for this?
>>>
> --- linux-x86.orig/fs/proc/vmcore.c
> +++ linux-x86/fs/proc/vmcore.c
> @@ -231,7 +231,9 @@ static ssize_t __read_vmcore(char *buffe
>  
>   list_for_each_entry(m, _list, list) {
>   if (*fpos < m->offset + m->size) {
> - tsz = min_t(size_t, m->offset + m->size - *fpos, 
> buflen);
> + tsz = (size_t)min_t(unsigned long long,
> + m->offset + m->size - *fpos,
> + buflen);
 This is rather a mess.  Can we please try to fix this bug by choosing
 appropriate types rather than all the typecasting?
>>> file read/mmap buflen is size_t, so tsz is alwyas less then buflen unless
>>> m->offset + m->size - *fpos < buflen. The only problem is we need avoid 
>>> large
>>> value of m->offset + m->size - *fpos being casted thus it will mistakenly be
>>> less than buflen.
>> *
>> Can we use "tsz = min(m->offset + m->size - *fpos, buflen)" instead?
>> I think it's ok for this case (both have positive values), nothing will go 
>> wrong,
>> also can make the code cleaner.
> We can't. Macro min() has a type checking. min_t is necessary here.


You're right, missed that :-)

Regards,
Xunlei

>
>> *
>   start = m->paddr + *fpos - m->offset;
>   tmp = read_from_oldmem(buffer, tsz, , userbuf);
>   if (tmp < 0)
> @@ -461,7 +463,8 @@ static int mmap_vmcore(struct file *file
>   if (start < m->offset + m->size) {
>   u64 paddr = 0;
>  
> - tsz = min_t(size_t, m->offset + m->size - start, size);
> + tsz = (size_t)min_t(unsigned long long,
> + m->offset + m->size - start, size);
>   paddr = m->paddr + start - m->offset;
>   if (vmcore_remap_oldmem_pfn(vma, vma->vm_start + len,
>   paddr >> PAGE_SHIFT, tsz,
>>> Thanks
>>> Dave
> ___
> kexec mailing list
> ke...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec



Re: [PATCH V2] proc-vmcore: wrong data type casting fix

2016-03-12 Thread Xunlei Pang
On 2016/03/12 at 21:59, Baoquan He wrote:
> On 03/12/16 at 08:43pm, Xunlei Pang wrote:
>> On 2016/03/12 at 12:49, Dave Young wrote:
>>> Hi, Andrew
>>>
>>> On 03/11/16 at 12:27pm, Andrew Morton wrote:
 On Fri, 11 Mar 2016 16:42:48 +0800 Dave Young  wrote:

> On i686 PAE enabled machine the contiguous physical area could be large
> and it can cause trimming down variables in below calculation in
> read_vmcore() and mmap_vmcore():
>
>   tsz = min_t(size_t, m->offset + m->size - *fpos, buflen);
>
> Then the real size passed down is not correct any more.
> Suppose m->offset + m->size - *fpos being truncated to 0, buflen >0 then
> we will get tsz = 0. It is of course not an expected result.
 I don't really understand this.

 vmcore.offset if loff_t which is 64-bit
 vmcore.size is long long
 *fpos is loff_t

 so the expression should all be done with 64-bit arithmetic anyway.
>>> #define min_t(type, x, y) ({\
>>> type __min1 = (x);  \
>>> type __min2 = (y);  \
>>> __min1 < __min2 ? __min1: __min2; })
>>>
>>> Here x = m->offset + m->size - *fpos; the expression is done with 64bit
>>> arithmetic, it is true. But x will be cast to size_t then compare x with y
>>> The casting will cause problem.
>>>
 Maybe buflen (size_t) has the wrong type, but the result of the other
 expression should be in-range by the time we come to doing the
 comparison.

> During our tests there are two problems caused by it:
> 1) read_vmcore will refuse to continue so makedumpfile fails.
> 2) mmap_vmcore will trigger BUG_ON() in remap_pfn_range().
>
> Use unsigned long long in min_t instead so that the variables are not
> truncated.
>
> Signed-off-by: Baoquan He 
> Signed-off-by: Dave Young 
 I think we'll need a cc:stable here.
>>> Agreed. Do you think I need repost for this?
>>>
> --- linux-x86.orig/fs/proc/vmcore.c
> +++ linux-x86/fs/proc/vmcore.c
> @@ -231,7 +231,9 @@ static ssize_t __read_vmcore(char *buffe
>  
>   list_for_each_entry(m, _list, list) {
>   if (*fpos < m->offset + m->size) {
> - tsz = min_t(size_t, m->offset + m->size - *fpos, 
> buflen);
> + tsz = (size_t)min_t(unsigned long long,
> + m->offset + m->size - *fpos,
> + buflen);
 This is rather a mess.  Can we please try to fix this bug by choosing
 appropriate types rather than all the typecasting?
>>> file read/mmap buflen is size_t, so tsz is alwyas less then buflen unless
>>> m->offset + m->size - *fpos < buflen. The only problem is we need avoid 
>>> large
>>> value of m->offset + m->size - *fpos being casted thus it will mistakenly be
>>> less than buflen.
>> *
>> Can we use "tsz = min(m->offset + m->size - *fpos, buflen)" instead?
>> I think it's ok for this case (both have positive values), nothing will go 
>> wrong,
>> also can make the code cleaner.
> We can't. Macro min() has a type checking. min_t is necessary here.


You're right, missed that :-)

Regards,
Xunlei

>
>> *
>   start = m->paddr + *fpos - m->offset;
>   tmp = read_from_oldmem(buffer, tsz, , userbuf);
>   if (tmp < 0)
> @@ -461,7 +463,8 @@ static int mmap_vmcore(struct file *file
>   if (start < m->offset + m->size) {
>   u64 paddr = 0;
>  
> - tsz = min_t(size_t, m->offset + m->size - start, size);
> + tsz = (size_t)min_t(unsigned long long,
> + m->offset + m->size - start, size);
>   paddr = m->paddr + start - m->offset;
>   if (vmcore_remap_oldmem_pfn(vma, vma->vm_start + len,
>   paddr >> PAGE_SHIFT, tsz,
>>> Thanks
>>> Dave
> ___
> kexec mailing list
> ke...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/kexec



drivers/mfd/syscon.c:89:2: error: implicit declaration of function 'iounmap'

2016-03-12 Thread kbuild test robot
Hi Rob,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   f414ca64be4b36c30deb5b5fa25c5a8ff42ea56b
commit: 0166dc11be911213e0b1b764488c671be4c48cf3 of: make CONFIG_OF user 
selectable
date:   9 months ago
config: um-allyesconfig (attached as .config)
reproduce:
git checkout 0166dc11be911213e0b1b764488c671be4c48cf3
# save the attached .config to linux build tree
make ARCH=um 

All errors (new ones prefixed by >>):

   drivers/mfd/syscon.c: In function 'of_syscon_register':
>> drivers/mfd/syscon.c:89:2: error: implicit declaration of function 'iounmap' 
>> [-Werror=implicit-function-declaration]
 iounmap(base);
 ^
   cc1: some warnings being treated as errors

vim +/iounmap +89 drivers/mfd/syscon.c

bdb0066d Pankaj Dubey 2014-09-30  73if (IS_ERR(regmap)) {
bdb0066d Pankaj Dubey 2014-09-30  74pr_err("regmap init failed\n");
bdb0066d Pankaj Dubey 2014-09-30  75ret = PTR_ERR(regmap);
bdb0066d Pankaj Dubey 2014-09-30  76goto err_regmap;
bdb0066d Pankaj Dubey 2014-09-30  77}
bdb0066d Pankaj Dubey 2014-09-30  78  
bdb0066d Pankaj Dubey 2014-09-30  79syscon->regmap = regmap;
bdb0066d Pankaj Dubey 2014-09-30  80syscon->np = np;
bdb0066d Pankaj Dubey 2014-09-30  81  
bdb0066d Pankaj Dubey 2014-09-30  82spin_lock(_list_slock);
bdb0066d Pankaj Dubey 2014-09-30  83list_add_tail(>list, 
_list);
bdb0066d Pankaj Dubey 2014-09-30  84spin_unlock(_list_slock);
87d68730 Dong Aisheng 2012-09-05  85  
bdb0066d Pankaj Dubey 2014-09-30  86return syscon;
bdb0066d Pankaj Dubey 2014-09-30  87  
bdb0066d Pankaj Dubey 2014-09-30  88  err_regmap:
bdb0066d Pankaj Dubey 2014-09-30 @89iounmap(base);
bdb0066d Pankaj Dubey 2014-09-30  90  err_map:
bdb0066d Pankaj Dubey 2014-09-30  91kfree(syscon);
bdb0066d Pankaj Dubey 2014-09-30  92return ERR_PTR(ret);
87d68730 Dong Aisheng 2012-09-05  93  }
87d68730 Dong Aisheng 2012-09-05  94  
87d68730 Dong Aisheng 2012-09-05  95  struct regmap 
*syscon_node_to_regmap(struct device_node *np)
87d68730 Dong Aisheng 2012-09-05  96  {
bdb0066d Pankaj Dubey 2014-09-30  97struct syscon *entry, *syscon = NULL;

:: The code at line 89 was first introduced by commit
:: bdb0066df96e74a4002125467ebe459feff1ebef mfd: syscon: Decouple syscon 
interface from platform devices

:: TO: Pankaj Dubey 
:: CC: Lee Jones 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


drivers/mfd/syscon.c:89:2: error: implicit declaration of function 'iounmap'

2016-03-12 Thread kbuild test robot
Hi Rob,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   f414ca64be4b36c30deb5b5fa25c5a8ff42ea56b
commit: 0166dc11be911213e0b1b764488c671be4c48cf3 of: make CONFIG_OF user 
selectable
date:   9 months ago
config: um-allyesconfig (attached as .config)
reproduce:
git checkout 0166dc11be911213e0b1b764488c671be4c48cf3
# save the attached .config to linux build tree
make ARCH=um 

All errors (new ones prefixed by >>):

   drivers/mfd/syscon.c: In function 'of_syscon_register':
>> drivers/mfd/syscon.c:89:2: error: implicit declaration of function 'iounmap' 
>> [-Werror=implicit-function-declaration]
 iounmap(base);
 ^
   cc1: some warnings being treated as errors

vim +/iounmap +89 drivers/mfd/syscon.c

bdb0066d Pankaj Dubey 2014-09-30  73if (IS_ERR(regmap)) {
bdb0066d Pankaj Dubey 2014-09-30  74pr_err("regmap init failed\n");
bdb0066d Pankaj Dubey 2014-09-30  75ret = PTR_ERR(regmap);
bdb0066d Pankaj Dubey 2014-09-30  76goto err_regmap;
bdb0066d Pankaj Dubey 2014-09-30  77}
bdb0066d Pankaj Dubey 2014-09-30  78  
bdb0066d Pankaj Dubey 2014-09-30  79syscon->regmap = regmap;
bdb0066d Pankaj Dubey 2014-09-30  80syscon->np = np;
bdb0066d Pankaj Dubey 2014-09-30  81  
bdb0066d Pankaj Dubey 2014-09-30  82spin_lock(_list_slock);
bdb0066d Pankaj Dubey 2014-09-30  83list_add_tail(>list, 
_list);
bdb0066d Pankaj Dubey 2014-09-30  84spin_unlock(_list_slock);
87d68730 Dong Aisheng 2012-09-05  85  
bdb0066d Pankaj Dubey 2014-09-30  86return syscon;
bdb0066d Pankaj Dubey 2014-09-30  87  
bdb0066d Pankaj Dubey 2014-09-30  88  err_regmap:
bdb0066d Pankaj Dubey 2014-09-30 @89iounmap(base);
bdb0066d Pankaj Dubey 2014-09-30  90  err_map:
bdb0066d Pankaj Dubey 2014-09-30  91kfree(syscon);
bdb0066d Pankaj Dubey 2014-09-30  92return ERR_PTR(ret);
87d68730 Dong Aisheng 2012-09-05  93  }
87d68730 Dong Aisheng 2012-09-05  94  
87d68730 Dong Aisheng 2012-09-05  95  struct regmap 
*syscon_node_to_regmap(struct device_node *np)
87d68730 Dong Aisheng 2012-09-05  96  {
bdb0066d Pankaj Dubey 2014-09-30  97struct syscon *entry, *syscon = NULL;

:: The code at line 89 was first introduced by commit
:: bdb0066df96e74a4002125467ebe459feff1ebef mfd: syscon: Decouple syscon 
interface from platform devices

:: TO: Pankaj Dubey 
:: CC: Lee Jones 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


include/linux/workqueue.h:186:2: error: dereferencing type-punned pointer will break strict-aliasing rules

2016-03-12 Thread kbuild test robot
Hi Guenter,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   fda604a4daa19ead458ce5471892fa1d4b382d82
commit: 398c7500a1f5f74e207bd2edca1b1721b3cc1f1e MIPS: VDSO: Fix build error 
with binutils 2.24 and earlier
date:   2 months ago
config: mips-allyesconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 398c7500a1f5f74e207bd2edca1b1721b3cc1f1e
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   In file included from include/linux/srcu.h:34:0,
from include/linux/notifier.h:15,
from arch/mips/include/asm/uprobes.h:9,
from include/linux/uprobes.h:61,
from include/linux/mm_types.h:13,
from arch/mips/include/asm/vdso.h:14,
from arch/mips/vdso/vdso.h:27,
from arch/mips/vdso/gettimeofday.c:11:
   include/linux/workqueue.h: In function 'work_static':
>> include/linux/workqueue.h:186:2: error: dereferencing type-punned pointer 
>> will break strict-aliasing rules [-Werror=strict-aliasing]
 return *work_data_bits(work) & WORK_STRUCT_STATIC;
 ^
   cc1: all warnings being treated as errors

vim +186 include/linux/workqueue.h

dd6414b5 Phil Carmody2010-10-20  170  
65f27f38 David Howells   2006-11-22  171  #define DECLARE_WORK(n, f)
\
65f27f38 David Howells   2006-11-22  172struct work_struct n = 
__WORK_INITIALIZER(n, f)
65f27f38 David Howells   2006-11-22  173  
65f27f38 David Howells   2006-11-22  174  #define DECLARE_DELAYED_WORK(n, f)
\
f991b318 Tejun Heo   2012-08-21  175struct delayed_work n = 
__DELAYED_WORK_INITIALIZER(n, f, 0)
65f27f38 David Howells   2006-11-22  176  
203b42f7 Tejun Heo   2012-08-21  177  #define DECLARE_DEFERRABLE_WORK(n, f) 
\
f991b318 Tejun Heo   2012-08-21  178struct delayed_work n = 
__DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE)
dd6414b5 Phil Carmody2010-10-20  179  
dc186ad7 Thomas Gleixner 2009-11-16  180  #ifdef CONFIG_DEBUG_OBJECTS_WORK
dc186ad7 Thomas Gleixner 2009-11-16  181  extern void __init_work(struct 
work_struct *work, int onstack);
dc186ad7 Thomas Gleixner 2009-11-16  182  extern void 
destroy_work_on_stack(struct work_struct *work);
ea2e64f2 Thomas Gleixner 2014-03-23  183  extern void 
destroy_delayed_work_on_stack(struct delayed_work *work);
4690c4ab Tejun Heo   2010-06-29  184  static inline unsigned int 
work_static(struct work_struct *work)
4690c4ab Tejun Heo   2010-06-29  185  {
22df02bb Tejun Heo   2010-06-29 @186return *work_data_bits(work) & 
WORK_STRUCT_STATIC;
4690c4ab Tejun Heo   2010-06-29  187  }
dc186ad7 Thomas Gleixner 2009-11-16  188  #else
dc186ad7 Thomas Gleixner 2009-11-16  189  static inline void __init_work(struct 
work_struct *work, int onstack) { }
dc186ad7 Thomas Gleixner 2009-11-16  190  static inline void 
destroy_work_on_stack(struct work_struct *work) { }
ea2e64f2 Thomas Gleixner 2014-03-23  191  static inline void 
destroy_delayed_work_on_stack(struct delayed_work *work) { }
4690c4ab Tejun Heo   2010-06-29  192  static inline unsigned int 
work_static(struct work_struct *work) { return 0; }
dc186ad7 Thomas Gleixner 2009-11-16  193  #endif
dc186ad7 Thomas Gleixner 2009-11-16  194  

:: The code at line 186 was first introduced by commit
:: 22df02bb3fab24af97bff4c69cc6fd8529fc66fe workqueue: define masks for 
work flags and conditionalize STATIC flags

:: TO: Tejun Heo 
:: CC: Tejun Heo 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


include/linux/workqueue.h:186:2: error: dereferencing type-punned pointer will break strict-aliasing rules

2016-03-12 Thread kbuild test robot
Hi Guenter,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   fda604a4daa19ead458ce5471892fa1d4b382d82
commit: 398c7500a1f5f74e207bd2edca1b1721b3cc1f1e MIPS: VDSO: Fix build error 
with binutils 2.24 and earlier
date:   2 months ago
config: mips-allyesconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 398c7500a1f5f74e207bd2edca1b1721b3cc1f1e
# save the attached .config to linux build tree
make.cross ARCH=mips 

All errors (new ones prefixed by >>):

   In file included from include/linux/srcu.h:34:0,
from include/linux/notifier.h:15,
from arch/mips/include/asm/uprobes.h:9,
from include/linux/uprobes.h:61,
from include/linux/mm_types.h:13,
from arch/mips/include/asm/vdso.h:14,
from arch/mips/vdso/vdso.h:27,
from arch/mips/vdso/gettimeofday.c:11:
   include/linux/workqueue.h: In function 'work_static':
>> include/linux/workqueue.h:186:2: error: dereferencing type-punned pointer 
>> will break strict-aliasing rules [-Werror=strict-aliasing]
 return *work_data_bits(work) & WORK_STRUCT_STATIC;
 ^
   cc1: all warnings being treated as errors

vim +186 include/linux/workqueue.h

dd6414b5 Phil Carmody2010-10-20  170  
65f27f38 David Howells   2006-11-22  171  #define DECLARE_WORK(n, f)
\
65f27f38 David Howells   2006-11-22  172struct work_struct n = 
__WORK_INITIALIZER(n, f)
65f27f38 David Howells   2006-11-22  173  
65f27f38 David Howells   2006-11-22  174  #define DECLARE_DELAYED_WORK(n, f)
\
f991b318 Tejun Heo   2012-08-21  175struct delayed_work n = 
__DELAYED_WORK_INITIALIZER(n, f, 0)
65f27f38 David Howells   2006-11-22  176  
203b42f7 Tejun Heo   2012-08-21  177  #define DECLARE_DEFERRABLE_WORK(n, f) 
\
f991b318 Tejun Heo   2012-08-21  178struct delayed_work n = 
__DELAYED_WORK_INITIALIZER(n, f, TIMER_DEFERRABLE)
dd6414b5 Phil Carmody2010-10-20  179  
dc186ad7 Thomas Gleixner 2009-11-16  180  #ifdef CONFIG_DEBUG_OBJECTS_WORK
dc186ad7 Thomas Gleixner 2009-11-16  181  extern void __init_work(struct 
work_struct *work, int onstack);
dc186ad7 Thomas Gleixner 2009-11-16  182  extern void 
destroy_work_on_stack(struct work_struct *work);
ea2e64f2 Thomas Gleixner 2014-03-23  183  extern void 
destroy_delayed_work_on_stack(struct delayed_work *work);
4690c4ab Tejun Heo   2010-06-29  184  static inline unsigned int 
work_static(struct work_struct *work)
4690c4ab Tejun Heo   2010-06-29  185  {
22df02bb Tejun Heo   2010-06-29 @186return *work_data_bits(work) & 
WORK_STRUCT_STATIC;
4690c4ab Tejun Heo   2010-06-29  187  }
dc186ad7 Thomas Gleixner 2009-11-16  188  #else
dc186ad7 Thomas Gleixner 2009-11-16  189  static inline void __init_work(struct 
work_struct *work, int onstack) { }
dc186ad7 Thomas Gleixner 2009-11-16  190  static inline void 
destroy_work_on_stack(struct work_struct *work) { }
ea2e64f2 Thomas Gleixner 2014-03-23  191  static inline void 
destroy_delayed_work_on_stack(struct delayed_work *work) { }
4690c4ab Tejun Heo   2010-06-29  192  static inline unsigned int 
work_static(struct work_struct *work) { return 0; }
dc186ad7 Thomas Gleixner 2009-11-16  193  #endif
dc186ad7 Thomas Gleixner 2009-11-16  194  

:: The code at line 186 was first introduced by commit
:: 22df02bb3fab24af97bff4c69cc6fd8529fc66fe workqueue: define masks for 
work flags and conditionalize STATIC flags

:: TO: Tejun Heo 
:: CC: Tejun Heo 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH] block: don't optimize for non-cloned bio in bio_get_last_bvec()

2016-03-12 Thread Jens Axboe

On 03/12/2016 08:58 PM, Jens Axboe wrote:

On 03/12/2016 07:56 AM, Ming Lei wrote:

For !BIO_CLONED bio, we can use .bi_vcnt safely, but it
doesn't mean we can just simply return .bi_io_vec[.bi_vcnt - 1]
because the start postion may have been moved in the middle of
the bvec, such as splitting in the middle of bvec.


Added and tested.


And Ming, let's not get a repeat of this situation. For critical fixes, 
it has to be spot on for post -rc1, especially for code that is 
notoriously difficult to get right. Fixes are obviously fine, but it has 
to be just enough to fix the regression, no more. This has been too lax, 
I expect this to improve.


--
Jens Axboe



Re: [PATCH] block: don't optimize for non-cloned bio in bio_get_last_bvec()

2016-03-12 Thread Jens Axboe

On 03/12/2016 08:58 PM, Jens Axboe wrote:

On 03/12/2016 07:56 AM, Ming Lei wrote:

For !BIO_CLONED bio, we can use .bi_vcnt safely, but it
doesn't mean we can just simply return .bi_io_vec[.bi_vcnt - 1]
because the start postion may have been moved in the middle of
the bvec, such as splitting in the middle of bvec.


Added and tested.


And Ming, let's not get a repeat of this situation. For critical fixes, 
it has to be spot on for post -rc1, especially for code that is 
notoriously difficult to get right. Fixes are obviously fine, but it has 
to be just enough to fix the regression, no more. This has been too lax, 
I expect this to improve.


--
Jens Axboe



Re: [PATCH] media: au0828 fix to clear enable/disable/change source handlers

2016-03-12 Thread kbuild test robot
Hi Shuah,

[auto build test ERROR on sailus-media/master]
[also build test ERROR on next-20160311]
[cannot apply to v4.5-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Shuah-Khan/media-au0828-fix-to-clear-enable-disable-change-source-handlers/20160313-120037
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-x003-201611 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/media/usb/au0828/au0828-core.c: In function 
'au0828_unregister_media_device':
>> drivers/media/usb/au0828/au0828-core.c:144:17: error: 'struct media_device' 
>> has no member named 'change_source'
  dev->media_dev->change_source = NULL;
^

vim +144 drivers/media/usb/au0828/au0828-core.c

   138  if (dev->media_dev &&
   139  media_devnode_is_registered(>media_dev->devnode)) {
   140  /* clear enable_source, disable_source, change_source */
   141  dev->media_dev->source_priv = NULL;
   142  dev->media_dev->enable_source = NULL;
   143  dev->media_dev->disable_source = NULL;
 > 144  dev->media_dev->change_source = NULL;
   145  
   146  media_device_unregister(dev->media_dev);
   147  media_device_cleanup(dev->media_dev);

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Re: [PATCH] media: au0828 fix to clear enable/disable/change source handlers

2016-03-12 Thread kbuild test robot
Hi Shuah,

[auto build test ERROR on sailus-media/master]
[also build test ERROR on next-20160311]
[cannot apply to v4.5-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improving the system]

url:
https://github.com/0day-ci/linux/commits/Shuah-Khan/media-au0828-fix-to-clear-enable-disable-change-source-handlers/20160313-120037
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-x003-201611 (attached as .config)
reproduce:
# save the attached .config to linux build tree
make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/media/usb/au0828/au0828-core.c: In function 
'au0828_unregister_media_device':
>> drivers/media/usb/au0828/au0828-core.c:144:17: error: 'struct media_device' 
>> has no member named 'change_source'
  dev->media_dev->change_source = NULL;
^

vim +144 drivers/media/usb/au0828/au0828-core.c

   138  if (dev->media_dev &&
   139  media_devnode_is_registered(>media_dev->devnode)) {
   140  /* clear enable_source, disable_source, change_source */
   141  dev->media_dev->source_priv = NULL;
   142  dev->media_dev->enable_source = NULL;
   143  dev->media_dev->disable_source = NULL;
 > 144  dev->media_dev->change_source = NULL;
   145  
   146  media_device_unregister(dev->media_dev);
   147  media_device_cleanup(dev->media_dev);

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


[GIT PULL] Block merge fix for 4.5-final

2016-03-12 Thread Jens Axboe
Hi Linus,

Please pull the following fix for 4.5-final, fixing a bug in a previous
commit.


  git://git.kernel.dk/linux-block.git for-linus



Ming Lei (1):
  block: don't optimize for non-cloned bio in bio_get_last_bvec()

 include/linux/bio.h | 5 -
 1 file changed, 5 deletions(-)

-- 
Jens Axboe



[GIT PULL] Block merge fix for 4.5-final

2016-03-12 Thread Jens Axboe
Hi Linus,

Please pull the following fix for 4.5-final, fixing a bug in a previous
commit.


  git://git.kernel.dk/linux-block.git for-linus



Ming Lei (1):
  block: don't optimize for non-cloned bio in bio_get_last_bvec()

 include/linux/bio.h | 5 -
 1 file changed, 5 deletions(-)

-- 
Jens Axboe



[PATCH] clk: rockchip: release io resource when failing to init clk

2016-03-12 Thread Shawn Lin
We should call iounmap to relase reg_base since it's not going
to be used any more if failing to init clk.

Signed-off-by: Shawn Lin 
---

 drivers/clk/rockchip/clk-rk3036.c | 1 +
 drivers/clk/rockchip/clk-rk3188.c | 1 +
 drivers/clk/rockchip/clk-rk3228.c | 1 +
 drivers/clk/rockchip/clk-rk3288.c | 1 +
 drivers/clk/rockchip/clk-rk3368.c | 1 +
 5 files changed, 5 insertions(+)

diff --git a/drivers/clk/rockchip/clk-rk3036.c 
b/drivers/clk/rockchip/clk-rk3036.c
index 8c683cc..284c36f 100644
--- a/drivers/clk/rockchip/clk-rk3036.c
+++ b/drivers/clk/rockchip/clk-rk3036.c
@@ -453,6 +453,7 @@ static void __init rk3036_clk_init(struct device_node *np)
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(reg_base);
return;
}
 
diff --git a/drivers/clk/rockchip/clk-rk3188.c 
b/drivers/clk/rockchip/clk-rk3188.c
index 0fcce22..d0e722a 100644
--- a/drivers/clk/rockchip/clk-rk3188.c
+++ b/drivers/clk/rockchip/clk-rk3188.c
@@ -773,6 +773,7 @@ static struct rockchip_clk_provider *__init 
rk3188_common_clk_init(struct device
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(reg_base);
return ERR_PTR(-ENOMEM);
}
 
diff --git a/drivers/clk/rockchip/clk-rk3228.c 
b/drivers/clk/rockchip/clk-rk3228.c
index c112b2f..016bdb0 100644
--- a/drivers/clk/rockchip/clk-rk3228.c
+++ b/drivers/clk/rockchip/clk-rk3228.c
@@ -640,6 +640,7 @@ static void __init rk3228_clk_init(struct device_node *np)
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(reg_base);
return;
}
 
diff --git a/drivers/clk/rockchip/clk-rk3288.c 
b/drivers/clk/rockchip/clk-rk3288.c
index d1031d1..39af05a 100644
--- a/drivers/clk/rockchip/clk-rk3288.c
+++ b/drivers/clk/rockchip/clk-rk3288.c
@@ -893,6 +893,7 @@ static void __init rk3288_clk_init(struct device_node *np)
ctx = rockchip_clk_init(np, rk3288_cru_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(rk3288_cru_base);
return;
}
 
diff --git a/drivers/clk/rockchip/clk-rk3368.c 
b/drivers/clk/rockchip/clk-rk3368.c
index 58690f2..3437289 100644
--- a/drivers/clk/rockchip/clk-rk3368.c
+++ b/drivers/clk/rockchip/clk-rk3368.c
@@ -875,6 +875,7 @@ static void __init rk3368_clk_init(struct device_node *np)
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(reg_base);
return;
}
 
-- 
2.3.7




[PATCH] clk: rockchip: release io resource when failing to init clk

2016-03-12 Thread Shawn Lin
We should call iounmap to relase reg_base since it's not going
to be used any more if failing to init clk.

Signed-off-by: Shawn Lin 
---

 drivers/clk/rockchip/clk-rk3036.c | 1 +
 drivers/clk/rockchip/clk-rk3188.c | 1 +
 drivers/clk/rockchip/clk-rk3228.c | 1 +
 drivers/clk/rockchip/clk-rk3288.c | 1 +
 drivers/clk/rockchip/clk-rk3368.c | 1 +
 5 files changed, 5 insertions(+)

diff --git a/drivers/clk/rockchip/clk-rk3036.c 
b/drivers/clk/rockchip/clk-rk3036.c
index 8c683cc..284c36f 100644
--- a/drivers/clk/rockchip/clk-rk3036.c
+++ b/drivers/clk/rockchip/clk-rk3036.c
@@ -453,6 +453,7 @@ static void __init rk3036_clk_init(struct device_node *np)
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(reg_base);
return;
}
 
diff --git a/drivers/clk/rockchip/clk-rk3188.c 
b/drivers/clk/rockchip/clk-rk3188.c
index 0fcce22..d0e722a 100644
--- a/drivers/clk/rockchip/clk-rk3188.c
+++ b/drivers/clk/rockchip/clk-rk3188.c
@@ -773,6 +773,7 @@ static struct rockchip_clk_provider *__init 
rk3188_common_clk_init(struct device
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(reg_base);
return ERR_PTR(-ENOMEM);
}
 
diff --git a/drivers/clk/rockchip/clk-rk3228.c 
b/drivers/clk/rockchip/clk-rk3228.c
index c112b2f..016bdb0 100644
--- a/drivers/clk/rockchip/clk-rk3228.c
+++ b/drivers/clk/rockchip/clk-rk3228.c
@@ -640,6 +640,7 @@ static void __init rk3228_clk_init(struct device_node *np)
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(reg_base);
return;
}
 
diff --git a/drivers/clk/rockchip/clk-rk3288.c 
b/drivers/clk/rockchip/clk-rk3288.c
index d1031d1..39af05a 100644
--- a/drivers/clk/rockchip/clk-rk3288.c
+++ b/drivers/clk/rockchip/clk-rk3288.c
@@ -893,6 +893,7 @@ static void __init rk3288_clk_init(struct device_node *np)
ctx = rockchip_clk_init(np, rk3288_cru_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(rk3288_cru_base);
return;
}
 
diff --git a/drivers/clk/rockchip/clk-rk3368.c 
b/drivers/clk/rockchip/clk-rk3368.c
index 58690f2..3437289 100644
--- a/drivers/clk/rockchip/clk-rk3368.c
+++ b/drivers/clk/rockchip/clk-rk3368.c
@@ -875,6 +875,7 @@ static void __init rk3368_clk_init(struct device_node *np)
ctx = rockchip_clk_init(np, reg_base, CLK_NR_CLKS);
if (IS_ERR(ctx)) {
pr_err("%s: rockchip clk init failed\n", __func__);
+   iounmap(reg_base);
return;
}
 
-- 
2.3.7




Re: [PATCH 0/6] arc_emac: fixes the emac issues oand cleanup emac drivers

2016-03-12 Thread Caesar Wang



在 2016年03月12日 02:46, Sergei Shtylyov 写道:

Hello.

On 03/11/2016 05:48 PM, Caesar Wang wrote:

[...]


Hi Rob, David:
PATCH[1/6-2/6]: >
net: arc_emac: make the rockchip emac document more compatible
net: arc_emac: add phy-reset-* are optional for device tree

The patches change the rockchip emac document for more compatible and
Add the phy-reset-* property for document.

This patch adds the following property for arc_emac.

phy-reset-* include the following:
1) phy-reset-gpios:
The phy-reset-gpios is an optional property for arc emac device 
tree boot.

Change the binding document to match the driver code.

2) phy-reset-duration:
Different boards may require different phy reset duration. Add 
property

phy-reset-duration for device tree probe, so that the boards that need
a longer reset duration can specify it in their device tree.

3) phy-reset-active-high:
We need that for a custom hardware that needs the reverse reset 
sequence.


   Why not infer this from the "phy-reset-gpios" prop?


See:
https://patchwork.kernel.org/patch/8564511/

>
phy-reset-active-high : If present then the reset sequence using the 
GPIO
  specified in the "phy-reset-gpios" property is reversed (H=reset 
state,

  L=operation state).


   Referring to your own suggested bindings isn't an answer. If the 
driver that you're copying from here (fec) had a reason to handle the 
GPIO sense with the help of an extra prop (legacy code), it doesn't 
mean your new driver needs to mimic this as well, AFAIU...


I know your suggestion is a fair request.

Oh, that copy from the 'freescale/fec_main.c' 

So, The exist way was old and unwise in mainline. :(

wxt@nb:~/kernel/drivers/net/ethernet$ ag reset-gpios
micrel/ks8851.c
1427:gpio = of_get_named_gpio_flags(spi->dev.of_node, "reset-gpios",

arc/emac_main.c
787:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
797:dev_err(dev, "failed to get phy-reset-gpios: %d\n", err);

arc/emac_main.c~
784:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
794:dev_err(dev, "failed to get phy-reset-gpios: %d\n", err);

davicom/dm9000.c
1451:reset_gpios = of_get_named_gpio_flags(dev->of_node, 
"reset-gpios", 0,


freescale/fec_main.c
3206:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
3216:dev_err(>dev, "failed to get phy-reset-gpios: %d\n", 
err);


cadence/macb.c
2958:int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0);

...


Anyway, I will update it with your suggestion.

Thanks,


Caesar








Thanks,

Caesar


MBR, Sergei


___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip



--
Thanks,
Caesar



Re: [PATCH 0/6] arc_emac: fixes the emac issues oand cleanup emac drivers

2016-03-12 Thread Caesar Wang



在 2016年03月12日 02:46, Sergei Shtylyov 写道:

Hello.

On 03/11/2016 05:48 PM, Caesar Wang wrote:

[...]


Hi Rob, David:
PATCH[1/6-2/6]: >
net: arc_emac: make the rockchip emac document more compatible
net: arc_emac: add phy-reset-* are optional for device tree

The patches change the rockchip emac document for more compatible and
Add the phy-reset-* property for document.

This patch adds the following property for arc_emac.

phy-reset-* include the following:
1) phy-reset-gpios:
The phy-reset-gpios is an optional property for arc emac device 
tree boot.

Change the binding document to match the driver code.

2) phy-reset-duration:
Different boards may require different phy reset duration. Add 
property

phy-reset-duration for device tree probe, so that the boards that need
a longer reset duration can specify it in their device tree.

3) phy-reset-active-high:
We need that for a custom hardware that needs the reverse reset 
sequence.


   Why not infer this from the "phy-reset-gpios" prop?


See:
https://patchwork.kernel.org/patch/8564511/

>
phy-reset-active-high : If present then the reset sequence using the 
GPIO
  specified in the "phy-reset-gpios" property is reversed (H=reset 
state,

  L=operation state).


   Referring to your own suggested bindings isn't an answer. If the 
driver that you're copying from here (fec) had a reason to handle the 
GPIO sense with the help of an extra prop (legacy code), it doesn't 
mean your new driver needs to mimic this as well, AFAIU...


I know your suggestion is a fair request.

Oh, that copy from the 'freescale/fec_main.c' 

So, The exist way was old and unwise in mainline. :(

wxt@nb:~/kernel/drivers/net/ethernet$ ag reset-gpios
micrel/ks8851.c
1427:gpio = of_get_named_gpio_flags(spi->dev.of_node, "reset-gpios",

arc/emac_main.c
787:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
797:dev_err(dev, "failed to get phy-reset-gpios: %d\n", err);

arc/emac_main.c~
784:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
794:dev_err(dev, "failed to get phy-reset-gpios: %d\n", err);

davicom/dm9000.c
1451:reset_gpios = of_get_named_gpio_flags(dev->of_node, 
"reset-gpios", 0,


freescale/fec_main.c
3206:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
3216:dev_err(>dev, "failed to get phy-reset-gpios: %d\n", 
err);


cadence/macb.c
2958:int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0);

...


Anyway, I will update it with your suggestion.

Thanks,


Caesar








Thanks,

Caesar


MBR, Sergei


___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip



--
Thanks,
Caesar



Re: [PATCH 3/6] net: arc_emac: support the phy reset for emac driver

2016-03-12 Thread Caesar Wang

Hi Sergei,

在 2016年03月12日 02:35, Sergei Shtylyov 写道:

On 03/11/2016 01:55 PM, Caesar Wang wrote:


This patch adds to support the emac phy reset.

1) phy-reset-gpios:
The phy-reset-gpios is an optional property for arc emac device tree 
boot.

Change the binding document to match the driver code.


   The binding document is apparently changed in another patch. Not 
sure what you wanted to say here...



2) phy-reset-duration:
Different boards may require different phy reset duration. Add property
phy-reset-duration for device tree probe, so that the boards that need
a longer reset duration can specify it in their device tree.

3) phy-reset-active-high:
We need that for a custom hardware that needs the reverse reset 
sequence.


   No, we don't really need that, "phy-reset-gpio" prop can contain 
this data.



Of course, this patch will fix the issue on
https://patchwork.kernel.org/patch/8186801/.

In some cases, the emac couldn't work if you don't have reset the phy.
Let's add it to happy work.

Signed-off-by: Caesar Wang 
---

  drivers/net/ethernet/arc/emac_main.c | 41 


  1 file changed, 41 insertions(+)

diff --git a/drivers/net/ethernet/arc/emac_main.c 
b/drivers/net/ethernet/arc/emac_main.c

index 6446af1..42384f6a 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -764,6 +764,45 @@ static const struct net_device_ops 
arc_emac_netdev_ops = {

  #endif
  };

+#ifdef CONFIG_OF
+static void emac_reset_phy(struct net_device *pdev)
+{
+int err, phy_reset;
+bool active_high = false;
+int msec = 10;
+struct device *dev = pdev->dev.parent;
+struct device_node *np = dev->of_node;
+
+if (!np)
+return;
+
+of_property_read_u32(np, "phy-reset-duration", );
+/* A sane reset duration should not be longer than 1s */
+if (msec > 1000)
+msec = 1;
+
+phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);


   Forgot to say that these old integer-base GPIO APIs shouldn't be 
used by the new code, there's new 'struct gpio_desc' based APIs, like 
devm_gpiod_get() etc.



+if (!gpio_is_valid(phy_reset))
+return;
+
+active_high = of_property_read_bool(np, "phy-reset-active-high");


   Well, I still don't understand why this prop is needed, while the 
GPIO sense is transparently handled by the gpiolib (at least when 
using DT).


Okay, I have to admit that reference the exist way to do...


wxt@nb:~/kernel/drivers/net/ethernet$ ag reset-gpios
micrel/ks8851.c
1427:gpio = of_get_named_gpio_flags(spi->dev.of_node, "reset-gpios",

arc/emac_main.c
787:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
797:dev_err(dev, "failed to get phy-reset-gpios: %d\n", err);

arc/emac_main.c~
784:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
794:dev_err(dev, "failed to get phy-reset-gpios: %d\n", err);

davicom/dm9000.c
1451:reset_gpios = of_get_named_gpio_flags(dev->of_node, 
"reset-gpios", 0,


freescale/fec_main.c
3206:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
3216:dev_err(>dev, "failed to get phy-reset-gpios: %d\n", 
err);


cadence/macb.c
2958:int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0);

...

Yep, the gpiolib that can include the prop to work with the same ways.





[...]

MBR, Sergei


___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip



--
Thanks,
Caesar



Re: [PATCH] block: don't optimize for non-cloned bio in bio_get_last_bvec()

2016-03-12 Thread Jens Axboe

On 03/12/2016 07:56 AM, Ming Lei wrote:

For !BIO_CLONED bio, we can use .bi_vcnt safely, but it
doesn't mean we can just simply return .bi_io_vec[.bi_vcnt - 1]
because the start postion may have been moved in the middle of
the bvec, such as splitting in the middle of bvec.


Added and tested.

--
Jens Axboe



Re: [PATCH 3/6] net: arc_emac: support the phy reset for emac driver

2016-03-12 Thread Caesar Wang

Hi Sergei,

在 2016年03月12日 02:35, Sergei Shtylyov 写道:

On 03/11/2016 01:55 PM, Caesar Wang wrote:


This patch adds to support the emac phy reset.

1) phy-reset-gpios:
The phy-reset-gpios is an optional property for arc emac device tree 
boot.

Change the binding document to match the driver code.


   The binding document is apparently changed in another patch. Not 
sure what you wanted to say here...



2) phy-reset-duration:
Different boards may require different phy reset duration. Add property
phy-reset-duration for device tree probe, so that the boards that need
a longer reset duration can specify it in their device tree.

3) phy-reset-active-high:
We need that for a custom hardware that needs the reverse reset 
sequence.


   No, we don't really need that, "phy-reset-gpio" prop can contain 
this data.



Of course, this patch will fix the issue on
https://patchwork.kernel.org/patch/8186801/.

In some cases, the emac couldn't work if you don't have reset the phy.
Let's add it to happy work.

Signed-off-by: Caesar Wang 
---

  drivers/net/ethernet/arc/emac_main.c | 41 


  1 file changed, 41 insertions(+)

diff --git a/drivers/net/ethernet/arc/emac_main.c 
b/drivers/net/ethernet/arc/emac_main.c

index 6446af1..42384f6a 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -764,6 +764,45 @@ static const struct net_device_ops 
arc_emac_netdev_ops = {

  #endif
  };

+#ifdef CONFIG_OF
+static void emac_reset_phy(struct net_device *pdev)
+{
+int err, phy_reset;
+bool active_high = false;
+int msec = 10;
+struct device *dev = pdev->dev.parent;
+struct device_node *np = dev->of_node;
+
+if (!np)
+return;
+
+of_property_read_u32(np, "phy-reset-duration", );
+/* A sane reset duration should not be longer than 1s */
+if (msec > 1000)
+msec = 1;
+
+phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);


   Forgot to say that these old integer-base GPIO APIs shouldn't be 
used by the new code, there's new 'struct gpio_desc' based APIs, like 
devm_gpiod_get() etc.



+if (!gpio_is_valid(phy_reset))
+return;
+
+active_high = of_property_read_bool(np, "phy-reset-active-high");


   Well, I still don't understand why this prop is needed, while the 
GPIO sense is transparently handled by the gpiolib (at least when 
using DT).


Okay, I have to admit that reference the exist way to do...


wxt@nb:~/kernel/drivers/net/ethernet$ ag reset-gpios
micrel/ks8851.c
1427:gpio = of_get_named_gpio_flags(spi->dev.of_node, "reset-gpios",

arc/emac_main.c
787:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
797:dev_err(dev, "failed to get phy-reset-gpios: %d\n", err);

arc/emac_main.c~
784:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
794:dev_err(dev, "failed to get phy-reset-gpios: %d\n", err);

davicom/dm9000.c
1451:reset_gpios = of_get_named_gpio_flags(dev->of_node, 
"reset-gpios", 0,


freescale/fec_main.c
3206:phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
3216:dev_err(>dev, "failed to get phy-reset-gpios: %d\n", 
err);


cadence/macb.c
2958:int gpio = of_get_named_gpio(phy_node, "reset-gpios", 0);

...

Yep, the gpiolib that can include the prop to work with the same ways.





[...]

MBR, Sergei


___
Linux-rockchip mailing list
linux-rockc...@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip



--
Thanks,
Caesar



Re: [PATCH] block: don't optimize for non-cloned bio in bio_get_last_bvec()

2016-03-12 Thread Jens Axboe

On 03/12/2016 07:56 AM, Ming Lei wrote:

For !BIO_CLONED bio, we can use .bi_vcnt safely, but it
doesn't mean we can just simply return .bi_io_vec[.bi_vcnt - 1]
because the start postion may have been moved in the middle of
the bvec, such as splitting in the middle of bvec.


Added and tested.

--
Jens Axboe



[PATCH] media: au0828 fix to clear enable/disable/change source handlers

2016-03-12 Thread Shuah Khan
Fix to clear enable/disable/change source handlers in the media device
when media device is unregistered in au0828_unregister_media_device().
When au0828 module is removed, snd-usb-audio shouldn't call the handlers.
Clearing will ensure snd-usb-audio won't call them once au0828 is removed.

Signed-off-by: Shuah Khan 
---
 drivers/media/usb/au0828/au0828-core.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/usb/au0828/au0828-core.c 
b/drivers/media/usb/au0828/au0828-core.c
index de9ab11..abdb956 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -137,6 +137,12 @@ static void au0828_unregister_media_device(struct 
au0828_dev *dev)
 #ifdef CONFIG_MEDIA_CONTROLLER
if (dev->media_dev &&
media_devnode_is_registered(>media_dev->devnode)) {
+   /* clear enable_source, disable_source, change_source */
+   dev->media_dev->source_priv = NULL;
+   dev->media_dev->enable_source = NULL;
+   dev->media_dev->disable_source = NULL;
+   dev->media_dev->change_source = NULL;
+
media_device_unregister(dev->media_dev);
media_device_cleanup(dev->media_dev);
dev->media_dev = NULL;
-- 
2.5.0



[PATCH] media: au0828 fix to clear enable/disable/change source handlers

2016-03-12 Thread Shuah Khan
Fix to clear enable/disable/change source handlers in the media device
when media device is unregistered in au0828_unregister_media_device().
When au0828 module is removed, snd-usb-audio shouldn't call the handlers.
Clearing will ensure snd-usb-audio won't call them once au0828 is removed.

Signed-off-by: Shuah Khan 
---
 drivers/media/usb/au0828/au0828-core.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/media/usb/au0828/au0828-core.c 
b/drivers/media/usb/au0828/au0828-core.c
index de9ab11..abdb956 100644
--- a/drivers/media/usb/au0828/au0828-core.c
+++ b/drivers/media/usb/au0828/au0828-core.c
@@ -137,6 +137,12 @@ static void au0828_unregister_media_device(struct 
au0828_dev *dev)
 #ifdef CONFIG_MEDIA_CONTROLLER
if (dev->media_dev &&
media_devnode_is_registered(>media_dev->devnode)) {
+   /* clear enable_source, disable_source, change_source */
+   dev->media_dev->source_priv = NULL;
+   dev->media_dev->enable_source = NULL;
+   dev->media_dev->disable_source = NULL;
+   dev->media_dev->change_source = NULL;
+
media_device_unregister(dev->media_dev);
media_device_cleanup(dev->media_dev);
dev->media_dev = NULL;
-- 
2.5.0



Re: [PATCH] staging: dgap: dgap.c: Fixed a comment warning

2016-03-12 Thread Greg KH
On Sat, Mar 12, 2016 at 05:03:01PM -0800, Gavin O'Leary wrote:
> Signed-off-by: Gavin O'Leary 

I can't take a patch without a changelog entry.

greg k-h


Re: [PATCH] staging: dgap: dgap.c: fixed whitespace error caused by my patch

2016-03-12 Thread Greg KH
On Sat, Mar 12, 2016 at 05:10:29PM -0800, Gavin O'Leary wrote:
> Signed-off-by: Gavin O'Leary 
> ---
>  drivers/staging/dgap/dgap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
> index 9e07a39..7845516 100644
> --- a/drivers/staging/dgap/dgap.c
> +++ b/drivers/staging/dgap/dgap.c
> @@ -4819,7 +4819,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, 
> unsigned int cmd,
>  
>   case TCSBRKP:
>   /* support for POSIX tcsendbreak()
> -  * 
> +  *

No, you need to fix up your previous patch and get it right.



Re: [RFC PATCH 1/3] siox: new driver/bus framework for Eckelmann SIOX

2016-03-12 Thread Greg Kroah-Hartman
On Sat, Mar 12, 2016 at 02:43:21PM +0100, Uwe Kleine-König wrote:
> Hello Greg,
> 
> On Fri, Mar 11, 2016 at 02:20:39PM -0800, Greg Kroah-Hartman wrote:
> > On Fri, Mar 11, 2016 at 10:52:12PM +0100, Uwe Kleine-König wrote:
> > > Signed-off-by: Uwe Kleine-König 
> > > ---
> > >  drivers/Kconfig  |   2 +
> > >  drivers/Makefile |   1 +
> > >  drivers/siox/Kconfig |   2 +
> > >  drivers/siox/Makefile|   1 +
> > >  drivers/siox/siox-core.c | 572 
> > > +++
> > >  drivers/siox/siox.h  |  48 
> > >  include/linux/siox.h |  53 +
> > >  7 files changed, 679 insertions(+)
> > >  create mode 100644 drivers/siox/Kconfig
> > >  create mode 100644 drivers/siox/Makefile
> > >  create mode 100644 drivers/siox/siox-core.c
> > >  create mode 100644 drivers/siox/siox.h
> > >  create mode 100644 include/linux/siox.h
> > 
> > What's the relationship between your "master" and "regular" devices
> > here?  I think that's getting things confused, you are unregistering
> > your 'master' yet the children it controls don't go away because you
> > never unregister them.  You need to fix this heirachy up a bit, and
> > maybe just drop the 'master' logic?
> 
> A master is the bus controller (i.e. it drives DOUT, DCLK and DLD). A
> device is a consumer and provides DIN to the master.
> 
> The topology looks as follows:
> 
>   ,--->--DCLK-->---+--.
>   ^v  v
>  ,.,--.   ,--
>  |||   ,--.   |   |
>  ||--->--DOUT-->---|->-|shift register|->-|--->---|
>  |||   `--'   |   |
>  | master ||device|   |  device
>  |||   ,--.   |   |
>  ||---<--DIN---<---|-<-|shift register|-<-|---<---|
>  |||   `--'   |   |
>  `'`--'   `--
>   v^  ^
>   `--DLD---+--'
> 
> So there are two chains of shift registers, one for letting the master
> write to the devices, and the other to let the master read from the
> devices. DCLK is the clock to shift both chains by a single bit. An edge
> on DLD is used to make the devices load the inputs and sample the
> outputs.
> 
> I think I need the following:
> 
>   void siox_unregister_master(struct siox_master *smaster)
>   {
>   for (each siox_device d of smaster)
>   siox_device_remove(d);
> 
>   device_unregister(>dev);
>   }

Yes, you have to do this, as that's how USB and other busses do it when
their "controllers" go away.

> But the locking scheme that is necessary isn't obvious for me. For
> example I must prevent that after the for loop is done a new device is
> registered. Do I need to prevent this explicitly (e.g. by doing
> something like:
> 
>   lock(smaster);
>   smaster->is_going_away = true;
>   for (each siox_device d of smaster)
>   siox_device_remove(d);
>   unlock(smaster);
> 
>   device_unregister(>dev);
> 
> and let registering new devices fail if smaster->is_going_away is true?)
> Or is there something that the kobject stuff/driver core can help me
> with?

Look at what happens when you remove a USB host controller with the
locking there, it shouldn't be that hard.

thanks,

greg k-h


Re: [PATCH 4.4 00/74] 4.4.5-stable review

2016-03-12 Thread Greg Kroah-Hartman
On Tue, Mar 08, 2016 at 05:15:13PM +0100, Sedat Dilek wrote:
> On Tue, Mar 8, 2016 at 2:39 PM, Greg Kroah-Hartman
>  wrote:
> > On Tue, Mar 08, 2016 at 10:12:13AM +0100, Sedat Dilek wrote:
> >> Hi Greg,
> >>
> >> I tested with my usual setup/config.
> >>
> >> Looks good so far.
> >>
> >> Missing some net-ppp-fixes / overlayfs-fixes / userfaultfd-fixes, but
> >> I guess you will pick them up in a 6th run of Linux v4.4.y.
> >
> > I have no idea what these "fixes" are you speak of, my queue is empty,
> > there are no known stable patches I haven't applied yet.  What exactly
> > are you referring to here?
> >
> > thansk,
> >
> >
> 
> Here we go...
> 
> [1] "userfaultfd: don't block on the last VM updates at exit time"
> 
> [2] "ppp: release rtnl mutex when interface creation fails"
> 
> ( I was involved in... Fixes: 58a89ecaca53 ("ppp: fix lockdep splat in
> ppp_dev_uninit()" )
> 
> [3] "ovl: fix working on distributed fs as lower layer"
> 
> BTW, in [1] Linus forgot to add a "CC:stable", how is this handled
> when a maintainer forgets this?

Someone needs to tell me.  I've grabbed it now, the networking one will
come through David, and the ovl patch is already in my tree for this
round of releases.  I couldn't take it before as it wasn't in Linus's
tree.

thanks,

greg k-h


Re: [PATCH] staging: dgap: dgap.c: Fixed a comment warning

2016-03-12 Thread Greg KH
On Sat, Mar 12, 2016 at 05:03:01PM -0800, Gavin O'Leary wrote:
> Signed-off-by: Gavin O'Leary 

I can't take a patch without a changelog entry.

greg k-h


Re: [PATCH] staging: dgap: dgap.c: fixed whitespace error caused by my patch

2016-03-12 Thread Greg KH
On Sat, Mar 12, 2016 at 05:10:29PM -0800, Gavin O'Leary wrote:
> Signed-off-by: Gavin O'Leary 
> ---
>  drivers/staging/dgap/dgap.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c
> index 9e07a39..7845516 100644
> --- a/drivers/staging/dgap/dgap.c
> +++ b/drivers/staging/dgap/dgap.c
> @@ -4819,7 +4819,7 @@ static int dgap_tty_ioctl(struct tty_struct *tty, 
> unsigned int cmd,
>  
>   case TCSBRKP:
>   /* support for POSIX tcsendbreak()
> -  * 
> +  *

No, you need to fix up your previous patch and get it right.



Re: [RFC PATCH 1/3] siox: new driver/bus framework for Eckelmann SIOX

2016-03-12 Thread Greg Kroah-Hartman
On Sat, Mar 12, 2016 at 02:43:21PM +0100, Uwe Kleine-König wrote:
> Hello Greg,
> 
> On Fri, Mar 11, 2016 at 02:20:39PM -0800, Greg Kroah-Hartman wrote:
> > On Fri, Mar 11, 2016 at 10:52:12PM +0100, Uwe Kleine-König wrote:
> > > Signed-off-by: Uwe Kleine-König 
> > > ---
> > >  drivers/Kconfig  |   2 +
> > >  drivers/Makefile |   1 +
> > >  drivers/siox/Kconfig |   2 +
> > >  drivers/siox/Makefile|   1 +
> > >  drivers/siox/siox-core.c | 572 
> > > +++
> > >  drivers/siox/siox.h  |  48 
> > >  include/linux/siox.h |  53 +
> > >  7 files changed, 679 insertions(+)
> > >  create mode 100644 drivers/siox/Kconfig
> > >  create mode 100644 drivers/siox/Makefile
> > >  create mode 100644 drivers/siox/siox-core.c
> > >  create mode 100644 drivers/siox/siox.h
> > >  create mode 100644 include/linux/siox.h
> > 
> > What's the relationship between your "master" and "regular" devices
> > here?  I think that's getting things confused, you are unregistering
> > your 'master' yet the children it controls don't go away because you
> > never unregister them.  You need to fix this heirachy up a bit, and
> > maybe just drop the 'master' logic?
> 
> A master is the bus controller (i.e. it drives DOUT, DCLK and DLD). A
> device is a consumer and provides DIN to the master.
> 
> The topology looks as follows:
> 
>   ,--->--DCLK-->---+--.
>   ^v  v
>  ,.,--.   ,--
>  |||   ,--.   |   |
>  ||--->--DOUT-->---|->-|shift register|->-|--->---|
>  |||   `--'   |   |
>  | master ||device|   |  device
>  |||   ,--.   |   |
>  ||---<--DIN---<---|-<-|shift register|-<-|---<---|
>  |||   `--'   |   |
>  `'`--'   `--
>   v^  ^
>   `--DLD---+--'
> 
> So there are two chains of shift registers, one for letting the master
> write to the devices, and the other to let the master read from the
> devices. DCLK is the clock to shift both chains by a single bit. An edge
> on DLD is used to make the devices load the inputs and sample the
> outputs.
> 
> I think I need the following:
> 
>   void siox_unregister_master(struct siox_master *smaster)
>   {
>   for (each siox_device d of smaster)
>   siox_device_remove(d);
> 
>   device_unregister(>dev);
>   }

Yes, you have to do this, as that's how USB and other busses do it when
their "controllers" go away.

> But the locking scheme that is necessary isn't obvious for me. For
> example I must prevent that after the for loop is done a new device is
> registered. Do I need to prevent this explicitly (e.g. by doing
> something like:
> 
>   lock(smaster);
>   smaster->is_going_away = true;
>   for (each siox_device d of smaster)
>   siox_device_remove(d);
>   unlock(smaster);
> 
>   device_unregister(>dev);
> 
> and let registering new devices fail if smaster->is_going_away is true?)
> Or is there something that the kobject stuff/driver core can help me
> with?

Look at what happens when you remove a USB host controller with the
locking there, it shouldn't be that hard.

thanks,

greg k-h


Re: [PATCH 4.4 00/74] 4.4.5-stable review

2016-03-12 Thread Greg Kroah-Hartman
On Tue, Mar 08, 2016 at 05:15:13PM +0100, Sedat Dilek wrote:
> On Tue, Mar 8, 2016 at 2:39 PM, Greg Kroah-Hartman
>  wrote:
> > On Tue, Mar 08, 2016 at 10:12:13AM +0100, Sedat Dilek wrote:
> >> Hi Greg,
> >>
> >> I tested with my usual setup/config.
> >>
> >> Looks good so far.
> >>
> >> Missing some net-ppp-fixes / overlayfs-fixes / userfaultfd-fixes, but
> >> I guess you will pick them up in a 6th run of Linux v4.4.y.
> >
> > I have no idea what these "fixes" are you speak of, my queue is empty,
> > there are no known stable patches I haven't applied yet.  What exactly
> > are you referring to here?
> >
> > thansk,
> >
> >
> 
> Here we go...
> 
> [1] "userfaultfd: don't block on the last VM updates at exit time"
> 
> [2] "ppp: release rtnl mutex when interface creation fails"
> 
> ( I was involved in... Fixes: 58a89ecaca53 ("ppp: fix lockdep splat in
> ppp_dev_uninit()" )
> 
> [3] "ovl: fix working on distributed fs as lower layer"
> 
> BTW, in [1] Linus forgot to add a "CC:stable", how is this handled
> when a maintainer forgets this?

Someone needs to tell me.  I've grabbed it now, the networking one will
come through David, and the ovl patch is already in my tree for this
round of releases.  I couldn't take it before as it wasn't in Linus's
tree.

thanks,

greg k-h


[PATCH 5/7] KVM: Replace smp_mb() with smp_load_acquire() in the kvm_flush_remote_tlbs()

2016-03-12 Thread Lan Tianyu
smp_load_acquire() is enough here and it's cheaper than smp_mb().
Adding a comment about reusing memory barrier of kvm_make_all_cpus_request()
here to keep order between modifications to the page tables and reading mode.

Signed-off-by: Lan Tianyu 
---
 virt/kvm/kvm_main.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ec5aa8d..39ebee9a 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -191,9 +191,23 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned 
int req)
 #ifndef CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL
 void kvm_flush_remote_tlbs(struct kvm *kvm)
 {
-   long dirty_count = kvm->tlbs_dirty;
+   /*
+* Read tlbs_dirty before setting KVM_REQ_TLB_FLUSH in
+* kvm_make_all_cpus_request.
+*/
+   long dirty_count = smp_load_acquire(>tlbs_dirty);
 
-   smp_mb();
+   /*
+* We want to publish modifications to the page tables before reading
+* mode. Pairs with a memory barrier in arch-specific code.
+* - x86: smp_mb__after_srcu_read_unlock in vcpu_enter_guest
+* and smp_mb in walk_shadow_page_lockless_begin/end.
+* - powerpc: smp_mb in kvmppc_prepare_to_enter.
+*
+* There is already an smp_mb__after_atomic() before
+* kvm_make_all_cpus_request() reads vcpu->mode. We reuse that
+* barrier here.
+*/
if (kvm_make_all_cpus_request(kvm, KVM_REQ_TLB_FLUSH))
++kvm->stat.remote_tlb_flush;
cmpxchg(>tlbs_dirty, dirty_count, 0);
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 6/7] KVM/x86: update the comment of memory barrier in the vcpu_enter_guest()

2016-03-12 Thread Lan Tianyu
The barrier also orders the write to mode from any reads
to the page tables done and so update the comment.

Signed-off-by: Lan Tianyu 
---
 arch/x86/kvm/x86.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index bcbce0f..4bdb4e6 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6589,8 +6589,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 
srcu_read_unlock(>kvm->srcu, vcpu->srcu_idx);
 
-   /* We should set ->mode before check ->requests,
-* see the comment in make_all_cpus_request.
+   /*
+* We should set ->mode before check ->requests,
+* Please see the comment in kvm_make_all_cpus_request.
+* This also orders the write to mode from any reads
+* to the page tables done while the VCPU is running.
+* Please see the comment in kvm_flush_remote_tlbs.
 */
smp_mb__after_srcu_read_unlock();
 
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 4/7] KVM/x86: Call smp_wmb() before increasing tlbs_dirty

2016-03-12 Thread Lan Tianyu
Update spte before increasing tlbs_dirty to make sure no tlb flush
in lost after spte is zapped. This pairs with the barrier in the
kvm_flush_remote_tlbs().

Signed-off-by: Lan Tianyu 
---
 arch/x86/kvm/paging_tmpl.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index e159a81..d34475e 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -949,6 +949,12 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct 
kvm_mmu_page *sp)
return 0;
 
if (FNAME(prefetch_invalid_gpte)(vcpu, sp, >spt[i], gpte)) {
+   /*
+* Update spte before increasing tlbs_dirty to make sure
+* no tlb flush in lost after spte is zapped, see the
+* comments in kvm_flush_remote_tlbs().
+*/
+   smp_wmb();
vcpu->kvm->tlbs_dirty++;
continue;
}
@@ -964,6 +970,11 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct 
kvm_mmu_page *sp)
 
if (gfn != sp->gfns[i]) {
drop_spte(vcpu->kvm, >spt[i]);
+   /*
+* The same as above where we are doing
+* prefetch_invalid_gpte().
+*/
+   smp_wmb();
vcpu->kvm->tlbs_dirty++;
continue;
}
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 7/7] KVM/PPC: update the comment of memory barrier in the kvmppc_prepare_to_enter()

2016-03-12 Thread Lan Tianyu
The barrier also orders the write to mode from any reads
to the page tables done and so update the comment.

Signed-off-by: Lan Tianyu 
---
 arch/powerpc/kvm/powerpc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 19aa59b..6a68730 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -96,6 +96,9 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
 * so we don't miss a request because the requester sees
 * OUTSIDE_GUEST_MODE and assumes we'll be checking requests
 * before next entering the guest (and thus doesn't IPI).
+* This also orders the write to mode from any reads
+* to the page tables done while the VCPU is running.
+* Please see the comment in kvm_flush_remote_tlbs.
 */
smp_mb();
 
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 5/7] KVM: Replace smp_mb() with smp_load_acquire() in the kvm_flush_remote_tlbs()

2016-03-12 Thread Lan Tianyu
smp_load_acquire() is enough here and it's cheaper than smp_mb().
Adding a comment about reusing memory barrier of kvm_make_all_cpus_request()
here to keep order between modifications to the page tables and reading mode.

Signed-off-by: Lan Tianyu 
---
 virt/kvm/kvm_main.c | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index ec5aa8d..39ebee9a 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -191,9 +191,23 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned 
int req)
 #ifndef CONFIG_HAVE_KVM_ARCH_TLB_FLUSH_ALL
 void kvm_flush_remote_tlbs(struct kvm *kvm)
 {
-   long dirty_count = kvm->tlbs_dirty;
+   /*
+* Read tlbs_dirty before setting KVM_REQ_TLB_FLUSH in
+* kvm_make_all_cpus_request.
+*/
+   long dirty_count = smp_load_acquire(>tlbs_dirty);
 
-   smp_mb();
+   /*
+* We want to publish modifications to the page tables before reading
+* mode. Pairs with a memory barrier in arch-specific code.
+* - x86: smp_mb__after_srcu_read_unlock in vcpu_enter_guest
+* and smp_mb in walk_shadow_page_lockless_begin/end.
+* - powerpc: smp_mb in kvmppc_prepare_to_enter.
+*
+* There is already an smp_mb__after_atomic() before
+* kvm_make_all_cpus_request() reads vcpu->mode. We reuse that
+* barrier here.
+*/
if (kvm_make_all_cpus_request(kvm, KVM_REQ_TLB_FLUSH))
++kvm->stat.remote_tlb_flush;
cmpxchg(>tlbs_dirty, dirty_count, 0);
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 6/7] KVM/x86: update the comment of memory barrier in the vcpu_enter_guest()

2016-03-12 Thread Lan Tianyu
The barrier also orders the write to mode from any reads
to the page tables done and so update the comment.

Signed-off-by: Lan Tianyu 
---
 arch/x86/kvm/x86.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index bcbce0f..4bdb4e6 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6589,8 +6589,12 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 
srcu_read_unlock(>kvm->srcu, vcpu->srcu_idx);
 
-   /* We should set ->mode before check ->requests,
-* see the comment in make_all_cpus_request.
+   /*
+* We should set ->mode before check ->requests,
+* Please see the comment in kvm_make_all_cpus_request.
+* This also orders the write to mode from any reads
+* to the page tables done while the VCPU is running.
+* Please see the comment in kvm_flush_remote_tlbs.
 */
smp_mb__after_srcu_read_unlock();
 
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 4/7] KVM/x86: Call smp_wmb() before increasing tlbs_dirty

2016-03-12 Thread Lan Tianyu
Update spte before increasing tlbs_dirty to make sure no tlb flush
in lost after spte is zapped. This pairs with the barrier in the
kvm_flush_remote_tlbs().

Signed-off-by: Lan Tianyu 
---
 arch/x86/kvm/paging_tmpl.h | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index e159a81..d34475e 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -949,6 +949,12 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct 
kvm_mmu_page *sp)
return 0;
 
if (FNAME(prefetch_invalid_gpte)(vcpu, sp, >spt[i], gpte)) {
+   /*
+* Update spte before increasing tlbs_dirty to make sure
+* no tlb flush in lost after spte is zapped, see the
+* comments in kvm_flush_remote_tlbs().
+*/
+   smp_wmb();
vcpu->kvm->tlbs_dirty++;
continue;
}
@@ -964,6 +970,11 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct 
kvm_mmu_page *sp)
 
if (gfn != sp->gfns[i]) {
drop_spte(vcpu->kvm, >spt[i]);
+   /*
+* The same as above where we are doing
+* prefetch_invalid_gpte().
+*/
+   smp_wmb();
vcpu->kvm->tlbs_dirty++;
continue;
}
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 7/7] KVM/PPC: update the comment of memory barrier in the kvmppc_prepare_to_enter()

2016-03-12 Thread Lan Tianyu
The barrier also orders the write to mode from any reads
to the page tables done and so update the comment.

Signed-off-by: Lan Tianyu 
---
 arch/powerpc/kvm/powerpc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 19aa59b..6a68730 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -96,6 +96,9 @@ int kvmppc_prepare_to_enter(struct kvm_vcpu *vcpu)
 * so we don't miss a request because the requester sees
 * OUTSIDE_GUEST_MODE and assumes we'll be checking requests
 * before next entering the guest (and thus doesn't IPI).
+* This also orders the write to mode from any reads
+* to the page tables done while the VCPU is running.
+* Please see the comment in kvm_flush_remote_tlbs.
 */
smp_mb();
 
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 1/7] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()

2016-03-12 Thread Lan Tianyu
There is already a barrier inside of kvm_flush_remote_tlbs() which can
help to make sure everyone sees our modifications to the page tables and
see changes to vcpu->mode here. So remove the smp_mb in the
kvm_mmu_commit_zap_page() and update the comment.

Signed-off-by: Lan Tianyu 
---
 arch/x86/kvm/mmu.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 2463de0..5e795af 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2390,14 +2390,12 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,
return;
 
/*
-* wmb: make sure everyone sees our modifications to the page tables
-* rmb: make sure we see changes to vcpu->mode
-*/
-   smp_mb();
-
-   /*
-* Wait for all vcpus to exit guest mode and/or lockless shadow
-* page table walks.
+* We need to make sure everyone sees our modifications to
+* the page tables and see changes to vcpu->mode here. The barrier
+* in the kvm_flush_remote_tlbs() helps us to achieve these. This pairs
+* with vcpu_enter_guest and walk_shadow_page_lockless_begin/end.
+* In addition, wait for all vcpus to exit guest mode and/or lockless
+* shadow page table walks.
 */
kvm_flush_remote_tlbs(kvm);
 
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 1/7] KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()

2016-03-12 Thread Lan Tianyu
There is already a barrier inside of kvm_flush_remote_tlbs() which can
help to make sure everyone sees our modifications to the page tables and
see changes to vcpu->mode here. So remove the smp_mb in the
kvm_mmu_commit_zap_page() and update the comment.

Signed-off-by: Lan Tianyu 
---
 arch/x86/kvm/mmu.c | 14 ++
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 2463de0..5e795af 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2390,14 +2390,12 @@ static void kvm_mmu_commit_zap_page(struct kvm *kvm,
return;
 
/*
-* wmb: make sure everyone sees our modifications to the page tables
-* rmb: make sure we see changes to vcpu->mode
-*/
-   smp_mb();
-
-   /*
-* Wait for all vcpus to exit guest mode and/or lockless shadow
-* page table walks.
+* We need to make sure everyone sees our modifications to
+* the page tables and see changes to vcpu->mode here. The barrier
+* in the kvm_flush_remote_tlbs() helps us to achieve these. This pairs
+* with vcpu_enter_guest and walk_shadow_page_lockless_begin/end.
+* In addition, wait for all vcpus to exit guest mode and/or lockless
+* shadow page table walks.
 */
kvm_flush_remote_tlbs(kvm);
 
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 0/7] KVM/X86/PPC: Clear up kvm mmu memory barriers and update related comments

2016-03-12 Thread Lan Tianyu
This series is to clear up kvm mmu memory barriers.
1) Remove redundant barrier (PATCH 1)
2) Replace origin barrier functions with preferrable ones (PATCH 2, 3, 5)
3) Fix unpaired barriers (PATCH 4)
4) Update or add barrier related comments (PATCH 6, 7)

Lan Tianyu (7):
  KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()
  KVM/x86: Replace smp_mb() with smp_store_mb/release() in the
walk_shadow_page_lockless_begin/end()
  KVM: Replace smp_mb() with smp_mb_after_atomic() in the
kvm_make_all_cpus_request()
  KVM/x86: Call smp_wmb() before increasing tlbs_dirty
  KVM: Replace smp_mb() with smp_load_acquire() in the
kvm_flush_remote_tlbs()
  KVM/x86: update the comment of memory barrier in the
vcpu_enter_guest()
  KVM/PPC:  update the comment of memory barrier in the
kvmppc_prepare_to_enter()

 arch/powerpc/kvm/powerpc.c |  3 +++
 arch/x86/kvm/mmu.c | 23 ++-
 arch/x86/kvm/paging_tmpl.h | 11 +++
 arch/x86/kvm/x86.c |  8 ++--
 virt/kvm/kvm_main.c| 22 ++
 5 files changed, 48 insertions(+), 19 deletions(-)

-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 2/7] KVM/x86: Replace smp_mb() with smp_store_mb/release() in the walk_shadow_page_lockless_begin/end()

2016-03-12 Thread Lan Tianyu
Signed-off-by: Lan Tianyu 
---
 arch/x86/kvm/mmu.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 5e795af..d1ee68c 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -632,12 +632,12 @@ static void walk_shadow_page_lockless_begin(struct 
kvm_vcpu *vcpu)
 * kvm_flush_remote_tlbs() IPI to all active vcpus.
 */
local_irq_disable();
-   vcpu->mode = READING_SHADOW_PAGE_TABLES;
+
/*
 * Make sure a following spte read is not reordered ahead of the write
 * to vcpu->mode.
 */
-   smp_mb();
+   smp_store_mb(vcpu->mode, READING_SHADOW_PAGE_TABLES);
 }
 
 static void walk_shadow_page_lockless_end(struct kvm_vcpu *vcpu)
@@ -647,8 +647,7 @@ static void walk_shadow_page_lockless_end(struct kvm_vcpu 
*vcpu)
 * reads to sptes.  If it does, kvm_commit_zap_page() can see us
 * OUTSIDE_GUEST_MODE and proceed to free the shadow page table.
 */
-   smp_mb();
-   vcpu->mode = OUTSIDE_GUEST_MODE;
+   smp_store_release(>mode, OUTSIDE_GUEST_MODE);
local_irq_enable();
 }
 
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 3/7] KVM: Replace smp_mb() with smp_mb_after_atomic() in the kvm_make_all_cpus_request()

2016-03-12 Thread Lan Tianyu
Signed-off-by: Lan Tianyu 
---
 virt/kvm/kvm_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 1eae052..ec5aa8d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -170,8 +170,8 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned 
int req)
kvm_make_request(req, vcpu);
cpu = vcpu->cpu;
 
-   /* Set ->requests bit before we read ->mode */
-   smp_mb();
+   /* Set ->requests bit before we read ->mode. */
+   smp_mb__after_atomic();
 
if (cpus != NULL && cpu != -1 && cpu != me &&
  kvm_vcpu_exiting_guest_mode(vcpu) != OUTSIDE_GUEST_MODE)
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 2/7] KVM/x86: Replace smp_mb() with smp_store_mb/release() in the walk_shadow_page_lockless_begin/end()

2016-03-12 Thread Lan Tianyu
Signed-off-by: Lan Tianyu 
---
 arch/x86/kvm/mmu.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 5e795af..d1ee68c 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -632,12 +632,12 @@ static void walk_shadow_page_lockless_begin(struct 
kvm_vcpu *vcpu)
 * kvm_flush_remote_tlbs() IPI to all active vcpus.
 */
local_irq_disable();
-   vcpu->mode = READING_SHADOW_PAGE_TABLES;
+
/*
 * Make sure a following spte read is not reordered ahead of the write
 * to vcpu->mode.
 */
-   smp_mb();
+   smp_store_mb(vcpu->mode, READING_SHADOW_PAGE_TABLES);
 }
 
 static void walk_shadow_page_lockless_end(struct kvm_vcpu *vcpu)
@@ -647,8 +647,7 @@ static void walk_shadow_page_lockless_end(struct kvm_vcpu 
*vcpu)
 * reads to sptes.  If it does, kvm_commit_zap_page() can see us
 * OUTSIDE_GUEST_MODE and proceed to free the shadow page table.
 */
-   smp_mb();
-   vcpu->mode = OUTSIDE_GUEST_MODE;
+   smp_store_release(>mode, OUTSIDE_GUEST_MODE);
local_irq_enable();
 }
 
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 3/7] KVM: Replace smp_mb() with smp_mb_after_atomic() in the kvm_make_all_cpus_request()

2016-03-12 Thread Lan Tianyu
Signed-off-by: Lan Tianyu 
---
 virt/kvm/kvm_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 1eae052..ec5aa8d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -170,8 +170,8 @@ bool kvm_make_all_cpus_request(struct kvm *kvm, unsigned 
int req)
kvm_make_request(req, vcpu);
cpu = vcpu->cpu;
 
-   /* Set ->requests bit before we read ->mode */
-   smp_mb();
+   /* Set ->requests bit before we read ->mode. */
+   smp_mb__after_atomic();
 
if (cpus != NULL && cpu != -1 && cpu != me &&
  kvm_vcpu_exiting_guest_mode(vcpu) != OUTSIDE_GUEST_MODE)
-- 
1.8.4.rc0.1.g8f6a3e5.dirty



[PATCH 0/7] KVM/X86/PPC: Clear up kvm mmu memory barriers and update related comments

2016-03-12 Thread Lan Tianyu
This series is to clear up kvm mmu memory barriers.
1) Remove redundant barrier (PATCH 1)
2) Replace origin barrier functions with preferrable ones (PATCH 2, 3, 5)
3) Fix unpaired barriers (PATCH 4)
4) Update or add barrier related comments (PATCH 6, 7)

Lan Tianyu (7):
  KVM: Remove redundant smp_mb() in the kvm_mmu_commit_zap_page()
  KVM/x86: Replace smp_mb() with smp_store_mb/release() in the
walk_shadow_page_lockless_begin/end()
  KVM: Replace smp_mb() with smp_mb_after_atomic() in the
kvm_make_all_cpus_request()
  KVM/x86: Call smp_wmb() before increasing tlbs_dirty
  KVM: Replace smp_mb() with smp_load_acquire() in the
kvm_flush_remote_tlbs()
  KVM/x86: update the comment of memory barrier in the
vcpu_enter_guest()
  KVM/PPC:  update the comment of memory barrier in the
kvmppc_prepare_to_enter()

 arch/powerpc/kvm/powerpc.c |  3 +++
 arch/x86/kvm/mmu.c | 23 ++-
 arch/x86/kvm/paging_tmpl.h | 11 +++
 arch/x86/kvm/x86.c |  8 ++--
 virt/kvm/kvm_main.c| 22 ++
 5 files changed, 48 insertions(+), 19 deletions(-)

-- 
1.8.4.rc0.1.g8f6a3e5.dirty



Re: [PATCH 2/2] mISDN: Support DR6 indication in mISDNipac driver

2016-03-12 Thread isdn
Acked-by: Karsten Keil 
Am 13.03.2016 um 00:19 schrieb Maciej S. Szmigiero:
> According to figure 39 in PEB3086 data sheet, version 1.4 this indication
> replaces DR when layer 1 transition source state is F6.
> 
> This fixes mISDN layer 1 getting stuck in F6 state in TE mode on
> Dialogic Diva 2.02 card (and possibly others) when NT deactivates it.
> 
> Signed-off-by: Maciej S. Szmigiero 
> ---
>  drivers/isdn/hardware/mISDN/ipac.h  | 1 +
>  drivers/isdn/hardware/mISDN/mISDNipac.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/isdn/hardware/mISDN/ipac.h 
> b/drivers/isdn/hardware/mISDN/ipac.h
> index 76aa6f8f298e..720ee72aab6a 100644
> --- a/drivers/isdn/hardware/mISDN/ipac.h
> +++ b/drivers/isdn/hardware/mISDN/ipac.h
> @@ -217,6 +217,7 @@ struct ipac_hw {
>  #define ISAC_IND_SD  0x2
>  #define ISAC_IND_DIS 0x3
>  #define ISAC_IND_RSY 0x4
> +#define ISAC_IND_DR6 0x5
>  #define ISAC_IND_EI  0x6
>  #define ISAC_IND_PU  0x7
>  #define ISAC_IND_ARD 0x8
> diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c 
> b/drivers/isdn/hardware/mISDN/mISDNipac.c
> index cb428b9ee441..aa9b6c3cadc1 100644
> --- a/drivers/isdn/hardware/mISDN/mISDNipac.c
> +++ b/drivers/isdn/hardware/mISDN/mISDNipac.c
> @@ -80,6 +80,7 @@ isac_ph_state_bh(struct dchannel *dch)
>   l1_event(dch->l1, HW_DEACT_CNF);
>   break;
>   case ISAC_IND_DR:
> + case ISAC_IND_DR6:
>   dch->state = 3;
>   l1_event(dch->l1, HW_DEACT_IND);
>   break;
> @@ -660,6 +661,7 @@ isac_l1cmd(struct dchannel *dch, u32 cmd)
>   spin_lock_irqsave(isac->hwlock, flags);
>   if ((isac->state == ISAC_IND_EI) ||
>   (isac->state == ISAC_IND_DR) ||
> + (isac->state == ISAC_IND_DR6) ||
>   (isac->state == ISAC_IND_RS))
>   ph_command(isac, ISAC_CMD_TIM);
>   else
> 
> 



Re: [PATCH 2/2] mISDN: Support DR6 indication in mISDNipac driver

2016-03-12 Thread isdn
Acked-by: Karsten Keil 
Am 13.03.2016 um 00:19 schrieb Maciej S. Szmigiero:
> According to figure 39 in PEB3086 data sheet, version 1.4 this indication
> replaces DR when layer 1 transition source state is F6.
> 
> This fixes mISDN layer 1 getting stuck in F6 state in TE mode on
> Dialogic Diva 2.02 card (and possibly others) when NT deactivates it.
> 
> Signed-off-by: Maciej S. Szmigiero 
> ---
>  drivers/isdn/hardware/mISDN/ipac.h  | 1 +
>  drivers/isdn/hardware/mISDN/mISDNipac.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/drivers/isdn/hardware/mISDN/ipac.h 
> b/drivers/isdn/hardware/mISDN/ipac.h
> index 76aa6f8f298e..720ee72aab6a 100644
> --- a/drivers/isdn/hardware/mISDN/ipac.h
> +++ b/drivers/isdn/hardware/mISDN/ipac.h
> @@ -217,6 +217,7 @@ struct ipac_hw {
>  #define ISAC_IND_SD  0x2
>  #define ISAC_IND_DIS 0x3
>  #define ISAC_IND_RSY 0x4
> +#define ISAC_IND_DR6 0x5
>  #define ISAC_IND_EI  0x6
>  #define ISAC_IND_PU  0x7
>  #define ISAC_IND_ARD 0x8
> diff --git a/drivers/isdn/hardware/mISDN/mISDNipac.c 
> b/drivers/isdn/hardware/mISDN/mISDNipac.c
> index cb428b9ee441..aa9b6c3cadc1 100644
> --- a/drivers/isdn/hardware/mISDN/mISDNipac.c
> +++ b/drivers/isdn/hardware/mISDN/mISDNipac.c
> @@ -80,6 +80,7 @@ isac_ph_state_bh(struct dchannel *dch)
>   l1_event(dch->l1, HW_DEACT_CNF);
>   break;
>   case ISAC_IND_DR:
> + case ISAC_IND_DR6:
>   dch->state = 3;
>   l1_event(dch->l1, HW_DEACT_IND);
>   break;
> @@ -660,6 +661,7 @@ isac_l1cmd(struct dchannel *dch, u32 cmd)
>   spin_lock_irqsave(isac->hwlock, flags);
>   if ((isac->state == ISAC_IND_EI) ||
>   (isac->state == ISAC_IND_DR) ||
> + (isac->state == ISAC_IND_DR6) ||
>   (isac->state == ISAC_IND_RS))
>   ph_command(isac, ISAC_CMD_TIM);
>   else
> 
> 



Re: [PATCH 1/2] mISDN: Order IPAC register defines

2016-03-12 Thread isdn
Acked-by: Karsten Keil 
Am 13.03.2016 um 00:18 schrieb Maciej S. Szmigiero:
> It looks like IPAC/ISAC chips register defines weren't in any particular
> order.
> 
> Order them by their number to make it easier to spot holes.
> 
> Signed-off-by: Maciej S. Szmigiero 
> ---
>  drivers/isdn/hardware/mISDN/ipac.h | 40 
> +++---
>  1 file changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/isdn/hardware/mISDN/ipac.h 
> b/drivers/isdn/hardware/mISDN/ipac.h
> index 8121e046b739..76aa6f8f298e 100644
> --- a/drivers/isdn/hardware/mISDN/ipac.h
> +++ b/drivers/isdn/hardware/mISDN/ipac.h
> @@ -99,32 +99,32 @@ struct ipac_hw {
>  
>  /* All registers original Siemens Spec  */
>  /* IPAC/ISAC registers */
> -#define ISAC_MASK0x20
>  #define ISAC_ISTA0x20
> -#define ISAC_STAR0x21
> +#define ISAC_MASK0x20
>  #define ISAC_CMDR0x21
> +#define ISAC_STAR0x21
> +#define ISAC_MODE0x22
> +#define ISAC_TIMR0x23
>  #define ISAC_EXIR0x24
> -#define ISAC_ADF20x39
> +#define ISAC_RBCL0x25
> +#define ISAC_RSTA0x27
> +#define ISAC_RBCH0x2A
>  #define ISAC_SPCR0x30
> -#define ISAC_ADF10x38
>  #define ISAC_CIR00x31
>  #define ISAC_CIX00x31
> -#define ISAC_CIR10x33
> -#define ISAC_CIX10x33
> -#define ISAC_STCR0x37
> -#define ISAC_MODE0x22
> -#define ISAC_RSTA0x27
> -#define ISAC_RBCL0x25
> -#define ISAC_RBCH0x2A
> -#define ISAC_TIMR0x23
> -#define ISAC_SQXR0x3b
> -#define ISAC_SQRR0x3b
> -#define ISAC_MOSR0x3a
> -#define ISAC_MOCR0x3a
>  #define ISAC_MOR00x32
>  #define ISAC_MOX00x32
> +#define ISAC_CIR10x33
> +#define ISAC_CIX10x33
>  #define ISAC_MOR10x34
>  #define ISAC_MOX10x34
> +#define ISAC_STCR0x37
> +#define ISAC_ADF10x38
> +#define ISAC_ADF20x39
> +#define ISAC_MOCR0x3a
> +#define ISAC_MOSR0x3a
> +#define ISAC_SQRR0x3b
> +#define ISAC_SQXR0x3b
>  
>  #define ISAC_RBCH_XAC0x80
>  
> @@ -212,13 +212,13 @@ struct ipac_hw {
>  #define ISAC_CMD_DUI 0xF
>  
>  /* ISAC/ISACX/IPAC/IPACX L1 indications */
> -#define ISAC_IND_RS  0x1
> -#define ISAC_IND_PU  0x7
>  #define ISAC_IND_DR  0x0
> +#define ISAC_IND_RS  0x1
>  #define ISAC_IND_SD  0x2
>  #define ISAC_IND_DIS 0x3
> -#define ISAC_IND_EI  0x6
>  #define ISAC_IND_RSY 0x4
> +#define ISAC_IND_EI  0x6
> +#define ISAC_IND_PU  0x7
>  #define ISAC_IND_ARD 0x8
>  #define ISAC_IND_TI  0xA
>  #define ISAC_IND_ATI 0xB
> @@ -339,9 +339,9 @@ struct ipac_hw {
>  #define ISACX__AUX   0x08
>  #define ISACX__CIC   0x10
>  #define ISACX__ST0x20
> +#define IPACX__ON0x2C
>  #define IPACX__ICB   0x40
>  #define IPACX__ICA   0x80
> -#define IPACX__ON0x2C
>  
>  /* ISACX/IPACX _CMDRD (W) */
>  #define ISACX_CMDRD_XRES 0x01
> 
> 



Re: [PATCH 1/2] mISDN: Order IPAC register defines

2016-03-12 Thread isdn
Acked-by: Karsten Keil 
Am 13.03.2016 um 00:18 schrieb Maciej S. Szmigiero:
> It looks like IPAC/ISAC chips register defines weren't in any particular
> order.
> 
> Order them by their number to make it easier to spot holes.
> 
> Signed-off-by: Maciej S. Szmigiero 
> ---
>  drivers/isdn/hardware/mISDN/ipac.h | 40 
> +++---
>  1 file changed, 20 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/isdn/hardware/mISDN/ipac.h 
> b/drivers/isdn/hardware/mISDN/ipac.h
> index 8121e046b739..76aa6f8f298e 100644
> --- a/drivers/isdn/hardware/mISDN/ipac.h
> +++ b/drivers/isdn/hardware/mISDN/ipac.h
> @@ -99,32 +99,32 @@ struct ipac_hw {
>  
>  /* All registers original Siemens Spec  */
>  /* IPAC/ISAC registers */
> -#define ISAC_MASK0x20
>  #define ISAC_ISTA0x20
> -#define ISAC_STAR0x21
> +#define ISAC_MASK0x20
>  #define ISAC_CMDR0x21
> +#define ISAC_STAR0x21
> +#define ISAC_MODE0x22
> +#define ISAC_TIMR0x23
>  #define ISAC_EXIR0x24
> -#define ISAC_ADF20x39
> +#define ISAC_RBCL0x25
> +#define ISAC_RSTA0x27
> +#define ISAC_RBCH0x2A
>  #define ISAC_SPCR0x30
> -#define ISAC_ADF10x38
>  #define ISAC_CIR00x31
>  #define ISAC_CIX00x31
> -#define ISAC_CIR10x33
> -#define ISAC_CIX10x33
> -#define ISAC_STCR0x37
> -#define ISAC_MODE0x22
> -#define ISAC_RSTA0x27
> -#define ISAC_RBCL0x25
> -#define ISAC_RBCH0x2A
> -#define ISAC_TIMR0x23
> -#define ISAC_SQXR0x3b
> -#define ISAC_SQRR0x3b
> -#define ISAC_MOSR0x3a
> -#define ISAC_MOCR0x3a
>  #define ISAC_MOR00x32
>  #define ISAC_MOX00x32
> +#define ISAC_CIR10x33
> +#define ISAC_CIX10x33
>  #define ISAC_MOR10x34
>  #define ISAC_MOX10x34
> +#define ISAC_STCR0x37
> +#define ISAC_ADF10x38
> +#define ISAC_ADF20x39
> +#define ISAC_MOCR0x3a
> +#define ISAC_MOSR0x3a
> +#define ISAC_SQRR0x3b
> +#define ISAC_SQXR0x3b
>  
>  #define ISAC_RBCH_XAC0x80
>  
> @@ -212,13 +212,13 @@ struct ipac_hw {
>  #define ISAC_CMD_DUI 0xF
>  
>  /* ISAC/ISACX/IPAC/IPACX L1 indications */
> -#define ISAC_IND_RS  0x1
> -#define ISAC_IND_PU  0x7
>  #define ISAC_IND_DR  0x0
> +#define ISAC_IND_RS  0x1
>  #define ISAC_IND_SD  0x2
>  #define ISAC_IND_DIS 0x3
> -#define ISAC_IND_EI  0x6
>  #define ISAC_IND_RSY 0x4
> +#define ISAC_IND_EI  0x6
> +#define ISAC_IND_PU  0x7
>  #define ISAC_IND_ARD 0x8
>  #define ISAC_IND_TI  0xA
>  #define ISAC_IND_ATI 0xB
> @@ -339,9 +339,9 @@ struct ipac_hw {
>  #define ISACX__AUX   0x08
>  #define ISACX__CIC   0x10
>  #define ISACX__ST0x20
> +#define IPACX__ON0x2C
>  #define IPACX__ICB   0x40
>  #define IPACX__ICA   0x80
> -#define IPACX__ON0x2C
>  
>  /* ISACX/IPACX _CMDRD (W) */
>  #define ISACX_CMDRD_XRES 0x01
> 
> 



Re: [PATCH] fix: print ext4 mountopt data_err=abort correctly

2016-03-12 Thread Theodore Ts'o
On Wed, Mar 09, 2016 at 07:30:40PM +0100, Ales Novak wrote:
> If data_err=abort option is specified for an ext3/ext4 mount,
> /proc/mounts does show it as "(null)". This is caused by token2str()
> returning NULL for Opt_data_err_abort (due to its pattern containing
> '=').
> 
> This is perhaps more logical solution than the previously submitted,
> handling these 'data_err=' options in other way than MOPT_SET.
> 
> Signed-off-by: Ales Novak 

Thanks, applied.

- Ted


Re: [PATCH] fix: print ext4 mountopt data_err=abort correctly

2016-03-12 Thread Theodore Ts'o
On Wed, Mar 09, 2016 at 07:30:40PM +0100, Ales Novak wrote:
> If data_err=abort option is specified for an ext3/ext4 mount,
> /proc/mounts does show it as "(null)". This is caused by token2str()
> returning NULL for Opt_data_err_abort (due to its pattern containing
> '=').
> 
> This is perhaps more logical solution than the previously submitted,
> handling these 'data_err=' options in other way than MOPT_SET.
> 
> Signed-off-by: Ales Novak 

Thanks, applied.

- Ted


drivers/vhost/vhost.c:718:3: error: call to '__compiletime_assert_718' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE

2016-03-12 Thread kbuild test robot
Hi Michael,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   fda604a4daa19ead458ce5471892fa1d4b382d82
commit: 5d9a07b0de512b77bf28d2401e5fe3351f00a240 vhost: relax used address 
alignment
date:   1 year, 2 months ago
config: openrisc-allmodconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 5d9a07b0de512b77bf28d2401e5fe3351f00a240
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   drivers/vhost/vhost.c: In function 'vhost_vring_ioctl':
>> drivers/vhost/vhost.c:718:3: error: call to '__compiletime_assert_718' 
>> declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > 
>> VRING_AVAIL_ALIGN_SIZE

vim +/__compiletime_assert_718 +718 drivers/vhost/vhost.c

   712  (u64)(unsigned long)a.avail_user_addr != 
a.avail_user_addr) {
   713  r = -EFAULT;
   714  break;
   715  }
   716  
   717  /* Make sure it's safe to cast pointers to vring types. 
*/
 > 718  BUILD_BUG_ON(__alignof__ *vq->avail > 
 > VRING_AVAIL_ALIGN_SIZE);
   719  BUILD_BUG_ON(__alignof__ *vq->used > 
VRING_USED_ALIGN_SIZE);
   720  if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) 
||
   721  (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) ||

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


drivers/vhost/vhost.c:718:3: error: call to '__compiletime_assert_718' declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > VRING_AVAIL_ALIGN_SIZE

2016-03-12 Thread kbuild test robot
Hi Michael,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   fda604a4daa19ead458ce5471892fa1d4b382d82
commit: 5d9a07b0de512b77bf28d2401e5fe3351f00a240 vhost: relax used address 
alignment
date:   1 year, 2 months ago
config: openrisc-allmodconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 5d9a07b0de512b77bf28d2401e5fe3351f00a240
# save the attached .config to linux build tree
make.cross ARCH=openrisc 

All errors (new ones prefixed by >>):

   drivers/vhost/vhost.c: In function 'vhost_vring_ioctl':
>> drivers/vhost/vhost.c:718:3: error: call to '__compiletime_assert_718' 
>> declared with attribute error: BUILD_BUG_ON failed: __alignof__ *vq->avail > 
>> VRING_AVAIL_ALIGN_SIZE

vim +/__compiletime_assert_718 +718 drivers/vhost/vhost.c

   712  (u64)(unsigned long)a.avail_user_addr != 
a.avail_user_addr) {
   713  r = -EFAULT;
   714  break;
   715  }
   716  
   717  /* Make sure it's safe to cast pointers to vring types. 
*/
 > 718  BUILD_BUG_ON(__alignof__ *vq->avail > 
 > VRING_AVAIL_ALIGN_SIZE);
   719  BUILD_BUG_ON(__alignof__ *vq->used > 
VRING_USED_ALIGN_SIZE);
   720  if ((a.avail_user_addr & (VRING_AVAIL_ALIGN_SIZE - 1)) 
||
   721  (a.used_user_addr & (VRING_USED_ALIGN_SIZE - 1)) ||

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


arch/xtensa/include/asm/initialize_mmu.h:55: Error: invalid register 'atomctl' for 'wsr' instruction

2016-03-12 Thread kbuild test robot
Hi Max,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   fda604a4daa19ead458ce5471892fa1d4b382d82
commit: ca55b2fef3a9373fcfc30f82fd26bc7fccbda732 xtensa: add de212 core variant
date:   4 months ago
config: xtensa-nommu_kc705_defconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout ca55b2fef3a9373fcfc30f82fd26bc7fccbda732
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   arch/xtensa/include/asm/initialize_mmu.h: Assembler messages:
>> arch/xtensa/include/asm/initialize_mmu.h:55: Error: invalid register 
>> 'atomctl' for 'wsr' instruction

vim +55 arch/xtensa/include/asm/initialize_mmu.h

6cb97111 Baruch Siach 2013-12-29  39  
c622b29d Max Filippov 2012-11-19  40  #ifdef __ASSEMBLY__
c622b29d Max Filippov 2012-11-19  41  
c622b29d Max Filippov 2012-11-19  42  #define XTENSA_HWVERSION_RC_2009_0 23
c622b29d Max Filippov 2012-11-19  43  
c622b29d Max Filippov 2012-11-19  44.macro  initialize_mmu
c622b29d Max Filippov 2012-11-19  45  
c622b29d Max Filippov 2012-11-19  46  #if XCHAL_HAVE_S32C1I && 
(XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0)
c622b29d Max Filippov 2012-11-19  47  /*
c622b29d Max Filippov 2012-11-19  48   * We Have Atomic Operation Control 
(ATOMCTL) Register; Initialize it.
c622b29d Max Filippov 2012-11-19  49   * For details see 
Documentation/xtensa/atomctl.txt
c622b29d Max Filippov 2012-11-19  50   */
c622b29d Max Filippov 2012-11-19  51  #if XCHAL_DCACHE_IS_COHERENT
c622b29d Max Filippov 2012-11-19  52movia3, 0x25/* For SMP/MX 
-- internal for writeback,
c622b29d Max Filippov 2012-11-19  53 * RCW otherwise
c622b29d Max Filippov 2012-11-19  54 */
c622b29d Max Filippov 2012-11-19 @55  #else
c622b29d Max Filippov 2012-11-19  56movia3, 0x29/* non-MX -- 
Most cores use Std Memory
c622b29d Max Filippov 2012-11-19  57 * Controlers 
which usually can't use RCW
c622b29d Max Filippov 2012-11-19  58 */
c622b29d Max Filippov 2012-11-19  59  #endif
c622b29d Max Filippov 2012-11-19  60wsr a3, atomctl
c622b29d Max Filippov 2012-11-19  61  #endif  /* XCHAL_HAVE_S32C1I &&
c622b29d Max Filippov 2012-11-19  62 * (XCHAL_HW_MIN_VERSION >= 
XTENSA_HWVERSION_RC_2009_0)
c622b29d Max Filippov 2012-11-19  63 */

:: The code at line 55 was first introduced by commit
:: c622b29d1f38021411965b7e0170ab01b257 xtensa: initialize atomctl SR

:: TO: Max Filippov 
:: CC: Chris Zankel 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


arch/xtensa/include/asm/initialize_mmu.h:55: Error: invalid register 'atomctl' for 'wsr' instruction

2016-03-12 Thread kbuild test robot
Hi Max,

FYI, the error/warning still remains.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   fda604a4daa19ead458ce5471892fa1d4b382d82
commit: ca55b2fef3a9373fcfc30f82fd26bc7fccbda732 xtensa: add de212 core variant
date:   4 months ago
config: xtensa-nommu_kc705_defconfig (attached as .config)
reproduce:
wget 
https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross
 -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout ca55b2fef3a9373fcfc30f82fd26bc7fccbda732
# save the attached .config to linux build tree
make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   arch/xtensa/include/asm/initialize_mmu.h: Assembler messages:
>> arch/xtensa/include/asm/initialize_mmu.h:55: Error: invalid register 
>> 'atomctl' for 'wsr' instruction

vim +55 arch/xtensa/include/asm/initialize_mmu.h

6cb97111 Baruch Siach 2013-12-29  39  
c622b29d Max Filippov 2012-11-19  40  #ifdef __ASSEMBLY__
c622b29d Max Filippov 2012-11-19  41  
c622b29d Max Filippov 2012-11-19  42  #define XTENSA_HWVERSION_RC_2009_0 23
c622b29d Max Filippov 2012-11-19  43  
c622b29d Max Filippov 2012-11-19  44.macro  initialize_mmu
c622b29d Max Filippov 2012-11-19  45  
c622b29d Max Filippov 2012-11-19  46  #if XCHAL_HAVE_S32C1I && 
(XCHAL_HW_MIN_VERSION >= XTENSA_HWVERSION_RC_2009_0)
c622b29d Max Filippov 2012-11-19  47  /*
c622b29d Max Filippov 2012-11-19  48   * We Have Atomic Operation Control 
(ATOMCTL) Register; Initialize it.
c622b29d Max Filippov 2012-11-19  49   * For details see 
Documentation/xtensa/atomctl.txt
c622b29d Max Filippov 2012-11-19  50   */
c622b29d Max Filippov 2012-11-19  51  #if XCHAL_DCACHE_IS_COHERENT
c622b29d Max Filippov 2012-11-19  52movia3, 0x25/* For SMP/MX 
-- internal for writeback,
c622b29d Max Filippov 2012-11-19  53 * RCW otherwise
c622b29d Max Filippov 2012-11-19  54 */
c622b29d Max Filippov 2012-11-19 @55  #else
c622b29d Max Filippov 2012-11-19  56movia3, 0x29/* non-MX -- 
Most cores use Std Memory
c622b29d Max Filippov 2012-11-19  57 * Controlers 
which usually can't use RCW
c622b29d Max Filippov 2012-11-19  58 */
c622b29d Max Filippov 2012-11-19  59  #endif
c622b29d Max Filippov 2012-11-19  60wsr a3, atomctl
c622b29d Max Filippov 2012-11-19  61  #endif  /* XCHAL_HAVE_S32C1I &&
c622b29d Max Filippov 2012-11-19  62 * (XCHAL_HW_MIN_VERSION >= 
XTENSA_HWVERSION_RC_2009_0)
c622b29d Max Filippov 2012-11-19  63 */

:: The code at line 55 was first introduced by commit
:: c622b29d1f38021411965b7e0170ab01b257 xtensa: initialize atomctl SR

:: TO: Max Filippov 
:: CC: Chris Zankel 

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data


Dear Customer

2016-03-12 Thread Reserve Bank Of India
Dear Receipiant,

Your Pending funds of £750,000 GBP has been released by RBI. To claim, send 
full details as follows,  Name: , Mob No.: , Address:
and Alternate E-mail:

This is the last ever notification we are sending to you, if we do not receive 
your details, we will delete your email, and details from
our database completely.

Regards.
Transfers Department; RBI,


Dear Customer

2016-03-12 Thread Reserve Bank Of India
Dear Receipiant,

Your Pending funds of £750,000 GBP has been released by RBI. To claim, send 
full details as follows,  Name: , Mob No.: , Address:
and Alternate E-mail:

This is the last ever notification we are sending to you, if we do not receive 
your details, we will delete your email, and details from
our database completely.

Regards.
Transfers Department; RBI,


Re: [GIT PULL 1/2] ARM: EXYNOS: mach/soc changes for v4.6, 2nd

2016-03-12 Thread Olof Johansson
On Fri, Feb 26, 2016 at 09:05:02AM +0900, Krzysztof Kozlowski wrote:
> Hi Arnd, Kevin and Olof,
> 
> 
> Second pull request for v4.6 with mach/soc changes. This does
> not contain any external dependencies.
> 
> It includes movement of PMU code to separate driver (drivers/soc) but
> it does not have commits doing the same for the SROM controller driver
> (that part I will send separately).
> 
> 
> Kind regards,
> Krzysztof
> 
> 
> Cc: Pankaj Dubey 
> 
> 
> 
> The following changes since commit 92e963f50fc74041b5e9e744c330dca48e04f08d:
> 
>   Linux 4.5-rc1 (2016-01-24 13:06:47 -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
> tags/samsung-soc-4.6-2

Hi,

Apologies for the long latency here.

I should probably merge this into a late/* branch, but for now I've taken it
into next/soc because I feel guilty. :-)


-Olof


Re: [GIT PULL 1/2] ARM: EXYNOS: mach/soc changes for v4.6, 2nd

2016-03-12 Thread Olof Johansson
On Fri, Feb 26, 2016 at 09:05:02AM +0900, Krzysztof Kozlowski wrote:
> Hi Arnd, Kevin and Olof,
> 
> 
> Second pull request for v4.6 with mach/soc changes. This does
> not contain any external dependencies.
> 
> It includes movement of PMU code to separate driver (drivers/soc) but
> it does not have commits doing the same for the SROM controller driver
> (that part I will send separately).
> 
> 
> Kind regards,
> Krzysztof
> 
> 
> Cc: Pankaj Dubey 
> 
> 
> 
> The following changes since commit 92e963f50fc74041b5e9e744c330dca48e04f08d:
> 
>   Linux 4.5-rc1 (2016-01-24 13:06:47 -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
> tags/samsung-soc-4.6-2

Hi,

Apologies for the long latency here.

I should probably merge this into a late/* branch, but for now I've taken it
into next/soc because I feel guilty. :-)


-Olof


Re: [GIT PULL 2/2] ARM64: EXYNOS: mach/soc changes for v4.6, 2nd

2016-03-12 Thread Olof Johansson
On Fri, Feb 26, 2016 at 09:09:38AM +0900, Krzysztof Kozlowski wrote:
> On 26.02.2016 09:05, Krzysztof Kozlowski wrote:
> > Hi Arnd, Kevin and Olof,
> > 
> > 
> > Pull request for v4.6 with ARM64 mach/soc changes.
> > 
> > This depends on change in clk tree (removal of ARCH_EXYNOS7) which is
> > pulled here.
> > 
> > 
> > Kind regards,
> > Krzysztof
> > 
> > 
> > Cc: Sylwester Nawrocki 
> > Cc: Stephen Boyd 
> > Cc: Michael Turquette 
> > 
> > 
> > 
> > The following changes since commit 92e963f50fc74041b5e9e744c330dca48e04f08d:
> > 
> >   Linux 4.5-rc1 (2016-01-24 13:06:47 -0800)
> > 
> > are available in the git repository at:
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
> > tags/samsung-soc64-4.6-2
> > 
> > for you to fetch changes up to c87b3e970c70d5e27f9eb9acd09c6b5b9d589860:
> > 
> >   arm64: EXYNOS: Consolidate ARCH_EXYNOS7 symbol into ARCH_EXYNOS 
> > (2016-02-23 08:49:46 +0900)
> 
> And for easier grepping through history, below is the pull request
> for Exynos-specific change (no clk commits):
> 
> 
> The following changes since commit 85997a7cba7bc1578eb554e88f82023d85fb499a:
> 
>   clk: samsung: Don't build ARMv8 clock drivers on ARMv7 (2016-02-22 10:20:24 
> -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
> tags/samsung-soc64-4.6-2
> 
> for you to fetch changes up to c87b3e970c70d5e27f9eb9acd09c6b5b9d589860:
> 
>   arm64: EXYNOS: Consolidate ARCH_EXYNOS7 symbol into ARCH_EXYNOS (2016-02-23 
> 08:49:46 +0900)

Excellent, thanks! Merged into next/arm64.


-Olof


Re: [PATCH v3] ARM, ARM64: dts: drop "arm, amba-bus" in favor of "simple-bus"

2016-03-12 Thread Olof Johansson
On Wed, Mar 09, 2016 at 01:26:45PM +0900, Masahiro Yamada wrote:
> The compatible string "simple-bus" is well defined in ePAPR, while
> I see no documentation for the "arm,amba-bus" arnywhere in ePAPR or
> Documentation/devicetree/.
> 
> DT is also used by other projects than Linux kernel.  It is not a
> good idea to rely on such an unofficial binding.
> 
> This commit
>   - replaces "arm,amba-bus" with "simple-bus"
>   - drops "arm,amba-bus" where it is used along with "simple-bus"
> 
> Signed-off-by: Masahiro Yamada 
> ---

Thanks, applied.


-Olof


Re: [GIT PULL] ARM: EXYNOS: SROM driver for v4.6, 2nd try

2016-03-12 Thread Olof Johansson
On Thu, Mar 03, 2016 at 02:11:32PM +0100, Arnd Bergmann wrote:
> On Thursday 03 March 2016 09:04:54 Krzysztof Kozlowski wrote:
> > On 01.03.2016 18:37, Krzysztof Kozlowski wrote:
> > > Hi,
> > > 
> > > 
> > > After Olof comments, second pull request with movement of SROM code
> > > to separate driver - under drivers/memory/samsung (more are planned for
> > > that directory).
> > > 
> > > This depends on (included here):
> > > 1. tag samsung-dt-srom-4.6: SROM-DT changes, merged already to arm-soc,
> > > 2. tag samsung-soc-4.6-2: next/soc changes, sent few days ago, not merged 
> > > yet.
> > > 
> > > This may conflict in the future (in linux-next or Linus) around
> > > drivers/memory/Kconfig with iommu tree. Just add all the changes.
> > > 
> > > 
> > > The diff at the end contains both samsung-soc-4.6-2 and this stuff.
> > > To make finding changes easier, below you will find difference between
> > > this tag and samsung-soc-4.6-2:
> > 
> > I see you did not pull this yet so can you wait a little bit? Rob
> > Herring posted some comments on bindings so this might be revisited...
> > 
> > This is an unlucky patchset...
> 
> It was a bit late last night, and I didn't want to check that the
> dependencies were correct. I also saw that you had discussed these
> contents with Olof before, but didn't follow the thread there, so
> I was hoping that Olof could get back to it and check that his
> concerns are all addressed before picking it up.

Hi,

I've merged the other SoC branches now (that were respun without this SROM
contents). I think it's safe given the feedback from Rob to wait with this
driver for the next cycle. That way the dependencies are gone too since they
will have been merged.


-Olof


Re: [GIT PULL 2/2] ARM64: EXYNOS: mach/soc changes for v4.6, 2nd

2016-03-12 Thread Olof Johansson
On Fri, Feb 26, 2016 at 09:09:38AM +0900, Krzysztof Kozlowski wrote:
> On 26.02.2016 09:05, Krzysztof Kozlowski wrote:
> > Hi Arnd, Kevin and Olof,
> > 
> > 
> > Pull request for v4.6 with ARM64 mach/soc changes.
> > 
> > This depends on change in clk tree (removal of ARCH_EXYNOS7) which is
> > pulled here.
> > 
> > 
> > Kind regards,
> > Krzysztof
> > 
> > 
> > Cc: Sylwester Nawrocki 
> > Cc: Stephen Boyd 
> > Cc: Michael Turquette 
> > 
> > 
> > 
> > The following changes since commit 92e963f50fc74041b5e9e744c330dca48e04f08d:
> > 
> >   Linux 4.5-rc1 (2016-01-24 13:06:47 -0800)
> > 
> > are available in the git repository at:
> > 
> >   git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
> > tags/samsung-soc64-4.6-2
> > 
> > for you to fetch changes up to c87b3e970c70d5e27f9eb9acd09c6b5b9d589860:
> > 
> >   arm64: EXYNOS: Consolidate ARCH_EXYNOS7 symbol into ARCH_EXYNOS 
> > (2016-02-23 08:49:46 +0900)
> 
> And for easier grepping through history, below is the pull request
> for Exynos-specific change (no clk commits):
> 
> 
> The following changes since commit 85997a7cba7bc1578eb554e88f82023d85fb499a:
> 
>   clk: samsung: Don't build ARMv8 clock drivers on ARMv7 (2016-02-22 10:20:24 
> -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux.git 
> tags/samsung-soc64-4.6-2
> 
> for you to fetch changes up to c87b3e970c70d5e27f9eb9acd09c6b5b9d589860:
> 
>   arm64: EXYNOS: Consolidate ARCH_EXYNOS7 symbol into ARCH_EXYNOS (2016-02-23 
> 08:49:46 +0900)

Excellent, thanks! Merged into next/arm64.


-Olof


  1   2   3   4   5   6   >