* [RFC PATCH v3 4/5] skb: add tracepoints to freeing skb
From: Koki Sanagi @ 2010-07-20 0:49 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, davem, kaneshige.kenji, izumi.taku, kosaki.motohiro,
nhorman, laijs, scott.a.mcmillan, rostedt, eric.dumazet, fweisbec,
mathieu.desnoyers
In-Reply-To: <4C44F12F.5090908@jp.fujitsu.com>
[RFC PATCH v3 4/5] skb: add tracepoints to freeing skb
This patch adds tracepoint to consume_skb, dev_kfree_skb_irq and
skb_free_datagram_locked. Combinating with tracepoint on dev_hard_start_xmit,
we can check how long it takes to free transmited packets. And using it, we can
calculate how many packets driver had at that time. It is useful when a drop of
transmited packet is a problem.
<idle>-0 [001] 241409.218333: consume_skb: skbaddr=dd6b2fb8
<idle>-0 [001] 241409.490555: dev_kfree_skb_irq: skbaddr=f5e29840
udp-recv-302 [001] 515031.206008: skb_free_datagram_locked: skbaddr=f5b1d900
Signed-off-by: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
---
include/trace/events/skb.h | 42 ++++++++++++++++++++++++++++++++++++++++++
net/core/datagram.c | 1 +
net/core/dev.c | 2 ++
net/core/skbuff.c | 1 +
4 files changed, 46 insertions(+), 0 deletions(-)
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 4b2be6d..84c9041 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h
@@ -35,6 +35,48 @@ TRACE_EVENT(kfree_skb,
__entry->skbaddr, __entry->protocol, __entry->location)
);
+DECLARE_EVENT_CLASS(free_skb,
+
+ TP_PROTO(struct sk_buff *skb),
+
+ TP_ARGS(skb),
+
+ TP_STRUCT__entry(
+ __field( void *, skbaddr )
+ ),
+
+ TP_fast_assign(
+ __entry->skbaddr = skb;
+ ),
+
+ TP_printk("skbaddr=%p", __entry->skbaddr)
+
+);
+
+DEFINE_EVENT(free_skb, consume_skb,
+
+ TP_PROTO(struct sk_buff *skb),
+
+ TP_ARGS(skb)
+
+);
+
+DEFINE_EVENT(free_skb, dev_kfree_skb_irq,
+
+ TP_PROTO(struct sk_buff *skb),
+
+ TP_ARGS(skb)
+
+);
+
+DEFINE_EVENT(free_skb, skb_free_datagram_locked,
+
+ TP_PROTO(struct sk_buff *skb),
+
+ TP_ARGS(skb)
+
+);
+
TRACE_EVENT(skb_copy_datagram_iovec,
TP_PROTO(const struct sk_buff *skb, int len),
diff --git a/net/core/datagram.c b/net/core/datagram.c
index f5b6f43..1ea32a0 100644
--- a/net/core/datagram.c
+++ b/net/core/datagram.c
@@ -231,6 +231,7 @@ void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb)
{
bool slow;
+ trace_skb_free_datagram_locked(skb);
if (likely(atomic_read(&skb->users) == 1))
smp_rmb();
else if (likely(!atomic_dec_and_test(&skb->users)))
diff --git a/net/core/dev.c b/net/core/dev.c
index 4acfec6..d979847 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -131,6 +131,7 @@
#include <linux/random.h>
#include <trace/events/napi.h>
#include <trace/events/net.h>
+#include <trace/events/skb.h>
#include <linux/pci.h>
#include "net-sysfs.h"
@@ -1581,6 +1582,7 @@ void dev_kfree_skb_irq(struct sk_buff *skb)
struct softnet_data *sd;
unsigned long flags;
+ trace_dev_kfree_skb_irq(skb);
local_irq_save(flags);
sd = &__get_cpu_var(softnet_data);
skb->next = sd->completion_queue;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 34432b4..a7b4036 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -466,6 +466,7 @@ void consume_skb(struct sk_buff *skb)
smp_rmb();
else if (likely(!atomic_dec_and_test(&skb->users)))
return;
+ trace_consume_skb(skb);
__kfree_skb(skb);
}
EXPORT_SYMBOL(consume_skb);
^ permalink raw reply related
* [RFC PATCH v3 5/5] perf:add a script shows a process of packet
From: Koki Sanagi @ 2010-07-20 0:50 UTC (permalink / raw)
To: netdev
Cc: linux-kernel, davem, kaneshige.kenji, izumi.taku, kosaki.motohiro,
nhorman, laijs, scott.a.mcmillan, rostedt, eric.dumazet, fweisbec,
mathieu.desnoyers
In-Reply-To: <4C44F12F.5090908@jp.fujitsu.com>
Add a perf script which shows a process of packets and processed time.
It helps us to investigate networking or network device.
If you want to use it, install perf and record perf.data like following.
#perf trace record netdev-times [script]
If you set script, perf gathers records until it ends.
If not, you must Ctrl-C to stop recording.
And if you want a report from record,
#perf trace report netdev-times [options]
If you use some options, you can limit an output.
Option is below.
tx: show only process of tx packets
rx: show only process of rx packets
dev=: show a process specified with this option
debug: work with debug mode. It shows buffer status.
For example, if you want to show a process of received packets associated
with eth3,
#perf trace report netdev-times rx dev=eth3
79074.756672832sec cpu=1
irq_entry(+0.000000msec,irq=77:eth3)
|------------softirq_raise(+0.001277msec)
irq_exit (+0.002278msec) |
softirq_entry(+0.003562msec
|
|---netif_receive_skb(+0.006279msec,len=100)
| |
| skb_copy_datagram_iovec(+0.038778msec, 2285:sshd)
|
napi_poll_exit(+0.017160msec, eth3)
|
softirq_exit(+0.018248msec)
This perf script helps us to analyze a process time of transmit/receive
sequence.
Signed-off-by: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
---
tools/perf/scripts/python/bin/netdev-times-record | 8 +
tools/perf/scripts/python/bin/netdev-times-report | 5 +
tools/perf/scripts/python/netdev-times.py | 478 +++++++++++++++++++++
3 files changed, 491 insertions(+), 0 deletions(-)
diff --git a/tools/perf/scripts/python/bin/netdev-times-record b/tools/perf/scripts/python/bin/netdev-times-record
new file mode 100644
index 0000000..12da07e
--- /dev/null
+++ b/tools/perf/scripts/python/bin/netdev-times-record
@@ -0,0 +1,8 @@
+#!/bin/bash
+perf record -c 1 -f -R -a -e net:net_dev_xmit -e net:net_dev_queue \
+ -e net:net_dev_receive -e skb:consume_skb \
+ -e skb:kfree_skb -e skb:skb_free_datagram_locked \
+ -e skb:dev_kfree_skb_irq -e napi:napi_poll \
+ -e irq:irq_handler_entry -e irq:irq_handler_exit \
+ -e irq:softirq_entry -e irq:softirq_exit \
+ -e irq:softirq_raise -e skb:skb_copy_datagram_iovec $@
diff --git a/tools/perf/scripts/python/bin/netdev-times-report b/tools/perf/scripts/python/bin/netdev-times-report
new file mode 100644
index 0000000..c3d0a63
--- /dev/null
+++ b/tools/perf/scripts/python/bin/netdev-times-report
@@ -0,0 +1,5 @@
+#!/bin/bash
+# description: display a process of packet and processing time
+# args: [tx] [rx] [dev=] [debug]
+
+perf trace -s ~/libexec/perf-core/scripts/python/netdev-times.py $@
diff --git a/tools/perf/scripts/python/less b/tools/perf/scripts/python/less
new file mode 100644
index 0000000..e69de29
diff --git a/tools/perf/scripts/python/netdev-times.py b/tools/perf/scripts/python/netdev-times.py
new file mode 100644
index 0000000..486f16e
--- /dev/null
+++ b/tools/perf/scripts/python/netdev-times.py
@@ -0,0 +1,478 @@
+# Display a process of packets and processed time.
+# It helps us to investigate networking or network device.
+#
+# options
+# tx: show only tx chart
+# rx: show only rx chart
+# dev=: show only thing related to specified device
+# debug: work with debug mode. It shows buffer status.
+
+import os
+import sys
+
+sys.path.append(os.environ['PERF_EXEC_PATH'] + \
+ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace')
+
+from perf_trace_context import *
+from Core import *
+from Util import *
+
+all_event_list = []; # insert all tracepoint event related with this script
+irq_dic = {}; # key is cpu and value is a list which stacks irqs
+ # which raise NET_RX softirq
+net_rx_dic = {}; # key is cpu and value include time of NET_RX softirq-entry
+ # and a list which stacks receive
+receive_hunk_list = []; # a list which include a sequence of receive events
+rx_skb_list = []; # received packet list for matching
+ # skb_copy_datagram_iovec
+
+buffer_budget = 65536; # the budget of rx_skb_list, tx_queue_list and
+ # tx_xmit_list
+of_count_rx_skb_list = 0; # overflow count
+
+tx_queue_list = []; # list of packets which pass through dev_queue_xmit
+of_count_tx_queue_list = 0; # overflow count
+
+tx_xmit_list = []; # list of packets which pass through dev_hard_start_xmit
+of_count_tx_xmit_list = 0; # overflow count
+
+tx_free_list = []; # list of packets which is freed
+
+# options
+show_tx = 0;
+show_rx = 0;
+dev = 0; # store a name of device specified by option "dev="
+debug = 0;
+
+# indices of event_info tuple
+EINFO_IDX_NAME= 0
+EINFO_IDX_CONTEXT=1
+EINFO_IDX_CPU= 2
+EINFO_IDX_TIME= 3
+EINFO_IDX_PID= 4
+EINFO_IDX_COMM= 5
+
+# Calculate a time interval(msec) from src(nsec) to dst(nsec)
+def diff_msec(src, dst):
+ return (dst - src) / 1000000.0
+
+# Display a process of transmitting a packet
+def print_transmit(hunk):
+ if dev != 0 and hunk['dev'].find(dev) < 0:
+ return
+ print "%7s %5d %6d.%09dsec %12.6fmsec %12.6fmsec" % \
+ (hunk['dev'], hunk['len'],
+ nsecs_secs(hunk['queue_t']),
+ nsecs_nsecs(hunk['queue_t']),
+ diff_msec(hunk['queue_t'], hunk['xmit_t']),
+ diff_msec(hunk['xmit_t'], hunk['free_t']))
+
+PF_IRQ_ENTRY= "irq_entry(+%fmsec,irq=%d:%s)"
+PF_IRQ_EXIT= "irq_exit (+%fmsec) |"
+PF_SOFT_RAISE=" |------------softirq_raise(+%fmsec)"
+PF_SOFT_ENTRY=" softirq_entry(+%fmsec)"
+PF_SOFT_EXIT= " softirq_exit (+%fmsec)\n"
+PF_NAPI_POLL= " napi_poll_exit(+%fmsec, %s)"
+PF_JOINT= " |"
+PF_WJOINT= " | |"
+PF_NET_RECV= " |---netif_receive_skb" \
+ "(+%fmsec,len=%d)"
+PF_CPY_DGRAM= " | skb_copy_datagram_iovec" \
+ "(+%fmsec, %d:%s)"
+PF_FREE_DGRAM=" | skb_free_datagram_locked" \
+ "(+%fmsec)"
+PF_KFREE_SKB= " | kfree_skb" \
+ "(+%fmsec)"
+PF_CONS_SKB= " | consume_skb" \
+ "(+%fmsec)"
+
+# Display a process of received packets and interrputs associated with
+# a NET_RX softirq
+def print_receive(hunk):
+ show_hunk = 0
+ irq_list = hunk['irq_list']
+ cpu = irq_list[0]['cpu']
+ base_t = irq_list[0]['irq_ent_t']
+ # check if this hunk should be showed
+ if dev != 0:
+ for i in range(len(irq_list)):
+ if irq_list[i]['name'].find(dev) >= 0:
+ show_hunk = 1
+ break
+ else:
+ show_hunk = 1
+ if show_hunk == 0:
+ return
+
+ print "%d.%09dsec cpu=%d" % \
+ (nsecs_secs(base_t), nsecs_nsecs(base_t), cpu)
+ for i in range(len(irq_list)):
+ print PF_IRQ_ENTRY % \
+ (diff_msec(base_t, irq_list[i]['irq_ent_t']),
+ irq_list[i]['irq'], irq_list[i]['name'])
+
+ if 'sirq_raise_t' in irq_list[i].keys():
+ print PF_SOFT_RAISE % \
+ diff_msec(base_t, irq_list[i]['sirq_raise_t'])
+
+ if 'irq_ext_t' in irq_list[i].keys():
+ print PF_IRQ_EXIT % \
+ diff_msec(base_t, irq_list[i]['irq_ext_t'])
+ if 'sirq_ent_t' not in hunk.keys():
+ print 'maybe softirq_entry is dropped'
+ return
+ print PF_SOFT_ENTRY % \
+ diff_msec(base_t, hunk['sirq_ent_t'])
+ print PF_JOINT
+ event_list = hunk['event_list']
+ for i in range(len(event_list)):
+ event = event_list[i]
+ if event['event_name'] == 'napi_poll':
+ print PF_NAPI_POLL % \
+ (diff_msec(base_t, event['event_t']), event['dev'])
+ else:
+ print PF_NET_RECV % \
+ (diff_msec(base_t, event['event_t']), event['len'])
+ if 'comm' in event.keys():
+ print PF_WJOINT
+ print PF_CPY_DGRAM % \
+ (diff_msec(base_t, event['comm_t']),
+ event['pid'], event['comm'])
+ elif 'handle' in event.keys():
+ print PF_WJOINT
+ if event['handle'] == \
+ "skb_free_datagram_locked":
+ print PF_FREE_DGRAM % \
+ diff_msec(base_t,
+ event['comm_t'])
+ elif event['handle'] == "kfree_skb":
+ print PF_KFREE_SKB % \
+ diff_msec(base_t,
+ event['comm_t'])
+ elif event['handle'] == "consume_skb":
+ print PF_CONS_SKB % \
+ diff_msec(base_t,
+ event['comm_t'])
+ print PF_JOINT
+ print PF_SOFT_EXIT % diff_msec(base_t, hunk['sirq_ext_t'])
+
+def trace_begin():
+ global show_tx
+ global show_rx
+ global dev
+ global debug
+
+ for i in range(len(sys.argv)):
+ if i == 0:
+ continue
+ arg = sys.argv[i]
+ if arg == 'tx':
+ show_tx = 1
+ elif arg =='rx':
+ show_rx = 1
+ elif arg.find('dev=',0, 4) >= 0:
+ dev = arg[4:]
+ elif arg == 'debug':
+ debug = 1
+ if show_tx == 0 and show_rx == 0:
+ show_tx = 1
+ show_rx = 1
+
+def trace_end():
+ # order all events in time
+ all_event_list.sort(lambda a,b :cmp(a[EINFO_IDX_TIME],
+ b[EINFO_IDX_TIME]))
+ # process all events
+ for i in range(len(all_event_list)):
+ event_info = all_event_list[i]
+ name = event_info[EINFO_IDX_NAME]
+ if name == 'irq__softirq_exit':
+ handle_irq_softirq_exit(event_info)
+ elif name == 'irq__softirq_entry':
+ handle_irq_softirq_entry(event_info)
+ elif name == 'irq__softirq_raise':
+ handle_irq_softirq_raise(event_info)
+ elif name == 'irq__irq_handler_entry':
+ handle_irq_handler_entry(event_info)
+ elif name == 'irq__irq_handler_exit':
+ handle_irq_handler_exit(event_info)
+ elif name == 'napi__napi_poll':
+ handle_napi_poll(event_info)
+ elif name == 'net__net_dev_receive':
+ handle_net_dev_receive(event_info)
+ elif name == 'skb__skb_copy_datagram_iovec':
+ handle_skb_copy_datagram_iovec(event_info)
+ elif name == 'net__net_dev_queue':
+ handle_net_dev_queue(event_info)
+ elif name == 'net__net_dev_xmit':
+ handle_net_dev_xmit(event_info)
+ elif name == 'skb__kfree_skb':
+ handle_kfree_skb(event_info)
+ elif name == 'skb__dev_kfree_skb_irq':
+ handle_dev_kfree_skb_irq(event_info)
+ elif name == 'skb__consume_skb':
+ handle_consume_skb(event_info)
+ elif name == 'skb__skb_free_datagram_locked':
+ handle_skb_free_datagram_locked(event_info)
+ # display receive hunks
+ if show_rx:
+ for i in range(len(receive_hunk_list)):
+ print_receive(receive_hunk_list[i])
+ # display transmit hunks
+ if show_tx:
+ print " dev len Qdisc " \
+ " netdevice free"
+ for i in range(len(tx_free_list)):
+ print_transmit(tx_free_list[i])
+ if debug:
+ print "debug buffer status"
+ print "----------------------------"
+ print "xmit Qdisc:remain:%d overflow:%d" % \
+ (len(tx_queue_list), of_count_tx_queue_list)
+ print "xmit netdevice:remain:%d overflow:%d" % \
+ (len(tx_xmit_list), of_count_tx_xmit_list)
+ print "receive:remain:%d overflow:%d" % \
+ (len(rx_skb_list), of_count_rx_skb_list)
+
+# called from perf, when it finds a correspoinding event
+def irq__softirq_entry(name, context, cpu, sec, nsec, pid, comm, vec):
+ if symbol_str("irq__softirq_entry", "vec", vec) != "NET_RX":
+ return
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, vec)
+ all_event_list.append(event_info)
+
+def irq__softirq_exit(name, context, cpu, sec, nsec, pid, comm, vec):
+ if symbol_str("irq__softirq_entry", "vec", vec) != "NET_RX":
+ return
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, vec)
+ all_event_list.append(event_info)
+
+def irq__softirq_raise(name, context, cpu, sec, nsec, pid, comm, vec):
+ if symbol_str("irq__softirq_entry", "vec", vec) != "NET_RX":
+ return
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, vec)
+ all_event_list.append(event_info)
+
+def irq__irq_handler_entry(name, context, cpu, sec, nsec, pid, comm,
+ irq, irq_name):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ irq, irq_name)
+ all_event_list.append(event_info)
+
+def irq__irq_handler_exit(name, context, cpu, sec, nsec, pid, comm, irq, ret):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm, irq, ret)
+ all_event_list.append(event_info)
+
+def napi__napi_poll(name, context, cpu, sec, nsec, pid, comm, napi, dev_name):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ napi, dev_name)
+ all_event_list.append(event_info)
+
+def net__net_dev_receive(name, context, cpu, sec, nsec, pid, comm, skbaddr,
+ skblen, dev_name):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ skbaddr, skblen, dev_name)
+ all_event_list.append(event_info)
+
+def net__net_dev_queue(name, context, cpu, sec, nsec, pid, comm,
+ skbaddr, skblen, dev_name):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ skbaddr, skblen, dev_name)
+ all_event_list.append(event_info)
+
+def net__net_dev_xmit(name, context, cpu, sec, nsec, pid, comm,
+ skbaddr, skblen, rc, dev_name):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ skbaddr, skblen, rc ,dev_name)
+ all_event_list.append(event_info)
+
+def skb__kfree_skb(name, context, cpu, sec, nsec, pid, comm,
+ skbaddr, protocol, location):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ skbaddr, protocol, location)
+ all_event_list.append(event_info)
+
+def skb__skb_free_datagram_locked(name, context, cpu, sec, nsec, pid, comm,
+ skbaddr):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ skbaddr)
+ all_event_list.append(event_info)
+
+def skb__dev_kfree_skb_irq(name, context, cpu, sec, nsec, pid, comm, skbaddr):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ skbaddr)
+ all_event_list.append(event_info)
+
+def skb__consume_skb(name, context, cpu, sec, nsec, pid, comm, skbaddr):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ skbaddr)
+ all_event_list.append(event_info)
+
+def skb__skb_copy_datagram_iovec(name, context, cpu, sec, nsec, pid, comm,
+ skbaddr, skblen):
+ event_info = (name, context, cpu, nsecs(sec, nsec), pid, comm,
+ skbaddr, skblen)
+ all_event_list.append(event_info)
+
+def handle_irq_softirq_exit(event_info):
+ (name, context, cpu, time, pid, comm, vec) = event_info
+ irq_list = []
+ event_list = 0
+ if cpu in irq_dic.keys():
+ irq_list = irq_dic[cpu]
+ del irq_dic[cpu]
+ if cpu in net_rx_dic.keys():
+ sirq_ent_t = net_rx_dic[cpu]['sirq_ent_t']
+ event_list = net_rx_dic[cpu]['event_list']
+ del net_rx_dic[cpu]
+ if irq_list == [] or event_list == 0:
+ return
+ rec_data = {'sirq_ent_t':sirq_ent_t, 'sirq_ext_t':time,
+ 'irq_list':irq_list, 'event_list':event_list}
+ # merge information realted to a NET_RX softirq
+ receive_hunk_list.append(rec_data)
+
+def handle_irq_softirq_entry(event_info):
+ (name, context, cpu, time, pid, comm, vec) = event_info
+ net_rx_dic[cpu] = {'sirq_ent_t':time, 'event_list':[]}
+
+def handle_irq_softirq_raise(event_info):
+ (name, context, cpu, time, pid, comm, vec) = event_info
+ if cpu not in irq_dic.keys() \
+ or len(irq_dic[cpu]) == 0:
+ return
+ irq = irq_dic[cpu].pop()
+ # put a time to prev irq on the same cpu
+ irq.update({'sirq_raise_t':time})
+ irq_dic[cpu].append(irq)
+
+def handle_irq_handler_entry(event_info):
+ (name, context, cpu, time, pid, comm, irq, irq_name) = event_info
+ if cpu not in irq_dic.keys():
+ irq_dic[cpu] = []
+ irq_record = {'irq':irq, 'name':irq_name, 'cpu':cpu, 'irq_ent_t':time}
+ irq_dic[cpu].append(irq_record)
+
+def handle_irq_handler_exit(event_info):
+ (name, context, cpu, time, pid, comm, irq, ret) = event_info
+ if cpu not in irq_dic.keys():
+ return
+ irq_record = irq_dic[cpu].pop()
+ if irq != irq_record['irq']:
+ return
+ irq_record.update({'irq_ext_t':time})
+ # if an irq doesn't include NET_RX softirq, drop.
+ if 'sirq_raise_t' in irq_record.keys():
+ irq_dic[cpu].append(irq_record)
+
+def handle_napi_poll(event_info):
+ (name, context, cpu, time, pid, comm, napi, dev_name) = event_info
+ if cpu in net_rx_dic.keys():
+ event_list = net_rx_dic[cpu]['event_list']
+ rec_data = {'event_name':'napi_poll',
+ 'dev':dev_name, 'event_t':time}
+ event_list.append(rec_data)
+
+def handle_net_dev_receive(event_info):
+ global of_count_rx_skb_list
+
+ (name, context, cpu, time, pid, comm,
+ skbaddr, skblen, dev_name) = event_info
+ if cpu in net_rx_dic.keys():
+ rec_data = {'event_name':'netif_receive_skb',
+ 'event_t':time, 'skbaddr':skbaddr, 'len':skblen}
+ event_list = net_rx_dic[cpu]['event_list']
+ event_list.append(rec_data)
+ rx_skb_list.insert(0, rec_data)
+ if len(rx_skb_list) > buffer_budget:
+ rx_skb_list.pop()
+ of_count_rx_skb_list += 1
+
+def handle_net_dev_queue(event_info):
+ global of_count_tx_queue_list
+
+ (name, context, cpu, time, pid, comm,
+ skbaddr, skblen, dev_name) = event_info
+ skb = {'dev':dev_name, 'skbaddr':skbaddr, 'len':skblen, 'queue_t':time}
+ tx_xmit_list.insert(0, skb)
+ if len(tx_xmit_list) > buffer_budget:
+ tx_xmit_list.pop()
+ of_count_tx_xmit_list += 1
+
+def handle_net_dev_xmit(event_info):
+ global of_count_tx_queue_list
+
+ (name, context, cpu, time, pid, comm,
+ skbaddr, skblen, rc, dev_name) = event_info
+ if rc == 0: # NETDEV_TX_OK
+ for i in range(len(tx_xmit_list)):
+ skb = tx_xmit_list[i]
+ if skb['skbaddr'] == skbaddr:
+ skb['xmit_t'] = time
+ tx_queue_list.insert(0, skb)
+ del tx_xmit_list[i]
+ if len(tx_queue_list) > buffer_budget:
+ tx_queue_list.pop()
+ of_count_tx_queue_list += 1
+ return
+
+def handle_kfree_skb(event_info):
+ (name, context, cpu, time, pid, comm,
+ skbaddr, protocol, location) = event_info
+ for i in range(len(tx_queue_list)):
+ skb = tx_queue_list[i]
+ if skb['skbaddr'] == skbaddr:
+ del tx_queue_list[i]
+ return
+ for i in range(len(tx_xmit_list)):
+ skb = tx_xmit_list[i]
+ if skb['skbaddr'] == skbaddr:
+ del tx_xmit_list[i]
+ return
+ for i in range(len(rx_skb_list)):
+ rec_data = rx_skb_list[i]
+ if rec_data['skbaddr'] == skbaddr:
+ rec_data.update({'handle':"kfree_skb",
+ 'comm':comm, 'pid':pid, 'comm_t':time})
+ del rx_skb_list[i]
+ return
+
+def handle_dev_kfree_skb_irq(event_info):
+ (name, context, cpu, time, pid, comm, skbaddr) = event_info
+ for i in range(len(tx_queue_list)):
+ skb = tx_queue_list[i]
+ if skb['skbaddr'] == skbaddr:
+ skb['free_t'] = time
+ tx_free_list.append(skb)
+ del tx_queue_list[i]
+ return
+
+def handle_consume_skb(event_info):
+ (name, context, cpu, time, pid, comm, skbaddr) = event_info
+ for i in range(len(tx_queue_list)):
+ skb = tx_queue_list[i]
+ if skb['skbaddr'] == skbaddr:
+ skb['free_t'] = time
+ tx_free_list.append(skb)
+ del tx_queue_list[i]
+ return
+
+def handle_skb_free_datagram_locked(event_info):
+ (name, context, cpu, time, pid, comm, skbaddr) = event_info
+ for i in range(len(rx_skb_list)):
+ rec_data = rx_skb_list[i]
+ if skbaddr == rec_data['skbaddr']:
+ rec_data.update({'handle':"skb_free_datagram_locked",
+ 'comm':comm, 'pid':pid, 'comm_t':time})
+ del rx_skb_list[i]
+ return
+
+def handle_skb_copy_datagram_iovec(event_info):
+ (name, context, cpu, time, pid, comm, skbaddr, skblen) = event_info
+ for i in range(len(rx_skb_list)):
+ rec_data = rx_skb_list[i]
+ if skbaddr == rec_data['skbaddr']:
+ rec_data.update({'handle':"skb_copy_datagram_iovec",
+ 'comm':comm, 'pid':pid, 'comm_t':time})
+ del rx_skb_list[i]
+ return
^ permalink raw reply related
* [PATCH net-next 0/3] cxgb4vf: fixes for several small issues discovered by QA
From: Casey Leedom @ 2010-07-20 1:12 UTC (permalink / raw)
To: netdev
A couple of small (but important) fixes discovered by our QA people. I've also
included a patch to add myself as the maintainer of cxgb4vf in the MAINTAINERS
file which I think is the protocol but please correct me if changes to that file
are usually performed by someone else.
Casey
^ permalink raw reply
* Re: Question about way that NICs deliver packets to the kernel
From: Junchang Wang @ 2010-07-20 1:15 UTC (permalink / raw)
To: Rick Jones; +Cc: Ben Hutchings, romieu, netdev
In-Reply-To: <4C409DD6.7060903@hp.com>
On Fri, Jul 16, 2010 at 10:58:46AM -0700, Rick Jones wrote:
>>Hi Ben,
>>I added options -c -C to netperf's command line. Result is as follows:
>> scheme 1 scheme 2 Imp.
>>Throughput: 683M 718M 5%
>>CPU usage: 47.8% 45.6%
>>
>>That really surprised me because "top" command showed the CPU usage
>>was fluctuating between 0.5% and 1.5% rather that between 45% and 50%.
>
Hi rick,
very sorry for my late reply. Just recovered from the final exam.:)
>Can you tell us a bit more about the system, and which version of
>netperf you are using?
The target machine is a Pentium Dual-core E2200 desktop with a r8169
gigabit NIC. (I couldn't find a better server with old pci slot.)
Another machine is a Nehalem based system with Intel 82576 NIC.
The target machine executes netserver and Nehalem machine executes netperf.
The version of netperf is 2.4.5
>Any chance that the CPU utilization you were
>looking at in top was just that being charged to netperf the process?
What I see on target machine is as follows:
top - 21:37:12 up 21 min, 6 users, load average: 0.43, 0.28, 0.19
Tasks: 152 total, 2 running, 149 sleeping, 0 stopped, 1 zombie
Cpu(s): 2.3%us, 1.5%sy, 0.1%ni, 89.5%id, 2.7%wa, 0.0%hi, 3.9%si, 0.0%
Mem: 2074064k total, 690200k used, 1383864k free, 39372k buffers
Swap: 2096476k total, 0k used, 2096476k free, 435044k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3916 root 20 0 2228 584 296 R 84.6 0.0 0:07.12 netserver
It shows the CPU usage of taget machine is around 10%.
while Nehalem machine's report is as follows:
TCP STREAM TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET to 192.168.2.1 (192.168.2.1) port 0 AF_INET
Recv Send Send Utilization Service Demand
Socket Socket Message Elapsed Send Recv Send Recv
Size Size Size Time Throughput local remote local remote
bytes bytes bytes secs. 10^6bits/s % S % S us/KB us/KB
87380 16384 16384 10.05 679.79 1.63 48.27 1.571 11.634
It shows the CPU usage of target machine is 48.27%.
>"Network processing" does not often get charged to the responsible
>process, so netperf reports system-wide CPU utilization on the
>assumption it is the only thing causing the CPUs to be utilized.
My understand of your commends is:
1)except running in ksoftirqd, network processing cannot be correctly counted
because it runs in interrupt contexts that do not get charged to a correct
process. So "top" misses lots of CPU usage in high interrupt rate network
situation.
2)As you have mentioned in netperf's manual, netperf uses /proc/stat on Linux
to retrieve time spent in idle mode. In other words, it accumulates cpu time
spent in all other modes, including hardware interrupt, software interrupt,
etc., making the CPU usage more accurate in high interrupt situation.
3)Since most processes in target machine are in sleeping mode, the CPU usage
of network processing is in actually very close to 48.27%. Right?
Correct me if any of them are incorrect. Thanks.
--Junchang
^ permalink raw reply
* Re: [PATCH] LSM: Add post accept() hook.
From: Tetsuo Handa @ 2010-07-20 1:36 UTC (permalink / raw)
To: paul.moore
Cc: davem, eric.dumazet, jmorris, sam, serge, netdev,
linux-security-module
In-Reply-To: <201007191815.52124.paul.moore@hp.com>
Paul Moore wrote:
> I think you need to show how you plan to use this hook in an LSM before we can
> consider merging it with mainline. What you are proposing here is giving an
> LSM the ability to drop a connection _after_ allowing it to be established in
> the first place; this seems very wrong to me and I want to make sure everyone
> else is aware of that before accepting this code into the kernel. I
> understand that TOMOYO's security model does not allow it to reject incoming
> connections at the beginning of the connection request like some of the LSMs
> currently in use, but I'm just not very happy with the idea of finishing a
> connection handshake only to later drop the connection on the floor.
Yes. I'm planning to use security_socket_post_accept() for two purposes.
One is for dropping connections from unwanted hosts. Administrators define
policy before enabling enforcing mode (the mode which connections are dropped
if operation was not granted by policy). Administrators specify acceptable
hosts (i.e. hosts which this host needs to communicate with) and unacceptable
hosts (i.e. hosts which this host needn't to communicate with).
Dropping connections would happen if some process was hijacked and the process
attempted to communicate with other processes using TCP connections. But
dropping connections should not happen in normal circumstance.
The other is for updating process's state variable upon accept() operation.
LKM version of TOMOYO has per a task_struct variable that is used for
implementing stateful permissions. (As of now, not implemented for LSM version
of TOMOYO.) For example,
allow_network TCP accept 10.0.0.0-10.255.255.255 1024-65535 ; set task.state[0]=1
allow_network TCP accept 192.168.0.1-192.168.255.255 1024-65535 ; set task.state[0]=2
will change current thread's task state variable to 1 if current thread
accepted TCP connection from 10.0.0.0-10.255.255.255 and change it to 2 if from
192.168.0.1-192.168.255.255 . This variable is used for giving different
permissions for subsequent operations. For example,
allow_execute /bin/bash if task.state[0]=1
allow_execute /bin/tcsh if task.state[0]=2
will allow execution of /bin/bash if current thread is dealing connections from
10.0.0.0-10.255.255.255 and allow execution of /bin/tcsh if current thread is
dealing connections from 192.168.0.1-192.168.255.255 . Another example,
allow_network TCP accept 0.0.0.0-255.255.255.255 1024-65535 ; set task.state[0]=3
allow_network TCP accept 0.0.0.0-255.255.255.255 1-1023 ; set task.state[0]=4
will change it to 3 if from unprivileged port and change it to 4 if from
privileged port.
allow_execute /bin/rbash if task.state[0]=3
allow_execute /bin/bash if task.state[0]=4
will allow execution of /bin/rbash if dealing connections from unprivileged
ports and allow execution of /bin/bash if dealing connections from privileged
ports.
LSM hooks called before sock->ops->accept() cannot change current thread's task
state variable because it is racy, and LSM hook called after sock->ops->accept()
is missing.
Strictly speaking, it could be possible to update current thread's task state
variable in LSM hooks called by subsequent operations (e.g.
security_dentry_open(), security_bprm_set_creds()) by doing similar approach
done by tomoyo_dead_sock(), but updating it can fail (e.g. -ENOMEM) since
credentials are COW. If updating it failed, I want to drop the accept()ed
connection, but that is impossible from LSM hooks called by subsequent
operations. Killing current thread when updating it failed is possible, but
that looks worse for me than dropping connections upon accept() time (because
such action resembles OOM killer and likely gives larger damage to the caller).
^ permalink raw reply
* linux-next: manual merge of the net tree with the net-current tree
From: Stephen Rothwell @ 2010-07-20 2:20 UTC (permalink / raw)
To: David Miller, netdev
Cc: linux-next, linux-kernel, Jeff Dike, Michael S. Tsirkin
Hi all,
Today's linux-next merge of the net tree got a conflict in
drivers/vhost/net.c between commit
1680e9063ea28099a1efa8ca11cee069cc7a9bc3 ("vhost-net: avoid flush under
lock") from the net-current tree and commit
dd1f4078f0d2de74a308f00a2dffbd550cfba59f ("vhost-net: minor cleanup")
from the net tree.
I fixed it up (see below) and can carry the fix as necessary.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc drivers/vhost/net.c
index d219070,107af9e..0000000
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@@ -527,15 -527,12 +527,14 @@@ static long vhost_net_set_backend(struc
/* start polling new socket */
oldsock = vq->private_data;
- if (sock == oldsock)
- goto done;
+ if (sock != oldsock){
+ vhost_net_disable_vq(n, vq);
+ rcu_assign_pointer(vq->private_data, sock);
+ vhost_net_enable_vq(n, vq);
+ }
- vhost_net_disable_vq(n, vq);
- rcu_assign_pointer(vq->private_data, sock);
- vhost_net_enable_vq(n, vq);
- done:
+ mutex_unlock(&vq->mutex);
+
if (oldsock) {
vhost_net_flush_vq(n, index);
fput(oldsock->file);
^ permalink raw reply
* Re: linux-next: manual merge of the net tree with the net-current tree
From: Joe Perches @ 2010-07-20 2:34 UTC (permalink / raw)
To: Stephen Rothwell
Cc: David Miller, netdev, linux-next, linux-kernel, Jeff Dike,
Michael S. Tsirkin
In-Reply-To: <20100720122032.88e0fcd9.sfr@canb.auug.org.au>
On Tue, 2010-07-20 at 12:20 +1000, Stephen Rothwell wrote:
> I fixed it up (see below) and can carry the fix as necessary.
@@@ -527,15 -527,12 +527,14 @@@ static long vhost_net_set_backend(struc
/* start polling new socket */
oldsock = vq->private_data;
- if (sock == oldsock)
- goto done;
+ if (sock != oldsock){
Trivial: missing space before open brace in commit
dd1f4078f0d2de74a308f00a2dffbd550cfba59f
^ permalink raw reply
* Re: [net-next-2.6 PATCH] e1000: allow option to limit number of descriptors down to 48 per ring
From: David Miller @ 2010-07-20 3:24 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips, alexander.h.duyck
In-Reply-To: <20100719234219.13875.90302.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon, 19 Jul 2010 16:43:47 -0700
> From: Alexander Duyck <alexander.h.duyck@intel.com>
>
> This change makes it possible to limit the number of descriptors down to 48
> per ring. The reason for this change is to address a variation on hardware
> errata 10 for 82546GB in which descriptors will be lost if more than 32
> descriptors are fetched and the PCI-X MRBC is 512.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Tested-by: Emil Tantilov <emil.s.tantilov@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply
* Re: [net-next-2.6 PATCH 1/5] ixgbe: dcb, set DPF bit when PFC is enabled
From: David Miller @ 2010-07-20 3:24 UTC (permalink / raw)
To: jeffrey.t.kirsher
Cc: netdev, gospo, bphilips, john.r.fastabend, donald.c.skidmore
In-Reply-To: <20100719235831.14112.14175.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon, 19 Jul 2010 16:59:03 -0700
> From: John Fastabend <john.r.fastabend@intel.com>
>
> Set the DPF bit when PFC is enabled. This will discard
> PFC frames so they do not get passed up the stack.
>
> The DPF bit is set for flow control, but not priority
> flow control this brings pfc inline with fc.
>
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
> Tested-by: Ross Brattain <ross.b.brattain@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply
* Re: [net-next-2.6 PATCH 2/5] ixgbe: drop support for UDP in RSS hash generation
From: David Miller @ 2010-07-20 3:24 UTC (permalink / raw)
To: jeffrey.t.kirsher
Cc: netdev, gospo, bphilips, alexander.h.duyck, donald.c.skidmore
In-Reply-To: <20100719235925.14112.65890.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon, 19 Jul 2010 16:59:27 -0700
> From: Alexander Duyck <alexander.h.duyck@intel.com>
>
> This change removes UDP from the supported protocols for RSS hashing. The
> reason for removing this protocol is because IP fragmentation was causing a
> network flow to be broken into two streams, one for fragmented, and one for
> non-fragmented and this in turn was causing out-of-order issues.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Acked-by: Don Skidmore <donald.c.skidmore@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply
* Re: [net-next-2.6 PATCH 3/5] ixgbe: properly toggling netdev feature flags when disabling FCoE
From: David Miller @ 2010-07-20 3:24 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips, yi.zou
In-Reply-To: <20100719235949.14112.48380.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon, 19 Jul 2010 16:59:52 -0700
> From: Yi Zou <yi.zou@intel.com>
>
> When FCoE is disabled, there is a race condition that FCoE offload is
> turned off but the FCoE protocol driver is still queuing I/O thinking
> offload support still exists. This patch toggles off corresponding FCoE
> netdev feature flags and notify the FCoE stack first, allowing FCoE
> protocol stack driver to update its flags upon NETDEV_FEAT_CHANGE so no
> I/O will be using offload.
>
> Also, indicate FCoE offload flags in vlan_features in ixgbe_probe once
> and do not toggle them in ixgbe_fcoe_enable/disable so when FCoE is
> created on the VLAN interface, vlan_transfer_features() would properly
> update the VLAN netdev features flag and notify the FCoE protocol driver
> for NETDEV_FEAT_CHANGE.
>
> Signed-off-by: Yi Zou <yi.zou@intel.com>
> Tested-by: Ross Brattain <ross.b.brattain@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply
* Re: [net-next-2.6 PATCH 4/5] ixgbe: use GFP_ATOMIC when allocating FCoE DDP context from the dma pool
From: David Miller @ 2010-07-20 3:24 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips, yi.zou
In-Reply-To: <20100720000021.14112.63604.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon, 19 Jul 2010 17:00:24 -0700
> From: Yi Zou <yi.zou@intel.com>
>
> The FCoE protocol stack may hold a lock when this gets called.
>
> Signed-off-by: Yi Zou <yi.zou@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply
* Re: [net-next-2.6 PATCH 5/5] ixgbe: fix version string for ixgbe
From: David Miller @ 2010-07-20 3:24 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, bphilips, donald.c.skidmore
In-Reply-To: <20100720000044.14112.65405.stgit@localhost.localdomain>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon, 19 Jul 2010 17:00:47 -0700
> From: Don Skidmore <donald.c.skidmore@intel.com>
>
> Bump the version string to better reflect what is in the driver.
>
> Signed-off-by: Don Skidmore <donald.c.skidmore@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 1/4] bnx2: Use proper counter for net_device_stats->multicast.
From: David Miller @ 2010-07-20 3:31 UTC (permalink / raw)
To: mchan; +Cc: netdev
In-Reply-To: <1279584905-15084-1-git-send-email-mchan@broadcom.com>
From: "Michael Chan" <mchan@broadcom.com>
Date: Mon, 19 Jul 2010 17:15:02 -0700
> We were using the wrong tx multicast counter instead of the rx multicast
> counter.
>
> Reported-by: Peter Snellman <peter.snellman@cinnober.com>
> Reviewed-by: Benjamin Li <benli@broadcom.com>
> Reviewed-by: Matt Carlson <mcarlson@broadcom.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 2/4] bnx2: Call pci_enable_msix() with actual number of vectors.
From: David Miller @ 2010-07-20 3:31 UTC (permalink / raw)
To: mchan; +Cc: netdev, leitao
In-Reply-To: <1279584905-15084-2-git-send-email-mchan@broadcom.com>
From: "Michael Chan" <mchan@broadcom.com>
Date: Mon, 19 Jul 2010 17:15:03 -0700
> Based on original patch by Breno Leitão <leitao@linux.vnet.ibm.com>.
>
> Allocate the actual number of vectors and make use of fewer vectors
> if pci_enable_msix() returns > 0. We must allocate one additional
> vector for the cnic driver.
>
> Cc: Breno Leitão <leitao@linux.vnet.ibm.com>
> Reviewed-by: Benjamin Li <benli@broadcom.com>
> Reviewed-by: Matt Carlson <mcarlson@broadcom.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 3/4] bnx2: Remove some unnecessary smp_mb() in tx fast path.
From: David Miller @ 2010-07-20 3:31 UTC (permalink / raw)
To: mchan; +Cc: netdev
In-Reply-To: <1279584905-15084-3-git-send-email-mchan@broadcom.com>
From: "Michael Chan" <mchan@broadcom.com>
Date: Mon, 19 Jul 2010 17:15:04 -0700
> smp_mb() inside bnx2_tx_avail() is used twice in the normal
> bnx2_start_xmit() path (see illustration below). The full memory
> barrier is only necessary during race conditions with tx completion.
> We can speed up the tx path by replacing smp_mb() in bnx2_tx_avail()
> with a compiler barrier. The compiler barrier is to force the
> compiler to fetch the tx_prod and tx_cons from memory.
>
> In the race condition between bnx2_start_xmit() and bnx2_tx_int(),
> we have the following situation:
>
> bnx2_start_xmit() bnx2_tx_int()
> if (!bnx2_tx_avail())
> BUG();
>
> ...
>
> if (!bnx2_tx_avail())
> netif_tx_stop_queue(); update_tx_index();
> smp_mb(); smp_mb();
> if (bnx2_tx_avail()) if (netif_tx_queue_stopped() &&
> netif_tx_wake_queue(); bnx2_tx_avail())
>
> With smp_mb() removed from bnx2_tx_avail(), we need to add smp_mb() to
> bnx2_start_xmit() as shown above to properly order netif_tx_stop_queue()
> and bnx2_tx_avail() to check the ring index. If it is not strictly
> ordered, the tx queue can be stopped forever.
>
> This improves performance by about 5% with 2 ports running bi-directional
> 64-byte packets.
>
> Reviewed-by: Benjamin Li <benli@broadcom.com>
> Reviewed-by: Matt Carlson <mcarlson@broadcom.com>
> Signed-off-by: Michael Chan <mchan@broadcom.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 4/4] bnx2: Update version to 2.0.17.
From: David Miller @ 2010-07-20 3:31 UTC (permalink / raw)
To: mchan; +Cc: netdev
In-Reply-To: <1279584905-15084-4-git-send-email-mchan@broadcom.com>
From: "Michael Chan" <mchan@broadcom.com>
Date: Mon, 19 Jul 2010 17:15:05 -0700
> Signed-off-by: Michael Chan <mchan@broadcom.com>
Applied.
^ permalink raw reply
* Re: [PATCH net-next 0/3] cxgb4vf: fixes for several small issues discovered by QA
From: David Miller @ 2010-07-20 3:40 UTC (permalink / raw)
To: leedom; +Cc: netdev
In-Reply-To: <201007191812.10459.leedom@chelsio.com>
From: Casey Leedom <leedom@chelsio.com>
Date: Mon, 19 Jul 2010 18:12:10 -0700
> A couple of small (but important) fixes discovered by our QA people. I've also
> included a patch to add myself as the maintainer of cxgb4vf in the MAINTAINERS
> file which I think is the protocol but please correct me if changes to that file
> are usually performed by someone else.
Well, where are they?
^ permalink raw reply
* Re: [PATCH] net: Add batman-adv meshing protocol
From: David Miller @ 2010-07-20 4:26 UTC (permalink / raw)
To: sven.eckelmann-Mmb7MZpHnFY
Cc: netdev-u79uwXL29TY76Z2rM5mHXA,
b.a.t.m.a.n-ZwoEplunGu2X36UT3dwlltHuzzzSOjJt
In-Reply-To: <1279291156-5297-2-git-send-email-sven.eckelmann-Mmb7MZpHnFY@public.gmane.org>
From: Sven Eckelmann <sven.eckelmann-Mmb7MZpHnFY@public.gmane.org>
Date: Fri, 16 Jul 2010 16:39:16 +0200
> +/* count the hamming weight, how many good packets did we receive? just count
> + * the 1's. The inner loop uses the Kernighan algorithm, see
> + * http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetKernighan
> + */
> +int bit_packet_count(TYPE_OF_WORD *seq_bits)
> +{
> + int i, hamming = 0;
> + TYPE_OF_WORD word;
> +
> + for (i = 0; i < NUM_WORDS; i++) {
> + word = seq_bits[i];
> +
> + while (word) {
> + word &= word-1;
> + hamming++;
> + }
> + }
> + return hamming;
> +}
The kernel has a hamming weight library function which takes advantage
of population count instructions on cpus that suport it, and also has
a sw version than is faster than what you're doing here, please use
it.
The interfaces are called "hweight{8,16,32,64}()" where the number in
the name indicates the bit-size of the word the interface operates on.
I also notice that this code uses it's own internal buffering scheme
with kmalloc()'d buffers, then seperately allocates actual SKB's and
copies the data there.
Just use the SKB facilities how they were designed to be used, instead
of needlessly inventing new things. Allocate your initial SKB and put
the initial forwarding header in it, then when you want to send a copy
off, skb_clone() it, and push the other bits you want at the head
and/or the tail of the cloned SKB, then simply send it off.
^ permalink raw reply
* Re: [net-next-2.6 PATCH] e1000: allow option to limit number of descriptors down to 48 per ring
From: Eric Dumazet @ 2010-07-20 4:40 UTC (permalink / raw)
To: Jeff Kirsher; +Cc: davem, netdev, gospo, bphilips, Alexander Duyck
In-Reply-To: <20100719234219.13875.90302.stgit@localhost.localdomain>
Le lundi 19 juillet 2010 à 16:43 -0700, Jeff Kirsher a écrit :
> From: Alexander Duyck <alexander.h.duyck@intel.com>
>
> This change makes it possible to limit the number of descriptors down to 48
> per ring. The reason for this change is to address a variation on hardware
> errata 10 for 82546GB in which descriptors will be lost if more than 32
> descriptors are fetched and the PCI-X MRBC is 512.
>
> Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
> Tested-by: Emil Tantilov <emil.s.tantilov@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>
> drivers/net/e1000/e1000.h | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
> index 40b62b4..65298a6 100644
> --- a/drivers/net/e1000/e1000.h
> +++ b/drivers/net/e1000/e1000.h
> @@ -86,12 +86,12 @@ struct e1000_adapter;
> /* TX/RX descriptor defines */
> #define E1000_DEFAULT_TXD 256
> #define E1000_MAX_TXD 256
> -#define E1000_MIN_TXD 80
> +#define E1000_MIN_TXD 48
> #define E1000_MAX_82544_TXD 4096
>
> #define E1000_DEFAULT_RXD 256
> #define E1000_MAX_RXD 256
> -#define E1000_MIN_RXD 80
> +#define E1000_MIN_RXD 48
> #define E1000_MAX_82544_RXD 4096
>
> #define E1000_MIN_ITR_USECS 10 /* 100000 irq/sec */
>
So this limit is a pure software one ?
Why not let an admin chose a lower limit if he wants to ?
I am asking because big ring sizes can be a latency source in some
workloads.
Thanks
^ permalink raw reply
* Re: [RFC PATCH v3 4/5] skb: add tracepoints to freeing skb
From: Eric Dumazet @ 2010-07-20 4:54 UTC (permalink / raw)
To: Koki Sanagi
Cc: netdev, linux-kernel, davem, kaneshige.kenji, izumi.taku,
kosaki.motohiro, nhorman, laijs, scott.a.mcmillan, rostedt,
fweisbec, mathieu.desnoyers
In-Reply-To: <4C44F286.1050907@jp.fujitsu.com>
Le mardi 20 juillet 2010 à 09:49 +0900, Koki Sanagi a écrit :
> [RFC PATCH v3 4/5] skb: add tracepoints to freeing skb
> This patch adds tracepoint to consume_skb, dev_kfree_skb_irq and
> skb_free_datagram_locked. Combinating with tracepoint on dev_hard_start_xmit,
> we can check how long it takes to free transmited packets. And using it, we can
> calculate how many packets driver had at that time. It is useful when a drop of
> transmited packet is a problem.
>
> <idle>-0 [001] 241409.218333: consume_skb: skbaddr=dd6b2fb8
> <idle>-0 [001] 241409.490555: dev_kfree_skb_irq: skbaddr=f5e29840
>
> udp-recv-302 [001] 515031.206008: skb_free_datagram_locked: skbaddr=f5b1d900
>
>
> Signed-off-by: Koki Sanagi <sanagi.koki@jp.fujitsu.com>
> ---
> include/trace/events/skb.h | 42 ++++++++++++++++++++++++++++++++++++++++++
> net/core/datagram.c | 1 +
> net/core/dev.c | 2 ++
> net/core/skbuff.c | 1 +
> 4 files changed, 46 insertions(+), 0 deletions(-)
>
> diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
> index 4b2be6d..84c9041 100644
> --- a/include/trace/events/skb.h
> +++ b/include/trace/events/skb.h
> @@ -35,6 +35,48 @@ TRACE_EVENT(kfree_skb,
> __entry->skbaddr, __entry->protocol, __entry->location)
> );
>
> +DECLARE_EVENT_CLASS(free_skb,
> +
> + TP_PROTO(struct sk_buff *skb),
> +
> + TP_ARGS(skb),
> +
> + TP_STRUCT__entry(
> + __field( void *, skbaddr )
> + ),
> +
> + TP_fast_assign(
> + __entry->skbaddr = skb;
> + ),
> +
> + TP_printk("skbaddr=%p", __entry->skbaddr)
> +
> +);
> +
> +DEFINE_EVENT(free_skb, consume_skb,
> +
> + TP_PROTO(struct sk_buff *skb),
> +
> + TP_ARGS(skb)
> +
> +);
> +
> +DEFINE_EVENT(free_skb, dev_kfree_skb_irq,
> +
> + TP_PROTO(struct sk_buff *skb),
> +
> + TP_ARGS(skb)
> +
> +);
> +
> +DEFINE_EVENT(free_skb, skb_free_datagram_locked,
> +
> + TP_PROTO(struct sk_buff *skb),
> +
> + TP_ARGS(skb)
> +
> +);
> +
> TRACE_EVENT(skb_copy_datagram_iovec,
>
> TP_PROTO(const struct sk_buff *skb, int len),
> diff --git a/net/core/datagram.c b/net/core/datagram.c
> index f5b6f43..1ea32a0 100644
> --- a/net/core/datagram.c
> +++ b/net/core/datagram.c
> @@ -231,6 +231,7 @@ void skb_free_datagram_locked(struct sock *sk, struct sk_buff *skb)
> {
> bool slow;
>
> + trace_skb_free_datagram_locked(skb);
Here you unconditionally trace before the test on skb->users
> if (likely(atomic_read(&skb->users) == 1))
> smp_rmb();
> else if (likely(!atomic_dec_and_test(&skb->users)))
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 4acfec6..d979847 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -131,6 +131,7 @@
> #include <linux/random.h>
> #include <trace/events/napi.h>
> #include <trace/events/net.h>
> +#include <trace/events/skb.h>
> #include <linux/pci.h>
>
> #include "net-sysfs.h"
> @@ -1581,6 +1582,7 @@ void dev_kfree_skb_irq(struct sk_buff *skb)
> struct softnet_data *sd;
> unsigned long flags;
>
> + trace_dev_kfree_skb_irq(skb);
> local_irq_save(flags);
> sd = &__get_cpu_var(softnet_data);
> skb->next = sd->completion_queue;
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 34432b4..a7b4036 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -466,6 +466,7 @@ void consume_skb(struct sk_buff *skb)
> smp_rmb();
> else if (likely(!atomic_dec_and_test(&skb->users)))
> return;
While here you trace _after_ the test on skb->users - and a "return;" ,
so you miss some consume_skb() calls
> + trace_consume_skb(skb);
> __kfree_skb(skb);
> }
> EXPORT_SYMBOL(consume_skb);
>
^ permalink raw reply
* Re: [RFC PATCH] ipv6: Make IP6CB(skb)->nhoff 16-bit.
From: David Miller @ 2010-07-20 5:01 UTC (permalink / raw)
To: netdev
In-Reply-To: <20100715.223011.58409183.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Thu, 15 Jul 2010 22:30:11 -0700 (PDT)
>
> Even with jumbograms I cannot see any way in which we would need
> to records a larger than 65535 valued next-header offset.
>
> The maximum extension header length is (256 << 3) == 2048.
> There are only a handful of extension headers specified which
> we'd even accept (say 5 or 6), therefore the largest next-header
> offset we'd ever have to contend with is something less than
> say 16k.
>
> Therefore make it a u16 instead of a u32.
>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> ---
> Can anyone find any holes in this? I want to do this so we
> can legitimately rip ndisc_nodetype out of struct sk_buff
> and stick it into the IP6CB where it belongs. Currently
> there isn't enough space, but with this change there will
> be.
No holes claimed by anyone, so... applied :-)
^ permalink raw reply
* [PATCH net-next] drivers/acpi/acpica/utmisc.c: Use printk extension %pV
From: Joe Perches @ 2010-07-20 5:06 UTC (permalink / raw)
To: Len Brown; +Cc: linux-acpi, linux-kernel, netdev, David Miller
Consolidates the printk messages to a single
call so the messages can not be interleaved.
Reduces text a bit.
$ size drivers/acpi/acpica/utmisc.o.*
text data bss dec hex filename
7822 56 1832 9710 25ee drivers/acpi/acpica/utmisc.o.old
7748 56 1736 9540 2544 drivers/acpi/acpica/utmisc.o.new
Depends on net-next commit 7db6f5fb65a82af03229eef104dc9899c5eecf33
(vsprintf: Recursive vsnprintf: Add "%pV", struct va_format)
Compile tested only
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/acpi/acpica/utmisc.c | 78 ++++++++++++++++++++++++++++--------------
1 files changed, 52 insertions(+), 26 deletions(-)
diff --git a/drivers/acpi/acpica/utmisc.c b/drivers/acpi/acpica/utmisc.c
index e8d0724..d9a4a64 100644
--- a/drivers/acpi/acpica/utmisc.c
+++ b/drivers/acpi/acpica/utmisc.c
@@ -53,8 +53,8 @@ ACPI_MODULE_NAME("utmisc")
/*
* Common suffix for messages
*/
-#define ACPI_COMMON_MSG_SUFFIX \
- acpi_os_printf(" (%8.8X/%s-%u)\n", ACPI_CA_VERSION, module_name, line_number)
+#define ACPI_COMMON_MSG_SUFFIX_FMT " (%8.8X/%s-%u)"
+#define ACPI_COMMON_MSG_SUFFIX_ARGS ACPI_CA_VERSION, module_name, line_number
/*******************************************************************************
*
* FUNCTION: acpi_ut_validate_exception
@@ -1063,12 +1063,16 @@ void ACPI_INTERNAL_VAR_XFACE
acpi_error(const char *module_name, u32 line_number, const char *format, ...)
{
va_list args;
-
- acpi_os_printf("ACPI Error: ");
+ struct va_format vaf;
va_start(args, format);
- acpi_os_vprintf(format, args);
- ACPI_COMMON_MSG_SUFFIX;
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ acpi_os_printf("ACPI Error: %pV" ACPI_COMMON_MSG_SUFFIX_FMT "\n",
+ &vaf, ACPI_COMMON_MSG_SUFFIX_ARGS);
+
va_end(args);
}
@@ -1077,12 +1081,18 @@ acpi_exception(const char *module_name,
u32 line_number, acpi_status status, const char *format, ...)
{
va_list args;
-
- acpi_os_printf("ACPI Exception: %s, ", acpi_format_exception(status));
+ struct va_format vaf;
va_start(args, format);
- acpi_os_vprintf(format, args);
- ACPI_COMMON_MSG_SUFFIX;
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ acpi_os_printf("ACPI Exception: %s, %pV"
+ ACPI_COMMON_MSG_SUFFIX_FMT "\n",
+ acpi_format_exception(status), &vaf,
+ ACPI_COMMON_MSG_SUFFIX_ARGS);
+
va_end(args);
}
@@ -1090,12 +1100,16 @@ void ACPI_INTERNAL_VAR_XFACE
acpi_warning(const char *module_name, u32 line_number, const char *format, ...)
{
va_list args;
-
- acpi_os_printf("ACPI Warning: ");
+ struct va_format vaf;
va_start(args, format);
- acpi_os_vprintf(format, args);
- ACPI_COMMON_MSG_SUFFIX;
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ acpi_os_printf("ACPI Warning: %pV" ACPI_COMMON_MSG_SUFFIX_FMT "\n",
+ &vaf, ACPI_COMMON_MSG_SUFFIX_ARGS);
+
va_end(args);
}
@@ -1103,12 +1117,15 @@ void ACPI_INTERNAL_VAR_XFACE
acpi_info(const char *module_name, u32 line_number, const char *format, ...)
{
va_list args;
-
- acpi_os_printf("ACPI: ");
+ struct va_format vaf;
va_start(args, format);
- acpi_os_vprintf(format, args);
- acpi_os_printf("\n");
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ acpi_os_printf("ACPI: %pV\n", &vaf);
+
va_end(args);
}
@@ -1143,6 +1160,7 @@ acpi_ut_predefined_warning(const char *module_name,
u8 node_flags, const char *format, ...)
{
va_list args;
+ struct va_format vaf;
/*
* Warning messages for this method/object will be disabled after the
@@ -1152,11 +1170,15 @@ acpi_ut_predefined_warning(const char *module_name,
return;
}
- acpi_os_printf("ACPI Warning for %s: ", pathname);
-
va_start(args, format);
- acpi_os_vprintf(format, args);
- ACPI_COMMON_MSG_SUFFIX;
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ acpi_os_printf("ACPI Warning for %s: %pV"
+ ACPI_COMMON_MSG_SUFFIX_FMT "\n",
+ pathname, &vaf, ACPI_COMMON_MSG_SUFFIX_ARGS);
+
va_end(args);
}
@@ -1185,6 +1207,7 @@ acpi_ut_predefined_info(const char *module_name,
char *pathname, u8 node_flags, const char *format, ...)
{
va_list args;
+ struct va_format vaf;
/*
* Warning messages for this method/object will be disabled after the
@@ -1194,10 +1217,13 @@ acpi_ut_predefined_info(const char *module_name,
return;
}
- acpi_os_printf("ACPI Info for %s: ", pathname);
-
va_start(args, format);
- acpi_os_vprintf(format, args);
- ACPI_COMMON_MSG_SUFFIX;
+
+ vaf.fmt = format;
+ vaf.va = &args;
+
+ acpi_os_printf("ACPI Info for %s: %pV" ACPI_COMMON_MSG_SUFFIX_FMT "\n",
+ pathname, &vaf, ACPI_COMMON_MSG_SUFFIX_ARGS);
+
va_end(args);
}
^ permalink raw reply related
* Re: [PATCH net-next] drivers/acpi/acpica/utmisc.c: Use printk extension %pV
From: David Miller @ 2010-07-20 5:16 UTC (permalink / raw)
To: joe; +Cc: lenb, linux-acpi, linux-kernel, netdev
In-Reply-To: <1279602367.19374.20.camel@Joe-Laptop.home>
From: Joe Perches <joe@perches.com>
Date: Mon, 19 Jul 2010 22:06:07 -0700
> Consolidates the printk messages to a single
> call so the messages can not be interleaved.
>
> Reduces text a bit.
>
> $ size drivers/acpi/acpica/utmisc.o.*
> text data bss dec hex filename
> 7822 56 1832 9710 25ee drivers/acpi/acpica/utmisc.o.old
> 7748 56 1736 9540 2544 drivers/acpi/acpica/utmisc.o.new
>
> Depends on net-next commit 7db6f5fb65a82af03229eef104dc9899c5eecf33
> (vsprintf: Recursive vsnprintf: Add "%pV", struct va_format)
>
> Compile tested only
>
> Signed-off-by: Joe Perches <joe@perches.com>
Joe, I really can't keep merging stuff like this into the networking
tree. The driver generic bits, since the netdev print macros needed
this indirectly and you used %pV primarily for networking stuff, that's
fine.
But you're going to have to find another way to merge uses outside of
networking that you want integrated.
Thanks.
^ permalink raw reply
* Re: [PATCH net-next] drivers/acpi/acpica/utmisc.c: Use printk extension %pV
From: Joe Perches @ 2010-07-20 5:21 UTC (permalink / raw)
To: David Miller; +Cc: lenb, linux-acpi, linux-kernel, netdev
In-Reply-To: <20100719.221630.146073821.davem@davemloft.net>
On Mon, 2010-07-19 at 22:16 -0700, David Miller wrote:
> Joe, I really can't keep merging stuff like this into the networking
> tree.
Oh no worries David.
The patch is more like a preliminary notification that at
some point after the vsprintf stuff gets merged into Linus'
tree after 2.6.36-rc1 that this change to acpi could be useful.
> But you're going to have to find another way to merge uses outside of
> networking that you want integrated.
Hey, I'm a patient guy, there's no hurry.
cheers, Joe
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox