Skip to contentSkip to conversation

How to Stop scheduler

DISCUSSION Pankaj Parakh 3 participants 17 messages Nov 2, 2009 – Nov 11, 2009 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

#1 lore raw

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

-George

Quoted 23 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw

But beware of deadlocks. :-)On Tue, Nov 3, 2009 at 11:48 AM, George

Quoted 8 lines · Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

But beware of deadlocks. :-)
-George

#3 lore raw
In reply to George Dunlap

If I pause a vcpu/domain using those functions, say if a domain's I/O
request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 37 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 23 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 1 line
Pankaj Parakh
#4 lore raw

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct. While that counter is non-zero, the vcpu *will not* be scheduled, interrupts or no. Interrupts will be delivered when it's scheduled again.

-George

Quoted 51 lines · Pankaj Parakh

If I pause a vcpu/domain using those functions, say if a domain's I/O
request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 38 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

-George

Quoted 24 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#5 lore raw

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 64 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled, interrupts or no.  Interrupts will be delivered when it's scheduled again.

-George

Quoted 55 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 41 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 25 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 1 line
Pankaj Parakh
#6 lore raw

If I take domain_update_lock for a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Quoted 78 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 2 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct. While that counter is non-zero, the vcpu *will not* be

scheduled,

Quoted 1 line

interrupts or no. Interrupts will be delivered when it's scheduled

again.

Quoted 28 lines

-George

Quoted 24 lines · Pankaj Parakh

If I pause a vcpu/domain using those functions, say if a domain's I/O
request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 14 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

-George

On Mon, Nov 2, 2009 at 9:02 PM, Pankaj Parakh <

[email protected]>

Quoted 21 lines
Quoted 21 lines
Quoted 21 lines
Quoted 19 lines · wrote:

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

Quoted 12 lines
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

Signature · 1 line
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#7 lore raw
Quoted 3 lines · Pankaj Parakh

If I take domain_update_lock for  a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Have you looked at the interrupt delivery / IO completion path, or the scheduler path, to see if those are affected by the domain_update_lock()?

Xen is a bit of a twisted web; sometimes you just have to follow a web of logic around to find out what you're looking for; then, once you've come to a conclusion, test it by writing some code.

For the scheduling question, you might start with looking at vcpu_runnable().

Peace,
-George

Quoted 94 lines
Quoted 77 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 6 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no.  Interrupts will be delivered when it's scheduled again.

Quoted 62 lines

-George

Quoted 57 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 43 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 26 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil
confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 2 lines

--
Pankaj Parakh

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#8 lore raw

How can I schedule idle vcpu voluntarily without using schedule() ?? Is there any function for it already defined, or do I have to follow some steps.. ??

Quoted 10 lines · George Dunlap
Quoted 3 lines · Pankaj Parakh

If I take domain_update_lock for  a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Have you looked at the interrupt delivery / IO completion path, or the scheduler path, to see if those are affected by the domain_update_lock()?

Quoted 103 lines

Xen is a bit of a twisted web; sometimes you just have to follow a web of logic around to find out what you're looking for; then, once you've come to a conclusion, test it by writing some code.

For the scheduling question, you might start with looking at vcpu_runnable().

Peace,
 -George

Quoted 94 lines
Quoted 77 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 6 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no.  Interrupts will be delivered when it's scheduled again.

Quoted 62 lines

-George

Quoted 57 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 43 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 26 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil
confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 2 lines

--
Pankaj Parakh

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

#9 lore raw

I assume you mean, once you've paused current(), how do you get into the scheduler to actually get it off the cpu?

In Linux, you can call schedule() because each process has its own kernel stack allocated to it; the stack "remembers" where each process was in the kernel, so you can return from schedule() at the same place in the kernel once you're scheduled again.

Xen only has one stack per cpu, so it cannot keep track of where *in the hypervisor* a vcpu is that gets scheduled out. Therefore, you can't call schedule() directly, as it would throw away the stack. You must raise SCHEDULE_SOFTIRQ on the current cpu, and then return back to the guest. On the way out, the softirq will call schedule() and switch to another vcpu if necessary. (It will only schedule the idle process if there are no runnable vcpus.)

grep for SCHEDULE_SOFTIRQ to see examples of how this is used in Xen.

-George

Quoted 130 lines · Pankaj Parakh

How can I schedule idle vcpu voluntarily without using schedule() ?? Is there any function for it already defined, or do I have to follow some steps.. ??

Quoted 10 lines · George Dunlap
Quoted 3 lines · Pankaj Parakh

If I take domain_update_lock for  a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Have you looked at the interrupt delivery / IO completion path, or the scheduler path, to see if those are affected by the domain_update_lock()?

Quoted 103 lines

Xen is a bit of a twisted web; sometimes you just have to follow a web of logic around to find out what you're looking for; then, once you've come to a conclusion, test it by writing some code.

For the scheduling question, you might start with looking at vcpu_runnable().

Peace,
 -George

Quoted 94 lines
Quoted 77 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 6 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no.  Interrupts will be delivered when it's scheduled again.

Quoted 62 lines

-George

Quoted 57 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 43 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 26 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil
confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 2 lines

--
Pankaj Parakh

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#10 lore raw

BTW, for the benefit of posterity, would you post a patch with the working sched_rr.c to the list, so that if in the future someone tries to use the code from that book, we can point them to it?

Thanks,
-George

Quoted 153 lines · George Dunlap

I assume you mean, once you've paused current(), how do you get into the scheduler to actually get it off the cpu?

In Linux, you can call schedule() because each process has its own kernel stack allocated to it; the stack "remembers" where each process was in the kernel, so you can return from schedule() at the same place in the kernel once you're scheduled again.

Xen only has one stack per cpu, so it cannot keep track of where *in the hypervisor* a vcpu is that gets scheduled out.  Therefore, you can't call schedule() directly, as it would throw away the stack.  You must raise SCHEDULE_SOFTIRQ on the current cpu, and then return back to the guest.  On the way out, the softirq will call schedule() and switch to another vcpu if necessary.  (It will only schedule the idle process if there are no runnable vcpus.)

grep for SCHEDULE_SOFTIRQ to see examples of how this is used in Xen.

 -George

Quoted 130 lines · Pankaj Parakh

How can I schedule idle vcpu voluntarily without using schedule() ?? Is there any function for it already defined, or do I have to follow some steps.. ??

Quoted 10 lines · George Dunlap
Quoted 3 lines · Pankaj Parakh

If I take domain_update_lock for  a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Have you looked at the interrupt delivery / IO completion path, or the scheduler path, to see if those are affected by the domain_update_lock()?

Quoted 103 lines

Xen is a bit of a twisted web; sometimes you just have to follow a web of logic around to find out what you're looking for; then, once you've come to a conclusion, test it by writing some code.

For the scheduling question, you might start with looking at vcpu_runnable().

Peace,
 -George

Quoted 94 lines
Quoted 77 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 6 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no.  Interrupts will be delivered when it's scheduled again.

Quoted 62 lines

-George

Quoted 57 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 43 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 26 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil
confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 2 lines

--
Pankaj Parakh

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#11 lore raw

Yes George,

I'll do that as soon as it is in right shape, there is still some problems there to which I am unable to give time to.

Quoted 5 lines · George Dunlap

BTW, for the benefit of posterity, would you post a patch with the working sched_rr.c to the list, so that if in the future someone tries to use the code from that book, we can point them to it?

Quoted 158 lines

Thanks,
 -George

Quoted 153 lines · George Dunlap

I assume you mean, once you've paused current(), how do you get into the scheduler to actually get it off the cpu?

In Linux, you can call schedule() because each process has its own kernel stack allocated to it; the stack "remembers" where each process was in the kernel, so you can return from schedule() at the same place in the kernel once you're scheduled again.

Xen only has one stack per cpu, so it cannot keep track of where *in the hypervisor* a vcpu is that gets scheduled out.  Therefore, you can't call schedule() directly, as it would throw away the stack.  You must raise SCHEDULE_SOFTIRQ on the current cpu, and then return back to the guest.  On the way out, the softirq will call schedule() and switch to another vcpu if necessary.  (It will only schedule the idle process if there are no runnable vcpus.)

grep for SCHEDULE_SOFTIRQ to see examples of how this is used in Xen.

 -George

Quoted 130 lines · Pankaj Parakh

How can I schedule idle vcpu voluntarily without using schedule() ?? Is there any function for it already defined, or do I have to follow some steps.. ??

Quoted 10 lines · George Dunlap
Quoted 3 lines · Pankaj Parakh

If I take domain_update_lock for  a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Have you looked at the interrupt delivery / IO completion path, or the scheduler path, to see if those are affected by the domain_update_lock()?

Quoted 103 lines

Xen is a bit of a twisted web; sometimes you just have to follow a web of logic around to find out what you're looking for; then, once you've come to a conclusion, test it by writing some code.

For the scheduling question, you might start with looking at vcpu_runnable().

Peace,
 -George

Quoted 94 lines
Quoted 77 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 6 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no.  Interrupts will be delivered when it's scheduled again.

Quoted 62 lines

-George

Quoted 57 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 43 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 26 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil
confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 2 lines

--
Pankaj Parakh

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

#12 lore raw
In reply to George Dunlap

How to disable softirq in Xen, if I want that no function should be able to raise SCHEDULE_SOFTIRQ, how can I do that??

Quoted 153 lines · George Dunlap

I assume you mean, once you've paused current(), how do you get into the scheduler to actually get it off the cpu?

In Linux, you can call schedule() because each process has its own kernel stack allocated to it; the stack "remembers" where each process was in the kernel, so you can return from schedule() at the same place in the kernel once you're scheduled again.

Xen only has one stack per cpu, so it cannot keep track of where *in the hypervisor* a vcpu is that gets scheduled out.  Therefore, you can't call schedule() directly, as it would throw away the stack.  You must raise SCHEDULE_SOFTIRQ on the current cpu, and then return back to the guest.  On the way out, the softirq will call schedule() and switch to another vcpu if necessary.  (It will only schedule the idle process if there are no runnable vcpus.)

grep for SCHEDULE_SOFTIRQ to see examples of how this is used in Xen.

 -George

Quoted 130 lines · Pankaj Parakh

How can I schedule idle vcpu voluntarily without using schedule() ?? Is there any function for it already defined, or do I have to follow some steps.. ??

Quoted 10 lines · George Dunlap
Quoted 3 lines · Pankaj Parakh

If I take domain_update_lock for  a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Have you looked at the interrupt delivery / IO completion path, or the scheduler path, to see if those are affected by the domain_update_lock()?

Quoted 103 lines

Xen is a bit of a twisted web; sometimes you just have to follow a web of logic around to find out what you're looking for; then, once you've come to a conclusion, test it by writing some code.

For the scheduling question, you might start with looking at vcpu_runnable().

Peace,
 -George

Quoted 94 lines
Quoted 77 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 6 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no.  Interrupts will be delivered when it's scheduled again.

Quoted 62 lines

-George

Quoted 57 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 43 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 26 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil
confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 2 lines

--
Pankaj Parakh

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 1 line
Pankaj Parakh
#13 lore raw

Also is what schedule_lock in schedlue_data is for ??
I tried to use it thinking it'll stop further scheduling, but it hangs my machine and the function doesnot proceed after that.. is something else I have to do to pause scheduling in XEN.

Quoted 164 lines · Pankaj Parakh

How to disable softirq in Xen, if I want that no function should be able to raise SCHEDULE_SOFTIRQ, how can I do that??

Quoted 16 lines · George Dunlap

I assume you mean, once you've paused current(), how do you get into the scheduler to actually get it off the cpu?

In Linux, you can call schedule() because each process has its own kernel stack allocated to it; the stack "remembers" where each process was in the kernel, so you can return from schedule() at the same place in the kernel once you're scheduled again.

Xen only has one stack per cpu, so it cannot keep track of where *in the hypervisor* a vcpu is that gets scheduled out.  Therefore, you can't call schedule() directly, as it would throw away the stack.  You must raise SCHEDULE_SOFTIRQ on the current cpu, and then return back to the guest.  On the way out, the softirq will call schedule() and switch to another vcpu if necessary.  (It will only schedule the idle process if there are no runnable vcpus.)

Quoted 137 lines

grep for SCHEDULE_SOFTIRQ to see examples of how this is used in Xen.

 -George

Quoted 130 lines · Pankaj Parakh

How can I schedule idle vcpu voluntarily without using schedule() ?? Is there any function for it already defined, or do I have to follow some steps.. ??

Quoted 10 lines · George Dunlap
Quoted 3 lines · Pankaj Parakh

If I take domain_update_lock for  a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Have you looked at the interrupt delivery / IO completion path, or the scheduler path, to see if those are affected by the domain_update_lock()?

Quoted 103 lines

Xen is a bit of a twisted web; sometimes you just have to follow a web of logic around to find out what you're looking for; then, once you've come to a conclusion, test it by writing some code.

For the scheduling question, you might start with looking at vcpu_runnable().

Peace,
 -George

Quoted 94 lines
Quoted 77 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 6 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no.  Interrupts will be delivered when it's scheduled again.

Quoted 62 lines

-George

Quoted 57 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 43 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 26 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil
confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 2 lines

--
Pankaj Parakh

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

Signature · 1 line
Pankaj Parakh

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw

Any answers plzz??

 Also is what schedule_lock in schedlue_data is for ??
 I tried to use it thinking it'll stop further scheduling, but it hangs my machine and the function doesnot proceed after that.. is something else I have to do to pause scheduling in XEN.

Quoted 2 lines

On Tue, Nov 10, 2009 at 12:18 PM, Pankaj Parakh
<[email protected]> wrote:

 How to disable softirq in Xen, if I want that no function should be able to raise SCHEDULE_SOFTIRQ, how can I do that??

 > On Thu, Nov 5, 2009 at 3:25 PM, George Dunlap
 > <[email protected]> wrote:
 >> I assume you mean, once you've paused current(), how do you get into

Quoted 155 lines
Quoted 155 lines
Quoted 152 lines

the scheduler to actually get it off the cpu?

In Linux, you can call schedule() because each process has its own kernel stack allocated to it; the stack "remembers" where each process was in the kernel, so you can return from schedule() at the same place in the kernel once you're scheduled again.

Xen only has one stack per cpu, so it cannot keep track of where *in the hypervisor* a vcpu is that gets scheduled out.  Therefore, you can't call schedule() directly, as it would throw away the stack.  You must raise SCHEDULE_SOFTIRQ on the current cpu, and then return back to the guest.  On the way out, the softirq will call schedule() and switch to another vcpu if necessary.  (It will only schedule the idle process if there are no runnable vcpus.)

grep for SCHEDULE_SOFTIRQ to see examples of how this is used in Xen.

 -George

Quoted 130 lines · Pankaj Parakh

How can I schedule idle vcpu voluntarily without using schedule() ?? Is there any function for it already defined, or do I have to follow some steps.. ??

Quoted 10 lines · George Dunlap
Quoted 3 lines · Pankaj Parakh

If I take domain_update_lock for  a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Have you looked at the interrupt delivery / IO completion path, or the scheduler path, to see if those are affected by the domain_update_lock()?

Quoted 103 lines

Xen is a bit of a twisted web; sometimes you just have to follow a web of logic around to find out what you're looking for; then, once you've come to a conclusion, test it by writing some code.

For the scheduling question, you might start with looking at vcpu_runnable().

Peace,
 -George

Quoted 94 lines
Quoted 77 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 6 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no.  Interrupts will be delivered when it's scheduled again.

Quoted 62 lines

-George

Quoted 57 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 43 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 26 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil
confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 2 lines

--
Pankaj Parakh

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 8 lines
Quoted 3 lines

--
Pankaj Parakh

--
Pankaj Parakh

--
Pankaj Parakh

Signature · 1 line
Pankaj Parakh
#16 lore raw
In reply to a message not in the archive

The purpose of schedule_lock in schedule_data is to prevent race conditions when accessing schedule_data.

A prerequisite for being able to do any work in Xen is knowing:
* What a race condition is
* How spinlocks work
* How to use spinlocks (and other synchronization techniques) to avoid data races
* How to avoid introducing deadlock conditions when using spinlocks

Your question makes it seem like you're not familiar with the above concepts. I suggest you spend some time learning about them first, and then come back to your work with Xen. It's especially important that you have worked through several examples to develop an "instinct" for what kinds of things might be data races and what might cause deadlock. Data races and deadlock are both incredibly difficult to debug, and the scheduler is particularly prone to both.

-George

Quoted 186 lines · Pankaj Parakh

Any answers plzz??

Also is what schedule_lock in schedlue_data is for ??
I tried to use it thinking it'll stop further scheduling, but it hangs my machine and the function doesnot proceed after that.. is something else I have to do to pause scheduling in XEN.

Quoted 3 lines

On Tue, Nov 10, 2009 at 12:18 PM, Pankaj Parakh
<[email protected]> wrote:

How to disable softirq in Xen, if I want that no function should be able to raise SCHEDULE_SOFTIRQ, how can I do that??

Quoted 155 lines
Quoted 153 lines · George Dunlap

I assume you mean, once you've paused current(), how do you get into

Quoted 150 lines

the scheduler to actually get it off the cpu?

In Linux, you can call schedule() because each process has its own kernel stack allocated to it; the stack "remembers" where each process was in the kernel, so you can return from schedule() at the same place in the kernel once you're scheduled again.

Xen only has one stack per cpu, so it cannot keep track of where *in the hypervisor* a vcpu is that gets scheduled out. Therefore, you can't call schedule() directly, as it would throw away the stack. You must raise SCHEDULE_SOFTIRQ on the current cpu, and then return back to the guest. On the way out, the softirq will call schedule() and switch to another vcpu if necessary. (It will only schedule the idle process if there are no runnable vcpus.)

grep for SCHEDULE_SOFTIRQ to see examples of how this is used in Xen.

-George

Quoted 128 lines · Pankaj Parakh

How can I schedule idle vcpu voluntarily without using schedule() ?? Is there any function for it already defined, or do I have to follow some steps.. ??

Quoted 10 lines · George Dunlap
Quoted 4 lines · Pankaj Parakh

If I take domain_update_lock for a domain, what will happen to its interrupts for IO completions or any other type..??
And will it be scheduled if I hold that lock..??

Have you looked at the interrupt delivery / IO completion path, or the scheduler path, to see if those are affected by the domain_update_lock()?

Quoted 101 lines

Xen is a bit of a twisted web; sometimes you just have to follow a web of logic around to find out what you're looking for; then, once you've come to a conclusion, test it by writing some code.

For the scheduling question, you might start with looking at vcpu_runnable().

Peace,
-George

Quoted 91 lines
Quoted 74 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 6 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct. While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no. Interrupts will be delivered when it's scheduled again.

Quoted 61 lines

-George

Quoted 56 lines · Pankaj Parakh

If I pause a vcpu/domain using those functions, say if a domain's I/O
request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 43 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

-George

Quoted 26 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil
confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 3 lines

--
Pankaj Parakh

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

--
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Quoted 8 lines
Quoted 4 lines

--
Pankaj Parakh

--
Pankaj Parakh

--
Pankaj Parakh

#17 lore raw
In reply to Pankaj Parakh

IMO, George have say it clearly, interrupt (including timer interrupt) will be losed until the VCPU or Domain unpaused.

-James (song wei)

Quoted 85 lines · Pankaj Parakh

So is that means there will be no interrupt loss, and also clock in the paused domain will be in right and expected time.. ??

Quoted 67 lines · George Dunlap

If you call vcpu_pause(), it atomically increments a counter in the vcpu struct.  While that counter is non-zero, the vcpu *will not* be scheduled,
interrupts or no.  Interrupts will be delivered when it's scheduled again.

-George

Quoted 56 lines · Pankaj Parakh

 If I pause a vcpu/domain using those functions, say if a domain's I/O request over then its interrupt will raise and it can restart its scheduling rite..?? How this interrupts are/ can be queued so that when the vcpu is in pause state, it should nat change its state and when it come back to wait state, those interrupt will not be lost..

Quoted 42 lines · George Dunlap

Do you mean that you want to stop one specific vcpu / domain from being scheduled?

If so, you're looking for the following functions:
vcpu_pause(), vcpu_unpause() domain_pause(), domain_unpause().

They're defined in xen/common/domain.c.

 -George

Quoted 25 lines · Pankaj Parakh

Hi All,

I am working on a project wherein I wanted to stop the scheduling activity in hypervisor through 'generic' part of scheduler, I have lil confusion as to what all things I need to mask/stop for disabling hypervisor to schedule any vcpu untill I want.

Issues which I can think are about I/O waits or Zombie VCPUs. But how to tackle them... I dont know..

I wanted to know what all responsibility the generic scheduler holds in hypervisor,

Any type of info or pointer can be useful.

Thanks
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 6 lines
Pankaj Parakh

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 2 lines
View this message in context: http://old.nabble.com/How-to-Stop-scheduler-tp26170683p26191458.html
Sent from the Xen - Dev mailing list archive at Nabble.com.