Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753131AbbBXOTM (ORCPT ); Tue, 24 Feb 2015 09:19:12 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:15595 "EHLO imgpgp01.kl.imgtec.org" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751407AbbBXOTK (ORCPT ); Tue, 24 Feb 2015 09:19:10 -0500 X-PGP-Universal: processed; by imgpgp01.kl.imgtec.org on Tue, 24 Feb 2015 14:19:08 +0000 Message-ID: <54EC885B.6090905@imgtec.com> Date: Tue, 24 Feb 2015 14:19:07 +0000 From: James Hogan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Steven Rostedt CC: Jeff Layton , "J. Bruce Fields" , , Trond Myklebust , Ingo Molnar , Subject: Re: [PATCH] sunrpc: Fix trace events to store data in the struct References: <1424778476-28242-1-git-send-email-james.hogan@imgtec.com> <20150224090915.40d8c7ff@grimm.local.home> In-Reply-To: <20150224090915.40d8c7ff@grimm.local.home> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="seMb6dKpGRHx6hb8oHDFXhdg5KTgsv2bF" X-Originating-IP: [192.168.154.110] X-ESG-ENCRYPT-TAG: da4c5968 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3837 Lines: 119 --seMb6dKpGRHx6hb8oHDFXhdg5KTgsv2bF Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi Steven, On 24/02/15 14:09, Steven Rostedt wrote: > On Tue, 24 Feb 2015 11:47:56 +0000 > James Hogan wrote: >=20 >=20 >=20 >> TP_printk("xprt=3D0x%p addr=3D%pIScp pid=3D%d flags=3D%s", __entry->= xprt, >> - (struct sockaddr *)&__entry->xprt->xpt_remote, >=20 > There's actually nothing wrong with the above even if xprt is NULL. > It's not dereferencing the structure, it is just getting the address of= > what would be dereference. I think that corresponds to the %pIScp format which I presumed does dereference the pointer? Looking at Documentation/printk-formats.txt I see: > IPv4/IPv6 addresses (generic, with port, flowinfo, scope): > ... > %pISpc 1.2.3.4:12345 or [1:2:3:4:5:6:7:8]:12345 Same applies below. Should these formats still be avoided? Thanks for reviewing, Cheers James >=20 >> - __entry->rqst ? __entry->rqst->rq_task->pid : 0, >> - show_svc_xprt_flags(__entry->xprt->xpt_flags)) >> + (struct sockaddr *)&__entry->ss, >=20 > The above is meaningless. You just printed the address of the ring > buffer and this will be different (and useless) every time. >=20 >> + __entry->pid, >> + show_svc_xprt_flags(__entry->flags)) >> ); >> =20 >> TRACE_EVENT(svc_xprt_dequeue, >> @@ -562,17 +566,21 @@ TRACE_EVENT(svc_handle_xprt, >> =20 >> TP_STRUCT__entry( >> __field(struct svc_xprt *, xprt) >> + __field_struct(struct sockaddr_storage, ss) >> + __field(unsigned long, flags); >> __field(int, len) >> ), >> =20 >> TP_fast_assign( >> __entry->xprt =3D xprt; >> + xprt ? memcpy(&__entry->ss, &xprt->xpt_remote, sizeof(__entry->ss))= : memset(&__entry->ss, 0, sizeof(__entry->ss)); >> + __entry->flags =3D xprt ? xprt->xpt_flags : 0; >> __entry->len =3D len; >> ), >> =20 >> TP_printk("xprt=3D0x%p addr=3D%pIScp len=3D%d flags=3D%s", __entry->= xprt, >> - (struct sockaddr *)&__entry->xprt->xpt_remote, __entry->len, >> - show_svc_xprt_flags(__entry->xprt->xpt_flags)) >> + (struct sockaddr *)&__entry->ss, __entry->len, >=20 > Ditto. >=20 > Don't use field_struct() unless you really know what you are doing. > This is copying the entire struct into the ring buffer and only using > the address of that struct. Which not only is useless, but wastes a lot= > of space in the ring buffer. >=20 > -- Steve >=20 >> + show_svc_xprt_flags(__entry->flags)) >> ); >> #endif /* _TRACE_SUNRPC_H */ >> =20 >=20 --seMb6dKpGRHx6hb8oHDFXhdg5KTgsv2bF Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBAgAGBQJU7IhbAAoJEGwLaZPeOHZ6/0UQAKQoe38c1wf7kHnI25tisKii UKXn1m/zTpWqOrQ8YFV+0UNEHN8+1PNUN6INUVAPywQ1ZHOwVzYTP4jeP7DJLrtF 2fUDae0SYot9AweKW5vB8jVcv9EoIv1km2/TT1rW8z2NCcRwddnFolG2M1J2KHIn 0AoP760y034AoT6AcjsSX+NNXA27i8/QfEAUyVlET0fxu+Yq9znryq1mSllnW0Zx yFRuVZG6ZHmDnRPdGk5QTJ7SqZxWHkLbtUsrt1Q9MJh+veq08rpB3XDOSToQ0Nyd qRZH2pIMwnMF1fE56452j+oKIUuD1lzuIgmteBTMMgEc4outSCHXtO/sZmgkfJYs b2ZJvDzxYzUOt0ZwK2UThskYpGyTtKisX7VWlz7VSZ4LfVEN52vnYfLfZBbkkknS LvyVW2ATlyGSa09mCb3Ufe2BIgAFCNmHp1sioKvyr23+lgPGjvGYOEZreUhIKjIh C22Xz9/ZgYxA2QR6ocVYmtUFIK2h6EIF6IGsJXBlZk06qSQTU5Gv0pKYe0tyHUVv KvLfL29NDr5AyghtYoOe9bfTdtEXblC2q4UnELROC/CcBMs4InQV8Zgt+HBUq3ot TEOB1y5JfGPHAK9IvZZN7CClJKnerbs39AZcU3Iq7p6g/ICFpm4IQkAhVIOsJzYv WqhCZeaExLG4jPrlAOZo =BK9F -----END PGP SIGNATURE----- --seMb6dKpGRHx6hb8oHDFXhdg5KTgsv2bF-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/