Re: [patch] IPV4 spinlock_casting

2005-08-08 Thread Sven-Thorsten Dietrich
On Mon, 2005-08-08 at 11:06 +0200, Ingo Molnar wrote:
> 
> it just occured to me that !PREEMPT_RT builds would be affected by the
> #else branch, so i committed the build fix below into -52-15.
> 
> Ingo
> 

That fixes it. Thanks

Sven

> Index: linux/net/ipv4/route.c
> ===
> --- linux.orig/net/ipv4/route.c
> +++ linux/net/ipv4/route.c
> @@ -231,7 +231,7 @@ static spinlock_t   *rt_hash_locks;
> spin_lock_init(_hash_locks[i]); \
> }
>  #else
> -# define rt_hash_lock_addr(slot) NULL
> +# define rt_hash_lock_addr(slot) ((spinlock_t *)NULL)
>  # define rt_hash_lock_init()
>  #endif
>  
> 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] IPV4 spinlock_casting

2005-08-08 Thread Ingo Molnar

* Ingo Molnar <[EMAIL PROTECTED]> wrote:

> > Fix a compile error in net/ipv4/route.c when RT patch is applied:
> 
> > Index: linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c
> 
> are you sure you are seeing this with the -52-14 patch? If yes then 
> please send me your .config.
> 
> the build error showed a more fundamental bug, which had to be solved 
> differently. The problem was the code in route.c, the problem was this:
> 
>  # define rt_hash_lock_addr(slot) NULL
>  # define rt_hash_lock_init()
> 
> where NULL has no type. The solution for the build problem would have 
> been to cast the NULL to spinlock_t *, but we need this spinlock so 
> the correct solution was to add a || defined(PREEMPT_RT) to the #if 
> defined(CONFIG_SMP) line above. Solving the build problem alone only 
> fixes the symptom, not the bug.

it just occured to me that !PREEMPT_RT builds would be affected by the
#else branch, so i committed the build fix below into -52-15.

Ingo

Index: linux/net/ipv4/route.c
===
--- linux.orig/net/ipv4/route.c
+++ linux/net/ipv4/route.c
@@ -231,7 +231,7 @@ static spinlock_t   *rt_hash_locks;
spin_lock_init(_hash_locks[i]); \
}
 #else
-# define rt_hash_lock_addr(slot) NULL
+# define rt_hash_lock_addr(slot) ((spinlock_t *)NULL)
 # define rt_hash_lock_init()
 #endif
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] IPV4 spinlock_casting

2005-08-08 Thread Ingo Molnar

* Sven-Thorsten Dietrich <[EMAIL PROTECTED]> wrote:

> Fix a compile error in net/ipv4/route.c when RT patch is applied:

> Index: linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c

are you sure you are seeing this with the -52-14 patch? If yes then 
please send me your .config.

the build error showed a more fundamental bug, which had to be solved 
differently. The problem was the code in route.c, the problem was this:

 # define rt_hash_lock_addr(slot) NULL
 # define rt_hash_lock_init()

where NULL has no type. The solution for the build problem would have 
been to cast the NULL to spinlock_t *, but we need this spinlock so the 
correct solution was to add a || defined(PREEMPT_RT) to the #if 
defined(CONFIG_SMP) line above. Solving the build problem alone only 
fixes the symptom, not the bug.

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] IPV4 spinlock_casting

2005-08-08 Thread Ingo Molnar

* Sven-Thorsten Dietrich [EMAIL PROTECTED] wrote:

 Fix a compile error in net/ipv4/route.c when RT patch is applied:

 Index: linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c

are you sure you are seeing this with the -52-14 patch? If yes then 
please send me your .config.

the build error showed a more fundamental bug, which had to be solved 
differently. The problem was the code in route.c, the problem was this:

 # define rt_hash_lock_addr(slot) NULL
 # define rt_hash_lock_init()

where NULL has no type. The solution for the build problem would have 
been to cast the NULL to spinlock_t *, but we need this spinlock so the 
correct solution was to add a || defined(PREEMPT_RT) to the #if 
defined(CONFIG_SMP) line above. Solving the build problem alone only 
fixes the symptom, not the bug.

Ingo
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] IPV4 spinlock_casting

2005-08-08 Thread Ingo Molnar

* Ingo Molnar [EMAIL PROTECTED] wrote:

  Fix a compile error in net/ipv4/route.c when RT patch is applied:
 
  Index: linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c
 
 are you sure you are seeing this with the -52-14 patch? If yes then 
 please send me your .config.
 
 the build error showed a more fundamental bug, which had to be solved 
 differently. The problem was the code in route.c, the problem was this:
 
  # define rt_hash_lock_addr(slot) NULL
  # define rt_hash_lock_init()
 
 where NULL has no type. The solution for the build problem would have 
 been to cast the NULL to spinlock_t *, but we need this spinlock so 
 the correct solution was to add a || defined(PREEMPT_RT) to the #if 
 defined(CONFIG_SMP) line above. Solving the build problem alone only 
 fixes the symptom, not the bug.

it just occured to me that !PREEMPT_RT builds would be affected by the
#else branch, so i committed the build fix below into -52-15.

Ingo

Index: linux/net/ipv4/route.c
===
--- linux.orig/net/ipv4/route.c
+++ linux/net/ipv4/route.c
@@ -231,7 +231,7 @@ static spinlock_t   *rt_hash_locks;
spin_lock_init(rt_hash_locks[i]); \
}
 #else
-# define rt_hash_lock_addr(slot) NULL
+# define rt_hash_lock_addr(slot) ((spinlock_t *)NULL)
 # define rt_hash_lock_init()
 #endif
 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [patch] IPV4 spinlock_casting

2005-08-08 Thread Sven-Thorsten Dietrich
On Mon, 2005-08-08 at 11:06 +0200, Ingo Molnar wrote:
 
 it just occured to me that !PREEMPT_RT builds would be affected by the
 #else branch, so i committed the build fix below into -52-15.
 
 Ingo
 

That fixes it. Thanks

Sven

 Index: linux/net/ipv4/route.c
 ===
 --- linux.orig/net/ipv4/route.c
 +++ linux/net/ipv4/route.c
 @@ -231,7 +231,7 @@ static spinlock_t   *rt_hash_locks;
 spin_lock_init(rt_hash_locks[i]); \
 }
  #else
 -# define rt_hash_lock_addr(slot) NULL
 +# define rt_hash_lock_addr(slot) ((spinlock_t *)NULL)
  # define rt_hash_lock_init()
  #endif
  
 

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[patch] IPV4 spinlock_casting

2005-08-07 Thread Sven-Thorsten Dietrich
Fix a compile error in net/ipv4/route.c when RT patch is applied:

LD  .tmp_vmlinux1
net/built-in.o(.text+0x19058): In function `rt_check_expire':
net/ipv4/route.c:628: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x1907a):net/ipv4/route.c:661: undefined reference to 
`__bad_spinlock_type'
net/built-in.o(.text+0x1918b): In function `rt_run_flush':
net/ipv4/route.c:684: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x191a3):net/ipv4/route.c:688: undefined reference to 
`__bad_spinlock_type'
net/built-in.o(.text+0x193b9): In function `rt_garbage_collect':
net/ipv4/route.c:821: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x193e7):net/ipv4/route.c:853: more undefined references 
to `__bad_spinlock_type' follow
make: *** [.tmp_vmlinux1] Error 1

Problem is related to the RT PICK_OP function.

Adds explicit casting to spinlock_t (whatever that happens to be for the
given .config)

Signed-off-by: Sven-Thorsten Dietrich <[EMAIL PROTECTED]>

Index: linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c
===
--- linux-2.6.13-rc4-RT-V0.7.52-14.orig/net/ipv4/route.c
+++ linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c
@@ -228,7 +228,7 @@
rt_hash_locks = kmalloc(sizeof(spinlock_t) * RT_HASH_LOCK_SZ, 
GFP_KERNEL); \
if (!rt_hash_locks) panic("IP: failed to allocate 
rt_hash_locks\n"); \
for (i = 0; i < RT_HASH_LOCK_SZ; i++) \
-   spin_lock_init(_hash_locks[i]); \
+   spin_lock_init((spinlock_t *) _hash_locks[i]); \
}
 #else
 # define rt_hash_lock_addr(slot) NULL
@@ -625,7 +625,7 @@
 
if (*rthp == 0)
continue;
-   spin_lock(rt_hash_lock_addr(i));
+   spin_lock((spinlock_t *) rt_hash_lock_addr(i));
while ((rth = *rthp) != NULL) {
if (rth->u.dst.expires) {
/* Entry is expired even if it is in use */
@@ -658,7 +658,7 @@
rt_free(rth);
 #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */
}
-   spin_unlock(rt_hash_lock_addr(i));
+   spin_unlock((spinlock_t *) rt_hash_lock_addr(i));
 
/* Fallback loop breaker. */
if (time_after(jiffies, now))
@@ -681,11 +681,11 @@
get_random_bytes(_hash_rnd, 4);
 
for (i = rt_hash_mask; i >= 0; i--) {
-   spin_lock_bh(rt_hash_lock_addr(i));
+   spin_lock_bh((spinlock_t *) rt_hash_lock_addr(i));
rth = rt_hash_table[i].chain;
if (rth)
rt_hash_table[i].chain = NULL;
-   spin_unlock_bh(rt_hash_lock_addr(i));
+   spin_unlock_bh((spinlock_t *) rt_hash_lock_addr(i));
 
for (; rth; rth = next) {
next = rth->u.rt_next;
@@ -818,7 +818,7 @@
 
k = (k + 1) & rt_hash_mask;
rthp = _hash_table[k].chain;
-   spin_lock_bh(rt_hash_lock_addr(k));
+   spin_lock_bh((spinlock_t *) rt_hash_lock_addr(k));
while ((rth = *rthp) != NULL) {
if (!rt_may_expire(rth, tmo, expire)) {
tmo >>= 1;
@@ -850,7 +850,7 @@
goal--;
 #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */
}
-   spin_unlock_bh(rt_hash_lock_addr(k));
+   spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(k));
if (goal <= 0)
break;
}
@@ -920,7 +920,7 @@
 
rthp = _hash_table[hash].chain;
 
-   spin_lock_bh(rt_hash_lock_addr(hash));
+   spin_lock_bh((spinlock_t *) rt_hash_lock_addr(hash));
while ((rth = *rthp) != NULL) {
 #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
if (!(rth->u.dst.flags & DST_BALANCED) &&
@@ -946,7 +946,7 @@
rth->u.dst.__use++;
dst_hold(>u.dst);
rth->u.dst.lastuse = now;
-   spin_unlock_bh(rt_hash_lock_addr(hash));
+   spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(hash));
 
rt_drop(rt);
*rp = rth;
@@ -987,7 +987,7 @@
if (rt->rt_type == RTN_UNICAST || rt->fl.iif == 0) {
int err = arp_bind_neighbour(>u.dst);
if (err) {
-   spin_unlock_bh(rt_hash_lock_addr(hash));
+   spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(hash));
 
if (err != -ENOBUFS) {
rt_drop(rt);
@@ -1028,7 +1028,7 @@
}
 #endif
rt_hash_table[hash].chain = rt;
-   spin_unlock_bh(rt_hash_lock_addr(hash));

[patch] IPV4 spinlock_casting

2005-08-07 Thread Sven-Thorsten Dietrich
Fix a compile error in net/ipv4/route.c when RT patch is applied:

LD  .tmp_vmlinux1
net/built-in.o(.text+0x19058): In function `rt_check_expire':
net/ipv4/route.c:628: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x1907a):net/ipv4/route.c:661: undefined reference to 
`__bad_spinlock_type'
net/built-in.o(.text+0x1918b): In function `rt_run_flush':
net/ipv4/route.c:684: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x191a3):net/ipv4/route.c:688: undefined reference to 
`__bad_spinlock_type'
net/built-in.o(.text+0x193b9): In function `rt_garbage_collect':
net/ipv4/route.c:821: undefined reference to `__bad_spinlock_type'
net/built-in.o(.text+0x193e7):net/ipv4/route.c:853: more undefined references 
to `__bad_spinlock_type' follow
make: *** [.tmp_vmlinux1] Error 1

Problem is related to the RT PICK_OP function.

Adds explicit casting to spinlock_t (whatever that happens to be for the
given .config)

Signed-off-by: Sven-Thorsten Dietrich [EMAIL PROTECTED]

Index: linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c
===
--- linux-2.6.13-rc4-RT-V0.7.52-14.orig/net/ipv4/route.c
+++ linux-2.6.13-rc4-RT-V0.7.52-14/net/ipv4/route.c
@@ -228,7 +228,7 @@
rt_hash_locks = kmalloc(sizeof(spinlock_t) * RT_HASH_LOCK_SZ, 
GFP_KERNEL); \
if (!rt_hash_locks) panic(IP: failed to allocate 
rt_hash_locks\n); \
for (i = 0; i  RT_HASH_LOCK_SZ; i++) \
-   spin_lock_init(rt_hash_locks[i]); \
+   spin_lock_init((spinlock_t *) rt_hash_locks[i]); \
}
 #else
 # define rt_hash_lock_addr(slot) NULL
@@ -625,7 +625,7 @@
 
if (*rthp == 0)
continue;
-   spin_lock(rt_hash_lock_addr(i));
+   spin_lock((spinlock_t *) rt_hash_lock_addr(i));
while ((rth = *rthp) != NULL) {
if (rth-u.dst.expires) {
/* Entry is expired even if it is in use */
@@ -658,7 +658,7 @@
rt_free(rth);
 #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */
}
-   spin_unlock(rt_hash_lock_addr(i));
+   spin_unlock((spinlock_t *) rt_hash_lock_addr(i));
 
/* Fallback loop breaker. */
if (time_after(jiffies, now))
@@ -681,11 +681,11 @@
get_random_bytes(rt_hash_rnd, 4);
 
for (i = rt_hash_mask; i = 0; i--) {
-   spin_lock_bh(rt_hash_lock_addr(i));
+   spin_lock_bh((spinlock_t *) rt_hash_lock_addr(i));
rth = rt_hash_table[i].chain;
if (rth)
rt_hash_table[i].chain = NULL;
-   spin_unlock_bh(rt_hash_lock_addr(i));
+   spin_unlock_bh((spinlock_t *) rt_hash_lock_addr(i));
 
for (; rth; rth = next) {
next = rth-u.rt_next;
@@ -818,7 +818,7 @@
 
k = (k + 1)  rt_hash_mask;
rthp = rt_hash_table[k].chain;
-   spin_lock_bh(rt_hash_lock_addr(k));
+   spin_lock_bh((spinlock_t *) rt_hash_lock_addr(k));
while ((rth = *rthp) != NULL) {
if (!rt_may_expire(rth, tmo, expire)) {
tmo = 1;
@@ -850,7 +850,7 @@
goal--;
 #endif /* CONFIG_IP_ROUTE_MULTIPATH_CACHED */
}
-   spin_unlock_bh(rt_hash_lock_addr(k));
+   spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(k));
if (goal = 0)
break;
}
@@ -920,7 +920,7 @@
 
rthp = rt_hash_table[hash].chain;
 
-   spin_lock_bh(rt_hash_lock_addr(hash));
+   spin_lock_bh((spinlock_t *) rt_hash_lock_addr(hash));
while ((rth = *rthp) != NULL) {
 #ifdef CONFIG_IP_ROUTE_MULTIPATH_CACHED
if (!(rth-u.dst.flags  DST_BALANCED) 
@@ -946,7 +946,7 @@
rth-u.dst.__use++;
dst_hold(rth-u.dst);
rth-u.dst.lastuse = now;
-   spin_unlock_bh(rt_hash_lock_addr(hash));
+   spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(hash));
 
rt_drop(rt);
*rp = rth;
@@ -987,7 +987,7 @@
if (rt-rt_type == RTN_UNICAST || rt-fl.iif == 0) {
int err = arp_bind_neighbour(rt-u.dst);
if (err) {
-   spin_unlock_bh(rt_hash_lock_addr(hash));
+   spin_unlock_bh((spinlock_t *)rt_hash_lock_addr(hash));
 
if (err != -ENOBUFS) {
rt_drop(rt);
@@ -1028,7 +1028,7 @@
}
 #endif
rt_hash_table[hash].chain = rt;
-   spin_unlock_bh(rt_hash_lock_addr(hash));
+