On 11/01/17(Wed) 18:27, Martin Pieuchot wrote:
> Mark Patruck reported the following assertion:
>
> splassert: pool_put: want 5 have 7
> Starting stack trace...
> pool_put() at pool_put+0x4e
> pf_pkt_unlink_state_key() at pf_pkt_unlink_state_key+0x15
> m_free() at m_free+0xa0
> m_freem() at m_freem+0x19
> vmxnet3_txintr() at vmxnet3_txintr+0x9c
> vmxnet3_intr() at vmxnet3_intr+0x70
> intr_handler() at intr_handler+0x28
> Xintr_ioapic_level7() at Xintr_ioapic_level7+0xcd
> --- interrupt ---
> acpicpu_idle() at acpicpu_idle+0xcb
> cpu_idle_cycle() at cpu_idle_cycle+0x10
> end trace frame: 0x0, count: 247
> End of stack trace.
>
> Since state keys can be pool_put(9)'d in interrupt handlers the correct
> IPL should be IPL_NET.
After discussing the issue with bluhm@ a better solution would be to
unlink the state key before passing the mbuf to the driver. This way
we would respect the contract that PF data structures are only accessed
at IPL_SOFTNET.
ok?
Index: net/if.c
===================================================================
RCS file: /cvs/src/sys/net/if.c,v
retrieving revision 1.473
diff -u -p -r1.473 if.c
--- net/if.c 4 Jan 2017 03:56:15 -0000 1.473
+++ net/if.c 11 Jan 2017 18:30:41 -0000
*/
@@ -597,6 +599,10 @@ if_enqueue(struct ifnet *ifp, struct mbu
length = m->m_pkthdr.len;
mflags = m->m_flags;
+
+#if NPF > 0
+ pf_pkt_unlink_state_key(m);
+#endif /* NPF > 0 */
/*
* Queue message on interface, and start output if interface