Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932339AbdHWRAk (ORCPT ); Wed, 23 Aug 2017 13:00:40 -0400 Received: from mail-io0-f170.google.com ([209.85.223.170]:32794 "EHLO mail-io0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754150AbdHWRAj (ORCPT ); Wed, 23 Aug 2017 13:00:39 -0400 X-Google-Smtp-Source: ADKCNb6kyB7Ml8qt8E39x8LOyLmd1NUFYSf26P4GNz1ILznI8etwEchFCQbpZwhDT43XS4F9Y7H3kEJUdXCvQaaO7a0= MIME-Version: 1.0 In-Reply-To: <20170823143959.m6k5xojly3q2tacv@hirez.programming.kicks-ass.net> References: <1503498166-3887-1-git-send-email-kan.liang@intel.com> <20170823143308.v27pgjagxjyd65ci@hirez.programming.kicks-ass.net> <20170823143959.m6k5xojly3q2tacv@hirez.programming.kicks-ass.net> From: Stephane Eranian Date: Wed, 23 Aug 2017 10:00:37 -0700 Message-ID: Subject: Re: [PATCH V6] perf: Add PERF_SAMPLE_PHYS_ADDR To: Peter Zijlstra Cc: "Liang, Kan" , "mingo@redhat.com" , LKML , Arnaldo Carvalho de Melo , Jiri Olsa , Thomas Gleixner , "ak@linux.intel.com" , Michael Ellerman , Madhavan Srinivasan Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 907 Lines: 22 On Wed, Aug 23, 2017 at 7:39 AM, Peter Zijlstra wrote: > On Wed, Aug 23, 2017 at 04:33:08PM +0200, Peter Zijlstra wrote: >> > @@ -6145,6 +6183,9 @@ void perf_prepare_sample(struct perf_event_header *header, >> > >> > header->size += size; >> > } >> > + >> > + if (sample_type & PERF_SAMPLE_PHYS_ADDR) >> > + data->phys_addr = perf_virt_to_phys(data->addr); >> >> Only problem with this now is that it requires SAMPLE_ADDR to also be >> set in order to obtain data->addr. >> >> Either fix all to set data->attr for (SAMPLE_ADDR || SAMPLE_PHYS_ADDR) >> or mandate SAMPLE_ADDR when SAMPLE_PHYS_ADDR. > > I think the former suggestion is better, as it allows for smaller > samples. Agreed. I may only care about physical addresses, so SAMPLE_PHYS_ADDR should suffice from the user. The kernel must save the virtual address in data->addr, and then convert it.