Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp235609pxb; Wed, 3 Feb 2021 04:24:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwoINhnjHDd63B67Mzulm+R4k8s9j+QqwTMawctD/TDW9qRVE8UthhRECK/C0nLWJ9kDIg X-Received: by 2002:a17:906:c448:: with SMTP id ck8mr2945543ejb.55.1612355081638; Wed, 03 Feb 2021 04:24:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612355081; cv=none; d=google.com; s=arc-20160816; b=zrg0lBJXltavNNR6Orte/Ha6uU0GMMGUWJmjuDZDmPUNW2L3m8GAGZT+J9xPbLAoBf Ezxi4GXeiMJuEjGQpF4981/3/5TZw6MpODQY3VB3u5c1ab8aZS/4H4rtbIKsSd31GT/m CDSaSgK/kxBC1nM0CaxFiJnjxQrYLSNUN6B7W6vA1FSs0ahyQXZpw+9+/JtYVX1Z996n ADdpOyyL672oyASlnfI04oCPo5bHsBGcHHi8XzlVTPVQ1Pol0WsHn8cnKwUspAdPEmmp btPMjbvW0qtmFGyF5rZKp1s7BbQL1F7nqq+p0Kmt0ab8faTssN2hENa2kFj0r3zjFrZv 64hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BLKFiOlbJDOWii2pbgHA5lJ2Ah9mF9AHYQiKGvGJc/A=; b=mwnFZxAiWgU4ClRqBhA+pyoWP/v2P2/Bbflv71OR8SjJi+Cef1OgU5hb9P7Yka/I1Z UgTe5FC4E3njKhrL/E5VTQT/uTytqir6PkVm6znzCktrRadLZ+L//9cw1IJyZsZV8Zge CGLAPMTmT0OEiJFWDGvofYTlTvjPn+blTziecUSYjp3fwgt80gf8Cjpyu9Dw0ZAzz5Eg VIvO3QK4FcmD1NiSHCiykO9yEsf80wfBdrW5fpXKkuPCYZ0Or7IW9OeuQ457h1OWJTuu hUfZPyteANzSe65kyUOXqZotTd/46Y1lLBTYLbkN5cdPWDJ+93zdKoAsmTMtH5BPp29y jZKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=tQXSKKB7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e6si1375375edz.98.2021.02.03.04.24.16; Wed, 03 Feb 2021 04:24:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=tQXSKKB7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234161AbhBCMWw (ORCPT + 99 others); Wed, 3 Feb 2021 07:22:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232525AbhBCMWw (ORCPT ); Wed, 3 Feb 2021 07:22:52 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B38B4C061573 for ; Wed, 3 Feb 2021 04:22:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BLKFiOlbJDOWii2pbgHA5lJ2Ah9mF9AHYQiKGvGJc/A=; b=tQXSKKB7FTpIrzIZOEkfWKPuYg ecnN4Cii/6JuxPPQjJrNNevlznfrjXOnnZKV2a8jSofWKbxaHopuuMP6eXKTRvcEnX0dV2PoOtyE5 CpyzpKIGtKo7Q8G8Q8m5StfCzwZMr1McK1e36QzKiRVUNsXi+8y7+dq3ZIphGc0Zun4tWvd95ekk7 gkerjaA7dDClIwYTix/Ukgr838DpKz3YxMLVm8YwLpRun0f5FfD1jTM3WWO2y6gXdgEDa5TLnVwPu J4/HTEGC9Tlmzzsirj0t81VZA2ApuVbh3A0mfcteCnerDYu995Xmo1CnMCZYggi9cbz607O1lSN3w ApHTybNw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1l7HAZ-00015k-5f; Wed, 03 Feb 2021 12:22:03 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id AB628301179; Wed, 3 Feb 2021 13:22:01 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6D1CF2364E362; Wed, 3 Feb 2021 13:22:01 +0100 (CET) Date: Wed, 3 Feb 2021 13:22:01 +0100 From: Peter Zijlstra To: Dmitry Vyukov Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Will Deacon , LKML , Matt Morehouse Subject: Re: Process-wide watchpoints Message-ID: References: <20201112103125.GV2628@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 31, 2021 at 11:04:43AM +0100, Dmitry Vyukov wrote: > PERF_EVENT_IOC_{ENABLE,DISABLE} work as advertised. > However, PERF_EVENT_IOC_MODIFY_ATTRIBUTES does not work for inherited > child events. > Does something like this make any sense to you? Are you willing to > accept such change? > > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 55d18791a72d..f6974807a32c 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -3174,7 +3174,7 @@ int perf_event_refresh(struct perf_event *event, > int refresh) > } > EXPORT_SYMBOL_GPL(perf_event_refresh); > > -static int perf_event_modify_breakpoint(struct perf_event *bp, > +static int _perf_event_modify_breakpoint(struct perf_event *bp, > struct perf_event_attr *attr) > { > int err; > @@ -3189,6 +3189,28 @@ static int perf_event_modify_breakpoint(struct > perf_event *bp, > return err; > } > > +static int perf_event_modify_breakpoint(struct perf_event *bp, > + struct perf_event_attr *attr) > +{ > + struct perf_event *child; > + int err; > + > + WARN_ON_ONCE(bp->ctx->parent_ctx); > + > + mutex_lock(&bp->child_mutex); > + err = _perf_event_modify_breakpoint(bp, attr); > + if (err) > + goto unlock; > + list_for_each_entry(child, &bp->child_list, child_list) { > + err = _perf_event_modify_breakpoint(child, attr); > + if (err) > + goto unlock; > + } > +unlock: > + mutex_unlock(&bp->child_mutex); > + return err; > +} > + > static int perf_event_modify_attr(struct perf_event *event, > struct perf_event_attr *attr) Oh.. yeah, normal ioctl()s go through the perf_event_for_each_child() thing, but that doesn't work here. So yeah, I suppose your patch makes sense.