Message ID | 1459197678-12022-1-git-send-email-ezequiel@vanguardiasur.com.ar |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> Date: Mon, 28 Mar 2016 17:41:18 -0300 > +/* Polled functionality used by netconsole and others in non interrupt mode */ > +static void mvneta_poll_controller(struct net_device *dev) > +{ > + struct mvneta_port *pp = netdev_priv(dev); > + > + on_each_cpu(mvneta_percpu_poll_controller, pp, false); > +} This doesn't work. netpoll may be invoked from any context whatsoever, even hardware interrupt handlers or contexts where cpu interrupts are disabled. smp_call_function() and thus on_each_cpu() may not be called with disabled interrupts or from a hardware interrupt handler or from a bottom half handler, all of which are valid situations where netpoll may occur since printk's can occur anywhere.
Hi David, On 30 March 2016 at 00:09, David Miller <davem@davemloft.net> wrote: > From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> > Date: Mon, 28 Mar 2016 17:41:18 -0300 > >> +/* Polled functionality used by netconsole and others in non interrupt mode */ >> +static void mvneta_poll_controller(struct net_device *dev) >> +{ >> + struct mvneta_port *pp = netdev_priv(dev); >> + >> + on_each_cpu(mvneta_percpu_poll_controller, pp, false); >> +} > > This doesn't work. > > netpoll may be invoked from any context whatsoever, even hardware > interrupt handlers or contexts where cpu interrupts are disabled. > > smp_call_function() and thus on_each_cpu() may not be called with > disabled interrupts or from a hardware interrupt handler or from > a bottom half handler, all of which are valid situations where > netpoll may occur since printk's can occur anywhere. Well, I hated the idea of using on_each_cpu here, but wasn't sure if there was a real reason that forbid it. Thanks a lot for the feedback.
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 577f7ca7deba..dd114303c98f 100644 --- a/drivers/net/ethernet/marvell/mvneta.c +++ b/drivers/net/ethernet/marvell/mvneta.c @@ -3813,6 +3813,24 @@ static int mvneta_ethtool_get_rxfh(struct net_device *dev, u32 *indir, u8 *key, return 0; } +#ifdef CONFIG_NET_POLL_CONTROLLER +static void mvneta_percpu_poll_controller(void *arg) +{ + struct mvneta_port *pp = arg; + struct mvneta_pcpu_port *pcpu_port = + this_cpu_ptr(pp->ports); + mvneta_isr(pp->dev->irq, pcpu_port); +} + +/* Polled functionality used by netconsole and others in non interrupt mode */ +static void mvneta_poll_controller(struct net_device *dev) +{ + struct mvneta_port *pp = netdev_priv(dev); + + on_each_cpu(mvneta_percpu_poll_controller, pp, false); +} +#endif + static const struct net_device_ops mvneta_netdev_ops = { .ndo_open = mvneta_open, .ndo_stop = mvneta_stop, @@ -3823,6 +3841,9 @@ static const struct net_device_ops mvneta_netdev_ops = { .ndo_fix_features = mvneta_fix_features, .ndo_get_stats64 = mvneta_get_stats64, .ndo_do_ioctl = mvneta_ioctl, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller = mvneta_poll_controller, +#endif }; const struct ethtool_ops mvneta_eth_tool_ops = {
This commit adds the support for netpoll, which is used to implement netconsole. Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar> --- Tested on Armada 370 Mirabox and Armada XP Openblocks AX3-4 with netconsole. drivers/net/ethernet/marvell/mvneta.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)