8965c1c095
Currently, the set_lazy_mode pv_op is overloaded with 5 functions: 1. enter lazy cpu mode 2. leave lazy cpu mode 3. enter lazy mmu mode 4. leave lazy mmu mode 5. flush pending batched operations This complicates each paravirt backend, since it needs to deal with all the possible state transitions, handling flushing, etc. In particular, flushing is quite distinct from the other 4 functions, and seems to just cause complication. This patch removes the set_lazy_mode operation, and adds "enter" and "leave" lazy mode operations on mmu_ops and cpu_ops. All the logic associated with enter and leaving lazy states is now in common code (basically BUG_ONs to make sure that no mode is current when entering a lazy mode, and make sure that the mode is current when leaving). Also, flush is handled in a common way, by simply leaving and re-entering the lazy mode. The result is that the Xen, lguest and VMI lazy mode implementations are much simpler. Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com> Cc: Andi Kleen <ak@suse.de> Cc: Zach Amsden <zach@vmware.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: Avi Kivity <avi@qumranet.com> Cc: Anthony Liguory <aliguori@us.ibm.com> Cc: "Glauber de Oliveira Costa" <glommer@gmail.com> Cc: Jun Nakajima <jun.nakajima@intel.com>
46 lines
1.0 KiB
C
46 lines
1.0 KiB
C
#ifndef _XEN_MULTICALLS_H
|
|
#define _XEN_MULTICALLS_H
|
|
|
|
#include "xen-ops.h"
|
|
|
|
/* Multicalls */
|
|
struct multicall_space
|
|
{
|
|
struct multicall_entry *mc;
|
|
void *args;
|
|
};
|
|
|
|
/* Allocate room for a multicall and its args */
|
|
struct multicall_space __xen_mc_entry(size_t args);
|
|
|
|
DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags);
|
|
|
|
/* Call to start a batch of multiple __xen_mc_entry()s. Must be
|
|
paired with xen_mc_issue() */
|
|
static inline void xen_mc_batch(void)
|
|
{
|
|
/* need to disable interrupts until this entry is complete */
|
|
local_irq_save(__get_cpu_var(xen_mc_irq_flags));
|
|
}
|
|
|
|
static inline struct multicall_space xen_mc_entry(size_t args)
|
|
{
|
|
xen_mc_batch();
|
|
return __xen_mc_entry(args);
|
|
}
|
|
|
|
/* Flush all pending multicalls */
|
|
void xen_mc_flush(void);
|
|
|
|
/* Issue a multicall if we're not in a lazy mode */
|
|
static inline void xen_mc_issue(unsigned mode)
|
|
{
|
|
if ((paravirt_get_lazy_mode() & mode) == 0)
|
|
xen_mc_flush();
|
|
|
|
/* restore flags saved in xen_mc_batch */
|
|
local_irq_restore(x86_read_percpu(xen_mc_irq_flags));
|
|
}
|
|
|
|
#endif /* _XEN_MULTICALLS_H */
|