From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753264AbbGQElJ (ORCPT ); Fri, 17 Jul 2015 00:41:09 -0400 Received: from ozlabs.org ([103.22.144.67]:44211 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752113AbbGQElH (ORCPT ); Fri, 17 Jul 2015 00:41:07 -0400 Message-ID: <1437108065.29389.6.camel@ellerman.id.au> Subject: Re: [RFC PATCH 01/12] powerpc/kernel: Get pt_regs from r9 before calling do_syscall_trace_enter() From: Michael Ellerman To: Benjamin Herrenschmidt Cc: linuxppc-dev@ozlabs.org, wad@chromium.org, keescook@chromium.org, linux-kernel@vger.kernel.org, luto@amacapital.net, strosake@linux.vnet.ibm.com, bogdan.purcareata@freescale.com Date: Fri, 17 Jul 2015 14:41:05 +1000 In-Reply-To: <1437086432.28088.46.camel@kernel.crashing.org> References: <1436945834-26660-1-git-send-email-mpe@ellerman.id.au> <1437086432.28088.46.camel@kernel.crashing.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.10-0ubuntu1~14.10.1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2015-07-17 at 08:40 +1000, Benjamin Herrenschmidt wrote: > On Wed, 2015-07-15 at 17:37 +1000, Michael Ellerman wrote: > > To call do_syscall_trace_enter() we need pt_regs in r3, but we don't need > > to recalculate it based on r1, it's already in r9. > > > > Signed-off-by: Michael Ellerman > > Is there any performance difference ? No. I'm not going to bother measuring it :) > I find the addi a bit more robust in case the code gets moved around or > the "previous" code gets changed to either not use r9 or clobber it, > which would have the potential to > introduce a subtle bug ... Yeah true. There is an "invariant" in that entry code that r9 contains pt_regs, you can see for example the DTL code goes to pains to ensure it puts pt_regs back in r9 after it clobbers it. As does the current syscall_dotrace. But looking closer I don't see where we actually use that (prior to this patch). So yeah I'll drop this and send a clean up to just get rid of all the r9 reloading. cheers From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 484E41A0727 for ; Fri, 17 Jul 2015 14:41:06 +1000 (AEST) Message-ID: <1437108065.29389.6.camel@ellerman.id.au> Subject: Re: [RFC PATCH 01/12] powerpc/kernel: Get pt_regs from r9 before calling do_syscall_trace_enter() From: Michael Ellerman To: Benjamin Herrenschmidt Cc: linuxppc-dev@ozlabs.org, wad@chromium.org, keescook@chromium.org, linux-kernel@vger.kernel.org, luto@amacapital.net, strosake@linux.vnet.ibm.com, bogdan.purcareata@freescale.com Date: Fri, 17 Jul 2015 14:41:05 +1000 In-Reply-To: <1437086432.28088.46.camel@kernel.crashing.org> References: <1436945834-26660-1-git-send-email-mpe@ellerman.id.au> <1437086432.28088.46.camel@kernel.crashing.org> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, 2015-07-17 at 08:40 +1000, Benjamin Herrenschmidt wrote: > On Wed, 2015-07-15 at 17:37 +1000, Michael Ellerman wrote: > > To call do_syscall_trace_enter() we need pt_regs in r3, but we don't need > > to recalculate it based on r1, it's already in r9. > > > > Signed-off-by: Michael Ellerman > > Is there any performance difference ? No. I'm not going to bother measuring it :) > I find the addi a bit more robust in case the code gets moved around or > the "previous" code gets changed to either not use r9 or clobber it, > which would have the potential to > introduce a subtle bug ... Yeah true. There is an "invariant" in that entry code that r9 contains pt_regs, you can see for example the DTL code goes to pains to ensure it puts pt_regs back in r9 after it clobbers it. As does the current syscall_dotrace. But looking closer I don't see where we actually use that (prior to this patch). So yeah I'll drop this and send a clean up to just get rid of all the r9 reloading. cheers