Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] VM compiling optimization
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
djdkf343
n00b
n00b


Joined: 28 Jul 2016
Posts: 32

PostPosted: Fri Dec 09, 2016 10:39 am    Post subject: [SOLVED] VM compiling optimization Reply with quote

Hello,im creating Gentoo VM with 10GB RAM and 20GB swap with 3 CPU cores (my host have 4 CPU cores) and last step emerging grub,system just froze,i guess its luck of RAM or CPU power,emerging KDE,Plasma desktops have the same issue,looking for best VM solution.

There is MAKEOPTS and EMERGE_DEFAULT_OPTS,but dont know what would be the best,maybe there is some other solutions?

Thanks.


Last edited by djdkf343 on Sat Dec 17, 2016 5:23 pm; edited 1 time in total
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7127
Location: almost Mile High in the USA

PostPosted: Sat Dec 10, 2016 7:50 am    Post subject: Reply with quote

Which virtual machine solution are you using?
How much RAM on your host?

Your host machine should not hang. It can get really slow if you choose your settings improperly.

As your RAM in the VMs get locked on the host, you need to make sure you can live without the RAM on the host. That is, if you have 12GB RAM and set up a 10GB VM, the host needs to survive with less than 2GB RAM all of the time. Perhaps another virtualization system like containers or docker is what you need if you need to pool RAM.

I usually blame hard lockups to hardware or hardware-software issues. My VM host's implementation of IOMMU is buggy and causes crashes - disabling that feature in firmware stopped the crashes at a performance penalty.
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
djdkf343
n00b
n00b


Joined: 28 Jul 2016
Posts: 32

PostPosted: Sat Dec 10, 2016 11:20 am    Post subject: Reply with quote

KVM
12GB

How much RAM do you think host needs to survive?
I think containers and docker its not what i need right now,maybe later.
Ill check IOMMU.

And what about VM,would it better to edit make.conf file with -j cores?
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7127
Location: almost Mile High in the USA

PostPosted: Mon Dec 12, 2016 6:04 pm    Post subject: Reply with quote

What were you doing when it froze? Was the system loaded? Is it stable when idle? Was the VM running stuff or host running stuff?
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
djdkf343
n00b
n00b


Joined: 28 Jul 2016
Posts: 32

PostPosted: Tue Dec 13, 2016 8:19 pm    Post subject: Reply with quote

I dont find IOMMU in BIOS,maybe old version or hardware.
Power off the VM,it completely stacked,no reactions on any commands,host was just fine.
So i think maybe problem in old versions of libvirt,qemu-kvm (Debian Jessie on host) or just older hardware,need to upgrade.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7127
Location: almost Mile High in the USA

PostPosted: Tue Dec 13, 2016 9:11 pm    Post subject: Reply with quote

I would think most modern computers that have virtualization features, IOMMU should just "work" - it's my old ancient Q45 board with Core2 Quad that has problems. I only have 8GB RAM and have been making no more than 1-2GB VM's and haven't seen a problem after disabling IOMMU. My i7 seems to run VMs fine though I didn't explicitly try IOMMU.

I'm just using lastest stable libvirt/qemu-kvm - Gentoo on Gentoo (and older Ubuntu/Windows on Gentoo).
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
djdkf343
n00b
n00b


Joined: 28 Jul 2016
Posts: 32

PostPosted: Wed Dec 14, 2016 7:53 pm    Post subject: Reply with quote

Yes,i checked more detailed my hardware and CPU supports virtualization for sure,in BIOS SVM is enabled,but no IOMMU.

Then checked system dmesg and have this messages:

AMD IOMMUv2 driver by Joerg Roedel <joerg.roedel@amd.com>
AMD IOMMUv2 functionality not available on this system

So maybe this is not hardware motherboard issue,but kernel? Need something like AMD-IOMMU: enabled
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 7127
Location: almost Mile High in the USA

PostPosted: Wed Dec 14, 2016 8:56 pm    Post subject: Reply with quote

Well if you don't have it, it shouldn't try to use it, so it should be a red herring. So you have an AMD?
I've only messed with Intel virtualization...
_________________
Intel Core i7 2700K@ 4.1GHz/HD3000 graphics/8GB DDR3/180GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
brendlefly62
Tux's lil' helper
Tux's lil' helper


Joined: 19 Dec 2009
Posts: 93

PostPosted: Wed Dec 14, 2016 9:56 pm    Post subject: Reply with quote

Hi djdkf343,
First, I'm by no means an expert -- but I have done a lot of "learning by trial and error" and puzzling over "documentation" in the use of both AMD and Intel virtualization with KVM, Xen, VMware, and Virtualbox solutions. I have found that some CPUs will (partially) support virtualization but may not support full IO virtualization (i.e., be IOMMU capable -- and this is where I start to get out of my depth). On those that are capable, getting the kernel properly configured is essential (https://wiki.gentoo.org/wiki/QEMU of course), and using the bootloader command line for your "hypervisor" can help. On my i7-3537U which has "virtualization" turned on in the UEFI "BIOS" and shows vmx support, I have the following (for xen) in legacy grub.conf:
Code:
kernel /xen.gz noreboot vga=mode-0x37f iommu=1 intel_iommu=on xsave=1 dom0_mem=7G,max:7G loglvl=all guest_loglvl=all softlevel=xen
module /vmlinuz-4.7.10-hardened.xen0 root=... video=... console=tty1 net.ifnames=0 softlevel=xen
module /initramfs-4.0.0.1-20161109

However, on my i7-3770K, I have "virtualization" enabled, but no vmx support shows in cpu flags -- this machine still supports xen virtualization, but I have not been able to pass thru pci devices as dedicated to the vm...

In any case, to get on with your grub-install, I would think you should be able to either loop mount your image or use sys-block/nbd as a module and use qemu-nbd to make the image and its partitions available -- chroot and continue your work...

fwiw...

cheers
Back to top
View user's profile Send private message
djdkf343
n00b
n00b


Joined: 28 Jul 2016
Posts: 32

PostPosted: Thu Dec 15, 2016 4:16 pm    Post subject: Reply with quote

eccerr0r yep AMD.

brendlefly62 i will experiment with kernel configs,pci passthrough devices,maybe issue lays there,also checked grub config-amd64 file (Debian on host) and there is bunch IOMMU configs enabled:

CONFIG_AMD_IOMMU=y

sys-block/nbd and qemu-nbd this is new to me,check this later.

Ok,thanks guys for replies,ill keep this working sometime )).
Back to top
View user's profile Send private message
brendlefly62
Tux's lil' helper
Tux's lil' helper


Joined: 19 Dec 2009
Posts: 93

PostPosted: Thu Dec 15, 2016 5:02 pm    Post subject: Reply with quote

djdkf343 -- Cool. You may not need it if you can loop-mount your (raw) image, but if you do, then when you are ready to come back to it, the nbd technique for mounting your vm's image is described in a number of places. This writeup is a simple/easy version: https://bethesignal.org/blog/2011/01/05/how-to-mount-virtualbox-vdi-image/. This method has been helpful in my vbox projects and in my raspberrypi projects (emulating rpi using qemu-system-arm) where I use nbd to manage a "virtual SD card". A succinct version of the general steps described at the link above are something like this:

    Load the nbd kernel module.
    Code:
    # modprobe nbd max_part=8

    Then run qemu-nbd, a user space loopback block device server for QEMU-supported disk images. (knows about many disk image formats, and presents them as normal block devices)
    Code:
    # qemu-nbd -c /dev/nbd0 <image-file>

    That will expose the image as a block device named /dev/nbd0, as well as the partitions within it -- e.g. the first partition will be presented as /dev/nbd0p1. Note that you could format the entire image ( /dev/nbd0 ) with fdisk or some such tool, but you will most likely want to mount an individual partition if your image already exists as a result of some other work. For example, if the first partition is a gentoo root:
    Code:
    # mount /dev/nbd0p1 /mnt/gentoo

    Once here, you can mount the other partitions against the base layout, chroot, and proceed per the handbook. When you’re done, unmount the filesystem and shut down the qemu-nbd service.
    Code:
    # umount /mnt
    qemu-nbd -d /dev/nbd0

Note that there is also a lot of image manipulation flexibility in the qemu-img tool, particularly with the "convert" option.

Anyway - I know it's more than you are asking for; just wanted to put it down while I'm thinking about it.

cheers
Back to top
View user's profile Send private message
djdkf343
n00b
n00b


Joined: 28 Jul 2016
Posts: 32

PostPosted: Sat Dec 17, 2016 5:22 pm    Post subject: Reply with quote

Ok,thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum