* Naive questions regarding KVM @ 2014-05-23 4:57 Mathew Li 2014-05-23 5:12 ` Jidong Xiao 2014-05-23 5:51 ` Chai Wen 0 siblings, 2 replies; 4+ messages in thread From: Mathew Li @ 2014-05-23 4:57 UTC (permalink / raw) To: kvm Hi All, I want to learn KVM code. Apologies for asking really simple questions. I have Ubuntu 12.04 32bit installed on my laptop. As I understand there are two modules of the KVM. One is called kvm.ko and other arch specific e.g. in my case it is kvm-intel.ko. These modules are already present in my system. I can do modinfo and it lists them. What I want to do is modify KVM code to add print statements to understand things better. But I don't know what code to modify and how to rebuild these two modules for my system, so that they have my print statements. Could you please guide me what code do I need to download and how to compile that to get the modules regenerated for my system? If I need to download the whole Linux kernel then where in Linux kernel KVM code lives? I don't want to compile the whole linux kernel, I just want to compile these modules for my system. Thanks a lot for any help you could provide. Thanks! Matt ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Naive questions regarding KVM 2014-05-23 4:57 Naive questions regarding KVM Mathew Li @ 2014-05-23 5:12 ` Jidong Xiao 2014-05-23 5:23 ` Mathew Li 2014-05-23 5:51 ` Chai Wen 1 sibling, 1 reply; 4+ messages in thread From: Jidong Xiao @ 2014-05-23 5:12 UTC (permalink / raw) To: Mathew Li; +Cc: KVM On Fri, May 23, 2014 at 12:57 AM, Mathew Li <mathew.li100@gmail.com> wrote: > Hi All, > > I want to learn KVM code. Apologies for asking really simple > questions. I have Ubuntu 12.04 32bit installed on my laptop. As I > understand there are two modules of the KVM. One is called kvm.ko and > other arch specific e.g. in my case it is kvm-intel.ko. These modules > are already present in my system. I can do modinfo and it lists them. > > What I want to do is modify KVM code to add print statements to > understand things better. But I don't know what code to modify and how > to rebuild these two modules for my system, so that they have my print > statements. Could you please guide me what code do I need to download > and how to compile that to get the modules regenerated for my system? > If I need to download the whole Linux kernel then where in Linux > kernel KVM code lives? I don't want to compile the whole linux kernel, > I just want to compile these modules for my system. > > Thanks a lot for any help you could provide. > > Thanks! > Matt If you are using the latest kernel, then arch/x86/kvm and virt/kvm are the two directories you should look at, and also some header files are under the include/linux directory. Since kvm is a part of the mainline kernel, I don't think you need to download anything else other than the mainline kernel. But, to use kvm, I think you should install Qemu, which is a user-level tool. If you compile kvm as a kernel module, then each time you insert your printk statements, you don't need to compile the whole kernel, just compile the specific directory you have made changes in. For example, if you have changed arch/x86/kvm directory, you can use the command: `make modules SUBDIRS=arch/x86/kvm`. Once you are done, just copy the generated module: kvm.ko, kvm-intel.ko to /lib/modules/your-kernel-version/kernel/arch/x86/kvm/. Remove the existing kvm.ko/kvm-intel.ko, and install the new modules. -Jidong ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Naive questions regarding KVM 2014-05-23 5:12 ` Jidong Xiao @ 2014-05-23 5:23 ` Mathew Li 0 siblings, 0 replies; 4+ messages in thread From: Mathew Li @ 2014-05-23 5:23 UTC (permalink / raw) To: Jidong Xiao; +Cc: KVM Thanks a lot Jidong. I will give it a run. Thanks! Matt On Thu, May 22, 2014 at 10:12 PM, Jidong Xiao <jidong.xiao@gmail.com> wrote: > On Fri, May 23, 2014 at 12:57 AM, Mathew Li <mathew.li100@gmail.com> wrote: >> Hi All, >> >> I want to learn KVM code. Apologies for asking really simple >> questions. I have Ubuntu 12.04 32bit installed on my laptop. As I >> understand there are two modules of the KVM. One is called kvm.ko and >> other arch specific e.g. in my case it is kvm-intel.ko. These modules >> are already present in my system. I can do modinfo and it lists them. >> >> What I want to do is modify KVM code to add print statements to >> understand things better. But I don't know what code to modify and how >> to rebuild these two modules for my system, so that they have my print >> statements. Could you please guide me what code do I need to download >> and how to compile that to get the modules regenerated for my system? >> If I need to download the whole Linux kernel then where in Linux >> kernel KVM code lives? I don't want to compile the whole linux kernel, >> I just want to compile these modules for my system. >> >> Thanks a lot for any help you could provide. >> >> Thanks! >> Matt > If you are using the latest kernel, then arch/x86/kvm and virt/kvm are > the two directories you should look at, and also some header files are > under the include/linux directory. Since kvm is a part of the mainline > kernel, I don't think you need to download anything else other than > the mainline kernel. But, to use kvm, I think you should install Qemu, > which is a user-level tool. > > If you compile kvm as a kernel module, then each time you insert your > printk statements, you don't need to compile the whole kernel, just > compile the specific directory you have made changes in. For example, > if you have changed arch/x86/kvm directory, you can use the command: > `make modules SUBDIRS=arch/x86/kvm`. > > Once you are done, just copy the generated module: kvm.ko, > kvm-intel.ko to /lib/modules/your-kernel-version/kernel/arch/x86/kvm/. > Remove the existing kvm.ko/kvm-intel.ko, and install the new modules. > > -Jidong ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Naive questions regarding KVM 2014-05-23 4:57 Naive questions regarding KVM Mathew Li 2014-05-23 5:12 ` Jidong Xiao @ 2014-05-23 5:51 ` Chai Wen 1 sibling, 0 replies; 4+ messages in thread From: Chai Wen @ 2014-05-23 5:51 UTC (permalink / raw) To: Mathew Li; +Cc: kvm On 05/23/2014 12:57 PM, Mathew Li wrote: > Hi All, > > I want to learn KVM code. Apologies for asking really simple > questions. I have Ubuntu 12.04 32bit installed on my laptop. As I > understand there are two modules of the KVM. One is called kvm.ko and > other arch specific e.g. in my case it is kvm-intel.ko. These modules > are already present in my system. I can do modinfo and it lists them. > > What I want to do is modify KVM code to add print statements to > understand things better. But I don't know what code to modify and how > to rebuild these two modules for my system, so that they have my print > statements. Could you please guide me what code do I need to download > and how to compile that to get the modules regenerated for my system? > If I need to download the whole Linux kernel then where in Linux > kernel KVM code lives? I don't want to compile the whole linux kernel, > I just want to compile these modules for my system. > > Thanks a lot for any help you could provide. > Hi Li: I happend to have an similar example for kernel-3.3.3. If you want to build kvm modules out of a kernel tree you can copy files in kernel root dirs: 'arch/x86/kvm' and 'virt/kvm' to a dedicated dir like '/home/wrok/kvm_debug'. Its Makefile could be like below. Building command is some command like "make -C ../linux-3.3.3 M=`pwd` modules" in dir 'kvm_debug' And trace.h & mmutrace.h need a littile change: # [root@chaiw kvm_debug]# diff -U 5 trace.h ../linux-3.3.3/arch/x86/kvm/trace.h # --- trace.h 2014-05-05 15:25:16.319200716 +0800 # +++ ../linux-3.3.3/arch/x86/kvm/trace.h 2012-04-23 06:39:43.000000000 +0800 # @@ -820,11 +820,11 @@ # __entry->gpa_match ? "GPA" : "GVA") # ); # #endif /* _TRACE_KVM_H */ # # #undef TRACE_INCLUDE_PATH # -#define TRACE_INCLUDE_PATH /home/work/kvm_debug # +#define TRACE_INCLUDE_PATH arch/x86/kvm # #undef TRACE_INCLUDE_FILE # #define TRACE_INCLUDE_FILE trace # # /* This part must be outside protection */ # #include <trace/define_trace.h> # # [root@chaiw kvm_debug]# diff -U 5 mmutrace.h ../linux-3.3.3/arch/x86/kvm/mmutrace.h # --- mmutrace.h 2014-05-05 15:28:19.300189943 +0800 # +++ ../linux-3.3.3/arch/x86/kvm/mmutrace.h 2012-04-23 06:39:43.000000000 +0800 # @@ -244,11 +244,11 @@ # __entry->access) # ); # #endif /* _TRACE_KVMMMU_H */ # # #undef TRACE_INCLUDE_PATH # -#define TRACE_INCLUDE_PATH /home/work/kvm_debug # +#define TRACE_INCLUDE_PATH . # #undef TRACE_INCLUDE_FILE # #define TRACE_INCLUDE_FILE mmutrace # # /* This part must be outside protection */ # #include <trace/define_trace.h> ------- Makefile --------- # depended on kernel-3.3.3 # for kvm module kvm-y += kvm_main.o ioapic.o coalesced_mmio.o irq_comm.o eventfd.o \ assigned-dev.o kvm-$(CONFIG_IOMMU_API) += iommu.o kvm-$(CONFIG_KVM_ASYNC_PF) += async_pf.o kvm-y += x86.o mmu.o emulate.o i8259.o irq.o lapic.o i8254.o timer.o \ cpuid.o pmu.o obj-m := kvm.o # for kvm_intel & kvm_amd modules kvm_intel-y += vmx.o kvm_amd-y += svm.o obj-m += kvm_intel.o obj-m += kvm_amd.o clean: @-rm -f *.o @-rm -f *mod* @-rm -f *.ko thanks chai wen > Thanks! > Matt > -- > To unsubscribe from this list: send the line "unsubscribe kvm" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- Regards Chai Wen ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-05-23 5:53 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-05-23 4:57 Naive questions regarding KVM Mathew Li 2014-05-23 5:12 ` Jidong Xiao 2014-05-23 5:23 ` Mathew Li 2014-05-23 5:51 ` Chai Wen
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.