Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp928419pxb; Thu, 4 Feb 2021 00:12:05 -0800 (PST) X-Google-Smtp-Source: ABdhPJwgI1xFV5OmQpSAsSbLwMGTG2hrAvb3rrIy6QKKG7eDWttxKf13uYRFxloA8sVynh06q5f0 X-Received: by 2002:a17:907:11c7:: with SMTP id va7mr6971111ejb.351.1612426325450; Thu, 04 Feb 2021 00:12:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612426325; cv=none; d=google.com; s=arc-20160816; b=r0I7pV2EM0HnMtJ39tOICSyjqW5VakxNzzOxtfIjlF7AG+DFHM+kxNAfL/8/bmjvw8 5RT11tIUrWSHv0zhHxtXaoOzggxq5ffupM24IUgMzttwQ3umJJv4gk1kQvFBFPFsnl3v 3eKD5ylhMydaz1mGNGVGnKFPLrg7BeTFLXjr03RoPYjQV9e6UQdEoxtTv27mY+0oSQY5 hLXwstKvxMQbMuBtg7wKvI+QLL4vHxKiAm7+Jk2eIcI8UX5Viz0lPizND+Q7jcadLSjT HD+hcEJX9WSzXcAk6gvRMhbkfA0y3FqzZtzPkaYGcb7rtKfLT3rhaEeo8HsL5It2M2ix EHXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=3dMlwZbTRtvs33wBsCxd9atqEMDdw1B0hqvbpblPMA0=; b=N1C43u7qWXK3/7mq/kcE8p7VQ9/lHCbUsbSMjLRbai7yMDt9J41zCQ/dKCtA22/tB/ Kl48DDKWjl86QGFxOudVQxw0daH+ciIiI/Zx9NOhnqGQ4/VifkzboBukoGa3Ew8HqbHq nt6SQRroT/bmmCqjGiYtFOZsOGF+kDXVHlRQthMiWHY/OMyg3uneeDsPOMbujKGRDTz3 7H0RbHijM/waE5Fzpr4t3zLkNyHkM7vZISiN4U5ZjQMS9MOYxRzGe9x1JFsExuiIO2Nz 05oaHNW9azRZH98pAFhsGlSVMMhVOp8ShyEju4ROgw7iuTht13s1oks/dJVm6qMc1/eg 0Tyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Rho3iN2L; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id uz12si2811547ejb.576.2021.02.04.00.11.41; Thu, 04 Feb 2021 00:12:05 -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=@google.com header.s=20161025 header.b=Rho3iN2L; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234834AbhBDILH (ORCPT + 99 others); Thu, 4 Feb 2021 03:11:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230252AbhBDILE (ORCPT ); Thu, 4 Feb 2021 03:11:04 -0500 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6BB6C061573 for ; Thu, 4 Feb 2021 00:10:24 -0800 (PST) Received: by mail-qv1-xf2a.google.com with SMTP id n14so1326889qvg.5 for ; Thu, 04 Feb 2021 00:10:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=3dMlwZbTRtvs33wBsCxd9atqEMDdw1B0hqvbpblPMA0=; b=Rho3iN2Lf5K6QM0EKVgayPCb+QWxlhDBcr9TbW2D8Cn+g8egpJcG7rVI8XB0lk9wZ3 zhEqGFc1QJ5bU/G5xByE1+pzYfDylZpnYH69QW6hhnI06894rL+5lvM9soJ17C2SBihT K9OmlDhdfsQ/8uDqUtR+0ynamPF9VGDxjy+CmBra5i0sLVD6fhNYeD5DPKygSjuJj5lP jZ29Q4Rj84D5JKaObWNcC6DstX7VW2+w2OL3g+AqXGT+Za+lADJ7vYzeWUKSD6lMImtO ZzYypiTg5rP/BsbXVxk1+2+/d84mNpDr+cwQFgscaDWZU320tbob8F74qywwYdWaxjrC Iegw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=3dMlwZbTRtvs33wBsCxd9atqEMDdw1B0hqvbpblPMA0=; b=BJKIyX2/DmxtnOHjTv6qgDnzRCCUZULcdU8x8Qo6nRI0Gzb3FlYqaFCva7ai7GxTuV /VVfdO8JIiB3bpA21StbQOme/+d82SJd5MtG54UNaABqY+Eqi6rEcD3S9cziOJLvADqN W51CX27FXcxXZXV/pvAJi5R8NtRwPCeIgRMdfUVhhHqPrvoHoX1awvPqe9lg8WCWJbxy ACIhvMWpicNPBCh58aYYjXKfAteAz9MQTyEUT/ARh22P2EBDzpmHlQlHoMVgRuCa6+MP dcskBU18paovDiCzGND0ly2GQ4HqTHznHU1dJ2dnKUKnpvVJOpyCMipBD1o2B8PkN7rb EL7w== X-Gm-Message-State: AOAM532BUFZrurm7owNGCsBGhAPW8GtIB6w+IH8mxmmiDEp6VfTWGRSR jQQQ2pAO7vqJP7Xyvx3caL/AXs1Lif3QD9RlW8nKSw== X-Received: by 2002:a0c:8304:: with SMTP id j4mr6646419qva.18.1612426223627; Thu, 04 Feb 2021 00:10:23 -0800 (PST) MIME-Version: 1.0 References: <20201112103125.GV2628@hirez.programming.kicks-ass.net> In-Reply-To: From: Dmitry Vyukov Date: Thu, 4 Feb 2021 09:10:11 +0100 Message-ID: Subject: Re: Process-wide watchpoints To: Peter Zijlstra Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Will Deacon , LKML , Matt Morehouse Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 3, 2021 at 2:37 PM Peter Zijlstra wrote: > > 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. I was thinking of something very similar to that bpf_send_signal that delays sending to exit from irq: https://elixir.bootlin.com/linux/latest/source/kernel/trace/bpf_trace.c#L1091