Re: [RT] seqlocks: use of PICK_FUNCTION breaks kernel compile when CONFIG_GENERIC_TIME is NOT set

Previous thread: [PATCH TRIVIAL 2.6.23-git9] CREDITS: correct Mikael Pettersson's URL by Mikael Pettersson on Tuesday, October 16, 2007 - 12:33 am. (1 message)

Next thread: [PATCH] Update libata driver for bf548 atapi controller against the 2.6.24 tree. by Sonic Zhang on Tuesday, October 16, 2007 - 1:43 am. (3 messages)
From: Remy Bohmer
Date: Tuesday, October 16, 2007 - 1:35 am

Hello Daniel and Ingo,

I use 2.6.23-rt1 and the patch of Daniel below which seems to be in
there breaks the compilation of the RT-kernel when CONFIG_GENERIC_TIME
is NOT set.

It breaks in the do_gettimeofday(struct timeval *tv) code in the
architecture specific code
where there is a call to: seq = read_seqbegin_irqsave(&xtime_lock, flags);
The PICK_FUNCTION implementation does not return anything, so the
compile breaks here.

I am figuring out how to solve this problem nicely, but I have not
found a nice solution yet. Attached I have put my hack to make it
compile on ARM again, but maybe one of you can do a better proposal to
fix this.

Here is a list of files that will probably all fail to build: (I only
tested ARM)
linux-2.6.23/arch/arm/kernel/time.c:254
linux-2.6.23/arch/xtensa/kernel/time.c:132
linux-2.6.23/arch/sparc/kernel/time.c:453
linux-2.6.23/arch/sparc/kernel/pcic.c:776
linux-2.6.23/arch/blackfin/kernel/time.c:269
linux-2.6.23/arch/m68knommu/kernel/time.c:130
linux-2.6.23/arch/sh64/kernel/time.c:193
linux-2.6.23/arch/alpha/kernel/time.c:408
linux-2.6.23/arch/sh/kernel/time.c:65
linux-2.6.23/arch/m68k/kernel/time.c:104
linux-2.6.23/arch/ppc/kernel/time.c:207
linux-2.6.23/arch/s390/kernel/time.c:197


Kind Regards,

Remy Bohmer


From: Daniel Walker
Date: Tuesday, October 16, 2007 - 9:52 am

Here's another fix for this. I compile tested for ARM (!GENERIC_TIME) ,
but I didn't boot test .. Could you boot test this patch?

---

Move the read_seqbegin() call up in the chain so the value 
can be returned

Signed-off-by: Daniel Walker <dwalker@mvista.com>

---
 include/linux/seqlock.h |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Index: linux-2.6.23/include/linux/seqlock.h
===================================================================
--- linux-2.6.23.orig/include/linux/seqlock.h
+++ linux-2.6.23/include/linux/seqlock.h
@@ -285,21 +285,20 @@ unsigned long __read_seqbegin_irqsave_ra
 	unsigned long flags;
 
 	local_irq_save(flags);
-	__read_seqbegin_raw(sl);
 	return flags;
 }
 
 static __always_inline unsigned long __read_seqbegin_irqsave(seqlock_t *sl)
 {
-	__read_seqbegin(sl);
 	return 0;
 }
 
 #define read_seqbegin_irqsave(lock, flags)			\
-do {								\
+({								\
 	flags = PICK_SEQ_OP_RET(__read_seqbegin_irqsave_raw,	\
 		__read_seqbegin_irqsave, lock);			\
-} while (0)
+	read_seqbegin(lock);					\
+})
 
 static __always_inline int
 __read_seqretry_irqrestore(seqlock_t *sl, unsigned iv, unsigned long flags)


-

From: Remy Bohmer
Date: Wednesday, October 17, 2007 - 7:07 am

This fix seems to work! The target still boots properly. So, it can be
pushed upstream... :-)

Kind Regards,

Remy Bohmer

-

Previous thread: [PATCH TRIVIAL 2.6.23-git9] CREDITS: correct Mikael Pettersson's URL by Mikael Pettersson on Tuesday, October 16, 2007 - 12:33 am. (1 message)

Next thread: [PATCH] Update libata driver for bf548 atapi controller against the 2.6.24 tree. by Sonic Zhang on Tuesday, October 16, 2007 - 1:43 am. (3 messages)