Re: [PATCH RFC] paravirt: cleanup lazy mode handling

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

 



Rusty Russell wrote:
> That's good, but this code does lose on native because we no longer
> simply replace the entire thing with noops.
>
> Perhaps inverting this and having (inline) helpers is the way to go?
>   

I'm thinking that the overhead will be unmeasurably small, and its not
really worth any more complexity.  That's almost certainly true for lazy
mmu mode, but lazy cpu is used in the middle of a context switch, so
it's probably worth a bit more attention.

> I'm thinking something like:
>
> static inline void paravirt_enter_lazy(enum paravirt_lazy_mode mode)
> {
> 	BUG_ON(x86_read_percpu(paravirt_lazy_mode) != PARAVIRT_LAZY_NONE);
> 	BUG_ON(preemptible());
>
> 	x86_write_percpu(paravirt_lazy_mode, mode);
> }
>
> static inline void paravirt_exit_lazy(enum paravirt_lazy_mode mode)
> {
> 	BUG_ON(x86_read_percpu(paravirt_lazy_mode) != mode);
> 	BUG_ON(preemptible());
>
> 	x86_write_percpu(paravirt_lazy_mode, PARAVIRT_LAZY_NONE);
> }
>   

Er, they should probably call something to make the switch actually
happen, no?

> The only trick would be that the flushes are so rarely required it's
> probably worth putting the unlikely() in the top level:
>   

Sure, I guess.  Would it make any difference?  (I've never personally
noticed likely/unlikely change the generated code in any seriously
positive way.)

    J
_______________________________________________
Virtualization mailing list
Virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx
https://lists.linux-foundation.org/mailman/listinfo/virtualization

[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