[Gelistirici] Fwd: [PATCH -mm] ide_end_drive_cmd(): avoid instruction pipeline stall

İsmail Dönmez ismail at pardus.org.tr
1 Tem 2006 Cmt 02:56:27 EEST


Bu yama Alan Cox tarafından kabul edilmemesine rağmen ( x86 harici bir işe 
yaramadığını ve aslında bir gcc problemi olduğunu söylüyor ) IDE'de bazı 
durumlarda 333%'e varan yavaşlamaları engellediği söyleniyor ( 
Al Boldi <a1426z at gawab.com> nin iddiası ) , bence yama hiçbirşeyi bozamayacak 
kadar basit. Bir deneyelim derim.

/ismail

----------  Yönlendirilmiş İleti  ----------

Subject: [PATCH -mm] ide_end_drive_cmd(): avoid instruction pipeline stall
Date: Cuma 30 Haziran 2006 19:13
From: Andreas Mohr <andi at rhlx01.fht-esslingen.de>
To: Andrew Morton <akpm at osdl.org>
Cc: B.Zolnierkiewicz at elka.pw.edu.pl, linux-ide at vger.kernel.org, kernel list 
<linux-kernel at vger.kernel.org>

Use an independently-formatted "unsigned int" for data instead of a
restrictive "u16" to avoid instruction fetch pipeline stalls
probably caused by the byte calculations later.


ide_end_drive_cmd() uses an u16 variable for the result of an INW()
which it then does some byte masking operations on.
On my P3/700, this results in a highly visible IFU_MEM_STALL oprofile blip
when doing a simple "load 30 larger GUI apps in parallel" benchmark
(which takes about 1:30 or so, BTW):
The ide_end_drive_cmd() IFU_MEM_STALL amounts to 0.59% of all IFU_MEM_STALL
events during the profiling, with this opcode line amounting to > 95%
IFU_MEM_STALL within the function itself.

Replacing the u16 by an architecture-independently formatted unsigned int
to ease the byte-masking operations:

	/* no u16 here: caused severe IFU_MEM_STALL! */
	unsigned int data                               = hwif->INW(IDE_DATA_REG);
	args->tfRegister[IDE_DATA_OFFSET]       = (data) & 0xFF;
	args->hobRegister[IDE_DATA_OFFSET]      = (data >> 8) & 0xFF;

completely puts ide_end_drive_cmd() off the IFU_MEM_STALL radar during
repeated profiling attempts (after a fresh reboot with the modified kernel),
as opposed to having been the *top* oprofile trace item before.

I suppose that this is something like a textbook example of why it's
sometimes not beneficial to not use native-sized (i.e., 32bit) variables,
right?

Run-tested on 2.6.17-mm4.

Signed-off-by: Andreas Mohr <andi at lisas.de>


diff -urN linux-2.6.17-mm4.orig/drivers/ide/ide-io.c
 linux-2.6.17-mm4.my/drivers/ide/ide-io.c ---
 linux-2.6.17-mm4.orig/drivers/ide/ide-io.c	2006-06-29 11:57:12.000000000
 +0200 +++ linux-2.6.17-mm4.my/drivers/ide/ide-io.c	2006-06-30
 11:54:12.000000000 +0200 @@ -397,7 +397,8 @@

 		if (args) {
 			if (args->tf_in_flags.b.data) {
-				u16 data				= hwif->INW(IDE_DATA_REG);
+				/* no u16 here: caused severe IFU_MEM_STALL! */
+				unsigned int data				= hwif->INW(IDE_DATA_REG);
 				args->tfRegister[IDE_DATA_OFFSET]	= (data) & 0xFF;
 				args->hobRegister[IDE_DATA_OFFSET]	= (data >> 8) & 0xFF;
 			}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

-------------------------------------------------------

-- 
日本のanimeは揺れる 



Gelistirici mesaj listesiyle ilgili daha fazla bilgi