[kvm-devel] [PATCH] lapic3: various cleanups on user/kernel irqchip

2007-08-10 Thread He, Qing
KVM: cleanups on user/kernel irqchip checking

The patch removes the union of userspace irq_pending and kernel apic in
struct vcpu, which minimizes the impact of careless overwriting and
avoids accidentally dereferencing invalid apic pointer.

It also adds a protective checking on KVM_INTERRUPT ioctl, which should
only be valid when using userspace irqchips.

Signed-off-by: Qing He [EMAIL PROTECTED]

---

diff --git a/drivers/kvm/kvm.h b/drivers/kvm/kvm.h
index 87ddf73..f3f 100644
--- a/drivers/kvm/kvm.h
+++ b/drivers/kvm/kvm.h
@@ -322,19 +322,17 @@ struct kvm_vcpu {
u64 pdptrs[4]; /* pae */
u64 apic_base;
u64 shadow_efer;
-   union {
-   struct {/* user irqchip context */
-  /*
-   * bit vector: 1 per word in irq_pending
-   */
-   unsigned long irq_summary;
-   DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS);
-   unsigned long cr8;
-   };
-   struct {/* kernel irqchip context */
-   struct kvm_lapic *apic;
-   };
+
+   struct {/* user irqchip context */
+   /*
+* bit vector: 1 per word in irq_pending
+*/
+   unsigned long irq_summary;
+   DECLARE_BITMAP(irq_pending, KVM_NR_INTERRUPTS);
+   unsigned long cr8;
};
+   struct kvm_lapic *apic;/* kernel irqchip context */
+
u64 ia32_misc_enable_msr;
 
struct kvm_mmu mmu;
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 88b0b89..fd9436e 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -1079,7 +1079,7 @@ static struct kvm_io_device
*vcpu_find_pervcpu_dev(struct kvm_vcpu *vcpu,
 {
struct kvm_io_device *dev;
 
-   if (irqchip_in_kernel(vcpu-kvm)  vcpu-apic) {
+   if (vcpu-apic) {
dev = vcpu-apic-dev;
if (dev-in_range(dev, addr))
return dev;
@@ -2394,6 +2394,8 @@ static int kvm_vcpu_ioctl_interrupt(struct
kvm_vcpu *vcpu,
 {
if (irq-irq  0 || irq-irq = 256)
return -EINVAL;
+   if (irqchip_in_kernel(vcpu-kvm))
+   return -ENXIO;
vcpu_load(vcpu);
 
set_bit(irq-irq, vcpu-irq_pending);


apic-kern-user-cleanup.diff
Description: apic-kern-user-cleanup.diff
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] kvm very slow

2007-08-10 Thread Ulrich Schreiner
the system is now MUCH faster! it boots really fast, i think, in the
init-scripts there are much sleep x, and every x were 2*x in
reality.

other tasks are also much faster

i'm happy now :-)

although i cannot reboot ... (it hangs after halted), but that is
another thread.


Am Donnerstag, den 09.08.2007, 17:09 -0700 schrieb Matthew Kent:
 [oops sorry. should have included the full dmesg from the bad boot and
 cc'd the original poster]
 
 On Thu, 2007-09-08 at 16:23 -0700, Matthew Kent wrote:
  On Wed, 2007-01-08 at 07:22 +0200, Ulrich Schreiner wrote:
   hi,
   
   im using a 64 bit fedora7 system with a quad-core processor to host
   multiple virtual machines.
   
  
  literally the exact same setup here
  
   my current kernel is:
   
   Linux testserver 2.6.22.1-27.fc7 #1 SMP Tue Jul 17 17:19:58 EDT 2007
   x86_64 x86_64 x86_64 GNU/Linux
   
   (now there is a 2.6.22.1-33.fc7 to download, but i think it is not the
   point here).
   
  
  2.6.22.1-41.fc7 x86_64 host
  
   i installed
   
 kvm.x86_64: 31-1.fc8
  
  kvm-33
  
   
   because of a crash i reported as a bug with the older kvm module.
   
   this system starts a F7 image with the following command:
   
   /usr/bin/qemu-kvm 
 -net nic,macadr=52.54.00.12.34.57 
 -net tap,script=./ifup.py,ifname=tap0
 -hda /var/qemu/vm_images/F7image.img 
 -boot c: -m 512 -vnc :2 -k de
   
   inside the image there is fedora 7, but a 32bit system.
   
  
  almost exact same as here except using 32 bit fedora rawhide
  (development) guest running kernel 2.6.23-0.74.rc2.git1.fc8
  
   almost everything works (reboot hangs), but the system is extremely
   slow! the clock inside the system is extremely slow: every *virtual*
   second in the image is about two or more seconds in the *real* world.
  
  and I'm having the exact same issue here. The hardware clock works fine
  (least from the output of /proc/driver/rtc and hwclock) but the system
  time quickly falls behind in the guest, approx 0.5 secs for every 1 real
  second.
  
  No combination of selecting different clocksources in the guest,
  disabling CONFIG_NO_HZ, etc seemed to make any difference. And the fact
  is my fc7 x86_64 install works just great so I doubt its the host.
  
  What I did notice though was ACPI wasn't being enabled by default for
  the 32bit kernel with the message
  
  ACPI: no DMI BIOS year, acpi=force is required to enable ACPI
  
  and that the acpi_pm clocksource the x86_64 guest picked by default,
  which worked fine, was missing. eg:
  
  2.6.23-0.74.rc2.git1.fc8 i686 default boot:
  
  /sys/devices/system/clocksource/clocksource0/available_clocksource
  pit jiffies tsc
  /sys/devices/system/clocksource/clocksource0/current_clocksource
  pit
  
  2.6.23-0.74.rc2.git1.fc8 i686 with acpi=force:
  
  /sys/devices/system/clocksource/clocksource0/available_clocksource
  tsc acpi_pm pit jiffies
  /sys/devices/system/clocksource/clocksource0/current_clocksource
  tsc
  
  and now everything seems great, hardware and system time seem 1:1
  again. 
  
  Attached is a diff of the dmesg from each boot.
  
  As to why this is...


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] KVM version reporting?

2007-08-10 Thread Jim Paris
Hi,

Could qemu/VERSION get updated with each KVM release?  Currently it
seems there is no way to determine the KVM version from the binaries.

Putting it in MODULE_VERSION for the kernel modules would also be
useful.

-jim

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] clean APIC_TMCCT setting in APIC timer

2007-08-10 Thread Dong, Eddie
Forgot the attachment :-(


[EMAIL PROTECTED] wrote:
APIC_TMCCT is a dynamically running count which always
need to be recalculated at the time it is read. Setting
intermediate value is meaningless.
 
Signed-off-by: Yaozu (Eddie) Dong [EMAIL PROTECTED]
 
 
 diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
 index d59b69f..fc53e88 100644
 --- a/drivers/kvm/lapic.c
 +++ b/drivers/kvm/lapic.c
 @@ -445,7 +445,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
   { u32 counter_passed;
   ktime_t passed, now = apic-timer.dev.base-get_time();
 - u32 tmcct = apic_get_reg(apic, APIC_TMCCT);
 + u32 tmcct = apic_get_reg(apic, APIC_TMICT);
 
   ASSERT(apic != NULL);
 
 @@ -474,9 +474,6 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
   } while (tmcct = 0); }
 
 - apic-timer.last_update = now;
 - apic_set_reg(apic, APIC_TMCCT, tmcct);
 -
   return tmcct;
 }
 
 @@ -633,7 +630,6 @@ static void apic_mmio_write(struct kvm_io_device
   *this, u32 offset;
 
   apic_set_reg(apic, APIC_TMICT, val);
 - apic_set_reg(apic, APIC_TMCCT, val);
   apic-timer.last_update = now;
   offset =
   APIC_BUS_CYCLE_NS * apic-timer.divide_count
* val;
 @@ -815,7 +811,6 @@ static void lapic_reset(struct kvm_vcpu *vcpu)
   apic_set_reg(apic, APIC_ICR2, 0);
   apic_set_reg(apic, APIC_TDCR, 0);
   apic_set_reg(apic, APIC_TMICT, 0);
 - apic_set_reg(apic, APIC_TMCCT, 0);
   for (i = 0; i  8; i++) {
   apic_set_reg(apic, APIC_IRR + 0x10 * i, 0);
   apic_set_reg(apic, APIC_ISR + 0x10 * i, 0);
 @@ -886,13 +881,10 @@ static int __apic_timer_fn(struct
 kvm_lapic *apic)
   u32 offset;
   u32 tmict = apic_get_reg(apic, APIC_TMICT);
 
 - apic_set_reg(apic, APIC_TMCCT, tmict);
   offset = APIC_BUS_CYCLE_NS * apic-timer.divide_count *
 tmict;
 
   result = 1;
   apic-timer.dev.expires = ktime_add_ns(now, offset);
 - } else {
 - apic_set_reg(apic, APIC_TMCCT, 0);
   }
 
   return result;
 @@ -996,7 +988,6 @@ void kvm_apic_post_state_restore(struct kvm_vcpu
*vcpu) MSR_IA32_APICBASE_BASE;
   apic_set_reg(apic, APIC_LVR, APIC_VERSION);
   val = apic_get_reg(apic, APIC_TMICT);
 - apic_set_reg(apic, APIC_TMCCT, val);
   apic_update_ppr(apic);
 
   /* TODO: following code can be in a common API */
 
 ---
 --
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a
 browser. Download your FREE copy of Splunk now  
 http://get.splunk.com/ ___
 kvm-devel mailing list
 kvm-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/kvm-devel



apic-timer-tmcct.patch
Description: apic-timer-tmcct.patch
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] Storing command line options in images

2007-08-10 Thread Anthony Liguori
Jorge Lucángeli Obes wrote:
 Hi all,

 From what I've gathered, it seems that we have basically four options
 at hand. I think it's important to notice, however, that whatever
 comes out of this will probably be, as Avi said, a low-end solution.
 IMHO there's room to have both the high-end libvirt-like approach, and
 the shell replacer approach.

 So let's see:

 1- We could go the way of the patches I've posted, adding the comments
 everyone's made.
 1a- It's a good idea to actively signal QEMU to read command line
 options from the image file, and not have it on by default.
   

I think if you have to add a new option, the base implementation is 
wrong.  The whole point of this is to simplify things for the user and 
adding more weird options just makes things more complicated.

 1b- As Avi said, there are many guest-related options that would be
 good to store _somewhere_. The user always has the option of using
 qemu-img to review the options that the VM is going to use. I think
 that having a valid set of options that the user can store will
 complicate things too much.

 2- We could bump qcow's version number and add command line options as
 first-class citizens of the image world.
 2a- As Anthony suggested, it could be a good starting point to make
 sure these version transition happen in a smoother way.

 3- We could add command line options as plain text in the image
 itself. Sounds (to me) risky and not very user friendly.
   

Why is it risky or user unfriendly?  From the user's perspective, it's 
no different from storing it in a snapshot.  The user still needs a 
separate tool (qemu-img) to view and manipulate the command line.  The 
only real user facing difference is that the image itself is now 
directly executable.  This turns out to be a Good Thing in that the user 
is now aware that he must trust that image which addresses the concern 
in 1a.

 4- We could have configuration files associated with the host and guests.
 4a- Embedded XML.
 4b- Separate files.
   

This is a big effort but a config file is the right long term solution.

Regards,

Anthony Liguori

 What do you guys think? I'm partial to 1 or 2. Since the beginning my
 approach was that of a simple solution for a simple feature.

 Cheers,
 Jorge

 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 kvm-devel mailing list
 kvm-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/kvm-devel

   


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 1/2][KVM] introduce a new field in cpustat

2007-08-10 Thread Laurent Vivier
introduce a new field, guest, in cpustat to store the time used by the CPU to
run virtual CPU. Modify /proc/stat to display this new field.

Signed-Off-by: Laurent Vivier [EMAIL PROTECTED]
-- 
- [EMAIL PROTECTED]  --
  Software is hard - Donald Knuth
Index: kvm/fs/proc/proc_misc.c
===
--- kvm.orig/fs/proc/proc_misc.c2007-08-10 16:49:42.0 +0200
+++ kvm/fs/proc/proc_misc.c 2007-08-10 16:51:34.0 +0200
@@ -443,6 +443,7 @@
int i;
unsigned long jif;
cputime64_t user, nice, system, idle, iowait, irq, softirq, steal;
+   cputime64_t guest;
u64 sum = 0;
struct timespec boottime;
unsigned int *per_irq_sum;
@@ -452,7 +453,7 @@
return -ENOMEM;
 
user = nice = system = idle = iowait =
-   irq = softirq = steal = cputime64_zero;
+   irq = softirq = steal = guest = cputime64_zero;
getboottime(boottime);
jif = boottime.tv_sec;
 
@@ -467,6 +468,7 @@
irq = cputime64_add(irq, kstat_cpu(i).cpustat.irq);
softirq = cputime64_add(softirq, kstat_cpu(i).cpustat.softirq);
steal = cputime64_add(steal, kstat_cpu(i).cpustat.steal);
+   guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
for (j = 0; j  NR_IRQS; j++) {
unsigned int temp = kstat_cpu(i).irqs[j];
sum += temp;
@@ -474,7 +476,7 @@
}
}
 
-   seq_printf(p, cpu  %llu %llu %llu %llu %llu %llu %llu %llu\n,
+   seq_printf(p, cpu  %llu %llu %llu %llu %llu %llu %llu %llu %llu\n,
(unsigned long long)cputime64_to_clock_t(user),
(unsigned long long)cputime64_to_clock_t(nice),
(unsigned long long)cputime64_to_clock_t(system),
@@ -482,7 +484,8 @@
(unsigned long long)cputime64_to_clock_t(iowait),
(unsigned long long)cputime64_to_clock_t(irq),
(unsigned long long)cputime64_to_clock_t(softirq),
-   (unsigned long long)cputime64_to_clock_t(steal));
+   (unsigned long long)cputime64_to_clock_t(steal),
+   (unsigned long long)cputime64_to_clock_t(guest));
for_each_online_cpu(i) {
 
/* Copy values here to work around gcc-2.95.3, gcc-2.96 */
@@ -494,7 +497,8 @@
irq = kstat_cpu(i).cpustat.irq;
softirq = kstat_cpu(i).cpustat.softirq;
steal = kstat_cpu(i).cpustat.steal;
-   seq_printf(p, cpu%d %llu %llu %llu %llu %llu %llu %llu %llu\n,
+   guest = kstat_cpu(i).cpustat.guest;
+   seq_printf(p, cpu%d %llu %llu %llu %llu %llu %llu %llu %llu 
%llu\n,
i,
(unsigned long long)cputime64_to_clock_t(user),
(unsigned long long)cputime64_to_clock_t(nice),
@@ -503,7 +507,8 @@
(unsigned long long)cputime64_to_clock_t(iowait),
(unsigned long long)cputime64_to_clock_t(irq),
(unsigned long long)cputime64_to_clock_t(softirq),
-   (unsigned long long)cputime64_to_clock_t(steal));
+   (unsigned long long)cputime64_to_clock_t(steal),
+   (unsigned long long)cputime64_to_clock_t(guest));
}
seq_printf(p, intr %llu, (unsigned long long)sum);
 
Index: kvm/include/linux/kernel_stat.h
===
--- kvm.orig/include/linux/kernel_stat.h2007-08-10 16:49:42.0 
+0200
+++ kvm/include/linux/kernel_stat.h 2007-08-10 16:49:59.0 +0200
@@ -23,6 +23,7 @@
cputime64_t idle;
cputime64_t iowait;
cputime64_t steal;
+   cputime64_t guest;
 };
 
 struct kernel_stat {
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 2/2][KVM] modify account_system_time() to add cputime to cpustat-guest

2007-08-10 Thread Laurent Vivier
modify account_system_time() to add cputime to cpustat-guest if we are running
a VCPU. We add this cputime to cpustat-user too instead of cpustat-system
because this part of KVM code is in fact user code although it is executed in
the kernel. We duplicate VCPU time between guest and user to allow an unmodified
top(1) to display correct value. A modified top(1) is able to display good
cpu user time and cpu guest time by subtracting cpu guest time from cpu user 
time.

Signed-Off-by: Laurent Vivier [EMAIL PROTECTED]
-- 
- [EMAIL PROTECTED]  --
  Software is hard - Donald Knuth
Index: kvm/drivers/kvm/vmx.c
===
--- kvm.orig/drivers/kvm/vmx.c  2007-08-10 16:49:40.0 +0200
+++ kvm/drivers/kvm/vmx.c   2007-08-10 17:21:46.0 +0200
@@ -2078,6 +2078,7 @@
local_irq_disable();
 
vcpu-guest_mode = 1;
+   current-flags |= PF_VCPU;
if (vcpu-requests)
if (test_and_clear_bit(KVM_TLB_FLUSH, vcpu-requests))
vmx_flush_tlb(vcpu);
Index: kvm/drivers/kvm/svm.c
===
--- kvm.orig/drivers/kvm/svm.c  2007-08-10 16:49:40.0 +0200
+++ kvm/drivers/kvm/svm.c   2007-08-10 16:52:29.0 +0200
@@ -1404,6 +1404,7 @@
clgi();
 
vcpu-guest_mode = 1;
+   current-flags |= PF_VCPU;
if (vcpu-requests)
if (test_and_clear_bit(KVM_TLB_FLUSH, vcpu-requests))
svm_flush_tlb(vcpu);
Index: kvm/include/linux/sched.h
===
--- kvm.orig/include/linux/sched.h  2007-08-10 16:49:40.0 +0200
+++ kvm/include/linux/sched.h   2007-08-10 16:52:29.0 +0200
@@ -1310,6 +1310,7 @@
 #define PF_STARTING0x0002  /* being created */
 #define PF_EXITING 0x0004  /* getting shut down */
 #define PF_EXITPIDONE  0x0008  /* pi exit done on shut down */
+#define PF_VCPU0x0010  /* I'm virtual CPU */
 #define PF_FORKNOEXEC  0x0040  /* forked but didn't exec */
 #define PF_SUPERPRIV   0x0100  /* used super-user privileges */
 #define PF_DUMPCORE0x0200  /* dumped core */
Index: kvm/kernel/sched.c
===
--- kvm.orig/kernel/sched.c 2007-08-10 16:49:40.0 +0200
+++ kvm/kernel/sched.c  2007-08-10 17:21:30.0 +0200
@@ -3246,10 +3246,18 @@
struct rq *rq = this_rq();
cputime64_t tmp;
 
+   tmp = cputime_to_cputime64(cputime);
+   if (p-flags  PF_VCPU) {
+   p-utime = cputime_add(p-utime, cputime);
+   cpustat-user = cputime64_add(cpustat-user, tmp);
+   cpustat-guest = cputime64_add(cpustat-guest, tmp);
+   p-flags = ~PF_VCPU;
+   return;
+   }
+
p-stime = cputime_add(p-stime, cputime);
 
/* Add system time to cpustat. */
-   tmp = cputime_to_cputime64(cputime);
if (hardirq_count() - hardirq_offset)
cpustat-irq = cputime64_add(cpustat-irq, tmp);
else if (softirq_count())
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] add back pending timer irqs for kernel APIC timer

2007-08-10 Thread Dong, Eddie
[EMAIL PROTECTED] wrote:
Add back pending irqs for apic timer to get precise guestAPIC
 timer interrupt. 
 
Signed-off-by: Yaozu (Eddie) Dong [EMAIL PROTECTED]
 
 
a typo, please use this one.

With above patches, now guest timer is much accurate! sleep 60 
get exactly 60 seconds in host per my rough test.

BTW, AMD platform is not tested.

thx,eddie


diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h
index ed6d20a..8867c82 100644
--- a/drivers/kvm/irq.h
+++ b/drivers/kvm/irq.h
@@ -110,7 +110,7 @@ struct kvm_lapic {
unsigned long base_address;
struct kvm_io_device dev;
struct {
-   unsigned long pending;
+   atomic_t pending;
s64 period; /* unit: ns */
u32 divide_count;
ktime_t last_update;
@@ -153,5 +153,7 @@ int kvm_apic_set_irq(struct kvm_lapic *apic, u8 vec,
u8 trig);
 void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu);
 int kvm_ioapic_init(struct kvm *kvm);
 void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level);
+void kvm_pt_intr_post(struct kvm_vcpu *vcpu, int vec);
+void kvm_pt_update_irq(struct kvm_vcpu *vcpu);
 
 #endif
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index 352b8a7..cb4d3ca 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -30,6 +30,7 @@
 #include asm/page.h
 #include asm/current.h
 #include asm/apicdef.h
+#include asm/atomic.h
 #include irq.h
 
 #define PRId64 d
@@ -300,6 +301,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic,
int delivery_mode,
 int vector, int level, int trig_mode)
 {
int result = 0;
+   int orig_irr;
 
switch (delivery_mode) {
case APIC_DM_FIXED:
@@ -308,7 +310,8 @@ static int __apic_accept_irq(struct kvm_lapic *apic,
int delivery_mode,
if (unlikely(!apic_enabled(apic)))
break;
 
-   if (apic_test_and_set_irr(vector, apic)  trig_mode) {
+   orig_irr = apic_test_and_set_irr(vector, apic);
+   if (orig_irr  trig_mode) {
apic_debug(level trig mode repeatedly for
vector %d,
   vector);
break;
@@ -322,7 +325,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic,
int delivery_mode,
 
kvm_vcpu_kick(apic-vcpu);
 
-   result = 1;
+   result = (orig_irr == 0);
break;
 
case APIC_DM_REMRD:
@@ -352,18 +355,6 @@ static int __apic_accept_irq(struct kvm_lapic
*apic, int delivery_mode,
return result;
 }
 
-static inline int apic_accept_irq(struct kvm_lapic *apic, int
delivery_mode,
- int vector, int level, int trig_mode)
-{
-   int result = 0;
-
-   spin_lock_bh(apic-lock);
-   result = __apic_accept_irq(apic, delivery_mode,
-  vector, level, trig_mode);
-   spin_unlock_bh(apic-lock);
-   return result;
-}
-
 struct kvm_lapic *kvm_apic_round_robin(struct kvm *kvm, u8 vector,
   unsigned long bitmap)
 {
@@ -595,6 +586,7 @@ static void apic_mmio_write(struct kvm_io_device
*this,
apic_set_reg(apic, APIC_LVTT + 0x10 * i,
 lvt_val | APIC_LVT_MASKED);
}
+   atomic_set(apic-timer.pending, 0);
 
}
break;
@@ -632,12 +624,14 @@ static void apic_mmio_write(struct kvm_io_device
*this,
apic-timer.last_update = now;
apic-timer.period =
APIC_BUS_CYCLE_NS * apic-timer.divide_count
* val;
+   apic_debug(LAPIC period = %lld\n,
apic-timer.period);
 
/* Make sure the lock ordering is coherent */
spin_unlock_bh(apic-lock);
hrtimer_cancel(apic-timer.dev);
+   atomic_set(apic-timer.pending, 0);
hrtimer_start(apic-timer.dev,
- ktime_add_ns(now, offset),
+ ktime_add_ns(now,
apic-timer.period),
  HRTIMER_MODE_ABS);
 
apic_debug(%s: bus cycle is % PRId64 ns, now
0x%016
@@ -816,7 +810,7 @@ static void lapic_reset(struct kvm_vcpu *vcpu)
apic_set_reg(apic, APIC_TMR + 0x10 * i, 0);
}
apic-timer.divide_count = 0;
-   apic-timer.pending = 0;
+   atomic_set(apic-timer.pending, 0);
if (vcpu-vcpu_id == 0)
vcpu-apic_base |= MSR_IA32_APICBASE_BSP;
apic_update_ppr(apic);
@@ -857,38 +851,30 @@ EXPORT_SYMBOL_GPL(kvm_lapic_get_regs);
  * timer interface
 
*--
  */
+
+/* TODO: make sure __apic_timer_fn runs in current pCPU */
 static int 

Re: [kvm-devel] help with understanding GPA/GVA issues

2007-08-10 Thread Avi Kivity
Gregory Haskins wrote:
   
   
 Yes, you can pass through any gva.  There are couple of things to be 
 aware of though.  When passing a gva, you have to be sure that the gva 
 is actually mapped in memory as KVM cannot cause Linux to fault in a 
 page.
 

 Cool!  Ya, I totally understand and agree that it has to be DMA class
 memory that is mapped and pinned in guest context.  IIUC you basically
 need to follow the same rules as you would for a DMA based device in a
 bare-metal scenario.

   

Note that passing a virtual address is highly discouraged as its meaning 
can change from vcpu to vcpu, it might not be mapped, translation is 
slow, etc.  Just let the guest do the translation.

 On this topic:  I know there has been talk going on of giving each VM
 its own linux va context.  IIUC, when that happens we wouldn't need the
 gva_to_hpa type functions, right?  We could use things like
 copy_to_user(), etc?  Out of curiosity, what's the status of that
 project?
   

We have something running at qumranet, will be sent out soon.  I am 
somewhat discouraged in trying to get the thing to page -- Shaohua's 
approach is much simpler.



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] KVM version reporting?

2007-08-10 Thread Avi Kivity
Jim Paris wrote:
 Hi,

 Could qemu/VERSION get updated with each KVM release?  Currently it
 seems there is no way to determine the KVM version from the binaries.

 Putting it in MODULE_VERSION for the kernel modules would also be
 useful.

   

There will be a version string for the external modules starting with 
kvm-34.  I'll look into adding same for qemu.

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH 2/2][KVM] modify account_system_time() to add cputime to cpustat-guest

2007-08-10 Thread Laurent Vivier
You can find attached to this email the patch to apply to procps-3.2.7[1] to
allow top(1) to display the cpu guest time.

Laurent
[1] http://procps.sf.net/procps-3.2.7.tar.gz
-- 
- [EMAIL PROTECTED]  --
  Software is hard - Donald Knuth
Index: procps-3.2.7/top.c
===
--- procps-3.2.7.orig/top.c 2007-08-08 16:13:17.0 +0200
+++ procps-3.2.7/top.c  2007-08-10 16:46:01.0 +0200
@@ -935,7 +935,8 @@
cpus[Cpu_tot].x = 0;  // FIXME: can't tell by kernel version number
cpus[Cpu_tot].y = 0;  // FIXME: can't tell by kernel version number
cpus[Cpu_tot].z = 0;  // FIXME: can't tell by kernel version number
-   num = sscanf(buf, cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu,
+   cpus[Cpu_tot].g = 0;  // FIXME: can't tell by kernel version number
+   num = sscanf(buf, cpu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu,
   cpus[Cpu_tot].u,
   cpus[Cpu_tot].n,
   cpus[Cpu_tot].s,
@@ -943,7 +944,8 @@
   cpus[Cpu_tot].w,
   cpus[Cpu_tot].x,
   cpus[Cpu_tot].y,
-  cpus[Cpu_tot].z
+  cpus[Cpu_tot].z,
+  cpus[Cpu_tot].g
);
if (num  4)
  std_err(failed /proc/stat read);
@@ -960,9 +962,10 @@
   cpus[i].x = 0;  // FIXME: can't tell by kernel version number
   cpus[i].y = 0;  // FIXME: can't tell by kernel version number
   cpus[i].z = 0;  // FIXME: can't tell by kernel version number
-  num = sscanf(buf, cpu%u %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu,
+  cpus[i].g = 0;  // FIXME: can't tell by kernel version number
+  num = sscanf(buf, cpu%u %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu %Lu,
  cpus[i].id,
- cpus[i].u, cpus[i].n, cpus[i].s, cpus[i].i, cpus[i].w, 
cpus[i].x, cpus[i].y, cpus[i].z
+ cpus[i].u, cpus[i].n, cpus[i].s, cpus[i].i, cpus[i].w, 
cpus[i].x, cpus[i].y, cpus[i].z, cpus[i].g
   );
   if (num  4)
 std_err(failed /proc/stat read);
@@ -2879,10 +2882,11 @@
// we'll trim to zero if we get negative time ticks,
// which has happened with some SMP kernels (pre-2.4?)
 #define TRIMz(x)  ((tz = (SIC_t)(x))  0 ? 0 : tz)
-   SIC_t u_frme, s_frme, n_frme, i_frme, w_frme, x_frme, y_frme, z_frme, 
tot_frme, tz;
+   SIC_t u_frme, s_frme, n_frme, i_frme, w_frme, x_frme, y_frme, z_frme, 
g_frme, tot_frme, tz, u_tmp;
float scale;
 
-   u_frme = cpu-u - cpu-u_sav;
+   u_tmp = cpu-u - cpu-g;
+   u_frme = TRIMz(u_tmp - cpu-u_sav);
s_frme = cpu-s - cpu-s_sav;
n_frme = cpu-n - cpu-n_sav;
i_frme = TRIMz(cpu-i - cpu-i_sav);
@@ -2890,7 +2894,8 @@
x_frme = cpu-x - cpu-x_sav;
y_frme = cpu-y - cpu-y_sav;
z_frme = cpu-z - cpu-z_sav;
-   tot_frme = u_frme + s_frme + n_frme + i_frme + w_frme + x_frme + y_frme + 
z_frme;
+   g_frme = cpu-g - cpu-g_sav;
+   tot_frme = u_frme + s_frme + n_frme + i_frme + w_frme + x_frme + y_frme + 
z_frme + g_frme;
if (tot_frme  1) tot_frme = 1;
scale = 100.0 / (float)tot_frme;
 
@@ -2908,13 +2913,14 @@
  (float)w_frme * scale,
  (float)x_frme * scale,
  (float)y_frme * scale,
- (float)z_frme * scale
+ (float)z_frme * scale,
+ (float)g_frme * scale
   )
);
Msg_row += 1;
 
// remember for next time around
-   cpu-u_sav = cpu-u;
+   cpu-u_sav = u_tmp;
cpu-s_sav = cpu-s;
cpu-n_sav = cpu-n;
cpu-i_sav = cpu-i;
@@ -2922,6 +2928,7 @@
cpu-x_sav = cpu-x;
cpu-y_sav = cpu-y;
cpu-z_sav = cpu-z;
+   cpu-g_sav = cpu-g;
 
 #undef TRIMz
 }
Index: procps-3.2.7/top.h
===
--- procps-3.2.7.orig/top.h 2007-08-08 16:14:47.0 +0200
+++ procps-3.2.7/top.h  2007-08-08 17:01:45.0 +0200
@@ -211,8 +211,8 @@
 // calculations.  It exists primarily for SMP support but serves
 // all environments.
 typedef struct CPU_t {
-   TIC_t u, n, s, i, w, x, y, z; // as represented in /proc/stat
-   TIC_t u_sav, s_sav, n_sav, i_sav, w_sav, x_sav, y_sav, z_sav; // in the 
order of our display
+   TIC_t u, n, s, i, w, x, y, z, g; // as represented in /proc/stat
+   TIC_t u_sav, s_sav, n_sav, i_sav, w_sav, x_sav, y_sav, z_sav, g_sav; // in 
the order of our display
unsigned id;  // the CPU ID number
 } CPU_t;
 
@@ -390,7 +390,7 @@
 #define STATES_line2x6  %s\03 \
 %#4.1f%% \02us,\03 %#4.1f%% \02sy,\03 %#4.1f%% \02ni,\03 %#4.1f%% 
\02id,\03 %#4.1f%% \02wa,\03 %#4.1f%% \02hi,\03 %#4.1f%% \02si\03\n
 #define STATES_line2x7  %s\03 \
-   
%#5.1f%%\02us,\03%#5.1f%%\02sy,\03%#5.1f%%\02ni,\03%#5.1f%%\02id,\03%#5.1f%%\02wa,\03%#5.1f%%\02hi,\03%#5.1f%%\02si,\03%#5.1f%%\02st\03\n
+  
%#4.1f%%\02us,\03%#4.1f%%\02sy,\03%#4.1f%%\02ni,\03%#5.1f%%\02id,\03%#4.1f%%\02wa,\03%#4.1f%%\02hi,\03%#4.1f%%\02si,\03%#4.1f%%\02st\03,\02%#4.1f%%\02g\n
 #ifdef CASEUP_SUMMK
 #define MEMORY_line1  Mem: \03 \
 %8luK \02total,\03 %8luK \02used,\03 %8luK \02free,\03 %8luK 
\02buffers\03\n
-
This 

[kvm-devel] add back pending timer irqs for kernel APIC timer

2007-08-10 Thread Dong, Eddie
Add back pending irqs for apic timer to get precise guest
APIC timer interrupt.

Signed-off-by: Yaozu (Eddie) Dong [EMAIL PROTECTED]


diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h
index ed6d20a..8867c82 100644
--- a/drivers/kvm/irq.h
+++ b/drivers/kvm/irq.h
@@ -110,7 +110,7 @@ struct kvm_lapic {
unsigned long base_address;
struct kvm_io_device dev;
struct {
-   unsigned long pending;
+   atomic_t pending;
s64 period; /* unit: ns */
u32 divide_count;
ktime_t last_update;
@@ -153,5 +153,7 @@ int kvm_apic_set_irq(struct kvm_lapic *apic, u8 vec,
u8 trig);
 void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu);
 int kvm_ioapic_init(struct kvm *kvm);
 void kvm_ioapic_set_irq(struct kvm_ioapic *ioapic, int irq, int level);
+void kvm_pt_intr_post(struct kvm_vcpu *vcpu, int vec);
+void kvm_pt_update_irq(struct kvm_vcpu *vcpu);
 
 #endif
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index 352b8a7..cb4d3ca 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -30,6 +30,7 @@
 #include asm/page.h
 #include asm/current.h
 #include asm/apicdef.h
+#include asm/atomic.h
 #include irq.h
 
 #define PRId64 d
@@ -300,6 +301,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic,
int delivery_mode,
 int vector, int level, int trig_mode)
 {
int result = 0;
+   int orig_irr;
 
switch (delivery_mode) {
case APIC_DM_FIXED:
@@ -308,7 +310,8 @@ static int __apic_accept_irq(struct kvm_lapic *apic,
int delivery_mode,
if (unlikely(!apic_enabled(apic)))
break;
 
-   if (apic_test_and_set_irr(vector, apic)  trig_mode) {
+   orig_irr = apic_test_and_set_irr(vector, apic);
+   if (orig_irr  trig_mode) {
apic_debug(level trig mode repeatedly for
vector %d,
   vector);
break;
@@ -322,7 +325,7 @@ static int __apic_accept_irq(struct kvm_lapic *apic,
int delivery_mode,
 
kvm_vcpu_kick(apic-vcpu);
 
-   result = 1;
+   result = (orig_irr == 0);
break;
 
case APIC_DM_REMRD:
@@ -352,18 +355,6 @@ static int __apic_accept_irq(struct kvm_lapic
*apic, int delivery_mode,
return result;
 }
 
-static inline int apic_accept_irq(struct kvm_lapic *apic, int
delivery_mode,
- int vector, int level, int trig_mode)
-{
-   int result = 0;
-
-   spin_lock_bh(apic-lock);
-   result = __apic_accept_irq(apic, delivery_mode,
-  vector, level, trig_mode);
-   spin_unlock_bh(apic-lock);
-   return result;
-}
-
 struct kvm_lapic *kvm_apic_round_robin(struct kvm *kvm, u8 vector,
   unsigned long bitmap)
 {
@@ -595,6 +586,7 @@ static void apic_mmio_write(struct kvm_io_device
*this,
apic_set_reg(apic, APIC_LVTT + 0x10 * i,
 lvt_val | APIC_LVT_MASKED);
}
+   atomic_set(apic-timer.pending, 0);
 
}
break;
@@ -632,12 +624,14 @@ static void apic_mmio_write(struct kvm_io_device
*this,
apic-timer.last_update = now;
apic-timer.period =
APIC_BUS_CYCLE_NS * apic-timer.divide_count
* val;
+   apic_debug(LAPIC period = %lld\n,
apic-timer.period);
 
/* Make sure the lock ordering is coherent */
spin_unlock_bh(apic-lock);
hrtimer_cancel(apic-timer.dev);
+   atomic_set(apic-timer.pending, 0);
hrtimer_start(apic-timer.dev,
- ktime_add_ns(now, offset),
+ ktime_add_ns(now,
apic-timer.period),
  HRTIMER_MODE_ABS);
 
apic_debug(%s: bus cycle is % PRId64 ns, now
0x%016
@@ -816,7 +810,7 @@ static void lapic_reset(struct kvm_vcpu *vcpu)
apic_set_reg(apic, APIC_TMR + 0x10 * i, 0);
}
apic-timer.divide_count = 0;
-   apic-timer.pending = 0;
+   atomic_set(apic-timer.pending, 0);
if (vcpu-vcpu_id == 0)
vcpu-apic_base |= MSR_IA32_APICBASE_BSP;
apic_update_ppr(apic);
@@ -857,38 +851,30 @@ EXPORT_SYMBOL_GPL(kvm_lapic_get_regs);
  * timer interface
 
*--
  */
+
+/* TODO: make sure __apic_timer_fn runs in current pCPU */
 static int __apic_timer_fn(struct kvm_lapic *apic)
 {
-   u32 vector;
int result = 0;
 
-   if (unlikely(!apic_enabled(apic) ||
-!apic_lvt_enabled(apic, APIC_LVTT))) {
-   

[kvm-devel] modify apic timer last_update to precisely reflect hrtimer fire point.

2007-08-10 Thread Dong, Eddie
cleanup:
last_update should precisely reflect the time
when an hrtimer is fired, and store the period
of apic timer to avoid calculation each time.

Signed-off-by: Yaozu (Eddie) Dong [EMAIL PROTECTED]



diff --git a/drivers/kvm/irq.h b/drivers/kvm/irq.h
index 44e1fa4..ed6d20a 100644
--- a/drivers/kvm/irq.h
+++ b/drivers/kvm/irq.h
@@ -111,6 +111,7 @@ struct kvm_lapic {
struct kvm_io_device dev;
struct {
unsigned long pending;
+   s64 period; /* unit: ns */
u32 divide_count;
ktime_t last_update;
struct hrtimer dev;
diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index fc53e88..352b8a7 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -627,11 +627,10 @@ static void apic_mmio_write(struct kvm_io_device
*this,
case APIC_TMICT:
{
ktime_t now = apic-timer.dev.base-get_time();
-   u32 offset;
 
apic_set_reg(apic, APIC_TMICT, val);
apic-timer.last_update = now;
-   offset =
+   apic-timer.period =
APIC_BUS_CYCLE_NS * apic-timer.divide_count
* val;
 
/* Make sure the lock ordering is coherent */
@@ -861,7 +860,6 @@ EXPORT_SYMBOL_GPL(kvm_lapic_get_regs);
 static int __apic_timer_fn(struct kvm_lapic *apic)
 {
u32 vector;
-   ktime_t now;
int result = 0;
 
if (unlikely(!apic_enabled(apic) ||
@@ -872,8 +870,7 @@ static int __apic_timer_fn(struct kvm_lapic *apic)
}
 
vector = apic_lvt_vector(apic, APIC_LVTT);
-   now = apic-timer.dev.base-get_time();
-   apic-timer.last_update = now;
+   apic-timer.last_update = apic-timer.dev.expires;
apic-timer.pending++;
__apic_accept_irq(apic, APIC_DM_FIXED, vector, 1, 0);
 
@@ -884,7 +881,9 @@ static int __apic_timer_fn(struct kvm_lapic *apic)
offset = APIC_BUS_CYCLE_NS * apic-timer.divide_count *
tmict;
 
result = 1;
-   apic-timer.dev.expires = ktime_add_ns(now, offset);
+   apic-timer.dev.expires = ktime_add_ns(
+   apic-timer.dev.expires,
+   apic-timer.period);
}
 
return result;


apic-timer-last2.patch
Description: apic-timer-last2.patch
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] clean APIC_TMCCT setting in APIC timer

2007-08-10 Thread Dong, Eddie
APIC_TMCCT is a dynamically running count which always
need to be recalculated at the time it is read. Setting
intermediate value is meaningless.

Signed-off-by: Yaozu (Eddie) Dong [EMAIL PROTECTED]


diff --git a/drivers/kvm/lapic.c b/drivers/kvm/lapic.c
index d59b69f..fc53e88 100644
--- a/drivers/kvm/lapic.c
+++ b/drivers/kvm/lapic.c
@@ -445,7 +445,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
 {
u32 counter_passed;
ktime_t passed, now = apic-timer.dev.base-get_time();
-   u32 tmcct = apic_get_reg(apic, APIC_TMCCT);
+   u32 tmcct = apic_get_reg(apic, APIC_TMICT);
 
ASSERT(apic != NULL);
 
@@ -474,9 +474,6 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
} while (tmcct = 0);
}
 
-   apic-timer.last_update = now;
-   apic_set_reg(apic, APIC_TMCCT, tmcct);
-
return tmcct;
 }
 
@@ -633,7 +630,6 @@ static void apic_mmio_write(struct kvm_io_device
*this,
u32 offset;
 
apic_set_reg(apic, APIC_TMICT, val);
-   apic_set_reg(apic, APIC_TMCCT, val);
apic-timer.last_update = now;
offset =
APIC_BUS_CYCLE_NS * apic-timer.divide_count
* val;
@@ -815,7 +811,6 @@ static void lapic_reset(struct kvm_vcpu *vcpu)
apic_set_reg(apic, APIC_ICR2, 0);
apic_set_reg(apic, APIC_TDCR, 0);
apic_set_reg(apic, APIC_TMICT, 0);
-   apic_set_reg(apic, APIC_TMCCT, 0);
for (i = 0; i  8; i++) {
apic_set_reg(apic, APIC_IRR + 0x10 * i, 0);
apic_set_reg(apic, APIC_ISR + 0x10 * i, 0);
@@ -886,13 +881,10 @@ static int __apic_timer_fn(struct kvm_lapic *apic)
u32 offset;
u32 tmict = apic_get_reg(apic, APIC_TMICT);
 
-   apic_set_reg(apic, APIC_TMCCT, tmict);
offset = APIC_BUS_CYCLE_NS * apic-timer.divide_count *
tmict;
 
result = 1;
apic-timer.dev.expires = ktime_add_ns(now, offset);
-   } else {
-   apic_set_reg(apic, APIC_TMCCT, 0);
}
 
return result;
@@ -996,7 +988,6 @@ void kvm_apic_post_state_restore(struct kvm_vcpu
*vcpu)
 MSR_IA32_APICBASE_BASE;
apic_set_reg(apic, APIC_LVR, APIC_VERSION);
val = apic_get_reg(apic, APIC_TMICT);
-   apic_set_reg(apic, APIC_TMCCT, val);
apic_update_ppr(apic);
 
/* TODO: following code can be in a common API */

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [Qemu-devel] Re: Storing command line options in images

2007-08-10 Thread Anthony Liguori
Avi Kivity wrote:
 This is a big effort but a config file is the right long term solution.

 

 For which use case? management-full or management-less?
   

Both.  A config file will be useful not just for expressing the 
functionality we have today, but also for describing the guest's 
environment in greater detail.  For instance, if you want to support a 
bunch of different kinds of embedded systems, it would be very nice if 
the machine description was a config file instead of hard coded such 
that it was easy to tweak what hardware was present for the particular 
embedded system.

 A managed system will want to supply arguments out of a central 
 database.  For a management-less use case, the config file is a hassle.
   

As long as all options are still settable via command line (or stdio), 
then it's not at all a hassle.

Regards,

Anthony Liguori

 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 kvm-devel mailing list
 kvm-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/kvm-devel

   


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [Qemu-devel] Re: Storing command line options in images

2007-08-10 Thread Avi Kivity
Anthony Liguori wrote:
 Jorge Lucángeli Obes wrote:
 Hi all,

 From what I've gathered, it seems that we have basically four options
 at hand. I think it's important to notice, however, that whatever
 comes out of this will probably be, as Avi said, a low-end solution.
 IMHO there's room to have both the high-end libvirt-like approach, and
 the shell replacer approach.

 So let's see:

 1- We could go the way of the patches I've posted, adding the comments
 everyone's made.
 1a- It's a good idea to actively signal QEMU to read command line
 options from the image file, and not have it on by default.
   

 I think if you have to add a new option, the base implementation is 
 wrong.  The whole point of this is to simplify things for the user and 
 adding more weird options just makes things more complicated.

It's not as bad as that -- the user has to remember only option (or have 
a qemu-trusted script that supplies the option).  But I agree that the 
feature is now much less compelling, and that the new option is needed.


 4- We could have configuration files associated with the host and 
 guests.
 4a- Embedded XML.
 4b- Separate files.
   

 This is a big effort but a config file is the right long term solution.


For which use case? management-full or management-less?

A managed system will want to supply arguments out of a central 
database.  For a management-less use case, the config file is a hassle.


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] add back pending timer irqs for kernel APIC timer

2007-08-10 Thread Avi Kivity
Dong, Eddie wrote:
 Add back pending irqs for apic timer to get precise guest
 APIC timer interrupt.
   

Can you explain the problem and the solution in more detail?


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH 0/2][KVM] guest time accounting

2007-08-10 Thread Laurent Vivier
The aim of these two patches is to measure the CPU time used by a virtual
machine. All comments are welcome... I'm not sure it's the good way to do that.

[PATCH 1/2] introduce a new field, guest, in cpustat to store the time used by
the CPU to run virtual CPU. Modify /proc/stat to display this new field.

[PATCH 2/2] modify account_system_time() to add cputime to cpustat-guest if we
are running a VCPU. We add this cputime to  cpustat-user instead of
cpustat-system because this part of KVM code is in fact user code although it
is executed in the kernel. We duplicate VCPU time between guest and user to
allow an unmodified top(1) to display correct value. A modified top(1) is
able to display good cpu user time and cpu guest time by subtracting cpu guest
time from cpu user time.

Signed-Off-by: Laurent Vivier [EMAIL PROTECTED]
-- 
- [EMAIL PROTECTED]  --
  Software is hard - Donald Knuth


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] qemu: free migration structure if migration fails

2007-08-10 Thread Jim Paris
Without this, memory is leaked and later attempts fail with
Migration already active.

Signed-off-by: Jim Paris [EMAIL PROTECTED]
---
 qemu/migration.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/qemu/migration.c b/qemu/migration.c
index bbeed86..ed1fd29 100644
--- a/qemu/migration.c
+++ b/qemu/migration.c
@@ -190,6 +190,8 @@ static void migrate_finish(MigrationState *s)
 save_verify_memory(f, NULL);
 #endif /* MIGRATION_VERIFY */
 qemu_fclose(f);
+} else {
+   migrate_close(s);
 }
 status = *has_error;
 if (ret  !status)
-- 
1.5.3.rc4


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [Qemu-devel] Re: Storing command line options in images

2007-08-10 Thread Anthony Liguori
Avi Kivity wrote:
 Anthony Liguori wrote:
 Avi Kivity wrote:
 This is a big effort but a config file is the right long term 
 solution.

 

 For which use case? management-full or management-less?
   

 Both.  A config file will be useful not just for expressing the 
 functionality we have today, but also for describing the guest's 
 environment in greater detail.  For instance, if you want to support 
 a bunch of different kinds of embedded systems, it would be very nice 
 if the machine description was a config file instead of hard coded 
 such that it was easy to tweak what hardware was present for the 
 particular embedded system.


 Maybe I'm dense today.  Which use case is this?

If you're using QEMU to simulate an embedded platform (ARM or PPC based 
for instance).  There is a huge amount of variety in embedded platforms 
so having to hard code the PC description as a machine type in QEMU is 
kind of annoying.

 A managed system will want to supply arguments out of a central 
 database.  For a management-less use case, the config file is a hassle.
   

 As long as all options are still settable via command line (or 
 stdio), then it's not at all a hassle.


 Yes.  But if you don't plan to use it, why implement it?

Well, I do plan to use it.  I'm simply saying that you don't have to use 
it if you don't want to.

There are a lot of knobs in QEMU and most of them have somewhat 
arbitrary defaults.  For instance, when I setup a machine, I don't want 
to use user networking by default, I want to use tap.  A global 
configuration file would be terribly useful for this sort of thing.

 My feeling is that config files are outdated.  When used with a gui, 
 you end up writing silly parsers and stuff and still wrecking things 
 horribly when the the gui writer's expectations don't match reality.  
 When used without a gui, they increase the amount of details one has 
 to remember (where's that config file? I renamed my image, did I 
 remember to update the config file?).  They also make upgrading more 
 difficult.

There's only so much that can be expressed on a command line.  There are 
actually limits to the command line size on a lot of platforms.  I don't 
see why reading options from a file is so much worse than reading them 
from the command line.

Regards,

Anthony Liguori






-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] help with understanding GPA/GVA issues

2007-08-10 Thread Anthony Liguori
Gregory Haskins wrote:
 Hi All,
   I am working on some PV stuff and had some questions about the ability
 to share memory across the Guest/Host boundary.

 It seems that most examples of how to do this always involve starting
 with a *page, converting it to a gfn via page_to_gfn(), and using that
 as a gpa to pass across the boundary.
   

Do you mean page_to_pfn?  I assume you're talking about a page within 
the guest right?

 I understand that this method avoids a software traipse through the
 page-walker, so it's nice.  What I can't quite figure out is what are
 the other types of memory (if any) that can be passed across.

 For instance, is a pointer from kmalloc() considered a gpa, a gva,
 neither?

gpa = guest physical address.  It's a pa or a pfn  PAGE_SHIFT.

gva = guest virtual address.  It's returned from pretty much anything 
that allocates memory (kmalloc for instance).  This is all within the 
guest of course.

   Or are gva's only pointers that come from guest-userspace,
 etc.  Is it possible to pass something like a skb-data pointer (I
 understand that I may have to run the page-walker for some of these)?
   

Yes, you can pass through any gva.  There are couple of things to be 
aware of though.  When passing a gva, you have to be sure that the gva 
is actually mapped in memory as KVM cannot cause Linux to fault in a 
page.  Also, for something like skb-data, you should probably just pass 
the gpa since they'll usually fall within a single page anyway.

 If so, how would I do this:  E.g. can I just pass the pointer, and then
 do gva_to_hpa() on the host?  Or do I need to prep the pointer before
 sending it?
   

There's no need to prep provided that you know the va is mapped into 
memory in the guest.

Regards,

Anthony Liguori

 TIA
 -Greg


 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 kvm-devel mailing list
 kvm-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/kvm-devel

   


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] help with understanding GPA/GVA issues

2007-08-10 Thread Gregory Haskins
On Fri, 2007-08-10 at 19:59 +0300, Avi Kivity wrote:

 Note that passing a virtual address is highly discouraged as its meaning 
 can change from vcpu to vcpu, it might not be mapped, translation is 
 slow, etc.  Just let the guest do the translation.

Yeah, Hollis and Anthony straighted me out via IRC.  I will mostly be
dealing with kmalloc/skb buffers so we settled on the following as
optimal:

guest-side

gpa = __pa(ptr);

host-side:

gfn  = gpa  PAGE_SHIFT
page = gfn_to_page(gfn);
ptr = kmap(page);

..

kunmap(ptr); 


 
 We have something running at qumranet, will be sent out soon.  I am 
 somewhat discouraged in trying to get the thing to page -- Shaohua's 
 approach is much simpler.
 

Cool!  Ill keep an eye out.

-Greg


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] WARNING: at arch/x86_64/kernel/smp.c:379 smp_call_function_single()

2007-08-10 Thread Michal Piotrowski
Hi,

On 10/08/07, Paolo Ornati [EMAIL PROTECTED] wrote:
 Just got this warning during suspend2ram (2.6.23-rc2-gac078602).

 Config and full dmesg attached.


 [  756.707601] Disabling non-boot CPUs ...
 [  756.712034] kvm: disabling virtualization on CPU1
 [  756.712037] WARNING: at arch/x86_64/kernel/smp.c:379 
 smp_call_function_single()
 [  756.712039]
 [  756.712039] Call Trace:
 [  756.712046]  [8021d159] smp_call_function_single+0x119/0x120
 [  756.712050]  [80542169] thread_return+0x1bf/0x626
 [  756.712054]  [80234b5b] sys_sched_yield+0x2b/0x80
 [  756.712057]  [8043684b] kvm_cpu_hotplug+0x4b/0xa0
 [  756.712060]  [80247c83] notifier_call_chain+0x53/0x80
 [  756.712062]  [80247d09] __raw_notifier_call_chain+0x9/0x10
 [  756.712065]  [80247d21] raw_notifier_call_chain+0x11/0x20
 [  756.712068]  [8026184b] take_cpu_down+0x1b/0x30
 [  756.712071]  [802699d2] do_stop+0xd2/0x150
 [  756.712073]  [80269900] do_stop+0x0/0x150
 [  756.712076]  [8024f84d] kthread+0x4d/0x80
 [  756.712079]  [8020cb28] child_rip+0xa/0x12
 [  756.712081]  [8020c23c] restore_args+0x0/0x30
 [  756.712084]  [8024f800] kthread+0x0/0x80
 [  756.712086]  [8020cb1e] child_rip+0x0/0x12
 [  756.712087]
 [  756.815693] CPU 1 is now offline
 [  756.815697] lockdep: not fixing up alternatives.
 [  756.819276] CPU1 is down


Added to KR list, thanks for the report.

Regrads,
Michal

-- 
LOG
http://www.stardust.webpages.pl/log/

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] help with understanding GPA/GVA issues

2007-08-10 Thread Gregory Haskins
On Fri, 2007-08-10 at 09:32 -0500, Anthony Liguori wrote:
 Gregory Haskins wrote:
  Hi All,
I am working on some PV stuff and had some questions about the ability
  to share memory across the Guest/Host boundary.
 
  It seems that most examples of how to do this always involve starting
  with a *page, converting it to a gfn via page_to_gfn(), and using that
  as a gpa to pass across the boundary.

 
 Do you mean page_to_pfn?  I assume you're talking about a page within 
 the guest right?

Er, ya.  Sorry...up too late last night ;)

 
  I understand that this method avoids a software traipse through the
  page-walker, so it's nice.  What I can't quite figure out is what are
  the other types of memory (if any) that can be passed across.
 
  For instance, is a pointer from kmalloc() considered a gpa, a gva,
  neither?
 
 gpa = guest physical address.  It's a pa or a pfn  PAGE_SHIFT.
 
 gva = guest virtual address.  It's returned from pretty much anything 
 that allocates memory (kmalloc for instance).  This is all within the 
 guest of course.
 
Or are gva's only pointers that come from guest-userspace,
  etc.  Is it possible to pass something like a skb-data pointer (I
  understand that I may have to run the page-walker for some of these)?

 
 Yes, you can pass through any gva.  There are couple of things to be 
 aware of though.  When passing a gva, you have to be sure that the gva 
 is actually mapped in memory as KVM cannot cause Linux to fault in a 
 page.

Cool!  Ya, I totally understand and agree that it has to be DMA class
memory that is mapped and pinned in guest context.  IIUC you basically
need to follow the same rules as you would for a DMA based device in a
bare-metal scenario.

   Also, for something like skb-data, you should probably just pass 
 the gpa since they'll usually fall within a single page anyway.

Hmm...good point.

 
  If so, how would I do this:  E.g. can I just pass the pointer, and then
  do gva_to_hpa() on the host?  Or do I need to prep the pointer before
  sending it?

 
 There's no need to prep provided that you know the va is mapped into 
 memory in the guest.
 

Thanks Anthony!  Very helpful indeed and I appreciate the explanation.

On this topic:  I know there has been talk going on of giving each VM
its own linux va context.  IIUC, when that happens we wouldn't need the
gva_to_hpa type functions, right?  We could use things like
copy_to_user(), etc?  Out of curiosity, what's the status of that
project?


-Greg


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] help with understanding GPA/GVA issues

2007-08-10 Thread Hollis Blanchard
On Fri, 10 Aug 2007 00:09:18 -0400, Gregory Haskins wrote:
 
 If so, how would I do this:  E.g. can I just pass the pointer, and then
 do gva_to_hpa() on the host?  Or do I need to prep the pointer before
 sending it?

We've talked about this a little in the
past: see the discussion around http://lkml.org/lkml/2007/1/7/60 (in
particular http://lkml.org/lkml/2007/1/7/126 ;) .

In short, please do *not* pass guest virtual addresses through a
paravirtual API.

-- 
Hollis Blanchard
IBM Linux Technology Center


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [Patch] (big) real mode emulation - jmp rel

2007-08-10 Thread Nitin A Kamble
Hi Avi,
The patch to implement jmp rel emulation is attached.

Thanks  Regards,
Nitin 
Open Source Technology Center, Intel Corporation.
-
The mind is like a parachute; it works much better when it's open. 
commit 1d77b7ad2bcb20858dd66d9653952a8d1cc0a153
Author: Nitin A Kamble [EMAIL PROTECTED]
Date:   Fri Aug 10 18:36:12 2007 -0700

Implement instruction jmp rel opcode 0xe9

Signed-off-by: Nitin A Kamble [EMAIL PROTECTED]

diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index b4f439c..40fb6ee 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -145,8 +145,10 @@ static u8 opcode_table[256] = {
 	0, 0, 0, 0,
 	/* 0xD8 - 0xDF */
 	0, 0, 0, 0, 0, 0, 0, 0,
-	/* 0xE0 - 0xEF */
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	/* 0xE0 - 0xE7 */
+	0, 0, 0, 0, 0, 0, 0, 0,
+	/* 0xE8 - 0xEF */
+	0, SrcImm|ImplicitOps, 0, 0, 0, 0, 0, 0,
 	/* 0xF0 - 0xF7 */
 	0, 0, 0, 0,
 	ImplicitOps, 0,
@@ -447,6 +449,12 @@ struct operand {
 			   (((reg) + _inc)  ((1UL  (ad_bytes  3)) - 1)); \
 	} while (0)
 
+#define jmp_rel(rel)			\
+do {	\
+	_eip += (int)(rel);		\
+	_eip = ((op_bytes == 2) ? (uint16_t)_eip : (uint32_t)_eip);	\
+} while (0)
+
 /*
  * Given the 'reg' portion of a ModRM byte, and a register block, return a
  * pointer into the block that addresses the relevant register.
@@ -1200,6 +1208,10 @@ special_insn:
 	case 0xae ... 0xaf:	/* scas */
 		DPRINTF(Urk! I don't handle SCAS.\n);
 		goto cannot_emulate;
+	case 0xe9: /* jmp rel */
+		jmp_rel(src.val);
+		no_wb = 1; /* Disable writeback. */
+		break;
 	case 0xf4:  /* hlt */
 		ctxt-vcpu-halt_request = 1;
 		goto done;


signature.asc
Description: This is a digitally signed message part
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [Patch] (big) real mode emulation - jmp rel short

2007-08-10 Thread Nitin A Kamble
Hi Avi,
Attached is the patch for the instruction jmp rel short, opcode
0xeb.

  This patch goes on top of last patch (jmp rel).


Thanks  Regards,
Nitin 
Open Source Technology Center, Intel Corporation.
-
The mind is like a parachute; it works much better when it's open. 
commit 38f7db6830c862cd0470aaa07cabe616ff741d69
Author: Nitin A Kamble [EMAIL PROTECTED]
Date:   Fri Aug 10 18:48:05 2007 -0700

Implement jmp rel short opcode: 0xeb

Signed-off-by: Nitin A Kamble [EMAIL PROTECTED]

diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c
index 40fb6ee..16ea385 100644
--- a/drivers/kvm/x86_emulate.c
+++ b/drivers/kvm/x86_emulate.c
@@ -148,7 +148,7 @@ static u8 opcode_table[256] = {
 	/* 0xE0 - 0xE7 */
 	0, 0, 0, 0, 0, 0, 0, 0,
 	/* 0xE8 - 0xEF */
-	0, SrcImm|ImplicitOps, 0, 0, 0, 0, 0, 0,
+	0, SrcImm|ImplicitOps, 0, SrcImmByte|ImplicitOps, 0, 0, 0, 0,
 	/* 0xF0 - 0xF7 */
 	0, 0, 0, 0,
 	ImplicitOps, 0,
@@ -1208,6 +1208,7 @@ special_insn:
 	case 0xae ... 0xaf:	/* scas */
 		DPRINTF(Urk! I don't handle SCAS.\n);
 		goto cannot_emulate;
+	case 0xeb: /* jmp rel short */
 	case 0xe9: /* jmp rel */
 		jmp_rel(src.val);
 		no_wb = 1; /* Disable writeback. */


signature.asc
Description: This is a digitally signed message part
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] [PATCH] Fix network boot whether KVM is enabled or disabled

2007-08-10 Thread Chuan-kai Lin
From: Chuan-kai Lin [EMAIL PROTECTED]

This patch is based on the one Anthony Liguori submitted to kvm-devel
on July 2nd, which fixes PXE booting with KVM enabled but breaks PXE
booting when not using KVM.  I simplified Anthony's patch and
duplicated the cpu_register_physical_memory call to ensure that the
code retains its original behavior when kvm_allowed is 0.

Signed-off-by: Chuan-kai Lin [EMAIL PROTECTED]

---

diff -r 3aba64456000 qemu/hw/pc.c
--- a/qemu/hw/pc.c  Fri Aug 10 11:33:03 2007 -0700
+++ b/qemu/hw/pc.c  Fri Aug 10 14:53:28 2007 -0700
@@ -566,8 +566,15 @@ static void pc_init1(int ram_size, int v
fprintf(stderr, Too many option ROMS\n);
exit(1);
}
-   cpu_register_physical_memory(0xd + option_rom_offset,
-size, offset | IO_MEM_ROM);
+if (kvm_allowed) {
+  memcpy(phys_ram_base + 0xc + offset - bios_offset,
+ phys_ram_base + offset, size);
+  cpu_register_physical_memory(0xd + option_rom_offset,
+   size, (offset - bios_offset) |
IO_MEM_ROM);
+}
+else
+  cpu_register_physical_memory(0xd + option_rom_offset,
+   size, offset | IO_MEM_ROM);
option_rom_offset += size + 2047;
option_rom_offset -= (option_rom_offset % 2048);
 }

-- 
Chuan-kai Lin

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] add back pending timer irqs for kernel APIC timer

2007-08-10 Thread Dong, Eddie
Avi Kivity wrote:
 Dong, Eddie wrote:
 Add back pending irqs for apic timer to get precise guest
 APIC timer interrupt. 
 
 
 Can you explain the problem and the solution in more detail?

Today guest sleep 10 seconds only get about 5-6 seconds in host time.
A design philosiphy in various VMM is that guest wall clock should catch
up host wall clock. 

The reason (partly) is that A VM may be descheduled, while the host time
is still going.  For periodic timer like APIC timer, guest expect to see
certain amount of interrupt that stands for the time passed (host time).
In previous
APIC timer virtualization policy, we inject an IRQ to APIC when a period
of  host time is passed, but the guest may not take it if it is
descheduled.
In that way the previous irq in APIC will be overwritten by next
injection from fire of 
host hrtimer.  In that way guest get less amount of APIC timer IRQ.

This patch keep track of the pending irqs and inject them back to guest
eventually
even the guest may be descheduled. This is also what we did in Xen.
BTW, This policy will also be applied to future kernel PIT, I just do it
step by step.


Thx,eddie

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [Qemu-devel] Re: Storing command line options in images

2007-08-10 Thread Jorge Lucángeli Obes
  My feeling is that config files are outdated.  When used with a gui,
  you end up writing silly parsers and stuff and still wrecking things
  horribly when the the gui writer's expectations don't match reality.
  When used without a gui, they increase the amount of details one has
  to remember (where's that config file? I renamed my image, did I
  remember to update the config file?).  They also make upgrading more
  difficult.

 There's only so much that can be expressed on a command line.  There are
 actually limits to the command line size on a lot of platforms.  I don't
 see why reading options from a file is so much worse than reading them
 from the command line.

In my view, the bottom line is: we need an _easy_ way of launching VMs
when one doesn't want all the options of the managed approach. I back
Avi on this one, I would like to be able to do

qemu guest.img

without worrying about configuration files, or XML, or parsing. That's
not to say that a global configuration file for QEMU wouldn't be
useful, but I think it would solve a different problem.

When I read Avi's TODO, I basically thought about getting rid of the
long command lines I had to store in scripts. I wanted to write that
command line once, and then forgetting about it, until I needed to
change it. I wanted an image to be self-contained as much as possible.
That's what I set to achieve.

All that said, I rethought Anthony's idea of storing plain text in the
image and with proper tools, it can work out. I don't like the idea of
having users overwriting and padding files, but the approach seems
less of a hack than using empty snapshots. In short: I think we will
need to have something like 'qemu-img cmdline' anyways, independent of
the implementation. That's because I would like an implementation that
does not depend on extra files. For that, we already have libvirt and
the likes.

Cheers,
Jorge

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


Re: [kvm-devel] [PATCH] Fix network boot whether KVM is enabled or disabled

2007-08-10 Thread Anthony Liguori
Chuan-kai Lin wrote:
 From: Chuan-kai Lin [EMAIL PROTECTED]

 This patch is based on the one Anthony Liguori submitted to kvm-devel
 on July 2nd, which fixes PXE booting with KVM enabled but breaks PXE
 booting when not using KVM.  I simplified Anthony's patch and
 duplicated the cpu_register_physical_memory call to ensure that the
 code retains its original behavior when kvm_allowed is 0.

 Signed-off-by: Chuan-kai Lin [EMAIL PROTECTED]

 ---

 diff -r 3aba64456000 qemu/hw/pc.c
 --- a/qemu/hw/pc.cFri Aug 10 11:33:03 2007 -0700
 +++ b/qemu/hw/pc.cFri Aug 10 14:53:28 2007 -0700
 @@ -566,8 +566,15 @@ static void pc_init1(int ram_size, int v
   fprintf(stderr, Too many option ROMS\n);
   exit(1);
   }
 - cpu_register_physical_memory(0xd + option_rom_offset,
 -  size, offset | IO_MEM_ROM);
 +if (kvm_allowed) {
 +  memcpy(phys_ram_base + 0xc + offset - bios_offset,
 + phys_ram_base + offset, size);
 +  cpu_register_physical_memory(0xd + option_rom_offset,
 +   size, (offset - bios_offset) |
 IO_MEM_ROM);
 +}
 +else
   

Should be:

} else

I clearly preferred the way I did it but I don't care that much.  Thanks 
for bringing this patch up again, I've been meaning to resubmit it.

Regards,

Anthony Liguori

 +  cpu_register_physical_memory(0xd + option_rom_offset,
 +   size, offset | IO_MEM_ROM);
   option_rom_offset += size + 2047;
   option_rom_offset -= (option_rom_offset % 2048);
  }

   


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel


[kvm-devel] problem upgrading to kvm-33

2007-08-10 Thread Tony Smolar
Hi,  I was currently using kvm-24, and I decided to try to upgrade to 
the latest.

My guest is XP-SP2 Home full edition.When I tried to boot it under 
kvm-33,  I eventually got a blue screen and a IRQL_NOT_LESS_OR_EQUAL error.

I removed 33, and installed kvm-26.I was able to boot the VM 
successfully with that.  So I guess this problem was introduced 
somewhere between 27 and 33.   Is there a way to tweak the guest to get 
around this problem?

Thanks,
Tony Smolar

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel