[PATCH 3/3] Paravirtualization: struct paravirt_ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rusty Russell wrote:
> I'd expect (1) higher-level additions to paravirt_ops, and (2) binary
> patching similar to the VMI patches for interrupt operations.
>
> Name: Function Call Abstraction for Paravirtualization
> Status: Booted on 2.6.16-rc2-git7
> Depends: Paravirt/abstract-sensitive.patch.gz
> Signed-off-by: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
>
> This patch does the dumbest possible replacement of paravirtualized
> instructions: calls through a "paravirt_ops" structure.  Currently
> these are function implementations of native hardware: hypervisors
> will override the ops structure with their own variants.
>   

Well, performance will not be the best, and this native stub seems 
awkward (especially the debug register bit) - but as a first step, I 
think this is a fine direction.

>
> +#define IRET		jmp *paravirt_ops+PARAVIRT_iret
> +#define CLI		pushl %eax; pushl %ecx; pushl %edx; call *paravirt_ops+PARAVIRT_irq_disable; popl %edx; popl %ecx; popl %eax
> +#define STI		pushl %eax; pushl %ecx; pushl %edx; call *paravirt_ops+PARAVIRT_irq_enable; popl %edx; popl %ecx; popl %eax
> +#define STI_SYSEXIT	jmp *paravirt_ops+PARAVIRT_irq_enable_sysexit
> +#define GET_CR0		pushl %ecx; pushl %edx; call *paravirt_ops+PARAVIRT_read_cr0; popl %edx; popl %ecx
> +#define RDMSR		pushl %ecx; pushl %edx; pushl %ecx; call *paravirt_ops+PARAVIRT_read_msr; addl $4, %esp; popl %edx; popl %ecx
> +#define WRMSR		pushl %eax; pushl %ecx; pushl %edx; pushl %eax; pushl %ecx; call *paravirt_ops+PARAVIRT_write_msr; addl $8, %esp; popl %edx; popl %ecx
> +#define CPUID		pushl %edx; pushl %ecx; pushl %ebx; pushl %eax; leal $16(%esp), %eax; pushl %eax; leal $16(%esp), %eax; pushl %eax; leal $16(%esp), %eax; pushl %eax; leal $16(%esp), %eax; pushl %eax; call *paravirt_ops+PARAVIRT_cpuid; addl $16; popl %eax; popl %ebx; popl %ecx; popl %edx
> +

I'm pretty uncomfortable with this bit - the extra push / pops here are 
really redundant if you implement the CLI/STI in assembly.  And it is 
pretty clear that they have to be for performance.  That said, I'm ok 
with this as a transitory step to building a working interface first, 
and getting performance optimal second.

Also, RDMSR / WRMSR need not be defined for assembly code - this was 
legacy from my original patch.  I defined them there because of the 
non-C semantics of the instructions register input and output until I 
could get an inline assembler version.

Zach

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux