Skip to contentSkip to conversation

UML - Delay loop cleanups

PATCH In review Jeff Dike 4 participants 6 messages May 20, 2005 – May 23, 2005 1 message not in the archive User-mode Linux (UML)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Jeff Dike

author
#1 lore raw
Quoted 1 line · [email protected] said:

I'll drop this in light of the review comments - pls redo&&resend

Here 'tis.

This patch cleans up the delay implementations a bit, makes the loops unoptimizable, and exports __udelay and __const_udelay.

arch/um/sys-i386/delay.c +12 -4
Index: linux-2.6.11/arch/um/sys-i386/delay.c
===================================================================
@@ -1,5 +1,7 @@
-#include "linux/delay.h"
-#include "asm/param.h"
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <asm/param.h>
 
 void __delay(unsigned long time)
 {
@@ -20,13 +22,19 @@ void __udelay(unsigned long usecs)
 	int i, n;
 
 	n = (loops_per_jiffy * HZ * usecs) / MILLION;
-	for(i=0;i<n;i++) ;
+        for(i=0;i<n;i++)
+                cpu_relax();
 }
 
+EXPORT_SYMBOL(__udelay);
+
 void __const_udelay(unsigned long usecs)
 {
 	int i, n;
 
 	n = (loops_per_jiffy * HZ * usecs) / MILLION;
-	for(i=0;i<n;i++) ;
+        for(i=0;i<n;i++)
+                cpu_relax();
 }
+
+EXPORT_SYMBOL(__const_udelay);
arch/um/sys-x86_64/delay.c +15 -18
Index: linux-2.6.11/arch/um/sys-x86_64/delay.c
===================================================================
@@ -5,40 +5,37 @@
  * Licensed under the GPL
  */
 
-#include "linux/delay.h"
-#include "asm/processor.h"
-#include "asm/param.h"
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <asm/processor.h>
+#include <asm/param.h>
 
 void __delay(unsigned long loops)
 {
 	unsigned long i;
 
-	for(i = 0; i < loops; i++) ;
+        for(i = 0; i < loops; i++)
+                cpu_relax();
 }
 
 void __udelay(unsigned long usecs)
 {
-	int i, n;
+	unsigned long i, n;
 
 	n = (loops_per_jiffy * HZ * usecs) / MILLION;
-	for(i=0;i<n;i++) ;
+        for(i=0;i<n;i++)
+                cpu_relax();
 }
 
+EXPORT_SYMBOL(__udelay);
+
 void __const_udelay(unsigned long usecs)
 {
-	int i, n;
+	unsigned long i, n;
 
 	n = (loops_per_jiffy * HZ * usecs) / MILLION;
-	for(i=0;i<n;i++) ;
+        for(i=0;i<n;i++)
+                cpu_relax();
 }
 
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
+EXPORT_SYMBOL(__const_udelay);

-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#2 lore raw

PATCH 1/1 UML - 2.6.12-rc4-mm2 Compile error

Here is a patch to correct a compile error on linux 2.6.12-rc4-mm2 for uml.
At the compilation of init/main.c, it complains because it doens't find the 2 constants FIXADDR_USER_START and FIXADDR_USER_END

include/asm/fixmap.h 2005-05-22 21:38:17.000000000 +0200 renamed from include/asm/fixmap.h.orig 2005-05-22 21:37:13.000000000 +0200 +0 -0
@@ -60,7 +60,8 @@ extern unsigned long get_kmem_end(void);
 

#define FIXADDR_TOP (get_kmem_end() - 0x2000) #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) -#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) +#define FIXADDR_USER_START (FIXADDR_TOP - FIXADDR_SIZE) +#define FIXADDR_USER_END FIXADDR_TOP

#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT)) #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT) @@ -91,7 +92,7 @@ static inline unsigned long fix_to_virt(

static inline unsigned long virt_to_fix(const unsigned long vaddr) {

- BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
+ BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_USER_START);

return __virt_to_fix(vaddr);
}

-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw

Re: [uml-devel] [PATCH] UML - 2.6.12-rc4-mm2 Compile error

Quoted 3 lines · Eric BEGOT

Here is a patch to correct a compile error on linux 2.6.12-rc4-mm2 for uml. At the compilation of init/main.c, it complains because it doens't find the 2 constants FIXADDR_USER_START and FIXADDR_USER_END

Why deleting FIXADDR_START? Also FIXADDR_USER_* are defined, just in a different way (and the patch below is IIRC uncorrect).

Quoted 23 lines

--- linux-2.6.12-rc4-mm2/include/asm/fixmap.h.orig 2005-05-22 21:37:13.000000000 +0200
+++ linux-2.6.12-rc4-mm2/include/asm/fixmap.h 2005-05-22 21:38:17.000000000 +0200

(quoted diff) +3 -2
@@ -60,7 +60,8 @@ extern unsigned long get_kmem_end(void);
 
 #define FIXADDR_TOP (get_kmem_end() - 0x2000)
 #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
-#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
+#define FIXADDR_USER_START (FIXADDR_TOP - FIXADDR_SIZE)
+#define FIXADDR_USER_END FIXADDR_TOP
 
 #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
 #define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
@@ -91,7 +92,7 @@ static inline unsigned long fix_to_virt(
 
 static inline unsigned long virt_to_fix(const unsigned long vaddr)
 {
- BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
+ BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_USER_START);
 return __virt_to_fix(vaddr);
 }
Signature · 17 lines
Paolo Giarrusso, aka Blaisorblade
Skype user "PaoloGiarrusso"
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#4 lore raw

Re: [uml-devel] [PATCH] UML - 2.6.12-rc4-mm2 Compile error

Quoted 5 lines
Quoted 3 lines

Here is a patch to correct a compile error on linux 2.6.12-rc4-mm2 for uml. At the compilation of init/main.c, it complains because it doens't find the 2 constants FIXADDR_USER_START and FIXADDR_USER_END

Why deleting FIXADDR_START? Also FIXADDR_USER_* are defined, just in a different way (and the patch below is IIRC uncorrect).

I've seen this error too after 'make menuconfig ARCH=um' on a clean tree.

The following fixes it:

cp .config /tmp
make mrproper ARCH=um
cp /tmp/.config .
make ARCH=um

So there's definitely something wrong with the build on UML.

Miklos

-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#5 lore raw

Re: [uml-devel] [PATCH] UML - 2.6.12-rc4-mm2 Compile error

Quoted 10 lines · Miklos Szeredi
Quoted 6 lines
Quoted 3 lines

Here is a patch to correct a compile error on linux 2.6.12-rc4-mm2 for uml. At the compilation of init/main.c, it complains because it doens't find the 2 constants FIXADDR_USER_START and FIXADDR_USER_END

Why deleting FIXADDR_START? Also FIXADDR_USER_* are defined, just in a different way (and the patch below is IIRC uncorrect).

I've seen this error too after 'make menuconfig ARCH=um' on a clean tree.

Quoted 8 lines

The following fixes it:

cp .config /tmp
make mrproper ARCH=um
cp /tmp/.config .
make ARCH=um

So there's definitely something wrong with the build on UML.

Yes, an empty include/asm-um/elf.h which is not by default replaced by a symlink. Sadly a patch which should have been deleted it simply emptied it (courtesy of quilt). So

include/asm-um/elf.h:

	$(call create_the_symlink)

(which is pseudo-code) won't create it.

As a last resort I'll force that symlink to be unconditional (I hope not needing this).

Signature · 17 lines
Paolo Giarrusso, aka Blaisorblade
Skype user "PaoloGiarrusso"
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#6 lore raw

Re: [uml-devel] [PATCH] UML - 2.6.12-rc4-mm2 Compile error

In reply to Eric BEGOT
Quoted 3 lines · Eric BEGOT

Here is a patch to correct a compile error on linux 2.6.12-rc4-mm2 for uml. At the compilation of init/main.c, it complains because it doens't find the 2 constants FIXADDR_USER_START and FIXADDR_USER_END

On mainline it's defined by either include/asm-um/archparam-x86_64.h or include/asm-um/elf-i386.h.

Make sure you used a clean tree and a correct command line (make init/main.o ARCH=um wouldn't work because it would not create the needed header symlinks).

Signature · 17 lines
Paolo Giarrusso, aka Blaisorblade
Skype user "PaoloGiarrusso"
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade




-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel