Re: [patch] IPV4 spinlock_casting

From: Ingo Molnar
Date: Mon Aug 08 2005 - 04:06:24 EST



* Ingo Molnar <mingo@xxxxxxx> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/