Re: RT and kernel debugger ( 2.6.12rc6 + RT > 48-00 )

From: Tom Rini
Date: Fri Jun 17 2005 - 14:25:00 EST


On Tue, Jun 14, 2005 at 09:20:15AM +0200, Ingo Molnar wrote:
>
> * kus Kusche Klaus <kus@xxxxxxxx> wrote:
>
> > I was one of those who tried to get kgdb working.
> >
> > Here I described how far I came:
> > http://www.ussg.iu.edu/hypermail/linux/kernel/0505.1/0700.html
>
> does ethernet debugging work if you disable the netpoll WARN_ON() that
> triggers?

With the KGDB at http://kgdb.linsyssoft.com/cvs.htm the following is all
that's needed for PREEMPT_RT to work:
--- linux-2.6.10.orig/drivers/net/kgdb_eth.c
+++ linux-2.6.10/drivers/net/kgdb_eth.c
@@ -55,22 +55,49 @@ static int eth_getDebugChar(void)
{
int chr;

- while (atomic_read(&in_count) == 0)
+#ifdef CONFIG_PREEMPT_RT
+ /*
+ * A bit hairy. Netpoll API users uses mutexes (indirectly) and
+ * thus must have interrupts enabled:
+ */
+ local_irq_enable();
+#endif
+
+ while (atomic_read(&in_count) == 0) {
+ WARN_ON_RT(irqs_disabled());
netpoll_poll(&np);
+ WARN_ON_RT(irqs_disabled());
+ }

chr = in_buf[in_tail++];
in_tail &= (IN_BUF_SIZE - 1);
atomic_dec(&in_count);
+#ifdef CONFIG_PREEMPT_RT
+ local_irq_disable();
+#endif
return chr;
}

static void eth_flushDebugChar(void)
{
+#ifdef CONFIG_PREEMPT_RT
+ /*
+ * A bit hairy. Netpoll API users uses mutexes (indirectly) and
+ * thus must have interrupts enabled:
+ */
+ local_irq_enable();
+#endif
+
if (out_count && np.dev) {
+ WARN_ON_RT(irqs_disabled());
netpoll_send_udp(&np, out_buf, out_count);
+ WARN_ON_RT(irqs_disabled());
memset(out_buf, 0, sizeof(out_buf));
out_count = 0;
}
+#ifdef CONFIG_PREEMPT_RT
+ local_irq_disable();
+#endif
}

static void eth_putDebugChar(int chr)
--- linux-2.6.10.orig/kernel/kgdb.c
+++ linux-2.6.10/kernel/kgdb.c
@@ -85,7 +85,7 @@ struct kgdb_arch *kgdb_ops = &arch_kgdb_

static const char hexchars[] = "0123456789abcdef";

-static spinlock_t slavecpulocks[NR_CPUS];
+static raw_spinlock_t slavecpulocks[NR_CPUS];
static volatile int procindebug[NR_CPUS];
atomic_t kgdb_setting_breakpoint;
struct task_struct *kgdb_usethread, *kgdb_contthread;

--
Tom Rini
http://gate.crashing.org/~trini/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/