Re: [RFC PATCH v3 19/19] smp, x86: kill SMP single function call interrupt

2013-12-15 Thread Jiang Liu
Hi Sebastian,
Thanks for your review.
The patch applies to the mainstream kernel, so seems there's difference
between tip and the mainstream kernel. I will try to find the
difference.
And there's another patch for Xen, but I found the mail tile is
wrong:( Please refer to:
http://www.kernelhub.org/?msg=373208p=2

Should I merge the patch for xen with the patch for native x86?
Is there any dependency between them?

Thanks!
Gerry

On 12/12/2013 06:10 AM, Sebastian Andrzej Siewior wrote:
 On 05.12.13, Jiang Liu wrote:
 
 I like this in general however
 
 diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
 index 7cf1689..f241792 100644
 --- a/arch/x86/xen/smp.c
 +++ b/arch/x86/xen/smp.c
 @@ -560,7 +560,6 @@ static inline int xen_map_vector(int vector)
  xen_vector = XEN_RESCHEDULE_VECTOR;
  break;
  case CALL_FUNCTION_VECTOR:
 -case CALL_FUNCTION_SINGLE_VECTOR:
  xen_vector = XEN_CALL_FUNCTION_VECTOR;
  break;
  case IRQ_WORK_VECTOR:
 
 This chunk does not apply again tip's master branch, the code looks
 different. You need to also kill XEN_CALL_FUNCTION_SINGLE_VECTOR which
 is either part of a different patch or against a different tree. I
 haven't seen a note in 0/19 or this patch description so I'm confused
 here :)
 
 Sebastian
 

___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization


[PATCH v3 [resend] 14/18] smp, x86, xen: kill SMP single function call interrupt

2013-12-15 Thread Jiang Liu
Commit 9a46ad6d6df3b54 smp: make smp_call_function_many() use logic
similar to smp_call_function_single() has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Cc: Andrew Morton a...@linux-foundation.org
Cc: Shaohua Li s...@kernel.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Cc: Ingo Molnar mi...@elte.hu
Cc: Steven Rostedt rost...@goodmis.org
Cc: Jiri Kosina triv...@kernel.org
Cc: Thomas Gleixner t...@linutronix.de
Cc: H. Peter Anvin h...@zytor.com
Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com
Cc: Jeremy Fitzhardinge jer...@goop.org
Cc: Sebastian Andrzej Siewior sebast...@breakpoint.cc
Cc: x...@kernel.org
Cc: xen-de...@lists.xensource.com
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Jiang Liu liu...@gmail.com
---
 arch/x86/include/asm/xen/events.h |  1 -
 arch/x86/xen/smp.c| 38 ++
 2 files changed, 2 insertions(+), 37 deletions(-)

diff --git a/arch/x86/include/asm/xen/events.h 
b/arch/x86/include/asm/xen/events.h
index 608a79d..a9e54dc 100644
--- a/arch/x86/include/asm/xen/events.h
+++ b/arch/x86/include/asm/xen/events.h
@@ -4,7 +4,6 @@
 enum ipi_vector {
XEN_RESCHEDULE_VECTOR,
XEN_CALL_FUNCTION_VECTOR,
-   XEN_CALL_FUNCTION_SINGLE_VECTOR,
XEN_SPIN_UNLOCK_VECTOR,
XEN_IRQ_WORK_VECTOR,
XEN_NMI_VECTOR,
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index c36b325..7cf1689 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -46,12 +46,10 @@ struct xen_common_irq {
 };
 static DEFINE_PER_CPU(struct xen_common_irq, xen_resched_irq) = { .irq = -1 };
 static DEFINE_PER_CPU(struct xen_common_irq, xen_callfunc_irq) = { .irq = -1 };
-static DEFINE_PER_CPU(struct xen_common_irq, xen_callfuncsingle_irq) = { .irq 
= -1 };
 static DEFINE_PER_CPU(struct xen_common_irq, xen_irq_work) = { .irq = -1 };
 static DEFINE_PER_CPU(struct xen_common_irq, xen_debug_irq) = { .irq = -1 };
 
 static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id);
-static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id);
 static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id);
 
 /*
@@ -123,13 +121,6 @@ static void xen_smp_intr_free(unsigned int cpu)
kfree(per_cpu(xen_debug_irq, cpu).name);
per_cpu(xen_debug_irq, cpu).name = NULL;
}
-   if (per_cpu(xen_callfuncsingle_irq, cpu).irq = 0) {
-   unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu).irq,
-  NULL);
-   per_cpu(xen_callfuncsingle_irq, cpu).irq = -1;
-   kfree(per_cpu(xen_callfuncsingle_irq, cpu).name);
-   per_cpu(xen_callfuncsingle_irq, cpu).name = NULL;
-   }
if (xen_hvm_domain())
return;
 
@@ -178,18 +169,6 @@ static int xen_smp_intr_init(unsigned int cpu)
per_cpu(xen_debug_irq, cpu).irq = rc;
per_cpu(xen_debug_irq, cpu).name = debug_name;
 
-   callfunc_name = kasprintf(GFP_KERNEL, callfuncsingle%d, cpu);
-   rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
-   cpu,
-   xen_call_function_single_interrupt,
-   IRQF_PERCPU|IRQF_NOBALANCING,
-   callfunc_name,
-   NULL);
-   if (rc  0)
-   goto fail;
-   per_cpu(xen_callfuncsingle_irq, cpu).irq = rc;
-   per_cpu(xen_callfuncsingle_irq, cpu).name = callfunc_name;
-
/*
 * The IRQ worker on PVHVM goes through the native path and uses the
 * IPI mechanism.
@@ -569,8 +548,7 @@ static void xen_smp_send_call_function_ipi(const struct 
cpumask *mask)
 
 static void xen_smp_send_call_function_single_ipi(int cpu)
 {
-   __xen_send_IPI_mask(cpumask_of(cpu),
- XEN_CALL_FUNCTION_SINGLE_VECTOR);
+   __xen_send_IPI_mask(cpumask_of(cpu), XEN_CALL_FUNCTION_VECTOR);
 }
 
 static inline int xen_map_vector(int vector)
@@ -582,10 +560,8 @@ static inline int xen_map_vector(int vector)
xen_vector = XEN_RESCHEDULE_VECTOR;
break;
case CALL_FUNCTION_VECTOR:
-   xen_vector = XEN_CALL_FUNCTION_VECTOR;
-   break;
case CALL_FUNCTION_SINGLE_VECTOR:
-   xen_vector = XEN_CALL_FUNCTION_SINGLE_VECTOR;
+   xen_vector = XEN_CALL_FUNCTION_VECTOR;
break;
case IRQ_WORK_VECTOR:
xen_vector = XEN_IRQ_WORK_VECTOR;
@@ -663,16 +639,6 @@ static irqreturn_t xen_call_function_interrupt(int irq, 
void *dev_id)
return IRQ_HANDLED;
 }
 
-static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
-{
-   irq_enter();
-   

[PATCH v3 [resend] 15/18] smp, x86: kill SMP single function call interrupt

2013-12-15 Thread Jiang Liu
Commit 9a46ad6d6df3b54 smp: make smp_call_function_many() use logic
similar to smp_call_function_single() has unified the way to handle
single and multiple cross-CPU function calls. Now only one interrupt
is needed for architecture specific code to support generic SMP function
call interfaces, so kill the redundant single function call interrupt.

Cc: Andrew Morton a...@linux-foundation.org
Cc: Shaohua Li s...@kernel.org
Cc: Peter Zijlstra a.p.zijls...@chello.nl
Cc: Ingo Molnar mi...@elte.hu
Cc: Steven Rostedt rost...@goodmis.org
Cc: Jiri Kosina triv...@kernel.org
Cc: Thomas Gleixner t...@linutronix.de
Cc: H. Peter Anvin h...@zytor.com
Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com
Cc: Jeremy Fitzhardinge jer...@goop.org
Cc: Sebastian Andrzej Siewior sebast...@breakpoint.cc
Cc: x...@kernel.org
Cc: xen-de...@lists.xensource.com
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Jiang Liu liu...@gmail.com
---
 arch/x86/include/asm/entry_arch.h|  1 -
 arch/x86/include/asm/hw_irq.h|  3 ---
 arch/x86/include/asm/irq_vectors.h   |  7 +++
 arch/x86/include/asm/trace/irq_vectors.h |  6 --
 arch/x86/kernel/entry_64.S   |  2 --
 arch/x86/kernel/irqinit.c|  4 
 arch/x86/kernel/smp.c| 24 +---
 arch/x86/xen/smp.c   |  1 -
 8 files changed, 4 insertions(+), 44 deletions(-)

diff --git a/arch/x86/include/asm/entry_arch.h 
b/arch/x86/include/asm/entry_arch.h
index dc5fa66..9670cff 100644
--- a/arch/x86/include/asm/entry_arch.h
+++ b/arch/x86/include/asm/entry_arch.h
@@ -12,7 +12,6 @@
 #ifdef CONFIG_SMP
 BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR)
 BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR)
-BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR)
 BUILD_INTERRUPT3(irq_move_cleanup_interrupt, IRQ_MOVE_CLEANUP_VECTOR,
 smp_irq_move_cleanup_interrupt)
 BUILD_INTERRUPT3(reboot_interrupt, REBOOT_VECTOR, smp_reboot_interrupt)
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index cba45d9..66bacec 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -75,7 +75,6 @@ extern asmlinkage void reboot_interrupt(void);
 extern asmlinkage void threshold_interrupt(void);
 
 extern asmlinkage void call_function_interrupt(void);
-extern asmlinkage void call_function_single_interrupt(void);
 
 #ifdef CONFIG_TRACING
 /* Interrupt handlers registered during init_IRQ */
@@ -88,7 +87,6 @@ extern void trace_thermal_interrupt(void);
 extern void trace_reschedule_interrupt(void);
 extern void trace_threshold_interrupt(void);
 extern void trace_call_function_interrupt(void);
-extern void trace_call_function_single_interrupt(void);
 #define trace_irq_move_cleanup_interrupt  irq_move_cleanup_interrupt
 #define trace_reboot_interrupt  reboot_interrupt
 #define trace_kvm_posted_intr_ipi kvm_posted_intr_ipi
@@ -182,7 +180,6 @@ extern asmlinkage void smp_irq_move_cleanup_interrupt(void);
 #ifdef CONFIG_SMP
 extern __visible void smp_reschedule_interrupt(struct pt_regs *);
 extern __visible void smp_call_function_interrupt(struct pt_regs *);
-extern __visible void smp_call_function_single_interrupt(struct pt_regs *);
 extern __visible void smp_invalidate_interrupt(struct pt_regs *);
 #endif
 
diff --git a/arch/x86/include/asm/irq_vectors.h 
b/arch/x86/include/asm/irq_vectors.h
index 5702d7e..98a302d 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -92,10 +92,9 @@
 #define ERROR_APIC_VECTOR  0xfe
 #define RESCHEDULE_VECTOR  0xfd
 #define CALL_FUNCTION_VECTOR   0xfc
-#define CALL_FUNCTION_SINGLE_VECTOR0xfb
-#define THERMAL_APIC_VECTOR0xfa
-#define THRESHOLD_APIC_VECTOR  0xf9
-#define REBOOT_VECTOR  0xf8
+#define THERMAL_APIC_VECTOR0xfb
+#define THRESHOLD_APIC_VECTOR  0xfa
+#define REBOOT_VECTOR  0xf9
 
 /*
  * Generic system vector for platform specific use
diff --git a/arch/x86/include/asm/trace/irq_vectors.h 
b/arch/x86/include/asm/trace/irq_vectors.h
index 4cab890..e672e20 100644
--- a/arch/x86/include/asm/trace/irq_vectors.h
+++ b/arch/x86/include/asm/trace/irq_vectors.h
@@ -89,12 +89,6 @@ TRACE_EVENT_PERF_PERM(irq_work_exit, 
is_sampling_event(p_event) ? -EPERM : 0);
 DEFINE_IRQ_VECTOR_EVENT(call_function);
 
 /*
- * call_function_single - called when entering/exiting a call function
- * single interrupt vector handler
- */
-DEFINE_IRQ_VECTOR_EVENT(call_function_single);
-
-/*
  * threshold_apic - called when entering/exiting a threshold apic interrupt
  * vector handler
  */
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index e21b078..8d5d21a 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1182,8 +1182,6 @@ apicinterrupt THERMAL_APIC_VECTOR \
 #endif
 
 #ifdef CONFIG_SMP
-apicinterrupt 

Re: [PATCH v3 [resend] 14/18] smp, x86, xen: kill SMP single function call interrupt

2013-12-15 Thread Konrad Rzeszutek Wilk
On Mon, Dec 16, 2013 at 12:36:36AM +0800, Jiang Liu wrote:
 Commit 9a46ad6d6df3b54 smp: make smp_call_function_many() use logic
 similar to smp_call_function_single() has unified the way to handle
 single and multiple cross-CPU function calls. Now only one interrupt
 is needed for architecture specific code to support generic SMP function
 call interfaces, so kill the redundant single function call interrupt.
 
 Cc: Andrew Morton a...@linux-foundation.org
 Cc: Shaohua Li s...@kernel.org
 Cc: Peter Zijlstra a.p.zijls...@chello.nl
 Cc: Ingo Molnar mi...@elte.hu
 Cc: Steven Rostedt rost...@goodmis.org
 Cc: Jiri Kosina triv...@kernel.org
 Cc: Thomas Gleixner t...@linutronix.de
 Cc: H. Peter Anvin h...@zytor.com
 Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com

I presume this has been tested?

 Cc: Jeremy Fitzhardinge jer...@goop.org
 Cc: Sebastian Andrzej Siewior sebast...@breakpoint.cc
 Cc: x...@kernel.org
 Cc: xen-de...@lists.xensource.com
 Cc: virtualization@lists.linux-foundation.org
 Signed-off-by: Jiang Liu liu...@gmail.com
 ---
  arch/x86/include/asm/xen/events.h |  1 -
  arch/x86/xen/smp.c| 38 ++
  2 files changed, 2 insertions(+), 37 deletions(-)
 
 diff --git a/arch/x86/include/asm/xen/events.h 
 b/arch/x86/include/asm/xen/events.h
 index 608a79d..a9e54dc 100644
 --- a/arch/x86/include/asm/xen/events.h
 +++ b/arch/x86/include/asm/xen/events.h
 @@ -4,7 +4,6 @@
  enum ipi_vector {
   XEN_RESCHEDULE_VECTOR,
   XEN_CALL_FUNCTION_VECTOR,
 - XEN_CALL_FUNCTION_SINGLE_VECTOR,
   XEN_SPIN_UNLOCK_VECTOR,
   XEN_IRQ_WORK_VECTOR,
   XEN_NMI_VECTOR,
 diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
 index c36b325..7cf1689 100644
 --- a/arch/x86/xen/smp.c
 +++ b/arch/x86/xen/smp.c
 @@ -46,12 +46,10 @@ struct xen_common_irq {
  };
  static DEFINE_PER_CPU(struct xen_common_irq, xen_resched_irq) = { .irq = -1 
 };
  static DEFINE_PER_CPU(struct xen_common_irq, xen_callfunc_irq) = { .irq = -1 
 };
 -static DEFINE_PER_CPU(struct xen_common_irq, xen_callfuncsingle_irq) = { 
 .irq = -1 };
  static DEFINE_PER_CPU(struct xen_common_irq, xen_irq_work) = { .irq = -1 };
  static DEFINE_PER_CPU(struct xen_common_irq, xen_debug_irq) = { .irq = -1 };
  
  static irqreturn_t xen_call_function_interrupt(int irq, void *dev_id);
 -static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id);
  static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id);
  
  /*
 @@ -123,13 +121,6 @@ static void xen_smp_intr_free(unsigned int cpu)
   kfree(per_cpu(xen_debug_irq, cpu).name);
   per_cpu(xen_debug_irq, cpu).name = NULL;
   }
 - if (per_cpu(xen_callfuncsingle_irq, cpu).irq = 0) {
 - unbind_from_irqhandler(per_cpu(xen_callfuncsingle_irq, cpu).irq,
 -NULL);
 - per_cpu(xen_callfuncsingle_irq, cpu).irq = -1;
 - kfree(per_cpu(xen_callfuncsingle_irq, cpu).name);
 - per_cpu(xen_callfuncsingle_irq, cpu).name = NULL;
 - }
   if (xen_hvm_domain())
   return;
  
 @@ -178,18 +169,6 @@ static int xen_smp_intr_init(unsigned int cpu)
   per_cpu(xen_debug_irq, cpu).irq = rc;
   per_cpu(xen_debug_irq, cpu).name = debug_name;
  
 - callfunc_name = kasprintf(GFP_KERNEL, callfuncsingle%d, cpu);
 - rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
 - cpu,
 - xen_call_function_single_interrupt,
 - IRQF_PERCPU|IRQF_NOBALANCING,
 - callfunc_name,
 - NULL);
 - if (rc  0)
 - goto fail;
 - per_cpu(xen_callfuncsingle_irq, cpu).irq = rc;
 - per_cpu(xen_callfuncsingle_irq, cpu).name = callfunc_name;
 -
   /*
* The IRQ worker on PVHVM goes through the native path and uses the
* IPI mechanism.
 @@ -569,8 +548,7 @@ static void xen_smp_send_call_function_ipi(const struct 
 cpumask *mask)
  
  static void xen_smp_send_call_function_single_ipi(int cpu)
  {
 - __xen_send_IPI_mask(cpumask_of(cpu),
 -   XEN_CALL_FUNCTION_SINGLE_VECTOR);
 + __xen_send_IPI_mask(cpumask_of(cpu), XEN_CALL_FUNCTION_VECTOR);
  }
  
  static inline int xen_map_vector(int vector)
 @@ -582,10 +560,8 @@ static inline int xen_map_vector(int vector)
   xen_vector = XEN_RESCHEDULE_VECTOR;
   break;
   case CALL_FUNCTION_VECTOR:
 - xen_vector = XEN_CALL_FUNCTION_VECTOR;
 - break;
   case CALL_FUNCTION_SINGLE_VECTOR:
 - xen_vector = XEN_CALL_FUNCTION_SINGLE_VECTOR;
 + xen_vector = XEN_CALL_FUNCTION_VECTOR;
   break;
   case IRQ_WORK_VECTOR:
   xen_vector = XEN_IRQ_WORK_VECTOR;
 @@ -663,16 +639,6 @@ static irqreturn_t xen_call_function_interrupt(int irq, 
 void *dev_id)
   return IRQ_HANDLED;
  }
  
 -static 

RE: [PATCH v3 [resend] 14/18] smp, x86, xen: kill SMP single function call interrupt

2013-12-15 Thread Liu, Jinsong
Konrad Rzeszutek Wilk wrote:
 On Mon, Dec 16, 2013 at 12:36:36AM +0800, Jiang Liu wrote:
 Commit 9a46ad6d6df3b54 smp: make smp_call_function_many() use logic
 similar to smp_call_function_single() has unified the way to handle
 single and multiple cross-CPU function calls. Now only one interrupt
 is needed for architecture specific code to support generic SMP
 function 
 call interfaces, so kill the redundant single function call
 interrupt. 
 
 Cc: Andrew Morton a...@linux-foundation.org
 Cc: Shaohua Li s...@kernel.org
 Cc: Peter Zijlstra a.p.zijls...@chello.nl
 Cc: Ingo Molnar mi...@elte.hu
 Cc: Steven Rostedt rost...@goodmis.org
 Cc: Jiri Kosina triv...@kernel.org
 Cc: Thomas Gleixner t...@linutronix.de
 Cc: H. Peter Anvin h...@zytor.com
 Cc: Konrad Rzeszutek Wilk konrad.w...@oracle.com
 
 I presume this has been tested?
 

I have just test Jiang's patch, it works fine for dom0 booting.

Thanks,
Jinsong


___
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization