Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp984224pxb; Thu, 4 Feb 2021 02:00:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgpQ6DGau7lG5ZDGOEpqWDyR/VCYlb4/BM6LV3U5J+OOst5IznUnXyXGfOJh1nuphXK3td X-Received: by 2002:a50:fc06:: with SMTP id i6mr6581074edr.20.1612432851319; Thu, 04 Feb 2021 02:00:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612432851; cv=none; d=google.com; s=arc-20160816; b=rwuwaMhIoW9yzVSzOfvAMFafxlAdKQSaUKeA3Yv/SFKvqO+wSXTZ+WONp2nXbSlgRN +SnhJpcnrZyN50w9cAxqB7MmWl1Y0vRiSICC3LD4BrKNfxQ3LB7CTRVpME2t495YeHnE ZsUMiF36SRLOJuuD0dZE1Hcf6YrWqJGZnERwK9CRolPY6M0VHbEZVrV9Sg0twqlgkuWE zwfVvGogJwaPVBEBkkvkjrXoB+7i/eZPssqDuHsN37c91sjYVgnVyfblMAU1PMKLfmFn p8En//QiAyUL52RBTBdc0Xt1wk1pKrOoehvnt+DRcThKpWxvz0At2Dr1cI7u5Xjq3mIr Tugw== 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=gwoKI5+cSpuGhL3r0lZuUOMuyL0kTKIQYXZfMVQnS+M=; b=UfbUCUoITtm9N2FEh8WSevbT2gX/R7qKo5yJiebFscwJMvhfFt+gZhXMZpNCPN22fz vDf49xLP9UoMaN65tGQ3mReLsXyZpLeZGfkjo0DcOIp5cSJf2pu8iGACZjF36ARXBHO4 kKztG3SRjVSFMU6vUwfQkka52UVbTofctkgpR2dU1pp//LYjGMkTMqB6eN5fyBiEO0RZ 4QBanPChRiWsd6zCbK3RAWseNewJJRZHS2+KOekDnYZCvc0zwCrwzuIbBMeIb/PKH/se eOkwVOgULnI6Fd/N0y2SNYJbHT42WgLft1UjmohMYVA5i0LgyFTmsIb0s3VbK4QPyU+J +U3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=P0o3DTNR; 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 y16si2425268edq.174.2021.02.04.02.00.24; Thu, 04 Feb 2021 02:00:51 -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=P0o3DTNR; 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 S235098AbhBDJzf (ORCPT + 99 others); Thu, 4 Feb 2021 04:55:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234600AbhBDJzf (ORCPT ); Thu, 4 Feb 2021 04:55:35 -0500 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A703C0613D6 for ; Thu, 4 Feb 2021 01:54:55 -0800 (PST) Received: by mail-qt1-x836.google.com with SMTP id l23so1880491qtq.13 for ; Thu, 04 Feb 2021 01:54:55 -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=gwoKI5+cSpuGhL3r0lZuUOMuyL0kTKIQYXZfMVQnS+M=; b=P0o3DTNR5MxLgcX+yBoJeXbi7TkHK1HSACE3WhFC9oWxj5vxPztE3eaIA9gzEg7rYl uYzty3SIlYh7iLcfRlmyMHYHkc/b/vy9S6tlrBPkSECcbjOWD23RSSAVRzd2R2q9nKwf rmENZ9WqrF//kh59VmuJNIVDPZLdhkBdnWsH1qnDu+sI2Xd8cGGjh6/kfvDYIi+fG90t ME06HIR1p2mMUEmEuJJrg9E2dyywL9OyyBVRu+4GDItZ3cC/Gyx0ovtKinwh3jsOiqwQ TOaN5ITLveAVCF2JDjxvpvt21DUKDHy00a0huJvX23SW7NkRE1Jzc7/WnDxtlvgv+KkK OZug== 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=gwoKI5+cSpuGhL3r0lZuUOMuyL0kTKIQYXZfMVQnS+M=; b=rdXhJzO88wK8lE11+pIWkexbeGK0/QOWSl162N4lJEMjwlDbuCsnGEPGQIoql/2jeO tDpWYuqSPn/DPhQZqzMyeUw6U7yuD2/biJzGNfHjysK8Ummto90j/0GWYrBm9SYRtOGe 2wMxYqdxWGi9B7FGB4VxtxJM+4CVQ0zjCjLP8g2e6CpGeg0XrnXGkBlRgZF+UqOBzk4f aMiOXOE+R4qGiDskHvhdRxQSXSnkmWOxcGOkI9sT1wjUeJ39kODNb7P1nzD4M8q67Oho Ve6lT29HW8AZSvTrU8sEp5xEoXSAgXXAZbfJhmUEkn7EMMbi54xGjl0+fV9tGUrL3Mxx jT9g== X-Gm-Message-State: AOAM5333uxFKdNhzjxWlhMO8qaS1I62jDIcDyFlCT8Gv8KsGlzaMP0ym OVcR5zTLRtfipLOrPs9vGhKKO6ZkOxp7HGlBnx59Yg== X-Received: by 2002:ac8:e0e:: with SMTP id a14mr6304181qti.66.1612432494120; Thu, 04 Feb 2021 01:54:54 -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 10:54:42 +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 Thu, Feb 4, 2021 at 10:39 AM Peter Zijlstra wrote: > > On Thu, Feb 04, 2021 at 09:10:11AM +0100, Dmitry Vyukov wrote: > > On Wed, Feb 3, 2021 at 2:37 PM Peter Zijlstra wrote: > > > > 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 > > Oh, making code to do it isn't the problem. The problem stems from the > fact that perf is supposed to be observant only. The exception is when > you monitor yourself, in that case you can send signals to yourself, > because you know what you're doing (supposedly ;-). > > But if you go send signals to the task you're monitoring, you're > actually changing their code-flow, you're an active participant instead > of an observer. > > Also, they might not be able to handle the signal, in which case you're > not changing the program but terminating it entirely. > > That's a big conceptual shift. > > OTOH, we're using ptrace permission checks, and ptrace() can inject > signals just fine. But it's a fairly big departure from what perf set > out to be. Oh, I see, I did not think about this. FWIW it's doable today by attaching a BPF program. Will it help if this mode is restricted to monitoring the current process? Sending signals indeed usually requires cooperation, so doing it for the current process looks like a reasonable restriction. This may be not a fundamental restriction, but rather "we don't have any use cases and are not sure about implications, so this is a precaution measure, may be relaxed in future".