Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1523437pxb; Thu, 4 Feb 2021 15:38:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxElJpl7aYPuziJvDBAJzfuefaiFBSTCc5kTmzI7JNvQKyBoxN1PzsaJra+6hDDNPjecsGa X-Received: by 2002:a17:906:9705:: with SMTP id k5mr1433187ejx.325.1612481892242; Thu, 04 Feb 2021 15:38:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612481892; cv=none; d=google.com; s=arc-20160816; b=gMz+DC2rTC3WwvamV+XItfqk68NebA7N10EFWZ/ba/HxnVPEzTDx7Q6/7KfgJKp0y0 BaiHrbRSJSbBV48fRuC6T2lkJJ4Vj82d4i3pf2/a1zWVCbMy3L2/6PRxUJB9+2e63Mfc nc1cz4uoZKy1KA4VH0VfmPKPb8jdtf5IaNzLNrcC4HypXiuN0uXj9a5zt6eYGfq58nrG zR3t+reVNjlkFpoDv3xM+LMt3Q85Vqw3ICUtxUD0D9lJ4mZJFroEQwVHFSlmwmWhBMqd o0HvFSifHCAPqbtnwhXzhrQnprZKRwH5cmbfnt4YniVn7SDA/LnX288EqTj3IykCefLp Yhow== 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=3o2saBcPyUQ6g/10+Rj6Ku6UfMXIXVT/67I546Blx18=; b=ypvm33RiWIAB0OHhBeDiCR/uvhnMIBQJsBPln0Kda+52pkF7WvlI7Y5CbJ5dYmOE+k lh7YtkViTsCNqdgIvZv9kkvl+q0sOOaghfTJVFGU4UVV/KUP/QJiXfb6Aw9ZNxiRS9pO rTtpv4nQ3GuyAHNXlkpQAPadqjqScF5ws+ZDN9Wq1v2P4t3WeQ1ncerxUz0uTcbgWNs6 o4orMkhlqKGDP3NnS8A91IAPwhHig1yARW1RkYq6zv/GM7ivs3VXPNxZfA6KNafH/eqC 6ZPIzyPjovIDkwrzVsgliT5ck9x/ZwtPJiFDeB6vBoFdOUm3QwDMSO5q747oS7nvwKdg fpbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=vIlYxDHo; 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 p13si4084103ejo.460.2021.02.04.15.37.47; Thu, 04 Feb 2021 15:38:12 -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=casper.20170209 header.b=vIlYxDHo; 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 S235247AbhBDJjv (ORCPT + 99 others); Thu, 4 Feb 2021 04:39:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234689AbhBDJjs (ORCPT ); Thu, 4 Feb 2021 04:39:48 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A88B9C061573 for ; Thu, 4 Feb 2021 01:39:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=3o2saBcPyUQ6g/10+Rj6Ku6UfMXIXVT/67I546Blx18=; b=vIlYxDHoSkG7xyetvOcrUXHxn7 vlruNrOw3mqhF7OHZ9PhbqZWv4Ov6FPJGGT3kXeWxnkJ2lzi6SM/2sQr3qFAEEjeJ43iJc6jNQrvL 8sdRfvrgFXOVHJwBhI5vPjHWfrg9SMEfAzodtPEwIbPCLMV3JRwbTdNRu/2haO/n4uoW/PkixcQ8Y e1pCOgJ8n3i0uYz5W17A+HMqa5wpxUK5cEWu4Xb2cUzM69n7BdymyT+O/N3L3cIT4DBmvIyMvxoJX 4Mi0Vut1Emfb+IpRMEhg8NsegIRXwBZ3OaUn7oqFjFIJzfn4vcdzZQJfc7Uk315Pk40QlMKglWbb7 yfeerTLg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1l7b6J-000feA-Ae; Thu, 04 Feb 2021 09:38:59 +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 CC034301A32; Thu, 4 Feb 2021 10:38:58 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ACC542138F7C5; Thu, 4 Feb 2021 10:38:58 +0100 (CET) Date: Thu, 4 Feb 2021 10:38:58 +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 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.