Re: [PATCH 01/14] KVM: PPC: e500: don't translate gfn to pfn with preemption disabled

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

 



On 10/31/2011 09:53 AM, Alexander Graf wrote:
> From: Scott Wood <scottwood@xxxxxxxxxxxxx>
>
> Delay allocation of the shadow pid until we're ready to disable
> preemption and write the entry.
>
> @@ -507,21 +507,16 @@ static inline void kvmppc_e500_deliver_tlb_miss(struct kvm_vcpu *vcpu,
>  	vcpu_e500->mas7 = 0;
>  }
>  
> +/* TID must be supplied by the caller */
>  static inline void kvmppc_e500_setup_stlbe(struct kvmppc_vcpu_e500 *vcpu_e500,
>  					   struct tlbe *gtlbe, int tsize,
>  					   struct tlbe_priv *priv,
>  					   u64 gvaddr, struct tlbe *stlbe)
>  {
>  	pfn_t pfn = priv->pfn;
> -	unsigned int stid;
> -
> -	stid = kvmppc_e500_get_sid(vcpu_e500, get_tlb_ts(gtlbe),
> -				   get_tlb_tid(gtlbe),
> -				   get_cur_pr(&vcpu_e500->vcpu), 0);
>  
>  	/* Force TS=1 IPROT=0 for all guest mappings. */
> -	stlbe->mas1 = MAS1_TSIZE(tsize)
> -		| MAS1_TID(stid) | MAS1_TS | MAS1_VALID;
> +	stlbe->mas1 = MAS1_TSIZE(tsize) | MAS1_TS | MAS1_VALID;
>  	stlbe->mas2 = (gvaddr & MAS2_EPN)
>  		| e500_shadow_mas2_attrib(gtlbe->mas2,
>  				vcpu_e500->vcpu.arch.shared->msr & MSR_PR);
> @@ -816,6 +811,24 @@ int kvmppc_e500_emul_tlbsx(struct kvm_vcpu *vcpu, int rb)
>  	return EMULATE_DONE;
>  }
>  
> +/* sesel is index into the set, not the whole array */
> +static void write_stlbe(struct kvmppc_vcpu_e500 *vcpu_e500,
> +			struct tlbe *gtlbe,
> +			struct tlbe *stlbe,
> +			int stlbsel, int sesel)
> +{
> +	int stid;
> +
> +	preempt_disable();
> +	stid = kvmppc_e500_get_sid(vcpu_e500, get_tlb_ts(gtlbe),
> +				   get_tlb_tid(gtlbe),
> +				   get_cur_pr(&vcpu_e500->vcpu), 0);
> +
> +	stlbe->mas1 |= MAS1_TID(stid);
> +	write_host_tlbe(vcpu_e500, stlbsel, sesel, stlbe);
> +	preempt_enable();
> +}
> +
>

This naked preempt_disable() is fishy.  What happens if we're migrated
immediately afterwards? we fault again and redo?

I realize that the patch doesn't introduce this.

-- 
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux