Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp390524lqr; Wed, 5 Jun 2024 08:57:47 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8fVgF2x6KnHelXUf6SdOnz/CuEtXEwI71WJ2r7xvlJetjTv+5Y4iAOuDSPLH0OD9pBG7WNaKVlkOU9dxFYxvMVNkt4P5lRKLzj0TRpA== X-Google-Smtp-Source: AGHT+IGhPsghVaJ1/0MDKvh7k/YaAeKXKyecxytmaXqrsQ0UMctYYHnxYahmZE48ckbk4yGqJ3xO X-Received: by 2002:a05:6a20:244d:b0:1a8:4254:5cdf with SMTP id adf61e73a8af0-1b2b6f819aamr3380094637.22.1717603067471; Wed, 05 Jun 2024 08:57:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717603067; cv=pass; d=google.com; s=arc-20160816; b=yy7g3RYnqA4keGhqlpajiriSfBy19YSRput3xOBZpdrrDNXQlVfALx2iVkF8VEM6Cu nkfGvQdmxfn6114bHwrE7Ai2Y/EvYSgcm0NtjRY6J5qE2wF4S/cfYTRqbwp7QZa9r718 RtRb/N9YC0whgqlmfM8b9WmfcC7nk/XvDYGjoGLoSUNBV3jxbW1an5GuJsVhB/O/MQSa gIsv/TvHa+s/y3RhX9ghZ8PaXSOrbQFoUMPcIWizFkRKRvmtZ9sQS8YHrp7oOcsp6ddZ YlAT5e6IS0C4txnz4ZJgqgCoz0F/2WoKrkOI7h4VvJCy8HJORjTDL6xFiAru0uAvpUH2 Im4w== 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=JBCoiHutLk0vWvVe2jPtxGY0YZJBt3gZWD7D6OcdQ4I=; fh=C0qiOMaxbyx3y1zoxd3Kabhq9YHl22DqqwO7/qdSdlE=; b=QQtLqBT+DQXhDnztrPRMO/T+zH8MDzq2Q20o74kfDH1XaXpJGb22DoPkilBRcbAsKb uH9taPU9ZWRd1xxAIJ24nva4I9ziBtVYYE38d4VWiSGnT6dYBDVSOVI1oSmb0Lo1MDPL x1gWfqhnbI/KDD7CVyKUZ640yM/F84a+M3gyUpShlup5+bvgvJYEsRrbjkQiPTDcsvz8 gAfUZ0d7tTeAQQp7elSiN4VGUjCvKAvIFwJtyW6TQzHOlxJAK4pvw8YATrOAscSNtMMA wab+Q1lU5kIFzkoWWi8j0bokk2eINHnnlbd7+N5x1cPaFsQAsL2MyxF3QtfiWU2XHwrr YJYQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y6GHnbDM; 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-202831-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202831-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35af457c3si4176571a12.430.2024.06.05.08.57.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 08:57:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202831-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Y6GHnbDM; 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-202831-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202831-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8A60AB28921 for ; Wed, 5 Jun 2024 15:26:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74BD348CFC; Wed, 5 Jun 2024 15:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Y6GHnbDM" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 0C177148FF8 for ; Wed, 5 Jun 2024 15:26:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717601203; cv=none; b=T0Em4iOGpUPvsH4rf1fnWPBVgJdRe9QBUO174kTn4n55i3uOPU3B0NuIJL7MpOsdqNkJTjX0NCJGghfJVhE46XekvhepRqaFxEk245jHZv4zOgULM2A3gkV6wgdn/G6T8FXJxG232FFITm1XmM7bYSu4iprfFaJy2UuOxwheWRA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717601203; c=relaxed/simple; bh=bNuWGrfh+H7Fav06wVfQOoCuk0r6nLVCkcxz3VrlPag=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EaVx2zf9Bbv9h2Cax7KfVWudYwoPxz3YzafXPfqjni6qTJzkZzbg4JtBNr5W6+6/pTo0kx93J4g/2ckVz58z1nx6E6TOFGuZB69pTVxQaBnBv0OGvY0GQKHQzoBuVRkPE0Dkg+iEzBQyYMwQ0gXC5UA9GdcwAhmbZXUtqXkjk8E= 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=Y6GHnbDM; arc=none smtp.client-ip=170.10.129.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=1717601201; 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=JBCoiHutLk0vWvVe2jPtxGY0YZJBt3gZWD7D6OcdQ4I=; b=Y6GHnbDMW/pcifhH9pwuCpUD52p/BLEQCvMu9Ho35lR9PrncezBaQlVWtTtE0HJxKrSO9m Zq4TiQFUF6IEeXC7LUHjeOdy7zBicsZ2XmatVI4WdrSzfBUK+EERNvaHObufCHtL/Sub3N 1TdXFWlSn8xkBhtO1UXdhZyNM5WE/p4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-513-1Nq6HuAwPg6NLiDZHQWiFg-1; Wed, 05 Jun 2024 11:26:35 -0400 X-MC-Unique: 1Nq6HuAwPg6NLiDZHQWiFg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1A5878032F8; Wed, 5 Jun 2024 15:26:31 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.50]) by smtp.corp.redhat.com (Postfix) with SMTP id 32B02C15970; Wed, 5 Jun 2024 15:26:26 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 5 Jun 2024 17:25:01 +0200 (CEST) Date: Wed, 5 Jun 2024 17:24:57 +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: <20240605152457.GD25006@redhat.com> References: <20240604200221.377848-1-jolsa@kernel.org> <20240604200221.377848-2-jolsa@kernel.org> 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: <20240604200221.377848-2-jolsa@kernel.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 I'll try to read this code tomorrow, right now I don't really understand what does it do and why. However, On 06/04, Jiri Olsa wrote: > > struct uprobe_consumer { > + /* > + * The handler callback return value controls removal of the uprobe. > + * 0 on success, uprobe stays > + * 1 on failure, remove the uprobe > + * console warning for anything else > + */ > int (*handler)(struct uprobe_consumer *self, struct pt_regs *regs); This is misleading. It is not about success/failure, it is about filtering. consumer->handler() returns UPROBE_HANDLER_REMOVE if this consumer is not interested in this task, so this uprobe can be removed (unless another consumer returns 0). > +/* > + * 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; ? Oleg.