specify password-secret during drive mirror

2020-02-05 Thread Jiatong Shen
Hello,

I am trying to hot swap drive from a file to a rbd based image. I try the
following command

*virs# qemu-monitor-command 1476 '{"execute": "drive-mirror","arguments":
{"device": "drive-virtio-disk1","job-id": "job0","target":
"rbd:vms/06abc940-f8de-4184-a37c-2fac9506a2c6_disk.config:id=nova:auth_supported=cephx\\;none:mon_host=172.16.2.61\\:6789;172.16.2.62\\:6789;172.16.2.63\\:6789",
"sync": "full", "mode": "existing", "format": "raw"}}'*

and then

*virsh # qemu-monitor-command 1476 '{"execute": "block-job-complete",
"arguments": {"device": "job0" }}'*

it seems working because query-block returns a new backend drive.

But how can I pass in a password-secret? looks like the above command work
because there is  already one secret.
-- 

Best Regards,

Jiatong Shen


romfile resize

2021-02-22 Thread Jiatong Shen
Hello,

  we are faced with an issue where a changed sized romfile (efi-virtio.rom)
fails live migration. Do qemu load this rom from its current host only? If
yes, why cannot sync this from source vm?

thank you.

-- 

Best Regards,

Jiatong Shen


Re: romfile resize

2021-02-23 Thread Jiatong Shen
Hi,

  Thank you very much for the answer. so if romfile on destination got a
larger size than source, why romfile check still does not
pass? because dest got enough space to hold romfile.

thank you.

Jiatong Shen

On Tue, Feb 23, 2021 at 5:46 PM Dr. David Alan Gilbert 
wrote:

> * Philippe Mathieu-Daudé (phi...@redhat.com) wrote:
> > Cc'ing qemu-devel@
> >
> > On 2/23/21 1:45 AM, Jiatong Shen wrote:
> > > Hello,
> > >
> > >   we are faced with an issue where a changed sized romfile
> > > (efi-virtio.rom) fails live migration. Do qemu load this rom from its
> > > current host only? If yes, why cannot sync this from source vm?
>
> Hi,
>   For migration to work the ROM has to be the same size on the source
> and destination.
>
>   The problem is that whne the destination starts up it allocates the
> size of the ROM based on the size of the file;  but then the migration
> comes along and tries to copy the data from the source machine into that
> allocation; and isn't sure what should happen when it doesn't quite fit.
>
>   There is some variation allowed (I think the allocated size gets
> rounded up, maybe to the next power of 2); but you still hit problems
> wehn the ROM size crosses certain thresholds.
>
>   In the latest qemu, a 'romsize' property was added (see git commit
> 08b1df8ff463e72b0875538fb991d5393047606c ); that lets you specifiy a
> size that's big enough to hold some space for future expansion - e.g.
> lets say your ROM is currently 300k, you might specify romsize=512k
> and then it doesn't matter what size the actual file is, we'll always
> allocate 512k, and as long as the file is less than 512k migration will
> work.
>
>   The more manual way to do that, is to arrange for your files to be
> padded to a larger boundary so that you leave room for growth.
> Some distros have done that for a while.
>
> Dave
>
> > > thank you.
> > >
> > > --
> > >
> > > Best Regards,
> > >
> > > Jiatong Shen
> >
> --
> Dr. David Alan Gilbert / dgilb...@redhat.com / Manchester, UK
>
>

-- 

Best Regards,

Jiatong Shen


Re: romfile resize

2021-02-23 Thread Jiatong Shen
alright, thank you very much for the help :)

On Tue, Feb 23, 2021 at 6:23 PM Paolo Bonzini  wrote:

> On 23/02/21 10:57, Jiatong Shen wrote:
> >
> >Thank you very much for the answer. so if romfile on destination got
> > a larger size than source, why romfile check still does not
> > pass? because dest got enough space to hold romfile.
>
> Because QEMU checks that memory areas have the same size on the source
> and destination.  You're right that it's overly strict, but it's a case
> that has never been an issue before; probably because the ROM size
> should be fixed for each QEMU "machine type", and it's better to have a
> consistent set of ROM files on all your hosts.
>
> You can create a dummy file with the right size, or copy it from the
> source.
>
> Paolo
>
>

-- 

Best Regards,

Jiatong Shen


windows vm also uses max memory allocated

2021-04-15 Thread Jiatong Shen
Hi, qemu experts,

we are facing an issue that windows vm uses up all memory once booted. for
example, if vm has spec of 20G of memory, a linux machine will not uses 20G
memory as soon as it boots up, on the contrary, windows vm will uses all
that are allocated to it. (issue has also been reported
https://bugs.launchpad.net/ubuntu/+source/qemu/+bug/1916313)

another observation is that live migrating seems able to bring down rss
temporarily until balloon is called next time.

is this expected behavior for a windows guest? thank you

-- 

Best Regards,

Jiatong Shen


how to change sector size using qemu-img

2021-06-25 Thread Jiatong Shen
Hello community,

I have a disk with both logical and physical sector size being 4096. I have
a qcow2 image which is built from a virtual machine has legacy 512 bytes
sector size.

when I do something like

qemu-img convert -f qcow2 -O host_device disk device

turns out it will not work. mounting a filesystem reports an error.

Any advice on how to possibly work around this? thank you.

-- 

Best Regards,

Jiatong Shen


Add new commands to qemu-guest-agent without recompiling source code

2021-08-11 Thread Jiatong Shen
Hello,

  I am trying to add some new commands to qemu-guest-agent to export more
stats, but I am hesitating to modify source code and recompile it. Is it
possible to extend guest commands by add some python scripts? Thank you.

-- 

Best Regards,

Jiatong Shen


change vnc password

2021-08-16 Thread Jiatong Shen
Hello,

I am trying to change the vnc password without shutting down the running
virtual machine. And the problem is that virtual machine does not have a
password.. Is it possible to change its password? Thank you.

-- 

Best Regards,

Jiatong Shen


will qemu zero out memory before allocating

2021-08-20 Thread Jiatong Shen
Hello,

   For some security reasons, I would like to ask if memory will be zeroed
out before giving to virtual machine? For example, before ept entry
constructed, a hpa could have already got some contents, will these
contents be cleared before this hpa associated with a gpa?

Thank you and hopes what I wrote makes some sense

-- 

Best Regards,

Jiatong Shen


how to build debian package on arm64 machine

2021-08-23 Thread Jiatong Shen
Hello,

  for whatever reason I am trying to build qemu debian package
manuallyon arm64 machine. what I do is first "apt source qemu" to download
source and then "dpkg-buildcpakge" to build debs. This works on amd64
machine but fails on arm64.

  by looking that control file, seems it explicitly depends on
gcc-alpha-linux-gnu, but when I try to gcc-alpha-linux-gnu, it complains
there is no candidates for installation.. what should I do? thank you.

-- 

Best Regards,

Jiatong Shen


get efi-virtio-rom size at run time

2021-09-03 Thread Jiatong Shen
Hello,

I am trying to solve changed efi-virtio.rom blocking live migration (by
modifying openstack code). A problem I am facing is that I do not know how
to get efi-virtio.rom size out of the running virtual machine, because
unfortunately, I cannot directly calculate the file size because
nova-compute is running in a container..

I am trying info qtree & info mtree but does not find the rom size. so my
question is where can I find rom size for an interface? thank you .

-- 

Best Regards,

Jiatong Shen


Cross compile QEMU guest agent for windows on Linux server

2021-09-16 Thread Jiatong Shen
Hello community,

   I am trying to build qemu guest agent for windows on a linux server, but
I do not know how to start.. Could you give me references to guide me
through the building process? Thank you.

-- 

Best Regards,

Jiatong Shen


Re: Cross compile QEMU guest agent for windows on Linux server

2021-09-17 Thread Jiatong Shen
Thank you very much.  I'll have a look at it.

Best,
Norman

On Fri, Sep 17, 2021 at 2:19 PM Thomas Huth  wrote:

> On 17/09/2021 08.01, Jiatong Shen wrote:
> > Hello community,
> >
> > I am trying to build qemu guest agent for windows on a linux server,
> but
> > I do not know how to start.. Could you give me references to guide me
> > through the building process? Thank you.
>
> Have a look here:
>
>   https://wiki.qemu.org/Hosts/W32#Cross_builds
>
>   HTH,
>Thomas
>
>

-- 

Best Regards,

Jiatong Shen


live migration failure with kvm_put_msr_feature_control: Assertion `ret == 1' failed

2021-09-19 Thread Jiatong Shen
Hello community,

   I am trying to understand an error message produced during live
migration. The error message are produced when trying to do a live
migration from a host which enabled nested kvm_intel to a host where nest
virtualization has been disabled. The full error message is

/build/qemu-vx6Pwx/qemu-2.11+dfsg/target/i386/kvm.c:1596:
kvm_put_msr_feature_control: Assertion `ret == 1' failed.

guest vm has -cpu host and -enable-kvm

After some googling, looks like the assertion failed here
https://github.com/qemu/qemu/blob/c99e34e537f13a431a80e3e414e5904e9dd0a116/target/i386/kvm/kvm.c#L2649
but I had a hard time understanding the background...

so in all my question is

1. What  is the difference between vmxon and guest mode?
2. What is  MSR_IA32_FEATURE_CONTROL ?
3. I am using qemu 2.11 but live migration succeeds on ubuntu 16.04 with
kernel 4.4..
so does this assert also has something to do with kernel?

Thank you.
-- 

Best Regards,

Jiatong Shen


qemu-img convert from uri: recv failure

2022-01-13 Thread Jiatong Shen
Hello, community,

  I am trying to run qemu-img convert on an aarch64 machine and hit by a
connection recv failure issue.

  the command I am executing is :  qemu-img convert -f qcow2 -O raw
http://x/system.qcow2  out.img -p

  and the error msg is : qemu-img: curl: Recv failure: Connection reset by
peer
qemu-img: error while reading at byte 515833856: Input/output error

  in the meantime, using curl http:///system.qcow2 is ok.

  what could be cause of the connection reset issue? Thank you.
-- 

Best Regards,

Jiatong Shen


how to obtain qemu changlogs

2022-02-08 Thread Jiatong Shen
Hello community,

   I am trying to find new changelogs for each release. I find there is a
site (https://wiki.qemu.org/ChangeLog/6.1) for it, but looks like it does
not contain every changes. for example,
https://github.com/qemu/qemu/commit/c56ac27d2ad583aa2db5382bb510a33b638a4ab5
this commit which supports rbd device to write zeros is not included. May I
ask how change log is generated? Thank you.

-- 

Best Regards,

Jiatong Shen


how to detach vhost-user-blk

2022-02-08 Thread Jiatong Shen
Hello community,

  I am testing vhost-user-blk. the virtual machine is started with the
following command

./x86_64-softmmu/qemu-system-x86_64 \
--enable-kvm \
-smp 2 \
-chardev
socket,id=chr-vu-virtio-disk0,path=/var/lib/nova/volume-04789a9b-21ce-4270-89bd-638700a0e56c,reconnect=10
\
-device
vhost-user-blk-pci,bus=pci.0,addr=0x8,chardev=chr-vu-virtio-disk0,id=virtio-disk0
\
-chardev
socket,id=chr-vu-virtio-disk1,path=/var/lib/nova/volume-9590b74a-c652-4e97-a88d-f736000b4886,reconnect=10
\
-device
vhost-user-blk-pci,bus=pci.0,addr=0x9,chardev=chr-vu-virtio-disk1,id=virtio-disk1
\
-m 2048 \
-overcommit mem-lock=off \
-smp 2,sockets=2,dies=1,cores=1,threads=1 \
-object
memory-backend-file,id=ram-node0,mem-path=/dev/hugepages/libvirt/qemu/7-instance-0005,share=on,prealloc=on,size=2147483648,host-nodes=0,policy=bind
\
-numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
-monitor stdio \
-vnc :0

the two devices are hosted by spdk vhost application

it uses two vhost-user-blk devices. then in the monitor, I execute

device_del virtio-disk1

the command completed successfully and in the virtual machine the disk is
gone.

but when I execute spdk vhost_delete_controller, this command will fail
with spdk vhost application complained

[2022-02-09 14:52:30.487815] vhost.c:1013:vhost_dev_unregister: *ERROR*:
Controller volume-9590b74a-c652-4e97-a88d-f736000b4

it looks like qemu  does not disconnect unix socket connection even though
the device is removed.

My question is: is device_del enough? do I need to remove chardev as well?
thank you.

-- 

Best Regards,

Jiatong Shen


Re: how to detach vhost-user-blk

2022-02-09 Thread Jiatong Shen
Hello, I figured out I should have executed chardev-remove to disconnect
unix socket connection. It actually works on qemu 6.2.0.
but for qemu 4.2.0 even after delete chardev device, the connection is not
disconnected, My current assumption is that char-socket
object ref count is not 0 after connection_free.

My question is is there a simple way to track ref count for a specific
object? thank you.

On Wed, Feb 9, 2022 at 3:07 PM Jiatong Shen  wrote:

> Hello community,
>
>   I am testing vhost-user-blk. the virtual machine is started with the
> following command
>
> ./x86_64-softmmu/qemu-system-x86_64 \
> --enable-kvm \
> -smp 2 \
> -chardev
> socket,id=chr-vu-virtio-disk0,path=/var/lib/nova/volume-04789a9b-21ce-4270-89bd-638700a0e56c,reconnect=10
> \
> -device
> vhost-user-blk-pci,bus=pci.0,addr=0x8,chardev=chr-vu-virtio-disk0,id=virtio-disk0
> \
> -chardev
> socket,id=chr-vu-virtio-disk1,path=/var/lib/nova/volume-9590b74a-c652-4e97-a88d-f736000b4886,reconnect=10
> \
> -device
> vhost-user-blk-pci,bus=pci.0,addr=0x9,chardev=chr-vu-virtio-disk1,id=virtio-disk1
> \
> -m 2048 \
> -overcommit mem-lock=off \
> -smp 2,sockets=2,dies=1,cores=1,threads=1 \
> -object
> memory-backend-file,id=ram-node0,mem-path=/dev/hugepages/libvirt/qemu/7-instance-0005,share=on,prealloc=on,size=2147483648,host-nodes=0,policy=bind
> \
> -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
> -monitor stdio \
> -vnc :0
>
> the two devices are hosted by spdk vhost application
>
> it uses two vhost-user-blk devices. then in the monitor, I execute
>
> device_del virtio-disk1
>
> the command completed successfully and in the virtual machine the disk is
> gone.
>
> but when I execute spdk vhost_delete_controller, this command will fail
> with spdk vhost application complained
>
> [2022-02-09 14:52:30.487815] vhost.c:1013:vhost_dev_unregister: *ERROR*:
> Controller volume-9590b74a-c652-4e97-a88d-f736000b4
>
> it looks like qemu  does not disconnect unix socket connection even though
> the device is removed.
>
> My question is: is device_del enough? do I need to remove chardev as well?
> thank you.
>
> --
>
> Best Regards,
>
> Jiatong Shen
>


-- 

Best Regards,

Jiatong Shen


Re: how to detach vhost-user-blk

2022-02-12 Thread Jiatong Shen
hello, after some debugging, I am suspecting
https://github.com/qemu/qemu/blob/b0ca999a43a22b38158a33d3f5881648bb4f/hw/block/vhost-user-blk.c#L376
this code creates a watcher which
might not be released ( in 4.2.0), if I remove this line, looks like
device_del + chardev-remove could correctly release unix link.

On Thu, Feb 10, 2022 at 11:03 AM Jiatong Shen  wrote:

> Hello, I figured out I should have executed chardev-remove to disconnect
> unix socket connection. It actually works on qemu 6.2.0.
> but for qemu 4.2.0 even after delete chardev device, the connection is not
> disconnected, My current assumption is that char-socket
> object ref count is not 0 after connection_free.
>
> My question is is there a simple way to track ref count for a specific
> object? thank you.
>
> On Wed, Feb 9, 2022 at 3:07 PM Jiatong Shen  wrote:
>
>> Hello community,
>>
>>   I am testing vhost-user-blk. the virtual machine is started with the
>> following command
>>
>> ./x86_64-softmmu/qemu-system-x86_64 \
>> --enable-kvm \
>> -smp 2 \
>> -chardev
>> socket,id=chr-vu-virtio-disk0,path=/var/lib/nova/volume-04789a9b-21ce-4270-89bd-638700a0e56c,reconnect=10
>> \
>> -device
>> vhost-user-blk-pci,bus=pci.0,addr=0x8,chardev=chr-vu-virtio-disk0,id=virtio-disk0
>> \
>> -chardev
>> socket,id=chr-vu-virtio-disk1,path=/var/lib/nova/volume-9590b74a-c652-4e97-a88d-f736000b4886,reconnect=10
>> \
>> -device
>> vhost-user-blk-pci,bus=pci.0,addr=0x9,chardev=chr-vu-virtio-disk1,id=virtio-disk1
>> \
>> -m 2048 \
>> -overcommit mem-lock=off \
>> -smp 2,sockets=2,dies=1,cores=1,threads=1 \
>> -object
>> memory-backend-file,id=ram-node0,mem-path=/dev/hugepages/libvirt/qemu/7-instance-0005,share=on,prealloc=on,size=2147483648,host-nodes=0,policy=bind
>> \
>> -numa node,nodeid=0,cpus=0-1,memdev=ram-node0 \
>> -monitor stdio \
>> -vnc :0
>>
>> the two devices are hosted by spdk vhost application
>>
>> it uses two vhost-user-blk devices. then in the monitor, I execute
>>
>> device_del virtio-disk1
>>
>> the command completed successfully and in the virtual machine the disk is
>> gone.
>>
>> but when I execute spdk vhost_delete_controller, this command will fail
>> with spdk vhost application complained
>>
>> [2022-02-09 14:52:30.487815] vhost.c:1013:vhost_dev_unregister: *ERROR*:
>> Controller volume-9590b74a-c652-4e97-a88d-f736000b4
>>
>> it looks like qemu  does not disconnect unix socket connection even
>> though the device is removed.
>>
>> My question is: is device_del enough? do I need to remove chardev as
>> well? thank you.
>>
>> --
>>
>> Best Regards,
>>
>> Jiatong Shen
>>
>
>
> --
>
> Best Regards,
>
> Jiatong Shen
>


-- 

Best Regards,

Jiatong Shen


how to use blockdev-add in hmp console

2022-02-22 Thread Jiatong Shen
Hello community,

  I am reading
https://qemu.readthedocs.io/en/latest/interop/live-block-operations.html
and try to learn blockdev-add command. I boot a virtual machine with
-nographic option and entered hmp interactive console. but when I execute
blockdev-add there, it fails with no such command. but on the given website
looks like it could successfully translate to a qmp command. My question is
how could I execute blockdev-add in hmp? thank you very much for the help.

-- 

Best Regards,

Jiatong Shen


sparsed block copy from a host_device to rbd

2022-02-23 Thread Jiatong Shen
Hello community,

  I would like to ask if there is a way to do a sparse blockdev-mirror from
a host_device to ceph RBD object. I saw rbd driver has already
implemented write_zeroes as well as block_status such that a
blockdev-mirror rbd object from one ceph pool to another is sparsed but
when I try to block-copy from SAN based mulitpath device mapper
(host_device) to RBD, the rbd image is still filled with zeroes. Right now,
my workaround seems to enable detect_zeroes and make granularity larger
than rbd object size (2^22 for example). but detect_zeroes will on the
other hand causes intensive  unnecessary computations.
   after skimming through the code base, my current impression is that
host_device does not implement with a block_status method so somehow it
could not determine holes.

  My question is there way to determine if a host_device is sparsed? or if
it not possible, is it possible to switch on detect_zeroes during
blocdev-mirror and disable it when the copy completes? thank you.

-- 

Best Regards,

Jiatong Shen


kvm bad address

2022-02-27 Thread Jiatong Shen
Hello community,

I saw the following error and vm is paused, qemu version is 4.2 and os is
linux 4.15.0

error: kvm run failed Bad address
RAX=000f RBX=dbc0 RCX=080b
RDX=880ffec44800
RSI=0001 RDI=0046 RBP=880fff3e3f80
RSP=880fff3e3f68
R8 = R9 = R10=
R11=
R12=000f R13=880fe8404000 R14=880fe8404000
R15=
RIP=810df774 RFL=00010006 [-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =  000f 
CS =0010   00a09b00 DPL=0 CS64 [-RA]
SS =0018   00c09300 DPL=0 DS   [-WA]
DS =  000f 
FS =  000f 
GS = 880fff3e 000f 
LDT=  000f 
TR =0040 880fff3f1b40 2087 8b00 DPL=0 TSS64-busy
GDT= 880fff3e9000 007f
IDT= ff529000 0fff
CR0=80050033 CR2= CR3=000fdcd9 CR4=003406e0
DR0= DR1= DR2=
DR3=
DR6=fffe0ff0 DR7=0400
EFER=0d01
Code=0f 1f 44 00 00 65 8b 04 25 1c a0 00 00 48 8b 15 94 79 cd 00 <0f> a3 02
19 c0 85 c0 74 16 48 c7 c0 80 db 00 00 65 48 03 04 25 e8 ce 00 00 83 78 08
01 74

My question is what does above log tells me and how can I do further
investigation?  thank you.

-- 

Best Regards,

Jiatong Shen


make coverage-html failed with no rule found

2022-05-18 Thread Jiatong Shen
Hello community,

I am trying to get qemu uniting test coverage report. I find this
https://www.qemu.org/docs/master/devel/testing.html#gcc-gcov-support link
might be relevant. but when I execute make  coverage-html.

it complains
make: *** No rule to make target 'coverage-html'.  Stop

What am I doing wrong? Would be appreciated to receive help. Thank you very
much in advance.

-- 

Best Regards,

Jiatong Shen


Re: make coverage-html failed with no rule found

2022-05-18 Thread Jiatong Shen
thank you very much for reply. I am using master branch. I think I have to
configure with  --enable-gcov enabled.
and then make and make coverage-html works.

Thank you for the help.

Best,
Norman

On Wed, May 18, 2022 at 6:27 PM Peter Maydell 
wrote:

> On Wed, 18 May 2022 at 10:14, Jiatong Shen  wrote:
> >
> > Hello community,
> >
> > I am trying to get qemu uniting test coverage report. I find this
> https://www.qemu.org/docs/master/devel/testing.html#gcc-gcov-support link
> might be relevant. but when I execute make  coverage-html.
> >
> > it complains
> > make: *** No rule to make target 'coverage-html'.  Stop
>
> You don't say what version of QEMU you're trying to do this on.
> Is this with the current git ?
>
> I expect that the coverage tests have broken at some point; we
> don't really use them in practice I think.
>
> Alex, did you ever look at this, or am I misremembering?
>
> thanks
> -- PMM
>


-- 

Best Regards,

Jiatong Shen


Re: make coverage-html failed with no rule found

2022-05-19 Thread Jiatong Shen
Thank you.. btw the result shows many of lines of codes does not get
covered. Am I doing something wrong?

Best,
Norman

On Fri, May 20, 2022 at 5:00 AM Alex Bennée  wrote:

>
> Jiatong Shen  writes:
>
> > thank you very much for reply. I am using master branch. I think I have
> to configure with  --enable-gcov enabled.
> > and then make and make coverage-html works.
>
> Hmm ok - I'll see if I can make that a bit cleaner...
>
> >
> > Thank you for the help.
> >
> > Best,
> > Norman
> >
> > On Wed, May 18, 2022 at 6:27 PM Peter Maydell 
> wrote:
> >
> >  On Wed, 18 May 2022 at 10:14, Jiatong Shen 
> wrote:
> >  >
> >  > Hello community,
> >  >
> >  > I am trying to get qemu uniting test coverage report. I find this
> >  https://www.qemu.org/docs/master/devel/testing.html#gcc-gcov-support
> link might be relevant. but when I execute make
> >  coverage-html.
> >  >
> >  > it complains
> >  > make: *** No rule to make target 'coverage-html'.  Stop
> >
> >  You don't say what version of QEMU you're trying to do this on.
> >  Is this with the current git ?
> >
> >  I expect that the coverage tests have broken at some point; we
> >  don't really use them in practice I think.
> >
> >  Alex, did you ever look at this, or am I misremembering?
> >
> >  thanks
> >  -- PMM
>
>
> --
> Alex Bennée
>


-- 

Best Regards,

Jiatong Shen


IPA range (41 bits) larger than the one supported by the host (40 bits)

2022-05-25 Thread Jiatong Shen
Hello community,

   I am trying to run qemu-system-aarch64 on a Kylin based machine, the
host kernel version is 4.19. qemu is versioned 4.2.1. The command I am
running is "qemu-system-aarch64 -cpu host -enable-kvm -machine virt -m
size=4G,maxmem=512G". This command failed with "qemu-system-aarch64: -m and
,maxmem option values require an IPA range (41 bits) larger than the one
supported by the host (40 bits)".
   I am confused because 2^40 is around 1TB which is greater than 512G.
Would be very appreciated to get some insights. Thank you very much for the
help in advance.

-- 

Best Regards,

Jiatong Shen


Re: IPA range (41 bits) larger than the one supported by the host (40 bits)

2022-05-26 Thread Jiatong Shen
Thank you very much. I'll try it out.

Best,
Norman

On Thu, May 26, 2022 at 4:18 PM Peter Maydell 
wrote:

> On Thu, 26 May 2022 at 07:45, Jiatong Shen  wrote:
> >I am trying to run qemu-system-aarch64 on a Kylin based machine, the
> host kernel version is 4.19. qemu is versioned 4.2.1. The command I am
> running is "qemu-system-aarch64 -cpu host -enable-kvm -machine virt -m
> size=4G,maxmem=512G". This command failed with "qemu-system-aarch64: -m and
> ,maxmem option values require an IPA range (41 bits) larger than the one
> supported by the host (40 bits)".
> >I am confused because 2^40 is around 1TB which is greater than 512G.
> Would be very appreciated to get some insights. Thank you very much for the
> help in advance.
>
> That's a rather old QEMU version. We reworked the handling of
> highmem in the virt board for the 7.0 release -- could you
> test whether that also has this problem? (I don't have a
> 40 bit PA host to hand but I did a quick simulation with
> a gdb session and I think 7.0 should fit everything into 40 bits
> with those command line options.)
>
> thanks
> -- PMM
>


-- 

Best Regards,

Jiatong Shen


Re: IPA range (41 bits) larger than the one supported by the host (40 bits)

2022-05-26 Thread Jiatong Shen
Hi,

   I've tried to use qemu 7.0 and indeed "qemu-system-aarch64 -cpu host
-enable-kvm -machine virt -m size=4G,maxmem=512G" works this time! I also
tried qemu 6.2 but it doesn't work.
we have some environments which unfortunately couldn't upgrade qemu to 7.0.
So my question is is it possible to calculate a reasonable maxmem given
slots for an older qemu? Thank you much for the help.

Best,
Norman

On Thu, May 26, 2022 at 5:51 PM Jiatong Shen  wrote:

> Thank you very much. I'll try it out.
>
> Best,
> Norman
>
> On Thu, May 26, 2022 at 4:18 PM Peter Maydell 
> wrote:
>
>> On Thu, 26 May 2022 at 07:45, Jiatong Shen  wrote:
>> >I am trying to run qemu-system-aarch64 on a Kylin based machine, the
>> host kernel version is 4.19. qemu is versioned 4.2.1. The command I am
>> running is "qemu-system-aarch64 -cpu host -enable-kvm -machine virt -m
>> size=4G,maxmem=512G". This command failed with "qemu-system-aarch64: -m and
>> ,maxmem option values require an IPA range (41 bits) larger than the one
>> supported by the host (40 bits)".
>> >I am confused because 2^40 is around 1TB which is greater than 512G.
>> Would be very appreciated to get some insights. Thank you very much for the
>> help in advance.
>>
>> That's a rather old QEMU version. We reworked the handling of
>> highmem in the virt board for the 7.0 release -- could you
>> test whether that also has this problem? (I don't have a
>> 40 bit PA host to hand but I did a quick simulation with
>> a gdb session and I think 7.0 should fit everything into 40 bits
>> with those command line options.)
>>
>> thanks
>> -- PMM
>>
>
>
> --
>
> Best Regards,
>
> Jiatong Shen
>


-- 

Best Regards,

Jiatong Shen


how to cross compiling qemu debian deb package

2022-06-08 Thread Jiatong Shen
Hello community,

 I am trying to building qemu debian deb packages. The process I am
taking is apt download source packages and then executing dpkg-buildpackage
to compile. Right now the problem I am facing is how to build arm64
compatible debs in one run. Right now, the command I am using is
dpkg-buildpackages -us -uc, but it only outputs packages fitting the same
arch as the building machine.

   So my question is is there an easy way to do cross compiling and how.
Thank you very much for the help.

-- 

Best Regards,

Jiatong Shen


change cpu vendor id for kvm enabled guest

2022-08-11 Thread Jiatong Shen
Hello community,

  I would like to ask if there is a way to change cpu vendor id for a kvm
enabled guest. The background is that we are trying out Hygon CPU (which
seems similar to amd cpu). The issue is that windows 2008 cannot boot.
After some research, my colleague is suspecting that maybe windows 2008
only recognizes certain vendors (like Intel and amd).
  So my question is if it is possible to change vendor id to intel ? Thank
you very much for the help.

-- 

Best Regards,

Jiatong Shen


how to connect commit to email patch

2022-11-22 Thread Jiatong Shen
Hello community,

   I am trying to investigate bug fixes and new features for qemu from 4.2.
I noticed qemu's commits are reviewed through email, but right now the only
way that I found to connect commits to a particular email is through
googling. So my question is, is there a command line tool to either obtain
a patchset list or build a relationship between commit and git-email?

Thank you very much for the help.

-- 

Best Regards,

Jiatong Shen


Re: how to connect commit to email patch

2022-11-23 Thread Jiatong Shen
Thank you for reply! I found that pwclient could search through emails like
and produces an patch id.
using this patch id, I can obtain a msgid. Just curious for a patchset with
several commits, will
msgid get some similarities?

Best

On Wed, Nov 23, 2022 at 8:03 PM Peter Maydell 
wrote:

> On Wed, 23 Nov 2022 at 06:12, Jiatong Shen  wrote:
> >I am trying to investigate bug fixes and new features for qemu from
> 4.2. I noticed qemu's commits are reviewed through email, but right now the
> only way that I found to connect commits to a particular email is through
> googling. So my question is, is there a command line tool to either obtain
> a patchset list or build a relationship between commit and git-email?
>
> Generally not. You can look for the relevant patches either
> directly in a mailing list archive (the one with the best
> search facilities is https://lore.kernel.org/qemu-devel/ I
> think), or you can look for them in https://patchew.org/QEMU/
> (which provides a web-view of patches sent to the mailing
> list).
>
> There are one or two command line tools for working with
> mailing list emails, but generally they're aimed at the
> use case of developers working with recently sent
> patches and turning them into commits, not archaeological work
> starting with commits from releases that are several years old
> and trying to work back to the mailing list emails.
>
> thanks
> -- PMM
>


-- 

Best Regards,

Jiatong Shen


download kvm keynote slides

2022-11-29 Thread Jiatong Shen
Hello community,

   Sorry in advance if this is not the right place to ask.. Where could I
download kvm forum's keynote for the past 3 years? I googled but only found
http://www.linux-kvm.org/page/KVM_Forum_2015 very old documents.

Thank you for the help.

-- 

Best Regards,

Jiatong Shen


Re: download kvm keynote slides

2022-11-30 Thread Jiatong Shen
Ah, thank you very much. My bad, I should've read the schedules more
carefully..

Best,
Jiatong Shen

On Wed, Nov 30, 2022 at 5:01 PM Thomas Huth  wrote:

> On 30/11/2022 05.00, Jiatong Shen wrote:
> > Hello community,
> >
> > Sorry in advance if this is not the right place to ask.. Where could
> I
> > download kvm forum's keynote for the past 3 years? I googled but only
> found
> > http://www.linux-kvm.org/page/KVM_Forum_2015 very old documents.
>
> Hi, you likely best check the schedules of the conferences, most speakers
> uploaded their slides there:
>
> https://kvmforum2020.sched.com/
>
> https://kvmforum2021.sched.com/
>
> https://kvmforum2022.sched.com/
>
> ... and if you cannot find the talk you're looking for there, I suggest to
> try youtube.com - most talks have been recorded and can be found there.
>
>   Thomas
>
>

-- 

Best Regards,

Jiatong Shen


windows 2019 on qemu 4.2.0 & ubuntu kernel 4.15.0-72 stuck

2022-12-05 Thread Jiatong Shen
Hello community,

   I would like to ask for some advices on debugging a weird problem. The
setup is a qemu version is qemu-4.2.0-rc3 and kernel version
is 4.15.0-72-generic and distro is ubuntu 18.04. And the symptom is windows
stuck and cannot boot into system.

  After some debugging, I observe that if I specify -cpu
Cascadelake-Server,arch-capabilities,tsx-ctrl, then it does not work, but
if I remove tsx-ctrl then windows2019 boots successfully.

  Another observation is qemu-4.2.0-rc2 works the the same commandline
(namely, -cpu Cascadelake-Server,arch-capabilities,tsx-ctrl).

So my question is what could be the possible reason for such behavior.
Thank you very much in advance for you help.

-- 

Best Regards,

Jiatong Shen


about 2a9758c51e and tsx-ctrl

2022-12-12 Thread Jiatong Shen
Hello community,

   I am observing an issue where a windows 2019 vm failed to boot if I
specifying arch-capabilities with tsx-ctrl on cpu type (eg -enable-kvm -cpu
Cascadelake-Server,arch-capabilities,tsx-ctrl). After some debugging I
found if I revert commit 2a9758c51e, then windows 2019 is normal.

   I have some issue understanding what the commit is doing. So I send this
email and looking forward to receiving advice.  In the commit, I found
tsx-ctrl seems to be in two MSRs, one for feat_arch_capabilities and one
for msr_ia32_tsx_ctrl, the latter could be enabled if kvm supports it, but
the former is only controller by arch-capabilities.

   so my question is what is the relationship between MSR_IA32_TSX_CTRL
and MSR_IA32_ARCH_CAPABILITIES? and if has_msr_tsx_ctrl is false, should
tsx-ctrl still be set in MSR_IA32_ARCH_CAPABILITIES?

Thank you very much for the help.



Best Regards,

Jiatong Shen


migrate from qemu 2.11 to qemu 4.2 failed on arm machine

2023-01-29 Thread Jiatong Shen
Hello community experts,

   I am facing an issue to migrate a virtual machine from qemu 2.11 to qemu
4.2 node. The command using on src node is

*qemu-system-aarch64 -M virt -vnc :2 -rtc base=utc,driftfix=slew -smp 2 -m
4096 -cpu host -enable-kvm -nodefaults -incoming :4443*

on the dst node, the command is


*qemu-system-aarch64 -M virt-2.11 -enable-kvm -cpu host -smp 2 -m 4096
-incoming tcp::4443 -rtc base=utc,driftfix=slew -nodefaults  *

after running migrate tcp:localhost:4443, the dest machine failed with
following message

Segmentation fault (core dumped)

I try to debug and find the following trace: *0xaaab0f07262c in
armv7m_nvic_neg_prio_requested (opaque=0x0, secure=false) at
/root/qemu-4.2.1/hw/intc/armv7m_nvic.c:391*.

After some investigation, I believe the issue is from
*https://elixir.bootlin.com/qemu/v4.2.1/source/target/arm/helper.c#L11134
<https://elixir.bootlin.com/qemu/v4.2.1/source/target/arm/helper.c#L11134>*
and *ARM_FEATURE_M *'s value is changed from 2.11 to 4.2.

My question is do we support migrating from 2.11 to 4.2  on aarch64
platform? Thank you much for the help
-- 

Best Regards,

Jiatong Shen


Re: migrate from qemu 2.11 to qemu 4.2 failed on arm machine

2023-01-30 Thread Jiatong Shen
Thank you very much for the information!

Best,
Jiatong Shen

On Mon, Jan 30, 2023 at 6:46 PM Peter Maydell 
wrote:

> On Mon, 30 Jan 2023 at 06:53, Jiatong Shen  wrote:
> >
> > Hello community experts,
> >
> >I am facing an issue to migrate a virtual machine from qemu 2.11 to
> qemu 4.2 node. The command using on src node is
> >
> > qemu-system-aarch64 -M virt -vnc :2 -rtc base=utc,driftfix=slew -smp 2
> -m 4096 -cpu host -enable-kvm -nodefaults -incoming :4443
> >
> > on the dst node, the command is
> >
> > qemu-system-aarch64 -M virt-2.11 -enable-kvm -cpu host -smp 2 -m 4096
> -incoming tcp::4443 -rtc base=utc,driftfix=slew -nodefaults
> >
> > after running migrate tcp:localhost:4443, the dest machine failed with
> following message
> >
> > Segmentation fault (core dumped)
> >
> > I try to debug and find the following trace: 0xaaab0f07262c in
> armv7m_nvic_neg_prio_requested (opaque=0x0, secure=false) at
> /root/qemu-4.2.1/hw/intc/armv7m_nvic.c:391.
> >
> > After some investigation, I believe the issue is from
> https://elixir.bootlin.com/qemu/v4.2.1/source/target/arm/helper.c#L11134
> and ARM_FEATURE_M 's value is changed from 2.11 to 4.2.
> >
> > My question is do we support migrating from 2.11 to 4.2  on aarch64
> platform? Thank you much for the help
>
> I think in theory it was supposed to work. In practice,
> both of those releases are very very old, and if it
> doesn't work then it doesn't work. This particular
> migration bug was fixed in commit af903caed9fc62cc
> in 2021 (there is no need to migrate the 'features'
> field at all). If you really need to run 4.2.1 then
> the patch should be easy to backport, but I would
> suggest running a newer QEMU anyway.
>
> thanks
> -- PMM
>


-- 

Best Regards,

Jiatong Shen


migrating between OS with different default PAGE_SIZE configured

2023-05-09 Thread Jiatong Shen
Hello community experts,

   I am trying to migrating virtual machine from one machine to another.
The host machine has the same specs, the only difference is the operating
system. For one OS, it configured with page_size to be 64K, for another it
is 4KB. When I try to execute the migration, migration failed, complaining
acpi table-loader size is different. So my question is how to work around
this constraint and allow live migration?


Thank you very much for the help!

-- 

Best Regards,

Jiatong Shen

The error log is

"Length too large: /rom@etc/table-loader: 0x1 > 0x1000: Invalid
argument"


arm64 disable some feature bit of ID_AA64ISAR0_EL1

2023-05-16 Thread Jiatong Shen
Hello community Experts!

I am doing some experiments with arm64 host machine. The host machine
is kunpeng 920 5251k. I try to boot a virtual machine with the following
command:

qemu-system-aarch64 -cpu cortex-a53 -enable-kvm -smp 1 -m 4096 -M
virt,gic-version=3

Here I have modified the code, and change kvm_target
from QEMU_KVM_ARM_TARGET_CORTEX_A53 to 5(generic arm  v8).

when the vm boots, I try to use lscpu, but I still saw some feature flags
like atomics exist.

So my question is how can I modify aa64isar0 register correctly? Thank you
very much for the generous support!

-- 

Best Regards,

Jiatong Shen


Re: arm64 disable some feature bit of ID_AA64ISAR0_EL1

2023-05-17 Thread Jiatong Shen
Thank you very much for the clarification. Although cpu type cannot be
changed, another
registers like aa64isar0, aa64isar1 could be changed through
KVM_SET_ONE_REG interface,
and then could potentially hide some cpu features from host. Am I right?

Another questions is why does arm64 have some invariant system registers?

thank you very much for the generous support!

Best,

Jiatong Shen

On Wed, May 17, 2023 at 9:13 PM Peter Maydell 
wrote:

> On Wed, 17 May 2023 at 14:06, Peter Maydell 
> wrote:
> >
> > On Wed, 17 May 2023 at 03:23, Jiatong Shen 
> wrote:
> > >
> > > Hello community Experts!
> > >
> > > I am doing some experiments with arm64 host machine. The host
> machine is kunpeng 920 5251k. I try to boot a virtual machine with the
> following command:
> > >
> > > qemu-system-aarch64 -cpu cortex-a53 -enable-kvm -smp 1 -m 4096 -M
> virt,gic-version=3
> > >
> > > Here I have modified the code, and change kvm_target from
> QEMU_KVM_ARM_TARGET_CORTEX_A53 to 5(generic arm  v8).
> >
> > This is part of what is confusing you: this is not a correct change.
> >
> > > when the vm boots, I try to use lscpu, but I still saw some feature
> flags like atomics exist.
> >
> > In a KVM VM you will always see in the guest the exact same
> > CPU type as the host. There is no support in the kernel for
> > showing the guest a different CPU type to what the hardware has.
>
> For clarity, I mean this specifically for the Arm architecture;
> x86 is different and will let you expose a different CPU type
> to the guest.
>
> -- PMM
>


-- 

Best Regards,

Jiatong Shen


Re: arm64 disable some feature bit of ID_AA64ISAR0_EL1

2023-05-17 Thread Jiatong Shen
Thank you very much for detail explanation!

Best,

Jiatong Shen

On Wed, May 17, 2023 at 11:21 PM Peter Maydell 
wrote:

> On Wed, 17 May 2023 at 15:36, Jiatong Shen  wrote:
> >
> > Thank you very much for the clarification. Although cpu type cannot be
> changed, another
> > registers like aa64isar0, aa64isar1 could be changed through
> KVM_SET_ONE_REG interface,
> > and then could potentially hide some cpu features from host. Am I right?
>
> No; as I say, the kernel does not support lying to the guest
> about the values of the ID registers currently. If you try this
> the kernel will return an EINVAL error code.
>
> > Another questions is why does arm64 have some invariant system registers?
>
> You can't from userspace change the value of an ID register because
> the kernel does not support lying to the guest about ID register
> values. You can't change it from the guest because it's architecturally
> a read-only register.
>
> This is not an in-principle impossible thing, it's just a feature the
> kernel doesn't implement. There are some interesting questions about
> how you handle CPU errata where the guest needs to install workarounds,
> which it currently does by looking at the ID registers that tell it
> what implementation it is running on. So there's a combination of
> some unanswered "how do we deal with this" questions, and the fact
> that it's not a small amount of work. Nobody so far who cares about
> having the feature implemented has stepped up to work through those
> questions and do the work. (The kvm-arm mailing list is the best
> place to talk about this for anybody who is interested in that.)
>
> -- PMM
>


-- 

Best Regards,

Jiatong Shen


GPU passthrough memory bandwidth performance degration

2023-07-03 Thread Jiatong Shen
Hello community experts,

  I am testing a passtrhough gpu performance by measuring device to host &
host to device memory copy bandwidth. The tested GPU is nvidia t4. The
benchmarking script I am using is
https://developer.nvidia.com/blog/how-optimize-data-transfers-cuda-cc/.

On the baremetal machine, the result is
[image: image.png]
in the virtual machine, the result is,

[image: image.png]

My question is what could be the reason for the degradation and is there
anything I can do to improve it? Thank you very much for the help.
--

Best Regards,

Jiatong Shen


qemu aarch64 info registers PC register not changing

2023-07-10 Thread Jiatong Shen
Hello community experts,

I am trying to learn some arm64 basics using qemu. I would like to
retrieve a register value
through hmp command info register. The output is

virsh # qemu-monitor-command --hmp eefcdf53-2fd5-40ee-91a8-858b3e621fc5
info registers -a

CPU#0
 PC=48a3f2aa2a30 X00=48a3f4203ed0 X01=48a3f3d30018
X02= X03=a8c1ce2ef988 X04=601e0c1d
X05=001e458eb800 X06=a8c1fff07c00 X07=
X08=48a3f422de10 X09=48a3f4203e70 X10=0970
X11=0001 X12= X13=0298
X14=0400 X15=0400 X16=
X17= X18= X19=48a3f3d30018
X20=0001 X21=48a3f4224200 X22=48a3f3d4ac70
X23=48a3f4224224 X24= X25=48a3f422d440
X26= X27=000138315520 X28=dce8f330
X29=48a3f4203ed0 X30=48a3f2a87288  SP=48a3f4203ed0
PSTATE=60c00085 -ZC- EL1h FPCR= FPSR=
Q00=2525252525252525:2525252525252525 Q01=6568632068746170:0a68
Q02=000a707520747261:7473207372656b63 Q03=:
Q04=ff00: Q05=:401004014010
Q06=4000: Q07=4010040140100401:4010040140100401
Q08=:aaac80fcc388 Q09=:aaac85269150
Q10=: Q11=:
Q12=: Q13=:
Q14=: Q15=:
Q16=40005550:40005550 Q17=0008:00088000
Q18=0800: Q19=:
Q20=: Q21=:
Q22=: Q23=:
Q24=: Q25=:
Q26=: Q27=:
Q28=: Q29=:
Q30=: Q31=:

CPU#1
 PC=48a3f2aa2a30 X00=a8c1c496bf10 X01=48a3f3d30018
X02= X03=199a X04=601e0c20
X05=00ff X06=0002f6633c0c X07=601e0c20
X08=a8c1c48ea8d0 X09=a8c1c496beb0 X10=0970
X11=0001 X12= X13=0381
X14=0400 X15=0400 X16=
X17= X18= X19=48a3f3d30018
X20=0002 X21=48a3f4224200 X22=48a3f3d4ac70
X23=48a3f4224224 X24= X25=a8c1c48e9f00
X26= X27= X28=
X29=a8c1c496bf10 X30=48a3f2a87288  SP=a8c1c496bf10
PSTATE=60c00085 -ZC- EL1h FPCR= FPSR=0010
Q00=: Q01=:aaab83310a33
Q02=3020302032203020:3639332032333531 Q03=:0400
Q04=: Q05=4010040140100401:4010040140100401
Q06=0004:0004 Q07=4010040140100401:4010040140100401
Q08=:0002 Q09=:
Q10=: Q11=:
Q12=: Q13=:
Q14=: Q15=:
Q16=55540010:55540010 Q17=a00aa00aa00aa00a:
Q18=8020080280200802:8020080280200802 Q19=:
Q20=: Q21=:
Q22=: Q23=:
Q24=: Q25=:
Q26=: Q27=:
Q28=: Q29=:
Q30=: Q31=:

every time I issue the command, PC register is always the value. My
question is should PC value be changed every time an instruction completes?
Thank you very much.

The qemu version is 4.2.1. And the virtual machine is accelerated by KVM.
-- 

Best Regards,

Jiatong Shen


Re: qemu aarch64 info registers PC register not changing

2023-07-13 Thread Jiatong Shen
Thank you for your answer.

I tried to build an qemu 6.2.0 binary and looks like PC register value is
still unchanged.

virsh # version
Compiled against library: libvirt 7.8.0
Using library: libvirt 7.8.0
Using API: QEMU 7.8.0
Running hypervisor: QEMU 6.2.0

virsh # qemu-monitor-command --hmp 1 info registers
 PC=a2bbf4a7c68c X00=7ee4af45b6c0 X01=0006ab6c
X02=7ee4af45b7e0 X03=0006ab6a X04=dc28ba056000
X05=01ff X06=0184d0f83120 X07=
X08=a2bbf573d950 X09=a2bbf4a88128 X10=0eb0
X11= X12= X13=0001
X14= X15= X16=a2bbf43b6f20
X17= X18= X19=a2bbf53ed000
X20= X21= X22=a2bbf57326a8
X23=22bbe3dc X24=00203baa33d0 X25=
X26=0004 X27= X28=0006fd896380
X29=a2bbf5723ea0 X30=a2bbf4a7c6f8  SP=a2bbf5723ea0
PSTATE=60400085 -ZC- EL1h FPCR= FPSR=
Q00=: Q01=37315b7374726170:2d6e75722033313a
Q02=0f51:00203a5d3735 Q03=f00f:f00ff000f000
Q04=f00ff00ff00ff00f:f00ff00ff00ff00f Q05=ff00fff000f0:ff00fff000f0
Q06=c000cc00:c000cc00 Q07=:
Q08=: Q09=:
Q10=: Q11=:
Q12=: Q13=:
Q14=: Q15=:
Q16=: Q17=:
Q18=: Q19=:
Q20=: Q21=:
Q22=: Q23=:
Q24=: Q25=:
Q26=: Q27=:
Q28=: Q29=:
Q30=: Q31=:

Is it possible to get the instruction corresponding to the PC pointed
address?

Thank you very much for your generous help!

Best,
Jiatong Shen

On Mon, Jul 10, 2023 at 5:45 PM Peter Maydell 
wrote:

> On Mon, 10 Jul 2023 at 09:12, Jiatong Shen  wrote:
> >
> > Hello community experts,
> >
> > I am trying to learn some arm64 basics using qemu. I would like to
> retrieve a register value
> > through hmp command info register. The output is
> >
> > virsh # qemu-monitor-command --hmp eefcdf53-2fd5-40ee-91a8-858b3e621fc5
> info registers -a
>
> > every time I issue the command, PC register is always the value. My
> question is should PC value be changed every time an instruction completes?
> Thank you very much.
> >
> > The qemu version is 4.2.1. And the virtual machine is accelerated by KVM.
>
> It's worth looking at what that PC is in the guest,
> and what the guest is doing. If the guest is not particularly
> doing much, then it's very likely that almost all of the time
> when you look at it you'll find that the guest PC is pointing
> to the WFI in the guest kernel's idle loop.
>
> Other than that, QEMU 4.2.1 is pretty old, especially in
> Arm terms (where KVM support has not been so mature for
> as long as x86); so you could check whether a newer QEMU
> also behaves the same way.
>
> thanks
> -- PMM
>


-- 

Best Regards,

Jiatong Shen


does windows 2012 supports memory hot plugging on qemu 6.2

2023-08-10 Thread Jiatong Shen
Hello community experts,

  We are using qemu version 6.2 and are trying to do memory hotplugging for
windows 2012 std edition. The libvirt dimm configuration is appended below.
The problem I am facing is after dimm is attached, in guest the device is
shown as an unknown device and driver pnpmem.sys cannot properly handle the
device. I also tried qemu 4.2 and it seems to be working fine.

  So my question is is windows 2012 supports memory hot plugging on qemu
6.2? And where can I find some logs to identify the issue? Thank you.


-- 

Best Regards,

Jiatong Shen


the dimm device xml looks like,

  
4194304
0
  
  
  



how to saving some memory for windows virtual machine

2023-08-23 Thread Jiatong Shen
Hello community experts,

I am researching on saving host memory for windows virtual machines and
over committing host memory. Right now the issue is after windows virtual
machine boots, the qemu process's rss will be the same as memory given by
-m option very quickly compared with linux guest. Right now, I am thinking
it is because windows is actively zeroing out free pages (by zero-page
thread?). I am thinking about KSM, but it does not work if multiple windows
virtual machines boot together and user cannot let KSM to processing a
given process. So my question is is there other way to save windows virtual
machine's memory other than KSM? Thank you very much for helping.

-- 

Best Regards,

Jiatong Shen


how to debug kvm run failed bad address error

2023-09-07 Thread Jiatong Shen
Hello community experts,

   I want to ask how to debug errors like follows,

error: kvm run failed Bad address
 PC=b51041a8 X00=1240c034 X01=0001
X02= X03=1240c0340600 X04=fffdc048c34a
X05=1240c034068a X06= X07=
X08= X09= X10=
X11= X12=0300 X13=0001
X14= X15= X16=8395ee40
X17=b5104050 X18=b51d4a70 X19=843d4000
X20=0001 X21=d98cec30 X22=1240c034
X23=068a X24=8ea0abc8 X25=fffdc162a020
X26= X27=068a X28=d6f65fd0
X29=8ea0a9a0 X30=83930f80  SP=8ea0a9a0
PSTATE=80001000 N--- EL0t

It is an aarch64 virtual machine and qemu version is 4.2.0. The host is
running an openEuler 22.03 Linux system with kernel 5.10. I am trying to
passthrough an huawei ascend NPU to virtual machine and when above error
message appears, the vm is paused.

My question is how to make sense of this output and find out the root
cause. Thank you very much for the help.

-- 

Best Regards,

Jiatong Shen


the qemu commad is in attachment
/usr/bin/qemu-system-aarch64 \
-name guest=instance-4e08,debug-threads=on \
-S \
-object 
secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain-55-instance-4e08/master-key.aes
 \
-blockdev 
'{"driver":"file","filename":"/usr/share/AAVMF/AAVMF_CODE.fd","node-name":"libvirt-pflash0-storage","auto-read-only":true,"discard":"unmap"}'
 \
-blockdev 
'{"node-name":"libvirt-pflash0-format","read-only":true,"driver":"raw","file":"libvirt-pflash0-storage"}'
 \
-blockdev 
'{"driver":"file","filename":"/var/lib/libvirt/qemu/nvram/instance-4e08_VARS.fd","node-name":"libvirt-pflash1-storage","auto-read-only":true,"discard":"unmap"}'
 \
-machine 
virt-4.2,accel=kvm,usb=off,dump-guest-core=off,gic-version=3,pflash0=libvirt-pflash0-format,pflash1=libvirt-pflash1-format
 \
-cpu host \
-m 65536 \
-overcommit mem-lock=off \
-smp 16,sockets=16,cores=1,threads=1 \
-uuid 8f2064ea-b017-48f2-9ee8-9c1df29f287b \
-no-user-config \
-nodefaults \
-chardev socket,id=charmonitor,fd=38,server,nowait \
-mon chardev=charmonitor,id=monitor,mode=control \
-rtc base=utc,driftfix=slew \
-no-shutdown \
-boot strict=on \
-device 
pcie-root-port,port=0x8,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x1 
\
-device pcie-root-port,port=0x9,chassis=2,id=pci.2,bus=pcie.0,addr=0x1.0x1 \
-device pcie-root-port,port=0xa,chassis=3,id=pci.3,bus=pcie.0,addr=0x1.0x2 \
-device pcie-root-port,port=0xb,chassis=4,id=pci.4,bus=pcie.0,addr=0x1.0x3 \
-device pcie-root-port,port=0xc,chassis=5,id=pci.5,bus=pcie.0,addr=0x1.0x4 \
-device pcie-root-port,port=0xd,chassis=6,id=pci.6,bus=pcie.0,addr=0x1.0x5 \
-device pcie-root-port,port=0xe,chassis=7,id=pci.7,bus=pcie.0,addr=0x1.0x6 \
-device pcie-root-port,port=0xf,chassis=8,id=pci.8,bus=pcie.0,addr=0x1.0x7 \
-device 
pcie-root-port,port=0x10,chassis=9,id=pci.9,bus=pcie.0,multifunction=on,addr=0x2
 \
-device pcie-root-port,port=0x11,chassis=10,id=pci.10,bus=pcie.0,addr=0x2.0x1 \
-device pcie-root-port,port=0x12,chassis=11,id=pci.11,bus=pcie.0,addr=0x2.0x2 \
-device pcie-root-port,port=0x13,chassis=12,id=pci.12,bus=pcie.0,addr=0x2.0x3 \
-device pcie-root-port,port=0x14,chassis=13,id=pci.13,bus=pcie.0,addr=0x2.0x4 \
-device pcie-root-port,port=0x15,chassis=14,id=pci.14,bus=pcie.0,addr=0x2.0x5 \
-device pcie-root-port,port=0x16,chassis=15,id=pci.15,bus=pcie.0,addr=0x2.0x6 \
-device qemu-xhci,id=usb,bus=pci.3,addr=0x0 \
-device virtio-scsi-pci,id=scsi0,bus=pci.2,addr=0x0 \
-device virtio-serial-pci,id=virtio-serial0,bus=pci.4,addr=0x0 \
-object 
secret,id=libvirt-2-storage-secret0,data=udkUid/sikiVSuP9MfreiH3utxXjsYbgFCFka65VzjA=,keyid=masterKey0,iv=ljn2HbTx+vK9269AZ84fKA==,format=base64
 \
-device 
scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=0,device_id=drive-scsi0-0-0-0,drive=libvirt-2-format,id=scsi0-0-0-0,bootindex=1,write-cache=on
 \
-object 
secret,id=libvirt-1-storage-secret0,data=LrGlHpygimvJ3WtUaq0BOft4Wa7xOQUA9vVFowq2T1s=,keyid=masterKey0,iv=X+ff6w+cCASaxqM8V57YGw==,format=base64
 \
-device 
scsi-hd,bus=scsi0.0,channel=0,scsi-id=0,lun=1,device_id=drive-scsi0-0-0-1,drive=libvirt-1-format,id=scsi0-0-0-1,write-cache=on
 \
-device 
virtio-net-pci,mq=on,vectors=34,host_mtu=1500,netdev=hostnet0,id=net0,mac=fa:16:3e:bb:e2:ab,bus=pci.1,addr=0x0
 \
-serial chardev:charserial0 \
-chardev socket,id=charchannel0,fd=71,server,nowait \
-device 
virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=org.qemu.guest_agent.0
 \
-device usb-tablet,id=input0,bus=u

pci passhthrough device's pci mem cannot mapped

2023-10-30 Thread Jiatong Shen
Hello community experts,

  I am using a 4.2.0 versioned qemu and passthrough an A40 (48G GPU
memory). When I start the virtual machine with following option "-m
size=4096M,slots=2,maxmem=1T ", the virtual machine could boot but the in
the VM I saw lspci failed to find bar1 and kernel message attached in the
end of the mail.

root@a40-test:~# lspci -s 00:08.0 -vvv

00:08.0 3D controller: NVIDIA Corporation Device 2235 (rev a1)

Subsystem: NVIDIA Corporation Device 145a

Physical Slot: 8

Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr+
Stepping- SERR+ FastB2B- DisINTx-

Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- SERR-  (64-bit, prefetchable)

Region 3: Memory at c000 (64-bit, prefetchable) [size=32M]


I tried 6.2.0 with the same options and it works without problem. So my
question what might cause the problem and why. Thank you very much for help.





-- 

Best Regards,

Jiatong Shen

kernel message:

[mem 0xc000-0xfeffbfff] available for PCI devices

[Thu Oct 26 15:16:42 2023] pci :00:03.0: [10de:2235] type 00 class
0x030200

[Thu Oct 26 15:16:42 2023] pci :00:03.0: reg 0x10: [mem
0xfb00-0xfbff]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: reg 0x14: [mem
0x110-0x11f 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: reg 0x1c: [mem
0x120-0x12001ff 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: Enabling HDA controller

[Thu Oct 26 15:16:42 2023] pci :00:03.0: PME# supported from D0 D3hot

[Thu Oct 26 15:16:42 2023] pci :00:03.0: 32.000 Gb/s available PCIe
bandwidth, limited by 2.5 GT/s x16 link at :00:03.0 (capable of 252.048
Gb/s with 16 GT/s x16 link)

[Thu Oct 26 15:16:42 2023] pci :00:03.0: can't claim BAR 1 [mem
0x110-0x11f 64bit pref]: no compatible bridge window

[Thu Oct 26 15:16:42 2023] pci :00:03.0: can't claim BAR 3 [mem
0x120-0x12001ff 64bit pref]: no compatible bridge window

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 1: no space for [mem size
0x10 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 1: trying firmware
assignment [mem 0x110-0x11f 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 1: [mem
0x110-0x11f 64bit pref] conflicts with PCI mem [mem
0x-0xff]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 1: failed to assign [mem
size 0x10 64bit pref]

[Thu Oct 26 15:16:42 2023] pci :00:03.0: BAR 3: assigned [mem
0xc000-0xc1ff 64bit pref]

NVRM: BAR1 is 0M @ 0x0 (PCI::00:03.0)

[Thu Oct 26 15:16:46 2023] nvidia: probe of :00:03.0 failed with error
-1

NVRM: BAR1 is 0M @ 0x0 (PCI::00:03.0)

[Thu Oct 26 15:16:47 2023] nvidia: probe of :00:03.0 failed with error
-1


My command looks like ,


qemu-system-x86_64 -cpu host -smp 2 -m 4096 \

-enable-kvm -device vfio-pci,host=:4b:00.0 \

-drive file=test,if=virtio,format=raw \

-netdev user,id=net0,hostfwd=tcp::12-:22 \

-device virtio-net-pci,netdev=net0 \

-vnc 0.0.0.0:70


Re: pci passhthrough device's pci mem cannot mapped

2023-11-04 Thread Jiatong Shen
thank you very much for the reply.

in the end, I believe it is `object_property_set_bool(OBJECT(cpu),
"host-phys-bits", true, &error_abort);` in target/i386/host-cpu.c does the
trick.. I can make
the passthrough device work if I specify `-cpu max,host-phys-bits=true` in
qemu 4.2.0.

Thank you very much for the help.

Best Regards,
Jiatong Shen

On Tue, Oct 31, 2023 at 6:58 PM Peter Maydell 
wrote:

> On Tue, 31 Oct 2023 at 06:51, Jiatong Shen  wrote:
> >
> > Hello community experts,
> >
> >   I am using a 4.2.0 versioned qemu and passthrough an A40 (48G GPU
> memory). When I start the virtual machine with following option "-m
> size=4096M,slots=2,maxmem=1T ", the virtual machine could boot but the in
> the VM I saw lspci failed to find bar1 and kernel message attached in the
> end of the mail.
>
> > I tried 6.2.0 with the same options and it works without problem. So my
> question what might cause the problem and why. Thank you very much for help.
>
> (I assume when you say "a 4.2.0 versioned qemu" you mean that
> you're using version 4.2 of QEMU, not that you're using a
> 4.2-versioned machine type with a newer version of the QEMU
> binary, given the command line that you say you're using.)
>
> For problems of the form "this didn't work in QEMU version X,
> but it does work in newer QEMU Y", the obvious guess is
> "this was a bug, and we fixed it in the later version".
> So if the newer version works for you I would recommend using
> it -- 4.2 is now very old, and it's unlikely anybody will
> be particularly interested in doing the work to try to figure
> out what was going on in such an old version of QEMU, unless
> you have a support contract with them...
>
> thanks
> -- PMM
>


-- 

Best Regards,

Jiatong Shen


Help on 146818 rtc caused VM crash

2024-10-28 Thread Jiatong Shen
Hello QEMU Experts,

I want to get some help on a VM crash that happens after time on
the host is moved backwards.  The same issue seems to have been
reported on the RedHat website as well
(https://bugzilla.redhat.com/show_bug.cgi?id=2228406).

   The virtual machine crashes is a windows guest created by OpenStack
where HPET, timer, etc are not enabled.

   I have try to upload a patch to the mailing list and could you
please review it
(https://lists.gnu.org/archive/html/qemu-devel/2024-10/msg02557.html)
and leave me some feedback? Thank you very much.

-- 

Best Regards,

Jiatong Shen



RBD timeout 0 and QEMU process stuck during migration

2024-12-20 Thread Jiatong Shen
Hello Experts,

   We are using QEMU 6.2 and Ceph Pacific on production. The ceph mon
and osd operation timeout is defaulting to 0 which IMO means never
timeout. Under this setup, we observe that during live migration if
the RBD network is unstable, the virtual machine could become
unresponsive (for example, virsh domjobinfo command is stuck
indefinitely).
   My question is is there any recommendation for this situation? can
I possibly cancel live migration under such circumstances?


-- 

Best Regards,

Jiatong Shen



how to force detaching disk

2025-04-05 Thread Jiatong Shen
Hello Experts,

   I want to ask if there is a way to force detaching a disk from a running
QEMU virtual machine and thus not care about potential data loss. The
question comes from observation that if there is an on-going IO, Windows
guest will refuse to response to hot-unplug request.



-- 

Best Regards,

Jiatong Shen


How to convert ovf image to qcow2

2025-03-04 Thread Jiatong Shen
Hello Experts,

I am looking for materials on converting OVF format to qcow2. I use
qemu-img convert command and it complains ovf is not supported. I
found libguestfs seems to have implemented such tools. Does QEMU
community plans to implementing ovf as a block backend? Thank you.

-- 

Best Regards,

Jiatong Shen



Re: introduce new dependency

2025-02-21 Thread Jiatong Shen
Thank you for your answer.

On Fri, Feb 21, 2025 at 8:06 PM Thomas Huth  wrote:
>
> On 21/02/2025 11.21, Jiatong Shen wrote:
> > Hello Experts,
> >
> > I am analyzing introducing new dependencies to support more sm4
> > encryption features. The library I want to try to combine is GmSSL
> > which is licensed under Apache 2.0. Is it compatible with the QEMU
> > code base? Thank you very much for the help.
>
> No, sorry, the Apache License 2.0 is not compatible with GPLv2 that QEMU
> uses, see:
>
>   https://www.gnu.org/licenses/license-list.html#apache2
>
>Thomas
>


-- 

Best Regards,

Jiatong Shen



introduce new dependency

2025-02-21 Thread Jiatong Shen
Hello Experts,

   I am analyzing introducing new dependencies to support more sm4
encryption features. The library I want to try to combine is GmSSL
which is licensed under Apache 2.0. Is it compatible with the QEMU
code base? Thank you very much for the help.

-- 

Best Regards,

Jiatong Shen