linux-kernel

KVM shadow page table handling in x86 platform

懵懂的女人 提交于 2020-05-10 03:24:22
问题 From what I understand, on processors that doesn't have hardware support for guest virtual to host physical address translation KVM uses the shadow page table. Shadow page table is built and updated when the guest OS modifies its page tables. Are there special instructions in the hardware (let’s take x86 for reference) for modifying the page table? Unless there are special instructions there won't be a trap to the VMM. Isn't the page table maintained in software by the Linux kernel just

KVM shadow page table handling in x86 platform

a 夏天 提交于 2020-05-10 03:22:18
问题 From what I understand, on processors that doesn't have hardware support for guest virtual to host physical address translation KVM uses the shadow page table. Shadow page table is built and updated when the guest OS modifies its page tables. Are there special instructions in the hardware (let’s take x86 for reference) for modifying the page table? Unless there are special instructions there won't be a trap to the VMM. Isn't the page table maintained in software by the Linux kernel just

KVM shadow page table handling in x86 platform

一个人想着一个人 提交于 2020-05-10 03:22:04
问题 From what I understand, on processors that doesn't have hardware support for guest virtual to host physical address translation KVM uses the shadow page table. Shadow page table is built and updated when the guest OS modifies its page tables. Are there special instructions in the hardware (let’s take x86 for reference) for modifying the page table? Unless there are special instructions there won't be a trap to the VMM. Isn't the page table maintained in software by the Linux kernel just

Dereferencing pointer to incomplete type ‘const struct cred’

非 Y 不嫁゛ 提交于 2020-04-17 20:27:20
问题 I want to understand this error. Printing UID of a process, code: printk(KERN_INFO "User ID = %d\n", (task)->cred->uid); The error: error: dereferencing pointer to incomplete type ‘const struct cred’ 回答1: It's pretty straightforward: the compiler is telling you that the type struct cred is incomplete. In other words, the compiler does not know its definition, and therefore it does not know whether there is a uid field or where in the struct the field is located. Therefore it cannot compile

How to use a seq_file in Linux kernel modules?

谁都会走 提交于 2020-04-10 04:09:07
问题 Hello all I'm new to Linux and wondering how to use a Linux sequence file in a module to traverse kernel objects. What I know is I can use the command: cat /proc/kallsyms to view the available symbols and from what I've read on google, the symbols in the list that have a 'D' or 'd' are pointers to data structures. Though I know the basics of how to create a module, the examples on the internet on how to use seq operations are not uniform and I'm getting a little confused. If someone knows of

Difference between skb_header_pointer and skb_transport_header?

梦想与她 提交于 2020-03-26 04:29:06
问题 I'm trying to implement a netfilter module, while processing sk_buff I found two possible ways to retrieve TCP header: struct iphdr *ip_header = (struct iphdr *)skb_network_header(skb); struct tcphdr *tcp_header = (struct tcphdr *)skb_transport_header(skb); And struct iphdr *ip_header = skb_header_pointer(skb, 0, sizeof(struct iphdr), &_iph) struct tcphdr *tcp_header = skb_header_pointer(skb, ip_header->ihl * 4, sizeof(struct tcphdr), &_tcph); Which one should I use? 回答1: You should use ip

Perf event for sending reschedule interrupt?

雨燕双飞 提交于 2020-03-21 05:37:54
问题 When a process wakes another process on the same core, a sched:sched_wakeup event is generated with both PIDs. This is great for finding relationships between processes. When a process wakes another process on a different core, the second core generates an irq_vectors:reschedule_entry event on whichever process is unlucky enough to catch the IPI, followed by a sched:sched_wakeup event from that victim process. What I can't find is the original process on the first core that does the waking.

Which processor would execute hardware interrupt in a muticore system

こ雲淡風輕ζ 提交于 2020-03-18 09:13:45
问题 In general hardware interrupts need to be processed immediately, at least so as to acknowledge it and do some first level of processing. As I understand this is not scheduled activity. Please correct me. So the question is how to choose a processor that would actually execute this hardware interrupt handler? One can answer this for Linux and/or BSD systems 回答1: In general, this depends on the functionality offered by multi-core processor and OS. While using multi-core processors, you might

What does pss mean in /proc/pid/smaps

Deadly 提交于 2020-03-12 08:03:29
问题 I was confused about the pss column in /proc/pid/smaps, so I wrote a program to test it: void sa(); int main(int argc,char *argv[]) { int fd; sa(); sleep(1000); } void sa() { char *pi=new char[1024*1024*10]; for(int i=0;i<4;++i) { for(int j=0;j<1024*1024;++j){ *pi='o'; pi++; } } int cnt; for(int i=0;i<6;++i) { for(int j=0;j<1024*1024;++j){ cnt+=*pi; pi++; } } printf("%d",cnt); } $cat /proc/`pidof testprogram`/smaps 08838000-0885b000 rw-p 00000000 00:00 0 [heap] Size: 140 kB Rss: 12 kB Pss: 12

running multiple instances of a same interrupt parallely on an SMP system

不羁岁月 提交于 2020-03-06 06:58:06
问题 Is it possible to run multiple instances of a same interrupt simultaneously on a multi processor system in linux? If not possible, why do we need to synchronize between interrupt handlers using spin locks? Thanks Venkatesh 回答1: On a SMP architecture Advanced Programmable Interrupt Controller( APIC ) is used to route the interrupts from peripherals to the CPU's. the APIC, based on 1. the routing table (where interrupt affinity is set to a particular processor), 2. priority of the interrupt, 3.