Re: [PATCH] unbreak booting with virtio

2009-08-01 Thread SAL
On Fri, Jul 31, 2009 at 09:55:39PM +0200, Alexander Graf wrote:

 On 31.07.2009, at 20:19, Glauber Costa glom...@redhat.com wrote:

 Since commit 89e671e3, extboot is broken due to wrong checksum

 The problem is that printf \\$sum syntax will require an octal
 representation, so the fix I'm proposing is to convert it first.

 Is there no easy way to tell printf we're on decimal? I don't have a  
 Linux system handy atm, but I thought \90 was in fact a 90.

 Either way, my only complaint would be to introduce a dependency on bc.

 cp $1 $2
 +sum=$(echo obase=8; $sum | bc)
 printf \\$sum | dd of=$2 bs=1 count=1 seek=$size conv=notrunc 2/ 
 dev/null

May be it's better to use awk:

echo $sum | awk '{ printf(%c, $1) }' \
  | dd of=$2 bs=1 count=1 seek=$size conv=notrunc 2/dev/null

This version accepts decimal $sum, does not need conversion to octal.

SAL
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] unbreak booting with virtio

2009-08-01 Thread SAL
On Sat, Aug 01, 2009 at 09:04:55AM +0200, Ján ONDREJ (SAL) wrote:
 On Fri, Jul 31, 2009 at 09:55:39PM +0200, Alexander Graf wrote:
 
  On 31.07.2009, at 20:19, Glauber Costa glom...@redhat.com wrote:
 
  cp $1 $2
  +sum=$(echo obase=8; $sum | bc)
  printf \\$sum | dd of=$2 bs=1 count=1 seek=$size conv=notrunc 2/ 
  dev/null
 
 May be it's better to use awk:
 
 echo $sum | awk '{ printf(%c, $1) }' \
   | dd of=$2 bs=1 count=1 seek=$size conv=notrunc 2/dev/null
 
 This version accepts decimal $sum, does not need conversion to octal.

Ane may be it's better to write whole checksum in awk, it's faster and
cleaner. See attached patch (I am sorry, I don't know how to use git-email).

SAL
diff --git a/pc-bios/optionrom/signrom.sh b/pc-bios/optionrom/signrom.sh
index 4273d1f..065b6a9 100755
--- a/pc-bios/optionrom/signrom.sh
+++ b/pc-bios/optionrom/signrom.sh
@@ -18,28 +18,31 @@
 #
 # Copyright Novell Inc, 2009
 #   Authors: Alexander Graf ag...@suse.de
+#Jan Ondrej (SAL) ondrejj(at)salstar.sk
 #
 # Syntax: signrom.sh input output
 
 # did we get proper arguments?
 test $1 -a $2 || exit 1
 
-sum=0
-
-# find out the file size
-x=`dd if=$1 bs=1 count=1 skip=2 2/dev/null | od -t u1 -A n`
-#size=`expr $x \* 512 - 1`
-size=$(( $x * 512 - 1 ))
-
-# now get the checksum
-for i in `od -A n -t u1 -v $1`; do
-# add each byte's value to sum
-sum=$(( $sum + $i ))
-done
-
-sum=$(( $sum % 256 ))
-sum=$(( 256 - $sum ))
-
-# and write the output file
-cp $1 $2
-printf \\$sum | dd of=$2 bs=1 count=1 seek=$size conv=notrunc 2/dev/null
+od -A n -t u1 -v $1 | awk '
+BEGIN {
+checksum=0
+# last byte will be replaced by checksum
+last=-1
+}
+{
+# go over all record in row
+for(i=1; i=NF; i++) {
+checksum+=$i
+if (last=0) {
+printf %c, last
+}
+last=$i
+}
+}
+END {
+# compute checksum
+printf %c, 256-(checksum%256)
+}
+'  $2


Re: [PATCH] unbreak booting with virtio

2009-08-01 Thread SAL
On Sat, Aug 01, 2009 at 10:19:20AM +0200, Alexander Graf wrote:

 On 01.08.2009, at 10:01, Ján ONDREJ (SAL) wrote:

 On Sat, Aug 01, 2009 at 09:04:55AM +0200, Ján ONDREJ (SAL) wrote:
 On Fri, Jul 31, 2009 at 09:55:39PM +0200, Alexander Graf wrote:

 On 31.07.2009, at 20:19, Glauber Costa glom...@redhat.com wrote:

 cp $1 $2
 +sum=$(echo obase=8; $sum | bc)
 printf \\$sum | dd of=$2 bs=1 count=1 seek=$size conv=notrunc 
 2/
 dev/null

 May be it's better to use awk:

 echo $sum | awk '{ printf(%c, $1) }' \
  | dd of=$2 bs=1 count=1 seek=$size conv=notrunc 2/dev/null

 This version accepts decimal $sum, does not need conversion to octal.

 Ane may be it's better to write whole checksum in awk, it's faster and
 cleaner. See attached patch (I am sorry, I don't know how to use git- 
 email).

 My awk magic is pretty bad, but I think this version is missing the  
 padding, right?

Right. If you prefer this version agains Paolos double printf, I can
update it, if not, just use Pauols solution.

SAL
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: init scripts for KVM guests UPDATE!

2009-07-19 Thread SAL
On Sat, Jul 18, 2009 at 02:13:44AM +0200, Saman Behnam wrote:
 here is an update for the init scripts for KVM guestsI've wrote for
 starting and stopping the KVM guest machines either by saving and
 restoring or by gracefully shutdown and start. My question, is there an
 option within libvirt to make the KVM guest mashines get saved when
 the KVM host shuts down? I had problems to gracefully shutdown Windows
 VM's!!!

Hello,

  I sent my (and also your) script to libvir-list, but no response yet.
There are also some suggestions, how libvirt can handle graceful shutdown
and leave ability to restart libvirt without touching guests.

  I use my script to also shutdown windows guests. It's working well, if you
configure to shutdown windows on acpi event (virtual power button pressed).
I am not an expert for windows and I can't tell you more, but I am sure,
that you can find more with google. :-)

SAL
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: init scripts for KVM guests UPDATE!

2009-07-19 Thread SAL
On Sun, Jul 19, 2009 at 11:51:44AM +0200, Ján ONDREJ (SAL) wrote:
 On Sat, Jul 18, 2009 at 02:13:44AM +0200, Saman Behnam wrote:
  here is an update for the init scripts for KVM guestsI've wrote for
  starting and stopping the KVM guest machines either by saving and
  restoring or by gracefully shutdown and start. My question, is there an
  option within libvirt to make the KVM guest mashines get saved when
  the KVM host shuts down? I had problems to gracefully shutdown Windows
  VM's!!!

   I sent my (and also your) script to libvir-list, but no response yet.
 There are also some suggestions, how libvirt can handle graceful shutdown
 and leave ability to restart libvirt without touching guests.
 
   I use my script to also shutdown windows guests. It's working well, if you
 configure to shutdown windows on acpi event (virtual power button pressed).
 I am not an expert for windows and I can't tell you more, but I am sure,
 that you can find more with google. :-)

Forgot to attach mail archive URL:
  http://www.mail-archive.com/libvir-l...@redhat.com/msg14754.html

SAL
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: qemu-kvm process is running at 100% CPU, but no response from guest

2009-07-15 Thread SAL
On Wed, Jul 15, 2009 at 12:51:33PM +0530, Amit Shah wrote:
 On (Thu) Jul 09 2009 [07:18:54], Ján ONDREJ (SAL) wrote:
PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND
 
  17110 root  20   0 4417m 3.9g 1464 S 201.3 50.9   1326:34 qemu-kvm
   9886 root  20   0 2519m 1.9g 1376 S  1.7 25.1  72:40.73 qemu-kvm
 
 What's the command line you used to start the guests?

Guest was started using libvirt.

Looks that problem is somewhere in bounce code, more info in another thread:
  http://marc.info/?l=kvmm=124756938002626w=2
My CPU usage is growing after kernel panic. With panic=60 my guest is
restarted and runs some time again.

I am now experiencing with IDE dirves instead of virtio, so I can't send you
qemu-kvm original command line. With IDE drives there was no problem
tonight.

Thank you.

SAL
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Kernel oops for virtio_blk: [c048a9f8] __bounce_end_io_read+0x88/0xf8

2009-07-14 Thread SAL
Hello,

  one of my server has multiple oopses for virtio_blk devices. Is this a bug
of virtio_blk driver, or something else? Can it be fixed?
These virtual machines hangs aprox. once per day, mostly at midnight.

  Here is one oops:

BUG: unable to handle kernel paging request at fff82000
IP: [c048a9f8] __bounce_end_io_read+0x88/0xf8
Oops: 0002 [#1] SMP
Modules linked in: ipv6 nf_conntrack_netbios_ns virtio_balloon floppy
virtio_net pcspkr joydev i2c_piix4 i2c_core virtio_pci virtio_ring
virtio_blk virtio [last unloaded: scsi_wait_scan]

Pid: 27956, comm: httpd Not tainted (2.6.27.25-170.2.72.fc10.i686.PAE #1)
EIP: 0060:[c048a9f8] EFLAGS: 00210086 CPU: 2
EIP is at __bounce_end_io_read+0x88/0xf8
EAX: fff82000 EBX: e936ae00 ECX: 0400 EDX: 1000
ESI: ea808000 EDI: fff82000 EBP: c08c5f00 ESP: c08c5edc
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process httpd (pid: 27956, ti=c08c5000 task=e994 task.ti=e9571000)
Stack:  f1114340 d134ef80 d134ea00  00200086 c048aa7a 1000
    c08c5f08 c048aa8a c08c5f14 c04b8474 d134ef80 c08c5f28 c05149a8
   d134ef80 1000 ea5d1450 c08c5f60 c0514b22   007310b8
Call Trace:
 [c048aa7a] ? bounce_end_io_read+0x0/0x12
 [c048aa8a] ? bounce_end_io_read+0x10/0x12
 [c04b8474] ? bio_endio+0x2b/0x2e
 [c05149a8] ? req_bio_endio+0x84/0xa1
 [c0514b22] ? __end_that_request_first+0x15d/0x257
 [c05155ef] ? __blk_end_request+0x19/0x3b
 [c051566a] ? end_dequeued_request+0x32/0x35
 [f881d602] ? blk_done+0x3d/0x7b [virtio_blk]
 [f8821216] ? vring_interrupt+0x24/0x2e [virtio_ring]
 [f8824359] ? vp_interrupt+0x65/0x98 [virtio_pci]
 [c046a2cf] ? handle_IRQ_event+0x2f/0x64
 [c046b338] ? handle_fasteoi_irq+0x85/0xc0
 [c046b2b3] ? handle_fasteoi_irq+0x0/0xc0
 [c040af0a] ? do_IRQ+0xc7/0xfe
 [c0409668] ? common_interrupt+0x28/0x30
 [c042007b] ? native_flush_tlb_global+0x3a/0x48
 [c04200b1] ? paravirt_leave_lazy+0x20/0x21
 [c041f67b] ? kvm_leave_lazy_mmu+0x68/0x7d
 [c04820a0] ? unmap_vmas+0x4d5/0x644
 [c0485cef] ? vma_link+0x71/0x7d
 [c04856cf] ? unmap_region+0x7d/0xe4
 [c04864ba] ? do_munmap+0x193/0x1e6
 [c048653d] ? sys_munmap+0x30/0x3f
 [c0408c8a] ? syscall_call+0x7/0xb
 ===

I am trying to understand, where there are two call for bounce_end_io_read,
but no ideas yet. Source code for this function is:

static void bounce_end_io_read(struct bio *bio, int err)
{
__bounce_end_io_read(bio, page_pool, err);
}

How it's possible, that there is an recursive call for this function?

Host is running an updated Fedora 11, guest is an updated Fedora 10.
Fails with kernel 2.6.27 and 2.6.29 too (from fedora-updates-testing).

More in Red Hat bugzilla:
  https://bugzilla.redhat.com/show_bug.cgi?id=510304

Thank you.

SAL
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


qemu-kvm process is running at 100% CPU, but no response from guest

2009-07-08 Thread SAL
Hello,

  today I have second incident, that my qemu-kvm process is running at 100%
or 200% CPU (watched using top program), but there is no response from guest
long time (some hours). First time lots of these messages appeared in dmesg:

vcpu not ready for apic_round_robin
vcpu not ready for apic_round_robin
vcpu not ready for apic_round_robin

Second time nothing, only process was run at 200% CPU:

top - 06:23:14 up 4 days, 11:06,  1 user,  load average: 2.26, 2.15, 2.18
Tasks: 126 total,   1 running, 125 sleeping,   0 stopped,   0 zombie
Cpu(s): 50.2%us,  0.4%sy,  0.0%ni, 49.1%id,  0.2%wa,  0.0%hi,  0.1%si,
0.0%st
Mem:   8047368k total,  8004516k used,42852k free,  1507160k buffers
Swap:  8388600k total,57284k used,  8331316k free,79700k cached

  PID USER  PR  NI  VIRT  RES  SHR S %CPU %MEMTIME+  COMMAND   
17110 root  20   0 4417m 3.9g 1464 S 201.3 50.9   1326:34 qemu-kvm
 9886 root  20   0 2519m 1.9g 1376 S  1.7 25.1  72:40.73 qemu-kvm

Serial console without response too in boch cases, no ping to guest.

My current configuration is an fully updated Fedora 11 host and updated
Fedora 10 guest. KVM is from package qemu-kvm-0.10.5-3.fc11.x86_64.

I have no cpufreq or cpuspeed installed on my system, so there is no cpu
frequency scaling.

Other 2 similar host installations have no similar problems.

Thank you for help.

SAL
--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html