* [rfc patch] net/netpoll: don't disable irqs in netpoll_send_skb()
@ 2017-03-03 6:36 Mike Galbraith
2017-03-03 8:53 ` Mike Galbraith
0 siblings, 1 reply; 2+ messages in thread
From: Mike Galbraith @ 2017-03-03 6:36 UTC (permalink / raw)
To: RT; +Cc: Sebastian Andrzej Siewior, Thomas Gleixner
Greetings,
I occasionally want to use netconsole, but it has RT issues. It seems
to work fine with the not so pretty hacklet below.
net/netpoll: don't disable irqs in netpoll_send_skb()
RT takes sleeping locks, we can't disable irqs.
Signed-off-by: Mike Galbraith <efault@gmx.de>
---
include/linux/netpoll.h | 8 ++++++--
net/core/netpoll.c | 4 ++--
2 files changed, 8 insertions(+), 4 deletions(-)
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -67,9 +67,13 @@ void netpoll_send_skb_on_dev(struct netp
static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
{
unsigned long flags;
- local_irq_save(flags);
+ local_irq_save_nort(flags);
+ if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL))
+ rcu_read_lock();
netpoll_send_skb_on_dev(np, skb, np->dev);
- local_irq_restore(flags);
+ if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL))
+ rcu_read_unlock();
+ local_irq_restore_nort(flags);
}
#ifdef CONFIG_NETPOLL
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -328,7 +328,7 @@ void netpoll_send_skb_on_dev(struct netp
/* It is up to the caller to keep npinfo alive. */
struct netpoll_info *npinfo;
- WARN_ON_ONCE(!irqs_disabled());
+ WARN_ON_ONCE_NONRT(!irqs_disabled());
npinfo = rcu_dereference_bh(np->dev->npinfo);
if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) {
@@ -362,7 +362,7 @@ void netpoll_send_skb_on_dev(struct netp
udelay(USEC_PER_POLL);
}
- WARN_ONCE(!irqs_disabled(),
+ WARN_ONCE(!IS_ENABLED(CONFIG_PREEMPT_RT_FULL) && !irqs_disabled(),
"netpoll_send_skb_on_dev(): %s enabled interrupts in poll (%pF)\n",
dev->name, dev->netdev_ops->ndo_start_xmit);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [rfc patch] net/netpoll: don't disable irqs in netpoll_send_skb()
2017-03-03 6:36 [rfc patch] net/netpoll: don't disable irqs in netpoll_send_skb() Mike Galbraith
@ 2017-03-03 8:53 ` Mike Galbraith
0 siblings, 0 replies; 2+ messages in thread
From: Mike Galbraith @ 2017-03-03 8:53 UTC (permalink / raw)
To: RT; +Cc: Sebastian Andrzej Siewior, Thomas Gleixner
Not that it matters, but there was a hunk missing.
RT takes sleeping locks, we can't disable irqs.
Signed-off-by: Mike Galbraith <efault@gmx.de>
---
include/linux/netpoll.h | 8 ++++++--
net/core/netpoll.c | 6 +++---
2 files changed, 9 insertions(+), 5 deletions(-)
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -67,9 +67,13 @@ void netpoll_send_skb_on_dev(struct netp
static inline void netpoll_send_skb(struct netpoll *np, struct sk_buff *skb)
{
unsigned long flags;
- local_irq_save(flags);
+ local_irq_save_nort(flags);
+ if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL))
+ rcu_read_lock();
netpoll_send_skb_on_dev(np, skb, np->dev);
- local_irq_restore(flags);
+ if (IS_ENABLED(CONFIG_PREEMPT_RT_FULL))
+ rcu_read_unlock();
+ local_irq_restore_nort(flags);
}
#ifdef CONFIG_NETPOLL
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -328,7 +328,7 @@ void netpoll_send_skb_on_dev(struct netp
/* It is up to the caller to keep npinfo alive. */
struct netpoll_info *npinfo;
- WARN_ON_ONCE(!irqs_disabled());
+ WARN_ON_ONCE_NONRT(!irqs_disabled());
npinfo = rcu_dereference_bh(np->dev->npinfo);
if (!npinfo || !netif_running(dev) || !netif_device_present(dev)) {
@@ -362,7 +362,7 @@ void netpoll_send_skb_on_dev(struct netp
udelay(USEC_PER_POLL);
}
- WARN_ONCE(!irqs_disabled(),
+ WARN_ONCE(!IS_ENABLED(CONFIG_PREEMPT_RT_FULL) && !irqs_disabled(),
"netpoll_send_skb_on_dev(): %s enabled interrupts in poll (%pF)\n",
dev->name, dev->netdev_ops->ndo_start_xmit);
@@ -385,7 +385,7 @@ void netpoll_send_udp(struct netpoll *np
static atomic_t ip_ident;
struct ipv6hdr *ip6h;
- WARN_ON_ONCE(!irqs_disabled());
+ WARN_ON_ONCE_NONRT(!irqs_disabled());
udp_len = len + sizeof(*udph);
if (np->ipv6)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-03 9:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 6:36 [rfc patch] net/netpoll: don't disable irqs in netpoll_send_skb() Mike Galbraith
2017-03-03 8:53 ` Mike Galbraith
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.