public inbox for xenomai@lists.linux.dev
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Florian Bezdeka <florian.bezdeka@siemens.com>
Cc: xenomai@lists.linux.dev,  Jan Kiszka <jan.kiszka@siemens.com>
Subject: Re: [PATCH Dovetail 6.18 1/3] arm64: irq_pipeline: Fix mapping of SGI/LPI IPIs
Date: Tue, 03 Feb 2026 18:44:48 +0100	[thread overview]
Message-ID: <87ldh9iuwf.fsf@xenomai.org> (raw)
In-Reply-To: <87qzr1ivxz.fsf@xenomai.org> (Philippe Gerum's message of "Tue, 03 Feb 2026 18:22:16 +0100")

Philippe Gerum <rpm@xenomai.org> writes:

> Florian Bezdeka <florian.bezdeka@siemens.com> writes:
>
>> On Tue, 2026-02-03 at 14:08 +0100, Philippe Gerum wrote:
>>> -static inline void map_oob_ipis(int cpu)
>>> +static inline void map_oob_ipis(int cpu, int offset)
>>>  {
>>>  	int ipi;
>>>  
>>>  	for (ipi = OOB_IPI_OFFSET; ipi < OOB_NR_IPI + OOB_IPI_OFFSET; ipi++)
>>> -		get_ipi_desc(cpu, ipi) = irq_to_desc(ipi_irq_base + ipi);
>>> +		get_ipi_desc(cpu, ipi) = irq_to_desc(ipi_irq_base + cpu * offset + ipi);
>>>  }
>>
>> I'm still quite sure that the loop is wrong and should be 
>>
>> +static inline void map_oob_ipis(int cpu, int offset)
>>  {
>>         int ipi;
>>  
>> -       for (ipi = OOB_IPI_OFFSET; ipi < OOB_NR_IPI + OOB_IPI_OFFSET; ipi++)
>> -               get_ipi_desc(cpu, ipi) = irq_to_desc(ipi_irq_base + ipi);
>> +       offset = ipi_irq_base + (cpu * offset);
>> +
>> +       for (ipi = OOB_IPI_OFFSET; ipi < nr_ipi; ipi++)
>> +               get_ipi_desc(cpu, ipi) = irq_to_desc(offset + ipi);
>>  }
>>
>
> For ipi=SGI-0-7, the upstream implementation of ipi_setup_lpi() does:
>
>                 irq = ipi_irq_base + (cpu * nr_ipi) + ipi;
> 		get_ipi_desc(cpu, ipi) = irq_to_desc(irq);
>
> In pipelined mode, we need to do that for ipi=SGI0 for in-band IPIs,
> then for ipi=SGI1-3 for oob ones (see below). All members of
> ipi_msg_type become _logical_ IPIs multiplexed over SGI0. That is the
> whole point of your fix regarding CPU_BACKTRACE and KGDB_ROUNDUP.
>
>
>> instead. (Note OOB_NR_IPI + OOB_IPI_OFFSET vs. nr_ipi)
>
> The code above would map the original IPI range from SGI0-7, which we
> don't have to in pipelined mode, we only use SGI0-3 here.
>
>>
>> Example:
>>
>> static void arm64_send_ipi(const cpumask_t *mask, unsigned int nr)
>> {
>> 	unsigned int cpu;
>>
>> 	if (!percpu_ipi_descs)
>> 		__ipi_send_mask(get_ipi_desc(0, nr), mask);
>>
>> How should that work for IPI_IRQ_WORK? IPI_IRQ_WORK is located behind
>> the IPIs used for OOB and get_ipi_desc(0, IPI_IRQ_WORK) would return
>> NULL as we skipped the mapping in map_oob_ipis().
>>
>
> Any IPI from IPI_RESCHEDULE to IPI_IRQ_WORK are multiplexed over SGI0 by
> smp_cross_call(). IPI_CPU_BACKTRACE and IPI_KGDB_ROUNDUP should be as
> well, but unfortunately bypassed that routine to call into
> arm64_send_ipi() directly, which is invalid. So, if all call sites which
> want to send an in-band IPI do this remapping so that arm64_send_ipi()
> is always called with ipi=SGI0 for them, we are ok.
>
> IOW, arm64_send_ipi() can only be called for SGI0-3, i.e. one in-band
> channel over which all upstream IPIs are multiplexed, three oob IPIs the
> real-time core may use as it sees fit.
>
> I should have an Hikey Lemaker somewhere in my drawers to be excavated
> that I can reconnect to my lab. Is it the hardware which shows the issue
> in lpi mode, or is it a 960?

s/960/970/

-- 
Philippe.

  reply	other threads:[~2026-02-03 17:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02  7:55 [PATCH Dovetail 6.18 0/3] Fix IPI mapping for arm64 Florian Bezdeka
2026-02-02  7:55 ` [PATCH Dovetail 6.18 1/3] arm64: irq_pipeline: Fix mapping of SGI/LPI IPIs Florian Bezdeka
2026-02-03 13:08   ` Philippe Gerum
2026-02-03 15:25     ` Florian Bezdeka
2026-02-03 17:22       ` Philippe Gerum
2026-02-03 17:44         ` Philippe Gerum [this message]
2026-02-03 21:48         ` Florian Bezdeka
2026-02-03 22:00           ` Bezdeka, Florian
2026-02-04 11:44             ` Philippe Gerum
2026-02-04 16:46               ` Florian Bezdeka
2026-02-04 18:04                 ` Philippe Gerum
2026-02-02  7:55 ` [PATCH Dovetail 6.18 2/3] arm64: irq_pipeline: Fix size of IPI statistics array Florian Bezdeka
2026-02-03 11:59   ` Philippe Gerum
2026-02-02  7:55 ` [PATCH Dovetail 6.18 3/3] arm64: irq_pipeline: Fix IPI_KGDB_ROUNDUP and IPI_CPU_BACKTRACE IPIs Florian Bezdeka
2026-02-03 11:59   ` Philippe Gerum

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=87ldh9iuwf.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=florian.bezdeka@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=xenomai@lists.linux.dev \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox