From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756990AbdKGPni (ORCPT ); Tue, 7 Nov 2017 10:43:38 -0500 Received: from mail-ot0-f196.google.com ([74.125.82.196]:56474 "EHLO mail-ot0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753966AbdKGPnh (ORCPT ); Tue, 7 Nov 2017 10:43:37 -0500 X-Google-Smtp-Source: ABhQp+SDCCwwLp2rqofUpH6nEVzDa6DdHcRtJcyFdS2/RcktIOswu8Dau6lzSZfzu2uR1IWMxjF+PDLZgO9Nxvlnl+k= MIME-Version: 1.0 In-Reply-To: <20171107081457.GE3326@worktop> References: <1510006156-18988-1-git-send-email-chabbi.milind@gmail.com> <20171107081457.GE3326@worktop> From: Milind Chabbi Date: Tue, 7 Nov 2017 07:43:35 -0800 X-Google-Sender-Auth: ghBj0CdJnlRTSWOqMzbFZ33Qp7U Message-ID: Subject: Re: [PATCH] perf/core: fast breakpoint modification via _IOC_MODIFY_BREAKPOINT. To: Peter Zijlstra Cc: Milind Chabbi , Jiri Olsa , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Namhyung Kim , Michael Ellerman , Andi Kleen , Hari Bathini , Jin Yao , Kan Liang , Sukadev Bhattiprolu , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter, Generic update perf_event_attr interface is noble but impractical. It will cause a validation nightmare. Many of the behaviors or choices will become hard to reason. If somebody changes "sample_period" it is unclear what to do it the number of samples collected so far exceeds the newly configured N events. If somebody changes sample_type, the type of data recorded in the mmap ring buffer will be a mix of two (or more) different kinds of data, which make it untenable. Uncommon but possible: somebody may like to change the "type" itself. The list goes on. When you proposed generic update perf_event_attr interface, do you have a clear use case in mind with measured performance impact? If so, one can consider that path, which is an entirely different project. I believe your proposal is to introduce a new system call perf_event_update_attr(). The changes proposed in the patch are motivated by a clear use case with a clear performance impact. Changing the address monitored by a breakpoint is a common operation by profilers, and hence it need not go through the whole process of unmapping the ring buffer, closing the fd, re-opening a perf event and remapping the ring buffer. -Milind On Tue, Nov 7, 2017 at 12:14 AM, Peter Zijlstra wrote: > > On Mon, Nov 06, 2017 at 05:09:15PM -0500, Milind Chabbi wrote: > > diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h > > index 362493a..d458214 100644 > > --- a/include/uapi/linux/perf_event.h > > +++ b/include/uapi/linux/perf_event.h > > @@ -433,6 +433,8 @@ struct perf_event_attr { > > #define PERF_EVENT_IOC_ID _IOR('$', 7, __u64 *) > > #define PERF_EVENT_IOC_SET_BPF _IOW('$', 8, __u32) > > #define PERF_EVENT_IOC_PAUSE_OUTPUT _IOW('$', 9, __u32) > > +#define PERF_EVENT_IOC_MODIFY_BREAKPOINT \ > > + _IOW('$', 10, struct perf_event_attr *) > > > I really hate this thing. I would much rather see a more generic update > perf_event_attr interface. Where we allow modifying some of the > perf_event_attr fields.