Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp279550lqb; Tue, 4 Jun 2024 11:02:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWq1s9+sAkWPnUnDQUsQCth1zxpuj5COUnWqh8t+NymktdE5IO3JLJ8+U6+4/zsi+ZiII7Xuu91jaUmfSQfuBVyUU6d6bOqcUjY6EUUrQ== X-Google-Smtp-Source: AGHT+IHVCWrHDtlAZdPh/Dk/LDzd/xgWBTxpFms000vaSdQ6GfnIi9cGAiZTNlImD0HA7WFseazq X-Received: by 2002:a37:e10d:0:b0:792:bcc5:5c5 with SMTP id af79cd13be357-79523d26363mr14982885a.9.1717524153790; Tue, 04 Jun 2024 11:02:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717524153; cv=pass; d=google.com; s=arc-20160816; b=RwNsgbdUv0mOLsw5WReBIcK+LWR+PJYdP3TxsL2PIQLUqCdkYrp6IcDE5P7lKVi+dd uYxlfXfrZoroxVU+t74OoFYgnbAjD/e7C16n9xEAHrdTNyYBu3T9KDlRBqa/mfqFlD9i e/MRyh/y1b0QB1wyjAwk87cbnnMMBeaf9ACLpUpkVlkvokv5bm8wdKiLJNk5ywNtHSqF HsqDibIcF7JFfuf7S6oMTLcc3254eXgSXdw54z49ZncqPil7g+SpHB3aqtKX9LRfDI5Q 4CD1BQ8+ZjC7WHrI4F0IX3KOoXSiU+0uC0HX14tUH6qdnfbsg4Bbwrht8OtBpLGvkuo6 ImIw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=sM5upTKzaEKbfm0i4a3fwUIytIap79HDeEn1iTVbrEE=; fh=pMveXlSpsbH/r6WMQiAgSeKNvBwVHqVtWJdFwqUkMaM=; b=o1ESh1b2mKssNGKSaZmdKtkp0Ovq1l8Yg3JgMg88yYw+kz42BkOd68GA0v/CeDdkIg 7mgsFzXRA/bI0LvHLeB7z9x60E3Hq1BLme4db/TuU9ywpoyVTTw659/gzqKs1qjEQ7xY u8uprPbYQiNzwLwIuTAsH7plcPWhtQwpKbyLtkw8chmnBZQzB1S+fu5boLK6/1XNUZ2l c41q9QWEzvLE6XBI0vk7ezMno+ylijfjYbjRicI49yeAWgLeEMJO3cJTNGVqvxGactlD mMYGek+Cmmvb298m9l1ffIkL1cVGNa7kTW3wq1OtwvMFd2V7mFFebl36/ryhDtcQ6yk0 ptMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=H1DXBN0q; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-201222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201222-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.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 af79cd13be357-794f32a6e71si1110471785a.667.2024.06.04.11.02.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 11:02:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201222-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=@efficios.com header.s=smtpout1 header.b=H1DXBN0q; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-201222-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201222-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.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 8154C1C21194 for ; Tue, 4 Jun 2024 18:02:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0569D14A4E5; Tue, 4 Jun 2024 18:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="H1DXBN0q" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (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 8FF73179BC; Tue, 4 Jun 2024 18:02:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717524142; cv=none; b=o47TtoTIWoHOW+vKOyk5/6aD4ChBhk2yENN76/uHCXmylFCeI1awxjKYAcmUQBDBLOhIFYNNZ9TqLCUTIuR6jGmam1BCYDzj++GvF5zjoADUSH/ZN2+jrsVqxgwZKDywerXr6vK3WW9TXkZiQVFER714Ee+MZs3DuGPBW6TOfD4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717524142; c=relaxed/simple; bh=qcp+UzM4xs7eHbK/5zAhD0ChiUogwbeZjzyp4fNvko8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bLsrrB/hOvGORrdAHj5+WFQYab9h3z8hc0F3AGSFai8D2op155B87fW3d4EeQkF6lpp1y8vHVwyP190n4yYcrIg0iVVJUFdXonzsjf1TFzy8dpMHtNNfLcISsE9eFSmHpHdyw6+1DuzsKoE4OXSPUriOOZWZiWTNBNDyW/4fapk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=H1DXBN0q; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1717524138; bh=qcp+UzM4xs7eHbK/5zAhD0ChiUogwbeZjzyp4fNvko8=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=H1DXBN0qrpkHb1DP3ffwmLu34qJNIxKYImS1RbipV5DwDdW97Q+To4Q618q7A26pe qjGlrE0JFS/7pLIU2HuTUHXJXdImwlw82h3SNo5WEAPegF5gSW5IN5+Dx7q/enMupW wpIPAL008Q6I6iW+mVLd/HJsvcYIegDNlj2pZrG7XHLf/a/EraCwFIuRf5op6fct+K AUXVHncX/+QwKlJDPDubt12oicVEezHoNh02ZICqqcga3fjfZ6CYlHmLsyJdp7wpDh NBLuBO40/vMKwLfhRapC9UdUbxEAGh89SOxNu+varXmf2/7bpdZi7Q3wfIo1c6kLnX Myc9baY/JqNPA== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4Vtz2L0d0lz12ld; Tue, 4 Jun 2024 14:02:18 -0400 (EDT) Message-ID: <5fc7a866-ecd9-4b57-9740-369544df1264@efficios.com> Date: Tue, 4 Jun 2024 14:03:05 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 2/3] tracing/fprobe: Support raw tracepoint events on modules To: Steven Rostedt , Luis Chamberlain , linux-modules@vger.kernel.org Cc: "Masami Hiramatsu (Google)" , don , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org References: <171723014778.258703.6731294779199848686.stgit@devnote2> <171723016594.258703.1629777910752596529.stgit@devnote2> <20240604084955.29b9440687522a1347e0e7cd@kernel.org> <419b80da-9cbf-4bb2-aabb-dc04f0fb0f37@efficios.com> <20240604123418.22e16e97@gandalf.local.home> From: Mathieu Desnoyers Content-Language: en-US In-Reply-To: <20240604123418.22e16e97@gandalf.local.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-06-04 12:34, Steven Rostedt wrote: > On Tue, 4 Jun 2024 11:02:16 -0400 > Mathieu Desnoyers wrote: > >> I see. >> >> It looks like there are a few things we could improve there: >> >> 1) With your approach, modules need to be already loaded before >> attaching an fprobe event to them. This effectively prevents >> attaching to any module init code. Is there any way we could allow >> this by implementing a module coming notifier in fprobe as well ? >> This would require that fprobes are kept around in a data structure >> that matches the modules when they are loaded in the coming notifier. > > The above sounds like a nice enhancement, but not something necessary for > this series. IMHO it is nevertheless relevant to discuss the impact of supporting this kind of use-case on the ABI presented to userspace, at least to validate that what is exposed today can incrementally be enhanced towards that goal. I'm not saying that it needs to be implemented today, but we should at least give it some thoughts right now to make sure the ABI is a good fit. >> >> 2) Given that the fprobe module going notifier is protected by the >> event_mutex, can we use locking rather than reference counting >> in fprobe attach to guarantee the target module is not reclaimed >> concurrently ? This would remove the transient side-effect of >> holding a module reference count which temporarily prevents module >> unload. > > Why do we care about unloading modules during the transition? Note, module > unload has always been considered a second class citizen, and there's been > talks in the past to even rip it out. As a general rule I try to ensure tracing has as little impact on the system behavior so issues that occur without tracing can be reproduced with instrumentation. On systems where modules are loaded/unloaded with udev, holding references on modules can spuriously prevent module unload, which as a consequence changes the system behavior. About the relative importance of the various kernel subsystems, following your reasoning that module unload is considered a second-class citizen within the kernel, I would argue that tracing is a third-class citizen and should not needlessly modify the behavior of classes above it. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com