Re: [Qemu-discuss] Hardware component emulation

2016-07-18 Thread Federico Vaga
On Sunday, 17 July 2016 18:56:25 CEST Peter Maydell wrote:
> On 16 July 2016 at 23:38, Federico Vaga  wrote:
> > I'm super new to qemu and I would like to understand more about the
> > hardware components emulation. I surfed for some hours on the internet
> > but I cannot find much help.
> > By looking at the source code in the 'hw' directory of the qemu git
> > repository I can vaguely guess how it works but I would like to see some
> > explainations: a manual.
> 
> Sorry, we don't really have much internals documentation. The
> source code is the most accurate reference. 

It's a pity :(
If we end up to use QEMU maybe I will write a couple of lines :)

> Most devices are
> fairly straightforward: they implement one (occasionally more)
> MemoryRegion, which corresponds to a bank of registers that
> will be mapped into the emulated system's address maps. And
> they provide also some interrupt (irq) lines and perhaps some
> input or output GPIO lines.

What device would you suggest to look at?

> > Then a question. Are these hardware modules dynamically loadable by qemu
> > as
> > external modules? I mean, can I compile a hardware component out of the
> > qemu tree and load it in the qemu I get from the distro? In other words:
> > I would like to have something like Linux kernel modules (.ko) that I
> > attach to qemu when I launch it.
> 
> No, we don't have devices as modules. We do have some module
> support, but this is intended primarily to allow distributions
> to split out parts of QEMU which have dependencies on
> external shared libraries, so that users who don't need
> (for instance) the glusterfs support can just not install
> the optional QEMU modules rather than having to pull in
> a lot of dependent packages for a feature they're not using.
> Our modules code (deliberately) does not support loading a
> module from one compile into a QEMU built with another
> compile -- there is no stable API/ABI within QEMU.  So
> loading a separate module into a distro-supplied QEMU will
> not work.

I see.
Does it make sense to have it at some point in the future?

-- 
Federico Vaga



[Qemu-discuss] guest can not find my attached physical disk

2016-07-18 Thread wk
hi:   I attach a phyical disk to my qemu guest os successfully.But guest 
can not find the disk. Please give some advise?
   Below is my steps(opentest  os host os, test1  is guest os)


[root@opentest ~]# virsh attach-disk instance-0001 /dev/performance_disk1 
vdb --cache none --config --type disk
Disk attached successfully
[root@opentest ~]# virsh attach-disk instance-0001 /dev/performance_disk1 
vdb --cache none --config --type disk
error: Failed to attach disk
error: Requested operation is not valid: target vdb already exists


[root@opentest ~]# virsh qemu-monitor-command instance-0001 --hmp 'info 
block'
drive-virtio-disk0: removable=0 io-status=ok 
file=/opt/stack/data/nova/instances/828fd857-a957-4c17-b200-71d109585dd5/disk 
backing_file=/opt/stack/data/nova/instances/_base/3f82096f9c9d65312ae01acd864fc4d255ea3872
 backing_file_depth=1 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 
iops_rd=0 iops_wr=0
drive-ide0-1-1: removable=1 locked=1 tray-open=0 io-status=ok 
file=/opt/stack/data/nova/instances/828fd857-a957-4c17-b200-71d109585dd5/disk.config
 ro=1 drv=raw encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0




host os:
[root@opentest ~]# uname -a
Linux opentest 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 
x86_64 x86_64 GNU/Linux
[root@opentest ~]# cat /etc/redhat-release 
CentOS Linux release 7.0.1406 (Core) 


[root@opentest ~]#  /usr/libexec/qemu-kvm -version
QEMU emulator version 1.5.3 (qemu-kvm-1.5.3-105.el7_2.4), Copyright (c) 
2003-2008 Fabrice Bellard
[root@opentest ~]# qemu-img --help | grep version
qemu-img version 1.5.3, Copyright (c) 2004-2008 Fabrice Bellard
   conversion. If the number of bytes is 0, the source will not be scanned 
for
[root@opentest ~]# virsh -V
Virsh command line tool of libvirt 1.2.17
See web site at http://libvirt.org/


Compiled with support for:
 Hypervisors: QEMU/KVM LXC ESX Test
 Networking: Remote Network Bridging Interface netcf Nwfilter VirtualPort
 Storage: Dir Disk Filesystem SCSI Multipath iSCSI LVM RBD Gluster
 Miscellaneous: Daemon Nodedev SELinux Secrets Debug DTrace Readline Modular
 


guest os??
[root@test1 centos]# cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)

[Qemu-discuss] ASan'ed binaries start up very slow under qemu-aarch64.

2016-07-18 Thread Maxim Ostapenko

Hi!

When testing AddressSanitizer tool for AArch64 under qemu-aarch64 (user 
mode), I found out that even trivial helloworld apps start extremely 
slow (~2 seconds). I've investigated this a bit and noticed that QEMU 
actually freezes in large mmaps and subsequent reads of /proc/self/maps. 
Here a scenario I observed:


1) AddressSanitizer mmaps quite large regions of memory for redzones and 
shadow gap. In particular, for 39-bit AS it mmapes:


|| `[0x14, 0x1f]` || HighShadow || - 48 Gb
|| `[0x12, 0x13]` || ShadowGap  || - 8 Gb
|| `[0x10, 0x11]` || LowShadow  || - 4 Gb

2) In QEMU, page_set_flags is called for these ranges. It cuts given 
range to individual pages and sets flags for them.  Given the page size 
is 4 Kb, for 8 Gb range we have 2097152 iterations and for 48 Gb 
12582912 iterations in inner loop. This is obviously a performance 
bottleneck.


3) Same issue may happen when ASan tries to read /proc/self/map later in 
page_check_range function, after it already mmaped HighShadow, ShadowGap 
and LowShadow regions.


Could someone help me, how can I mitigate this performance issue? Do we 
really need to set flags to each page on entire (quite big) memory region?


Thanks,
-Maxim



Re: [Qemu-discuss] ASan'ed binaries start up very slow under qemu-aarch64.

2016-07-18 Thread Peter Maydell
(CCing qemu-devel, which is more likely to get developer attention)

On 18 July 2016 at 15:45, Maxim Ostapenko  wrote:
> 1) AddressSanitizer mmaps quite large regions of memory for redzones and
> shadow gap. In particular, for 39-bit AS it mmapes:
>
> || `[0x14, 0x1f]` || HighShadow || - 48 Gb
> || `[0x12, 0x13]` || ShadowGap  || - 8 Gb
> || `[0x10, 0x11]` || LowShadow  || - 4 Gb
>
> 2) In QEMU, page_set_flags is called for these ranges. It cuts given range
> to individual pages and sets flags for them.  Given the page size is 4 Kb,
> for 8 Gb range we have 2097152 iterations and for 48 Gb 12582912 iterations
> in inner loop. This is obviously a performance bottleneck.

Mmm, the algorithm here is pretty simple and basically assumes the
guest isn't going to be doing enormous allocations like that.
(If the host process doesn't happen to have a suitable big lump of its
VA space free then the mmap will fail anyway.)

> 3) Same issue may happen when ASan tries to read /proc/self/map later in
> page_check_range function, after it already mmaped HighShadow, ShadowGap and
> LowShadow regions.
>
> Could someone help me, how can I mitigate this performance issue? Do we
> really need to set flags to each page on entire (quite big) memory region?

Well, we do need to do some things:
 * we're populating the PageDesc data structure which we later use
   to cache generated code
 * if we're marking the range as writeable and it wasn't previously
   writeable, we need to check whether there's already generated code
   anywhere in this memory range and invalidate those translations

This could probably be done in a way that doesn't iterate naively
through every page, though.

thanks
-- PMM



[Qemu-discuss] qemu kvm problem

2016-07-18 Thread Yuxin Ren
Hi all,

When I start qemu, I got such error message

'''
Could not access KVM kernel module: No such file or directory
failed to initialize KVM: No such file or directory
Back to tcg accelerator.
'''

Does anyone know how to solve this problem?

Thanks a lot!!
Yuxin



Re: [Qemu-discuss] [problem] QEMU-GA & Windows 10

2016-07-18 Thread Frank Sfalanga Jr .
Hi Dominique,

Just returned from my trip.  Thank you for your patience. As requested,
here is a copy of the XML for this VM on the host:


  Windows10
  b69f4f7e-84db-faf5-0f93-9b14babdba78
  12617728
  12617728
  4
  
hvm

  
  



  
  
Haswell
Intel





















  
  
  destroy
  restart
  restart
  
/usr/bin/kvm-spice

  
  
  
  


  
  
  
  
  


  



  


  


  
  
  
  


  


  






  


  
  


  

  


I do not see anything related to 



This is what is returned when looking for the channel:

# ls -lh /var/lib/libvirt/qemu/channel
ls: cannot access /var/lib/libvirt/qemu/channel: No such file or
directory

-

Thank you in advance for any direction you can provide.

Kind regards,

-Frank


-Original Message-
From: Dominique Ramaekers 
To: Frank Sfalanga Jr. ,
qemu-discuss@nongnu.org 
Subject: RE: [problem] QEMU-GA & Windows 10
Date: Thu, 14 Jul 2016 09:30:33 +


> -Oorspronkelijk bericht-
> Van: Qemu-discuss [mailto:qemu-discuss-
> bounces+dominique.ramaekers=cometal...@nongnu.org] Namens Frank
> Sfalanga Jr.
> Verzonden: dinsdag 12 juli 2016 19:31
> Aan: qemu-discuss@nongnu.org
> Onderwerp: [Qemu-discuss] [problem] QEMU-GA & Windows 10
> 
> Hello,
> 
> Ubuntu 14.04LTS
> KVM/Qemu
> 
> After a bit of struggle I was recently able to get Windows 10 running in a VM
> with kvm/qemu.  I have the virtio drivers installed and have converted the
> disk to the .qcow2 file system.
> 
> The last piece of the puzzle is getting the QEMU GUEST AGENT working.
> I've googled around and found reports of people successfully upgrading
> Windows 7 to Windows 10 but cannot find any reports of success using
> qemu guest agent with a Windows 10 clean install.

I've done it with little trouble.

> 
> My issue specifically is that the QEMU GUEST AGENT VSS PROVIDER will start
> if I do it manually, the GUEST AGENT itself will not, ever.  I receive the
> following error:
> 
> 
> ERROR 1053: The service did not respond to the start or control request in a
> timely fashion.
> 
> 

Please post the xml of the guest...

You should be able to find something like this in the xml:

  
  
  
  


If not, please make sure the location for the channel exist and has the correct 
access rights:

root@CmsrvVH3:~# ls -lh /var/lib/libvirt/qemu/channel
totaal 4,0K
drwxr-xr-x 10 libvirt-qemu kvm 4,0K jul  1 08:57 target

> Hopefully there is a fix, or you can point me to the correct mailing list if 
> this
> is not it.
> 
> Thank you in advance.
> 
> Kind regards,
> 
> -Frank
> 

Sorry about the late reply...


-- 
Frank Sfalanga Jr | Director, Information Technology & Application
Services
Ph. 239-221-3309 | fr...@csiglobalvcard.com
3301 Bonita Beach Road #300 | Bonita Springs | FL | 34134
Celebrating 25 years of corporate payment innovation

  


This message and any attachments are intended solely for the use of the
intended recipient(s) and may contain information that is privileged,
confidential or proprietary of CSI Enterprises, Inc. If you are not an
intended recipient, please notify the sender, and then please delete and
destroy all copies and attachments, and be advised that any review or
dissemination of, or the taking of any action in reliance on, the
information contained in or attached to this message is prohibited. 







Re: [Qemu-discuss] qemu kvm problem

2016-07-18 Thread Joshua Cannell
Sounds to me like you're missing the kernel module?

What is the output of:

ls -l /dev/kvm

If you don't see anything or it throws an error, then you're missing the
kernel module.

On Mon, Jul 18, 2016 at 11:36 AM, Yuxin Ren  wrote:

> Hi all,
>
> When I start qemu, I got such error message
>
> '''
> Could not access KVM kernel module: No such file or directory
> failed to initialize KVM: No such file or directory
> Back to tcg accelerator.
> '''
>
> Does anyone know how to solve this problem?
>
> Thanks a lot!!
> Yuxin
>
>


-- 
Joshua Cannell


Re: [Qemu-discuss] qemu kvm problem

2016-07-18 Thread Yuxin Ren
Thank you for your reply.

the output is
ls: cannot access /dev/kvm: No such file or directory

How can I solve this problem?

Thank you again
Yuxin

On Mon, Jul 18, 2016 at 4:06 PM, Joshua Cannell  wrote:
> Sounds to me like you're missing the kernel module?
>
> What is the output of:
>
> ls -l /dev/kvm
>
> If you don't see anything or it throws an error, then you're missing the
> kernel module.
>
> On Mon, Jul 18, 2016 at 11:36 AM, Yuxin Ren  wrote:
>>
>> Hi all,
>>
>> When I start qemu, I got such error message
>>
>> '''
>> Could not access KVM kernel module: No such file or directory
>> failed to initialize KVM: No such file or directory
>> Back to tcg accelerator.
>> '''
>>
>> Does anyone know how to solve this problem?
>>
>> Thanks a lot!!
>> Yuxin
>>
>
>
>
> --
> Joshua Cannell
>



Re: [Qemu-discuss] qemu kvm problem

2016-07-18 Thread Fam Zheng
On Mon, 07/18 16:36, Yuxin Ren wrote:
> Thank you for your reply.
> 
> the output is
> ls: cannot access /dev/kvm: No such file or directory
> 
> How can I solve this problem?

modprobe kvm_intel (or kvm_amd depending on your CPU type).

Fam