From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753995AbdHUPxf (ORCPT ); Mon, 21 Aug 2017 11:53:35 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:48886 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753264AbdHUPxd (ORCPT ); Mon, 21 Aug 2017 11:53:33 -0400 Date: Mon, 21 Aug 2017 17:53:26 +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: <20170821155326.bbmpn62rcr64274p@hirez.programming.kicks-ass.net> References: <1498142498-15758-1-git-send-email-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1498142498-15758-1-git-send-email-mark.rutland@arm.com> 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 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 Thanks!