From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCHv4 4/5] KVM: emulator: make linearize() callable from outside of emulator Date: Thu, 19 Jul 2012 15:52:15 +0300 Message-ID: <500802FF.3030909@redhat.com> References: <1342683653-32114-1-git-send-email-gleb@redhat.com> <1342683653-32114-5-git-send-email-gleb@redhat.com> <5007E25B.3060207@redhat.com> <20120719105158.GV26120@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mtosatti@redhat.com To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:6410 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750898Ab2GSMwU (ORCPT ); Thu, 19 Jul 2012 08:52:20 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q6JCqKgr010451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Jul 2012 08:52:20 -0400 In-Reply-To: <20120719105158.GV26120@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 07/19/2012 01:51 PM, Gleb Natapov wrote: >> > +int x86_linearize(struct x86_linearize_params *p, ulong *linear) >> > { >> > - struct desc_struct desc; >> > - bool usable; >> > ulong la; >> > u32 lim; >> > - u16 sel; >> > unsigned cpl, rpl; >> > >> > - la = seg_base(ctxt, addr.seg) + addr.ea; >> > - switch (ctxt->mode) { >> > + la = get_desc_base(&p->desc) + p->ea; >> >> This makes 64-bit mode slower, since before the patch it avoided reading >> the segment base for non-fs/gs segments, and only read the segment base >> for fs/gs. After the patch we always execute 4 VMREADs (and decode the >> results). >> > That's easy to fix by making caller prepare fake desc if mode is 64-bit > and segment is non-fs/gs. The question is if this even measurable? I'm sure it will be measurable, esp. on older processors. Why not measure it? -- error compiling committee.c: too many arguments to function