When I boot kernel via kexec, it enables x2apic mode and causes my board does not reboot from external hardware NMI. Booting kernel from BIOS does not enable this mode and no issue happen in my board.
I am not sure whether in x2apic mode kernel can handle NMI successfully or not.
If anyone understands x2apic mode, could you explain it for me? And how can we disable x2apic mode when booting kernel via kexec.
Thanks a lot
I do not now enough about x2apic to tell you what it does, but to answer your second question, adding nox2apic as one of the kernel boot options disables it.
also see http://en.wikipedia.org/wiki/X2APIC
Related
I am new to Linux kernel, and now working with an AMP system on a 4-core Cortex-A53, where 2 cores are for RTOS and the other 2 for Linux.
The issue is RTOS and Linux share some H/W resource, like GIC controller and SMMU(IOMMU). I would like to initialize them(write to their register) by RTOS before booting the Linux kernel. Linux will only use these shared resource, but skip the initialization(e.g. irqchip_init()) during kernel booting.
Is it possible? Can I make it by kernel build configuration? If possible, how should I describe them in device tree?
I know this is a rare implementation case. Does anyone have experience?
I am curious why gdb does not show control registers for x86. I have been using gdb with qemu to debug some kernel stuff. I get register values using info registers and info all-registers.
However, I cant get cr3 and cr2.(In general CRs). Is there any way to get them. If not then why are not they provided.
If you are using qemu, you can get all registers states (even control ones) by issuing theses two commands in the shell you start qemu:
ctrl-a c (to switch to qemu command interface)
info registers (to get registers states)
UPDATE:
You could check the values of the control registers from gdb. The issue is that your program must be running in real mode (mostly bootloaders have a part that runs on real-mode this days).
UPDATE FROM #Mahouk:
Since me and #Majouk have the same number of votes on this thread, you should definitely check out his answer and try getting the register values from qemu.
ORIGINAL ANSWER:
I had the same issue and it seems that gdb doesn't have that option unfortunately.
I am not sure why they are not provided but I can suggest to you an alternative.
You could switch to Bochs from Qemu. Yes, it might be a bit quirky or slower but
it has a very good internal debugger. The command to see the control registers with
bochs is creg.
For more information, you can reference Boch's documentation here.
Good luck :)
info registers in QEMU 4.0.0 did show CR registers to me, likely due to a QEMU update, since it is QEMU sends an XML describing which registers it will show to GDB. I see:
cr0 0x80050033 [ PG AM WP NE ET MP PE ]
cr2 0x6a8d18 6982936
cr3 0xe0bc000 [ PDBR=7 PCID=0 ]
cr4 0x7406f0 [ PKE SMAP SMEP OSXSAVE OSXMMEXCPT OSFXSR PGE MCE PAE PSE ]
cr8 0x0 0
or I can also get individual ones with:
i r cr0
i r cr2
i r cr3
Tested with this exact setup.
I'm new to kvm, can someone explain it's process when guest handle a external interrupt or the emulated device interrupt?
Thanks
Amos
In x86 architecture, Intel in this case, most interrupts will cause CPU VM exit, which means the control of CPU will return to host from guests.
So the processes are
CPU is used by guest OS in VMX non-root mode.
CPU is aware of an interrupt coming.
CPU's control returns to host running in VMX root mode. (VM exit)
The host (KVM) handles the interrupt.
Host executed VMLAUNCH instruction to let CPU transfer to VMX non-root mode again for running
guest code.
Repeat 1.
If you are new to kvm, you should first read a few papers about how kvm module works (I assume you know basic idea of virtualization).How it uses qemu to do i/o emulation etc.
I recommend you read these papers:
kvm: the Linux Virtual Machine Monitor: https://www.kernel.org/doc/mirror/ols2007v1.pdf#page=225
Kernel-based Virtual Machine Technology : http://www.fujitsu.com/downloads/MAG/vol47-3/paper18.pdf KVM: Kernel-based Virtualization Driver: http://www.linuxinsight.com/files/kvm_whitepaper.pdf
These are papers written by guys who started kvm.( they are short and sweet :) )
After this you should start looking at the documentation of the kvm in the source code especially the file api.txt its very good.
Then I think you can jump into the source code to understand how things actually work.
Cheers
I learn that when computer starts it is in real mode.And kernel is responsible for switching mode from real to protected.Ok , my question is Grub boot loader runs in real mode or in protected mode ?
AFAIK, Grub starts in real mode like any other software loaded at boot. It switches to protected mode for its run time (detecting HD, displaying menus etc.) and switches back into real mode before loading and running OS such as Linux that do not support multiboot protocol.
See http://duartes.org/gustavo/blog/post/kernel-boot-process for a detailed answer, but basically Grub does not switch to protected mode when running Linux. It loads the real-mode part of the kernel in low memory and let it do the switch itself (as required per the Linux Boot Protocol, http://lxr.linux.no/#linux+v2.6.25.6/Documentation/i386/boot.txt)
However, Grub also supports the Multiboot Specification, which starts the loaded OS in protected mode. This is done for non-Linux kernels, like modern homebrew OSes for which the makers do not want to bother with the hassle of switching to protected mode.
How to enable AES-NI support in linux kernel. While searching on internet I found that once AES-NI enabled there should be a line "CONFIG_CRYPTO_AES_NI_INTEL=m" in kernel configuration file. I tried to recompile my kernel version 2.6.35.6 but no luck. My server hardware configuration are (Supermicro 6026T, Intel® Xeon® Processor E5640) which support AES-NI.
with kind regards
lalit