From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757982AbdEVJ1B (ORCPT ); Mon, 22 May 2017 05:27:01 -0400 Received: from merlin.infradead.org ([205.233.59.134]:46218 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757781AbdEVJ07 (ORCPT ); Mon, 22 May 2017 05:26:59 -0400 Date: Mon, 22 May 2017 11:26:51 +0200 From: Peter Zijlstra To: Mark Rutland Cc: "Jin, Yao" , 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: <20170522092651.nwhlpdws2ysyhlma@hirez.programming.kicks-ass.net> 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> <20170522084529.GC1478@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170522084529.GC1478@leverpostej> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 22, 2017 at 09:45:30AM +0100, Mark Rutland wrote: > On Mon, May 22, 2017 at 10:12:22AM +0800, Jin, Yao wrote: > > 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. Yes, that should work at that point. We specifically already rely on user_mode() in the generic code. On x86 we specifically set regs->cs to match regs->ip (in cases where this isn't necessarily so) before calling into the generic code to make this work.