Skip to contentSkip to conversation

ARM11 MPCore: Adding nop to __delay() doubles the BogoMIPS/lpj

DISCUSSION Uwe Kleine-König 3 participants 3 messages Jan 29, 2010

lore
Share & tools
lore
#0 lore raw

Hello,

Quoted 9 lines · Leif Lindholm
Quoted 8 lines

-----Original Message-----
From: linux-arm-kernel-bounces at lists.infradead.org [mailto:linux-arm- kernel-bounces at lists.infradead.org] On Behalf Of Dirk Behme
Sent: 27 January 2010 16:45

On a 400MHz ARM11 MPCore system (NEC NaviEngine based) with kernel 2.6.32 we found that BogoMIPS/loops per jiffies ~doubles (see below [1]) by adding a nop to __delay():

Quoted 8 lines

The reason for this is that the ARM11 MPCore doesn't fold branch instructions for busy-wait-style loops. Inserting the nop (or any other non-branch instruction) removes the branch instruction from the execution stream.
http://infocenter.arm.com/help/topic/com.arm.doc.ddi0360f/ch06s02s04.html

But as Catalin says, this makes no functional difference, even though it might look "more impressive" :)

With a bigger number of loops_per_seconds the maximal period that can be delayed for is shorter and the granularity is better, no?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
#1 lore raw
Quoted 9 lines

-----Original Message-----
From: Uwe Kleine-K?nig [mailto:u.kleine-koenig at pengutronix.de]
Sent: 29 January 2010 14:54

Quoted 2 lines

But as Catalin says, this makes no functional difference, even though it might look "more impressive" :)

With a bigger number of loops_per_seconds the maximal period that can be delayed for is shorter and the granularity is better, no?

I concur that this aspect of my comment was technically incorrect - but if your code was depending on either of those, surely that would be a problem in itself?

The minimum time would be questionable anyway, as loops_per_second is an average, and the branch predictor is fairly likely to miss on the first time through the loop unless your code uses a lot of delays.

/
Leif

#2 lore raw
Quoted 10 lines · Leif Lindholm
Quoted 9 lines

-----Original Message-----
From: Uwe Kleine-K?nig [mailto:u.kleine-koenig at pengutronix.de]
Sent: 29 January 2010 14:54

Quoted 2 lines

But as Catalin says, this makes no functional difference, even though it might look "more impressive" :)

With a bigger number of loops_per_seconds the maximal period that can be delayed for is shorter and the granularity is better, no?

Quoted 7 lines

I concur that this aspect of my comment was technically incorrect - but if your code was depending on either of those, surely that would be a problem in itself?

The minimum time would be questionable anyway, as loops_per_second is an average, and the branch predictor is fairly likely to miss on the first time through the loop unless your code uses a lot of delays.

Not only that, but it takes a certain number of cycles to calculate the number of loops for any given delay; the smaller the delay the more significant that is. For very short delays (eg, one loop) that it swamps the loop itself.