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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4877ACD13DE for ; Sat, 31 Aug 2024 16:19:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7C4F98D0030; Sat, 31 Aug 2024 12:19:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74DD98D002D; Sat, 31 Aug 2024 12:19:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EEA48D0030; Sat, 31 Aug 2024 12:19:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 3E2728D002D for ; Sat, 31 Aug 2024 12:19:39 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id BB220140C31 for ; Sat, 31 Aug 2024 16:19:38 +0000 (UTC) X-FDA: 82513051236.18.355E74D Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf18.hostedemail.com (Postfix) with ESMTP id B9C741C0004 for ; Sat, 31 Aug 2024 16:19:36 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=W1i3sZzc; spf=pass (imf18.hostedemail.com: domain of oleg@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=oleg@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725121085; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=o32RInfbuL+zWyn8Ou1U9Z6HZtom/bVCsA3/odOFf80=; b=O44vKg5Os0vr3jin5LGjTJlcx8S3EzBjWtb9Mtj1ogW979rDzhVwBNf5rlengwb9rf5CaP FJxeQ5N7M1TSKDrTa5Gix5KzRnXHk3x1Hrj2YCj4J//7h8OxQd6KelpP5QbhaegUvov3jQ vJ8XlFgZxYYM75Z1mqMrdaFl7hBzDcU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725121085; a=rsa-sha256; cv=none; b=wk+oGnO2gFiXKrP19tnFf8fR183tYNxALUsvFBoRVcBxLed/DPZPewLYBSsZRWcDM7+UXj Pl7Y9U/yS0fs2gp86fXZMYze+uqPyhPkwaoWgG0vyOJRyZrEPg9v5VBJLfmkGn+UuWc8YW sbi9ELbQ9gCyopucRiv0VlYIob2lnck= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=W1i3sZzc; spf=pass (imf18.hostedemail.com: domain of oleg@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=oleg@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725121175; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o32RInfbuL+zWyn8Ou1U9Z6HZtom/bVCsA3/odOFf80=; b=W1i3sZzc+HNSwxQWsCQgq4yvvlc5J1+nqtGZkOM4w8ezvGIJhEhn7BU0oDu66Ecjg05War iMovgCJLkdeOsmsHY6l6xX4KHS+ckKYU+FiW3aMfvXZXPt4YsU0U/IH7UWjbf0v9S+MVw6 J5JWCk7NciKvzFsz4AM+SwG/lTi3c2Y= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-595-I1N5zLFcPyWYmqvwB4IBXQ-1; Sat, 31 Aug 2024 12:19:33 -0400 X-MC-Unique: I1N5zLFcPyWYmqvwB4IBXQ-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 89F791956080; Sat, 31 Aug 2024 16:19:30 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.49]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 59E8F30001A4; Sat, 31 Aug 2024 16:19:25 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Sat, 31 Aug 2024 18:19:21 +0200 (CEST) Date: Sat, 31 Aug 2024 18:19:15 +0200 From: Oleg Nesterov To: Andrii Nakryiko Cc: Jiri Olsa , Andrii Nakryiko , linux-trace-kernel@vger.kernel.org, peterz@infradead.org, rostedt@goodmis.org, mhiramat@kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, paulmck@kernel.org, willy@infradead.org, surenb@google.com, akpm@linux-foundation.org, linux-mm@kvack.org Subject: Re: [PATCH v4 4/8] uprobes: travers uprobe's consumer list locklessly under SRCU protection Message-ID: <20240831161914.GA9683@redhat.com> References: <20240829183741.3331213-1-andrii@kernel.org> <20240829183741.3331213-5-andrii@kernel.org> <20240830143151.GC20163@redhat.com> <20240830202050.GA7440@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B9C741C0004 X-Stat-Signature: rw5ixxryufzny754ad4n4t4qedia1x3k X-HE-Tag: 1725121176-844385 X-HE-Meta: U2FsdGVkX19xA3MmiSwpcdD2OJfRZfFgfCzXpaGJ0G6Iyw4DXPrX/1rNxrz3U9UDuDL0EDVPcxFnStV40htu37Iqpht91erQWe3RhNtRolPDI3vYe5Sm2Ttjh0g8JOgBRhFFyAQpC3dRI1VWGHQ6yYKDl1DOxVwU4PFHqJZCfPNkwB8eGx9EnNJbkHEaW93ndClB7sIHBR4IDrPegusX64kmeHLBbMqqylYRj5qOPpizRYVp5YqOg1UcpCW3QN1c9A1oko1DnxAMvS1HR1iYckdjyiu3nXtaIqqYlYgiQtjUOHJ+qXn3sMuu3vmcMYNIFpQk5/s1T0Nx5RI6IZ0+EcKCL360kb6jycU2wvD499uY12XXYwRuMeNGQO1uJZtrKqCiQ4cORVBZQh2U5LT/R4F+/t9mb85GnSCpf9b1xnWqXEWenq3K3DJyfYG9eF6hm0749PY2fP/a+KWBxzaFox+vmY8jFiEKyy/mhiRnzg9G4VReC9xmgMgiIH2JvGiISisGfoCrlSsc/06PtCv/ZK6Z/uZt7pQAjYt1yccjhEgmf0fSrvBb2w1twsJWb2rGc2FN5Q+ZfWHNEWjgzAjc6kT8ZhcGdZ/lGXSdlE8TGxJ5GEhxN4fhCewhpn3IIF28zUxaFfD2KeAgJ6URrsZZT6B7kp+DVc4ZlCdLEZXwGUv3qbJHs2rYwZYHYug48Mt4Nf3+KY4sm9p1HOq5c95GjDKcrIWaycQYPUHzmot3DJ5iSp+YU1L6aRHpSjHiUcxU9x6BBNH8+me2WHZPOZXkMH1c885AO5+UMR/mdwnV+IzsNfqLtVY8Mjr1qo0MqcERRFsYNay2MkRnMFAuGT6m8vHPYpkq0I7aPYyUCTOndBA94u/rrXXs+RxgpuG5w7FbfPeUjafRV9Eimo/Gk9OWV9iF4+D2P75+FUSvvM2eJpbxvOyMj6FOJkK+hABxWejfmD0yNkT7/NMMuVrHZtp FR2tWQh7 jEoanGmaVLqixNso6OFuMQjUa3rqUUKGhwiNizWema7UcEN67/mPp87H08WQOnLhoAfbdW+lMMuMbmcX3CT6iC2h1w+3d5Ixo85e7Xj/KXN8x2brtexhSPzjQUbhh4xOQGcWwd6ruxMSiLVayxfueUQ4fuL0FWK+G3odDYqMIfTSsLeE5RWr6FiXiTdPbPJdy8zcrMuAeaGAlzheThXMpZYQby9qtCb2sx2dAlg+p9ODgbv4K7B8/HU+YC1NkbwWj9hy6FTPXXSXWBhPaC8gJORoc+bGQLShSCg4fxLyxyi7FV1+ay50nhjkhR6ErSPz+1szGJV4WrZWZQKjoqeFL+5mKZgNhugkpmRZLF8EmL7XMknEG38OxyMJifYD9XqP+Ikcy2Gsepl/xMvF6vxlagmokhQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 08/30, Andrii Nakryiko wrote: > > On Fri, Aug 30, 2024 at 1:21 PM Oleg Nesterov wrote: > > > > I'll probably write another email (too late for me today), but I agree > > that "avoid register_rwsem in handler_chain" is obviously a good goal, > > lets discuss the possible cleanups or even fixlets later, when this > > series is already applied. > > > > Sounds good. It seems like I'll need another revision due to missing > include, so if there is any reasonably straightforward clean up we > should do, I can just incorporate that into my series. I was thinking about another seq counter incremented in register(), so that handler_chain() can detect the race with uprobe_register() and skip unapply_uprobe() in this case. This is what Peter did in one of his series. Still changes the current behaviour, but not too much. But see below, > I still think it's fine, tbh. and perhaps you are right, > Which uprobe user violates this contract > in the kernel? The only in-kernel user of UPROBE_HANDLER_REMOVE is perf, and it is fine. But there are out-of-tree users, say systemtap, I have no idea if this change can affect them. And in general, this change makes the API less "flexible". But once again, I agree that it would be better to apply your series first, then add the fixes in (unlikely) case it breaks something. But. Since you are going to send another version, may I ask you to add a note into the changelog to explain that this patch assumes (and enforces) the rule about handler/filter consistency? Oleg.