From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932226AbdHUQJH (ORCPT ); Mon, 21 Aug 2017 12:09:07 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:44633 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932099AbdHUQJE (ORCPT ); Mon, 21 Aug 2017 12:09:04 -0400 Date: Mon, 21 Aug 2017 18:08:57 +0200 From: Peter Zijlstra To: Mark Rutland Cc: linux-kernel@vger.kernel.org, Alexander Shishkin , Arnaldo Carvalho de Melo , Ingo Molnar , Zhou Chengming Subject: Re: [PATCH] perf/core: fix group {cpu,task} validation Message-ID: <20170821160857.3ycvvzfyysbjonyp@hirez.programming.kicks-ass.net> References: <1498142498-15758-1-git-send-email-mark.rutland@arm.com> <20170821155326.bbmpn62rcr64274p@hirez.programming.kicks-ass.net> <20170821160137.GC5418@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170821160137.GC5418@leverpostej> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 21, 2017 at 05:01:38PM +0100, Mark Rutland wrote: > On Mon, Aug 21, 2017 at 05:53:26PM +0200, Peter Zijlstra wrote: > > On Thu, Jun 22, 2017 at 03:41:38PM +0100, Mark Rutland wrote: > > > Regardless of which events form a group, it does not make sense for the > > > events to target different tasks and/or CPUs, as this leaves the group > > > inconsistent and impossible to schedule. The core perf code assumes that > > > these are consistent across (successfully intialised) groups. > > > > > > Core perf code only verifies this when moving SW events into a HW > > > context. Thus, we can violate this requirement for pure SW groups and > > > pure HW groups, unless the relevant PMU driver happens to perform this > > > verification itself. These mismatched groups subsequently wreak havoc > > > elsewhere. > > > > > > For example, we handle watchpoints as SW events, and reserve watchpoint > > > HW on a per-cpu basis at pmu::event_init() time to ensure that any event > > > that is initialised is guaranteed to have a slot at pmu::add() time. > > > However, the core code only checks the group leader's cpu filter (via > > > event_filter_match()), and can thus install follower events onto CPUs > > > violating thier (mismatched) CPU filters, potentially installing them > > > into a CPU without sufficient reserved slots. > > > > > Fix this by validating this requirement regardless of whether we're > > > moving events. > > > > Yes, and this also appears to cure your other problem: > > > > https://lkml.kernel.org/r/20170810173551.GD12812@leverpostej > > Ah; sorry for the duplicate report! I should have realised. > > I guess this will get queued soon? Done :-) I'll try and hand to Ingo before end of week.