From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin Schwidefsky Date: Mon, 06 Aug 2018 05:24:54 +0000 Subject: Re: Getting the instruction pointer on a per arch basis Message-Id: <20180806072454.6efb5973@mschwideX1> List-Id: References: <20180801074051.11fa62b3@mschwideX1> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Nick Desaulniers Cc: heiko.carstens@de.ibm.com, Yoshinori Sato , dalias@libc.org, tony.luck@intel.com, fenghua.yu@intel.com, msalter@redhat.com, jacquiot.aurelien@gmail.com, "David S. Miller" , Thomas Gleixner , mingo@redhat.com, Pirama Arumuga Nainar , Greg Hackmann , Mark Salyzyn , LKML , linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-ia64@vger.kernel.org, linux-c6x-dev@linux-c6x.org, sparclinux@vger.kernel.org On Wed, 1 Aug 2018 11:21:13 -0700 Nick Desaulniers wrote: > On Tue, Jul 31, 2018 at 10:41 PM Martin Schwidefsky > wrote: > > > > On Tue, 31 Jul 2018 16:09:06 -0700 > > Nick Desaulniers wrote: > > > > > + More maintainers and lists for visibility > > > > > > On Tue, Jul 31, 2018 at 3:32 PM Nick Desaulniers > > > wrote: > > > > > > > > I'm currently looking into cleaning up the code duplication between > > > > current_text_addr() and _THIS_IP_, virtually every implementation of > > > > current_text_addr() and _THIS_IP_ itself are basically: > > > > > > > > #define _THIS_IP_ ({ __label__ _l; _l: &&_l; }) > > > > > > > > For a few arch's, they have inline assembly instead (for > > > > current_text_addr()). Examples: > > > > * s390 > > > > * sh > > > > * ia64 > > > > * x86 (um and 32b) > > > > * c6x > > > > * sparc > > > > > > > > I have a patch that cuts down on the duplication, but I don't > > > > understand why the few arch specific implementations are necessary. I > > > > could reduce the duplication further if it's ok to just use the > > > > statement expression. > > > > > > > > Does anyone know why this is the case? > > > > For s390 it is just that we did not know about the label trick when we > > introduced the define. The inline has an advantage though, the code > > generated with the label trick is using a LARL instruction which is > > 4 bytes, the inline assembly uses a BASR which is 2 bytes. > > > > If I use the label method in current_text_addr() the size of vmlinux > > increases by a small amount: > > > > add/remove: 33/13 grow/shrink: 101/48 up/down: 11941/-8887 (3054) > > Thanks for the measurements. Was this output produced by a utility? Yes, ./scripts/bloat-o-meter > > This is acceptable though, I would not mind if _THIS_IP_ and > > current_text_addr use a common definition using labels. > > Thank you for this feedback Martin, I appreciate it. Patches soon. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.