login
Header Space

 
 

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

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Jeremy Fitzhardinge <jeremy@...>
Cc: Virtualization Mailing List <virtualization@...>, Linux Kernel Mailing List <linux-kernel@...>, Andi Kleen <ak@...>, Zachary Amsden <zach@...>, Avi Kivity <avi@...>, Anthony Liguori <anthony@...>, Glauber de Oliveira Costa <glommer@...>, Nakajima, Jun <jun.nakajima@...>
Date: Monday, October 1, 2007 - 9:34 pm

On Mon, 2007-10-01 at 16:46 -0700, Jeremy Fitzhardinge 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 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);
}

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

static void arch_flush_lazy_cpu_mode(void)
{
	if (unlikely(x86_read_percpu(paravirt_lazy_mode)) {
		PVOP_VCALL0(cpu_ops.enter_lazy);
		PVOP_VCALL0(cpu_ops.exit_lazy);
	}
}

static void arch_flush_lazy_mmy_mode(void)
{
	if (unlikely(x86_read_percpu(paravirt_lazy_mode)) {
		PVOP_VCALL0(mmu_ops.enter_lazy);
		PVOP_VCALL0(mmu_ops.exit_lazy);
	}
}

Thoughts?
Rusty.

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH RFC] paravirt: cleanup lazy mode handling, Jeremy Fitzhardinge, (Mon Oct 1, 7:46 pm)
Re: [PATCH RFC] paravirt: cleanup lazy mode handling, Jeremy Fitzhardinge, (Tue Oct 2, 2:24 am)
Re: [PATCH RFC] paravirt: cleanup lazy mode handling, Rusty Russell, (Mon Oct 1, 9:34 pm)
Re: [PATCH RFC] paravirt: cleanup lazy mode handling, Jeremy Fitzhardinge, (Tue Oct 2, 2:29 am)
Re: [PATCH RFC] paravirt: cleanup lazy mode handling, Rusty Russell, (Tue Oct 2, 3:53 am)
Re: [PATCH RFC] paravirt: cleanup lazy mode handling, Jeremy Fitzhardinge, (Tue Oct 2, 6:43 pm)
speck-geostationary