From: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: "Geneviève Bastien" <gbastien@versatic.net>,
netdev <netdev@vger.kernel.org>, rostedt <rostedt@goodmis.org>,
"Ingo Molnar" <mingo@redhat.com>
Subject: Re: [PATCH v3] net: Add trace events for all receive exit points
Date: Sat, 17 Nov 2018 13:27:29 -0500 (EST) [thread overview]
Message-ID: <1286988499.7245.1542479249307.JavaMail.zimbra@efficios.com> (raw)
In-Reply-To: <20181116.195036.1120979831963497428.davem@davemloft.net>
----- On Nov 16, 2018, at 10:50 PM, David S. Miller davem@davemloft.net wrote:
> From: Geneviève Bastien <gbastien@versatic.net>
> Date: Tue, 13 Nov 2018 15:13:26 -0500
>
>> @@ -5222,9 +5228,14 @@ static void netif_receive_skb_list_internal(struct
>> list_head *head)
>> */
>> int netif_receive_skb(struct sk_buff *skb)
>> {
>> + int ret;
>> +
>> trace_netif_receive_skb_entry(skb);
>>
>> - return netif_receive_skb_internal(skb);
>> + ret = netif_receive_skb_internal(skb);
>> + trace_netif_receive_skb_exit(skb, ret);
>
> Every time I read this code from now on I'm going to say to myself
> "oh crap, we reference 'skb' after it's potentially freed up"
>
> I really don't like this.
>
> I know only the pointer is used, but that pointer can be reallocated
> to another SLAB object, even another SKB, by the time these exit
> tracepoints execute.
>
> Sorry, I can't really convince myself to apply this now.
Hi David,
Thanks for looking into this patch. You bring a very good point indeed!
Passing a skb pointer that may have been already reallocated to skb_exit
tracepoints is pretty much useless for analysis purposes.
I see two possible solutions:
1) Remove the "skb" argument from the sbk_exit tracepoints completely.
Anyway, I think it's not really needed for analysis purposes because
we can link the "entry" with the associated "exit" using the thread ID
executing those tracepoints. (Geneviève, would that work for your
analyses ?)
2) Move the skb_exit tracepoints before freeing the skb pointer. My
concern here is that the instrumentation may become much uglier than
the currently proposed patch. (I have not looked at the specifics
though, so I may be wrong.)
Do you have a preference between those two approaches, or perhaps you
have an alternative solution in mind ?
Thanks!
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
next prev parent reply other threads:[~2018-11-18 4:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-13 20:13 [PATCH v3] net: Add trace events for all receive exit points Geneviève Bastien
2018-11-17 3:50 ` David Miller
2018-11-17 18:27 ` Mathieu Desnoyers [this message]
2018-11-18 6:19 ` David Miller
2018-11-19 15:27 ` Geneviève Bastien
2018-11-19 17:47 ` Geneviève Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1286988499.7245.1542479249307.JavaMail.zimbra@efficios.com \
--to=mathieu.desnoyers@efficios.com \
--cc=davem@davemloft.net \
--cc=gbastien@versatic.net \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).