From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Romain Caritey" <Romain.Caritey@microchip.com>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Connor Davis" <connojdavis@gmail.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Michal Orzel" <michal.orzel@amd.com>,
"Julien Grall" <julien@xen.org>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Stefano Stabellini" <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v1] xen/riscv: route unhandled interrupts to do_unexpected_trap()
Date: Thu, 29 Jan 2026 17:56:11 +0100 [thread overview]
Message-ID: <d9142fd1-97db-41f7-8559-ecfc6bc68565@gmail.com> (raw)
In-Reply-To: <3b2a9dbe-fa14-43a3-a7c3-a4c1396a5c70@suse.com>
On 1/29/26 4:43 PM, Jan Beulich wrote:
> On 29.01.2026 15:40, Oleksii Kurochko wrote:
>> --- a/xen/arch/riscv/traps.c
>> +++ b/xen/arch/riscv/traps.c
>> @@ -196,6 +196,7 @@ void do_trap(struct cpu_user_regs *cpu_regs)
>> {
>> /* Handle interrupt */
>> unsigned long icause = cause & ~CAUSE_IRQ_FLAG;
>> + bool intr_handled = true;
> Of course I don't know what your further plans are here, so maybe doing
> it this way really is desirable. As the code is right now, I wonder if
> you couldn't make this a 2-line change, ...
>
>> @@ -204,10 +205,12 @@ void do_trap(struct cpu_user_regs *cpu_regs)
>> break;
> ... using return here and ...
>
>> default:
>> + intr_handled = false;
>> break;
>> }
>>
>> - break;
>> + if ( intr_handled )
>> + break;
> ... simply dropping this break altogether.
Well, your change is better but it won't apply to my current code of do_trap():
....
default:
if ( cause & CAUSE_IRQ_FLAG )
{
/* Handle interrupt */
unsigned long icause = cause & ~CAUSE_IRQ_FLAG;
bool intr_handled = true;
switch ( icause )
{
case IRQ_S_EXT:
intc_handle_external_irqs(cpu_regs);
break;
...
default:
intr_handled = false;
break;
}
if ( intr_handled )
break;
}
do_unexpected_trap(cpu_regs);
break;
}
if ( cpu_regs->hstatus & HSTATUS_SPV )
check_for_pcpu_work();
}
So if to use return instead of break here, I will miss the call of check_for_pcpu_work()
which is syncing interrupt and check if some softirq should be done:
static void check_for_pcpu_work(void)
{
ASSERT(!local_irq_is_enabled());
while ( softirq_pending(smp_processor_id()) )
{
local_irq_enable();
do_softirq();
local_irq_disable();
}
vcpu_flush_interrupts(current);
vcpu_sync_interrupts(current);
}
~ Oleksii
next prev parent reply other threads:[~2026-01-29 16:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 14:40 [PATCH v1] xen/riscv: route unhandled interrupts to do_unexpected_trap() Oleksii Kurochko
2026-01-29 15:43 ` Jan Beulich
2026-01-29 16:56 ` Oleksii Kurochko [this message]
2026-01-29 17:03 ` Jan Beulich
2026-01-29 20:28 ` Oleksii Kurochko
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=d9142fd1-97db-41f7-8559-ecfc6bc68565@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=Romain.Caritey@microchip.com \
--cc=alistair.francis@wdc.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=connojdavis@gmail.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.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.