From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] simplify pdpte check Date: Thu, 01 Feb 2007 16:54:27 +0200 Message-ID: <45C1FF23.1020201@qumranet.com> References: <20070201140138.GM2327@rhun.haifa.ibm.com><45C1F405.5070400@qumranet.com> <20070201144606.GH15992@rhun.haifa.ibm.com> <64F9B87B6B770947A9F8391472E032160A3F2213@ehost011-8.exch011.intermedia.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm-devel , Avi Kivity To: Dor Laor Return-path: In-Reply-To: <64F9B87B6B770947A9F8391472E032160A3F2213-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org Errors-To: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org List-Id: kvm.vger.kernel.org Dor Laor wrote: > >> -----Original Message----- >> From: kvm-devel-bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org [mailto:kvm-devel- >> bounces-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org] On Behalf Of Muli Ben-Yehuda >> Sent: Thursday, February 01, 2007 4:46 PM >> To: Avi Kivity >> Cc: kvm-devel >> Subject: Re: [kvm-devel] [PATCH] simplify pdpte check >> >> On Thu, Feb 01, 2007 at 04:07:01PM +0200, Avi Kivity wrote: >> >>> Muli Ben-Yehuda wrote: >>> >>>> Small cleanup: we check (pdpte & 1) && (pdpte & constant). Instead >>>> just check (pdpte & (constant | 1)). >>>> >>>> Signed-off-by: Muli Ben-Yehuda >>>> >>>> Index: kernel/kvm_main.c >>>> =================================================================== >>>> --- kernel/kvm_main.c (revision 4379) >>>> +++ kernel/kvm_main.c (working copy) >>>> @@ -336,7 +336,7 @@ >>>> ret = 1; >>>> for (i = 0; i < 4; ++i) { >>>> pdpte = pdpt[offset + i]; >>>> - if ((pdpte & 1) && (pdpte & 0xfffffff0000001e6ull)) { >>>> + if (pdpte & 0xfffffff0000001e7ull) { >>>> ret = 0; >>>> goto out; >>>> } >>>> >>>> >>>> >>> The code is not equivalent. For example, pdpte == 2 passes the check >>> before the patch and fails it after. >>> >> err... 2 & 1 == 0, which does not pass the original check. Perhaps the >> real error is '&&' instead of '||' in the original conditional? >> > > > What about 'if (pdpte & 0xfffffff0000001e7ull > 0x1)' ? > That would work. > Although the original is more readable. > Yes, and we're not exactly performance critical here. -- error compiling committee.c: too many arguments to function ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642