All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
To: Doug Brunner <dbrunner@ebus.com>
Cc: Xenomai <Xenomai@xenomai.org>
Subject: Re: [Xenomai] Interpreting I-pipe trace
Date: Mon, 17 Sep 2012 09:01:12 +0200	[thread overview]
Message-ID: <5056CAB8.3020506@xenomai.org> (raw)
In-Reply-To: <505667A8.9040409@ebus.com>

On 09/17/2012 01:58 AM, Doug Brunner wrote:

> On 09/11/2012 02:19 PM, Gilles Chanteperdrix wrote:
>> On 09/11/2012 09:21 PM, Gilles Chanteperdrix wrote:
>>
>>> On 09/11/2012 07:01 AM, Doug Brunner wrote:
>>>
>>>> While running my latency testing earlier I saw some rather high
>>>> worst-case latencies (~70us) compared to average case (~14us), so I ran
>>>> again with I-pipe tracing enabled. However, I'm not sure what to make of
>>>> the results.
>>>>
>>>> My worst case involves an IRQ (common_interrupt appears in the trace
>>>> with user value 0xFFFFFFC4) and the wiki page talks about being able to
>>>> translate the user value 0xFFFFFFF4 into IRQ 11 but doesn't elaborate on
>>>> how this correspondence works. I'm not horribly concerned since it's a
>>>> delay of 53 us on a rather slow processor (Geode LX800) but it would be
>>>> nice to know what interrupt is taking so long.
>>>
>>> You may also want to apply the following patch for SMI on Geode LX, and
>>> enable CONFIG_XENO_HW_SMI_WORKAROUND. You can remove the '#if 0', if you
>>> do not use PCI.
>>
>> You have to pass cs5536.msr=1 to avoid using PCI registers access (which
>> use SMIs) in the IDE driver.
>>
> It doesn't appear like this patch, or using idle=poll, has any effect. I 
> tried making latency histograms with and without and they were almost 
> identical. Interestingly I don't see any output from the printk in the 
> patch, even though I have earlyprintk set up to run over my serial 
> console hookup. This persisted even when I took out the is_geode_lx() 
> check. This suggests to me that rthal_smi_init is not getting called.


Actually, after some more test, the only thing that made the difference
for me was booting with "cs5536.msr=1", as it causes the cs5536 driver
to use msrs instead of pci config register accesses and pci config
register accesses are emulated with SMIs. When doing, that there does
not seem to be any SMI on my geode, so masking the SMIs is in fact useless.

To shut other SMI off, you may try to add:
                wrmsrl(0x51000002, 0);
+               wrmsrl(0x51010002, 0);
+               wrmsrl(0x51200002, 0);
+               wrmsrl(0x51300002, 0);
+               wrmsrl(0x51400002, 0);
+               wrmsrl(0x51500002, 0);
+               wrmsrl(0x51700002, 0);

The tsc in my case is correctly configured, but if it is not correctly
configured by your bios, you can check its registers. This is all
documented in the Geode datasheet. You have to configure it so that it
does not stop when the idle task calls. You should also configure the
geode so that the geode doe not automatically go into a low power mode
when the "hlt" instruction is called (but if you boot with idle=poll,
"hlt" should never be called anyway).

In any case, the trace you posted is way to short, to actually debug a
high latencies, the trace should capture at least the timer
programmation before the tick which triggers the trace, so that you can
see what happened between the time the timer was supposed to tick and
the time when it really ticked. When you have done that, please post the
trace here, and we will try and continue the debugging.

>

> I do have CONFIG_XENO_HW_SMI_ALL set, which now that I think about it 
> seems like it should already give me the benefit of the patch. However I 
> don't see how it would stop rthal_smi_init from getting called.


This suggests a configuration issue, such as
CONFIG_XENO_HW_SMI_WORKAROUND missing. Nothing magical here.
rthal_smi_init IS called during Xenomai startup if
CONFIG_XENO_HW_SMI_WORKAROUND is enabled.

> For the benefit of my curiosity, could you explain how 0xFFFFFFC4 
> translates into a PCI related SMI?


Well, in the trace you posted, I do not see 0xFFFFFFC4, but in that case
0xFFFFFFC4 is ~0x3b, so, it corresponds to vector 3b. Now, what is
vector 3b probably depends on your setup, and probably has nothing to do
with PCI related SMI.

In any case, an SMI does not go through "common_interrupt", and SMI
jumps directly to, and is handled in BIOS code. So, it is invisible in
the I-pipe trace, except for a large hole in the time line.

-- 
                                                                Gilles.


      parent reply	other threads:[~2012-09-17  7:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11  5:01 [Xenomai] Interpreting I-pipe trace Doug Brunner
2012-09-11  7:44 ` Gilles Chanteperdrix
2012-09-11  7:48 ` Philippe Gerum
2012-09-11 19:21 ` Gilles Chanteperdrix
2012-09-11 21:19   ` Gilles Chanteperdrix
2012-09-12  6:53     ` Gilles Chanteperdrix
     [not found]     ` <505667A8.9040409@ebus.com>
2012-09-17  7:01       ` Gilles Chanteperdrix [this message]

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=5056CAB8.3020506@xenomai.org \
    --to=gilles.chanteperdrix@xenomai.org \
    --cc=Xenomai@xenomai.org \
    --cc=dbrunner@ebus.com \
    /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.