Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp497655lqp; Mon, 10 Jun 2024 10:07:54 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVwAXWEEmdjjrW5KsT+lo5HGl7u7C0riGINSJaKfoUZ6E1rAf1w+2A56lkz+09TKgyteZ3dkOSJCthsrPEs7V62zkkz4fwqL58vWxPV5A== X-Google-Smtp-Source: AGHT+IFjqBz3plR/Q2+cgohECIWHxyMuSzZnnA2oS2B8MA0TyJHUOGKGQkIbeMJDh6QaOIlU/V8x X-Received: by 2002:a05:6e02:b25:b0:374:9a34:9ee with SMTP id e9e14a558f8ab-375803afb40mr109784865ab.31.1718039274226; Mon, 10 Jun 2024 10:07:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718039274; cv=pass; d=google.com; s=arc-20160816; b=xYxJiheJkpkwXBJezm0MOTrDD/ufufpnOSez8WoRFwGg6ZrB+ANaaEkY84YAi/cNWY Mp9+9UXOC6am7MOkmfV0rA1eEYhwtju2CuZGzx34sesxuRypwYHIlghcJyVPLtx0nNTn ueB7V/gkFQBu8Ldl7GtuGlJJFxOXZr3nofHJiOlJdty7CfCNG4+3J9XLPY3hp82jh6Fu Wojx3y7ys7t+60HlDokU2FuDlHy95LSQ+euZmmRtGB/RsZH07e1qhjtXTvEy9bhMl6JU 9+JdfLA4KQA3Hz7wm1DaGGhIrH8Rg5BPTMPk684k8XDNJEku5Z6uJIh/2xTdcQR854BG 2jLA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=MbKdbDdafB/WxdaDoWaEhC3Axrqrr8f85KBE7X/VpuU=; fh=Qxwcbfljj5Rl9KuH3i23D3aLHbMhPLPbNNcZhSwpBQk=; b=FP4x6/tqb2IMfqsVrFZH3y1aCbJuHLH7Cla96yX1PW3Cp1sb4QjRKCKS9t05yAeVmb 2Nf2Cmj350YxX9z+UCNcztVch2g5THid6wEdLLADw8WIrkD/XXhQCUaRcBAm4aLdNxPx TrX5nPIMnSBDtA49OXlw1xaAhcPu2S2hwiOl7JGcJ+h1nWztxkbkYCu4DKbWc1eRNi4/ SPWRyCQRkv2dwOqbax5tRcelzbMMPORVSqGrB/rxSW+Mek2+ZE2x/oJALYKoD/MluUA4 A66cjqvNsU0Jo1WG5k2lwTZA+VOF32jY/s7D87bSGuRdefh2bEnIwOHqWqZzSlgu1dIs q+qA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-208628-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208628-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e9741f894dsi3633075a12.195.2024.06.10.10.07.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 10:07:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208628-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-208628-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208628-linux.lists.archive=gmail.com@vger.kernel.org" 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AD7162882FF for ; Mon, 10 Jun 2024 16:58:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6CF4515250D; Mon, 10 Jun 2024 16:54:28 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 D2F8414AD3E; Mon, 10 Jun 2024 16:54:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718038467; cv=none; b=EMaclGYCNEHDHg/caw29vEAKHx8iaSu/lY5WHxZocHkchtrdLI9Ny75+ehTzVCaHdAfY32OWcMdnhkbbcBqhkYPW0Sipuci2C9zH7IBQ6oItClMzkrd1dlZpENX7iQidbTUl41+D2no6cOUBHZLfGY/A7VVIZynEzqkonSmIV/Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718038467; c=relaxed/simple; bh=IHKjkJJmNUwQBgZoGJ0QQEMWCIHokZu18EE5Cx8Z+f8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GyCA0oUHdIJE5GpENnff5CrnAxFvYo6LJT5FYhdFdplqs2z6a0GYma6flsyVKlVbWpl98N1a2UmIdwHkXvJm4qyPc3ar56aZ9rwvS7IvRlNt2hyYhfzmOFQeWCzk19TQWsxqAmyW0fzlE5f6Di1GIPhZTcXL3o4vFgLLlNzwxw0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 599B4C2BBFC; Mon, 10 Jun 2024 16:54:24 +0000 (UTC) Date: Mon, 10 Jun 2024 12:54:22 -0400 From: Steven Rostedt To: Yan Zhai Cc: netdev@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , David Ahern , Abhishek Chauhan , Mina Almasry , Florian Westphal , Alexander Lobakin , David Howells , Jiri Pirko , Daniel Borkmann , Sebastian Andrzej Siewior , Lorenzo Bianconi , Pavel Begunkov , linux-kernel@vger.kernel.org, kernel-team@cloudflare.com, Jesper Dangaard Brouer , Masami Hiramatsu , Mathieu Desnoyers , Neil Horman , linux-trace-kernel@vger.kernel.org, Dan Carpenter Subject: Re: [RFC v3 net-next 1/7] net: add rx_sk to trace_kfree_skb Message-ID: <20240610125422.252da487@rorschach.local.home> In-Reply-To: References: <983c54f98746bd42d778b99840435d0a93963cb3.1717529533.git.yan@cloudflare.com> <20240605195750.1a225963@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Thu, 6 Jun 2024 10:37:46 -0500 Yan Zhai wrote: > > name: kfree_skb > > ID: 1799 > > format: > > field:unsigned short common_type; offset:0; size:2; signed:0; > > field:unsigned char common_flags; offset:2; size:1; signed:0; > > field:unsigned char common_preempt_count; offset:3; size:1; signed:0; > > field:int common_pid; offset:4; size:4; signed:1; > > > > field:void * skbaddr; offset:8; size:8; signed:0; > > field:void * location; offset:16; size:8; signed:0; > > field:unsigned short protocol; offset:24; size:2; signed:0; > > field:enum skb_drop_reason reason; offset:28; size:4; signed:0; > > > > Notice that "protocol" is 2 bytes in size at offset 24, but "reason" starts > > at offset 28. This means at offset 26, there's a 2 byte hole. > > > The reason I added the pointer as the last argument is trying to > minimize the surprise to existing TP users, because for common ABIs > it's fine to omit later arguments when defining a function, but it > needs change and recompilation if the order of arguments changed. Nothing should be hard coding the offsets of the fields. This is exported to user space so that tools can see where the fields are. That's the purpose of libtraceevent. The fields should be movable and not affect anything. There should be no need to recompile. > > Looking at the actual format after the change, it does not add a new > hole since protocol and reason are already packed into the same 8-byte > block, so rx_skaddr starts at 8-byte aligned offset: > > # cat /sys/kernel/debug/tracing/events/skb/kfree_skb/format > name: kfree_skb > ID: 2260 > format: > field:unsigned short common_type; offset:0; > size:2; signed:0; > field:unsigned char common_flags; offset:2; > size:1; signed:0; > field:unsigned char common_preempt_count; offset:3; > size:1; signed:0; > field:int common_pid; offset:4; size:4; signed:1; > > field:void * skbaddr; offset:8; size:8; signed:0; > field:void * location; offset:16; size:8; signed:0; > field:unsigned short protocol; offset:24; size:2; signed:0; > field:enum skb_drop_reason reason; offset:28; > size:4; signed:0; > field:void * rx_skaddr; offset:32; size:8; signed:0; > > Do you think we still need to change the order? Up to you, just wanted to point it out. -- Steve