* [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc.
@ 2007-12-24 14:23 Julia Lawall
2007-12-24 15:31 ` Andi Kleen
0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2007-12-24 14:23 UTC (permalink / raw)
To: andi, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
The functions time_before, time_before_eq, time_after, and time_after_eq
are more robust for comparing jiffies against other values.
A simplified version of the semantic patch making this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@ change_compare_np @
expression E;
@@
(
- jiffies <= E
+ time_before_eq(jiffies,E)
|
- jiffies >= E
+ time_after_eq(jiffies,E)
|
- jiffies < E
+ time_before(jiffies,E)
|
- jiffies > E
+ time_after(jiffies,E)
)
@ include depends on change_compare_np @
@@
#include <linux/jiffies.h>
@ no_include depends on !include && change_compare_np @
@@
#include <linux/...>
+ #include <linux/jiffies.h>
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
diff -r -u -p a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
--- a/arch/x86/ia32/ia32_aout.c 2007-10-22 11:25:00.000000000 +0200
+++ b/arch/x86/ia32/ia32_aout.c 2007-12-23 20:31:29.000000000 +0100
@@ -25,6 +25,7 @@
#include <linux/binfmts.h>
#include <linux/personality.h>
#include <linux/init.h>
+#include <linux/jiffies.h>
#include <asm/system.h>
#include <asm/uaccess.h>
@@ -344,14 +345,15 @@ static int load_aout_binary(struct linux
#ifdef WARN_OLD
static unsigned long error_time, error_time2;
if ((ex.a_text & 0xfff || ex.a_data & 0xfff) &&
- (N_MAGIC(ex) != NMAGIC) && (jiffies-error_time2) > 5*HZ)
+ (N_MAGIC(ex) != NMAGIC) &&
+ time_after(jiffies, error_time2 + 5*HZ))
{
printk(KERN_NOTICE "executable not page aligned\n");
error_time2 = jiffies;
}
if ((fd_offset & ~PAGE_MASK) != 0 &&
- (jiffies-error_time) > 5*HZ)
+ time_after(jiffies, error_time + 5*HZ))
{
printk(KERN_WARNING
"fd_offset is not page aligned. Please convert program: %s\n",
@@ -467,7 +469,7 @@ static int load_aout_library(struct file
#ifdef WARN_OLD
static unsigned long error_time;
- if ((jiffies-error_time) > 5*HZ)
+ if (time_after(jiffies, error_time + 5*HZ))
{
printk(KERN_WARNING
"N_TXTOFF is not page aligned. Please convert library: %s\n",
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc.
2007-12-24 14:23 [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc Julia Lawall
@ 2007-12-24 15:31 ` Andi Kleen
2007-12-24 15:58 ` Julia Lawall
0 siblings, 1 reply; 8+ messages in thread
From: Andi Kleen @ 2007-12-24 15:31 UTC (permalink / raw)
To: Julia Lawall; +Cc: andi, linux-kernel, kernel-janitors
On Mon, Dec 24, 2007 at 03:23:19PM +0100, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> The functions time_before, time_before_eq, time_after, and time_after_eq
> are more robust for comparing jiffies against other values.
The old code was actually correct I think, but the change is ok for me.
-Andi
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc.
2007-12-24 15:31 ` Andi Kleen
@ 2007-12-24 15:58 ` Julia Lawall
2007-12-30 13:33 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2007-12-24 15:58 UTC (permalink / raw)
To: Andi Kleen; +Cc: linux-kernel, kernel-janitors
On Mon, 24 Dec 2007, Andi Kleen wrote:
> On Mon, Dec 24, 2007 at 03:23:19PM +0100, Julia Lawall wrote:
> > From: Julia Lawall <julia@diku.dk>
> >
> > The functions time_before, time_before_eq, time_after, and time_after_eq
> > are more robust for comparing jiffies against other values.
>
> The old code was actually correct I think, but the change is ok for me.
Please ignore the patch. All of my before_eq and after_eq's are
backwards due to parsing <= as >= and vice versa. I will try again.
julia
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc.
2007-12-24 15:58 ` Julia Lawall
@ 2007-12-30 13:33 ` Ingo Molnar
2007-12-30 14:55 ` Julia Lawall
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2007-12-30 13:33 UTC (permalink / raw)
To: Julia Lawall; +Cc: Andi Kleen, linux-kernel, kernel-janitors
* Julia Lawall <julia@diku.dk> wrote:
> On Mon, 24 Dec 2007, Andi Kleen wrote:
>
> > On Mon, Dec 24, 2007 at 03:23:19PM +0100, Julia Lawall wrote:
> > > From: Julia Lawall <julia@diku.dk>
> > >
> > > The functions time_before, time_before_eq, time_after, and time_after_eq
> > > are more robust for comparing jiffies against other values.
> >
> > The old code was actually correct I think, but the change is ok for me.
>
> Please ignore the patch. All of my before_eq and after_eq's are
> backwards due to parsing <= as >= and vice versa. I will try again.
your x86 patches (#7, #8 and #9) do not include any *_eq() comparisons
and they all seem to be correct. So picked those three up into x86.git -
let me know if there's any breakage in them that i missed.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc.
2007-12-30 13:33 ` Ingo Molnar
@ 2007-12-30 14:55 ` Julia Lawall
2007-12-30 15:41 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2007-12-30 14:55 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andi Kleen, linux-kernel, kernel-janitors
On Sun, 30 Dec 2007, Ingo Molnar wrote:
>
> * Julia Lawall <julia@diku.dk> wrote:
>
> > On Mon, 24 Dec 2007, Andi Kleen wrote:
> >
> > > On Mon, Dec 24, 2007 at 03:23:19PM +0100, Julia Lawall wrote:
> > > > From: Julia Lawall <julia@diku.dk>
> > > >
> > > > The functions time_before, time_before_eq, time_after, and time_after_eq
> > > > are more robust for comparing jiffies against other values.
> > >
> > > The old code was actually correct I think, but the change is ok for me.
> >
> > Please ignore the patch. All of my before_eq and after_eq's are
> > backwards due to parsing <= as >= and vice versa. I will try again.
>
> your x86 patches (#7, #8 and #9) do not include any *_eq() comparisons
> and they all seem to be correct. So picked those three up into x86.git -
> let me know if there's any breakage in them that i missed.
Only #7 is ok. The other two have #include <jiffies.h> in the wrong
place. I will send new versions of #8 and #9 shortly.
julia
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc.
2007-12-30 14:55 ` Julia Lawall
@ 2007-12-30 15:41 ` Ingo Molnar
2007-12-30 15:51 ` Julia Lawall
0 siblings, 1 reply; 8+ messages in thread
From: Ingo Molnar @ 2007-12-30 15:41 UTC (permalink / raw)
To: Julia Lawall; +Cc: Andi Kleen, linux-kernel, kernel-janitors
* Julia Lawall <julia@diku.dk> wrote:
> > your x86 patches (#7, #8 and #9) do not include any *_eq()
> > comparisons and they all seem to be correct. So picked those three
> > up into x86.git - let me know if there's any breakage in them that i
> > missed.
>
> Only #7 is ok. The other two have #include <jiffies.h> in the wrong
> place. I will send new versions of #8 and #9 shortly.
hm, #include file order in a .c file should normally not matter - why
are they in the wrong place?
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc.
2007-12-30 15:41 ` Ingo Molnar
@ 2007-12-30 15:51 ` Julia Lawall
2007-12-30 16:04 ` Ingo Molnar
0 siblings, 1 reply; 8+ messages in thread
From: Julia Lawall @ 2007-12-30 15:51 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Andi Kleen, linux-kernel, kernel-janitors
On Sun, 30 Dec 2007, Ingo Molnar wrote:
>
> * Julia Lawall <julia@diku.dk> wrote:
>
> > > your x86 patches (#7, #8 and #9) do not include any *_eq()
> > > comparisons and they all seem to be correct. So picked those three
> > > up into x86.git - let me know if there's any breakage in them that i
> > > missed.
> >
> > Only #7 is ok. The other two have #include <jiffies.h> in the wrong
> > place. I will send new versions of #8 and #9 shortly.
>
> hm, #include file order in a .c file should normally not matter - why
> are they in the wrong place?
Because they are under #ifdefs, but the code that uses the time functions
is not under the same #ifdef.
julia
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc.
2007-12-30 15:51 ` Julia Lawall
@ 2007-12-30 16:04 ` Ingo Molnar
0 siblings, 0 replies; 8+ messages in thread
From: Ingo Molnar @ 2007-12-30 16:04 UTC (permalink / raw)
To: Julia Lawall; +Cc: Andi Kleen, linux-kernel, kernel-janitors
* Julia Lawall <julia@diku.dk> wrote:
> > hm, #include file order in a .c file should normally not matter -
> > why are they in the wrong place?
>
> Because they are under #ifdefs, but the code that uses the time
> functions is not under the same #ifdef.
ah, ok - you are right. I fixed them up manually in x86.git.
Ingo
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-12-30 16:04 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-24 14:23 [PATCH 7/38] arch/x86/ia32: Use time_before, time_before_eq, etc Julia Lawall
2007-12-24 15:31 ` Andi Kleen
2007-12-24 15:58 ` Julia Lawall
2007-12-30 13:33 ` Ingo Molnar
2007-12-30 14:55 ` Julia Lawall
2007-12-30 15:41 ` Ingo Molnar
2007-12-30 15:51 ` Julia Lawall
2007-12-30 16:04 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox