All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Florian Bezdeka <florian.bezdeka@siemens.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,  Xenomai <xenomai@lists.linux.dev>
Subject: Re: [PATCH] dovetail: Fix interrupt re-enabling after hibernation
Date: Mon, 24 Mar 2025 15:19:43 +0100	[thread overview]
Message-ID: <87ikny7bpc.fsf@xenomai.org> (raw)
In-Reply-To: <6523189779e8b26ef3f8829de0835b1bbeab8b1c.camel@siemens.com> (Florian Bezdeka's message of "Mon, 24 Mar 2025 12:18:57 +0100")

Florian Bezdeka <florian.bezdeka@siemens.com> writes:

> On Thu, 2025-03-20 at 17:41 +0100, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>> 
>> We had unbalanced hard_cond_local_irq_disable here so far.
>> 
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>> 
>> Minus one hunk that is already in current 6.12.y, this needs to be 
>> applied to older stable versions as well.
>> 
>>  kernel/power/hibernate.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c
>> index 733b1a196f09e..e1c05f276a453 100644
>> --- a/kernel/power/hibernate.c
>> +++ b/kernel/power/hibernate.c
>> @@ -352,6 +352,7 @@ static int create_image(int platform_mode)
>>  	syscore_resume();
>>  
>>   Enable_irqs:
>> +	hard_cond_local_irq_enable();
>>  	system_state = SYSTEM_RUNNING;
>>  	local_irq_enable();
>
> General question about ordering here:
>
> The order hard_cond_local_irq_enable() followed by local_irq_enable()
> seems wrong to me. We enable hard irqs first, then we unstall the
> inband stage.
>
> That means that an hard irq might arrive and will end up in the IRQ
> log, which is not processed by local_irq_enable(), so we are delaying
> the IRQ processing to an unknown later time.
>

We are not delaying any IRQ, the implementation would just log any
incoming IRQ into the log, until __inband_irq_enable() eventually
disables them the hard way to check the log content, calling
sync_current_irq_stage() if any is to be played back.

> The other way around would make more sense to me. Is my understanding
> right?
>

Nope. The proper ordering is _always_ hard_local_irq_enable() _then_
local_irq_enable. There is also an historical reason for this (see
comment in inband_irq_enable()).

-- 
Philippe.

  parent reply	other threads:[~2025-03-24 14:19 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-20 16:41 [PATCH] dovetail: Fix interrupt re-enabling after hibernation Jan Kiszka
2025-03-20 16:50 ` Florian Bezdeka
2025-03-20 17:04   ` Jan Kiszka
2025-03-20 18:49     ` Philippe Gerum
2025-03-20 18:51   ` Philippe Gerum
2025-03-21  7:51 ` Philippe Gerum
2025-03-21 12:51   ` Florian Bezdeka
2025-03-21 13:31     ` Philippe Gerum
2025-03-21 13:35       ` Philippe Gerum
2025-03-21 13:51         ` Philippe Gerum
2025-03-24 17:18           ` Jan Kiszka
2025-03-24 11:18 ` Florian Bezdeka
2025-03-24 11:21   ` Jan Kiszka
2025-03-24 14:19   ` Philippe Gerum [this message]
2025-03-24 20:05     ` Florian Bezdeka

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=87ikny7bpc.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 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.