Hi All,
I've read in the KGDB FAQ that "The current design where kgdboe relies
entirely on the NET POLL API makes it unreliable. In a kernel with IRQ
PREEMPTION turned on it is possible that Ethernet device cannot be shared
safely between the polled and the interrupt driven context because a lock
or structure may be taken when a driver is preempted and the kernel
debugger is active."
I'd like to suggest a possible solution, which is driver independent. It
does, however, requires all applications and kernel space modules which use
that driver to close and open it again.
Upon configuring the kgdboe module, we lookup the kgdb communication dev
(e.g. eth0) in the net namespace, and replace it with a kgdb net driver
wrapper (decorator design pattern). All the kgdb net driver does is forward
the various net interface calls to the real driver, after a kgdb active
test. The purpose of this module is to be a single point to of
synchronization between the kgdboe and the ethernet driver.
An example read function will look like:
int kgdboe_net_read(struct net *net, ...)
{
if (kgdb_configured)
kgdb_disable_nmi();
int ret = net->dev->read(...); // net->dev points to the
original driver
if (kgdb_configured)
kgdb_enable_nmi();
return ret;
}
Both the kgdboe module and applications will use this module when using
eth0.
So, if for example the driver registered on eth0 is e1000, then:
legend:
-> uses
= points to
before:
userspace_app -> eth0 = e1000
kgdboe -> eth0 = e1000
after:
userspace_app -> eth0 = kgdb_net -> e1000
kgdboe -> eth0 = kgdb_net -> e1000
So now in the kgdb_net we can insert all the needed locking to protect
against reentrancy of kgdb's NMI.
What do you think? Are there any other issues a solution will need to
address?
------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
• 3 signs your SCM is hindering your productivity
• Requirements for releasing software faster
• Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
Kgdb-bugreport mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kgdb-bugreport