Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754675AbeAGUzf (ORCPT + 1 other); Sun, 7 Jan 2018 15:55:35 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:39972 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754649AbeAGUzd (ORCPT ); Sun, 7 Jan 2018 15:55:33 -0500 From: Song Liu To: Yafang Shao CC: David Miller , "brendan.d.gregg@gmail.com" , "marcelo.leitner@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 net-next] net: tracepoint: exposing sk_faimily in tracepoint inet_sock_set_state Thread-Topic: [PATCH v2 net-next] net: tracepoint: exposing sk_faimily in tracepoint inet_sock_set_state Thread-Index: AQHTh4FTU3HnCuW71E25yE38X9waF6No5K6A Date: Sun, 7 Jan 2018 20:55:26 +0000 Message-ID: <075DF50A-F4CD-4475-B393-1293BDF8E038@fb.com> References: <1515306707-1759-1-git-send-email-laoar.shao@gmail.com> In-Reply-To: <1515306707-1759-1-git-send-email-laoar.shao@gmail.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: Apple Mail (2.3273) x-originating-ip: [2620:10d:c090:180::98b8] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY4PR15MB1512;7:Z6BLQ1hFK2zx8wTQ4sFN9HEmkOw3DiL1VMPei8/CxoA+sxz7Z6hoqosxL6c9tppQP1nHWtJmtGFcsjFxIfM9/hUZ+eSwgKsi68mJcFzODzW6C8DRVy9MEkefeI5dkWrVTBmVpFrkJMi07HTRllFPfbABliJXAFXder7mHdLIHLfmr/T9c+8LF+blM/QCbAJFgqcVZVCAqL/Ndu21jA8uEotM4+PRd5C6dTehBJHyv+FIqkSPyo7nCsXvL7vs7ZgG;20:saWfeZbe7T/ACzS5kUxIUQUHRiRjshiWWSEGmYymdsAkzNV1YIUokmGMH1ZsjaW5WHOi4X5NsNb3JgNe05OsoNB3ncyhy6BiCUYJfs8ITI08BZhvL+cix9ucw6TPVPaFAbxZCtN5dDlQys+SLEKW4EnmMfhM6UFZalOGXIGrhM8= x-ms-exchange-antispam-srfa-diagnostics: SSOS; x-ms-office365-filtering-correlation-id: a52b0db8-9461-40e4-c2af-08d55610fa69 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060)(7193020);SRVR:CY4PR15MB1512; x-ms-traffictypediagnostic: CY4PR15MB1512: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(67672495146484); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(93006095)(93001095)(3002001)(3231023)(11241501184)(944501075)(10201501046)(6041268)(20161123558120)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:CY4PR15MB1512;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:CY4PR15MB1512; x-forefront-prvs: 0545EFAC9A x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39860400002)(376002)(346002)(366004)(396003)(39380400002)(189003)(199004)(24454002)(6916009)(86362001)(36756003)(6436002)(53546011)(81156014)(81166006)(6486002)(77096006)(5660300001)(82746002)(76176011)(2950100002)(6506007)(25786009)(39060400002)(14454004)(6116002)(478600001)(83716003)(102836004)(4326008)(54906003)(8936002)(50226002)(68736007)(3280700002)(6246003)(53936002)(99286004)(33656002)(2906002)(6512007)(2900100001)(229853002)(105586002)(8676002)(316002)(57306001)(97736004)(305945005)(106356001)(3660700001)(7736002);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR15MB1512;H:CY4PR15MB1512.namprd15.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-microsoft-antispam-message-info: Sg2SsjS2bnRdUpTH0d7g9ShvjZdvHJNXtb5oxExAjjvIIe9OMUD1Jo1pS3UJNzN1F41yQlaOKbNMyWlYpQ5Zhg== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-ID: <260E93C96C114846A579A69A1996238F@namprd15.prod.outlook.com> Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-MS-Exchange-CrossTenant-Network-Message-Id: a52b0db8-9461-40e4-c2af-08d55610fa69 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jan 2018 20:55:26.2400 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR15MB1512 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-01-07_07:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: > On Jan 6, 2018, at 10:31 PM, Yafang Shao wrote: > > As of now, there're two sk_family are traced with sock:inet_sock_set_state, > which are AF_INET and AF_INET6. > So the sk_family are exposed as well. > Then we can conveniently use it to do the filter. > > Both sk_family and sk_protocol are showed in the printk message, so we need > not expose them as tracepoint arguments. > > Suggested-by: Brendan Gregg > Suggested-by: Song Liu > Signed-off-by: Yafang Shao > --- > include/trace/events/sock.h | 15 +++++++++++++-- > 1 file changed, 13 insertions(+), 2 deletions(-) > > diff --git a/include/trace/events/sock.h b/include/trace/events/sock.h > index 3537c5f..3176a39 100644 > --- a/include/trace/events/sock.h > +++ b/include/trace/events/sock.h > @@ -11,7 +11,11 @@ > #include > #include > > -/* The protocol traced by sock_set_state */ > +#define family_names \ > + EM(AF_INET) \ > + EMe(AF_INET6) > + > +/* The protocol traced by inet_sock_set_state */ > #define inet_protocol_names \ > EM(IPPROTO_TCP) \ > EM(IPPROTO_DCCP) \ > @@ -37,6 +41,7 @@ > #define EM(a) TRACE_DEFINE_ENUM(a); > #define EMe(a) TRACE_DEFINE_ENUM(a); > > +family_names > inet_protocol_names > tcp_state_names > > @@ -45,6 +50,9 @@ > #define EM(a) { a, #a }, > #define EMe(a) { a, #a } > > +#define show_family_name(val) \ > + __print_symbolic(val, family_names) > + > #define show_inet_protocol_name(val) \ > __print_symbolic(val, inet_protocol_names) > > @@ -118,6 +126,7 @@ > __field(int, newstate) > __field(__u16, sport) > __field(__u16, dport) > + __field(__u16, family) > __field(__u8, protocol) > __array(__u8, saddr, 4) > __array(__u8, daddr, 4) > @@ -134,6 +143,7 @@ > __entry->oldstate = oldstate; > __entry->newstate = newstate; > > + __entry->family = sk->sk_family; > __entry->protocol = sk->sk_protocol; > __entry->sport = ntohs(inet->inet_sport); > __entry->dport = ntohs(inet->inet_dport); > @@ -160,7 +170,8 @@ > } > ), > > - TP_printk("protocol=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s", > + TP_printk("family=%s protocol=%s sport=%hu dport=%hu saddr=%pI4 daddr=%pI4 saddrv6=%pI6c daddrv6=%pI6c oldstate=%s newstate=%s", > + show_family_name(__entry->family), > show_inet_protocol_name(__entry->protocol), > __entry->sport, __entry->dport, > __entry->saddr, __entry->daddr, > -- > 1.8.3.1 > Reviewed-by: Song Liu