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.7 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 A5EE3C433E0 for ; Thu, 4 Feb 2021 09:40:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 51EEB64F51 for ; Thu, 4 Feb 2021 09:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235256AbhBDJjw (ORCPT ); Thu, 4 Feb 2021 04:39:52 -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.