KVM: add kvm_arch_sched_in
Introduce preempt notifiers for architecture specific code. Advantage over creating a new notifier in every arch is slightly simpler code and guaranteed call order with respect to kvm_sched_in. Signed-off-by: Radim Krčmář <rkrcmar@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
		
					parent
					
						
							
								6689fbe3cf
							
						
					
				
			
			
				commit
				
					
						e790d9ef64
					
				
			
		
					 7 changed files with 24 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -288,6 +288,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
 | 
			
		|||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 | 
			
		||||
{
 | 
			
		||||
	vcpu->cpu = cpu;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1002,6 +1002,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
 | 
			
		|||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
 | 
			
		||||
				  struct kvm_translation *tr)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -720,6 +720,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
 | 
			
		|||
	kvmppc_subarch_vcpu_uninit(vcpu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 | 
			
		||||
{
 | 
			
		||||
#ifdef CONFIG_BOOKE
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -555,6 +555,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
 | 
			
		|||
	/* Nothing todo */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 | 
			
		||||
{
 | 
			
		||||
	save_fp_ctl(&vcpu->arch.host_fpregs.fpc);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7171,6 +7171,10 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
 | 
			
		|||
		static_key_slow_dec(&kvm_no_apic_vcpu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu)
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 | 
			
		||||
{
 | 
			
		||||
	if (type)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -624,6 +624,8 @@ void kvm_arch_exit(void);
 | 
			
		|||
int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu);
 | 
			
		||||
void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu);
 | 
			
		||||
 | 
			
		||||
void kvm_arch_sched_in(struct kvm_vcpu *vcpu, int cpu);
 | 
			
		||||
 | 
			
		||||
void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu);
 | 
			
		||||
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu);
 | 
			
		||||
void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3124,6 +3124,8 @@ static void kvm_sched_in(struct preempt_notifier *pn, int cpu)
 | 
			
		|||
	if (vcpu->preempted)
 | 
			
		||||
		vcpu->preempted = false;
 | 
			
		||||
 | 
			
		||||
	kvm_arch_sched_in(vcpu, cpu);
 | 
			
		||||
 | 
			
		||||
	kvm_arch_vcpu_load(vcpu, cpu);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue