From: David Miller <davem@davemloft.net>
To: john.r.fastabend@intel.com
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, therbert@google.com
Subject: Re: [net-2.6 PATCH] nete zero kobject in rx_queue_release
Date: Fri, 12 Nov 2010 13:08:24 -0800 (PST) [thread overview]
Message-ID: <20101112.130824.68146775.davem@davemloft.net> (raw)
In-Reply-To: <20101111201341.4418.16400.stgit@jf-dev1-dcblab>
From: John Fastabend <john.r.fastabend@intel.com>
Date: Thu, 11 Nov 2010 12:13:41 -0800
> netif_set_real_num_rx_queues() can decrement and increment
> the number of rx queues. For example ixgbe does this as
> features and offloads are toggled. Presumably this could
> also happen across down/up on most devices if the available
> resources changed (cpu offlined).
>
> The kobject needs to be zero'd in this case so that the
> state is not preserved across kobject_put()/kobject_init_and_add().
>
> This resolves the following error report.
...
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
I think it's probably better to clear the entire netdev_rx_queue
object rather than just the embedded kobject.
Otherwise we leave dangling rps_map, rps_flow_table, etc. pointers.
In fact, it's more tricky than this, because notice that your
patch will memset() free'd memory in the case where the
first->count drops to zero and we execute the kfree().
So we'll need something like:
if (atomic_dec_and_test(&first->count))
kfree(first);
else
/* clear everything except queue->first */
or, alternatively:
--------------------
map = rcu_dereference_raw(queue->rps_map);
if (map) {
call_rcu(&map->rcu, rps_map_release);
rcu_assign_pointer(queue->rps_map, NULL);
}
flow_table = rcu_dereference_raw(queue->rps_flow_table);
if (flow_table) {
call_rcu(&flow_table->rcu, rps_dev_flow_table_release);
rcu_assign_pointer(queue->rps_flow_table, NULL);
}
if (atomic_dec_and_test(&first->count))
kfree(first);
else
memset(kobj);
--------------------
Something like that.
next prev parent reply other threads:[~2010-11-12 21:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-11 20:13 [net-2.6 PATCH] nete zero kobject in rx_queue_release John Fastabend
2010-11-12 21:08 ` David Miller [this message]
2010-11-14 22:40 ` Tom Herbert
2010-11-14 23:15 ` David Miller
2010-11-16 2:06 ` John Fastabend
2010-11-16 7:13 ` John Fastabend
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=20101112.130824.68146775.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=john.r.fastabend@intel.com \
--cc=netdev@vger.kernel.org \
--cc=therbert@google.com \
/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).