From: Philippe Gerum <rpm@xenomai.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Xenomai <xenomai@xenomai.org>
Subject: Re: Dovetail/x86 still broken /wrt exception fixups
Date: Wed, 02 Jun 2021 19:43:38 +0200 [thread overview]
Message-ID: <87bl8ogo1h.fsf@xenomai.org> (raw)
In-Reply-To: <d4d00a44-a155-663d-d6c9-7135d2beedb8@siemens.com>
Jan Kiszka <jan.kiszka@siemens.com> writes:
> On 01.06.21 23:24, Jan Kiszka via Xenomai wrote:
>> Hi Philippe,
>>
>> we are leaking the inband stall state into user land when the kernel
>> takes a fixable exception in oob. The problem is either
>> cond_disable_irqs() or its (missing?) counterpart. Where is the stall
>> bit set in handle_page_fault->cond_disable_irqs supposed to be cleared
>> again?
>>
>> I-pipe is fine in that regard, but it took us many years to get it into
>> that state - and it didn't have to deal with the impact of ca4c6a9858
>> ("x86/traps: Make interrupt enable/disable symmetric in C code") anymore...
>>
>
> A first attempt to fix the issue, but I'm only half-way through with
> understanding the related logic in dovetail:
>
> diff --git a/kernel/entry/common.c b/kernel/entry/common.c
> index 5e33248453e7..9f8c51e5f51c 100644
> --- a/kernel/entry/common.c
> +++ b/kernel/entry/common.c
> @@ -526,7 +526,8 @@ noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state)
> * irqentry_enter() raised it in order to mirror the hardware
> * state.
> */
> - if (state.stage_info & IRQENTRY_INBAND_STALLED)
> + if (state.stage_info == IRQENTRY_INBAND_STALLED ||
> + (running_inband() && state.stage_info == IRQENTRY_OOB_ENTRY))
> unstall_inband();
You can drop the check for running_inband(), this is always true at this
point.
> #endif
> return;
>
> State seems now consistent again.
>
Yes, that should cover the case described earlier.
> BTW, all those tests for bits in stage_info should likely be converted
> to testing for the state - IRQENTRY_INBAND_STALLED and IRQENTRY_OOB_ENTRY
> are mutually exclusive. Would make the code more readable.
>
Ack.
--
Philippe.
next prev parent reply other threads:[~2021-06-02 17:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-01 21:24 Dovetail/x86 still broken /wrt exception fixups Jan Kiszka
2021-06-02 15:29 ` Jan Kiszka
2021-06-02 17:43 ` Philippe Gerum [this message]
2021-06-02 16:53 ` 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=87bl8ogo1h.fsf@xenomai.org \
--to=rpm@xenomai.org \
--cc=jan.kiszka@siemens.com \
--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.