All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>
Cc: "xenomai@xenomai.org" <xenomai@xenomai.org>
Subject: Re: [Xenomai] [PATCH] ipipe: x86: Populate vector_irq for all dispatched vectors
Date: Wed, 19 Sep 2012 17:18:06 +0200	[thread overview]
Message-ID: <5059E22E.5020606@siemens.com> (raw)
In-Reply-To: <aa526cca898247642342ebae7e01b6a0.squirrel@www.xenomai.org>

On 2012-09-19 17:02, Gilles Chanteperdrix wrote:
> 
> Jan Kiszka wrote:
>> On 2012-09-19 16:46, Gilles Chanteperdrix wrote:
>>>
>>> Jan Kiszka wrote:
>>>> On 2012-09-19 16:28, Gilles Chanteperdrix wrote:
>>>>>
>>>>> Jan Kiszka wrote:
>>>>>>  	for (vector = 0; vector < NR_VECTORS; ++vector) {
>>>>>> +		/* I-pipe requires initialized vector_irq for system vectors */
>>>>>> +		if (test_bit(vector, used_vectors))
>>>>>> +			continue;
>>>>>>  		irq = per_cpu(vector_irq, cpu)[vector];
>>>>>>  		if (irq < 0)
>>>>>>  			continue;
>>>>>
>>>>> This looks wrong to me: you are skipping a part a code that was
>>>>> setting
>>>>> to
>>>>> -1 vectors that were allocated but not used on this cpu.
>>>>
>>>> I'm skipping only used_vectors, i.e system vectors. They will be set up
>>>> for I-pipe for that well-known reason. I'm no longer skipping to clear
>>>> IRQ vectors that are not used on the current CPU
>>>> (!cpumask_test_cpu(cpu,
>>>> cfg->domain)). That is what was missing in both approaches so far.
>>>>
>>>> Note: vector_free = (vector_irq == -1) && !used_vector
>>>
>>> Let us go back to the obvious loop:
>>>
>>>>         for (vector = 0; vector < first_system_vector; ++vector) {
>>>>                 if (vector == IRQ_MOVE_CLEANUP_VECTOR)
>>>>                         continue;
>>>>
>>>>                 irq = per_cpu(vector_irq, cpu)[vector];
>>>>                 if (irq < 0)
>>>>                         continue;
>>>>
>>>>                 cfg = irq_cfg(irq);
>>>>                 if (!cpumask_test_cpu(cpu, cfg->domain))
>>>>                         per_cpu(vector_irq, cpu)[vector] = -1;
>>>>         }
>>>
>>> >From what I understand, this function is called when a CPU is started,
>>> so, for instance, with hotplug cpu, on a system that has been running
>>> for days and so had a lot of time to allocate a lot of vectors.
>>>
>>> Now, some of these vectors are known not to be needed on the cpu we
>>> are currently starting. What this loop does, is for such vectors, to
>>> set the vector_irq entry on the cpu we are currently starting to -1.
>>>
>>> Now, such vectors will certainly have the used_vectors bit to 1.
>>
>> used_vectors should be called "used_for_system_vector".
> 
> What about TLB flush vectors, are they not restricted to some cpus?

OK, let's try this step by step:

So far, the original loop ("Mark the free vectors" went over all
vectors, clearing those out in vector_irq that were filled for *external
IRQs* by the first loop ("Mark the inuse vector") but are actually not
in use on the current CPU. Linux does not fill any system vector into
vector_irq, as we know.

Now that we do enter certain system vectors here (MOVE_CLEANUP and those
above first_system_vector), we must avoid that this clearing happens for
them. My old version did this by overwriting what was cleared with that
simply 1:1 mapping again. Your version avoided any clearing for
MOVE_CLEANUP and >first_system_vector. Both were wrong as both left
vectors marked as in use which are actually free.

What we need is to still clear unused IRQ vectors, i.e. still run the
full loop, but skip used system vectors. And the latter can be achieved
by looking at used_vectors which is valid for all CPUs.

Is this clearer?

Jan

-- 
Siemens AG, Corporate Technology, CT RTC ITP SDP-DE
Corporate Competence Center Embedded Linux


  reply	other threads:[~2012-09-19 15:18 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-11 15:56 [Xenomai] ipipe/x86: kernel BUG due to missing IRQ_MOVE_CLEANUP_VECTOR entry in ipipe-core3.2 Gernot Hillier
2012-09-15 22:26 ` Gilles Chanteperdrix
2012-09-16  7:20   ` Jan Kiszka
2012-09-16  8:36     ` Philippe Gerum
2012-09-16  8:50   ` Philippe Gerum
2012-09-16 10:31     ` Gilles Chanteperdrix
2012-09-17  8:13     ` Gilles Chanteperdrix
2012-09-18 17:25       ` Jan Kiszka
2012-09-18 17:28         ` Gilles Chanteperdrix
2012-09-18 18:25           ` Jan Kiszka
2012-09-18 18:31             ` Gilles Chanteperdrix
2012-09-18 18:55               ` Jan Kiszka
2012-09-18 19:01                 ` Gilles Chanteperdrix
2012-09-18 19:10                   ` Jan Kiszka
2012-09-18 19:14                     ` Gilles Chanteperdrix
2012-09-18 19:05                 ` Gilles Chanteperdrix
2012-09-18 19:10                   ` Jan Kiszka
2012-09-18 19:12                     ` Gilles Chanteperdrix
2012-09-18 19:18                       ` Jan Kiszka
2012-09-18 19:22                         ` Gilles Chanteperdrix
2012-09-19 14:17                           ` [Xenomai] [PATCH] ipipe: x86: Populate vector_irq for all dispatched vectors Jan Kiszka
2012-09-19 14:28                             ` Gilles Chanteperdrix
2012-09-19 14:33                               ` Jan Kiszka
2012-09-19 14:46                                 ` Gilles Chanteperdrix
2012-09-19 14:48                                   ` Jan Kiszka
2012-09-19 15:02                                     ` Gilles Chanteperdrix
2012-09-19 15:18                                       ` Jan Kiszka [this message]
2012-09-19 16:09                                         ` 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=5059E22E.5020606@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=gilles.chanteperdrix@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.