Which CPU is being emulated by Qemu by default? - qemu

I'm currently running a VM without selecting a CPU type. How can I know which one is being emulated? Is there a way to ask this to the Qemu monitor?
Host machine is Windows 10 and guest is Plan 9. Not using KVM.

Related

Why can't QEMU get even close to Rosetta 2's performance when translating x86 to M1?

Apparently, QEMU is the only piece of open source code that can emulate an x86 operating system on the new Apple silicon (M1, M2, etc.).
Apple built Rosetta 2, which, in theory, does the exact same thing that QEMU would be doing in these scenarios. It translates x86 (Intel) instructions into the instruction set supported by the new Apple silicon processors.
Rosetta 2 does it with remarkable performance, and some x86 applications even run with better performance than on native x86 hardware. QEMU, on the other hand, doesn't get even close when running x86 Linux on Apple silicon.
How can Rosetta have such superior performance? Are there any "secrets" that only Apple knows about their architecture that were never shared with the QEMU project? Any forbidden APIs that QEMU is not allowed to access?
Rosetta and QEMU are both emulators. However, they tackle the problem in vastly different ways.
QEMU
In order to emulate a a Linux system, QEMU must also emulate storage devices, console output devices, ethernet devices, keyboards, and the entire CPU. With this framework, it emulates every instruction doing everything with Just in Time translation. From the Linux kernel down to your /bin/ls command.
There are generally few limitations to QEMU's Intel emulate. You can run most any Intel Operating System and associated applications.
Rosetta 2
Apple's emulate, on the other hand, happens before the application launches. The entire binary is translated from x86 to Apple Silicon and launched. Once translated, the application is in effect a native arm64 binary making native macOS system calls.
Apple's documentation explains it thus:
If an executable contains only Intel instructions, macOS automatically
launches Rosetta and begins the translation process. When translation
finishes, the system launches the translated executable in place of
the original. However, the translation process takes time, so users
might perceive that translated apps launch or run more slowly at times
Rosetta 2 has a number of significant limitations. For example you can't use Intel Kernel extensions, Virtual Machine apps that virtualize x86_64 computer platforms (Parallels for example), or AVX/AVX2/AVX512 vector instructions.

Booting a QorIQ PowerPC firmware in Qemu

I have a QorIQ (P2041) processor based IoT device firmware. I have uBoot, Kernel and initrd ramdisk. Whatever I do with qemu-system-ppc I can't get it to work. I suspect that qemu-system-ppc doesn't support QorIQ processors. Is there anyway for me to load and boot this firmware in Qemu or any other emulator?
U-Boot has configuration file qemu-ppce500_defconfig. You should be able to run the U-Boot built with this configuration using command
qemu-system-ppc -nographic -bios u-boot -M ppce500
The CPU can be specified via the -cpu parameter as e500mc.
To run your kernel it will need drivers for the hardware provided by the emulated machine like the E1000 network card and the NS16550 console.
Use the fdt command of U-Boot to get an overview of the available devices in the emulated machine.
Firmware binaries are generally very closely tied to the hardware they're built to run on -- they make assumptions about what hardware is available, what addresses in memory it can be found at, and so on. You need to use a firmware blob that corresponds to the hardware you're asking QEMU to emulate. Since QEMU doesn't emulate whatever your random IoT device is, you need to use a u-boot which matches the hardware QEMU actually has (as for example suggested in Xypron's answer).
Once you have booting firmware, you will likely still find you have exactly the same problem with the kernel -- it is built to run on one bit of hardware, and you're trying to run it on something different, and this simply won't work.

Verifying CUDA-Capable GPU in Ubuntu

I downloaded and installed CUDA-7.5 and found that instruction that I need to check whether I have a CUDA-Capable GPU.
I did as
lin#lin-VirtualBox:/opt/caffe$ sudo update-pciids
Downloaded daily snapshot dated 2015-09-07 03:15:01
then why I type
lspci | grep -i nvidia
nothing comes out.
lin#lin-VirtualBox:/opt/caffe$ lspci | grep -i nvidia
lin#lin-VirtualBox:/opt/caffe$
I have NVIDIA graphic card GEFORCE GT750M.
What could be wrong?
My OS is Ubuntu14.04.
Thanks
It seems you are running in a VirtualBox VM (virtual machine) instance. With a typical VirtualBox setup, the graphics in the VM is virtualized; there is no physical GPU device present in the VM.
As a result, the GPU does not show up when you run lspci in the VM.
One possible approach to work around this would be to switch to a "baremetal" config; i.e. load Ubuntu directly on your laptop as the primary (or "host") OS, rather than in a VM. The GPU should show up that way.
Another possible approach would be to attempt to use VirtualBox PCI Passthrough to make the GPU "visible" in the VM. Whether or not this would work in a laptop scenario I don't know; there may be side effects of trying to pass through the laptop GPU to a VM; your laptop hypervisor and any other OS's would not have access to the GPU (or the laptop display) in this situation. I think there are a number of other requirements and restrictions with this approach. Your laptop hardware may or may not meet the requirements, and I think it is expected that the host OS uses some specific flavors of linux (kernel); you may have windows as the host OS on your laptop.
In any event, how to configure your machine with VirtualBox and/or PCI Passthrough is not a programming question, and I think is off-topic for SO. You might try askubuntu or another similar forum, for related questions.

Anyone can introduce some primers about qemu-kvm and kvm?

I am a fresh man in kvm,qemu-kvm and kvm are both very complicated now.
Anyone can introduce some primers about qemu-kvm and kvm?
thanks very much!
KVM stands for kernel based virtual machine. it enables you to create as many number of virtual machine as you like. These machine can be of two types LVM based or Non-LVM based.
Those machine which are LVM based you can take live backup for them. for non-lvm based VM you cannot take live backup i.e. they will be paused when you take backup for them. please refer KVM home page KVM Home Page.
QEMU is a generic and open source machine emulator and virtualizer.When used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. your own PC). By using dynamic translation, it achieves very good performance. When used as a virtualizer, QEMU achieves near native performances by executing the guest code directly on the host CPU. QEMU supports virtualization when executing under the Xen hypervisor or using the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86, server and embedded PowerPC, and S390 guests.
For managing the KVM VM's you need to install Libvirt which is the virtualization library. It provides you the tools for starting, suspending, resuming, cloning, restarting, listing of virtual machine. Please refer Libvirt home page for more reference.
If you are working on some backup or recovery process then I suggest you to go through this excellent perl script as well it will give a fair idea of how the backup and snapshot is being taken for KVM VM's.
KVM based virtual machines are not complicated once you go through the theory of them and start implementing them. I believe once you start working on them you will find fun in managing them.
Putting in a nutshell
QEMU : An emulator which translates the instruction of guest operating system to host operating system. As you can guess that translation has a certain cost, you will not see Guest machine working as fast as host machine.
For more info see the QEMU wiki
KVM (Kernal Virtual Machine): A module in Kernel which support Virtual Machine (host operating system) in hardware. By support I mean that if your guest architecture is same as host architecture, then certainly there is no need to translate the instructions as they can directly be executed by host. For this modern hardware are equipped with special registers and storage location which is leveraged by KVM. Also KVM is a module, some driver is needed to use the KVM, which is qemu also.
For more info see the KVM section in the same wiki.
QEMU-KVM : As I above mentioned, KVM is a module only, qemu is needed (or other) to use KVM. When KVM is used with QEMU, control transfers from QEMU to KVM and vice-versa over the execution.
Talking about KVM is talking about virtualization technology or about kernel modules (kvm.ko, kvm-intel.ko or kvm-amd-ko). Sometimes KVM is mentioned as a virtual machine, this is not correct, because KVM does not provide virtualized hardware.
Source

Can I run a CUDA Program on a computer if I remote into it using Windows RDP? [duplicate]

This question already has answers here:
How to Run a cuda code using remote Desktop?
(8 answers)
Closed 8 years ago.
I have a server that is located elsewhere. On that server, I plan to run a program written to take advantage of the CUDA-capable graphics card on that physical machine. This program has nothing to do with graphics--it will only use the graphics card for computational math.
Will I be able to run this program on that machine? Will the program recognize the physical graphics card if I am logged in using windows remote desktop? Or will the server not even recognize that there is a graphics card plugged in since I am remoting in?
EDIT: I wanted to mention that all computation will take place remotely and that nothing on this machine depends on what's going on locally on my home PC. I am simply using my home PC to "view" what is going on at that server.
You cannot use Remote Desktop to run CUDA. Remote Desktop unloads the graphics driver which disables CUDA.
You need to use VNC or Splashtop or something else instead of Remote Desktop.
RDP runs in Session 0 -- just like a service. Graphics drivers aren't accessible from Session 0, so normally CUDA programs won't work (because they won't be able to access the underlying hardware).
If you're using a Tesla, you can put the driver into Tesla Compute Cluster (TCC) mode and bypass this issue, so any CUDA programs will work just fine over RDP.