All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -v2] x86, irq: get correct available vectors for cpu disable
@ 2014-01-26 20:50 Yinghai Lu
  2014-01-28 18:43 ` Prarit Bhargava
  0 siblings, 1 reply; 3+ messages in thread
From: Yinghai Lu @ 2014-01-26 20:50 UTC (permalink / raw)
  To: Ingo Molnar, H. Peter Anvin
  Cc: Thomas Gleixner, Prarit Bhargava, linux-kernel, Yinghai Lu

assign_irq_vector will stop before first_system_vector.
also it will not vector that is set in used_vectors.

used_vectors is used to track non per_cpu irq_vector in vector_irq.
It include first 32 exception [0,1f) and system vector near 0xfe.
and IA32_SYSCALL_VECTOR (0x80), IRQ_MOVE_CLEANUP_VECTOR (0x20).

So add checking for them for counting avaiable vectors.

-v2: fix compiling problem.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>

---
 arch/x86/kernel/irq.c |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

Index: linux-2.6/arch/x86/kernel/irq.c
===================================================================
--- linux-2.6.orig/arch/x86/kernel/irq.c
+++ linux-2.6/arch/x86/kernel/irq.c
@@ -17,6 +17,7 @@
 #include <asm/idle.h>
 #include <asm/mce.h>
 #include <asm/hw_irq.h>
+#include <asm/desc.h>
 
 #define CREATE_TRACE_POINTS
 #include <asm/trace/irq_vectors.h>
@@ -321,8 +322,19 @@ int check_irq_vectors_for_cpu_disable(vo
 	for_each_online_cpu(cpu) {
 		if (cpu == this_cpu)
 			continue;
-		for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS;
-		     vector++) {
+
+		/*
+		 * assign_irq_vector() only use vector under
+		 * first_system_vector and not set in used_vectors bitmask.
+		 * used_vectors could have bits set for
+		 *	IA32_SYSCALL_VECTOR (0x80)
+		 *	IRQ_MOVE_CLEANUP_VECTOR (0x20)
+		 */
+		for (vector = FIRST_EXTERNAL_VECTOR;
+		     vector < first_system_vector; vector++) {
+			if (test_bit(vector, used_vectors))
+				continue;
+
 			if (per_cpu(vector_irq, cpu)[vector] < 0)
 				count++;
 		}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -v2] x86, irq: get correct available vectors for cpu disable
  2014-01-26 20:50 [PATCH -v2] x86, irq: get correct available vectors for cpu disable Yinghai Lu
@ 2014-01-28 18:43 ` Prarit Bhargava
  2014-01-28 21:47   ` Yinghai Lu
  0 siblings, 1 reply; 3+ messages in thread
From: Prarit Bhargava @ 2014-01-28 18:43 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: Ingo Molnar, H. Peter Anvin, Thomas Gleixner, linux-kernel



On 01/26/2014 03:50 PM, Yinghai Lu wrote:
> assign_irq_vector will stop before first_system_vector.
> also it will not vector that is set in used_vectors.
> 
> used_vectors is used to track non per_cpu irq_vector in vector_irq.
> It include first 32 exception [0,1f) and system vector near 0xfe.
> and IA32_SYSCALL_VECTOR (0x80), IRQ_MOVE_CLEANUP_VECTOR (0x20).
> 
> So add checking for them for counting avaiable vectors.
> 

Yinghai, no objection to the patch ... but how about


used_vectors is a bitmap for global irqs; it tracks the non per_cpu
irq_vectors in vector_irq.  used_vectors contains information on the first 32
exceptions (0 to 0x1f), the system vectors near the first system vector
(0xfe), the IA32_SYSCALL_VECTOR (0x80), and the IRQ_MOVE_CLEANUP_VECTOR (0x20)

assign_irq_vectors() assigns vectors up to first_system_vector (0xfe) and
sets the used_vectors bit for each assigned vector.  Currently, the
IRQ checking code only scans from the FIRST_EXTERNAL_VECTOR to the end of
the vectors.  This patch modifies the code to scan to first_system_vector
and do a test on the used_vectors bitmap.


... and ...

> -v2: fix compiling problem.
> 
> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
> 
> ---
>  arch/x86/kernel/irq.c |   16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6/arch/x86/kernel/irq.c
> ===================================================================
> --- linux-2.6.orig/arch/x86/kernel/irq.c
> +++ linux-2.6/arch/x86/kernel/irq.c
> @@ -17,6 +17,7 @@
>  #include <asm/idle.h>
>  #include <asm/mce.h>
>  #include <asm/hw_irq.h>
> +#include <asm/desc.h>
>  
>  #define CREATE_TRACE_POINTS
>  #include <asm/trace/irq_vectors.h>
> @@ -321,8 +322,19 @@ int check_irq_vectors_for_cpu_disable(vo
>  	for_each_online_cpu(cpu) {
>  		if (cpu == this_cpu)
>  			continue;
> -		for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS;
> -		     vector++) {
> +
> +		/*
> +		 * assign_irq_vector() only use vector under
> +		 * first_system_vector and not set in used_vectors bitmask.
> +		 * used_vectors could have bits set for
> +		 *	IA32_SYSCALL_VECTOR (0x80)
> +		 *	IRQ_MOVE_CLEANUP_VECTOR (0x20)
> +		 */


+               /*
+                * assign_irq_vector() will only scan non per_cpu vectors from
+                * FIRST_EXTERNAL_VECTOR to first_system_vector (0xfe) and not
+                * set in used_vectors bitmask.  This takes into account
+                * the IA32_SYSCALL_VECTOR and the IRQ_MOVE_CLEANUP_VECTOR,
+                * which should not be counted.
+                */

... what do you think?

P.

> +		for (vector = FIRST_EXTERNAL_VECTOR;
> +		     vector < first_system_vector; vector++) {
> +			if (test_bit(vector, used_vectors))
> +				continue;
> +
>  			if (per_cpu(vector_irq, cpu)[vector] < 0)
>  				count++;
>  		}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -v2] x86, irq: get correct available vectors for cpu disable
  2014-01-28 18:43 ` Prarit Bhargava
@ 2014-01-28 21:47   ` Yinghai Lu
  0 siblings, 0 replies; 3+ messages in thread
From: Yinghai Lu @ 2014-01-28 21:47 UTC (permalink / raw)
  To: Prarit Bhargava
  Cc: Ingo Molnar, H. Peter Anvin, Thomas Gleixner,
	Linux Kernel Mailing List

On Tue, Jan 28, 2014 at 10:43 AM, Prarit Bhargava <prarit@redhat.com> wrote:
>
>
> On 01/26/2014 03:50 PM, Yinghai Lu wrote:
>> assign_irq_vector will stop before first_system_vector.
>> also it will not vector that is set in used_vectors.
>>
>> used_vectors is used to track non per_cpu irq_vector in vector_irq.
>> It include first 32 exception [0,1f) and system vector near 0xfe.
>> and IA32_SYSCALL_VECTOR (0x80), IRQ_MOVE_CLEANUP_VECTOR (0x20).
>>
>> So add checking for them for counting avaiable vectors.
>>
>
> Yinghai, no objection to the patch ... but how about
>
>
> used_vectors is a bitmap for global irqs; it tracks the non per_cpu
> irq_vectors in vector_irq.  used_vectors contains information on the first 32
> exceptions (0 to 0x1f), the system vectors near the first system vector
> (0xfe), the IA32_SYSCALL_VECTOR (0x80), and the IRQ_MOVE_CLEANUP_VECTOR (0x20)
>
> assign_irq_vectors() assigns vectors up to first_system_vector (0xfe) and
> sets the used_vectors bit for each assigned vector.

No, assign_irq_vectors will not touch used_vectors.

>  Currently, the
> IRQ checking code only scans from the FIRST_EXTERNAL_VECTOR to the end of
> the vectors.  This patch modifies the code to scan to first_system_vector
> and do a test on the used_vectors bitmap.

first_system_vector start from 0xfe, and will be updated ....would end up with
0xf7.

>
>
> ... and ...
>
>> -v2: fix compiling problem.
>>
>> Signed-off-by: Yinghai Lu <yinghai@kernel.org>
>>
>> ---
>>  arch/x86/kernel/irq.c |   16 ++++++++++++++--
>>  1 file changed, 14 insertions(+), 2 deletions(-)
>>
>> Index: linux-2.6/arch/x86/kernel/irq.c
>> ===================================================================
>> --- linux-2.6.orig/arch/x86/kernel/irq.c
>> +++ linux-2.6/arch/x86/kernel/irq.c
>> @@ -17,6 +17,7 @@
>>  #include <asm/idle.h>
>>  #include <asm/mce.h>
>>  #include <asm/hw_irq.h>
>> +#include <asm/desc.h>
>>
>>  #define CREATE_TRACE_POINTS
>>  #include <asm/trace/irq_vectors.h>
>> @@ -321,8 +322,19 @@ int check_irq_vectors_for_cpu_disable(vo
>>       for_each_online_cpu(cpu) {
>>               if (cpu == this_cpu)
>>                       continue;
>> -             for (vector = FIRST_EXTERNAL_VECTOR; vector < NR_VECTORS;
>> -                  vector++) {
>> +
>> +             /*
>> +              * assign_irq_vector() only use vector under
>> +              * first_system_vector and not set in used_vectors bitmask.
>> +              * used_vectors could have bits set for
>> +              *      IA32_SYSCALL_VECTOR (0x80)
>> +              *      IRQ_MOVE_CLEANUP_VECTOR (0x20)
>> +              */
>
>
> +               /*
> +                * assign_irq_vector() will only scan non per_cpu vectors from
> +                * FIRST_EXTERNAL_VECTOR to first_system_vector (0xfe) and not
> +                * set in used_vectors bitmask.  This takes into account
> +                * the IA32_SYSCALL_VECTOR and the IRQ_MOVE_CLEANUP_VECTOR,
> +                * which should not be counted.
> +                */
>
> ... what do you think?
>

will send updated version.

Thanks

Yinghai

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-01-28 21:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-26 20:50 [PATCH -v2] x86, irq: get correct available vectors for cpu disable Yinghai Lu
2014-01-28 18:43 ` Prarit Bhargava
2014-01-28 21:47   ` Yinghai Lu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.