From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-170.mta1.migadu.com (out-170.mta1.migadu.com [95.215.58.170]) (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 2A4CF267F5F for ; Wed, 9 Apr 2025 16:41:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744216872; cv=none; b=lVMQhjz+6PCjiRQgXH3H+XyMMinlpLNKI4vWgXJh2uFeHYt7GpLod4Vmps0IUwaL2VsflI9WG1mqV4fKGEMaFkBiqTmk5ojVw6FWE9tvWKjrrZnYkdfvFW40YtKtuMCppRoB5iq6yVj3C4JSLloD+q20HHfTxsBzc90Byx4a3Q0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744216872; c=relaxed/simple; bh=fHtzsqyFXqsqKFMN9o9Jg6YNOCKqxpR3FTSVZ+RDgH0=; h=MIME-Version:Date:Content-Type:From:Message-ID:Subject:To:Cc: In-Reply-To:References; b=G3djfxHDcUr311Rh9fi29cgPlZx9Id+ZuoZNyj6uuqvxzvDXLVidw/wGLPfymA2Sez+bmEDsGPPVnblc+jKKctprq1FDEEsVVd6a98WRyNbL6lvv77haRec3jSgtKWdyBbd5jYVNphNP+eESSo8F0LMkmoUDeRa/7Ed5DFfTNdA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=flbivy0e; arc=none smtp.client-ip=95.215.58.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="flbivy0e" Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1744216857; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2uGpDWEkSr9vFQIbcnhzKP72TVIYwsPwOclwYbiHadg=; b=flbivy0eFa+1D3pp6XHzZXXaM/vyuD5kjKwpfeicfcJahclQRmqKai7pLKfClVn6NcPBQC odIONTf6B+d8QdgqeOfH3lULncL5hgF3qn7uCwEK0WVJQ9LLe9Vdz+hHiSn0MtHIhGIkfE Ou1Ya23bcILo4UFR8vebqPRdjlCCe4M= Date: Wed, 09 Apr 2025 16:40:55 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Jiayuan Chen" Message-ID: TLS-Required: No Subject: Re: [PATCH bpf-next v1] bpf, sockmap: Introduce tracing capability for sockmap To: "Steven Rostedt" Cc: bpf@vger.kernel.org, mrpre@163.com, "Alexei Starovoitov" , "Daniel Borkmann" , "John Fastabend" , "Andrii Nakryiko" , "Martin KaFai Lau" , "Eduard Zingerman" , "Song Liu" , "Yonghong Song" , "KP Singh" , "Stanislav Fomichev" , "Hao Luo" , "Jiri Olsa" , "Jakub Sitnicki" , "Masami Hiramatsu" , "Mathieu Desnoyers" , "David S. Miller" , "Eric Dumazet" , "Jakub Kicinski" , "Paolo Abeni" , "Simon Horman" , "Jesper Dangaard Brouer" , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-trace-kernel@vger.kernel.org In-Reply-To: <20250409121125.48510acb@gandalf.local.home> References: <20250409102937.15632-1-jiayuan.chen@linux.dev> <20250409121125.48510acb@gandalf.local.home> X-Migadu-Flow: FLOW_OUT April 10, 2025 at 24:11, "Steven Rostedt" wrote: >=20 >=20On Wed, 9 Apr 2025 18:29:33 +0800 >=20 >=20Jiayuan Chen wrote: >=20 >=20>=20 >=20> +#define trace_sockmap_skmsg_redirect(sk, prog, msg, act) \ > > + trace_sockmap_redirect((sk), "msg", (prog), (msg)->sg.size, (act)) > > + > > +#define trace_sockmap_skb_redirect(sk, prog, skb, act) \ > > + trace_sockmap_redirect((sk), "skb", (prog), (skb)->len, (act)) > > + > > +TRACE_EVENT(sockmap_redirect, > > + TP_PROTO(const struct sock *sk, const char *type, > > + const struct bpf_prog *prog, int length, int act), > > + TP_ARGS(sk, type, prog, length, act), > > + > > + TP_STRUCT__entry( > > + __field(const void *, sk) > > + __field(const char *, type) > >=20 >=20 > On 64bit, const char * is 8 bytes, and you are pointing it to a string = of > size 4 bytes (3 chars and '\0'). Why not just make it a constant string= , or > better yet, an enum? >=20 >=20-- Steve > Using an enum is indeed more appropriate in TRACE. Thank you for the suggestion.