From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757508AbdEVIqO (ORCPT ); Mon, 22 May 2017 04:46:14 -0400 Received: from foss.arm.com ([217.140.101.70]:33168 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752668AbdEVIqL (ORCPT ); Mon, 22 May 2017 04:46:11 -0400 Date: Mon, 22 May 2017 09:45:30 +0100 From: Mark Rutland To: "Jin, Yao" Cc: Peter Zijlstra , acme@kernel.org, jolsa@kernel.org, mingo@redhat.com, alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org, ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com, Will Deacon Subject: Re: [PATCH] perf/x86/intel: Drop kernel samples even though :u is specified Message-ID: <20170522084529.GC1478@leverpostej> References: <1495189152-5766-1-git-send-email-yao.jin@linux.intel.com> <20170519092905.yivnfjyhblm5wiap@hirez.programming.kicks-ass.net> <20170519121056.c45jbsfgcdjfuoow@hirez.programming.kicks-ass.net> <20170519123648.p4tkt6xrt5xachuw@hirez.programming.kicks-ass.net> <6d82d33c-df7d-f1ea-979a-5898efe88528@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 22, 2017 at 10:12:22AM +0800, Jin, Yao wrote: > Hi Peter, > > Maybe it's not very easy to move the skid checking to generic code > because we don't have a common kernel_ip() available to determine if > ip is a kernel address. > > I was trying to move kernel_ip() from arch/x86/events/perf_event.h > to generic code, but some difficulties I have: > > For example, in new kernel_ip(), we may use many > conditional-compilation for all arch, for example: > > #ifdef CONFIG_X86_32 > return ip > PAGE_OFFSET; > #endif > > #ifdef CONFIG_X86_64 > return (long)ip < 0; > #endif > > #ifdef CONFIG_ARM.... > ...... > #ifdef CONFIG_MIPS.... > ...... > > But the code is being ugly and hard to maintain. And frankly I don't > know kernel address space for all arch. > > Any idea? Could we just do at x86 side this time? Can we not check user_mode(regs) for all architectures? !user_mode(regs) implies a kernel sample. Thanks, Mark.