All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: rpm@xenomai.org
Cc: Jan Kiszka <jan.kiszka@domain.hid>, xenomai-core <xenomai@xenomai.org>
Subject: Re: [Xenomai-core] nervous nmi-watchdog
Date: Sun, 9 Jul 2006 21:36:53 +0200	[thread overview]
Message-ID: <17585.23253.953487.892164@domain.hid> (raw)
In-Reply-To: <1152464821.5027.6.camel@domain.hid>

[-- Attachment #1: message body and .signature --]
[-- Type: text/plain, Size: 626 bytes --]

Philippe Gerum wrote:
 > On Sun, 2006-07-09 at 18:56 +0200, Jan Kiszka wrote:
 > > I can confirm the failing NMI test here on my notebook with both nucleus
 > > and native skin built into the kernel. I haven't seen false positive
 > > NMIs yet, but the tracer is still on. Will switch off and re-check.
 > 
 > FWIW, here, the false positive is raised immediately when starting the
 > latency test.

The attached patch attempt to workaround these early shots, count them,
and display them in /proc/xenomai/nmi_early_shots. Could you try it on
your box and see if the /proc display moves ?

-- 


					    Gilles Chanteperdrix.

[-- Attachment #2: xeno-nmi.diff --]
[-- Type: text/plain, Size: 2087 bytes --]

Index: ksrc/arch/i386/nmi.c
===================================================================
--- ksrc/arch/i386/nmi.c	(revision 1316)
+++ ksrc/arch/i386/nmi.c	(working copy)
@@ -61,6 +61,9 @@
         unsigned long perfctr_msr;
         unsigned long long next_linux_check;
         unsigned int p4_cccr_val;
+
+		unsigned early_shots;
+		unsigned long long arm_date;
     };
     char __pad[SMP_CACHE_BYTES];
 } rthal_nmi_wd_t ____cacheline_aligned;
@@ -108,8 +111,13 @@
     rthal_nmi_wd_t *wd = &rthal_nmi_wds[cpu];
     unsigned long long now;
 
-    if (wd->armed)
+	if (wd->armed) {
+		if (rthal_rdtsc() - wd->arm_date < rthal_maxlat_tsc) {
+			++wd->early_shots;
+			wd->next_linux_check = wd->arm_date + rthal_maxlat_tsc;
+		} else
         rthal_nmi_emergency(regs);
+	}
 
     now = rthal_rdtsc();
 
@@ -142,6 +150,27 @@
     wrmsrl(wd->perfctr_msr, now - wd->next_linux_check);
 }
 
+static int earlyshots_read_proc(char *page,
+				char **start,
+				off_t off, int count, int *eof, void *data)
+{
+	int i, len = 0;
+
+	for_each_online_cpu(i)
+		len += sprintf(page + len, "CPU#%d: %u\n",
+			       i, rthal_nmi_wds[i].early_shots);
+	len -= off;
+	if (len <= off + count)
+		*eof = 1;
+	*start = page + off;
+	if (len > count)
+		len = count;
+	if (len < 0)
+		len = 0;
+
+	return len;
+}
+
 int rthal_nmi_request(void (*emergency) (struct pt_regs *))
 {
     if (!nmi_active || !nmi_watchdog_tick)
@@ -180,6 +209,11 @@
     rthal_linux_nmi_tick = nmi_watchdog_tick;
     wmb();
     nmi_watchdog_tick = &rthal_nmi_watchdog_tick;
+
+	__rthal_add_proc_leaf("nmi_early_shots",
+			      &earlyshots_read_proc,
+			      NULL, NULL, rthal_proc_root);
+
     return 0;
 }
 
@@ -188,6 +222,8 @@
     if (!rthal_linux_nmi_tick)
         return;
 
+	remove_proc_entry("nmi_early_shots", rthal_proc_root);
+
     wrmsrl(rthal_nmi_perfctr_msr, 0 - RTHAL_CPU_FREQ);
     touch_nmi_watchdog();
     wmb();
@@ -215,6 +251,7 @@
         rthal_local_irq_restore(flags);
     }
 
+	wd->arm_date = rthal_rdtsc();
     wrmsrl(wd->perfctr_msr, 0 - delay);
     wmb();
     wd->armed = 1;

  parent reply	other threads:[~2006-07-09 19:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-23 20:21 [Xenomai-core] nervous nmi-watchdog Jan Kiszka
2006-06-05 16:35 ` Philippe Gerum
2006-06-05 19:06   ` Gilles Chanteperdrix
2006-06-05 19:15     ` Philippe Gerum
2006-07-09 12:50       ` Gilles Chanteperdrix
2006-07-09 16:41         ` Philippe Gerum
2006-07-09 16:56           ` Jan Kiszka
2006-07-09 17:07             ` Philippe Gerum
2006-07-09 18:13               ` Jan Kiszka
2006-07-09 19:36               ` Gilles Chanteperdrix [this message]
2006-07-10 17:28                 ` Gilles Chanteperdrix

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17585.23253.953487.892164@domain.hid \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=jan.kiszka@domain.hid \
    --cc=rpm@xenomai.org \
    --cc=xenomai@xenomai.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.