Re: [PATCH v2 1/2] ARC: SMP: Set the default affinity to the boot cpu

2016-12-13 Thread Vineet Gupta
Hi Yuriy,

On 12/09/2016 01:59 AM, Yuriy Kolerov wrote:
> By default the kernel sets a value for default affinity which may
> not correspond to the real bitmap of potentially online CPUs. E.g.
> for ARC HS processors with 2 cores the default value of affinity in
> the kernel may be 0xF and it is wrong in this case. This happens
> because init_irq_default_affinity() sets all bits in
> irq_default_affinity variable by default.
>
> It is better to set the default value of affinity to the boot core
> to guarantee that value of irq_default_affinity contains at least
> one valid online CPU during the early stage of booting. It is
> necessary for proper configuration of affinity for common interrupt.
>
> Signed-off-by: Yuriy Kolerov 
> ---
>  arch/arc/kernel/irq.c | 6 ++
>  1 file changed, 6 insertions(+)
>
> diff --git a/arch/arc/kernel/irq.c b/arch/arc/kernel/irq.c
> index 538b36a..e53bfd5 100644
> --- a/arch/arc/kernel/irq.c
> +++ b/arch/arc/kernel/irq.c
> @@ -20,6 +20,12 @@
>   */
>  void __init init_IRQ(void)
>  {
> +#ifdef CONFIG_SMP
> + /* Set the default affinity to the boot cpu. */
> + cpumask_clear(irq_default_affinity);
> + cpumask_set_cpu(smp_processor_id(), irq_default_affinity);
> +#endif
> +
>   /*
>* process the entire interrupt tree in one go
>* Any external intc will be setup provided DT chains them

For a multi patch series, always include a cover letter. This gives an idea of
over intent of the series.
Also there is no record of what changed between v1 and v2. Reviewers typically
have a short memory span :-)
Also try to include all the reviewers: in this case Marc Z gave very good 
feedback
and direction for patches.
This is just a general lkml submission best practice !

Now on to the patch itself, I don't like arch code fudging a core genirq global
variable. If at all this needs to be moved into core code - assuming this is the
right thing to do !

Marc , tglx ?
-Vineet

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH v2 2/2] ARCv2: MCIP: Deprecate setting of affinity in Device Tree

2016-12-13 Thread Vineet Gupta
On 12/09/2016 01:59 AM, Yuriy Kolerov wrote:
> Ignore value of interrupt distribution mode for common interrupts in
> IDU since setting of affinity using value from Device Tree is deprecated
> in ARC. Originally it is done in idu_irq_xlate() function and it is
> semantically wrong and does not guaranty that an affinity value will be
> set properly. idu_irq_map() function is better place since it is called
> once for each IRQ.
> 
> The affinity of common interrupts in IDU must be set manually since
> in some cases the kernel will not call irq_set_affinity() by itself:
> 
> 1. When the kernel is not configured with support of SMP.
> 2. When the kernel is configured with support of SMP but upper
>interrupt controllers does not support setting of the affinity
>and cannot propagate it to IDU.
> 
> By default send all common interrupts to the boot CPU. If the kernel
> has support of SMP then use irq_default_affinity as the affinity
> for IDU common interrupts since it is set to the boot CPU by default.
> If the kernel is configured without support of SMP then use
> cpu_online_mask since in this case it must always contain a valid
> bitmap with only 1 online CPU.
> 
> Signed-off-by: Yuriy Kolerov 
> ---
>  .../interrupt-controller/snps,archs-idu-intc.txt   |  3 ++
>  arch/arc/kernel/mcip.c | 60 
> +++---
>  2 files changed, 33 insertions(+), 30 deletions(-)
> 
> diff --git 
> a/Documentation/devicetree/bindings/interrupt-controller/snps,archs-idu-intc.txt
>  
> b/Documentation/devicetree/bindings/interrupt-controller/snps,archs-idu-intc.txt
> index 0dcb7c7..9446576 100644
> --- 
> a/Documentation/devicetree/bindings/interrupt-controller/snps,archs-idu-intc.txt
> +++ 
> b/Documentation/devicetree/bindings/interrupt-controller/snps,archs-idu-intc.txt
> @@ -15,6 +15,9 @@ Properties:
>Second cell specifies the irq distribution mode to cores
>   0=Round Robin; 1=cpu0, 2=cpu1, 4=cpu2, 8=cpu3
>  
> +  The second cell in interrupts property is deprecated and may be ignored by
> +  the kernel.
> +
>intc accessed via the special ARC AUX register interface, hence "reg" 
> property
>is not specified.
>  
> diff --git a/arch/arc/kernel/mcip.c b/arch/arc/kernel/mcip.c
> index f39142a..5b36f7b 100644
> --- a/arch/arc/kernel/mcip.c
> +++ b/arch/arc/kernel/mcip.c
> @@ -174,7 +174,6 @@ static void idu_irq_unmask(struct irq_data *data)
>   raw_spin_unlock_irqrestore(&mcip_lock, flags);
>  }
>  
> -#ifdef CONFIG_SMP
>  static int
>  idu_irq_set_affinity(struct irq_data *data, const struct cpumask *cpumask,
>bool force)
> @@ -204,7 +203,6 @@ idu_irq_set_affinity(struct irq_data *data, const struct 
> cpumask *cpumask,
>  
>   return IRQ_SET_MASK_OK;
>  }
> -#endif
>  
>  static struct irq_chip idu_irq_chip = {
>   .name   = "MCIP IDU Intc",
> @@ -229,9 +227,33 @@ static void idu_cascade_isr(struct irq_desc *desc)
>  
>  static int idu_irq_map(struct irq_domain *d, unsigned int virq, 
> irq_hw_number_t hwirq)
>  {
> + struct irq_data *irqd = irq_get_irq_data(virq);
> +
>   irq_set_chip_and_handler(virq, &idu_irq_chip, handle_level_irq);
>   irq_set_status_flags(virq, IRQ_MOVE_PCNTXT);
>  
> + /*
> +  * The affinity of common interrupts in IDU must be set manually since
> +  * in some cases the kernel will not call irq_set_affinity() by itself:
> +  *
> +  *   1. When the kernel is not configured with support of SMP.
> +  *   2. When the kernel is configured with support of SMP but upper
> +  *  interrupt controllers does not support setting of the affinity
> +  *  and cannot propagate it to IDU.
> +  *
> +  * By default send all common interrupts to the boot CPU. If the kernel
> +  * has support of SMP then use irq_default_affinity as the affinity
> +  * for IDU common interrupts since it is set to the boot CPU by default.
> +  * If the kernel is configured without support of SMP then use
> +  * cpu_online_mask since in this case it must always contain a valid
> +  * bitmap with only 1 online CPU.
> +  */
> +#ifdef CONFIG_SMP
> + idu_irq_set_affinity(irqd, irq_default_affinity, false);
> +#else
> + idu_irq_set_affinity(irqd, cpu_online_mask, false);
> +#endif

Why even bother with using a genirq global. Just create a new cpu bitmap with
smp_processor_id() and use it for both UP/SMP. Isn't that simpler and leave 
genirq
alone.

> +
>   return 0;
>  }
>  
> @@ -239,36 +261,14 @@ static int idu_irq_xlate(struct irq_domain *d, struct 
> device_node *n,
>const u32 *intspec, unsigned int intsize,
>irq_hw_number_t *out_hwirq, unsigned int *out_type)
>  {
> - irq_hw_number_t hwirq = *out_hwirq = intspec[0];
> - int distri = intspec[1];
> - unsigned long flags;
> -
> + /*
> +  * Ignore value of interrupt distribution mode for common interrupts in
> +   

kisskb: OK linus/axs103_smp_defconfig/arcv2 Wed Dec 14, 18:32

2016-12-13 Thread noreply
OK linus/axs103_smp_defconfig/arcv2 Wed Dec 14, 18:32

http://kisskb.ellerman.id.au/kisskb/buildresult/12884321/

Commit:   Merge tag 'drm-for-v4.10' of 
git://people.freedesktop.org/~airlied/linux
  9439b3710df688d853eb6cb4851256f2c92b1797
Compiler: arc-linux-gcc.br_real (Buildroot 2016.11-git-00613-ge98b4dd) 6.2.1 
20160824

Possible errors
---

   - Error handling fixes
  drm/nouveau/gr/gf100-: properly ack all FECS error interrupts
 #define KERN_ERR KERN_SOH "3" /* error conditions */
 #define KERN_ERR KERN_SOH "3" /* error conditions */
 #define KERN_ERR KERN_SOH "3" /* error conditions */
 #define KERN_ERR KERN_SOH "3" /* error conditions */

Possible warnings (80)
--

kernel/sched/core.c:3293:1: warning: control reaches end of non-void function 
[-Wreturn-type]
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast
drivers/base/component.c:101:24: warning: format '%zu' expects argument of type 
'size_t', but argument 4 has type 'unsigned int' [-Wformat=]
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast
include/linux/kern_levels.h:4:18: warning: format '%zd' expects argument of 
type 'signed size_t', but argument 3 has type 'size_t {aka unsigned int}' 
[-Wformat=]
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast
include/linux/kern_levels.h:4:18: warning: format '%zu' expects argument of 
type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=]
include/linux/kern_levels.h:4:18: warning: format '%zu' expects argument of 
type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=]
mm/percpu.c:890:14: warning: format '%zu' expects argument of type 'size_t', 
but argument 4 has type 'unsigned int' [-Wformat=]
mm/percpu.c:890:14: warning: format '%zu' expects argument of type 'size_t', 
but argument 5 has type 'unsigned int' [-Wformat=]
include/linux/kern_levels.h:4:18: warning: format '%zu' expects argument of 
type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=]
 #define KERN_WARNING KERN_SOH "4" /* warning conditions */
include/linux/kern_levels.h:4:18: warning: format '%zu' expects argument of 
type 'size_t', but argument 3 has type 'unsigned int' [-Wformat=]
 #define KERN_WARNING KERN_SOH "4" /* warning conditions */
mm/percpu.c:1457:27: warning: format '%zu' expects argument of type 'size_t', 
but argument 3 has type 'unsigned int' [-Wformat=]
mm/percpu.c:1457:32: warning: format '%zu' expects argument of type 'size_t', 
but argument 4 has type 'unsigned int' [-Wformat=]
mm/percpu.c:1457:37: warning: format '%zu' expects argument of type 'size_t', 
but argument 5 has type 'unsigned int' [-Wformat=]
mm/percpu.c:1457:42: warning: format '%zu' expects argument of type 'size_t', 
but argument 6 has type 'unsigned int' [-Wformat=]
mm/percpu.c:1457:52: warning: format '%zu' expects argument of type 'size_t', 
but argument 7 has type 'unsigned int' [-Wformat=]
mm/percpu.c:1457:56: warning: format '%zu' expects argument of type 'size_t', 
but argument 8 has type 'unsigned int' [-Wformat=]
include/linux/kern_levels.h:4:18: warning: format '%zu' expects argument of 
type 'size_t', but argument 2 has type 'unsigned int' [-Wformat=]
include/linux/kern_levels.h:4:18: warning: format '%zu' expects argument of 
type 'size_t', but argument 4 has type 'unsigned int' [-Wformat=]
include/linux/kern_levels.h:4:18: warning: format '%zu' expects argument of 
type 'size_t', but argument 5 has type 'unsigned int' [-Wformat=]
include/linux/kern_levels.h:4:18: warning: format '%zu' expects argument of 
type 'size_t', but argument 6 has type 'unsigned int' [-Wformat=]
include/linux/kern_levels.h:4:18: warning: format '%zu' expects argument of 
type 'size_t', but argument 7 has type 'unsigned int' [-Wformat=]
fs/buffer.c:242:37: warning: format '%zu' expects argument of type 'size_t', 
but argument 3 has type 'unsigned int' [-Wformat=]
mm/slab_common.c:815:45: warning: format '%zu' expects argument of type 
'size_t', but argument 3 has type 'unsigned int' [-Wformat=]
drivers/base/regmap/regmap.c:1396:22: warning: format '%zu' expects argument of 
type 'size_t', but argument 5 has type 'unsigned int' [-Wformat=]
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast
include/linux/kern_levels.h:4:18: warning: format '%zd' expects argument of 
type 'signed size_t', but argument 3 has type 'size_t {aka const unsigned int}' 
[-Wformat=]
include/linux/kernel.h

kisskb: OK linus/axs101_defconfig/arcompact Wed Dec 14, 18:33

2016-12-13 Thread noreply
OK linus/axs101_defconfig/arcompact Wed Dec 14, 18:33

http://kisskb.ellerman.id.au/kisskb/buildresult/12884322/

Commit:   Merge tag 'drm-for-v4.10' of 
git://people.freedesktop.org/~airlied/linux
  9439b3710df688d853eb6cb4851256f2c92b1797
Compiler: arc-buildroot-linux-uclibc-gcc (Buildroot 2015.08.1) 4.8.4

Possible errors
---

   - Error handling fixes
  drm/nouveau/gr/gf100-: properly ack all FECS error interrupts

Possible warnings (16)
--

kernel/sched/core.c:3293:1: warning: control reaches end of non-void function 
[-Wreturn-type]
include/linux/kernel.h:739:16: warning: comparison of distinct pointer types 
lacks a cast [enabled by default]
block/cfq-iosched.c:3826:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
net/core/ethtool.c:311:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
include/linux/sunrpc/svc_xprt.h:177:1: warning: control reaches end of non-void 
function [-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
net/ipv4/tcp_input.c:4301:49: warning: array subscript is above array bounds 
[-Warray-bounds]
fs/ext4/ext4_jbd2.h:428:1: warning: control reaches end of non-void function 
[-Wreturn-type]
drivers/scsi/sd.c:1155:1: warning: control reaches end of non-void function 
[-Wreturn-type]


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc