Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp419023lqr; Wed, 5 Jun 2024 09:38:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4jrhdKfZSYmUAE1FVaNJyt3+C/FwWG4YZ7NdfbrbETkXqyAF2y4bsJCoO36WiJGrDPCxWV+j7KgDfcWbljjWJDvoHjEZr7RaVvAqZkA== X-Google-Smtp-Source: AGHT+IHb2F7yb0olSLTKUsKhL/vw+dWUZUTJnKscfROxzQUvWs2WfGasMM5m8mzUCvj6LE5dBe7E X-Received: by 2002:a05:6122:31c:b0:4eb:1ec6:72f3 with SMTP id 71dfb90a1353d-4eb3a3fe05bmr3381057e0c.6.1717605512939; Wed, 05 Jun 2024 09:38:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717605512; cv=pass; d=google.com; s=arc-20160816; b=dpVmAD2Lo4ThzkIWJezQv2nwAN3mklNqHmHV63V2h5IaG5So9FLPdDuayAj4WdTWXE QP+5NVX0RSIdYEMDDVX+DJwcRllsk+SdghQ+IujGGbomya/fXGULFEZAvkRFHjw7Etyo BwMH4a4XO2dPrI2c0bjH6OY5/mCIZ4J+I3wLuwTvUFh6Juo+MRUZPQmVSCUS4O+Ku9gd 9OYFjPAYIX+vA/fBBEfIOVBktfNdKjzGtk1I4lZ6TfkAwpXUcYrbmZrJNAM8ZlzNS5me tm/3N8fZcQdN+b1nbb8Z168S30Dg4o5ZyjoDYvtGNp8GKVxc74WW5dU70i9ibntNj7Dv ujJw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=XBGg4L8V3Q5EYMEYMCQld5ntR2Bf7/IEh8rTgIfGGV0=; fh=C0qiOMaxbyx3y1zoxd3Kabhq9YHl22DqqwO7/qdSdlE=; b=UdX3sQq9xPLOztWeKjIVpaiOmjDGhaJA5ut684gHeeejvsFBgmzMqpiAOkgOu1rh8t rxARij3SXHbj/+mQCg1aalYBjkGI6UI8EGuYoAG+DTsKjaKipq2L34SwNok44d9Z2cnt sydxuITbk8Th7BHOkZL8O2HdTKwGISv9UwlTLcps+WfUniIAMixDeQ3jwHqnlII1yeo8 bcGsBpdHwrfRMI7HR1y1SP9NJb0BD9Sg+4xh9o7HDAFHOzoRjkMDk3aM0YpKpNGf+y+A NSVB1qrpo83Fq6MZOV88at89FJ/XNR2mOAD2TPPihvYav5CxIeVrfRI6FZduBsTiFWtA /fKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UrThbiOz; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-202923-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 71dfb90a1353d-4eafedc9826si2440661e0c.75.2024.06.05.09.38.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 09:38:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202923-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UrThbiOz; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-202923-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202923-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D9B8F1C2169A for ; Wed, 5 Jun 2024 16:38:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA1DC18FC8F; Wed, 5 Jun 2024 16:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UrThbiOz" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6DB81188CC8 for ; Wed, 5 Jun 2024 16:38:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717605492; cv=none; b=mCgORGs18hQnc1B+3OB+E7j1HouY4B6JgozW8gPKccv4+t0jJ9gfPZKca62KXTx0Px7eTPBa61ZpdH+SwNsdHXSH3Hpay1CAw8xqHKjjdgF5ldlD0PKSGfFNs9P24lqyCl8FR4WsguOKzzYtECCLtkEjHI1Gxgzt9+qr7SFDKO0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717605492; c=relaxed/simple; bh=qYHQHvxEOL0+ja9/l1xmzQYzTlCH0OQ9ADs1DPd83aI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=PPZOitNZhAHaPl3T/33ADXZkF6gv9O6YXmr+nCx92GjjfisG5YGNy9rbRAuao1pyjPuYbItk2ulPoVbxq/XyqwxDf6SW8p5dUEk7YuofbQUlj0xlW2q/xTBk6dm1TkM9CkJqvvenUIKe7IhK5BZuj7sDJo8gFIZ/Tlxm+M5w9qc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UrThbiOz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717605489; 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: in-reply-to:in-reply-to:references:references; bh=XBGg4L8V3Q5EYMEYMCQld5ntR2Bf7/IEh8rTgIfGGV0=; b=UrThbiOzAkQtnLaax8r6bgFWB513pjgbgpvPnzI8i6MY2H9jdRUc7a0+jdE+fFZmXO64NE sWPtgbwNCPDVWpA4pmAZVN1MbehKapYTaxWYgwo06IhhuPYrJ/0PZvgoRssXQFknU3txCG vNvKSIDQOzZwXoIi6uabh4GsJRVKCLs= Received: from mx-prod-mc-02.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-632--yINWIP3P5KgloQ-Sd_GjA-1; Wed, 05 Jun 2024 12:38:06 -0400 X-MC-Unique: -yINWIP3P5KgloQ-Sd_GjA-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-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BCB8C1954216; Wed, 5 Jun 2024 16:38:01 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.62]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with SMTP id 0386B3000623; Wed, 5 Jun 2024 16:37:54 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 5 Jun 2024 18:36:32 +0200 (CEST) Date: Wed, 5 Jun 2024 18:36:25 +0200 From: Oleg Nesterov To: Jiri Olsa Cc: Peter Zijlstra , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , bpf@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Steven Rostedt , Masami Hiramatsu , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org Subject: Re: [RFC bpf-next 01/10] uprobe: Add session callbacks to uprobe_consumer Message-ID: <20240605163624.GG25006@redhat.com> References: <20240604200221.377848-1-jolsa@kernel.org> <20240604200221.377848-2-jolsa@kernel.org> <20240605152457.GD25006@redhat.com> <20240605160117.GE25006@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240605160117.GE25006@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 On 06/05, Oleg Nesterov wrote: > > On 06/05, Oleg Nesterov wrote: > > > > > +/* > > > + * Make sure all the uprobe consumers have only one type of entry > > > + * callback registered (either handler or handler_session) due to > > > + * different return value actions. > > > + */ > > > +static int consumer_check(struct uprobe_consumer *curr, struct uprobe_consumer *uc) > > > +{ > > > + if (!curr) > > > + return 0; > > > + if (curr->handler_session || uc->handler_session) > > > + return -EBUSY; > > > + return 0; > > > +} > > > > Hmm, I don't understand this code, it doesn't match the comment... > > > > The comment says "all the uprobe consumers have only one type" but > > consumer_check() will always fail if the the 1st or 2nd consumer has > > ->handler_session != NULL ? > > > > Perhaps you meant > > > > if (!!curr->handler != !!uc->handler) > > return -EBUSY; > > > > ? > > OK, the changelog says > > Which means that there can be only single user of a uprobe (inode + > offset) when session consumer is registered to it. > > so the code is correct. But I still think the comment is misleading. Cough... perhaps it is correct but I am still confused even we forget about the comment ;) OK, uprobe can have a single consumer with ->handler_session != NULL. I guess this is because return_instance->data is "global". So uprobe can have multiple handler_session == NULL consumers before handler_session != NULL, but not after ? Oleg.