All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check
@ 2026-11-30 20:43 Mukul Joshi
  2026-11-30 21:06 ` sashiko-bot
  2026-12-01  3:22 ` Lazar, Lijo
  0 siblings, 2 replies; 8+ messages in thread
From: Mukul Joshi @ 2026-11-30 20:43 UTC (permalink / raw)
  To: amd-gfx
  Cc: Felix.Kuehling, Harish.Kasiviswanathan, philip.yang, Mukul Joshi,
	Sashiko-bot

AMDGPU_UALINK_ACCEL_STATE_ERROR sorts above every configured state, so
a local peer in the error state passes both the "pPod configured" and
"vPod configured" checks in __check_local_vpod_integrity() and is
treated as a healthy vPod member. The local vPod is then activated
around an accelerator that cannot participate.

The error state is also entered when __check_ppod_info() fails on a
configuration that already includes vPod information. Such a peer
never reaches PPOD_CONFIGURED, and its accel_id is unvalidated
firmware data that is used to index vpod.active_accel_bits without a
bounds check.

Check for the error state first, before any other state check. Fail
the integrity check if the errored peer is a member of this vPod, and
skip it otherwise. If its accel_id is out of range, its membership
cannot be determined, so treat it as a member and fail the check
rather than risk activating the vPod without it.

Fixes: 448a35158bee ("drm/amdgpu: Assign accel state based on ASP config")
Reported-by: Sashiko-bot <sashiko-bot@kernel.org>
Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
---
v1->v2:
- Ensure invalid accel_id peer fail VPOD activation.

v2->v3:
- Check error state before PPOD_CONFIGURED check.

 drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
index 0982d8455b0c..6d675c318952 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
@@ -1169,17 +1169,30 @@ static int __check_local_vpod_integrity(struct amdgpu_device *adev)
 			continue;
 
 		peer_info = peer_adev->ualink.info;
+		accel_id = peer_info->ppod.accel_id;
+		/* An errored peer's accel_id may have failed validation, in
+		 * which case its vPod membership is unknown: treat it as a
+		 * member.
+		 */
+		if (peer_info->accel_state == AMDGPU_UALINK_ACCEL_STATE_ERROR) {
+			if (accel_id >= AMDGPU_UALINK_ACCEL_MAX ||
+			    test_bit(accel_id, info->vpod.active_accel_bits)) {
+				dev_warn(adev->dev,
+					 "UALINK: integrity fail: errored peer accel_id=%u is or may be a vpod member\n",
+					 accel_id);
+				return -EINVAL;
+			}
+			continue;
+		}
 		/* peer device ppod not configured */
 		if (peer_info->accel_state <
 		    AMDGPU_UALINK_ACCEL_STATE_PPOD_CONFIGURED) {
 			dev_info(adev->dev,
 				 "UALINK: integrity EAGAIN: peer accel_id=%u not ppod-configured (accel_state=%d)\n",
-				 peer_info->ppod.accel_id,
-				 peer_info->accel_state);
+				 accel_id, peer_info->accel_state);
 			return -EAGAIN;
 		}
 
-		accel_id = peer_info->ppod.accel_id;
 		if (!test_bit(accel_id, info->vpod.active_accel_bits))
 			continue;
 		/* peer device vpod not configured */
-- 
2.56.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check
  2026-11-30 20:43 [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check Mukul Joshi
@ 2026-11-30 21:06 ` sashiko-bot
  2026-12-01  3:22 ` Lazar, Lijo
  1 sibling, 0 replies; 8+ messages in thread
From: sashiko-bot @ 2026-11-30 21:06 UTC (permalink / raw)
  To: Mukul Joshi, amd-gfx

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/amdgpu: incomplete errored peer check in
  __check_local_vpod_integrity()
--

commit afa1dfd6bced3e7e4c6a0f3810602234d791cc37
Author: Mukul Joshi <mukul.joshi@amd.com>

drm/amdgpu: reject errored peers in UALink local vPod integrity check

This commit updates __check_local_vpod_integrity() to check whether a peer
accelerator is in AMDGPU_UALINK_ACCEL_STATE_ERROR before testing its pPod
or vPod configuration states, failing the integrity check if the errored
peer has an out-of-range accel_id or is marked in vpod.active_accel_bits.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> index fa4c3d27d2720..2966e501ac120 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> @@ -1168,17 +1168,30 @@ static int __check_local_vpod_integrity(struct amdgpu_device *adev)
>  			continue;
>  
>  		peer_info = peer_adev->ualink.info;
> +		accel_id = peer_info->ppod.accel_id;
> +		/* An errored peer's accel_id may have failed validation, in
> +		 * which case its vPod membership is unknown: treat it as a
> +		 * member.
> +		 */
> +		if (peer_info->accel_state == AMDGPU_UALINK_ACCEL_STATE_ERROR) {
> +			if (accel_id >= AMDGPU_UALINK_ACCEL_MAX ||
> +			    test_bit(accel_id, info->vpod.active_accel_bits)) {
> +				dev_warn(adev->dev,
> +					 "UALINK: integrity fail: errored peer accel_id=%u is or may be a vpod member\n",
> +					 accel_id);
> +				return -EINVAL;
> +			}
> +			continue;
> +		}

[Severity: Medium]
Can an errored peer whose pPod failed __check_ppod_info() still be skipped
here when accel_id < AMDGPU_UALINK_ACCEL_MAX?

In amdgpu_ualink_info_set_accel_state(), a peer enters
AMDGPU_UALINK_ACCEL_STATE_ERROR when __check_ppod_info() fails because
ppod.size is 0 or ppod.accel_id >= ppod.size.  When info->ppod.size is
smaller than AMDGPU_UALINK_ACCEL_MAX (for example 8) and the errored peer
has an unvalidated accel_id in [info->ppod.size, AMDGPU_UALINK_ACCEL_MAX - 1]
(or ppod.size == 0 and accel_id == 0 when bit 0 is not in this vPod),
accel_id >= AMDGPU_UALINK_ACCEL_MAX and test_bit() are both false.  The loop
then skips the peer and activates the vPod even though the peer's accel_id
failed validation and its vPod membership is unknown.

Checking !__check_ppod_info(peer_adev, peer_info) instead of
accel_id >= AMDGPU_UALINK_ACCEL_MAX would catch any unvalidated pPod on an
errored peer before consulting active_accel_bits.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261130204733.533769-1-mukul.joshi@amd.com?part=1

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check
  2026-11-30 20:43 [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check Mukul Joshi
  2026-11-30 21:06 ` sashiko-bot
@ 2026-12-01  3:22 ` Lazar, Lijo
  2026-12-01 15:10   ` Joshi, Mukul
  2026-12-01 16:00   ` Kuehling, Felix
  1 sibling, 2 replies; 8+ messages in thread
From: Lazar, Lijo @ 2026-12-01  3:22 UTC (permalink / raw)
  To: Mukul Joshi, amd-gfx
  Cc: Felix.Kuehling, Harish.Kasiviswanathan, philip.yang, Sashiko-bot



On 01-Dec-26 2:13 AM, Mukul Joshi wrote:
> AMDGPU_UALINK_ACCEL_STATE_ERROR sorts above every configured state, so
> a local peer in the error state passes both the "pPod configured" and
> "vPod configured" checks in __check_local_vpod_integrity() and is
> treated as a healthy vPod member. The local vPod is then activated
> around an accelerator that cannot participate.
> 
> The error state is also entered when __check_ppod_info() fails on a
> configuration that already includes vPod information. Such a peer
> never reaches PPOD_CONFIGURED, and its accel_id is unvalidated
> firmware data that is used to index vpod.active_accel_bits without a
> bounds check.
> 
> Check for the error state first, before any other state check. Fail
> the integrity check if the errored peer is a member of this vPod, and
> skip it otherwise. If its accel_id is out of range, its membership
> cannot be determined, so treat it as a member and fail the check
> rather than risk activating the vPod without it.
> 
> Fixes: 448a35158bee ("drm/amdgpu: Assign accel state based on ASP config")
> Reported-by: Sashiko-bot <sashiko-bot@kernel.org>
> Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
> ---
> v1->v2:
> - Ensure invalid accel_id peer fail VPOD activation.
> 
> v2->v3:
> - Check error state before PPOD_CONFIGURED check.
> 
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 19 ++++++++++++++++---
>   1 file changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> index 0982d8455b0c..6d675c318952 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> @@ -1169,17 +1169,30 @@ static int __check_local_vpod_integrity(struct amdgpu_device *adev)
>   			continue;
>   
>   		peer_info = peer_adev->ualink.info;
> +		accel_id = peer_info->ppod.accel_id;
> +		/* An errored peer's accel_id may have failed validation, in
> +		 * which case its vPod membership is unknown: treat it as a
> +		 * member.
> +		 */
> +		if (peer_info->accel_state == AMDGPU_UALINK_ACCEL_STATE_ERROR) {

I don't think anything can be inferred from an accel id in error state. 
It could be part of a different vpod altogether. It's better to just 
skip it.

Thanks,
Lijo

> +			if (accel_id >= AMDGPU_UALINK_ACCEL_MAX ||
> +			    test_bit(accel_id, info->vpod.active_accel_bits)) {
> +				dev_warn(adev->dev,
> +					 "UALINK: integrity fail: errored peer accel_id=%u is or may be a vpod member\n",
> +					 accel_id);
> +				return -EINVAL;
> +			}
> +			continue;
> +		}
>   		/* peer device ppod not configured */
>   		if (peer_info->accel_state <
>   		    AMDGPU_UALINK_ACCEL_STATE_PPOD_CONFIGURED) {
>   			dev_info(adev->dev,
>   				 "UALINK: integrity EAGAIN: peer accel_id=%u not ppod-configured (accel_state=%d)\n",
> -				 peer_info->ppod.accel_id,
> -				 peer_info->accel_state);
> +				 accel_id, peer_info->accel_state);
>   			return -EAGAIN;
>   		}
>   
> -		accel_id = peer_info->ppod.accel_id;
>   		if (!test_bit(accel_id, info->vpod.active_accel_bits))
>   			continue;
>   		/* peer device vpod not configured */


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check
  2026-12-01  3:22 ` Lazar, Lijo
@ 2026-12-01 15:10   ` Joshi, Mukul
  2026-12-01 15:19     ` Lazar, Lijo
  2026-12-01 16:00   ` Kuehling, Felix
  1 sibling, 1 reply; 8+ messages in thread
From: Joshi, Mukul @ 2026-12-01 15:10 UTC (permalink / raw)
  To: Lazar, Lijo, amd-gfx@lists.freedesktop.org
  Cc: Kuehling, Felix, Kasiviswanathan, Harish, Yang, Philip,
	Sashiko-bot

AMD General

> -----Original Message-----
> From: Lazar, Lijo <Lijo.Lazar@amd.com>
> Sent: Monday, November 30, 2026 10:23 PM
> To: Joshi, Mukul <Mukul.Joshi@amd.com>; amd-gfx@lists.freedesktop.org
> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish
> <Harish.Kasiviswanathan@amd.com>; Yang, Philip <Philip.Yang@amd.com>;
> Sashiko-bot <sashiko-bot@kernel.org>
> Subject: Re: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod
> integrity check
>
>
>
> On 01-Dec-26 2:13 AM, Mukul Joshi wrote:
> > AMDGPU_UALINK_ACCEL_STATE_ERROR sorts above every configured state,
> so
> > a local peer in the error state passes both the "pPod configured" and
> > "vPod configured" checks in __check_local_vpod_integrity() and is
> > treated as a healthy vPod member. The local vPod is then activated
> > around an accelerator that cannot participate.
> >
> > The error state is also entered when __check_ppod_info() fails on a
> > configuration that already includes vPod information. Such a peer
> > never reaches PPOD_CONFIGURED, and its accel_id is unvalidated
> > firmware data that is used to index vpod.active_accel_bits without a
> > bounds check.
> >
> > Check for the error state first, before any other state check. Fail
> > the integrity check if the errored peer is a member of this vPod, and
> > skip it otherwise. If its accel_id is out of range, its membership
> > cannot be determined, so treat it as a member and fail the check
> > rather than risk activating the vPod without it.
> >
> > Fixes: 448a35158bee ("drm/amdgpu: Assign accel state based on ASP
> > config")
> > Reported-by: Sashiko-bot <sashiko-bot@kernel.org>
> > Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
> > ---
> > v1->v2:
> > - Ensure invalid accel_id peer fail VPOD activation.
> >
> > v2->v3:
> > - Check error state before PPOD_CONFIGURED check.
> >
> >   drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 19
> ++++++++++++++++---
> >   1 file changed, 16 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> > b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> > index 0982d8455b0c..6d675c318952 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> > @@ -1169,17 +1169,30 @@ static int __check_local_vpod_integrity(struct
> amdgpu_device *adev)
> >                     continue;
> >
> >             peer_info = peer_adev->ualink.info;
> > +           accel_id = peer_info->ppod.accel_id;
> > +           /* An errored peer's accel_id may have failed validation, in
> > +            * which case its vPod membership is unknown: treat it as a
> > +            * member.
> > +            */
> > +           if (peer_info->accel_state ==
> AMDGPU_UALINK_ACCEL_STATE_ERROR) {
>
> I don't think anything can be inferred from an accel id in error state.
> It could be part of a different vpod altogether. It's better to just skip it.
>
I would prefer to let the administrators know that there is something wrong in your config rather than silently ignore/skip that
Accelerator.
Unfortunately, failing the VPOD config with an errored accelerator is the cleanest way to let administrator know that
something is wrong in the configuration.

I agree that if accel_id > = 256 would fail the VPOD config for another VPOD but I don't see how to avoid that.

Regards,
Mukul


> Thanks,
> Lijo
>
> > +                   if (accel_id >= AMDGPU_UALINK_ACCEL_MAX ||
> > +                       test_bit(accel_id, info->vpod.active_accel_bits)) {
> > +                           dev_warn(adev->dev,
> > +                                    "UALINK: integrity fail: errored peer
> accel_id=%u is or may be a vpod member\n",
> > +                                    accel_id);
> > +                           return -EINVAL;
> > +                   }
> > +                   continue;
> > +           }
> >             /* peer device ppod not configured */
> >             if (peer_info->accel_state <
> >                 AMDGPU_UALINK_ACCEL_STATE_PPOD_CONFIGURED) {
> >                     dev_info(adev->dev,
> >                              "UALINK: integrity EAGAIN: peer accel_id=%u
> not ppod-configured (accel_state=%d)\n",
> > -                            peer_info->ppod.accel_id,
> > -                            peer_info->accel_state);
> > +                            accel_id, peer_info->accel_state);
> >                     return -EAGAIN;
> >             }
> >
> > -           accel_id = peer_info->ppod.accel_id;
> >             if (!test_bit(accel_id, info->vpod.active_accel_bits))
> >                     continue;
> >             /* peer device vpod not configured */


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check
  2026-12-01 15:10   ` Joshi, Mukul
@ 2026-12-01 15:19     ` Lazar, Lijo
  2026-12-01 15:41       ` Joshi, Mukul
  0 siblings, 1 reply; 8+ messages in thread
From: Lazar, Lijo @ 2026-12-01 15:19 UTC (permalink / raw)
  To: Joshi, Mukul, amd-gfx@lists.freedesktop.org
  Cc: Kuehling, Felix, Kasiviswanathan, Harish, Yang, Philip,
	Sashiko-bot



On 01-Dec-26 8:40 PM, Joshi, Mukul wrote:
> AMD General
> 
>> -----Original Message-----
>> From: Lazar, Lijo <Lijo.Lazar@amd.com>
>> Sent: Monday, November 30, 2026 10:23 PM
>> To: Joshi, Mukul <Mukul.Joshi@amd.com>; amd-gfx@lists.freedesktop.org
>> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish
>> <Harish.Kasiviswanathan@amd.com>; Yang, Philip <Philip.Yang@amd.com>;
>> Sashiko-bot <sashiko-bot@kernel.org>
>> Subject: Re: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod
>> integrity check
>>
>>
>>
>> On 01-Dec-26 2:13 AM, Mukul Joshi wrote:
>>> AMDGPU_UALINK_ACCEL_STATE_ERROR sorts above every configured state,
>> so
>>> a local peer in the error state passes both the "pPod configured" and
>>> "vPod configured" checks in __check_local_vpod_integrity() and is
>>> treated as a healthy vPod member. The local vPod is then activated
>>> around an accelerator that cannot participate.
>>>
>>> The error state is also entered when __check_ppod_info() fails on a
>>> configuration that already includes vPod information. Such a peer
>>> never reaches PPOD_CONFIGURED, and its accel_id is unvalidated
>>> firmware data that is used to index vpod.active_accel_bits without a
>>> bounds check.
>>>
>>> Check for the error state first, before any other state check. Fail
>>> the integrity check if the errored peer is a member of this vPod, and
>>> skip it otherwise. If its accel_id is out of range, its membership
>>> cannot be determined, so treat it as a member and fail the check
>>> rather than risk activating the vPod without it.
>>>
>>> Fixes: 448a35158bee ("drm/amdgpu: Assign accel state based on ASP
>>> config")
>>> Reported-by: Sashiko-bot <sashiko-bot@kernel.org>
>>> Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
>>> ---
>>> v1->v2:
>>> - Ensure invalid accel_id peer fail VPOD activation.
>>>
>>> v2->v3:
>>> - Check error state before PPOD_CONFIGURED check.
>>>
>>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 19
>> ++++++++++++++++---
>>>    1 file changed, 16 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
>>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
>>> index 0982d8455b0c..6d675c318952 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
>>> @@ -1169,17 +1169,30 @@ static int __check_local_vpod_integrity(struct
>> amdgpu_device *adev)
>>>                      continue;
>>>
>>>              peer_info = peer_adev->ualink.info;
>>> +           accel_id = peer_info->ppod.accel_id;
>>> +           /* An errored peer's accel_id may have failed validation, in
>>> +            * which case its vPod membership is unknown: treat it as a
>>> +            * member.
>>> +            */
>>> +           if (peer_info->accel_state ==
>> AMDGPU_UALINK_ACCEL_STATE_ERROR) {
>>
>> I don't think anything can be inferred from an accel id in error state.
>> It could be part of a different vpod altogether. It's better to just skip it.
>>
> I would prefer to let the administrators know that there is something wrong in your config rather than silently ignore/skip that
> Accelerator.
> Unfortunately, failing the VPOD config with an errored accelerator is the cleanest way to let administrator know that
> something is wrong in the configuration.
> 
> I agree that if accel_id > = 256 would fail the VPOD config for another VPOD but I don't see how to avoid that.
> 

The notification is already there when an accelerator is put to error state.

Thanks,
Lijo


> Regards,
> Mukul
> 
> 
>> Thanks,
>> Lijo
>>
>>> +                   if (accel_id >= AMDGPU_UALINK_ACCEL_MAX ||
>>> +                       test_bit(accel_id, info->vpod.active_accel_bits)) {
>>> +                           dev_warn(adev->dev,
>>> +                                    "UALINK: integrity fail: errored peer
>> accel_id=%u is or may be a vpod member\n",
>>> +                                    accel_id);
>>> +                           return -EINVAL;
>>> +                   }
>>> +                   continue;
>>> +           }
>>>              /* peer device ppod not configured */
>>>              if (peer_info->accel_state <
>>>                  AMDGPU_UALINK_ACCEL_STATE_PPOD_CONFIGURED) {
>>>                      dev_info(adev->dev,
>>>                               "UALINK: integrity EAGAIN: peer accel_id=%u
>> not ppod-configured (accel_state=%d)\n",
>>> -                            peer_info->ppod.accel_id,
>>> -                            peer_info->accel_state);
>>> +                            accel_id, peer_info->accel_state);
>>>                      return -EAGAIN;
>>>              }
>>>
>>> -           accel_id = peer_info->ppod.accel_id;
>>>              if (!test_bit(accel_id, info->vpod.active_accel_bits))
>>>                      continue;
>>>              /* peer device vpod not configured */
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check
  2026-12-01 15:19     ` Lazar, Lijo
@ 2026-12-01 15:41       ` Joshi, Mukul
  0 siblings, 0 replies; 8+ messages in thread
From: Joshi, Mukul @ 2026-12-01 15:41 UTC (permalink / raw)
  To: Lazar, Lijo, amd-gfx@lists.freedesktop.org
  Cc: Kuehling, Felix, Kasiviswanathan, Harish, Yang, Philip,
	Sashiko-bot

AMD General

> -----Original Message-----
> From: Lazar, Lijo <Lijo.Lazar@amd.com>
> Sent: Tuesday, December 1, 2026 10:20 AM
> To: Joshi, Mukul <Mukul.Joshi@amd.com>; amd-gfx@lists.freedesktop.org
> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish
> <Harish.Kasiviswanathan@amd.com>; Yang, Philip <Philip.Yang@amd.com>;
> Sashiko-bot <sashiko-bot@kernel.org>
> Subject: Re: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod
> integrity check
>
>
>
> On 01-Dec-26 8:40 PM, Joshi, Mukul wrote:
> > AMD General
> >
> >> -----Original Message-----
> >> From: Lazar, Lijo <Lijo.Lazar@amd.com>
> >> Sent: Monday, November 30, 2026 10:23 PM
> >> To: Joshi, Mukul <Mukul.Joshi@amd.com>; amd-gfx@lists.freedesktop.org
> >> Cc: Kuehling, Felix <Felix.Kuehling@amd.com>; Kasiviswanathan, Harish
> >> <Harish.Kasiviswanathan@amd.com>; Yang, Philip
> <Philip.Yang@amd.com>;
> >> Sashiko-bot <sashiko-bot@kernel.org>
> >> Subject: Re: [PATCHv3] drm/amdgpu: reject errored peers in UALink
> >> local vPod integrity check
> >>
> >>
> >>
> >> On 01-Dec-26 2:13 AM, Mukul Joshi wrote:
> >>> AMDGPU_UALINK_ACCEL_STATE_ERROR sorts above every configured
> state,
> >> so
> >>> a local peer in the error state passes both the "pPod configured"
> >>> and "vPod configured" checks in __check_local_vpod_integrity() and
> >>> is treated as a healthy vPod member. The local vPod is then
> >>> activated around an accelerator that cannot participate.
> >>>
> >>> The error state is also entered when __check_ppod_info() fails on a
> >>> configuration that already includes vPod information. Such a peer
> >>> never reaches PPOD_CONFIGURED, and its accel_id is unvalidated
> >>> firmware data that is used to index vpod.active_accel_bits without a
> >>> bounds check.
> >>>
> >>> Check for the error state first, before any other state check. Fail
> >>> the integrity check if the errored peer is a member of this vPod,
> >>> and skip it otherwise. If its accel_id is out of range, its
> >>> membership cannot be determined, so treat it as a member and fail
> >>> the check rather than risk activating the vPod without it.
> >>>
> >>> Fixes: 448a35158bee ("drm/amdgpu: Assign accel state based on ASP
> >>> config")
> >>> Reported-by: Sashiko-bot <sashiko-bot@kernel.org>
> >>> Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
> >>> ---
> >>> v1->v2:
> >>> - Ensure invalid accel_id peer fail VPOD activation.
> >>>
> >>> v2->v3:
> >>> - Check error state before PPOD_CONFIGURED check.
> >>>
> >>>    drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 19
> >> ++++++++++++++++---
> >>>    1 file changed, 16 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> >>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> >>> index 0982d8455b0c..6d675c318952 100644
> >>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> >>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
> >>> @@ -1169,17 +1169,30 @@ static int
> >>> __check_local_vpod_integrity(struct
> >> amdgpu_device *adev)
> >>>                      continue;
> >>>
> >>>              peer_info = peer_adev->ualink.info;
> >>> +           accel_id = peer_info->ppod.accel_id;
> >>> +           /* An errored peer's accel_id may have failed validation, in
> >>> +            * which case its vPod membership is unknown: treat it as a
> >>> +            * member.
> >>> +            */
> >>> +           if (peer_info->accel_state ==
> >> AMDGPU_UALINK_ACCEL_STATE_ERROR) {
> >>
> >> I don't think anything can be inferred from an accel id in error state.
> >> It could be part of a different vpod altogether. It's better to just skip it.
> >>
> > I would prefer to let the administrators know that there is something
> > wrong in your config rather than silently ignore/skip that Accelerator.
> > Unfortunately, failing the VPOD config with an errored accelerator is
> > the cleanest way to let administrator know that something is wrong in the
> configuration.
> >
> > I agree that if accel_id > = 256 would fail the VPOD config for another VPOD
> but I don't see how to avoid that.
> >
>
> The notification is already there when an accelerator is put to error state.
>
Its just a notification which can be missed. An accelerator state not in READY
cannot be missed because it wouldn't let a workload run.
From an administrator point of view, silent ignore is not preferable.

Regards,
Mukul

> Thanks,
> Lijo
>
>
> > Regards,
> > Mukul
> >
> >
> >> Thanks,
> >> Lijo
> >>
> >>> +                   if (accel_id >= AMDGPU_UALINK_ACCEL_MAX ||
> >>> +                       test_bit(accel_id, info->vpod.active_accel_bits)) {
> >>> +                           dev_warn(adev->dev,
> >>> +                                    "UALINK: integrity fail:
> >>> + errored peer
> >> accel_id=%u is or may be a vpod member\n",
> >>> +                                    accel_id);
> >>> +                           return -EINVAL;
> >>> +                   }
> >>> +                   continue;
> >>> +           }
> >>>              /* peer device ppod not configured */
> >>>              if (peer_info->accel_state <
> >>>                  AMDGPU_UALINK_ACCEL_STATE_PPOD_CONFIGURED) {
> >>>                      dev_info(adev->dev,
> >>>                               "UALINK: integrity EAGAIN: peer
> >>> accel_id=%u
> >> not ppod-configured (accel_state=%d)\n",
> >>> -                            peer_info->ppod.accel_id,
> >>> -                            peer_info->accel_state);
> >>> +                            accel_id, peer_info->accel_state);
> >>>                      return -EAGAIN;
> >>>              }
> >>>
> >>> -           accel_id = peer_info->ppod.accel_id;
> >>>              if (!test_bit(accel_id, info->vpod.active_accel_bits))
> >>>                      continue;
> >>>              /* peer device vpod not configured */
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check
  2026-12-01  3:22 ` Lazar, Lijo
  2026-12-01 15:10   ` Joshi, Mukul
@ 2026-12-01 16:00   ` Kuehling, Felix
  2026-12-01 16:38     ` Lazar, Lijo
  1 sibling, 1 reply; 8+ messages in thread
From: Kuehling, Felix @ 2026-12-01 16:00 UTC (permalink / raw)
  To: Lazar, Lijo, Mukul Joshi, amd-gfx
  Cc: Harish.Kasiviswanathan, philip.yang, Sashiko-bot


On 2026-11-30 22:22, Lazar, Lijo wrote:
>
>
> On 01-Dec-26 2:13 AM, Mukul Joshi wrote:
>> AMDGPU_UALINK_ACCEL_STATE_ERROR sorts above every configured state, so
>> a local peer in the error state passes both the "pPod configured" and
>> "vPod configured" checks in __check_local_vpod_integrity() and is
>> treated as a healthy vPod member. The local vPod is then activated
>> around an accelerator that cannot participate.
>>
>> The error state is also entered when __check_ppod_info() fails on a
>> configuration that already includes vPod information. Such a peer
>> never reaches PPOD_CONFIGURED, and its accel_id is unvalidated
>> firmware data that is used to index vpod.active_accel_bits without a
>> bounds check.
>>
>> Check for the error state first, before any other state check. Fail
>> the integrity check if the errored peer is a member of this vPod, and
>> skip it otherwise. If its accel_id is out of range, its membership
>> cannot be determined, so treat it as a member and fail the check
>> rather than risk activating the vPod without it.
>>
>> Fixes: 448a35158bee ("drm/amdgpu: Assign accel state based on ASP 
>> config")
>> Reported-by: Sashiko-bot <sashiko-bot@kernel.org>
>> Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
>> ---
>> v1->v2:
>> - Ensure invalid accel_id peer fail VPOD activation.
>>
>> v2->v3:
>> - Check error state before PPOD_CONFIGURED check.
>>
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 19 ++++++++++++++++---
>>   1 file changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c 
>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
>> index 0982d8455b0c..6d675c318952 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
>> @@ -1169,17 +1169,30 @@ static int 
>> __check_local_vpod_integrity(struct amdgpu_device *adev)
>>               continue;
>>             peer_info = peer_adev->ualink.info;
>> +        accel_id = peer_info->ppod.accel_id;
>> +        /* An errored peer's accel_id may have failed validation, in
>> +         * which case its vPod membership is unknown: treat it as a
>> +         * member.
>> +         */
>> +        if (peer_info->accel_state == 
>> AMDGPU_UALINK_ACCEL_STATE_ERROR) {
>
> I don't think anything can be inferred from an accel id in error 
> state. It could be part of a different vpod altogether. It's better to 
> just skip it.

We also fail if any GPU is not at least in PPOD CONFIGURED state just 
below. Failing if any GPU is in an error state would be consistent with 
that. We require that the PPOD is correctly configured for all GPUs 
before we allow any VPOD to be enabled.

If we don't like that requirement, we can relax it. But that's outside 
the scope of this patch.

Regards,
   Felix


>
> Thanks,
> Lijo
>
>> +            if (accel_id >= AMDGPU_UALINK_ACCEL_MAX ||
>> +                test_bit(accel_id, info->vpod.active_accel_bits)) {
>> +                dev_warn(adev->dev,
>> +                     "UALINK: integrity fail: errored peer 
>> accel_id=%u is or may be a vpod member\n",
>> +                     accel_id);
>> +                return -EINVAL;
>> +            }
>> +            continue;
>> +        }
>>           /* peer device ppod not configured */
>>           if (peer_info->accel_state <
>>               AMDGPU_UALINK_ACCEL_STATE_PPOD_CONFIGURED) {
>>               dev_info(adev->dev,
>>                    "UALINK: integrity EAGAIN: peer accel_id=%u not 
>> ppod-configured (accel_state=%d)\n",
>> -                 peer_info->ppod.accel_id,
>> -                 peer_info->accel_state);
>> +                 accel_id, peer_info->accel_state);
>>               return -EAGAIN;
>>           }
>>   -        accel_id = peer_info->ppod.accel_id;
>>           if (!test_bit(accel_id, info->vpod.active_accel_bits))
>>               continue;
>>           /* peer device vpod not configured */
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check
  2026-12-01 16:00   ` Kuehling, Felix
@ 2026-12-01 16:38     ` Lazar, Lijo
  0 siblings, 0 replies; 8+ messages in thread
From: Lazar, Lijo @ 2026-12-01 16:38 UTC (permalink / raw)
  To: Kuehling, Felix, Mukul Joshi, amd-gfx
  Cc: Harish.Kasiviswanathan, philip.yang, Sashiko-bot



On 01-Dec-26 9:30 PM, Kuehling, Felix wrote:
> 
> On 2026-11-30 22:22, Lazar, Lijo wrote:
>>
>>
>> On 01-Dec-26 2:13 AM, Mukul Joshi wrote:
>>> AMDGPU_UALINK_ACCEL_STATE_ERROR sorts above every configured state, so
>>> a local peer in the error state passes both the "pPod configured" and
>>> "vPod configured" checks in __check_local_vpod_integrity() and is
>>> treated as a healthy vPod member. The local vPod is then activated
>>> around an accelerator that cannot participate.
>>>
>>> The error state is also entered when __check_ppod_info() fails on a
>>> configuration that already includes vPod information. Such a peer
>>> never reaches PPOD_CONFIGURED, and its accel_id is unvalidated
>>> firmware data that is used to index vpod.active_accel_bits without a
>>> bounds check.
>>>
>>> Check for the error state first, before any other state check. Fail
>>> the integrity check if the errored peer is a member of this vPod, and
>>> skip it otherwise. If its accel_id is out of range, its membership
>>> cannot be determined, so treat it as a member and fail the check
>>> rather than risk activating the vPod without it.
>>>
>>> Fixes: 448a35158bee ("drm/amdgpu: Assign accel state based on ASP 
>>> config")
>>> Reported-by: Sashiko-bot <sashiko-bot@kernel.org>
>>> Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
>>> ---
>>> v1->v2:
>>> - Ensure invalid accel_id peer fail VPOD activation.
>>>
>>> v2->v3:
>>> - Check error state before PPOD_CONFIGURED check.
>>>
>>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c | 19 ++++++++++++++++---
>>>   1 file changed, 16 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c b/drivers/ 
>>> gpu/drm/amd/amdgpu/amdgpu_ualink.c
>>> index 0982d8455b0c..6d675c318952 100644
>>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
>>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ualink.c
>>> @@ -1169,17 +1169,30 @@ static int 
>>> __check_local_vpod_integrity(struct amdgpu_device *adev)
>>>               continue;
>>>             peer_info = peer_adev->ualink.info;
>>> +        accel_id = peer_info->ppod.accel_id;
>>> +        /* An errored peer's accel_id may have failed validation, in
>>> +         * which case its vPod membership is unknown: treat it as a
>>> +         * member.
>>> +         */
>>> +        if (peer_info->accel_state == 
>>> AMDGPU_UALINK_ACCEL_STATE_ERROR) {
>>
>> I don't think anything can be inferred from an accel id in error 
>> state. It could be part of a different vpod altogether. It's better to 
>> just skip it.
> 
> We also fail if any GPU is not at least in PPOD CONFIGURED state just 
> below. Failing if any GPU is in an error state would be consistent with 
> that. We require that the PPOD is correctly configured for all GPUs 
> before we allow any VPOD to be enabled.
> 

For any GPU not having PPOD configured is not considered a real error. 
It's tried again later.

The checked conditions in this code -
A device not having a valid accelerator id. This should be a PPOD 
admissibility check and not part of VPOD integrity check.

The second check - Trying to exclude a device in error state which is 
part of vpod and in error state.

The error could have happened while trying to remove that device (in 
update config handler). I think that also shouldn't be in vpod integrity 
check.

Thanks,
Lijo


> If we don't like that requirement, we can relax it. But that's outside 
> the scope of this patch.
> 
> Regards,
>    Felix
> 
> 
>>
>> Thanks,
>> Lijo
>>
>>> +            if (accel_id >= AMDGPU_UALINK_ACCEL_MAX ||
>>> +                test_bit(accel_id, info->vpod.active_accel_bits)) {
>>> +                dev_warn(adev->dev,
>>> +                     "UALINK: integrity fail: errored peer 
>>> accel_id=%u is or may be a vpod member\n",
>>> +                     accel_id);
>>> +                return -EINVAL;
>>> +            }
>>> +            continue;
>>> +        }
>>>           /* peer device ppod not configured */
>>>           if (peer_info->accel_state <
>>>               AMDGPU_UALINK_ACCEL_STATE_PPOD_CONFIGURED) {
>>>               dev_info(adev->dev,
>>>                    "UALINK: integrity EAGAIN: peer accel_id=%u not 
>>> ppod-configured (accel_state=%d)\n",
>>> -                 peer_info->ppod.accel_id,
>>> -                 peer_info->accel_state);
>>> +                 accel_id, peer_info->accel_state);
>>>               return -EAGAIN;
>>>           }
>>>   -        accel_id = peer_info->ppod.accel_id;
>>>           if (!test_bit(accel_id, info->vpod.active_accel_bits))
>>>               continue;
>>>           /* peer device vpod not configured */
>>


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-12-01 16:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 20:43 [PATCHv3] drm/amdgpu: reject errored peers in UALink local vPod integrity check Mukul Joshi
2026-11-30 21:06 ` sashiko-bot
2026-12-01  3:22 ` Lazar, Lijo
2026-12-01 15:10   ` Joshi, Mukul
2026-12-01 15:19     ` Lazar, Lijo
2026-12-01 15:41       ` Joshi, Mukul
2026-12-01 16:00   ` Kuehling, Felix
2026-12-01 16:38     ` Lazar, Lijo

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.