[PATCH] xen/arm: gic-v3: Fix redistributor wakeup polling

Luca Fancellu posted 1 patch 5 days, 13 hours ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20260518070524.19813-1-luca.fancellu@arm.com
xen/arch/arm/gic-v3.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] xen/arm: gic-v3: Fix redistributor wakeup polling
Posted by Luca Fancellu 5 days, 13 hours ago
gicv3_enable_redist() clears GICR_WAKER.ProcessorSleep and then waits for
GICR_WAKER.ChildrenAsleep to clear, as required after waking a
redistributor.

However, the polling loop currently uses "while ( timeout )". Since
timeout is initially false, the loop runs only once unless the timeout
path has already been reached. As a result, Xen can continue before the
redistributor has completed wakeup.

Use an unconditional loop, matching the surrounding timeout/break pattern,
so the code polls until either ChildrenAsleep is clear or the deadline is
reached.

While there, also fix the timeout message. This path polls
GICR_WAKER.ChildrenAsleep, not an RWP bit, so "RWP timeout" is misleading.

Fixes: bc183a0235e0 ("xen/arm: Add support for GIC v3")
Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
---
 xen/arch/arm/gic-v3.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 7f365cdbe9df..bb946dc11375 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -828,11 +828,11 @@ static int gicv3_enable_redist(void)
         }
         cpu_relax();
         udelay(1);
-    } while ( timeout );
+    } while ( 1 );
 
     if ( timeout )
     {
-        dprintk(XENLOG_ERR, "GICv3: Redist enable RWP timeout\n");
+        dprintk(XENLOG_ERR, "GICv3: Redist wakeup timeout\n");
         return 1;
     }
 
-- 
2.34.1
Re: [PATCH] xen/arm: gic-v3: Fix redistributor wakeup polling
Posted by Orzel, Michal 4 days, 12 hours ago

On 18-May-26 09:05, Luca Fancellu wrote:
> gicv3_enable_redist() clears GICR_WAKER.ProcessorSleep and then waits for
> GICR_WAKER.ChildrenAsleep to clear, as required after waking a
> redistributor.
> 
> However, the polling loop currently uses "while ( timeout )". Since
> timeout is initially false, the loop runs only once unless the timeout
> path has already been reached. As a result, Xen can continue before the
> redistributor has completed wakeup.
> 
> Use an unconditional loop, matching the surrounding timeout/break pattern,
> so the code polls until either ChildrenAsleep is clear or the deadline is
> reached.
> 
> While there, also fix the timeout message. This path polls
> GICR_WAKER.ChildrenAsleep, not an RWP bit, so "RWP timeout" is misleading.
> 
> Fixes: bc183a0235e0 ("xen/arm: Add support for GIC v3")
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
Reviewed-by: Michal Orzel <michal.orzel@amd.com>

~Michal
Re: [PATCH] xen/arm: gic-v3: Fix redistributor wakeup polling
Posted by Orzel, Michal 2 days, 13 hours ago
Oleksii, can we ask for a release ack for this fix?

~Michal

On 19-May-26 09:19, Orzel, Michal wrote:
> 
> 
> On 18-May-26 09:05, Luca Fancellu wrote:
>> gicv3_enable_redist() clears GICR_WAKER.ProcessorSleep and then waits for
>> GICR_WAKER.ChildrenAsleep to clear, as required after waking a
>> redistributor.
>>
>> However, the polling loop currently uses "while ( timeout )". Since
>> timeout is initially false, the loop runs only once unless the timeout
>> path has already been reached. As a result, Xen can continue before the
>> redistributor has completed wakeup.
>>
>> Use an unconditional loop, matching the surrounding timeout/break pattern,
>> so the code polls until either ChildrenAsleep is clear or the deadline is
>> reached.
>>
>> While there, also fix the timeout message. This path polls
>> GICR_WAKER.ChildrenAsleep, not an RWP bit, so "RWP timeout" is misleading.
>>
>> Fixes: bc183a0235e0 ("xen/arm: Add support for GIC v3")
>> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> Reviewed-by: Michal Orzel <michal.orzel@amd.com>
> 
> ~Michal
> 
>
Re: [PATCH] xen/arm: gic-v3: Fix redistributor wakeup polling
Posted by Oleksii Kurochko 1 day, 13 hours ago

On 5/21/26 9:06 AM, Orzel, Michal wrote:
> Oleksii, can we ask for a release ack for this fix?
> 
> ~Michal
> 
> On 19-May-26 09:19, Orzel, Michal wrote:
>>
>>
>> On 18-May-26 09:05, Luca Fancellu wrote:
>>> gicv3_enable_redist() clears GICR_WAKER.ProcessorSleep and then waits for
>>> GICR_WAKER.ChildrenAsleep to clear, as required after waking a
>>> redistributor.
>>>
>>> However, the polling loop currently uses "while ( timeout )". Since
>>> timeout is initially false, the loop runs only once unless the timeout
>>> path has already been reached. As a result, Xen can continue before the
>>> redistributor has completed wakeup.
>>>
>>> Use an unconditional loop, matching the surrounding timeout/break pattern,
>>> so the code polls until either ChildrenAsleep is clear or the deadline is
>>> reached.
>>>
>>> While there, also fix the timeout message. This path polls
>>> GICR_WAKER.ChildrenAsleep, not an RWP bit, so "RWP timeout" is misleading.
>>>
>>> Fixes: bc183a0235e0 ("xen/arm: Add support for GIC v3")
>>> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
>> Reviewed-by: Michal Orzel <michal.orzel@amd.com>

Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Thanks.

~ Oleksii
Re: [PATCH] xen/arm: gic-v3: Fix redistributor wakeup polling
Posted by Mykola Kvach 5 days, 12 hours ago
On Mon, May 18, 2026 at 10:05 AM Luca Fancellu <luca.fancellu@arm.com> wrote:
>
> gicv3_enable_redist() clears GICR_WAKER.ProcessorSleep and then waits for
> GICR_WAKER.ChildrenAsleep to clear, as required after waking a
> redistributor.
>
> However, the polling loop currently uses "while ( timeout )". Since
> timeout is initially false, the loop runs only once unless the timeout
> path has already been reached. As a result, Xen can continue before the
> redistributor has completed wakeup.
>
> Use an unconditional loop, matching the surrounding timeout/break pattern,
> so the code polls until either ChildrenAsleep is clear or the deadline is
> reached.
>
> While there, also fix the timeout message. This path polls
> GICR_WAKER.ChildrenAsleep, not an RWP bit, so "RWP timeout" is misleading.
>
> Fixes: bc183a0235e0 ("xen/arm: Add support for GIC v3")
> Signed-off-by: Luca Fancellu <luca.fancellu@arm.com>
> ---
>  xen/arch/arm/gic-v3.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
> index 7f365cdbe9df..bb946dc11375 100644
> --- a/xen/arch/arm/gic-v3.c
> +++ b/xen/arch/arm/gic-v3.c
> @@ -828,11 +828,11 @@ static int gicv3_enable_redist(void)
>          }
>          cpu_relax();
>          udelay(1);
> -    } while ( timeout );
> +    } while ( 1 );
>
>      if ( timeout )
>      {
> -        dprintk(XENLOG_ERR, "GICv3: Redist enable RWP timeout\n");
> +        dprintk(XENLOG_ERR, "GICv3: Redist wakeup timeout\n");
>          return 1;
>      }
>
> --
> 2.34.1
>
>

Reviewed-by: Mykola Kvach <mykola_kvach@epam.com>

Best regards,
Mykola