Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752301AbdGMOfu (ORCPT ); Thu, 13 Jul 2017 10:35:50 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57847 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751201AbdGMOfs (ORCPT ); Thu, 13 Jul 2017 10:35:48 -0400 Date: Thu, 13 Jul 2017 20:04:19 +0530 From: "Naveen N. Rao" To: Jiri Olsa Cc: Peter Zijlstra , Arnaldo Carvalho de Melo , Ingo Molnar , linux-kernel@vger.kernel.org, Vince Weaver Subject: Re: [PATCH 2/2] kernel/events: Add option to enable counting sideband events in wakeup_events References: <3e1d5fea814758906c64b01e1eed186daaf2c9ed.1497881378.git.naveen.n.rao@linux.vnet.ibm.com> <20170712104855.GA3033@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170712104855.GA3033@krava> User-Agent: NeoMutt/20170609 (1.8.3) X-TM-AS-MML: disable x-cbid: 17071314-1617-0000-0000-000001F7422A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071314-1618-0000-0000-0000483F953F Message-Id: <20170713143419.ole6lrb3bqbf2l63@naverao1-tp.localdomain> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-07-13_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707130230 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1763 Lines: 50 On 2017/07/12 12:48PM, Jiri Olsa wrote: > On Mon, Jun 19, 2017 at 08:01:08PM +0530, Naveen N. Rao wrote: > > SNIP > > > - if (!event->attr.watermark) { > > + if (!event->attr.count_sb_events && !event->attr.watermark) { > > int wakeup_events = event->attr.wakeup_events; > > > > if (wakeup_events) { > > diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c > > index 4e7c728569a8..f43a6081141f 100644 > > --- a/kernel/events/ring_buffer.c > > +++ b/kernel/events/ring_buffer.c > > @@ -197,6 +197,19 @@ __perf_output_begin(struct perf_output_handle *handle, > > * none of the data stores below can be lifted up by the compiler. > > */ > > > > + if (event->attr.count_sb_events && !event->attr.watermark) { > > + int wakeup_events = event->attr.wakeup_events; > > + > > + if (wakeup_events) { > > + int events = local_inc_return(&rb->events); > > + > > + if (events >= wakeup_events) { > > + local_sub(wakeup_events, &rb->events); > > + local_inc(&rb->wakeup); > > + } > > + } > > + } > > hum, so there's the same wakeup code in perf_output_sample, > but it's not called for non-sample (sideband) events Good point. > > it'd be nice to have this wakeup only once in __perf_output_begin, > but it'd change the behaviour for sideband events, which would start to > follow the wakeup_events logic.. and possibly disturb Vince's tests? I suppose you meant 'change the behaviour for _sample_ events'. Yes, the problem with having the check here is that it will now start firing for all events, rather than just the sampling events. I am not sure if we can differentiate sample events from sideband events in __perf_output_begin(). The other aspect is also Peter's concerns around performance. Thanks, Naveen