Re: [PATCH v3 2/2] riscv: Fix text patching when IPI are used

From: Björn Töpel
Date: Tue Mar 05 2024 - 03:21:53 EST


Conor Dooley <conor.dooley@xxxxxxxxxxxxx> writes:

> On Tue, Mar 05, 2024 at 08:33:30AM +0530, Anup Patel wrote:
>> On Tue, Mar 5, 2024 at 1:54 AM Björn Töpel <bjorn@xxxxxxxxxx> wrote:
>> >
>> > Conor Dooley <conor@xxxxxxxxxx> writes:
>> >
>> > > On Thu, Feb 29, 2024 at 01:10:56PM +0100, Alexandre Ghiti wrote:
>> > >> For now, we use stop_machine() to patch the text and when we use IPIs for
>> > >> remote icache flushes (which is emitted in patch_text_nosync()), the system
>> > >> hangs.
>> > >>
>> > >> So instead, make sure every CPU executes the stop_machine() patching
>> > >> function and emit a local icache flush there.
>> > >>
>> > >> Co-developed-by: Björn Töpel <bjorn@xxxxxxxxxxxx>
>> > >> Signed-off-by: Björn Töpel <bjorn@xxxxxxxxxxxx>
>> > >> Signed-off-by: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>
>> > >> Reviewed-by: Andrea Parri <parri.andrea@xxxxxxxxx>
>> > >
>> > > What commit does this fix?
>> >
>> > Hmm. The bug is exposed when the AIA IPI are introduced, and used
>> > (instead of the firmware-based).
>> >
>> > I'm not sure this is something we'd like backported, but rather a
>> > prerequisite to AIA.
>> >
>> > @Anup @Alex WDYT?
>> >
>>
>> The current text patching never considered IPIs being injected
>> directly in S-mode from hart to another so we are seeing this
>> issue now with AIA IPIs.
>>
>> We certainly don't need to backport this fix since it's more
>> of a preparatory fix for AIA IPIs.
>
> Whether or not this is backportable, if it fixes a bug, it should get
> a Fixes: tag for the commit that it fixes. Fixes: isn't "the backport"
> tag, cc: stable is.

I guess the question is if this *is* a fix, or rather a change required
for AIA (not a fix).