* [PATCH] simplify pdpte check
@ 2007-02-01 14:01 Muli Ben-Yehuda
[not found] ` <20070201140138.GM2327-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org>
0 siblings, 1 reply; 9+ messages in thread
From: Muli Ben-Yehuda @ 2007-02-01 14:01 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel
Small cleanup: we check (pdpte & 1) && (pdpte & constant). Instead
just check (pdpte & (constant | 1)).
Signed-off-by: Muli Ben-Yehuda <muli-7z/5BgaJwgfQT0dZR+AlfA@public.gmane.org>
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;
}
-------------------------------------------------------------------------
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
^ permalink raw reply [flat|nested] 9+ messages in thread[parent not found: <20070201140138.GM2327-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH] simplify pdpte check [not found] ` <20070201140138.GM2327-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org> @ 2007-02-01 14:07 ` Avi Kivity [not found] ` <45C1F405.5070400-atKUWr5tajBWk0Htik3J/w@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Avi Kivity @ 2007-02-01 14:07 UTC (permalink / raw) To: Muli Ben-Yehuda; +Cc: kvm-devel Muli Ben-Yehuda wrote: > Small cleanup: we check (pdpte & 1) && (pdpte & constant). Instead > just check (pdpte & (constant | 1)). > > Signed-off-by: Muli Ben-Yehuda <muli-7z/5BgaJwgfQT0dZR+AlfA@public.gmane.org> > > 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. -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <45C1F405.5070400-atKUWr5tajBWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH] simplify pdpte check [not found] ` <45C1F405.5070400-atKUWr5tajBWk0Htik3J/w@public.gmane.org> @ 2007-02-01 14:46 ` Muli Ben-Yehuda [not found] ` <20070201144606.GH15992-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org> 0 siblings, 1 reply; 9+ messages in thread From: Muli Ben-Yehuda @ 2007-02-01 14:46 UTC (permalink / raw) To: Avi Kivity; +Cc: kvm-devel 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 <muli-7z/5BgaJwgfQT0dZR+AlfA@public.gmane.org> > > > >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? Cheers, Muli ------------------------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <20070201144606.GH15992-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org>]
* Re: [PATCH] simplify pdpte check [not found] ` <20070201144606.GH15992-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org> @ 2007-02-01 14:52 ` Avi Kivity [not found] ` <45C1FEA2.4050200-atKUWr5tajBWk0Htik3J/w@public.gmane.org> 2007-02-01 14:52 ` Dor Laor 1 sibling, 1 reply; 9+ messages in thread From: Avi Kivity @ 2007-02-01 14:52 UTC (permalink / raw) To: Muli Ben-Yehuda; +Cc: kvm-devel Muli Ben-Yehuda wrote: > 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 <muli-7z/5BgaJwgfQT0dZR+AlfA@public.gmane.org> >>> >>> 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? > pdpte == 2 is a legal value. in the original code, the (pdpte & 1) == 0 and we don't 'goto out'. In the patched code, (pdpte & 0xblah) == 2 and we 'goto out'. if the code had '||' instead of '&&', your change would be correct, but '&&' is really meant 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <45C1FEA2.4050200-atKUWr5tajBWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH] simplify pdpte check [not found] ` <45C1FEA2.4050200-atKUWr5tajBWk0Htik3J/w@public.gmane.org> @ 2007-02-01 14:57 ` Muli Ben-Yehuda 0 siblings, 0 replies; 9+ messages in thread From: Muli Ben-Yehuda @ 2007-02-01 14:57 UTC (permalink / raw) To: Avi Kivity; +Cc: kvm-devel On Thu, Feb 01, 2007 at 04:52:18PM +0200, Avi Kivity wrote: > pdpte == 2 is a legal value. in the original code, the (pdpte & 1) > == 0 and we don't 'goto out'. In the patched code, (pdpte & 0xblah) > == 2 and we 'goto out'. Yup, I got it now. Thanks. Cheers, Muli ------------------------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] simplify pdpte check [not found] ` <20070201144606.GH15992-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org> 2007-02-01 14:52 ` Avi Kivity @ 2007-02-01 14:52 ` Dor Laor [not found] ` <64F9B87B6B770947A9F8391472E032160A3F2213-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org> 1 sibling, 1 reply; 9+ messages in thread From: Dor Laor @ 2007-02-01 14:52 UTC (permalink / raw) To: Muli Ben-Yehuda, Avi Kivity; +Cc: kvm-devel >-----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 <muli-7z/5BgaJwgfQT0dZR+AlfA@public.gmane.org> >> > >> >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)' ? Although the original is more readable. > >Cheers, >Muli > >----------------------------------------------------------------------- -- >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=12164 2 >_______________________________________________ >kvm-devel mailing list >kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org >https://lists.sourceforge.net/lists/listinfo/kvm-devel ------------------------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <64F9B87B6B770947A9F8391472E032160A3F2213-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>]
* Re: [PATCH] simplify pdpte check [not found] ` <64F9B87B6B770947A9F8391472E032160A3F2213-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org> @ 2007-02-01 14:54 ` Avi Kivity [not found] ` <45C1FF23.1020201-atKUWr5tajBWk0Htik3J/w@public.gmane.org> 2007-02-01 14:57 ` Muli Ben-Yehuda 1 sibling, 1 reply; 9+ messages in thread From: Avi Kivity @ 2007-02-01 14:54 UTC (permalink / raw) To: Dor Laor; +Cc: kvm-devel, Avi Kivity 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 <muli-7z/5BgaJwgfQT0dZR+AlfA@public.gmane.org> >>>> >>>> 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <45C1FF23.1020201-atKUWr5tajBWk0Htik3J/w@public.gmane.org>]
* Re: [PATCH] simplify pdpte check [not found] ` <45C1FF23.1020201-atKUWr5tajBWk0Htik3J/w@public.gmane.org> @ 2007-02-01 14:56 ` Avi Kivity 0 siblings, 0 replies; 9+ messages in thread From: Avi Kivity @ 2007-02-01 14:56 UTC (permalink / raw) To: Avi Kivity; +Cc: kvm-devel, Avi Kivity Avi Kivity wrote: >> >> What about 'if (pdpte & 0xfffffff0000001e7ull > 0x1)' ? >> > > That would work. Actually it doesn't. pdpte == 2 fails. -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] simplify pdpte check [not found] ` <64F9B87B6B770947A9F8391472E032160A3F2213-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org> 2007-02-01 14:54 ` Avi Kivity @ 2007-02-01 14:57 ` Muli Ben-Yehuda 1 sibling, 0 replies; 9+ messages in thread From: Muli Ben-Yehuda @ 2007-02-01 14:57 UTC (permalink / raw) To: Dor Laor; +Cc: kvm-devel, Avi Kivity On Thu, Feb 01, 2007 at 06:52:47AM -0800, Dor Laor wrote: > What about 'if (pdpte & 0xfffffff0000001e7ull > 0x1)' ? > Although the original is more readable. The original is better, perhaps with a nice comment :-) Cheers, Muli ------------------------------------------------------------------------- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-02-01 14:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-01 14:01 [PATCH] simplify pdpte check Muli Ben-Yehuda
[not found] ` <20070201140138.GM2327-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org>
2007-02-01 14:07 ` Avi Kivity
[not found] ` <45C1F405.5070400-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-02-01 14:46 ` Muli Ben-Yehuda
[not found] ` <20070201144606.GH15992-WD1JZD8MxeCTrf4lBMg6DdBPR1lH4CV8@public.gmane.org>
2007-02-01 14:52 ` Avi Kivity
[not found] ` <45C1FEA2.4050200-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-02-01 14:57 ` Muli Ben-Yehuda
2007-02-01 14:52 ` Dor Laor
[not found] ` <64F9B87B6B770947A9F8391472E032160A3F2213-yEcIvxbTEBqsx+V+t5oei8rau4O3wl8o3fe8/T/H7NteoWH0uzbU5w@public.gmane.org>
2007-02-01 14:54 ` Avi Kivity
[not found] ` <45C1FF23.1020201-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-02-01 14:56 ` Avi Kivity
2007-02-01 14:57 ` Muli Ben-Yehuda
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox