From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2932DC433DB for ; Wed, 3 Feb 2021 13:39:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CFDA964E2B for ; Wed, 3 Feb 2021 13:39:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232069AbhBCNjF (ORCPT ); Wed, 3 Feb 2021 08:39:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232081AbhBCNh6 (ORCPT ); Wed, 3 Feb 2021 08:37:58 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E43FC061573 for ; Wed, 3 Feb 2021 05:37:18 -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=r0k7fkjKZZ1/Vt6lQr+Rtmn6WL7bhCFvwGKVqtcNWZ0=; b=JD4ERjBlcjJ0TYq7tXpsomdani m3trTAmxAW1JhLlxvNlVazdX9jfnK7BFy/BrxHFqppV4znvS5JKIil7IvkhEcVoDJd1kulkjMafSi idCh//S4tVV/8De/4BJ0TPVs2QHp3zD80eKg2OklccCJoUdeRjWO2QhIarz+I8QEKOn/nmlA+/WVk Tt0AuEgWfI5/L6nhS65dgYioST8kCM5wJ7JCpwYd1MPTHdETPTnIz2dooFElJew0Ty+S7KTZt7RF3 bxXi+/Cikx7vaOOLDaZHMjQ6VWLtZbgvv/NYMgzyz5HTIRWbl21Pdxhcs/4MgR6IOH4oJs123I52S oiUdUc/A==; 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 1l7ILF-0005GU-9t; Wed, 03 Feb 2021 13:37:09 +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 6034C301A66; Wed, 3 Feb 2021 14:37:05 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 49125284AA052; Wed, 3 Feb 2021 14:37:05 +0100 (CET) Date: Wed, 3 Feb 2021 14:37:05 +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 Wed, Feb 03, 2021 at 01:49:56PM +0100, Dmitry Vyukov wrote: > On Wed, Feb 3, 2021 at 1:29 PM Peter Zijlstra wrote: > > > > On Mon, Feb 01, 2021 at 09:50:20AM +0100, Dmitry Vyukov wrote: > > > Or, alternatively would it be reasonable for perf to generate SIGTRAP > > > directly on watchpoint hit (like ptrace does)? That's what I am > > > ultimately trying to do by attaching a bpf program. > > > > Perf should be able to generate signals, The perf_event_open manpage > > lists two ways of trigering signals. The second way doesn't work for > > you, due to it not working on inherited counters, but would the first > > work? > > > > That is, set attr::wakeup_events and fcntl(F_SETSIG). > > The problem is that this sends a signal to the fd owner rather than > the thread that hit the breakpoint. At least that's what happened in > our tests. We would like to send a signal to the thread that hit the > breakpoint. Ah indeed.. all of this was aimed at self-monitoring. Letting perf send a signal to the monitored task is intrusive.. let me think on that.