From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754410AbdHUQCx (ORCPT ); Mon, 21 Aug 2017 12:02:53 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:60490 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753264AbdHUQCv (ORCPT ); Mon, 21 Aug 2017 12:02:51 -0400 Date: Mon, 21 Aug 2017 17:01:38 +0100 From: Mark Rutland To: Peter Zijlstra 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: <20170821160137.GC5418@leverpostej> References: <1498142498-15758-1-git-send-email-mark.rutland@arm.com> <20170821155326.bbmpn62rcr64274p@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170821155326.bbmpn62rcr64274p@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Thanks, Mark.