<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Feb 12, 2014, at 4:12 PM, Pravin Shelar &lt;<a href="mailto:pshelar@nicira.com">pshelar@nicira.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">On Tue, Feb 11, 2014 at 4:07 PM, Jarno Rajahalme &lt;<a href="mailto:jrajahalme@nicira.com">jrajahalme@nicira.com</a>&gt; wrote:</div></blockquote>...<br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite">+#endif<br></blockquote><br>How much overhead do we have for non-NUMA systems without this compile<br>time check.<br>Since we always allocate node zero stat I do not think update stats<br>has that much overhead for that case.<br><br></div></blockquote><div><br></div><div>You are right, I removed this.</div><br>...<br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite"><br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spin_lock_bh(&amp;stats-&gt;lock);<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*used = stats-&gt;used;<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*tcp_flags = stats-&gt;tcp_flags;<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ovs_stats-&gt;n_packets = stats-&gt;packet_count;<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ovs_stats-&gt;n_bytes = stats-&gt;byte_count;<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spin_unlock_bh(&amp;stats-&gt;lock);<br>+<br></blockquote>Is there reason for reading node zero stat outside of for_each_node() {} loop?<br><br></div></blockquote><div><br></div><div>Not really.</div><br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite">+#if MAX_NUMNODES &gt; 1<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Collect stats from other nodes. */<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for_each_node(node) {<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (node == 0)<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;continue; /* Done already. */<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;stats = flow-&gt;stats[node];<br></blockquote><br>You need smp_read_barrier_depends() barrier here.<br>As Jesse suggested we can use higher level of API, like rcu_dereference/assign.<br><br></div></blockquote><div><br></div><div>Changed to use rcu macros.</div><div><br></div>...<br><blockquote type="cite"><div style="font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite"><br>static int check_header(struct sk_buff *skb, int len)<br>diff --git a/datapath/flow.h b/datapath/flow.h<br>index c4de0e6..f6cce35 100644<br>--- a/datapath/flow.h<br>+++ b/datapath/flow.h<br>@@ -155,6 +155,9 @@ struct flow_stats {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;unsigned long used; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Last used time (in jiffies). */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;spinlock_t lock; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Lock for atomic stats update. */<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;__be16 tcp_flags; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* Union of seen TCP flags. */<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;int last_writer; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* NUMA-node id of the last writer or<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;* -1. Meaningful for 'stats[0]' only.<br>+ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/<br>};<br><br></blockquote>I did not understood your comment from last thread about moving it to<br>struct sw_flow.<br>Since flow-&gt;stat[0] is only shared why we need last_writer in each flow_stats?<br>Therefore we should be able to move it to struct sw_flow.<br></div></blockquote><div><br></div><div>Right. However, the code in ovs_flow_stats_update() becomes a bit more complicated. Let me know what you think.</div><br></div><div>To keep things simple I’ll post a new version of this patch separately from the rest of the series.</div><br><div>&nbsp; Jarno</div><div><br></div></body></html>