qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 7/7] KVM regsync: Fix do_kvm_cpu_synchronize_sta


From: Alexander Graf
Subject: Re: [Qemu-devel] [PATCH 7/7] KVM regsync: Fix do_kvm_cpu_synchronize_state data integrity issue
Date: Fri, 4 Jan 2013 11:36:40 +0100

On 04.01.2013, at 11:32, Bhushan Bharat-R65777 wrote:

> 
> 
>> -----Original Message-----
>>>>> 
>>>>> Int timer_func(CPUxxState env)
>>>>> {
>>>>>  Struct timer_regs;
>>>>>  read_regs_type((env, &timer_regs,TIMER_REGS);
>>>>>  //update env->timer_registers
>>>>>  Write_regs_type(env, TIMER_REGS)
>>>>> }
>>>>> 
>>>>> This will get one type of register_types and can cause multiple
>>>>> IOCTL per
>>>> entry to QEMU.
>>>> 
>>>> This is still too explicit. How about
>>>> 
>>>> static inline void ppc_set_tsr(CPUState *env, target_ulong val) {
>>>>   env->kvm_sync_extra |= SYNC_TIMER_REGS;
>>>>   cpu_synchronize_registers(env);
>>>>   env->spr[SPR_TSR] = val;
>>> 
>>> You also want env->kvm_sync_dirty also, right?
>> 
>> Not quite, since SYNC_TIMER_REGS spans more than only TSR. So we need to make
>> sure we fetch the non-TSR register values before we can declare TIMER_REGS as
>> dirty.
> 
> Right , I actually want communicate mark dirty the TIMER_REGS only :)

Imagine TIMER_REGS includes TSR and TCR. Then

ppc_set_tsr();

should still work without a respective ppc_set_tcr() call. So we can't just 
mark it dirty here. The only way we could optimize this bit would be by either 
splitting the bitmap per register or by extending the setter functions to the 
full scope of the sync:

static inline void ppc_set_timer_regs(CPUState *env, target_ulong tsr, 
target_ulong tcr)
{
    ...
}


Alex




reply via email to

[Prev in Thread] Current Thread [Next in Thread]