Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3514553imu; Mon, 7 Jan 2019 04:55:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN4bdvrg/0+gbUzcBq6QTuymTmItc2uk01gKc0StM99xzFty/SNAm9EWBZW06B01jCILQTM7 X-Received: by 2002:a63:1321:: with SMTP id i33mr30354578pgl.380.1546865739478; Mon, 07 Jan 2019 04:55:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546865739; cv=none; d=google.com; s=arc-20160816; b=Bcr15Ui8/zkHT2eSHzvbOWqdIpKGdCtHg5S96l4sX8h9UX8LF4pl/Ovg8ZO+09iJL8 XJCn5FoUiQesheldAahmK5IbAKPaTTqUFTZU7y4N0YsRAbO7FgcjeW78jmtBdsTR0P3n JV/Q4hfMxzJ5rRaOEGGoAEQo8HQf1F2Ju7u9s1C7WaFj2RcHMQ0/1sqalnIt5TLpaDQT 7e1eUyVo4MXO1d+P6rQaZzL458CzxHOMILNY+NRgLGGIbZEGZsP8ifYo2I6PiqvpbJYu UwH8i9HQshiGQpuW3M1SHqJP8yLJNXLfUqVtMKxXl31AJzfnghexRuCeQxC6U7Glu111 CHSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=fr77jQjVAGvubnmrs0V3nPk+2qm8E08qFKOUalbVJf0=; b=LO/u1uRgGUr+h/w47oENyPYNFfZFK9816g7qYSxRmdua5sQ2c4lupuJ8ZYEudA1V2l IvsIbFgvGsMjr36mP4PVDQRtb/KHXfvOexWx98PgcORJNPejz6OR6oNsnDSV4pZ3ugUf hLNhfvf95inZ/dcsSkZY3xaeIp0iAISZOCOzhejQd8Jh0nvBoN0QqpoUFZYcRGwuBMrc Tv0FccgB2SKNCa88BHWRc1t+gdqklhpuaS3fmFDPV3qBLooApWKgeEA7kwCFU54zNLCo 2wwWM+u1T+idCupE5Omfaehar3kQ7XMwI7OmTQQF9157+jv+4QALNZU8aRtaYutpOUwb B3tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=u8HJlJd2; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z86si5136729pfl.209.2019.01.07.04.55.24; Mon, 07 Jan 2019 04:55:39 -0800 (PST) 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=@kernel.org header.s=default header.b=u8HJlJd2; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727532AbfAGMxd (ORCPT + 99 others); Mon, 7 Jan 2019 07:53:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:42752 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727443AbfAGMxb (ORCPT ); Mon, 7 Jan 2019 07:53:31 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7138520651; Mon, 7 Jan 2019 12:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546865610; bh=GepVdzv1XYuPWEpblWMDmTlCBWvHEZ84qkCigxknLuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u8HJlJd2Qw+zOoPX1RHbWHalkW3iIdWf/eJBCXCB5WnWHz6Q29zMV1Lw31IU0R4jb UeomYqhFZ1TS8anpMzvz9eHPqgBmm/69OfJy+FWdR5ycAelJaBSNVXZBxyM7jJOL3C QbmV+Ppktm8WvxSaP5GrcpWbOazsWAI9yFzrQCU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Andi Kleen , "David S. Miller" , Jiri Olsa , Leo Yan , Mathieu Poirier , Arnaldo Carvalho de Melo Subject: [PATCH 4.19 099/170] perf machine: Record if a arch has a single user/kernel address space Date: Mon, 7 Jan 2019 13:32:06 +0100 Message-Id: <20190107104504.696892059@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190107104452.953560660@linuxfoundation.org> References: <20190107104452.953560660@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Adrian Hunter commit ec1891afae740be581ecf5abc8bda74c4549203f upstream. Some architectures have a single address space for kernel and user addresses, which makes it possible to determine if an address is in kernel space or user space. Some don't, e.g.: sparc. Cache that info in perf_env so that, for instance, code needing to fallback failed symbol lookups at the kernel space in single address space arches can lookup at userspace. Signed-off-by: Adrian Hunter Cc: Andi Kleen Cc: David S. Miller Cc: Jiri Olsa Cc: Leo Yan Cc: Mathieu Poirier Cc: stable@vger.kernel.org # 4.19 Link: http://lkml.kernel.org/r/20181106210712.12098-2-adrian.hunter@intel.com [ split from a larger patch ] Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/arch/common.c | 10 ++++++++++ tools/perf/arch/common.h | 1 + tools/perf/util/machine.h | 1 + tools/perf/util/session.c | 4 ++++ 4 files changed, 16 insertions(+) --- a/tools/perf/arch/common.c +++ b/tools/perf/arch/common.c @@ -200,3 +200,13 @@ int perf_env__lookup_objdump(struct perf return perf_env__lookup_binutils_path(env, "objdump", path); } + +/* + * Some architectures have a single address space for kernel and user addresses, + * which makes it possible to determine if an address is in kernel space or user + * space. + */ +bool perf_env__single_address_space(struct perf_env *env) +{ + return strcmp(perf_env__arch(env), "sparc"); +} --- a/tools/perf/arch/common.h +++ b/tools/perf/arch/common.h @@ -5,5 +5,6 @@ #include "../util/env.h" int perf_env__lookup_objdump(struct perf_env *env, const char **path); +bool perf_env__single_address_space(struct perf_env *env); #endif /* ARCH_PERF_COMMON_H */ --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h @@ -42,6 +42,7 @@ struct machine { u16 id_hdr_size; bool comm_exec; bool kptr_restrict_warned; + bool single_address_space; char *root_dir; char *mmap_name; struct threads threads[THREADS__TABLE_SIZE]; --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -24,6 +24,7 @@ #include "thread.h" #include "thread-stack.h" #include "stat.h" +#include "arch/common.h" static int perf_session__deliver_event(struct perf_session *session, union perf_event *event, @@ -150,6 +151,9 @@ struct perf_session *perf_session__new(s session->machines.host.env = &perf_env; } + session->machines.host.single_address_space = + perf_env__single_address_space(session->machines.host.env); + if (!data || perf_data__is_write(data)) { /* * In O_RDONLY mode this will be performed when reading the