Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1172371imm; Wed, 1 Aug 2018 11:23:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfMgquX+iqFIlnrCsucO7TxVydQy4C7BZt87xjNYvNlomzjAyvLFjhh9C9T7e4FXk5Yp1fT X-Received: by 2002:a17:902:740b:: with SMTP id g11-v6mr25804162pll.85.1533147781866; Wed, 01 Aug 2018 11:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533147781; cv=none; d=google.com; s=arc-20160816; b=JUab9zhK2osX+qaD0P08on2AgWU1/J95wXwPspMtBeAR9/9OtVar0kXez5NakZVzWJ zzT7/TwDWFdI5i8+yOzhL/9SArGq3o9DxJ3P1hcL/fDy8H/Y8+r0gIJRDjcyYMVtDRHH V67G6yTk1MU3vaqsrkvqDzFJTHF1jnzrQxdS5rjx1zaIRV8qIy+Ti/AmrtWdtNvTKMBh bSN3KkGhN7ztZtIuO0kRjfK5hneuYK0Ph1EmJ00SsQXLjtCt/xvcSztZXv28ldmUM1ky McnhiQGgcI+o8YyxWFlLxv9rK+eB1FR8eBkdnDnOEp3CYWvx45Z5DnronMZ9l7oDS+Nv IUOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=wxpBoIKSWG8O4gEV2nnqWWlvZEX36jaAcDxH5/rCUJw=; b=1IAZX+VkPKcefeAxBxMz1irJ/4rGyQfVJE9xUphkRmcCCqDxYboqrNtGXnb+3Ddjmm 6ix9EYyuXd/ydScy/RB57jmUBn50wx5Uquq0Z952e0KgkCfO5S6xvPrYDgadkdqd9HGi rpABOecBMz6YBGFxkSQpdDdJcXWX4iSbnWqKkTMGDFtSBuud4d5RqHTBY2BLYUnTh7tz sAwpVAgcyffhEfjWDkWqL0C7Ory/36pcQZHkIPfbA95JFYajFC/m/d+ZeMrM4Rpx1bVy g+t44VG1b7t5ooK14wwJ4K6gVLuG6GxH0o1f3WeSFeAG4r20DQCjb0Zps6ds1oHYhCYH X2Cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CwJG+kwc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1-v6si17938572plm.375.2018.08.01.11.22.47; Wed, 01 Aug 2018 11:23:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CwJG+kwc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387528AbeHAUI0 (ORCPT + 99 others); Wed, 1 Aug 2018 16:08:26 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:38449 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387518AbeHAUIZ (ORCPT ); Wed, 1 Aug 2018 16:08:25 -0400 Received: by mail-pf1-f195.google.com with SMTP id x17-v6so8278198pfh.5 for ; Wed, 01 Aug 2018 11:21:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wxpBoIKSWG8O4gEV2nnqWWlvZEX36jaAcDxH5/rCUJw=; b=CwJG+kwc8zFpsebtm3B52XfPPF49sHaaw8/pYZZob6hPdgBF2Qk5DHBVmmikK+mR4T sMXNjq2iSi5rYKfjFGVQVhKZIWMJimCVA5/AmXgGofXOLNjowCnrfEFc3upsIsiR3Q24 X5ti1Sn4hJXQ3vC9yDkvUxfivKl/mZeT4iMHQS8WVEN/xl5G/OaODWr+l0m+c/kwPgOM VLzAeStD8NpzPdQ0+LSupI4TE6WnXIShTo6X55aQMhBCRQUYz6oK/XiTip8V+Xk1lLZK yeomjttr7NVe+Lpkyr6J84ff+wl1tujdUW9UQNcDhaMNJmmDwN/unoZRvNts6Lec3xqq sXdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wxpBoIKSWG8O4gEV2nnqWWlvZEX36jaAcDxH5/rCUJw=; b=Sjc8BO8usvIJmBtTEXaHBaM8lSOsAwYIge70IqoBI5WNXZj091OpiEdpy+onlLNdfC rFzqSC3Acp6NXGR5MvDOnwkuUQOR3/betSrh4z7EKLxMmfrxhc39rjgfG6qyFWkw4V0Z qGj3e4ub753+A/tRJtBuOO6bAUrtFze1fQDbuLn1fuoNBqUO4OfB8NRVND1zVB54Fux6 +6ZIwJofVYA+WDJ7Cl1OWhJOOLOCJgb6UuYR7djRJjL+gi6RkYybnb9yRT3vuyFiEKkd Z91MtDGqybjxZZedw8lFfvHfid4NmkBJiTPE21EGEXJiOjzAhfIgmsl/fODArM6dPjj9 BMsQ== X-Gm-Message-State: AOUpUlEP3vGL5bv4/UXSnm18fesRVO2r9R62/Zm9+qlVZuwIeOZZZuSG r4PsD+jxZRP7tL9x+S6mJPSlXFdxalz5jwnlEFE0eg== X-Received: by 2002:a63:9619:: with SMTP id c25-v6mr25307448pge.75.1533147685551; Wed, 01 Aug 2018 11:21:25 -0700 (PDT) MIME-Version: 1.0 References: <20180801074051.11fa62b3@mschwideX1> In-Reply-To: <20180801074051.11fa62b3@mschwideX1> From: Nick Desaulniers Date: Wed, 1 Aug 2018 11:21:13 -0700 Message-ID: Subject: Re: Getting the instruction pointer on a per arch basis To: schwidefsky@de.ibm.com 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? > 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. -- Thanks, ~Nick Desaulniers