Skip to contentSkip to conversation

8139too KGDBoE fix

PATCH Amit S. Kale 4 participants 12 messages Feb 23, 2007 – Mar 14, 2007 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#3 lore raw
In reply to a message not in the archive

Hi Net Gurus,

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

2. Here is how kgdb uses polling mechanism for communication to gdb. kgdb calls netpoll_set_trap(1) just before entering a loop where it communicates to gdb. It calls netpoll_set_trap(0) after it is done and wants to resume a kernel. The communication to gdb goes through netpoll_poll (which calls kgdb rx_hook) and netpoll_send_udp functions.

3. A queue for an interface may have been stopped by it's driver by calling netif_stop_queue. After this if kgdb attempts to enter communication with gdb, it'll call netpoll_set_trap(1), after which the queue can't be started again. This is a potential deadlock situation. Is there a way out of this?

4. Is it necessary to call netpoll_set_trap(1) at all before entering gdb communication loop? Even if a driver stops the queue in middle of the communication netpoll_poll and netpoll_send_udp calls can recover from that by calling driver's interrupt and poll routines. Is this a valid statement?

Thanks a lot.
-Amit

Quoted 60 lines · Sergei Shtylyov
Quoted 32 lines · Hello, I wrote:
Quoted 32 lines
Quoted 31 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Even with this patch, the packets probably get stuck somewhere in the driver, as cross-gdb sees tail of the $g packet reply only in reply to next packet...

This wasn;t happeing on x86 probably because the register packet
should be much shorted there than on PPC...

Quoted 14 lines
Quoted 7 lines
Quoted 6 lines

Argh! That's all because of the CONFIG_NETPOLL_TRAP that
CONFIG_KGDBOE* options select -- since the initial breakpoint enables trapping via KGDBoE's pre_exception() handler, netif_{stop/wake}_queue() stop to work and that causes KGDBoE to literally flood 8139too with packets (although it can't queue up more than 4). Looks like a general design issue to me... :-/

Quoted 6 lines

Well, maybe not. But many drivers are surely unprepared to their hard_start_xmit() method being called with queue alraedy stopped and those with small TX queue (like natsemi with which we're also having trouble) would get flooded as well. I'm going to submit a patch to netdev adding extra check for TX ring being full -- after/if it gets accepted, this patch won't be needed anymore.

Quoted 7 lines

Here is what comes to my mind right away. It might need some more polishing or cleaning up:

A potential solution will be to check the if hard_start_xmit() returns NETDEV_TX_BUSY. In case transmit queue is busy (due to lot of threads or queue getting full), we should wait in netpoll_send_skb(), call a cleanup through poll() and then retry sending packet.

This is already being done by netpoll iself. The thing is that
hard_start_xmit() doesdn't return NETDEV_TX_BUSY in those drivers. :-/

Quoted 6 lines
Quoted 3 lines

In addition to that we set trapped. I wonder whether it is possible that a queue is stopped and we enter kgdb. It would be a deadlock. -Amit

Why? Netpoll does call the driver's interrupt and NAPI handlers in
that case (until the retry count is 0).

Ah, got it -- since the traffic trapping (when enabled) effectively
bypasses netif_wake_queue(), a queue would never be actually woken up. Maybe it's worth to always return 0 from netif_queue_stopped() in this case? Or maybe the correct thing to do when trapping is to just thiddle the __LINK_STATE_XOFF bit, bypassing call to netif_schedule()?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Regards,
Mithlesh Thukral

WBR, Sergei

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Kgdb-bugreport mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

#4 lore raw
Quoted 6 lines · Amit S. Kale

Hi Net Gurus,

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

We think this comes from calling the driver while the queue is stopped. Drivers should not do horrible things when hard start is called with the queue stopped, but unfortunately, at this time, at least some drivers do explode or complain under that condition.

Quoted 4 lines

2. Here is how kgdb uses polling mechanism for communication to gdb. kgdb calls netpoll_set_trap(1) just before entering a loop where it communicates to gdb. It calls netpoll_set_trap(0) after it is done and wants to resume a kernel. The communication to gdb goes through netpoll_poll (which calls kgdb rx_hook) and netpoll_send_udp functions.

3. A queue for an interface may have been stopped by it's driver by calling netif_stop_queue. After this if kgdb attempts to enter communication with gdb, it'll call netpoll_set_trap(1), after which the queue can't be started again. This is a potential deadlock situation. Is there a way out of this?

We are trying without setting the CONFIG_NETPOLL_TRAP option. This option is what turns off the function of the netif_stop/wake_queue calls, which breaks the usual flow control mechanism used by netpoll transmit function. It also prevents the netif_schedule call, which will puts the device on the tx softirq queue. However, in the case where interupts are off and scheduling is not allowed - which would be the netpoll_set_trap(1) condition, the softirq will not run until netpoll is done and the user of netpoll returns the system to normal operation. So I am unclear that allowing the schedule is a problem. There may be some obscure race conditions on smp, so we are trying to analyze that part, but for the moment are testing with the netif_schedule call allowed in the event of queuing the device.

Quoted 2 lines

4. Is it necessary to call netpoll_set_trap(1) at all before entering gdb communication loop? Even if a driver stops the queue in middle of the communication netpoll_poll and netpoll_send_udp calls can recover from that by calling driver's interrupt and poll routines. Is this a valid statement?

netpoll_set_trap() is necessary, as it informs the netpoll code to respond to arp requests on behalf of the netpoll user, as well as making sure that skbs are freed without needing the completion queue stuff to run (I think)

Quoted 73 lines

Thanks a lot.
-Amit

Quoted 64 lines · Sergei Shtylyov
Quoted 33 lines · Hello, I wrote:
Quoted 33 lines
Quoted 33 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

Even with this patch, the packets probably get stuck somewhere in the driver, as cross-gdb sees tail of the $g packet reply only in reply to next packet...

This wasn;t happeing on x86 probably because the register packet
should be much shorted there than on PPC...

Quoted 14 lines
Quoted 7 lines
Quoted 7 lines

Argh! That's all because of the CONFIG_NETPOLL_TRAP that
CONFIG_KGDBOE* options select -- since the initial breakpoint enables trapping via KGDBoE's pre_exception() handler, netif_{stop/wake}_queue() stop to work and that causes KGDBoE to literally flood 8139too with packets (although it can't queue up more than 4). Looks like a general design issue to me... :-/

Quoted 7 lines

Well, maybe not. But many drivers are surely unprepared to their hard_start_xmit() method being called with queue alraedy stopped and those with small TX queue (like natsemi with which we're also having trouble) would get flooded as well. I'm going to submit a patch to netdev adding extra check for TX ring being full -- after/if it gets accepted, this patch won't be needed anymore.

Quoted 8 lines

Here is what comes to my mind right away. It might need some more polishing or cleaning up:

A potential solution will be to check the if hard_start_xmit() returns NETDEV_TX_BUSY. In case transmit queue is busy (due to lot of threads or queue getting full), we should wait in netpoll_send_skb(), call a cleanup through poll() and then retry sending packet.

This is already being done by netpoll iself. The thing is that
hard_start_xmit() doesdn't return NETDEV_TX_BUSY in those drivers. :-/

Quoted 7 lines
Quoted 4 lines

In addition to that we set trapped. I wonder whether it is possible that a queue is stopped and we enter kgdb. It would be a deadlock. -Amit

Why? Netpoll does call the driver's interrupt and NAPI handlers in
that case (until the retry count is 0).

Ah, got it -- since the traffic trapping (when enabled) effectively
bypasses netif_wake_queue(), a queue would never be actually woken up. Maybe it's worth to always return 0 from netif_queue_stopped() in this case? Or maybe the correct thing to do when trapping is to just thiddle the __LINK_STATE_XOFF bit, bypassing call to netif_schedule()?

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Regards,
Mithlesh Thukral

WBR, Sergei

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Kgdb-bugreport mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport

#5 lore raw
Quoted 11 lines · On Fri, 23 Feb 2007 11:10:40 -0700 Mark Huth <[email protected]> wrote:
Quoted 10 lines · Amit S. Kale

Hi Net Gurus,

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

Quoted 4 lines

We think this comes from calling the driver while the queue is stopped. Drivers should not do horrible things when hard start is called with the queue stopped, but unfortunately, at this time, at least some drivers do explode or complain under that condition.

The kernel is built on a set of assumptions about calling context. Your out of tree code is violating one of them. Why not check for stopped queue and do some action to try and clear it, that is what netconsole does.

Quoted 34 lines
Quoted 11 lines

2. Here is how kgdb uses polling mechanism for communication to gdb. kgdb calls netpoll_set_trap(1) just before entering a loop where it communicates to gdb. It calls netpoll_set_trap(0) after it is done and wants to resume a kernel. The communication to gdb goes through netpoll_poll (which calls kgdb rx_hook) and netpoll_send_udp functions.

3. A queue for an interface may have been stopped by it's driver by calling netif_stop_queue. After this if kgdb attempts to enter communication with gdb, it'll call netpoll_set_trap(1), after which the queue can't be started again. This is a potential deadlock situation. Is there a way out of this?

We are trying without setting the CONFIG_NETPOLL_TRAP option. This option is what turns off the function of the netif_stop/wake_queue calls, which breaks the usual flow control mechanism used by netpoll transmit function. It also prevents the netif_schedule call, which will puts the device on the tx softirq queue. However, in the case where interupts are off and scheduling is not allowed - which would be the netpoll_set_trap(1) condition, the softirq will not run until netpoll is done and the user of netpoll returns the system to normal operation. So I am unclear that allowing the schedule is a problem. There may be some obscure race conditions on smp, so we are trying to analyze that part, but for the moment are testing with the netif_schedule call allowed in the event of queuing the device.

Quoted 5 lines

4. Is it necessary to call netpoll_set_trap(1) at all before entering gdb communication loop? Even if a driver stops the queue in middle of the communication netpoll_poll and netpoll_send_udp calls can recover from that by calling driver's interrupt and poll routines. Is this a valid statement?

netpoll_set_trap() is necessary, as it informs the netpoll code to respond to arp requests on behalf of the netpoll user, as well as making sure that skbs are freed without needing the completion queue stuff to run (I think)

Quoted 2 lines

Thanks a lot.
-Amit

Signature · 1 line
Stephen Hemminger <[email protected]>
#6 lore raw

Hello.

Quoted 9 lines · Stephen Hemminger
Quoted 5 lines
Quoted 3 lines

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

We think this comes from calling the driver while the queue is stopped. Drivers should not do horrible things when hard start is called with the queue stopped, but unfortunately, at this time, at least some drivers do explode or complain under that condition.

The kernel is built on a set of assumptions about calling context. Your out of tree code is violating one of them. Why not check for stopped queue and do some action to try and clear it, that is what netconsole does.

The queue can't be stopped when the netpoll traffic trapping is enabled
(cause this effectively bypasses queue control), So, the stopped queue indoication doesn't work also -- *that* is the problem. It's not at all specific to KGBoE -- only to traffic trapping.

WBR, Sergei

#7 lore raw
Quoted 17 lines · On Fri, 23 Feb 2007 22:09:16 +0300 Sergei Shtylyov <[email protected]>…

Hello.

Quoted 12 lines · Stephen Hemminger
Quoted 12 lines
Quoted 7 lines

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

We think this comes from calling the driver while the queue is stopped. Drivers should not do horrible things when hard start is called with the queue stopped, but unfortunately, at this time, at least some drivers do explode or complain under that condition.

Quoted 8 lines
Quoted 3 lines

The kernel is built on a set of assumptions about calling context. Your out of tree code is violating one of them. Why not check for stopped queue and do some action to try and clear it, that is what netconsole does.

The queue can't be stopped when the netpoll traffic trapping is enabled
(cause this effectively bypasses queue control), So, the stopped queue indoication doesn't work also -- *that* is the problem. It's not at all specific to KGBoE -- only to traffic trapping.

You can't ask a device to send a packet when it has no resources.

Signature · 1 line
Stephen Hemminger <[email protected]>
#8 lore raw

Hello.

Quoted 6 lines · Stephen Hemminger
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

We think this comes from calling the driver while the queue is stopped. Drivers should not do horrible things when hard start is called with the queue stopped, but unfortunately, at this time, at least some drivers do explode or complain under that condition.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

The kernel is built on a set of assumptions about calling context. Your out of tree code is violating one of them. Why not check for stopped queue and do some action to try and clear it, that is what netconsole does.

The queue can't be stopped when the netpoll traffic trapping is enabled
(cause this effectively bypasses queue control), So, the stopped queue indoication doesn't work also -- *that* is the problem. It's not at all specific to KGBoE -- only to traffic trapping.

You can't ask a device to send a packet when it has no resources.

When traffic trapping is enabled, and driver stops the queue, the
__LINK_STATE_XOFF flag does *not* get set, so netif_queue_stopped() resturns *zero*. What may be done in this situation?

WBR, Sergei

#9 lore raw
Quoted 26 lines · On Fri, 23 Feb 2007 22:16:59 +0300 Sergei Shtylyov <[email protected]>…

Hello.

Quoted 21 lines · Stephen Hemminger
Quoted 21 lines
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

Quoted 8 lines
Quoted 4 lines

We think this comes from calling the driver while the queue is stopped. Drivers should not do horrible things when hard start is called with the queue stopped, but unfortunately, at this time, at least some drivers do explode or complain under that condition.

The kernel is built on a set of assumptions about calling context. Your out of tree code is violating one of them. Why not check for stopped queue and do some action to try and clear it, that is what netconsole does.

The queue can't be stopped when the netpoll traffic trapping is enabled
(cause this effectively bypasses queue control), So, the stopped queue indoication doesn't work also -- *that* is the problem. It's not at all specific to KGBoE -- only to traffic trapping.

Quoted 5 lines
Quoted 1 line

You can't ask a device to send a packet when it has no resources.

When traffic trapping is enabled, and driver stops the queue, the
__LINK_STATE_XOFF flag does *not* get set, so netif_queue_stopped() resturns *zero*. What may be done in this situation?

Read netpoll_send_skb()

	int status = NETDEV_TX_BUSY;
...
		if (netif_tx_trylock(dev)) {
			/* try until next clock tick */
			for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
					tries > 0; --tries) {
				if (!netif_queue_stopped(dev))
					status = dev->hard_start_xmit(skb, dev);

				if (status == NETDEV_TX_OK)
					break;

				/* tickle device maybe there is some cleanup */
				netpoll_poll(np);

				udelay(USEC_PER_POLL);
			}
			netif_tx_unlock(dev);

netpoll_poll() allows device to try and cleanup transmit resources.

Signature · 1 line
Stephen Hemminger <[email protected]>
#10 lore raw
Quoted 39 lines · Stephen Hemminger
Quoted 10 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

We think this comes from calling the driver while the queue is stopped. Drivers should not do horrible things when hard start is called with the queue stopped, but unfortunately, at this time, at least some drivers do explode or complain under that condition.

The kernel is built on a set of assumptions about calling context. Your out of tree code is violating one of them. Why not check for stopped queue and do some action to try and clear it, that is what netconsole does.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

The queue can't be stopped when the netpoll traffic trapping is enabled
(cause this effectively bypasses queue control), So, the stopped queue indoication doesn't work also -- *that* is the problem. It's not at all specific to KGBoE -- only to traffic trapping.

You can't ask a device to send a packet when it has no resources.

When traffic trapping is enabled, and driver stops the queue, the
__LINK_STATE_XOFF flag does *not* get set, so netif_queue_stopped() resturns *zero*. What may be done in this situation?

Read netpoll_send_skb()

	int status = NETDEV_TX_BUSY;
...
		if (netif_tx_trylock(dev)) {
			/* try until next clock tick */
			for (tries = jiffies_to_usecs(1)/USEC_PER_POLL;
					tries > 0; --tries) {
				if (!netif_queue_stopped(dev))
					status = dev->hard_start_xmit(skb, dev);

				if (status == NETDEV_TX_OK)
					break;

				/* tickle device maybe there is some cleanup */
				netpoll_poll(np);

				udelay(USEC_PER_POLL);
			}
			netif_tx_unlock(dev);
Quoted 1 line

netpoll_poll() allows device to try and cleanup transmit resources.

Read <linux/netdevice.h>:

static inline void netif_stop_queue(struct net_device *dev) {

#ifdef CONFIG_NETPOLL_TRAP
        if (netpoll_trap())
                return;
#endif
        set_bit(__LINK_STATE_XOFF, &dev->state);
}

static inline int netif_queue_stopped(const struct net_device *dev)

{
        return test_bit(__LINK_STATE_XOFF, &dev->state);
}

When the driver calls netif_stop_queue() having his TX queue filled to the
brim (4 buffers in case of 8139too) and netpoll_trap() returns 1, what will happen?

WBR, Sergei

#11 lore raw
In reply to Stephen Hemminger
Quoted 13 lines · Stephen Hemminger
Quoted 9 lines · On Fri, 23 Feb 2007 11:10:40 -0700 Mark Huth <[email protected]> wrote:
Quoted 7 lines · Amit S. Kale

Hi Net Gurus,

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

Quoted 7 lines
Quoted 2 lines

We think this comes from calling the driver while the queue is stopped. Drivers should not do horrible things when hard start is called with the queue stopped, but unfortunately, at this time, at least some drivers do explode or complain under that condition.

The kernel is built on a set of assumptions about calling context. Your out of tree code is violating one of them. Why not check for stopped queue and do some action to try and clear it, that is what netconsole does.

Yes, of course. This is just an incidental thing that happens because of the real problem, which is the use of CONFIG_NETPOL_TRAP in netif_stop/wake_queue routines. Information about the necessity of that code would be appreciated. Because when that option is selected, the queue management interface is squashed, leading to the situation where the device driver thinks the queue is stopped but the flag for that does not get changed. Leading to the situation where device drivers either panic or complain.

AFAIK, NETPOLL_RX is not used at all, and NETPOLL_TRAP is only used in netdevice.h to turn off the transmit flow control/queue management function. Netpoll already bypasses the actual queue, but it does try to honor the queue state. However, KGDBOE breaks the queue state management by selecting NETPOLL_TRAP.

This is not exactly out of tree code, because netpoll is the entity that calls the driver leading to errors and worse from the drivers. And KGDB is from the community tree. We're just trying to make it work, and the patches will be returned when we figure this out. We're also trying to get this to work with the RT stuff, which creates another whole set of problems due to major semantic changes. However it looks like the latest nepoll code should be okay wrt RT.

And I remain of the opinion that a device driver ought not panic or corrupt data, or anything else obnoxious given a hard_start call at the wrong time, but that's another battle for another day.

Quoted 18 lines
Quoted 15 lines
Quoted 5 lines

2. Here is how kgdb uses polling mechanism for communication to gdb. kgdb calls netpoll_set_trap(1) just before entering a loop where it communicates to gdb. It calls netpoll_set_trap(0) after it is done and wants to resume a kernel. The communication to gdb goes through netpoll_poll (which calls kgdb rx_hook) and netpoll_send_udp functions.

3. A queue for an interface may have been stopped by it's driver by calling netif_stop_queue. After this if kgdb attempts to enter communication with gdb, it'll call netpoll_set_trap(1), after which the queue can't be started again. This is a potential deadlock situation. Is there a way out of this?

We are trying without setting the CONFIG_NETPOLL_TRAP option. This option is what turns off the function of the netif_stop/wake_queue calls, which breaks the usual flow control mechanism used by netpoll transmit function. It also prevents the netif_schedule call, which will puts the device on the tx softirq queue. However, in the case where interupts are off and scheduling is not allowed - which would be the netpoll_set_trap(1) condition, the softirq will not run until netpoll is done and the user of netpoll returns the system to normal operation. So I am unclear that allowing the schedule is a problem. There may be some obscure race conditions on smp, so we are trying to analyze that part, but for the moment are testing with the netif_schedule call allowed in the event of queuing the device.

Quoted 3 lines

4. Is it necessary to call netpoll_set_trap(1) at all before entering gdb communication loop? Even if a driver stops the queue in middle of the communication netpoll_poll and netpoll_send_udp calls can recover from that by calling driver's interrupt and poll routines. Is this a valid statement?

netpoll_set_trap() is necessary, as it informs the netpoll code to respond to arp requests on behalf of the netpoll user, as well as making sure that skbs are freed without needing the completion queue stuff to run (I think)

Quoted 3 lines

Thanks a lot.
-Amit

#12 lore raw
In reply to Amit S. Kale

Hello.

Quoted 9 lines · Amit S. Kale

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

2. Here is how kgdb uses polling mechanism for communication to gdb. kgdb calls netpoll_set_trap(1) just before entering a loop where it communicates to gdb. It calls netpoll_set_trap(0) after it is done and wants to resume a kernel. The communication to gdb goes through netpoll_poll (which calls kgdb rx_hook) and netpoll_send_udp functions.

3. A queue for an interface may have been stopped by it's driver by calling netif_stop_queue. After this if kgdb attempts to enter communication with gdb, it'll call netpoll_set_trap(1), after which the queue can't be started again. This is a potential deadlock situation. Is there a way out of this?

4. Is it necessary to call netpoll_set_trap(1) at all before entering gdb communication loop? Even if a driver stops the queue in middle of the communication netpoll_poll and netpoll_send_udp calls can recover from that by calling driver's interrupt and poll routines. Is this a valid statement?

I'd like to return to this again (having received no feedback)...
The idea is to change how CONFIG_NETPOLL_TRAP is implemented: instead of
completely bypassing queue locking after netpoll_set_trap(1) has been called, how about we set and chack some other flag (internal to netpoll) telling it that the queue is frozen, i.e. watch the queue state using a separate mechanism when traffic trapping is engaged? This certainly would avoid TX queue overflows in drivers while also avoiding any dev->state changes and even worse evil __netif_schedule() call, i.e. things that CONFIG_NETPOLL_TRAP is currectly trying to avoid, AFAIU...

Quoted 2 lines

Thanks a lot.
-Amit

WBR, Sergei

#13 lore raw
Quoted 6 lines · Hello, I wrote:
Quoted 5 lines

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

2. Here is how kgdb uses polling mechanism for communication to gdb. kgdb calls netpoll_set_trap(1) just before entering a loop where it communicates to gdb. It calls netpoll_set_trap(0) after it is done and wants to resume a kernel. The communication to gdb goes through netpoll_poll (which calls kgdb rx_hook) and netpoll_send_udp functions.

Quoted 7 lines
Quoted 3 lines

3. A queue for an interface may have been stopped by it's driver by calling netif_stop_queue. After this if kgdb attempts to enter communication with gdb, it'll call netpoll_set_trap(1), after which the queue can't be started again. This is a potential deadlock situation. Is there a way out of this?

4. Is it necessary to call netpoll_set_trap(1) at all before entering gdb communication loop? Even if a driver stops the queue in middle of the communication netpoll_poll and netpoll_send_udp calls can recover from that by calling driver's interrupt and poll routines. Is this a valid statement?

I'd like to return to this again (having received no feedback)...
The idea is to change how CONFIG_NETPOLL_TRAP is implemented: instead of
completely bypassing queue locking after netpoll_set_trap(1) has been called, how about we set and chack some other flag (internal to netpoll) telling it that the queue is frozen, i.e. watch the queue state using a separate mechanism when traffic trapping is engaged? This certainly

Well, this certainly won't work, as the bit should be tied to struct
net_device. The first idea was more sound: just set/reset __LINK_STATE_XOFF flag, not calling __netif_schedule(), i.e. remove #ifdef from netif_stop_queue() and replace return stmt in netif_wake_queue() by clear_bit(__LINK_STATE_XOFF, &dev->state).

Quoted 1 line

would avoid TX queue overflows in drivers while also avoiding any dev->state changes and even worse evil __netif_schedule() call, i.e. things that CONFIG_NETPOLL_TRAP is currectly trying to avoid, AFAIU...

I think I'll submit a patch -- netpoll traffic trapping is pretty broken
as it is now.

Quoted 2 lines
Quoted 2 lines

Thanks a lot.
-Amit

WBR, Sergei

#14 lore raw
Quoted 7 lines · Hello, I wrote:
Quoted 7 lines
Quoted 7 lines

This thread came up on kgdb-bugreport mailing list. Could you please suggest us what's the correct way of fixing this problem?

1. When running a kgdb on RTL8139 ethernet interface: 8139too driver prints too many "Out-of-sync dirty pointer" messages on console and gdb can't connect to kgdb stub. These messages can be suppressed, though it still results in connection failures frequently.

2. Here is how kgdb uses polling mechanism for communication to gdb. kgdb calls netpoll_set_trap(1) just before entering a loop where it communicates to gdb. It calls netpoll_set_trap(0) after it is done and wants to resume a kernel. The communication to gdb goes through netpoll_poll (which calls kgdb rx_hook) and netpoll_send_udp functions.

3. A queue for an interface may have been stopped by it's driver by calling netif_stop_queue. After this if kgdb attempts to enter communication with gdb, it'll call netpoll_set_trap(1), after which the queue can't be started again. This is a potential deadlock situation. Is there a way out of this?

No way but at least "emulate" the queue controls...

Quoted 1 line
Quoted 1 line
Quoted 1 line

4. Is it necessary to call netpoll_set_trap(1) at all before entering gdb communication loop? Even if a driver stops the queue in middle of the communication netpoll_poll and netpoll_send_udp calls can recover from that by calling driver's interrupt and poll routines. Is this a valid statement?

It seems that having queue control working as usual is dangerous in case
of KGDB being active: this leads to wake_softirqd() being called, which seems undesirable (there has been report about the eventual lockup trying to get runqueue lock).

Quoted 7 lines
Quoted 4 lines

I'd like to return to this again (having received no feedback)...
The idea is to change how CONFIG_NETPOLL_TRAP is implemented:
instead of
completely bypassing queue locking after netpoll_set_trap(1) has been called, how about we set and chack some other flag (internal to netpoll) telling it that the queue is frozen, i.e. watch the queue state using a separate mechanism when traffic trapping is engaged? This certainly

Well, this certainly won't work, as the bit should be tied to struct
net_device.

Well, I hadn't yet discovered npinfo member of net_device before saying
that. :-)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Thanks a lot.
-Amit

WBR, Sergei