Re: [PATCH RFC 24/67] MIPS: asm: spinlock: Replace sub instruction with addiu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 18, 2014 at 10:53:05AM -0800, David Daney wrote:

> On 12/18/2014 07:09 AM, Markos Chandras wrote:
> >sub $reg, imm is not a real MIPS instruction. The assembler replaces
> >that with 'addi $reg, -imm'.
> 
> That is a bug right there.  We cannot have faulting instructions like this
> in the kernel.

The instruction is meant to kill the kernel if a readlock gets unlocked
more often than it was taken.  Think of it as an efficient method of
implementing a BUG_ON() for this condition.

I've only seen that overflow exception once and honestly, the primary
reason was my desparate search for a rarely used CPU feature.  So if
this ADDI is repaced by an ADDIU I won't be sad.

  Ralf





[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux