[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [V5] x86/xsaves: fix overwriting between non-lazy/lazy xsaves
>>> On 23.03.16 at 07:14, <shuai.ruan@xxxxxxxxxxxxxxx> wrote: > On Wed, Mar 23, 2016 at 10:02:24AM +0800, Shuai Ruan wrote: > But for hvm_vcpu_reset_state(), I think we should deleting the code > initializing the xcomp_bv as said below. >> For hvm_vcpu_reset_state(), we should depend on whether xsaves is used >> to decide whether to init xcomp_bv or not. And currently we use >> xcr0_accum to indicate the use of xsaves, when hvm_vcpu_reset_state() >> is called , can vcpu->xcr0_accum indicate using of xsaves ? >> I think in hvm_vcpu_reset_state(), we should leave xcomp_bv zero. Leaving it to be zero would be fine, but is it guaranteed to be zero? >> > Since again you repeat the same logic twice, this should again have >> > been a signal that all your changes should go into the XRSTOR() >> > macro. Or alternatively, since the exception fixup also differs, you >> > may want to convert the whole logic into an XSAVES and an XSAVE >> > path. My only really sincere request here is - as little redundancy as >> > possible, since having to change the same thing twice in more than >> > one place is always calling for trouble. > I will do all changes only in XRSTOR(). Code like : > > #define _XRSTOR(pfx, xrstor_ins) > asm volatile ( "1: .byte " pfx xrstor_ins"\n" \ > "3:\n" \ > " .section .fixup,\"ax\"\n" \ > "2: incl %[faults]\n" \ > " jmp 3b\n" \ > " .previous\n" \ > _ASM_EXTABLE(1b, 2b) \ > : [mem] "+m" (*ptr), [faults] "+g" (faults) \ > : [lmask] "a" (lmask), [hmask] "d" (hmask), \ > [ptr] "D" (ptr) ) > > #define XRSTOR(pfx) \ > if ( v->arch.xcr0_accum & XSTATE_XSAVES_ONLY ) \ > { \ > if ( unlikely(!(ptr->xsave_hdr.xcomp_bv \ > & XSTATE_COMPACTION_ENABLED)) ) \ > ptr->xsave_hdr.xcomp_bv |= (ptr->xsave_hdr.xstate_bv \ > | XSTATE_COMPACTION_ENABLED); > \ > _XRSTOR("0x48, ", "0x0f,0xc7,0x1f"); \ I think you mean to use pfx here. Also I don't see the point of passing two string literals to the auxiliary macro - just pass them as a single argument. > A now wapper is intruduced as "_XRSTOR"( maybe the macro name is not > good ). Indeed an underscore followed by an uppercase letter is starting a reserved identifier. Maybe DO_XRSTOR() or _xrstor()? Jan _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |