public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* patch for virtual machine oriented scheduling(1)
@ 2009-04-22 14:49 alex
  2009-04-23 16:18 ` Andrew Theurer
  0 siblings, 1 reply; 5+ messages in thread
From: alex @ 2009-04-22 14:49 UTC (permalink / raw)
  To: avi, anthony, kvm

the following patchs provide an extra control(besides the control of
Linux scheduler) over the execution of vcpu threads.

In this patch, Xen's credit
scheduler(http://wiki.xensource.com/xenwiki/CreditScheduler) is used.
User can use  "cat" and
"echo" command to view and control a guest os' credit.
e.g.,
[root@localhost ~]#  echo "weight=500" > /proc/kvm/12345
will change the credit of guest whose qemu process has the pid 12345 to be 500.

The patch consists of 3 parts:
1. modification to the standard KVM
2. modification to the Xen scheduler
3. helper functions

However, some are unnecessary in the latest Linux kernel.

The difficulties in the ports lie in:
1. Linux does not provide timer mechanism that the timer function is
bind to a dedicate CPU:
    in case of one cpu receives another cpu's schedule timer
expiration, IPI is used to relay it.
2. before linux 2.6.27, the smp_call_function_xxx()  can not be re-entered.
   if kvm is sending ipi at the time of relaying timer expiration
information, deadlock would occur in kernel versions below 2.6.27

In my implementation, tasklets are used to run the function of
scheduling, and  kernel thread is used to send IPI(in kernels above
2.6.27, this is unnecessary)

Originally, this code is developed at the release version of KVM-83.
In order to post it, I ported to the latest .git tree.  As a result,
modifications to files like external-module-compat-comm.h are omited.

NOTE:
1. Because my not having an AMD machine, only intel platforms are tested.
2. Because sched_setaffinity() is used (while Linux does not export
this symbol), the way of loading kvm modules are changed to be
./myins <directory that holds the kvm.ko and kvm-intel.ko>

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: patch for virtual machine oriented scheduling(1)
@ 2009-04-23  2:39 alex
  0 siblings, 0 replies; 5+ messages in thread
From: alex @ 2009-04-23  2:39 UTC (permalink / raw)
  To: avi, anthony, kvm

Hi,

Sorry for that something is wrong with my code posted earlier.

Just now, I found a bug in it, which was introduced by my porting my
work(which is developed under KVM83 and using svn depository) to KVM's
git depository by hand.  The bug is : you can not shutdown SMP guest
by killing the related qemu process.

I am examing my patch code to see the reason.

BTW:  counting the host mode time is quite easy. Hooking the virtual
machine runstate change to the time sched_in/sched_out is called will
satify Avi Kivity's requirement.

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

end of thread, other threads:[~2009-04-26  9:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-22 14:49 patch for virtual machine oriented scheduling(1) alex
2009-04-23 16:18 ` Andrew Theurer
2009-04-23 23:24   ` alex
2009-04-26  9:48     ` Avi Kivity
  -- strict thread matches above, loose matches on Subject: below --
2009-04-23  2:39 alex

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox