Re: dynamically use the irqbalance

2007-09-10 Thread Dong_Wei





On Mon, 10 Sep 2007 09:59:57 +0800
Dong_Wei <[EMAIL PROTECTED]> wrote:


Hi, all.
   I want to dynamically use irqbalance on X86 processor. My design
is like the following:
   1) if we boot kernel with "noirqbalance", then irqbalance is
always disabled.
   2) if we boot kernel without "noirqbalance", we can enable/disable 
irqbalance in runtime.


Hi,

kernel level irqbalance is not the right thing though (afaik it's in
feature-deprecation-schedule); please consider using the userland
irqbalancer instead (www.irqbalance.org). That also makes it entirely
easy to do what you want; since it's a daemon, starting and stopping it
follows standard Linux practice.


OK, I see. Maybe it's safe for me to run irqbalance using the userland.
Thanks a lot Arjan:)


Greetings,
Arjan van de Ven




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


Re: dynamically use the irqbalance

2007-09-10 Thread Arjan van de Ven
On Mon, 10 Sep 2007 09:59:57 +0800
Dong_Wei <[EMAIL PROTECTED]> wrote:

> Hi, all.
>    I want to dynamically use irqbalance on X86 processor. My design
> is like the following:
>1) if we boot kernel with "noirqbalance", then irqbalance is
> always disabled.
>2) if we boot kernel without "noirqbalance", we can enable/disable 
> irqbalance in runtime.

Hi,

kernel level irqbalance is not the right thing though (afaik it's in
feature-deprecation-schedule); please consider using the userland
irqbalancer instead (www.irqbalance.org). That also makes it entirely
easy to do what you want; since it's a daemon, starting and stopping it
follows standard Linux practice.


Greetings,
Arjan van de Ven
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: dynamically use the irqbalance

2007-09-10 Thread Arjan van de Ven
On Mon, 10 Sep 2007 09:59:57 +0800
Dong_Wei [EMAIL PROTECTED] wrote:

 Hi, all.
I want to dynamically use irqbalance on X86 processor. My design
 is like the following:
1) if we boot kernel with noirqbalance, then irqbalance is
 always disabled.
2) if we boot kernel without noirqbalance, we can enable/disable 
 irqbalance in runtime.

Hi,

kernel level irqbalance is not the right thing though (afaik it's in
feature-deprecation-schedule); please consider using the userland
irqbalancer instead (www.irqbalance.org). That also makes it entirely
easy to do what you want; since it's a daemon, starting and stopping it
follows standard Linux practice.


Greetings,
Arjan van de Ven
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: dynamically use the irqbalance

2007-09-10 Thread Dong_Wei





On Mon, 10 Sep 2007 09:59:57 +0800
Dong_Wei [EMAIL PROTECTED] wrote:


Hi, all.
   I want to dynamically use irqbalance on X86 processor. My design
is like the following:
   1) if we boot kernel with noirqbalance, then irqbalance is
always disabled.
   2) if we boot kernel without noirqbalance, we can enable/disable 
irqbalance in runtime.


Hi,

kernel level irqbalance is not the right thing though (afaik it's in
feature-deprecation-schedule); please consider using the userland
irqbalancer instead (www.irqbalance.org). That also makes it entirely
easy to do what you want; since it's a daemon, starting and stopping it
follows standard Linux practice.


OK, I see. Maybe it's safe for me to run irqbalance using the userland.
Thanks a lot Arjan:)


Greetings,
Arjan van de Ven




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


dynamically use the irqbalance

2007-09-09 Thread Dong_Wei

Hi, all.
  I want to dynamically use irqbalance on X86 processor. My design is 
like the following:
  1) if we boot kernel with "noirqbalance", then irqbalance is always 
disabled.
  2) if we boot kernel without "noirqbalance", we can enable/disable 
irqbalance in runtime.


I create a proc_fs entry /proc/sys/kernel/irqbalance
This symbol I adding is in file arch/i386/kernel/io_apic.c
/proc/sys/kernel/irqbalance = 0 /* disable irqbalance in runtime */
/proc/sys/kernel/irqbalance = 1 /* enable irqbalance in runtime */

The core function is like the following:
irqbalance_irq_flag = -1; /* this is the last time irqbalance used */
irqbalance_enable = 1; /* set it to enable by default */
static int balanced_irq(void *unused)
{
int i;
unsigned long prev_balance_time = jiffies;
long time_remaining = balanced_irq_interval;

daemonize("kirqd");

/* push everything to CPU 0 to give us a starting point.  */
for (i = 0 ; i < NR_IRQS ; i++) {
irq_desc[i].pending_mask = cpumask_of_cpu(0);
set_pending_irq(i, cpumask_of_cpu(0));
}

for ( ; ; ) {
time_remaining = schedule_timeout_interruptible(time_remaining);
try_to_freeze();
if(irqbalance_enable) {
 if (time_after(jiffies, 
prev_balance_time+balanced_irq_interval)) {

 preempt_disable();
 do_irq_balance();
 prev_balance_time = jiffies;
 time_remaining = balanced_irq_interval;
 preempt_enable();
 irqbalance_irq_flag = 1;
 }
 } else if (irqbalance_irq_flag != 0) {
 /* Is it SAFE to do so? */
 for (i = 0 ; i < NR_IRQS ; i++)
 set_pending_irq(i, cpumask_of_cpu(0));
 irqbalance_irq_flag = 0;
 }
 }
 return 0;
}

When we change /proc/sys/kernel/irqbalance from 1 to 0, I move all the 
irqs to CPU#0, Is it safe to do so? or will lead to some very dangerous 
thing?


Please help me to review my design, thanks in advance.

BTW: I can't join the linux-kernel maillist, for our mail server now has 
 some problems. If anyone replies my mail. Pls CC to me.



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


dynamically use the irqbalance

2007-09-09 Thread Dong_Wei

Hi, all.
  I want to dynamically use irqbalance on X86 processor. My design is 
like the following:
  1) if we boot kernel with noirqbalance, then irqbalance is always 
disabled.
  2) if we boot kernel without noirqbalance, we can enable/disable 
irqbalance in runtime.


I create a proc_fs entry /proc/sys/kernel/irqbalance
This symbol I adding is in file arch/i386/kernel/io_apic.c
/proc/sys/kernel/irqbalance = 0 /* disable irqbalance in runtime */
/proc/sys/kernel/irqbalance = 1 /* enable irqbalance in runtime */

The core function is like the following:
irqbalance_irq_flag = -1; /* this is the last time irqbalance used */
irqbalance_enable = 1; /* set it to enable by default */
static int balanced_irq(void *unused)
{
int i;
unsigned long prev_balance_time = jiffies;
long time_remaining = balanced_irq_interval;

daemonize(kirqd);

/* push everything to CPU 0 to give us a starting point.  */
for (i = 0 ; i  NR_IRQS ; i++) {
irq_desc[i].pending_mask = cpumask_of_cpu(0);
set_pending_irq(i, cpumask_of_cpu(0));
}

for ( ; ; ) {
time_remaining = schedule_timeout_interruptible(time_remaining);
try_to_freeze();
if(irqbalance_enable) {
 if (time_after(jiffies, 
prev_balance_time+balanced_irq_interval)) {

 preempt_disable();
 do_irq_balance();
 prev_balance_time = jiffies;
 time_remaining = balanced_irq_interval;
 preempt_enable();
 irqbalance_irq_flag = 1;
 }
 } else if (irqbalance_irq_flag != 0) {
 /* Is it SAFE to do so? */
 for (i = 0 ; i  NR_IRQS ; i++)
 set_pending_irq(i, cpumask_of_cpu(0));
 irqbalance_irq_flag = 0;
 }
 }
 return 0;
}

When we change /proc/sys/kernel/irqbalance from 1 to 0, I move all the 
irqs to CPU#0, Is it safe to do so? or will lead to some very dangerous 
thing?


Please help me to review my design, thanks in advance.

BTW: I can't join the linux-kernel maillist, for our mail server now has 
 some problems. If anyone replies my mail. Pls CC to me.



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