From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935887AbcLOMIw (ORCPT ); Thu, 15 Dec 2016 07:08:52 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:36607 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752693AbcLOMIs (ORCPT ); Thu, 15 Dec 2016 07:08:48 -0500 Date: Thu, 15 Dec 2016 11:51:54 +0000 From: "Maciej W. Rozycki" To: Matt Redfearn CC: Ralf Baechle , , "Jason A . Donenfeld" , Thomas Gleixner , , James Hogan , Paul Burton Subject: Re: [PATCH v2 3/5] MIPS: Only change $28 to thread_info if coming from user mode In-Reply-To: <1481626745-4290-4-git-send-email-matt.redfearn@imgtec.com> Message-ID: References: <1481626745-4290-1-git-send-email-matt.redfearn@imgtec.com> <1481626745-4290-4-git-send-email-matt.redfearn@imgtec.com> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [10.20.78.232] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 13 Dec 2016, Matt Redfearn wrote: > diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h > index eebf39549606..e13164daf9c2 100644 > --- a/arch/mips/include/asm/stackframe.h > +++ b/arch/mips/include/asm/stackframe.h > @@ -216,12 +216,20 @@ > LONG_S $25, PT_R25(sp) > LONG_S $28, PT_R28(sp) > LONG_S $31, PT_R31(sp) > + > + /* Set thread_info if we're coming from user mode */ > + mfc0 k0, CP0_STATUS > + sll k0, 3 /* extract cu0 bit */ > + bltz k0, 9f > + nop > + Have you actually verified the machine code generated as expected with such a change? This supposedly delay-slot NOP can be dropped as this is `.set reorder' code, so GAS will have scheduled a NOP itself already, having found there is an SLL->BLTZ data dependency and consequently the two instructions cannot be swapped. So now there'll be an extraneous NOP there, wasting code space and execution time. Maciej