From nobody Sun Dec 14 21:54:01 2025 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3C83248BC0 for ; Wed, 15 Jan 2025 11:25:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736940312; cv=none; b=nEQRAXWh0+3LpOJSJ42KiR3nPVCgbI/UT24sUhAzq/6e4FWbjP4Glk/VZpJX2SzkHeWGSATc9QRezQvNdbID58RA8zW8M//IgiZd8ZAiJvgMLYhrnfcUhdSs4pl367izjgjIpmxETican2GIyUJIMiZt3NPMWIRrc7vmHNEBJKE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736940312; c=relaxed/simple; bh=jc9GH7iODcztLgEACa98S5q4gJs1cF3h7lsgl/BP0Hk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=k1lQhy/1HR9BPrnAon6IExwbVC4FCavo4iZPMv3xxO3yZ6/tLc/bdNpPqBMuw9F2tf82aXYqeFp89wYm27GYyplsPK/nHZp5bIgSH4lVKwSlnI7aZJ7HOP3HaAnJvLKitZprmDL+mtuaWbT+f4nqtDMd7fSaUMoehWJotM9pcLo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com; spf=pass smtp.mailfrom=cloudflare.com; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b=NmIRVVag; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=cloudflare.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cloudflare.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cloudflare.com header.i=@cloudflare.com header.b="NmIRVVag" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5d3d0205bd5so10042966a12.3 for ; Wed, 15 Jan 2025 03:25:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cloudflare.com; s=google09082023; t=1736940309; x=1737545109; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=AKwBUUwE5/H+m7uR8aKHohtap5VDKMhxAfFxXDhd+Hs=; b=NmIRVVagWgPQ0I7oI+f2kL92fHHH+dpj8e1/GN4hEqZ3oKoMO9u2E72cj8/D2TyIkT Z6HNwGkD5YtEGLoLIZuz8fIoxyijJjXrvL3aS9tKP2lZfqzPKUnn3UyPzSfQfsvWNnHs 2dNpaY9NlyOmw/vgYIKi6Ni37UYBjlYKMo93KM3tDg5rScUnlELre5Cc756FOM8aj2f+ RM5lCOk6c2jjvr5rauLuJnvbLLVS820B7sttKhAZqYmFYxk2X+hEMfUXLMWl0lm5m+7X kaQ49XGaeKkjm7aTChYxKtSRma6mJ8Xwi0n0EB6UFaHTgGaVVUAVKydD9lLDmC++x7zS vJLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736940309; x=1737545109; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=AKwBUUwE5/H+m7uR8aKHohtap5VDKMhxAfFxXDhd+Hs=; b=dZF9z5l6xAMuqHNOUtqAOy5cPe4Irm8nXBoJwgQV7to1GAl+d0MOohaP9+iL8vKSA2 s57Br2JlOmVzntv0Ss/qw2lf6zPSTABNjYZlu7w1zI2awM4+dNPTiRhEtKri1qqiu4ce J7DTj33ego9ixM63MJxCgKI5t8Ta61XIGai/jHl8vNyj+rGWxXuQrExto4m4UWrcYOKO 9C8JQRrvqBzg2RK7JAYuGxwD3YmK903JQt5S8dMs+DyEyliD0ne4q1FBhEsuQ4Jqj0Et iPB3Ue0bCG+DFGZKly/OHP27OHcz5tVkRggNJtN7jiFTOlORaZ9wSKXd+8suedOguZvr YTDA== X-Forwarded-Encrypted: i=1; AJvYcCX2Yxrg5XNZM+I+6H1d8F4TDxODmXfiR/EjQ4P6IlU9HIdbSMb2bow24LpS5lIg/Fv3z3PdhZDwrOrex8M=@vger.kernel.org X-Gm-Message-State: AOJu0Yzz87tqP6qNp/lTGS8WjjtFcUn9HjLU648/2ZR7Z2035DAq4sLn osn51UX/ZWNLEK+O1NnD2sZ1zltH+iGBRW7E/TSTc4laf+VaxsQYORQu0VtLfUw= X-Gm-Gg: ASbGncv6iy4MDiYtBuHFuQW2/kg85PaB1rT/1nk/RG+FLSbIZhvtyy/WRbq9MuVxaLQ 3FyALIqU0u9kiI9IVWFoGWVDjJoQcGwVnywJpCcfBGNf7Ia05wt3oX9GU9Yrw2G/Sbi/sDIlEhE 5+VA9e3n4KE2uBWYBBBGhntsLON5JAanq8w4M7DGBmH5wSDqm9tVacm3cBfzQbMS0YbVhHg7zte 9ZI12Hgcqn53BiRHqyJSBVgDRvOT0bnYAj1Tp/sMDIbTSzO X-Google-Smtp-Source: AGHT+IFwIzJ6xTi+4605ZBbBzuzxGNwpZgaGtz8sS4Qf3KCGF55otcZgVTUAfCpbEUbuusCYgmJ/Ew== X-Received: by 2002:a05:6402:1ed4:b0:5d0:bcdd:ff8f with SMTP id 4fb4d7f45d1cf-5d972dfbcc3mr24896880a12.4.1736940308722; Wed, 15 Jan 2025 03:25:08 -0800 (PST) Received: from cloudflare.com ([2a09:bac1:5bc0:d60::38a:40]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d99008c371sm7400438a12.11.2025.01.15.03.25.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jan 2025 03:25:08 -0800 (PST) From: Jakub Sitnicki Date: Wed, 15 Jan 2025 12:24:54 +0100 Subject: [PATCH] ftrace: Allow tracing rcuref_*_slowpath 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="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250115-rcuref-ftrace-v1-1-76fa408c9884@cloudflare.com> X-B4-Tracking: v=1; b=H4sIAAWbh2cC/x2MQQqAIBAAvxJ7TlBDk74SHcTW2ovFWhGIf086D sNMgYxMmGHqCjA+lOlIDVTfQdh92lDQ2hi01EYqZQSHmzGKeLEPKPQwGmnROeMstOZsjt7/Ny+ 1ftIcVVpfAAAA X-Change-ID: 20250115-rcuref-ftrace-237506e88586 To: Andrew Morton Cc: Thomas Gleixner , Jakub Kicinski , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, kernel-team@cloudflare.com X-Mailer: b4 0.15-dev-355e8 All objects under lib/ are built as non-traceable for performance reasons since commit 2464a609ded0 ("ftrace: do not trace library functions"): This prevents users not only from tracing library functions with ftrace but also from attaching kprobes to them: # perf probe -a rcuref_put_slowpath:32 [ 65.228593] trace_kprobe: Could not probe notrace function rcuref_put_= slowpath The available solution is to rebuild the kernel with CONFIG_KPROBE_EVENTS_ON_NOTRACE=3Dy. A usually disabled option because of i= ts potential pitfalls, intended for those debugging ftrace itself. By default, in face of any bugs with reference counting, like the one we are currently tracking down [1], users cannot leverage kprobes to collect additional info like stack traces or data from the rcuref container, for example dst_entry. Building a debug kernel is the only option. Make it easier for users to troubleshoot reference counting issues by making the two rcuref_*_slowpath functions traceable. [1] https://lore.kernel.org/all/87ikxtfhky.fsf@cloudflare.com/ Signed-off-by: Jakub Sitnicki --- lib/Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Makefile b/lib/Makefile index a8155c972f02856fcc61ee949ddda436cfe211ff..1f5c9557c4cb5bf2b6e4ac7e87e= d30bb3c8f4664 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -5,6 +5,10 @@ =20 ccflags-remove-$(CONFIG_FUNCTION_TRACER) +=3D $(CC_FLAGS_FTRACE) =20 +ifdef CONFIG_FUNCTION_TRACER +CFLAGS_rcuref.o +=3D $(CC_FLAGS_FTRACE) +endif + # These files are disabled because they produce lots of non-interesting an= d/or # flaky coverage that is not a function of syscall inputs. For example, # rbtree can be global and individual rotations don't correlate with input= s.