sparc/sparc64 status

2014-04-23 Thread Jim
I'm trying to virtualize some physical SPARC Solaris machines (mix of
Solaris 2.6, 8,9 & 10) and am using the latest Qemu 2.0.0 release
(previousl worked with the various rc versions).

With some work, I can *build* a SparcStation5 install of Solaris 2.6
from the install media - provided I use the SS5 ROM - but that seems to
be about the limit of what is achievable.

Solaris > 2.6 seems to fail with a variety of errors and crashes. 
Solaris 8 looked good with cg3 but the Java install crashes with an
internal hotspot error in the java virtual machine so never starts the
real install.

Using the Sparc64 to try and install Solaris 10 (or other versions) just
crashes either Qemu itself or in the Solaris boot.  I've tried changing
the CPU selection but that seems to cause the switch between Qemu or
Solaris crashing so it all looks pretty bad.

Lots of searching suggests some people have something working but I've
not found any magic formula or incantation of qemu which works for me.

Can someone point me where I should look ? (the qemu documentation does
not seem to cover Sparc since this is a much rarer case than the
mainstream x86 emulation most people do)

Happy to hear from Qemu-Sparc experts by e-mail too.  I have some
resources available for testing - hopefully if I get this running I can
document it for other people to follow too.

Thanks
Jim


--
All e-mail and telephone communications are subject to Suresafe Terms
And Conditions and may be monitored, recorded and processed for the
purposes contained therein and adherence to regulatory and legal
requirements.

Your further communication or reply to this e-mail indicates your
acceptance of this.

Any views or opinions expressed are the responsibility of the author
and may not reflect those of Suresafe Protection Limited.

Suresafe Protection Limited is registered in Scotland, number SC132827
The registered office is at 8 Kelvin Road, Cumbernauld, G67 2BA.
Telephone: 01236 727792Fax: 01236 723301   VAT Number: 556 6950 02

--
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


Nested Virtualization Of Hyper-V 2K8R2

2011-10-18 Thread Jim

Hi,

I've worked with KVM for quite a while now but have come across a 
problem when trying to run some W2K8R2 VMs where I want to also run 
Hyper-V on those VMs - nested virtualization.


I've researched and checked the obvious AMD processor with the enable 
nested flag, running a kvm guest with the nesting support enabled etc. 
which did allow me to add the Hyper-V role to the VM but when it 
reboots, the machine hardware lists a problem with the VM machine bus 
and no hyper-v VMs can be created.


From what I've read through from lurking on the list and reading the 
archives, I'm not sure whether the problem is that KVM is not ready to 
support Hyper-V yet or if I'm doing it wrong.


I'd be very thankful if someone could say if I'm hoping for too much 
right now or point me where to go to find some details on what I'm  
doing wrong and how to do it right.


Thanks
Jim


--
All e-mail and telephone communications are subject to Suresafe Terms
And Conditions and may be monitored, recorded and processed for the
purposes contained therein and adherence to regulatory and legal
requirements.

Your further communication or reply to this e-mail indicates your
acceptance of this.

Any views or opinions expressed are the responsibility of the author
and may not reflect those of Suresafe Protection Limited.

Suresafe Protection Limited is registered in Scotland, number SC132827
The registered office is at 8 Kelvin Road, Cumbernauld, G67 2BA.
Telephone: 01236 727792Fax: 01236 723301   VAT Number: 556 6950 02


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
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: Nested Virtualization Of Hyper-V 2K8R2

2011-10-18 Thread Jim

Hi Avi,

There are 2 errors listed on the device manager.

1. Virtual Machine Bus : Windows cannot load the device driver for this 
hardware.  The driver may be corrupted or missing (Code 39)


Driver details are listed as version 6.1.7601.17617, date 6/21/2006 
signed by Microsoft


2. Virtualization Infrastructure Driver : Windows cannot load the device 
driver for this hardware.  The driver may be corrupted or missing (Code 39)


Driver details are listed as version 6.1.7601.17514, date 6/21/2006 
signed by Microsoft


Jim


On 18/10/2011 12:43, Avi Kivity wrote:

On 10/18/2011 01:34 PM, Jim wrote:

Hi,

I've worked with KVM for quite a while now but have come across a
problem when trying to run some W2K8R2 VMs where I want to also run
Hyper-V on those VMs - nested virtualization.

I've researched and checked the obvious AMD processor with the enable
nested flag, running a kvm guest with the nesting support enabled etc.
which did allow me to add the Hyper-V role to the VM but when it
reboots, the machine hardware lists a problem with the VM machine bus
and no hyper-v VMs can be created.

What's the error message?


 From what I've read through from lurking on the list and reading the
archives, I'm not sure whether the problem is that KVM is not ready to
support Hyper-V yet or if I'm doing it wrong.

I'd be very thankful if someone could say if I'm hoping for too much
right now or point me where to go to find some details on what I'm
doing wrong and how to do it right.

It's likely a kvm bug.




--
All e-mail and telephone communications are subject to Suresafe Terms
And Conditions and may be monitored, recorded and processed for the
purposes contained therein and adherence to regulatory and legal
requirements.

Your further communication or reply to this e-mail indicates your
acceptance of this.

Any views or opinions expressed are the responsibility of the author
and may not reflect those of Suresafe Protection Limited.

Suresafe Protection Limited is registered in Scotland, number SC132827
The registered office is at 8 Kelvin Road, Cumbernauld, G67 2BA.
Telephone: 01236 727792Fax: 01236 723301   VAT Number: 556 6950 02


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
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: Nested Virtualization Of Hyper-V 2K8R2

2011-10-18 Thread Jim


OK, this sounds like I am doing it wrong then.

The system is a Quad-Core AMD Opteron(tm) Processor 1354 running Ubuntu 
11.04 server with kernel 2.6.38.


The KVM starts with -enable-nesting and a ps of the running process 
shows this is set.  The Hyper-V role would not install until the 
-enable-nesting was appended to the command line, so I was using this as 
the confirmation nested virtualization was active.


I have tried the VM with 1 vcpu and with 2 vcpu and also with the -no 
options from http://www.linux-kvm.org/page/Bugs.


Is this the Ubuntu version of KVM is too old for what I am trying to do ?

Jim



On 18/10/2011 16:46, Avi Kivity wrote:

On 10/18/2011 04:57 PM, Brian Kelly wrote:

 From msft - hyperv cpu requirements:
*Processor *: x64 compatible processor with Intel VT or AMD-V
technology enabled.
Hardware Data Execution Prevention (DEP), specifically Intel XD bit
(execute disable bit) or AMD NX bit (no execute bit), must be
available and enabled.

Are these enabled for guests when -enable-nesting is used?


Yes.


On Tue, Oct 18, 2011 at 9:22 AM, Avi Kivitymailto:a...@redhat.com>>  wrote:

 On 10/18/2011 02:00 PM, Jim wrote:
 >  Hi Avi,
 >
 >  There are 2 errors listed on the device manager.
 >
 >  1. Virtual Machine Bus : Windows cannot load the device driver for
 >  this hardware.  The driver may be corrupted or missing (Code 39)
 >
 >  Driver details are listed as version 6.1.7601.17617, date 6/21/2006
 >  signed by Microsoft
 >
 >  2. Virtualization Infrastructure Driver : Windows cannot load the
 >  device driver for this hardware.  The driver may be corrupted or
 >  missing (Code 39)
 >
 >  Driver details are listed as version 6.1.7601.17514, date 6/21/2006
 >  signed by Microsoft

 Well, no idea.  It will have to wait until someone takes the time to
 debug it.

 --
 error compiling committee.c: too many arguments to function

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




--
Email:  kelly.bri...@gmail.com<mailto:kelly.bri...@gmail.com>
Voice:  (908) 514-8478
Fax:  (201) 221-8269




--
All e-mail and telephone communications are subject to Suresafe Terms
And Conditions and may be monitored, recorded and processed for the
purposes contained therein and adherence to regulatory and legal
requirements.

Your further communication or reply to this e-mail indicates your
acceptance of this.

Any views or opinions expressed are the responsibility of the author
and may not reflect those of Suresafe Protection Limited.

Suresafe Protection Limited is registered in Scotland, number SC132827
The registered office is at 8 Kelvin Road, Cumbernauld, G67 2BA.
Telephone: 01236 727792Fax: 01236 723301   VAT Number: 556 6950 02


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
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: Nested Virtualization Of Hyper-V 2K8R2

2011-10-18 Thread Jim

Hi Joerg,

Sure, the KVM command is :

/usr/bin/kvm -enable-nesting -no-kvm-irqchip -S -M pc-0.14 -enable-kvm 
-m 2048 -smp 2,sockets=2,cores=1,threads=1 -name hyperv1 -uuid 
8c5d8f1f-5767-b388-d408-1b53a1b66e72 -nodefconfig -nodefaults -chardev 
socket,id=charmonitor,path=/var/lib/libvirt/qemu/hyperv1.monitor,server,nowait 
-mon chardev=charmonitor,id=monitor,mode=readline -rtc base=localtime 
-no-reboot -boot d -drive 
file=/srv/hyperv/hyperv1.vmimg,if=none,id=drive-ide0-0-0,format=raw 
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0 
-drive 
file=/srv/virtual-machines/fromiscsi/iso/W2K8ENTR2SP1.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw 
-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0 
-drive 
file=/srv/virtual-machines/fromiscsi/iso/virtio-win-1.1.16.iso,if=none,media=cdrom,id=drive-ide0-1-1,readonly=on,format=raw 
-device ide-drive,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1 
-netdev tap,fd=17,id=hostnet0 -device 
rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:2a:be:2f,bus=pci.0,addr=0x3 
-chardev pty,id=charserial0 -device 
isa-serial,chardev=charserial0,id=serial0 -usb -device 
usb-tablet,id=input0 -vnc 127.0.0.1:0 -vga std -device 
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4


This is started via virsh.

Jim


On 18/10/2011 17:34, Joerg Roedel wrote:

Hi Jim,

On Tue, Oct 18, 2011 at 12:34:23PM +0100, Jim wrote:

I've worked with KVM for quite a while now but have come across a
problem when trying to run some W2K8R2 VMs where I want to also run
Hyper-V on those VMs - nested virtualization.

I've researched and checked the obvious AMD processor with the enable
nested flag, running a kvm guest with the nesting support enabled etc.
which did allow me to add the Hyper-V role to the VM but when it
reboots, the machine hardware lists a problem with the VM machine bus
and no hyper-v VMs can be created.

Can you share the qemu command line you used to start the VM?


 From what I've read through from lurking on the list and reading the
archives, I'm not sure whether the problem is that KVM is not ready to
support Hyper-V yet or if I'm doing it wrong.

I'd be very thankful if someone could say if I'm hoping for too much
right now or point me where to go to find some details on what I'm
doing wrong and how to do it right.

I also had issues with Hyper-V. But at least the root-domain should boot
up without problems. I also started a Linux guest inside but that got
stuck at some point in the kernel boot process. I havn't debugged that
further yet, though.


Joerg




--
All e-mail and telephone communications are subject to Suresafe Terms
And Conditions and may be monitored, recorded and processed for the
purposes contained therein and adherence to regulatory and legal
requirements.

Your further communication or reply to this e-mail indicates your
acceptance of this.

Any views or opinions expressed are the responsibility of the author
and may not reflect those of Suresafe Protection Limited.

Suresafe Protection Limited is registered in Scotland, number SC132827
The registered office is at 8 Kelvin Road, Cumbernauld, G67 2BA.
Telephone: 01236 727792Fax: 01236 723301   VAT Number: 556 6950 02


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
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: Nested Virtualization Of Hyper-V 2K8R2

2011-10-19 Thread Jim



On 19/10/2011 16:06, Jim wrote:

Hi Joerg,

I added the -cpu phenom,-hv but it made no difference.  I then tried 
to call it from the command line (rather then via virsh) and get this :


# /usr/bin/kvm -cpu phenom,-hv
*CPU feature hv not found*


I played around a little and found 'svm' seemed to be a supported cpu 
flag but both +svm and -svm made no difference either.  Alas kvm -cpu 
? only listed CPUs and not the options the various ones support.


Am I on too low a version of kvm perhaps ?  This is an Ubuntu 11.04 
server system and I've just used the Ubuntu packages - I did not build 
kvm myself.


Thanks
Jim

My CPU reports as :

*processor: 0-3  i.e. 4 cores*
vendor_id: AuthenticAMD
cpu family: 16
model: 2
model name: Quad-Core AMD Opteron(tm) Processor 1354
stepping: 3
cpu MHz: 1100.000
cache size: 512 KB
physical id: 0
siblings: 4
core id: 3
cpu cores: 4
apicid: 3
initial apicid: 3
fpu: yes
fpu_exception: yes
cpuid level: 5
wp: yes
flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext 
fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl 
nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy svm 
extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs npt 
lbrv svm_lock

bogomips: 4400.04
TLB size: 1024 4K pages
clflush size: 64
cache_alignment: 64
address sizes: 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate



On 19/10/2011 15:19, Joerg Roedel wrote:

Hi Jim,

On Tue, Oct 18, 2011 at 07:28:52PM +0100, Jim wrote:

Sure, the KVM command is :

/usr/bin/kvm -enable-nesting -no-kvm-irqchip -S -M pc-0.14 -enable-kvm
-m 2048 -smp 2,sockets=2,cores=1,threads=1 -name hyperv1 -uuid
8c5d8f1f-5767-b388-d408-1b53a1b66e72 -nodefconfig -nodefaults -chardev
socket,id=charmonitor,path=/var/lib/libvirt/qemu/hyperv1.monitor,server,nowait
-mon chardev=charmonitor,id=monitor,mode=readline -rtc base=localtime
-no-reboot -boot d -drive
file=/srv/hyperv/hyperv1.vmimg,if=none,id=drive-ide0-0-0,format=raw
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0
-drive
file=/srv/virtual-machines/fromiscsi/iso/W2K8ENTR2SP1.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw
-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
-drive
file=/srv/virtual-machines/fromiscsi/iso/virtio-win-1.1.16.iso,if=none,media=cdrom,id=drive-ide0-1-1,readonly=on,format=raw
-device ide-drive,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1
-netdev tap,fd=17,id=hostnet0 -device
rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:2a:be:2f,bus=pci.0,addr=0x3
-chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -usb -device
usb-tablet,id=input0 -vnc 127.0.0.1:0 -vga std -device
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4

This is missing a -cpu parameter. Please try again with adding
'-cpu phenom,-hv'. This is the combination I used during testing and
development.


Joerg

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message tomajord...@vger.kernel.org
More majordomo info athttp://vger.kernel.org/majordomo-info.html



--
All e-mail and telephone communications are subject to Suresafe Terms
And Conditions and may be monitored, recorded and processed for the
purposes contained therein and adherence to regulatory and legal
requirements.

Your further communication or reply to this e-mail indicates your
acceptance of this.

Any views or opinions expressed are the responsibility of the author
and may not reflect those of Suresafe Protection Limited.

Suresafe Protection Limited is registered in Scotland, number SC132827
The registered office is at 8 Kelvin Road, Cumbernauld, G67 2BA.
Telephone: 01236 727792Fax: 01236 723301   VAT Number: 556 6950 02


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
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: Nested Virtualization Of Hyper-V 2K8R2

2011-10-24 Thread Jim

Hi

Anyone got any further ideas on how I get the Hyper-V guest to work ?  
My kvm is 0.14 (Ubuntu 11.04 Server) - is this just too old ?


Jim


On 19/10/2011 16:07, Jim wrote:



On 19/10/2011 16:06, Jim wrote:

Hi Joerg,

I added the -cpu phenom,-hv but it made no difference.  I then tried 
to call it from the command line (rather then via virsh) and get this :


# /usr/bin/kvm -cpu phenom,-hv
*CPU feature hv not found*


I played around a little and found 'svm' seemed to be a supported cpu 
flag but both +svm and -svm made no difference either.  Alas kvm -cpu 
? only listed CPUs and not the options the various ones support.


Am I on too low a version of kvm perhaps ?  This is an Ubuntu 11.04 
server system and I've just used the Ubuntu packages - I did not 
build kvm myself.


Thanks
Jim

My CPU reports as :

*processor: 0-3  i.e. 4 cores*
vendor_id: AuthenticAMD
cpu family: 16
model: 2
model name: Quad-Core AMD Opteron(tm) Processor 1354
stepping: 3
cpu MHz: 1100.000
cache size: 512 KB
physical id: 0
siblings: 4
core id: 3
cpu cores: 4
apicid: 3
initial apicid: 3
fpu: yes
fpu_exception: yes
cpuid level: 5
wp: yes
flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge 
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext 
fxsr_opt pdpe1gb rdtscp lm 3dnowext 3dnow constant_tsc rep_good nopl 
nonstop_tsc extd_apicid pni monitor cx16 popcnt lahf_lm cmp_legacy 
svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs 
npt lbrv svm_lock

bogomips: 4400.04
TLB size: 1024 4K pages
clflush size: 64
cache_alignment: 64
address sizes: 48 bits physical, 48 bits virtual
power management: ts ttp tm stc 100mhzsteps hwpstate



On 19/10/2011 15:19, Joerg Roedel wrote:

Hi Jim,

On Tue, Oct 18, 2011 at 07:28:52PM +0100, Jim wrote:

Sure, the KVM command is :

/usr/bin/kvm -enable-nesting -no-kvm-irqchip -S -M pc-0.14 -enable-kvm
-m 2048 -smp 2,sockets=2,cores=1,threads=1 -name hyperv1 -uuid
8c5d8f1f-5767-b388-d408-1b53a1b66e72 -nodefconfig -nodefaults -chardev
socket,id=charmonitor,path=/var/lib/libvirt/qemu/hyperv1.monitor,server,nowait 


-mon chardev=charmonitor,id=monitor,mode=readline -rtc base=localtime
-no-reboot -boot d -drive
file=/srv/hyperv/hyperv1.vmimg,if=none,id=drive-ide0-0-0,format=raw
-device ide-drive,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0
-drive
file=/srv/virtual-machines/fromiscsi/iso/W2K8ENTR2SP1.iso,if=none,media=cdrom,id=drive-ide0-1-0,readonly=on,format=raw 


-device ide-drive,bus=ide.1,unit=0,drive=drive-ide0-1-0,id=ide0-1-0
-drive
file=/srv/virtual-machines/fromiscsi/iso/virtio-win-1.1.16.iso,if=none,media=cdrom,id=drive-ide0-1-1,readonly=on,format=raw 


-device ide-drive,bus=ide.1,unit=1,drive=drive-ide0-1-1,id=ide0-1-1
-netdev tap,fd=17,id=hostnet0 -device
rtl8139,netdev=hostnet0,id=net0,mac=52:54:00:2a:be:2f,bus=pci.0,addr=0x3 


-chardev pty,id=charserial0 -device
isa-serial,chardev=charserial0,id=serial0 -usb -device
usb-tablet,id=input0 -vnc 127.0.0.1:0 -vga std -device
virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x4

This is missing a -cpu parameter. Please try again with adding
'-cpu phenom,-hv'. This is the combination I used during testing and
development.


Joerg

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message tomajord...@vger.kernel.org
More majordomo info athttp://vger.kernel.org/majordomo-info.html



--
All e-mail and telephone communications are subject to Suresafe Terms
And Conditions and may be monitored, recorded and processed for the
purposes contained therein and adherence to regulatory and legal
requirements.

Your further communication or reply to this e-mail indicates your
acceptance of this.

Any views or opinions expressed are the responsibility of the author
and may not reflect those of Suresafe Protection Limited.

Suresafe Protection Limited is registered in Scotland, number SC132827
The registered office is at 8 Kelvin Road, Cumbernauld, G67 2BA.
Telephone: 01236 727792Fax: 01236 723301   VAT Number: 556 6950 02


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
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: Live Migration, DRBD

2008-07-24 Thread Jim
Kent Borg  borg.org> writes:

> 
> I am very happy to discover that KVM does live migration.  Now I am
> figuring out whether it will work for me. 
> 
> What I have in mind is to use DRBD for the file system image.  The
> problem is that during the migration I want to shift the file system
> access at the moment when the VM has quit running on the host it is
> leaving but before it starts running on the host where it is arriving. 
> Is there a hook to let me do stuff at this point?
> 
> This is what I want to do:
> 
> On the departing machine...
> 
>   - VM has stopped here
>   - umount the volume with the VM file system image
>   - mark volume in DRDB as secondary
> 
> On the arriving machine...
> 
>   - mark volume in DRBD as primary
>   - mount the volume with the VM file system image
>   - VM can now start here
> 

Yes, there is a way, but first your setup is a little strange. Why do you
take a device (the DRBD) then put a file system on it which just contains a
file with the system image? Why not use the DRBD device directly as your system
disk?

e.g. qemu-system-86_64 -hda /dev/drbdX

This way you do not get an extra layer of filesystem slowing things down
and taking up space, the whole of the DRBD device is directly accessible to
the guest.

Most importantly it saves the mount/umount steps in your above procedures.

When using DRBD devices directly live migration simply requires that the
device is accessible on both nodes at the same time. In other words live
migration assumes a shared device, which you have. The only problem is that
it needs to be opened read/write on both nodes at the same time, which means
you need to go Primary/Primary.

The recent DRBD versions support Primary/Primary, you just need to add
"net { allow-two-primaries; }"
to the resource section in drbd.conf

With that done you can go to the target node, make the device primary there
too, start up qemu to accept the incoming migration and migrate from the
source node.

Afterwards it is advisable to set the source node to secondary.

This procedure is safe, as apparently qemu won't start accessing the target
device until the source has been finished with and flushed. I have tested
the procedure and it worked very well.

Hope that helps,

Jim

P.S. I'm not subscribed to this list so please email me directly if you
need to.


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


randconfig build error with next-20150209, in arch/x86/kvm/vmx.c

2015-02-09 Thread Jim Davis
Building with the attached random configuration file,

arch/x86/kvm/vmx.c: In function ‘vmx_deliver_nested_posted_interrupt’:
arch/x86/kvm/vmx.c:4378:4: error: ‘apic’ undeclared (first use in this function)
apic->send_IPI_mask(get_cpu_mask(vcpu->cpu),
^
arch/x86/kvm/vmx.c:4378:4: note: each undeclared identifier is
reported only once for each function it appears in
  CC  kernel/locking/mutex.o
make[2]: *** [arch/x86/kvm/vmx.o] Error 1
#
# Automatically generated file; DO NOT EDIT.
# Linux/x86 3.19.0-rc7 Kernel Configuration
#
CONFIG_64BIT=y
CONFIG_X86_64=y
CONFIG_X86=y
CONFIG_INSTRUCTION_DECODER=y
CONFIG_OUTPUT_FORMAT="elf64-x86-64"
CONFIG_ARCH_DEFCONFIG="arch/x86/configs/x86_64_defconfig"
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_MMU=y
CONFIG_NEED_DMA_MAP_STATE=y
CONFIG_NEED_SG_DMA_LENGTH=y
CONFIG_GENERIC_ISA_DMA=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_ARCH_MAY_HAVE_PC_FDC=y
CONFIG_RWSEM_XCHGADD_ALGORITHM=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_ARCH_HAS_CPU_RELAX=y
CONFIG_ARCH_HAS_CACHE_LINE_SIZE=y
CONFIG_HAVE_SETUP_PER_CPU_AREA=y
CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK=y
CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
CONFIG_ARCH_HIBERNATION_POSSIBLE=y
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_ARCH_WANT_HUGE_PMD_SHARE=y
CONFIG_ARCH_WANT_GENERAL_HUGETLB=y
CONFIG_ZONE_DMA32=y
CONFIG_AUDIT_ARCH=y
CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING=y
CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
CONFIG_ARCH_HWEIGHT_CFLAGS="-fcall-saved-rdi -fcall-saved-rsi -fcall-saved-rdx 
-fcall-saved-rcx -fcall-saved-r8 -fcall-saved-r9 -fcall-saved-r10 
-fcall-saved-r11"
CONFIG_ARCH_SUPPORTS_UPROBES=y
CONFIG_FIX_EARLYCON_MEM=y
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_IRQ_WORK=y
CONFIG_BUILDTIME_EXTABLE_SORT=y

#
# General setup
#
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_CROSS_COMPILE=""
# CONFIG_COMPILE_TEST is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_BZIP2=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_HAVE_KERNEL_LZ4=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_XZ is not set
# CONFIG_KERNEL_LZO is not set
# CONFIG_KERNEL_LZ4 is not set
CONFIG_DEFAULT_HOSTNAME="(none)"
CONFIG_SWAP=y
# CONFIG_SYSVIPC is not set
# CONFIG_POSIX_MQUEUE is not set
CONFIG_CROSS_MEMORY_ATTACH=y
CONFIG_FHANDLE=y
CONFIG_USELIB=y
# CONFIG_AUDIT is not set
CONFIG_HAVE_ARCH_AUDITSYSCALL=y

#
# IRQ subsystem
#
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_GENERIC_IRQ_SHOW=y
CONFIG_GENERIC_IRQ_LEGACY_ALLOC_HWIRQ=y
CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_DOMAIN_DEBUG=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_SPARSE_IRQ=y
CONFIG_CLOCKSOURCE_WATCHDOG=y
CONFIG_ARCH_CLOCKSOURCE_DATA=y
CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE=y
CONFIG_GENERIC_TIME_VSYSCALL=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_GENERIC_CLOCKEVENTS_BROADCAST=y
CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST=y
CONFIG_GENERIC_CMOS_UPDATE=y

#
# Timers subsystem
#
CONFIG_TICK_ONESHOT=y
CONFIG_HZ_PERIODIC=y
# CONFIG_NO_HZ_IDLE is not set
# CONFIG_NO_HZ is not set
CONFIG_HIGH_RES_TIMERS=y

#
# CPU/Task time and stats accounting
#
CONFIG_TICK_CPU_ACCOUNTING=y
# CONFIG_VIRT_CPU_ACCOUNTING_GEN is not set
# CONFIG_IRQ_TIME_ACCOUNTING is not set
CONFIG_BSD_PROCESS_ACCT=y
# CONFIG_BSD_PROCESS_ACCT_V3 is not set
CONFIG_TASKSTATS=y
CONFIG_TASK_DELAY_ACCT=y
CONFIG_TASK_XACCT=y
# CONFIG_TASK_IO_ACCOUNTING is not set

#
# RCU Subsystem
#
CONFIG_TINY_RCU=y
CONFIG_SRCU=y
CONFIG_TASKS_RCU=y
# CONFIG_RCU_STALL_COMMON is not set
# CONFIG_TREE_RCU_TRACE is not set
CONFIG_RCU_KTHREAD_PRIO=0
CONFIG_BUILD_BIN2C=y
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=17
CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
CONFIG_ARCH_SUPPORTS_NUMA_BALANCING=y
CONFIG_ARCH_SUPPORTS_INT128=y
CONFIG_CGROUPS=y
# CONFIG_CGROUP_DEBUG is not set
CONFIG_CGROUP_FREEZER=y
# CONFIG_CGROUP_DEVICE is not set
# CONFIG_CPUSETS is not set
# CONFIG_CGROUP_CPUACCT is not set
# CONFIG_MEMCG is not set
# CONFIG_CGROUP_PERF is not set
# CONFIG_CGROUP_SCHED is not set
CONFIG_BLK_CGROUP=y
# CONFIG_DEBUG_BLK_CGROUP is not set
# CONFIG_CHECKPOINT_RESTORE is not set
# CONFIG_NAMESPACES is not set
# CONFIG_SCHED_AUTOGROUP is not set
CONFIG_SYSFS_DEPRECATED=y
# CONFIG_SYSFS_DEPRECATED_V2 is not set
CONFIG_RELAY=y
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
# CONFIG_RD_LZMA is not set
CONFIG_RD_XZ=y
# CONFIG_RD_LZO is not set
# CONFIG_RD_LZ4 is not set
# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
CONFIG_LTO_MENU=y
# CONFIG_LTO_DISABLE is not set
CONFIG_LTO=y
CONFIG_LTO_DEBUG=y
# CONFIG_LTO_CP_CLONE is not set
CONFIG_ANON_INODES=y
CONFIG_HAVE_UID16=y
CONFIG_SYSCTL_EXCEPTION_TRACE=y
CONFIG_HAVE_PCSPKR_PLATFORM=y
CONFIG_BPF=y
CONFIG_EXPERT=y
CONFIG_UID16=y
CONFIG_SGETMASK_SYSCALL=y
CONFIG_SYSFS_SYSCALL=y
CONFIG_KALLSYMS=y
CONFIG_KALLSYMS_ALL=y
CONFIG_PRINTK=y
# CONFIG_BUG is not set
# CONFIG_ELF_CORE is not set
C

randconfig build error with next-20150318, in drivers/vfio/virqfd.c

2015-03-18 Thread Jim Davis
This time, in plain text!

Building with the attached random configuration file,

drivers/vfio/virqfd.c: In function 'vfio_virqfd_enable':
drivers/vfio/virqfd.c:132:2: error: implicit declaration of function
'eventfd_ctx_fileget' [-Werror=implicit-function-declaration]
  ctx = eventfd_ctx_fileget(irqfd.file);
  ^
drivers/vfio/virqfd.c:132:6: warning: assignment makes pointer from
integer without a cast
  ctx = eventfd_ctx_fileget(irqfd.file);
  ^
  CC  drivers/tty/serial/serial_core.o
cc1: some warnings being treated as errors
scripts/Makefile.build:258: recipe for target 'drivers/vfio/virqfd.o' failed
HEAD is now at 78c876aef4f28... Add linux-next specific files for 20150318
  CLEAN   .
  CLEAN   arch/x86/kernel/cpu
  CLEAN   arch/x86/kernel
  CLEAN   arch/x86/purgatory
  CLEAN   arch/x86/realmode/rm
  CLEAN   arch/x86/vdso
  CLEAN   crypto/asymmetric_keys
  CLEAN   kernel/time
  CLEAN   kernel
  CLEAN   usr
  CLEAN   arch/x86/tools
  CLEAN   .tmp_versions
  CLEAN   scripts/basic
  CLEAN   scripts/genksyms
  CLEAN   scripts/kconfig
  CLEAN   scripts/mod
  CLEAN   scripts
  CLEAN   include/config include/generated arch/x86/include/generated
  CLEAN   .version signing_key.priv signing_key.x509 x509.genkey
Removing arch/x86/vdso/vdso-image-64.c
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
scripts/kconfig/conf --randconfig Kconfig
KCONFIG_SEED=0x68B9BF68
#
# configuration written to .config
#
scripts/kconfig/conf --silentoldconfig Kconfig
  SYSTBL  arch/x86/syscalls/../include/generated/asm/syscalls_32.h
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_32.h
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_x32.h
  SYSHDR  arch/x86/syscalls/../include/generated/uapi/asm/unistd_64.h
  HOSTCC  scripts/basic/bin2c
  CHK include/config/kernel.release
  WRAParch/x86/include/generated/asm/early_ioremap.h
  WRAParch/x86/include/generated/asm/dma-contiguous.h
  WRAParch/x86/include/generated/asm/mcs_spinlock.h
  WRAParch/x86/include/generated/asm/clkdev.h
  WRAParch/x86/include/generated/asm/scatterlist.h
  WRAParch/x86/include/generated/asm/cputime.h
  CHK include/generated/uapi/linux/version.h
  UPD include/generated/uapi/linux/version.h
  HOSTCC  scripts/recordmcount
  HOSTCC  scripts/kallsyms
  HOSTCC  scripts/pnmtologo
  HOSTCC  scripts/genksyms/genksyms.o
  CC  scripts/mod/empty.o
  UPD include/config/kernel.release
  HOSTCC  scripts/mod/mk_elfconfig
  CC  scripts/mod/devicetable-offsets.s
  SHIPPED scripts/genksyms/parse.tab.c
  MKELF   scripts/mod/elfconfig.h
  SHIPPED scripts/genksyms/lex.lex.c
  HOSTCC  scripts/mod/modpost.o
  SHIPPED scripts/genksyms/keywords.hash.c
  SHIPPED scripts/genksyms/parse.tab.h
  HOSTCC  scripts/sortextable
  HOSTCC  scripts/genksyms/parse.tab.o
  HOSTCC  scripts/mod/sumversion.o
  HOSTCC  scripts/genksyms/lex.lex.o
  HOSTCC  scripts/asn1_compiler
  GEN scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/genksyms/genksyms
  HOSTLD  scripts/mod/modpost
  HOSTCC  arch/x86/tools/relocs_common.o
  HOSTCC  arch/x86/tools/relocs_64.o
  HOSTCC  arch/x86/tools/relocs_32.o
  CHK include/generated/utsrelease.h
  UPD include/generated/utsrelease.h
  HOSTLD  arch/x86/tools/relocs
  CC  kernel/bounds.s
  GEN include/generated/bounds.h
  CC  arch/x86/kernel/asm-offsets.s
  GEN include/generated/asm-offsets.h
  CALLscripts/checksyscalls.sh
  CHK include/generated/compile.h
  CC  init/main.o
  CC  init/do_mounts.o
  CC  init/initramfs.o
  CC  init/do_mounts_initrd.o
  CC  init/init_task.o
  CC  init/calibrate.o
  UPD include/generated/compile.h
  HOSTCC  usr/gen_init_cpio
  CC  init/version.o
  GEN usr/initramfs_data.cpio.lz4
  CC  arch/x86/kernel/process_32.o
  AS  arch/x86/crypto/aes-i586-asm_32.o
  CC  kernel/fork.o
  CC  kernel/exec_domain.o
  AS  usr/initramfs_data.o
  CC  arch/x86/crypto/aes_glue.o
  CC  arch/x86/mm/init.o
  LD  usr/built-in.o
  CC  arch/x86/mm/init_32.o
  LD  init/mounts.o
  LD  init/built-in.o
  CC  arch/x86/mm/fault.o
  AS  arch/x86/crypto/aesni-intel_asm.o
  CC  mm/filemap.o
  CC  arch/x86/crypto/aesni-intel_glue.o
  CC  arch/x86/kernel/signal.o
  CC  kernel/panic.o
  CC  arch/x86/mm/ioremap.o
  CC  arch/x86/mm/extable.o
  CC  arch/x86/mm/pageattr.o
  CC  arch/x86/crypto/fpu.o
  CC  kernel/cpu.o
  CC  arch/x86/mm/mmap.o
  AS  arch/x86/kernel/entry_32.o
  CC  arch/x86/crypto/crc32c-intel_glue.o
  CC  arch/x86/kernel/traps.o
  CC  arch/x86/mm/pat.o
  CC  arch/x86/mm/pgtable.o
  CC  kernel/exit.o
  CC [M]  arch/x86/crypto/glue_helper.o
  CC  kernel/softirq.o
  CC   

Starting a VM using /dev/kvm

2013-11-19 Thread Jim MacArthur
I'm new to KVM and as a learning exercise I'd like to start a VM and
run a few instructions by using ioctls on /dev/kvm. This might be a
terrible idea, please say so if it is.

I haven't been able to find much information on it, but by reading the
API document and stracing qemu I've put together a small program which
creates a VM, VCPU, and sets up some memory. All of these ioctls
return successfully, but trying to run always returns with exit code
17 and suberror 1 which so far as I can tell seems to be a problem
with page tables. I'm on an x86_64 host.

The question is, how does a new vcpu start up? Will it start in full
64-bit mode or 16-bit real mode? And will I need a full set of
translation tables to run a single instruction or can I just point it
at some memory and expect it to run?

Thanks for any help you can offer.
--
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: Starting a VM using /dev/kvm

2013-11-20 Thread Jim MacArthur
On 20 November 2013 17:28, Paolo Bonzini  wrote:
> Il 20/11/2013 00:56, Jim MacArthur ha scritto:
>> The question is, how does a new vcpu start up? Will it start in full
>> 64-bit mode or 16-bit real mode?
>
> By default it start in 16-bit real mode, with CS=0xf000 and EIP=0xfff0,
> but CS.base = 0x.  However, you can send ioctls to modify
> CR0/CR4/EFER and place the VCPU in whatever mode you'd like to have.

After reading this I added a call to KVM_GET_SREGS. Everything you say
here matches my experience except that CS.base=0xf.
So I adjusted my memory to cover physical address 0x0, and now
it's happily running instructions (NOPs, at least.)
I'm a bit puzzled that it didn't start with CS.base=0x, but it
doesn't matter, I've done what I wanted to do for now.

Thanks very much for your help.
--
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: how to manage KVM guests with libvirt ?

2009-06-01 Thread Jim Paris
Javier Guerra wrote:
> On Mon, Jun 1, 2009 at 11:02 AM, Riccardo Veraldi
>  wrote:
> > thank you very much.
> >
> > How do I know all the XML tag options ??
> >
> > how to convert from comand line quemu options into XML tags ?
> >
> > and here to put XML file ?
> 
> you'll have to play around a little with a test machine before you get
> the hang of it.  the xml options are documented on the libvirt site.
> put them in /etc/libvirt/qemu/blahblahblah.xml, and the libvirtd
> daemon will pick them at startup.

With libvirt 0.6.4, you can use the "virsh domxml-from-native" tool to
convert from QEMU arguments to XML automatically:
  http://libvirt.org/drvqemu.html#xmlimport

> > about the console I used to start qemu-kvm under SCREEN program.
> > is ther another better way to have serial console ?
> 
> for that i don't have any good answer.  it seems libvirt ties the qemu
> monitor with a pipe to its own process, so you don't have manual
> control anymore.
> 
> i'd much prefer if it used a unix socket, so you could open it with
> socat or similar tools.

If by "serial console" you mean an actual emulated serial port, use
the  tag in the XML for this.  You can point it to a socket,
actual device, TCP server, etc.
  http://libvirt.org/formatdomain.html#elementsConsole

If you want access to the Qemu monitor console, Libvirt does not
provide that directly (by design), but it does use Unix sockets to
interact with the monitor, so you could in theory kill Libvirt and
talk to Qemu directly through the monitor socket in /var/run/libvirt/qemu.

-jim
--
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: KVM-86 not exposing 64 bits CPU anymore, NICE

2009-06-04 Thread Jim Paris
Gilles PIETRI wrote:
> Hi,
>
> I'm quite pissed off. I just upgraded to kvm-86 on a host that has  
> worked nicely on kvm-78 for quite some time. But since I was fearing the  
> qcow2 corruption issues, I wanted to upgrade kvm-86. After testing the  
> performance, I decided to switch. How stupid that was. That was really  
> putting too much trust in KVM.
>
> Now I can't have 64 bits CPUs on my guests.
> My host is running a 2.6.27.7 kernel, and is x86_64 enabled.
> Until the upgrade, guests were running x86_64 fine.
> Now, it says long mode can't be used or something like that, and I can  
> only have 32 bits guests.

Please see
  http://www.mail-archive.com/kvm@vger.kernel.org/msg15757.html
  http://www.mail-archive.com/kvm@vger.kernel.org/msg15769.html

-jim
--
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: KVM crashes when using certain USB device

2009-07-03 Thread Jim Paris
G wrote:
> Hello again,
> 
> I've continued my attempts to get the HASP dongle working, but with no 
> success:
> 
> Downloaded kvm-72.tar.gz through kvm-87.tar.gz to find out when the
> problem first appear, as kvm-72 is working. Unfortunately, kvm-72
> through kvm-82 fails to compile on my Debian system with kernel 2.6.30
> and gcc 4.3, and kvm-83 crashes in the same way that kvm-87 crashes.
> 
> I have also tested two other USB devices: a C-Pen (www.cpen.com) and a
> GEM card reader, both successfully. So it seems it is the HASP
> dongle/driver combo which is doing something naughty that makes KVM
> versions newer than kvm-72 crash...
> 
> Anyone got any ideas what I might try out to find the cause for the
> crashes?

You might try uncommenting "//#define DEBUG" at the top of usb-linux.c
to get some more verbose output from qemu.

-jim
--
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: Unable to pass multiple cores / CPUs to guests

2012-01-30 Thread Jim Paris
Binarus wrote:
> Dear all,
> 
> it seems that I am unable to pass multiple cores / CPUs to KVM
> guests. Whatever I do, the guests only report one CPU / core.
...
> /usr/bin/qemu-system-x86_64 -M pc -cpu host -smp cores=2,threads=1,sockets=1 
> -drive file=/dev/sda6,if=virtio,cache=none,index=0 -drive 
> file=/dev/sdb,if=virtio,cache=none,index=1 -cdrom /dev/cdrom -pidfile 
> ./qemu-garak.pid -boot c -k de -m 4096 -smp 1 -device pci-assign,host=01:05.0 
> -daemonize -usb -usbdevice "tablet" -name garak -net 
> nic,vlan=0,model=virtio,macaddr=02:01:01:01:01:01 -net 
> tap,vlan=0,ifname=virtnet1,script=/etc/qemu-ifup,downscript=/etc/qemu-ifup 
> -vnc :1

Remove the "-smp 1".

-jim
--
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


[PATCH 07/22] ppc: avoid buffer overrun: use pstrcpy, not strncpy

2012-05-09 Thread Jim Meyering
From: Jim Meyering 

A terminal NUL is required by caller's use of strchr.
It's better not to use strncpy at all, since there is no need
to zero out hundreds of trailing bytes for each iteration.

Signed-off-by: Jim Meyering 
---
 target-ppc/kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index c09cc39..fb79e9f 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -587,7 +587,7 @@ static int read_cpuinfo(const char *field, char *value, int 
len)
 break;
 }
 if (!strncmp(line, field, field_len)) {
-strncpy(value, line, len);
+pstrcpy(value, len, line);
 ret = 0;
 break;
 }
-- 
1.7.10.1.487.ga3935e6

--
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


[PATCH 07/22] ppc: avoid buffer overrun: use pstrcpy, not strncpy

2012-05-09 Thread Jim Meyering
From: Jim Meyering 

A terminal NUL is required by caller's use of strchr.
It's better not to use strncpy at all, since there is no need
to zero out hundreds of trailing bytes for each iteration.

Signed-off-by: Jim Meyering 
---
 target-ppc/kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index c09cc39..fb79e9f 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -587,7 +587,7 @@ static int read_cpuinfo(const char *field, char *value, int 
len)
 break;
 }
 if (!strncmp(line, field, field_len)) {
-strncpy(value, line, len);
+pstrcpy(value, len, line);
 ret = 0;
 break;
 }
-- 
1.7.10.1.487.ga3935e6

--
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: [F.A.Q.] the advantages of a shared tool/kernel Git repository, tools/perf/ and tools/kvm/

2011-11-09 Thread Jim Paris
Arnaldo Carvalho de Melo wrote:
> Em Wed, Nov 09, 2011 at 11:40:01AM +0100, Gerd Hoffmann escreveu:
> >   Hi,
> > 
> > > What we want to have is to have a set of distinctive colors - just 
> > > two (background, foreground) colors are not enough - we also need 
> > > colors to highlight certain information - we need 5-6 colors for the 
> > > output to be maximally expressive. Is there a canonical way to handle 
> > > that while still adapting to user preferences automatically by taking 
> > > background/foreground color scheme of the xterm into account?
> > 
> > > I suspect to fix the worst of the fallout we could add some logic to 
> > > detect low contrast combinations (too low color distance) and fall 
> > > back to the foreground/background colors in that case.
> > 
> > As far I know it is pretty much impossible to figure the
> > foreground/background colors of the terminal you are running on.  You
> 
> Glad to hear that, I thought I hadn't researched that much (I did). Hope
> somebody appears and tell us how it is done :-)

In xterm, '\e]10;?\e\\' and '\e]11;?\e\\' will report the colors, e.g.:

#!/bin/bash
  read -s -r -d \\ -p `printf '\e]10;?\e\\'` -t 1 fg
  [ $? -ne 0 ] && fg="no response"
  echo "foreground: $fg" | cat -v
  read -s -r -d \\ -p `printf '\e]11;?\e\\'` -t 1 bg
  [ $? -ne 0 ] && bg="no response"
  echo "background: $bg" | cat -v

-jim
--
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: KVM crashes when using certain USB device

2009-07-16 Thread Jim Paris
Hi G,

> >> I've continued my attempts to get the HASP dongle working, but with no 
> >> success:
...
> Good idea. The results from three test runs after that change are in
> the attached files. The third was done while also dumping the USB bus,
> and the output from that dump is also attached.

The gdb output here looks questionable.  Only the second trial seems
to have USB related stuff in the backtrace, so either gdb is wrong or
there's some memory corruption that is causing crashes elsewhere.
Maybe valgrind could help?

You can also add more debugging to the usb code to try to figure out
where things are going wrong.  See the attached patch for some printfs
that might help.

Try again with less memory on the guest, like -m 2048, just to reduce
possible problems with the 32-bit guest and address space.

I didn't see anything obviously wrong with the usbmon dumps you sent,
or the debugging that qemu printed out, but I'm not familiar with this
code.

Even though you're having problems with -no-kvm, I suspect this is an
upstream qemu issue, so you should probably try the qemu list too.

-jim
diff -urN kvm-87/usb-linux.c kvm-87-debug/usb-linux.c
--- kvm-87/usb-linux.c	2009-06-23 09:32:38.0 -0400
+++ kvm-87-debug/usb-linux.c	2009-07-16 03:06:22.0 -0400
@@ -209,16 +209,21 @@
 
 static AsyncURB *async_alloc(void)
 {
-return (AsyncURB *) qemu_mallocz(sizeof(AsyncURB));
+AsyncURB *aurb = (AsyncURB *) qemu_mallocz(sizeof(AsyncURB));
+dprintf("husb: allocated %p\n", aurb);
+return aurb;
 }
 
 static void async_free(AsyncURB *aurb)
 {
+dprintf("husb: freeing %p\n", aurb);
 qemu_free(aurb);
 }
 
 static void async_complete_ctrl(USBHostDevice *s, USBPacket *p)
 {
+dprintf("husb: complete ctrl, host state %d len %d\n", 
+	s->ctrl.state, s->ctrl.len);
 switch(s->ctrl.state) {
 case CTRL_STATE_SETUP:
 if (p->len < s->ctrl.len)
@@ -266,6 +271,7 @@
 aurb, aurb->urb.status, aurb->urb.actual_length);
 
 	if (p) {
+	dprintf("husb: p=%p\n", p);
 switch (aurb->urb.status) {
 case 0:
 p->len = aurb->urb.actual_length;
@@ -280,11 +286,12 @@
 p->len = USB_RET_NAK;
 break;
 }
-
+	dprintf("husb: completing, p->len=%d\n", p->len);
 usb_packet_complete(p);
 	}
 
 async_free(aurb);
+
 }
 }
 


Re: KVM crashes when using certain USB device

2009-07-20 Thread Jim Paris
G wrote:
> I'm not too familiar with valgrind output, I have only used it on
> smaller programs I've written myself, so I don't know what to think of
> the messages (and amount of messages; valgrind told me to use
> --error-limit=no). I do get a bit nervous from all the complaints
> about uninitialized values  and byes, but maybe it's normal for an
> application of kvm's size and type.

I'd be nervous too :)  Many of the complaints look harmless, but it's
probably worth fixing them to make the real bugs stand out more.

> > Even though you're having problems with -no-kvm, I suspect this is an
> > upstream qemu issue, so you should probably try the qemu list too.
> 
> qemu-de...@nongnu.org? I'll try to figure out the -no-kvm issue first,
> so I can run any commands they might want me to run.
> 
> And thanks for your help and suggestions so far, btw.

Here's a patch to try.  I'm not familiar with the code, but it looks
like this buffer might be too small versus the packet lengths that
you're seeing, and similar definitions in hw/usb-uhci.c.

-jim

diff -urN kvm-87-orig/usb-linux.c kvm-87/usb-linux.c
--- kvm-87-orig/usb-linux.c 2009-06-23 09:32:38.0 -0400
+++ kvm-87/usb-linux.c  2009-07-20 19:15:35.0 -0400
@@ -115,7 +115,7 @@
 uint16_t offset;
 uint8_t  state;
 struct   usb_ctrlrequest req;
-uint8_t  buffer[1024];
+uint8_t  buffer[2048];
 };
 
 typedef struct USBHostDevice {
--
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: KVM crashes when using certain USB device

2009-07-21 Thread Jim Paris
G wrote:
> On Tue, Jul 21, 2009 at 1:23 AM, Jim Paris wrote:
> > Here's a patch to try.  I'm not familiar with the code, but it looks
> > like this buffer might be too small versus the packet lengths that
> > you're seeing, and similar definitions in hw/usb-uhci.c.
> >
> > -jim
> >
> > diff -urN kvm-87-orig/usb-linux.c kvm-87/usb-linux.c
> > --- kvm-87-orig/usb-linux.c     2009-06-23 09:32:38.0 -0400
> > +++ kvm-87/usb-linux.c  2009-07-20 19:15:35.0 -0400
> > @@ -115,7 +115,7 @@
> >     uint16_t offset;
> >     uint8_t  state;
> >     struct   usb_ctrlrequest req;
> > -    uint8_t  buffer[1024];
> > +    uint8_t  buffer[2048];
> >  };
> >
> >  typedef struct USBHostDevice {
> 
> Yes! Applying this patch makes the crash go away! Thank you!

Great!

> In addition to enabling DEBUG and applying your debug printout
> patches, I added a debug printout right above the memcpy()s in
> usb-linux.c, and found that the memcpy() in do_token_in() is called
> multiple time (since do_token_in() is called multiple times for the
> 1993 bytes usb packet I have in my usb sniff dumps), which I guess is
> what's causing a buffer overflow as the offset is pushed beyond 1024
> bytes. But I'm not sure.

Yeah, I think that's it.

> I've looked at the code trying to figure out a better way to solve
> this, now that the problem spot has been found. To me it seems that
> malloc()ing and, when the need arises (the large 1993 bytes packets
> I'm seeing), realloc()ing the buffer, instead of using a statically
> sized buffer, would be the best solution.

Dynamically sizing the buffer might get tricky.  It looks like
hw/usb-uhci.c will go up to 2048, while hw/usb-ohci.c and
hw/usb-musb.c could potentially go up to 8192.  I think bumping it to
8192 and adding an error instead of overflowing would be good enough.
I'll try to understand the code a bit more and then spin a patch.

> One could of course redefine all buffers to be 8192 bytes instead,
> but that would just be a false sense of security, and perhaps some
> buffers need to be of a particular size to conform to the USB
> specification...

USB packets don't get that large, but the host controllers can combine
them, from what I understand.  So it's more a question of what the
host controllers can do.

-jim




--
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: How to remove VM (client) with command line ?

2009-07-23 Thread Jim Paris
Stephen Liu wrote:
> 
> Hi folks,
> 
> Debian 5.0
> KVM
> 
> How to remove/delete VM (client) on command line instead of on Virt-manager.
> 
> Ex.
> $ sudo virsh --connect qemu:///system
> 
> virsh # list --all
>  Id Name State
> --
>   - vm10 shut off
>   - vm11 shut off
>   - vm13 shut off
> 
> 
> I expect to remove vm10 and vm11.  The later was cloned on the former.

This is a libvirt question, not a kvm question.  You should use the
libvirt mailing list instead.  Also, check the documentation and the
"help" output, as it is generally good.  To remove a domain
completely, use "undefine".

> Furthermore;
> Do I need uml-utilities ?  What will be its use?

You would use uml-utilities if you were using User Mode Linux.
Again, not KVM related.

-jim
--
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: how to highlight text with mouse

2009-07-23 Thread Jim Paris
Stephen Liu wrote:
> 
> Hi folks,
> 
> Debian 5.0
> KVM
> 
> I need to copy the text on client's (VM) terminal. Please advise how to 
> highlight the text with mouse pointer.

If you are running kvm with a VNC or SDL display, it is a graphical
display and you cannot select text from the host.  You could run gpm
or similar in the guest.  You can also start kvm with -curses which
will display text using curses/ncurses, instead of graphically.

-jim
--
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: Poor network performance with cable modem assigned to guest

2009-08-29 Thread Jim Paris
Jon Fairbairn wrote:
> Brian Jackson  writes:
> 
> > On Friday 28 August 2009 01:14:42 pm Jon Fairbairn wrote:
> >> I'm experimenting with a virtual router. I did this a few years ago with
> >> Xen and it worked well enough, but then fedora changed and it stopped
> >> working, so I gave up for a while. Now I have a machine that supports
> >> hardware virtualisation, I thought I'd try again.
> >>
> >> The setup was done through virt-manager. The network between the host
> >> and guest is a virtual bridge. What I've been trying to do is to assign
> >> a USB cable modem to the guest,
> >
> >
> > This is probably your problem here. KVM only emulates a usb1.1
> > controller,
> 
> that shouldn't be a problem as the cable modem is only a usb 1.1 device.
> 
> > and from all reports, it doesn't really do that very well.
> 
> Not very well? We're talking about a factor of *FIFTY* slow down here.
> If I'd implemented the driver in a 1980s lazy functional language I
> would have only expected a factor of ten :-P ;-).
> 
> > There have been numerous reports of poor performance even for a usb1.1
> > device. You should check the archives to see if there was ever any
> > kind of tips or resolution to some of those problems.
> 
> I had a look, but I couldn't find anything helpful. Maybe I'm searching
> for the wrong things?

I don't have any specific answers, but you might be able to get some
more info by uncomenting the "//#define DEBUG" in kvm's usb-linux.c.
You might also try capturing the USB traffic (e.g. with wireshark)
both in the host with the modem connected directly, and in the
guest with the modem passed through, to see if there are any
differences other than speed (packet sizes, etc).  Also try comparing
the "lsusb -vvv" output in both guest and host?

-jim
--
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: Modifying RAM during runtime on guest

2009-09-28 Thread Jim Paris
Daniel Bareiro wrote:
> Hi Brian.
> 
> On Tuesday, 08 September 2009 16:18:09 -0500,
> Brian Jackson wrote:
> 
> > > I'm trying to modify the amount of RAM that has some of guests. Host
> > > has 2.6.30 kernel with KVM-88.
> > > 
> > > In one of guest I didn't have problems when decreasing the amount of
> > > memory from 3584 MIB to 1024 MiB. This guest has 2.6.26-2-686 stock
> > > kernel. Also I was trying to decrease the amount RAM of another guest
> > > from 3584 MiB to 2048 MiB, but it didn't work. This other guest has
> > > 2.6.24-etchnhalf.1-686-bigmem stock kernel. Does Ballooning in guest
> > > require 2.6.25 or superior?
> 
> > I don't know, if that kernel has a virtio-balloon driver, I'd think that
> > was all you need to balloon memory.
> 
> Then can be that it is related to kernel that is using the guest:
> 
> # uname -a
> Linux aprender01 2.6.24-etchnhalf.1-686-bigmem #1 SMP Mon Jul 27 03:56:49 UTC 
> 2009 i686 GNU/Linux
> 
> # cat config-2.6.24-etchnhalf.1-686-bigmem | grep -i virtio
> #
> 
> > > Thinking that it could be an impediment related to the kernel version
> > > of guest, I tried to increase the memory of another one guest with
> > > 2.6.26-2-686 from 512 MIB to 1024 MIB, but this didn't work either.
> 
> > You can only grow memory up to the amount you specified on the command
> > line if you've already ballooned down.
> 
> Good. Thanks for clarifying to me this detail.
> 
> > So if you specify "-m 1024M" on the command line, then shrink it to 512,
> > you could then balloon it back up to a max of 1024.
> 
> According to the tests that I was doing in guest with kernel with support
> for virtio, shrinking works, but when trying to return to the amount of
> initial memory, seems that it fails and I lose connectivity by serial
> console and ssh.
> 
> In the guest:
> 
> # uname -a
> Linux central 2.6.26-2-amd64 #1 SMP Sun Jul 26 20:35:48 UTC 2009 x86_64 
> GNU/Linux
> 
> # cat config-2.6.26-2-amd64 | grep -i virtio
> CONFIG_NET_9P_VIRTIO=m
> CONFIG_VIRTIO_BLK=m
> CONFIG_VIRTIO_NET=m
> CONFIG_HW_RANDOM_VIRTIO=m
> CONFIG_VIRTIO=m
> CONFIG_VIRTIO_RING=m
> CONFIG_VIRTIO_PCI=m
> CONFIG_VIRTIO_BALLOON=m
> 
> In the host:
> 
> # telnet localhost 4045
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> QEMU 0.10.50 monitor - type 'help' for more information
> (qemu)
> (qemu) info balloon
> balloon: actual=512
> (qemu) balloon 256
> (qemu) info balloon
> balloon: actual=256
> (qemu)
> (qemu) balloon 512
> (qemu) info balloon
> balloon: actual=36
> 
> At this moment I'm unable to connect by serial console to the guest and the
> ssh sessions are freeze nevertheless kvm process of the guest is running.
> Using a VNC client I see several messages of this type in the guest:
> 
> Out of memory: kill process  () score xx or a child
> Killed process  ()
> 
> Finally:
> 
> Kernel panic - not syncing - Out of memory and no killable processes...
> 
> 
> 
> Thanks for your reply.

Hi Daniel,

I noticed no-one answered this, and I just ran into the same thing
myself.  As Avi pointed out earlier, it is a guest bug, and upgrading
the guest to 2.6.27 should fix it:
  http://www.mail-archive.com/kvm@vger.kernel.org/msg10849.html

-jim




--
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: kvm or qemu-kvm?

2009-10-01 Thread Jim Paris
Ross Boylan wrote:
> My distro (Debian) is only at 85, even in unstable.  Since it wasn't
> current, and also the dependencies will have wide effects on my system
> (which I'm trying to keep at the stable release Lenny), I figured
> getting the current source and building it myself would be the best
> move.  For other reasons I'm already running a 2.6.30 kernel from
> Debian, which includes kernel side kvm.  So I figure I only need to mess
> with user space.

That's what I do.  Just as a warning, if you're using the libvirt
packages from Debian unstable, make sure you also install
linux-libc-dev from unstable before building qemu-kvm.

Otherwise, virtio networking will fail.  The reason is that qemu-kvm
will be built against the Lenny linux-libc-dev which does not have
IFF_VNET_HDR, while the libvirt was built against a newer
linux-libc-dev that did define IFF_VNET_HDR.  If they don't agree then
things break.

(just had to track this one down the other day)

-jim
--
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: kvm or qemu-kvm?

2009-10-01 Thread Jim Paris
Avi Kivity wrote:
> On 10/01/2009 08:06 PM, Jim Paris wrote:
>> That's what I do.  Just as a warning, if you're using the libvirt
>> packages from Debian unstable, make sure you also install
>> linux-libc-dev from unstable before building qemu-kvm.
>>
>> Otherwise, virtio networking will fail.  The reason is that qemu-kvm
>> will be built against the Lenny linux-libc-dev which does not have
>> IFF_VNET_HDR, while the libvirt was built against a newer
>> linux-libc-dev that did define IFF_VNET_HDR.  If they don't agree then
>> things break.
>
> Isn't that a libvirt bug?  libvirt shouldn't assume qemu supports  
> IFF_VNET_HDR just because it sees it.

Probably, but I think it has no way of knowing, because qemu doesn't
report whether it supports it.

  
http://libvirt.org/git/?p=libvirt.git;a=commit;h=b4f62abbf1191c8fbab3306b4bf2f2567e18067f

"However, we need to be careful to only set the flag when a) QEMU has
support for this ABI and b) the value of the flag is queryable using
the TUNGETIFF ioctl.

It's nearly five months since kvm-74 - the first KVM release with this
feature - was released. Up until now, we've not added libvirt support
because there is no clean way to detect support for this in QEMU at
runtime. A brief attempt to add a "info capabilities" monitor command
to QEMU floundered. Perfect is the enemy of good enough. Probing the
KVM version will suffice for now."

-jim

--
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: Modifying RAM during runtime on guest

2009-10-07 Thread Jim Paris
Daniel Bareiro wrote:
> Hi, Jim.
> > > I noticed no-one answered this, and I just ran into the same thing
> > > myself. As Avi pointed out earlier, it is a guest bug, and upgrading
> > > the guest to 2.6.27 should fix it:
>  
> > >   http://www.mail-archive.com/kvm@vger.kernel.org/msg10849.html
>  
> > In this moment I doesn't have Internet connectivity in my house, but,
> > as soon as it be possible, I shall download the necessary software to
> > compile 2.6.27 or superior and then I tell you the result of the
> > tests.
> 
> After to have compiled Linux 2.6.30.3 using the Debian way on guest
> Debian GNU/Linux Lenny, when trying to boot the guest with this kernel,
> the bootstrapping is freeze on "Loading, please wait..." message.
> 
> In logs I don't get entries of the bootstrapping process with 2.6.30 (I
> think it is because the process in itself didn't start). Can it be due
> to a bug using 2.6.30.3 in guest with host KVM-88?

2.6.30.3 should work fine, there must be some other problem.  If you
remove "quiet" from the boot command line you should see the kernel
messages which may indicate the problem.  I'd also recommend just
trying a standard prebuilt Debian kernel.
  http://packages.debian.org/squeeze/linux-image-2.6.30-1-amd64

-jim
--
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: PXE Boot Timeout Issue...

2010-04-23 Thread Jim Paris
Stuart Sheldon wrote:
> Stefan Hajnoczi wrote:
> > On Fri, Apr 23, 2010 at 1:45 AM, Stuart Sheldon  wrote:
> >> Just upgraded to 12.3 user space tools from 11.0, and now when I attempt
> >> to netboot a guest, it appears that the pxe rom is timing out on dhcp
> >> before the bridge has enough time to come up.

> 3) after about 15 seconds, tap device enters promiscuous mode on host,
> and at same time, gPXE reports "No bootable device." on guest
...
>  forward delay  15.00 bridge forward delay
>   15.00

I've run into this issue as well and lowering the forwarding delay
with "brctl setfd br0 5" fixes it.

-jim
--
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: repeatable hang with loop mount and heavy IO in guest (now in host - not KVM then..)

2010-05-22 Thread Jim Paris
Antoine Martin wrote:
> On 02/27/2010 12:38 AM, Antoine Martin wrote:
> >>>  1   0   0  98   0   1|   0 0 |  66B  354B|   0 0 |  3011
> >>>  1   1   0  98   0   0|   0 0 |  66B  354B|   0 0 |  2911
> >>>From that point onwards, nothing will happen.
> >>>The host has disk IO to spare... So what is it waiting for??
> >>Moved to an AMD64 host. No effect.
> >>Disabled swap before running the test. No effect.
> >>Moved the guest to a fully up-to-date FC12 server
> >>(2.6.31.6-145.fc12.x86_64), no effect.
> >I have narrowed it down to the guest's filesystem used for backing
> >the disk image which is loop mounted: although it was not
> >completely full (and had enough inodes), freeing some space on it
> >prevents the system from misbehaving.
> >
> >FYI: the disk image was clean and was fscked before each test. kvm
> >had been updated to 0.12.3
> >The weird thing is that the same filesystem works fine (no system
> >hang) if used directly from the host, it is only misbehaving via
> >kvm...
> >
> >So I am not dismissing the possibility that kvm may be at least
> >partly to blame, or that it is exposing a filesystem bug (race?)
> >not normally encountered.
> >(I have backed up the full 32GB virtual disk in case someone
> >suggests further investigation)
> Well, well. I've just hit the exact same bug on another *host* (not
> a guest), running stock Fedora 12.
> So this isn't a kvm bug after all. Definitely a loop+ext(4?) bug.
> Looks like you need a pretty big loop mounted partition to trigger
> it. (bigger than available ram?)
> 
> This is what triggered it on a quad amd system with 8Gb of ram,
> software raid-1 partition:
> mount -o loop 2GB.dd source
> dd if=/dev/zero of=8GB.dd bs=1048576 count=8192
> mkfs.ext4 -f 8GB.dd
> mount -o loop 8GB.dd dest
> rsync -rplogtD source/* dest/
> umount source
> umount dest
> ^ this is where it hangs, I then tried to issue a 'sync' from
> another terminal, which also hung.
> It took more than 10 minutes to settle itself, during that time one
> CPU was stuck in wait state.

This sounds like:
  https://bugzilla.kernel.org/show_bug.cgi?id=15906
  https://bugzilla.redhat.com/show_bug.cgi?id=588930

-jim
--
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


error compiling kvm-72 not there with kvm-69 - link kernel 2.6.26

2008-08-06 Thread jim miro

1st - I don't peruse this mail list

error:
--
make -C kernel
make[1]: Entering directory `/usr/src/kvm-72/kernel'
make -C /lib/modules/2.6.26/build M=`pwd` \
        LINUXINCLUDE="-I`pwd`/include -Iinclude -I`pwd`/include-compat \
        -include include/linux/autoconf.h \
        -include `pwd`/external-module-compat.h"
make[2]: Entering directory `/usr/src/linux-2.6.26'
  LD  /usr/src/kvm-72/kernel/built-in.o
  CC [M]  /usr/src/kvm-72/kernel/svm.o
  CC [M]  /usr/src/kvm-72/kernel/external-module-compat.o
  CC [M]  /usr/src/kvm-72/kernel/vmx.o
  CC [M]  /usr/src/kvm-72/kernel/vmx-debug.o
  CC [M] 
 /usr/src/kvm-72/kernel/kvm_main.o
  CC [M]  /usr/src/kvm-72/kernel/x86.o
  CC [M]  /usr/src/kvm-72/kernel/mmu.o
  CC [M]  /usr/src/kvm-72/kernel/x86_emulate.o
  CC [M]  /usr/src/kvm-72/kernel/anon_inodes.o
/usr/src/kvm-72/kernel/anon_inodes.c: In function ‘kvm_anon_inode_getfd’:
/usr/src/kvm-72/kernel/anon_inodes.c:254: error: too many arguments to function 
‘anon_inode_getfd’
make[3]: *** [/usr/src/kvm-72/kernel/anon_inodes.o] Error 1
make[2]: *** [_module_/usr/src/kvm-72/kernel] Error 2
make[2]: Leaving directory `/usr/src/linux-2.6.26'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/kvm-72/kernel'
make: *** [kernel] Error 2
--
kernel 2.6.26 built from linux.kernel.org image
It currently has kvm-69  external compiled modules made against this source and 
running.
I noted that --enable-alsa was not an option on kvm-72

kvm
 build with ./configure --prefix=/usr --enable-alsa  for kvm-69
for kvm-72 ./configure --prefix=/usr

cat config.mak
ARCH=x86_64
PREFIX=/usr
KERNELDIR=/lib/modules/2.6.26/build
LIBKVM_KERNELDIR=/usr/src/kvm-72/kernel
WANT_MODULE=1
CROSS_COMPILE=
CC=gcc
LD=ld
OBJCOPY=objcopy

OS is debian testing - last updated this date

CPU:
cat /proc/cpuinfo
processor    : 0
vendor_id    : AuthenticAMD
cpu family    : 15
model        : 75
model name    : AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
stepping    : 2
cpu MHz        : 2009.262
cache size    : 512 KB
physical id    : 0
siblings    : 2
core id        : 0
cpu cores    :
 2
apicid        : 0
initial apicid    : 0
fpu        : yes
fpu_exception    : yes
cpuid level    : 1
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 
3dnowext 3dnow rep_good pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
bogomips    : 4021.24
TLB size    : 1024 4K pages
clflush size    : 64
cache_alignment    : 64
address sizes    : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc

processor    : 1
vendor_id    : AuthenticAMD
cpu family    : 15
model   
     : 75
model name    : AMD Athlon(tm) 64 X2 Dual Core Processor 3800+
stepping    : 2
cpu MHz        : 2009.262
cache size    : 512 KB
physical id    : 0
siblings    : 2
core id        : 1
cpu cores    : 2
apicid        : 1
initial apicid    : 1
fpu        : yes
fpu_exception    : yes
cpuid level    : 1
wp        : yes
flags        : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov 
pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 
3dnowext 3dnow rep_good pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy
bogomips    :
 4018.33
TLB size    : 1024 4K pages
clflush size    : 64
cache_alignment    : 64
address sizes    : 40 bits physical, 48 bits virtual
power management: ts fid vid ttp tm stc

Memory:
cat /proc/meminfo
MemTotal:  1994512 kB
MemFree:    619124 kB
Buffers: 64884 kB
Cached: 629192 kB
SwapCached: 16 kB
Active: 725200 kB
Inactive:   451964 kB
SwapTotal: 5984248 kB
SwapFree:  5984112 kB
Dirty: 180
 kB
Writeback:   0 kB
AnonPages:  483040 kB
Mapped:  67612 kB
Slab:   153472 kB
SReclaimable:   139308 kB
SUnreclaim:  14164 kB

PageTables:  13956 kB
NFS_Unstable:    0 kB
Bounce:  0 kB
WritebackTmp:    0 kB
CommitLimit:   6981504 kB
Committed_AS:   852184 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    108376 kB
VmallocChunk: 34359625211 kB





  


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


Re: error compiling kvm-72 not there with kvm-69 - link kernel 2.6.26

2008-08-06 Thread jim miro

If I remove the "flags" parameter from the call to anon_inode_getfd in the 
function kvm_anon_inode_getfd 
It compiles but I get a warning.

 CC [M]  /usr/src/kvm-72/kernel/anon_inodes.o
/usr/src/kvm-72/kernel/anon_inodes.c: In function ‘kvm_anon_inode_getfd’:
/usr/src/kvm-72/kernel/anon_inodes.c:254: warning: passing argument 2 of 
‘anon_inode_getfd’ from incompatible pointer type
  CC [M]  /usr/src/kvm-72/kernel/irq.o

So...
its late and I won't have time to try it tonight but there is a coding error 
there.

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)

int kvm_anon_inode_getfd(const char *name,
 const struct file_operations *fops,
 void *priv, int flags)
{
int r;
int fd;
struct inode *inode;
struct file *file;

r = anon_inode_getfd(&fd, &inode, &file, name, fops, priv);
if (r < 0)
return r;
return fd;
}

#else

int kvm_anon_inode_getfd(const char *name,
 const struct file_operations *fops,
 void *priv, int flags)
{
return anon_inode_getfd(name, &fops, priv, flags);
}  ^^^error 

#endif



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


Re: error compiling kvm-72 not there with kvm-69 - link kernel 2.6.26

2008-08-07 Thread jim miro
the patch does not work...

[EMAIL PROTECTED]:~/KVM$ sh run_c_kvm

Message from [EMAIL PROTECTED] at Thu Aug  7 01:58:37 2008 ...
miro kernel: Oops: 0011 [1] SMP 

Message from [EMAIL PROTECTED] at Thu Aug  7 01:58:37 2008 ...
miro kernel: Code: 00 00 00 00 00 00 00 00 00 00 00 20 5d ed 6e 00 81 ff ff 20 
5d ed 6e 00 81 ff ff 00 00 00 00 00 00 00 00 40 5e 9f 68 00 81 ff ff <40> 5d ed 
6e 00 81 ff ff 40 5d ed 6e 00 81 ff ff 80 e7 82 7b 00 

Message from [EMAIL PROTECTED] at Thu Aug  7 01:58:37 2008 ...
miro kernel: CR2: 81006eed5d40

Message from [EMAIL PROTECTED] at Thu Aug  7 01:58:37 2008 ...
miro kernel: Oops:  [2] SMP 

Message from [EMAIL PROTECTED] at Thu Aug  7 01:58:37 2008 ...
miro kernel: Code: 5f e9 91 b4 11 00 41 57 4c 8d 7f 04 41 56 41 55 41 54 55 48 
89 fd 4c 89 ff 4c 8d 75 08 53 48 83 ec 08 e8 6e b3 11 00 48 89 04 24 <48> 8b 4d 
08 c7 45 00 00 00 00 00 4c 39 f1 0f 84 be 00 00 00 45 

Message from [EMAIL PROTECTED] at Thu Aug  7 01:58:37 2008 ...
miro kernel: CR2: 0009



--- On Thu, 8/7/08, jim miro <[EMAIL PROTECTED]> wrote:

> From: jim miro <[EMAIL PROTECTED]>
> Subject: Re: error compiling kvm-72 not there with kvm-69 - link kernel 2.6.26
> To: kvm@vger.kernel.org
> Date: Thursday, August 7, 2008, 1:46 AM
> If I remove the "flags" parameter from the call to
> anon_inode_getfd in the function kvm_anon_inode_getfd 
> It compiles but I get a warning.
> 
>  CC [M]  /usr/src/kvm-72/kernel/anon_inodes.o
> /usr/src/kvm-72/kernel/anon_inodes.c: In function
> ‘kvm_anon_inode_getfd’:
> /usr/src/kvm-72/kernel/anon_inodes.c:254: warning: passing
> argument 2 of ‘anon_inode_getfd’ from incompatible
> pointer type
>   CC [M]  /usr/src/kvm-72/kernel/irq.o
> 
> So...
> its late and I won't have time to try it tonight but
> there is a coding error there.
> 
> #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
> 
> int kvm_anon_inode_getfd(const char *name,
>const struct file_operations *fops,
>void *priv, int flags)
> {
>   int r;
>   int fd;
>   struct inode *inode;
>   struct file *file;
> 
>   r = anon_inode_getfd(&fd, &inode, &file, name,
> fops, priv);
>   if (r < 0)
>   return r;
>   return fd;
> }
> 
> #else
> 
> int kvm_anon_inode_getfd(const char *name,
>const struct file_operations *fops,
>void *priv, int flags)
> {
>   return anon_inode_getfd(name, &fops, priv, flags);
> }  ^^^error
> 
> 
> #endif


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


Re: [ANNOUNCE] kvm-75 release

2008-09-13 Thread Jim Paris
Avi Kivity wrote:
> - restore option roms to their original content on reset
>   - fixes extboot failures after reset

It doesn't seem to work here:

$ dmesg | grep kvm | tail -1
[1649282.904413] loaded kvm module (kvm-75)
$ sudo kvm | head -1
QEMU PC emulator version 0.9.1 (kvm-75), Copyright (c) 2003-2008 Fabrice Bellard
$ sudo /usr/bin/kvm -M pc -m 512 -smp 1 -name svn -boot c -drive 
file=/dev/mapper/raid1-svn,if=virtio,index=0,boot=on

At GRUB, I hit "c" for a command prompt, then type "reboot".
At the reboot, the BIOS says:

  QEMU BIOS - build: 09/03/08
  $Revision: 1.182 $ $Date: 2007/08/01 17:09:51 $
  Options: apmbios pcibios eltorito rombios32
  
  ata1 master: QEMU DVD-ROM ATAPI-4 CD-Rom/DVD-Rom
  
  Booting from Hard Disk...
  Boot from Hard Disk failed: could not read the boot disk
  FATAL: No bootable device.

With if=ide, rebooting in this manner works fine.

-jim
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [ANNOUNCE] kvm-75 release

2008-09-13 Thread Jim Paris
Avi Kivity wrote:
> Jim Paris wrote:
>> Avi Kivity wrote:
>>   
>>> - restore option roms to their original content on reset
>>>   - fixes extboot failures after reset
>>
>> It doesn't seem to work here:
>
> grub is probably booting via int 19 or jumping to the reset vector, so  
> kvm doesn't see the reboot.

You're right:

ENTRY(grub_reboot)
callEXT_C(prot_to_real)
.code16
/* cold boot */
movw$0x0472, %di
movw%ax, (%di)
ljmp$0x, $0x

> If that's the case, we can either implement  
> the chipset's memory control registers properly and teach the bios to  
> program them, or add a hack in the bios to trigger the copying without  
> the full reset.

My testing was a bit flawed.  With kvm-74, I noticed that reboot from
Linux had the problem, and reboot from grub failed the same way.  With
kvm-75, I only tested reboot from grub.  I can verify that reboot
from Linux works fine with virtio and kvm-75, and so the current
behavior is actually fine for us.

Thanks,
-jim
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Question on copy & paste

2010-04-15 Thread Jim Paris
Stephen Liu wrote:
> 
> 
> - Original Message 
> From: Amit Shah 
> To: Stephen Liu 
> Cc: kvm@vger.kernel.org
> Sent: Thu, April 15, 2010 9:02:53 AM
> Subject: Re: Question on copy & paste
> 
> On (Thu) Apr 15 2010 [08:45:23], Stephen Liu wrote:
> > Hi folks,
> > 
> > host - Debian 5.04
> > 
> > What will the easy way to enable copy_and_paste function between guest and 
> > hosts?  Also among guests.  TIA
> 
> This doesn't exist yet, but something should be available in a few
> months.
> 
> 
> Noted and thanks

You can use higher level layers to handle that in the meantime.  For
example, I always use rdesktop to connect to my Windows guests and it
supports copy and paste just fine.

-jim
--
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: Question on copy & paste

2010-04-16 Thread Jim Paris
Stephen Liu wrote:
> > You can use higher level layers to handle that in the meantime.  For
> > example, I always use rdesktop to connect to my Windows guests and it
> > supports copy and paste just fine.
> 
> Hi Jim,
> 
> Thanks for your advice.
> 
> 
> Host - Debian 5.0
> Guest - Debian 5.0
> 
> 
> I have rdesktop running here.  But I can't connect the guest on host
> 
> $ rdesktop 192.168.0.30
> Autoselected keyboard map en-us
> ERROR: 192.168.0.30: unable to connect
> 
> 
> On VBox I run;
> 
> $ rdesktop 192.168.0.30:3389
> 
> It connects.  Here I don't know which port to be used.
> 
> Could you please shed me some light.  TIA

You'll need a rdp server on the guest, try xrdp.  Or you can run a vnc
server on the guest and use a vnc client on the host.

-jim
--
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 5/8] KVM: PPC: Be more informative on BUG

2010-04-18 Thread Jim Paris
Alexander Graf wrote:
> We have a condition in the ppc64 host mmu code that should never occur.
> Unfortunately, it just did happen to me and I was rather puzzled on why,
> because BUG_ON doesn't tell me anything useful.
> 
> So let's add some more debug output in case this goes wrong. Also change
> BUG to WARN, since I don't want to reboot every time I mess something up.
> 
> Signed-off-by: Alexander Graf 
> ---
>  arch/powerpc/kvm/book3s_64_mmu_host.c |9 +++--
>  1 files changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c 
> b/arch/powerpc/kvm/book3s_64_mmu_host.c
> index 41af12f..5bf91a7 100644
> --- a/arch/powerpc/kvm/book3s_64_mmu_host.c
> +++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
> @@ -231,10 +231,15 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct 
> kvmppc_pte *orig_pte)
>   vcpu->arch.mmu.esid_to_vsid(vcpu, orig_pte->eaddr >> SID_SHIFT, &vsid);
>   map = find_sid_vsid(vcpu, vsid);
>   if (!map) {
> - kvmppc_mmu_map_segment(vcpu, orig_pte->eaddr);
> + ret = kvmppc_mmu_map_segment(vcpu, orig_pte->eaddr);
> + WARN_ON(ret < 0);
>   map = find_sid_vsid(vcpu, vsid);
>   }
> - BUG_ON(!map);
> + if (!map) {
> + printk(KERN_ERR "KVM: Segment map for 0x%llx (0x%lx) failed\n",
> + vsid, orig_pte->eaddr);
> + WARN();

Return here, otherwise dereferencing map in the next line will crash anyway...

> + }
>  
>   vsid = map->host_vsid;
>   va = hpt_va(orig_pte->eaddr, vsid, MMU_SEGSIZE_256M);
> -- 
> 1.6.0.2
> 
> --
> 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

-jim
--
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: Windows XP Bluescreen when unplugging printer

2009-11-16 Thread Jim Paris
Erik Rull wrote:
> Hi all,
>
> I want to run an epson inkjet within my windows xp guest. my host has  
> enabled usb 2.0, the USB flashdrive works without any problems. When I 
> plug in the printer (works with the same drivers on a native windows 
> xp!), it is recognized and the status monitor shows also the ink levels. 
> Until I start printing. Then the ink level disappears and the status 
> monitor hangs. The printer itself doesn't do anything, no LED blinks, no 
> printing starts. When I shut down windows or unplug the printer I get a 
> bluescreen in XP on usbuhci.sys
>
> Interesting: When I switch off USB 2.0 and enable only USB 1.x in the 
> host BIOS, everything related to USB is SLOW (usb flash drive, too!) but 
> the printer works (also slow, but it prints).
>
> Any ideas what could cause that behaviour? Comes up with kvm-88 and 
> kvm-77 as well.
>
> I tested it on two different systems both the same behaviour.

You might try this usb fix:
  
http://git.savannah.gnu.org/cgit/qemu.git/commit/?id=c4c0e236beabb9de5ff472f77aeb811ec5484615

It's been around for a while but hasn't made it into any qemu or kvm
releases yet.

-jim
--
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: Windows XP Bluescreen when unplugging printer

2009-11-18 Thread Jim Paris
Erik Rull wrote:
> Jim Paris wrote:
>> Erik Rull wrote:
>>> Hi all,
>>>
>>> I want to run an epson inkjet within my windows xp guest. my host has 
>>>  enabled usb 2.0, the USB flashdrive works without any problems. When 
>>> I plug in the printer (works with the same drivers on a native 
>>> windows xp!), it is recognized and the status monitor shows also the 
>>> ink levels. Until I start printing. Then the ink level disappears and 
>>> the status monitor hangs. The printer itself doesn't do anything, no 
>>> LED blinks, no printing starts. When I shut down windows or unplug 
>>> the printer I get a bluescreen in XP on usbuhci.sys
>>>
>>> Interesting: When I switch off USB 2.0 and enable only USB 1.x in the 
>>> host BIOS, everything related to USB is SLOW (usb flash drive, too!) 
>>> but the printer works (also slow, but it prints).
>>>
>>> Any ideas what could cause that behaviour? Comes up with kvm-88 and  
>>> kvm-77 as well.
>>>
>>> I tested it on two different systems both the same behaviour.
>>
>> You might try this usb fix:
>>   
>> http://git.savannah.gnu.org/cgit/qemu.git/commit/?id=c4c0e236beabb9de5ff472f77aeb811ec5484615
>>
>> It's been around for a while but hasn't made it into any qemu or kvm
>> releases yet.
>>
>> -jim
>> --
>> 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
>
> Hi Jim,
>
> sorry, still a bluescreen - but another one :-)
> BUGCODE_USBDRIVER is its name.
>
> Any other ideas? With USB 1.1 on the host everything is fine, after  
> enabling USB 2.0 in BIOS on the host, USB is faster within the guest, but 
> I have the given Bluescreen problem.
>
> Best regards,

No ideas, sorry.  It might be a Windows driver problem triggered by
qemu timing differences (try reinstalling the printer drivers?)  You
might also try enabling DEBUG in usb-linux.c and compare the output
you get there with a usbmon capture on the host, and a usbsnoopy
capture on the guest, to see if there are any discrepencies.  Not sure
what kind of thing you'd be looking for, though.

-jim
--
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: Windows XP Bluescreen when unplugging printer

2009-11-18 Thread Jim Paris
Erik Rull wrote:
> Jim Paris wrote:
>> Erik Rull wrote:
>>> Hi Jim,
>>>
>>> sorry, still a bluescreen - but another one :-)
>>> BUGCODE_USBDRIVER is its name.
>>>
>>> Any other ideas? With USB 1.1 on the host everything is fine, after   
>>> enabling USB 2.0 in BIOS on the host, USB is faster within the guest, 
>>> but I have the given Bluescreen problem.
>>>
>>> Best regards,
>>
>> No ideas, sorry.  It might be a Windows driver problem triggered by
>> qemu timing differences (try reinstalling the printer drivers?)  You
>> might also try enabling DEBUG in usb-linux.c and compare the output
>> you get there with a usbmon capture on the host, and a usbsnoopy
>> capture on the guest, to see if there are any discrepencies.  Not sure
>> what kind of thing you'd be looking for, though.
>>
>> -jim
>
> Hm, what I forgot to say: Now the bluescreen comes up directly after 
> trying to print, before it only appeared on unplugging or shutdown. And: 
> It seems to be a USB 2.0 issue. When I plug in a USB 1.1 printer 
> everything is fine??
>
> Can you recommend a usb sniffer tool? Hope this helps when getting a  
> bluescreen :-)

usbmon (e.g. with wireshark) on the Linux host should work.  usbsnoopy
is a tool you can use on the Windows guest side.  Of course, if the
guest OS is crashing it's going to be hard to get any useful data out
of that after the crash.

-jim
--
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: Some keys don't repeat in 64 bit Widows 7 kvm guest

2010-01-16 Thread Jim Paris
Jimmy Crossley wrote:
> Thanks for the quick response, Gleb.  You are right - we should not
> spend our time troubleshooting an issue with something this old.
> I'll try downloading all the sources and headers I need to build
> kvm-88.  I think I'll need another Debian install, since this is a
> production machine and I don't want to destabilize it.  Go ahead and
> laugh - I ran Debian stable for years before finally deciding I
> could risk running testing.

Debian testing still has the "kvm" package at version 72, but the new
package name "qemu-kvm" is at version 0.11.0 which is quite a bit
newer.

-jim
--
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-0.12.2 hangs when booting grub, when kvm is disabled

2010-01-21 Thread Jim Paris
Hi,

With this small disk image:

  http://psy.jim.sh/~jim/tmp/diskimage.gz

and the new qemu-kvm-0.12.2:

  $ kvm --version
  QEMU PC emulator version 0.12.2 (qemu-kvm-0.12.2), Copyright (c) 2003-2008 
Fabrice Bellard

I can successfully boot to a "grub> " prompt with:

  $ kvm -drive file=diskimage,boot=on

However, if kvm gets disabled:

  $ kvm -no-kvm -drive file=diskimage,boot=on

then the boot hangs at "GRUB Loading, please wait..." and consumes 100% CPU.

-jim
--
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: Issues with virtio_net in multiple guests?

2009-03-11 Thread Jim Paris
Ken Robertson wrote:
> Hoping someone can help me track down an issue I'm experiencing on a
> KVM machine I built recently.
...
> SIOCSIFFLAGS: Cannot assign requested address
> 
> The address isn't in use or anything, so no reason I can think of why
> it can't assign it.  It recognizes the device, however can't bring it
> up.  All the VMs have unique MAC addresses, randomly generated.  One
> of the ones that doesn't work is using 93:01:dc:a0:f0:57.

That MAC address is not valid.  The LSB of the first byte should be 0 to
indicate unicast, and the second LSB of the first byte should be 1 to
indicate a locally-assigned address.  e.g. 92:01:dc:a0:f0:57 should
work.

-jim



--
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: Issues with virtio_net in multiple guests?

2009-03-12 Thread Jim Paris
Ken Robertson wrote:
> Jim,
> 
> That was it!  I didn't realize there was some significance of certain
> bits within the address.  Changing that first byte resolved the issue.
>  Should I be setting the 2nd bit in the LSB to 1?  I started logging
> into all the systems I have access to and realized all of them have 00
> as the first byte in the address.  Should I just stick to 00 on all
> mine?  Or by making that 2nd bit 1, does that force the card to
> inherit an address from libvirt or somewhere else instead of the VM
> configuration?  I'll play around with it some more, but at least that
> mystery is solved.

The 2nd LSB of the first byte just says it's a locally generated
address rather than one of the officially-assigned OUIs.

The 1st LSB of the first byte is the important one as that's what the
Linux kernel checks and rejects if it's set (it also rejects an
address of all zeros).

-jim
--
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 -tip 4/6 V4.1] x86: kprobes checks safeness of insertion address.

2009-04-03 Thread Jim Keniston
On Fri, 2009-04-03 at 12:02 -0400, Masami Hiramatsu wrote:
> Ensure safeness of inserting kprobes by checking whether the specified
> address is at the first byte of a instruction. This is done by decoding
> probed function from its head to the probe point.
> 
> changes from v4:
>  - change a comment according to Ananth's suggestion.
> 
> Signed-off-by: Masami Hiramatsu 
> Cc: Ananth N Mavinakayanahalli 
> Cc: Jim Keniston 
> Cc: Ingo Molnar 
> ---
> 
>  arch/x86/kernel/kprobes.c |   51 
> +
>  1 files changed, 51 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
...
> 
> +/* Recover original instruction */

/* Recover the probed instruction at addr for further analysis. */
See below.

> +static int recover_probed_instruction(kprobe_opcode_t *buf, unsigned long 
> addr)
> +{
> + struct kprobe *kp;
> + kp = get_kprobe((void *)addr);
> + if (!kp)
> + return -EINVAL;
> +
> + /* Don't use p->ainsn.insn; which will be modified by fix_riprel */

fix_riprel doesn't affect the instruction's length, which is what
concerns this patch.  But we want this function to be useful for
unforeseen uses as well, so I like the code you have.  Just consider the
suggested comment changes.

/*
 * Don't use p->ainsn.insn, which could be modified -- e.g.,
 * by fix_riprel().
 */

> + memcpy(buf, kp->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
> + buf[0] = kp->opcode;
> + return 0;
> +}

Jim Keniston

--
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 -tip 0/6 V4] tracing: kprobe-based event tracer

2009-04-03 Thread Jim Keniston
On Fri, 2009-04-03 at 12:55 -0400, Masami Hiramatsu wrote:
> Ingo Molnar wrote:
> > * Masami Hiramatsu  wrote:
> > 
> >> Hmm, I'd like to know actually kvm aims to emulate all kinds of 
> >> instructions. If so, I might find some bugs in x86_emulate.c. 
> >> However, I don't know all bugs. To find all of them, we have to 
> >> port x86_emulate.c to user-space, decode binaries with it, and 
> >> compare its output with another decoder, as Jim had done with 
> >> insn.c.
> >>
> >> https://www.redhat.com/archives/utrace-devel/2009-March/msg00031.html
> > 
> > btw., i'd suggest we put a build time check for this into the kernel 
> > version as well. For example to decode the vmlinux via objdump, run 
> > it through your decoder as well and compare the results. Put under a 
> > CONFIG_DEBUG_X86_DECODER_TEST kind of (deault-off) build-time 
> > self-test.
> > 
> > This would ensure that the kernel we are running is fully supported 
> > by the decoder - even as GCC/GAS starts using new instructions, etc. 
> > 
> > How does this sound to you?
> 
> Thanks! That is a good idea.
> Jim, would you think you can port your script into kernel tree?
...

I'd be happy to do what's needed to make it happen, and maintain it in
the face of x86 changes.  The script itself is practically nothing (~100
lines of awk and C), but what I don't know about the kernel build is a
lot, so I'd need some help from a kernel-build expert.

Jim

--
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 -tip 3/6 V4.1] x86: instruction decorder API

2009-04-06 Thread Jim Keniston
On Fri, 2009-04-03 at 20:37 -0400, Masami Hiramatsu wrote:
> Hi Peter,
> 
> H. Peter Anvin wrote:
> > Masami Hiramatsu wrote:
> >> Add x86 instruction decoder to arch-specific libraries. This decoder
> >> can decode all x86 instructions into prefix, opcode, modrm, sib,
> >> displacement and immediates. This can also show the length of
> >> instructions.
> >>
...
> > 
> > Hi Masami,
> > 
> > On the surface the overall structure looks fine, but I have a couple of 
> > concerns:
> > 
> > 1. is this meant to be able to decode userspace code or just kernel 
> > code?  If it is supposed to be able to decode userspace code, is there a 
> > reason you're not dealing with 16-bit or V86 mode code at all?  If not, 
> > why are you including the 32-bit decoder in a 64-bit kernel (as well as 
> > instructions which we're pretty much guaranteed to never use in the 
> > kernel, such as ENTER.)
> 
> Actually, this aims to decode both of user space and kernel code.
> At this point, it just needs to cover kernel code, because kprobes
> just want to decode kernel binary.
> However, this is just a starting point, uprobe developers want to
> use it to decode user-space code. In that case, it needs to be
> enhanced.

For user-space probing, we've been concentrating on native-built
executables.  Am I correct in thinking that we'll see 16-bit or V86 mode
only on legacy apps built elsewhere?  In any case, it only makes sense
to build on the kvm folks' work in this regard.

...
> 
> > 
> > 4. you have a bunch of magic opcode constants all over the place.  This 
> > means that as new instructions come in -- and they're going to be coming 
> > in -- this is going to be hard to update.  It would be cleaner if we 
> > could have an intermediate format that preprocesses down to all the 
> > relevant tables and perhaps even some of the code rather than 
> > open-coding everything in C.
> > 
> > This matters... for example you have:
> > 
> > +   } else if (opcode == 0xea /* jmp far seg:offs */) {
> > +       __get_immptr(insn);
> > 
> > ... but nothing similar for opcode 0x9a.  This is extremely hard to spot 
> > with this kind of structure.
> 
> Oops, that should be a bug. Hmm, I think we'd better bit-flags tables
> for classifying opcodes.
> Jim, can your INAT idea help this situation?
> 
> http://sources.redhat.com/ml/systemtap/2009-q2/msg00109.html
> 

As noted, the INAT tables follow the kvm model of one fat bitmap of
attributes per opcode, rather than the kprobes/uprobes model of one or
two 256-bit tables per attribute.  (This latter approach was due to the
gradual accumulation of tables over the years.)

I like the bitmap-per-opcode approach because it's relatively easy to
see in one place everything you're saying about a particular opcode.
But with all the potential clients for this service, it's not clear that
we'll get by with a single bitmap for every opcode.  (x86 kvm uses 32
bits per opcode, I think, and the INAT tables use 10.  Seems like we
could overrun 64 bits pretty quickly.)  So I guess that means we'll have
to get a little creative as to how we expose these attribute sets to the
client.

...
> 
> Thank you for good advice!
> 

Ditto.
Jim Keniston

--
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 -tip 3/6 V4.1] x86: instruction decorder API

2009-04-16 Thread Jim Keniston
On Thu, 2009-04-16 at 19:31 -0400, Masami Hiramatsu wrote:
...
> 
> Hmm, I have an idea about instruction table. Usually, instruction tables
> are encoded with code defined by each decoder/emulator. This method
> will show their internal code directly, and is hard to maintain when
> the opcode map is updated. Instead of that, I'd like to suggest using
> the expressions in the opcode maps in a vender's genuine document (in
> this case, Intel/AMD's manual) or www.sandpile.org for instruction
> tables.
> 
> e.g.
> 
> const insn_attr_t onebyte_attr_table[ATTR_TABLE_SIZE] = {
> /* 0x00-0x0f */
> AT2(Eb,Gb), AT2(Ev,Gv),  AT2(Gb,Eb),  AT2(Gv,Ev),
> AT2(AL,Ib), AT2(rAX,Iz), AT2(ES,i64), AT2(ES,i64),
> AT2(Eb,Gb), AT2(Ev,Gv),  AT2(Gb,Eb),  AT2(Gv,Ev),
> AT2(AL,Ib), AT2(rAX,Iz), AT2(CS,i64), AT(ESC),
> ...
> 
> Here, AT and AT2 macros are defined as follows:
> 
> #define AT(a) (INAT_OMEXP_##a)
> #define AT2(a1, a2) (INAT_OMEXP_##a1 | INAT_OMEXP_##a2)
> 
...

It looks like AT2(Ev,Gv) would yield the same bits as AT2(Gv,Ev).  It'd
be nice not to lose the operand-order information.  And we'd have to
make clear whether which notation we're using -- src,dest as in the gnu
assembler, or dest,src as in the AMD (and Intel?) manuals.

Jim

--
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 -tip 3/6 V4.1] x86: instruction decorder API

2009-04-22 Thread Jim Keniston
On Tue, 2009-04-21 at 20:17 -0400, Masami Hiramatsu wrote:
...
> Hi Peter and Jim,
> 
> Now what I'm doing is making opcode tables like this.
> 
> Table: 1-byte opcode
> Alias: none
> 00: ADD Eb,Gb
> 01: ADD Ev,Gv
> 02: ADD Gb,Eb
> 03: ADD Gv,Ev
> 04: ADD AL,Ib
> 05: ADD rAX,Iz
> 06: PUSH ES (i64)
> 07: POP ES (i64)
> 08: OR Eb,Gb
> 09: OR Ev,Gv
> 0a: OR Gb,Eb
> 0b: OR Gv,Ev
> 0c: OR AL,Ib
> 0d: OR rAX,Iz
> 0e: PUSH CS
> 0f: 2-byte escape
> ...

We want to keep this info easy to parse. (Who knows how it might be
used, and by whom?)  Your format seems to be
opcode: mnemonic [comma,separated,operands] [(extra_info)]
which is fine if you stick to it... but your entry for 0f doesn't match
that.

Also, something like
+ extra_info
would be easier to parse (using, say, awk) than
(extra_info)

> 
> and a parser script which parses them into,
> 
> const insn_attr_t primary_table[INAT_TABLE_SIZE] = {
>   [0x04] = INAT_IMM(IMM_SIZE_BYTE)
>   [0x05] = INAT_IMM(IMM_SIZE_VWORD32)
>   [0x0c] = INAT_IMM(IMM_SIZE_BYTE)
>   [0x0d] = INAT_IMM(IMM_SIZE_VWORD32)
>   [0x0f] = INAT_ESC(IMM_ESC_2BYTE)
> ...
> 
> (note, instructions which has no attributes for decoder, are just ignored)
> 
> 
> By the way, I'm worried about legal things of Intel's instruction
> encoding expressions. Would you think there is any problem if we
> have those tables in the kernel tree?

Good question.  Sorry, I'm not a lawyer.  Intel and AMD and sandpile.org
all seem to be using the same notation, so the notation's inventor must
not be feeling too proprietary.  Interestingly, sandpile.org asserts a
copyright.

> 
> Thanks,
> 

Jim

--
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 -tip 3/6 V4.1] x86: instruction decorder API

2009-04-23 Thread Jim Keniston
On Thu, 2009-04-23 at 13:29 -0400, Masami Hiramatsu wrote:
...
> 
> Hmm, maybe, parser can handle "(extra_info)" as a solid keyword.
> so let's define actual format.
> 
> 
> Table: table-name
> Referrer: escamed-name
> opcode: mnemonic|Grp [operand1[,operand2...]] [(extra1)[,(extra2)...] [| 
> 2nd-mnemonic ...]
> opcode: ESC # escaped-name
> 
> 
> reg: mnemonic ...

For some instruction groups -- e.g., Groups 12, 13, 14 -- the
instruction prefix (66, f2, f3) and the reg field both affect the
instruction type.  And for some x87 instructions, the value of the modrm
byte's rm field also affects the instruction type.  (For others, rm just
selects among the st(0)..st(7) registers, as one might expect.)

Of course, that's all about floating-point instructions, which are of
more interest to uprobes than kprobes. 

Jim

--
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