Re: [GIT PULL 04/23] KVM: s390: rewrite vcpu_post_run and drop out early
On 12/02/2015 02:05 PM, Paolo Bonzini wrote: > > > On 02/12/2015 14:04, Christian Borntraeger wrote: Do you gain much over the simpler vcpu->run->s.regs.gprs[14] = vcpu->arch.sie_block->gg14; vcpu->run->s.regs.gprs[15] = vcpu->arch.sie_block->gg15; >> Its just legacy code from the old days. >> There is a difference, but it seems to a missed opportunity from gcc >> >> vcpu->arch.sie_block->gg14 = vcpu->run->s.regs.gprs[14]; >> 839c: e3 30 f0 b8 00 04 lg %r3,184(%r15) >> 83a2: e3 10 32 40 00 04 lg %r1,576(%r3) >> 83a8: e3 20 30 80 00 04 lg %r2,128(%r3) >> 83ae: e3 20 21 b8 00 04 lg %r2,440(%r2) >> 83b4: e3 20 10 a0 00 24 stg %r2,160(%r1) >> vcpu->arch.sie_block->gg15 = vcpu->run->s.regs.gprs[15]; >> 83ba: e3 10 32 40 00 04 lg %r1,576(%r3) >> 83c0: e3 20 30 80 00 04 lg %r2,128(%r3) >> 83c6: e3 20 21 c0 00 04 lg %r2,448(%r2) >> 83cc: e3 20 10 a8 00 24 stg %r2,168(%r1) >> >> gcc seems to reuse and reload %r2 and %r3, maybe register pressure. > > More likely to be -fno-strict-aliasing. :( Yes its indeed the aliasing. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GIT PULL 04/23] KVM: s390: rewrite vcpu_post_run and drop out early
On 02/12/2015 14:04, Christian Borntraeger wrote: >> > Do you gain much over the simpler >> > >> >vcpu->run->s.regs.gprs[14] = vcpu->arch.sie_block->gg14; >> >vcpu->run->s.regs.gprs[15] = vcpu->arch.sie_block->gg15; >> > > Its just legacy code from the old days. > There is a difference, but it seems to a missed opportunity from gcc > > vcpu->arch.sie_block->gg14 = vcpu->run->s.regs.gprs[14]; > 839c: e3 30 f0 b8 00 04 lg %r3,184(%r15) > 83a2: e3 10 32 40 00 04 lg %r1,576(%r3) > 83a8: e3 20 30 80 00 04 lg %r2,128(%r3) > 83ae: e3 20 21 b8 00 04 lg %r2,440(%r2) > 83b4: e3 20 10 a0 00 24 stg %r2,160(%r1) > vcpu->arch.sie_block->gg15 = vcpu->run->s.regs.gprs[15]; > 83ba: e3 10 32 40 00 04 lg %r1,576(%r3) > 83c0: e3 20 30 80 00 04 lg %r2,128(%r3) > 83c6: e3 20 21 c0 00 04 lg %r2,448(%r2) > 83cc: e3 20 10 a8 00 24 stg %r2,168(%r1) > > gcc seems to reuse and reload %r2 and %r3, maybe register pressure. More likely to be -fno-strict-aliasing. :( Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GIT PULL 04/23] KVM: s390: rewrite vcpu_post_run and drop out early
On 12/02/2015 01:20 PM, Paolo Bonzini wrote: > > > On 02/12/2015 12:06, Christian Borntraeger wrote: >> +memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); > > This is preexisting but... boy it's ugly. :) > > Do you gain much over the simpler > > vcpu->run->s.regs.gprs[14] = vcpu->arch.sie_block->gg14; > vcpu->run->s.regs.gprs[15] = vcpu->arch.sie_block->gg15; > Its just legacy code from the old days. There is a difference, but it seems to a missed opportunity from gcc vcpu->arch.sie_block->gg14 = vcpu->run->s.regs.gprs[14]; 839c: e3 30 f0 b8 00 04 lg %r3,184(%r15) 83a2: e3 10 32 40 00 04 lg %r1,576(%r3) 83a8: e3 20 30 80 00 04 lg %r2,128(%r3) 83ae: e3 20 21 b8 00 04 lg %r2,440(%r2) 83b4: e3 20 10 a0 00 24 stg %r2,160(%r1) vcpu->arch.sie_block->gg15 = vcpu->run->s.regs.gprs[15]; 83ba: e3 10 32 40 00 04 lg %r1,576(%r3) 83c0: e3 20 30 80 00 04 lg %r2,128(%r3) 83c6: e3 20 21 c0 00 04 lg %r2,448(%r2) 83cc: e3 20 10 a8 00 24 stg %r2,168(%r1) gcc seems to reuse and reload %r2 and %r3, maybe register pressure. the memcpy gives memcpy(&vcpu->arch.sie_block->gg14, &vcpu->run->s.regs.gprs[14], 16); 839c: e3 30 f0 b8 00 04 lg %r3,184(%r15) 83a2: e3 10 32 40 00 04 lg %r1,576(%r3) 83a8: e3 20 30 80 00 04 lg %r2,128(%r3) 83ae: d2 0f 10 a0 21 b8 mvc 160(16,%r1),440(%r2) I will prepare a patch and do my usual micro benchmark. Unless things get much worse I will schedule this for the next pull. Christian -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [GIT PULL 04/23] KVM: s390: rewrite vcpu_post_run and drop out early
On 02/12/2015 12:06, Christian Borntraeger wrote: > + memcpy(&vcpu->run->s.regs.gprs[14], &vcpu->arch.sie_block->gg14, 16); This is preexisting but... boy it's ugly. :) Do you gain much over the simpler vcpu->run->s.regs.gprs[14] = vcpu->arch.sie_block->gg14; vcpu->run->s.regs.gprs[15] = vcpu->arch.sie_block->gg15; ? Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
