Skip to content

[PMON HLD] update get_reboot_cause mechanism and add get_midplane_dow… - #2385

Merged
vvolam merged 6 commits into
sonic-net:masterfrom
chartsai-nvidia:chartsai/pmon-hld-update
Aug 25, 2026
Merged

[PMON HLD] update get_reboot_cause mechanism and add get_midplane_dow…#2385
vvolam merged 6 commits into
sonic-net:masterfrom
chartsai-nvidia:chartsai/pmon-hld-update

Conversation

@chartsai-nvidia

@chartsai-nvidia chartsai-nvidia commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Why I did it

Refines the SmartSwitch PMON HLD for DPU reboot-cause and midplane-down handling:

  • The old design assumed the NPU could read a DPU reboot-cause while the DPU was dead, triggered
    only by an offline→online transition. Now the cause is captured only when the midplane is online,
    using a per-boot boot_id so chassisd reliably detects a real DPU reboot.
  • Adds a get_midplane_down_reason() platform API and documents planned vs. unplanned midplane-down
    reasons.
Work item tracking
  • Microsoft ADO (number only): N/A

How I did it

  • Reworked the DPU Reboot Cause flow around boot_id: the DPU publishes a fresh per-boot UUID into
    CHASSIS_STATE_DB; the NPU chassisd compares it to the last persisted value and calls
    get_reboot_cause() only on a real reboot with midplane up.
  • Added boot_id to the REBOOT_CAUSE and DPU_STATE schema examples.
  • Documented up→down midplane handling (planned via transition flag vs. unplanned via
    get_midplane_down_reason()) and added the new API definition.

How to verify it

Repo PR Title / Link Status
sonic-platform-daemons [chassisd] Capture DPU reboot cause via boot_id and add midplane-down reason for Smart Switch PR State
sonic-host-services [process-reboot-cause] Save boot_id and device fields for DPU reboot cause PR State
sonic-platform-common [ModuleBase] Add get_midplane_down_reason() API and MIDPLANE_DOWN_REASON_* constants PR State
sonic-buildimage [Mellanox] Implement get_midplane_down_reason for DPU module PR State

Merge Dependencies

(sonic-platform-common + sonic-buildimage) ──► sonic-platform-daemons
sonic-host-services: independent
  • sonic-platform-common defines the platform API, and sonic-buildimage implements it for Mellanox.
  • sonic-platform-daemons consumes the API, captures DPU reboot causes, and persists the records.
  • sonic-host-services restores persisted records into CHASSIS_STATE_DB during boot. It has no merge dependency on the other changes.

…n_reason

The commit updates 2 main parts:
- when to run get_reboot_cause
- get_midplane_down_reason

Signed-off-by: Charles Tsai <chartsai@nvidia.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

dgsudharsan
dgsudharsan previously approved these changes Jun 12, 2026
gpunathilell
gpunathilell previously approved these changes Jun 22, 2026
Comment thread doc/smart-switch/pmon/smartswitch-pmon.md Outdated
@liat-grozovik

Copy link
Copy Markdown
Collaborator

@vvolam any further comments or this HLD can be approved and merged?
BTW you are welcome to review the code PRs as well as we wish to move forward with the merge process.

@vvolam

vvolam commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

@vvolam any further comments or this HLD can be approved and merged? BTW you are welcome to review the code PRs as well as we wish to move forward with the merge process.

@liat-grozovik In between the review. I will approve this week, if no further comments.

Comment thread doc/smart-switch/pmon/smartswitch-pmon.md Outdated
| 0.4 | 06/06/2024 | Ramesh Raghupathy | Added schema for DPU health-info and called out phase:1 and phase:2 activities for DPU health-info. Added key suffix to module reboot-cause to avoid key conflicts |
| 0.5 | 04/30/2025 | Gagan Punathil Ellath | Added Post Startup and Pre shutdown sections for DPU |
| 0.6 | 06/12/2025 | Gagan Punathil Ellath | DPU State Management Implementation |
| 0.7 | 06/11/2026 | Charles Tsai | Updated DPU reboot-cause and midplane-down reason |

@rameshraghupathy rameshraghupathy Jul 15, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chartsai-nvidia What is the rationale for this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change updates the HLD to reflect the addition of the new reboot cause mechanism and get_midplane_down_reason() API. The version number is updated accordingly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chartsai-nvidia The question was why are we changing the existing behavior of capturing and reporting the reboot-cause of DPUs even when the DPUs are down, which was done intentionally in the existing implementation to help debug DPU failure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rameshraghupathy This was already discussed in the platform meeting, we need to make sure that the behavior is aligned to the switch side, we do not want 2 reboot causes for each DPU reboots (->offline->Online) . That is why the get_midplane_down_reason() is being added newly so that the platform can still provide additional info to help debug DPU failure. Do you want this to be explicitly recorded?

@chartsai-nvidia
chartsai-nvidia dismissed stale reviews from gpunathilell and dgsudharsan via 95bf3bc July 16, 2026 21:21
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@vvolam

vvolam commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

@chartsai-nvidia Please fix DCO issue by amending your signoff to all commits.

Signed-off-by: Charles Tsai <chartsai@nvidia.com>
@chartsai-nvidia
chartsai-nvidia force-pushed the chartsai/pmon-hld-update branch from 95bf3bc to 761566a Compare July 17, 2026 21:53
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@chartsai-nvidia

Copy link
Copy Markdown
Contributor Author

@chartsai-nvidia Please fix DCO issue by amending your signoff to all commits.

Done. Thanks

Comment thread doc/smart-switch/pmon/smartswitch-pmon.md
Comment thread doc/smart-switch/pmon/smartswitch-pmon.md Outdated

@vvolam vvolam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a small nit. @rameshraghupathy @seveerap79 do you have comments?

Comment thread doc/smart-switch/pmon/smartswitch-pmon.md Outdated
| 0.4 | 06/06/2024 | Ramesh Raghupathy | Added schema for DPU health-info and called out phase:1 and phase:2 activities for DPU health-info. Added key suffix to module reboot-cause to avoid key conflicts |
| 0.5 | 04/30/2025 | Gagan Punathil Ellath | Added Post Startup and Pre shutdown sections for DPU |
| 0.6 | 06/12/2025 | Gagan Punathil Ellath | DPU State Management Implementation |
| 0.7 | 06/11/2026 | Charles Tsai | Updated DPU reboot-cause and midplane-down reason |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chartsai-nvidia The question was why are we changing the existing behavior of capturing and reporting the reboot-cause of DPUs even when the DPUs are down, which was done intentionally in the existing implementation to help debug DPU failure.

Comment thread doc/smart-switch/pmon/smartswitch-pmon.md Outdated
Comment thread doc/smart-switch/pmon/smartswitch-pmon.md Outdated
Comment thread doc/smart-switch/pmon/smartswitch-pmon.md Outdated
Comment thread doc/smart-switch/pmon/smartswitch-pmon.md Outdated
Comment thread doc/smart-switch/pmon/smartswitch-pmon.md Outdated
Comment thread doc/smart-switch/pmon/smartswitch-pmon.md
Signed-off-by: Charles Tsai <chartsai@nvidia.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

* On an `up -> down` midplane transition, chassisd records a reason string in `dpu_midplane_link_reason`:
- **Planned** — a DPU lifecycle operation is active, so the link loss is expected. Recorded as `Planned: '<transition_type>'`.
- **Unplanned** — otherwise, chassisd queries the platform through `get_midplane_down_reason()` and records `Unplanned: '<reason>'`, or `Unplanned: 'Unknown'` when the platform provides no reason.
* A DPU lifecycle operation counts as active only when all three hold: `transition_in_progress` is `"True"`, `transition_type` is one of the valid types, and `transition_start_time` has not exceeded the timeout for that `transition_type`. A stale value left behind by a completed, timed-out or failed operation therefore cannot classify a later failure as Planned.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chartsai-nvidia Looks like the current SmartSwitch transition field used by the surrounding design and implementation is state_transition_in_progress, not transition_in_progress. Can you double check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching the inconsistency. I checked the current runtime path and found that the deployed implementation uses transition_in_progress:

state_transition_in_progress appears in several related places:

However, I could not find a current production writer for state_transition_in_progress. sonic-utilities delegates transition handling to the platform API, which currently writes transition_in_progress.

Therefore, changing only this HLD to state_transition_in_progress would make it disagree with the current runtime implementation.

@vvolam, since you implemented the related transition handling in sonic-platform-common and sonic-utilities, could you clarify which field name should we use: transition_in_progress or state_transition_in_progress?

We can determine whether this HLD should change or whether the older documentation and related references are stale.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rameshraghupathy transition_in_progress is the right DB parameter. Any references in the code for state_transition_in_progress should be fixed accordingly.

Comment thread doc/smart-switch/pmon/smartswitch-pmon.md

@rameshraghupathy rameshraghupathy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chartsai-nvidia Can you please address the coments?

Signed-off-by: Charles Tsai <chartsai@nvidia.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@chartsai-nvidia

Copy link
Copy Markdown
Contributor Author

@rameshraghupathy done, please check, thanks

gpunathilell
gpunathilell previously approved these changes Aug 14, 2026
dgsudharsan
dgsudharsan previously approved these changes Aug 14, 2026
@vvolam

vvolam commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

@chartsai-nvidia The DPU reboot sequence diagram doc/smart-switch/pmon/images/dpu-reboot-seq.svg still reflects the old flow and now contradicts the updated prose. It isn't modified in this PR (only the .md is), but its labels still depict the removed mechanism:

oper-status out of offlineget-reboot-causextract-dpu-reboot-causepersist-dpu-reboot-cause

This conflicts with the new boot_id-triggered capture described in the text (boot_id change as the trigger, no NPU-hardware extraction, capture naturally aligned with the midplane coming online). Since the diagram is still referenced right under the edited DPU Reboot Cause bullets, a reader ends up with two contradictory mechanisms.

Could you please regenerate dpu-reboot-seq.svg to match the new boot_id flow? Thanks!

@chartsai-nvidia

Copy link
Copy Markdown
Contributor Author

@chartsai-nvidia The DPU reboot sequence diagram doc/smart-switch/pmon/images/dpu-reboot-seq.svg still reflects the old flow and now contradicts the updated prose. It isn't modified in this PR (only the .md is), but its labels still depict the removed mechanism:

oper-status out of offlineget-reboot-causextract-dpu-reboot-causepersist-dpu-reboot-cause

This conflicts with the new boot_id-triggered capture described in the text (boot_id change as the trigger, no NPU-hardware extraction, capture naturally aligned with the midplane coming online). Since the diagram is still referenced right under the edited DPU Reboot Cause bullets, a reader ends up with two contradictory mechanisms.

Could you please regenerate dpu-reboot-seq.svg to match the new boot_id flow? Thanks!

@vvolam Sure. @rameshraghupathy do you still have the source used to generate this diagram? If not, I’ll reconstruct it and update both the source and SVG to reflect the new flow. Thanks

@rameshraghupathy

Copy link
Copy Markdown
Contributor

@chartsai-nvidia The DPU reboot sequence diagram doc/smart-switch/pmon/images/dpu-reboot-seq.svg still reflects the old flow and now contradicts the updated prose. It isn't modified in this PR (only the .md is), but its labels still depict the removed mechanism:

oper-status out of offlineget-reboot-causextract-dpu-reboot-causepersist-dpu-reboot-cause

This conflicts with the new boot_id-triggered capture described in the text (boot_id change as the trigger, no NPU-hardware extraction, capture naturally aligned with the midplane coming online). Since the diagram is still referenced right under the edited DPU Reboot Cause bullets, a reader ends up with two contradictory mechanisms.
Could you please regenerate dpu-reboot-seq.svg to match the new boot_id flow? Thanks!

@vvolam Sure. @rameshraghupathy do you still have the source used to generate this diagram? If not, I’ll reconstruct it and update both the source and SVG to reflect the new flow. Thanks

@chartsai-nvidia Find below the mmd file content

sequenceDiagram
    actor User
    participant HostService as NPU: host-service
    participant StateDB as NPU: stateDB
    participant ChassisStateDB as NPU: chassisStateDB
    participant Chassisd as NPU: chassisd
    participant PlatformAPI as NPU: platform API
    participant Platform as NPU: Platform code

    User->>HostService: Input: PowerOn or Reboot config or cli
    HostService->>HostService: determine-reboot-cause
    HostService->>HostService: update-reboot-cause
    activate HostService
    HostService->>StateDB: update-reboot-cause
    HostService->>ChassisStateDB: update-reboot-cause
    HostService->>HostService: end processing
    deactivate HostService

    loop moduel_db_update
        Chassisd->>Chassisd: oper-status out of offline
        activate Chassisd
        Chassisd->>PlatformAPI: get-reboot-cause
        activate PlatformAPI
        PlatformAPI->>Platform: xtract-dpu-reboot-cause
        activate Platform
        Platform-->>PlatformAPI: dpu-reboot-cause
        deactivate Platform
        PlatformAPI-->>Chassisd: reboot-cause
        deactivate PlatformAPI
        Chassisd->>HostService: persist-dpu-reboot-cause
        Chassisd->>ChassisStateDB: update-dpu-reboot-cause
        deactivate Chassisd
    end

Signed-off-by: Charles Tsai <chartsai@nvidia.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

@chartsai-nvidia

Copy link
Copy Markdown
Contributor Author

@vvolam The svg has updated. Thanks

@vvolam vvolam left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thank you.

Please verify if we need to add reboot_cause testcases to cover the scenarios.

Also, you may have to add a testcase to cover midplane_down reason in DPU crash scenarios and check if the reason is being updated..

@liat-grozovik

Copy link
Copy Markdown
Collaborator

@rameshraghupathy are we good? if so approve

Comment thread doc/smart-switch/pmon/smartswitch-pmon.md

@rameshraghupathy rameshraghupathy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chartsai-nvidia Just provided one comment. Mostly LGTM. Please address that and hen I'll approve it.

@rameshraghupathy rameshraghupathy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chartsai-nvidia Can you call out that when the the platforms don't implement get_midplane_down_reason(), the ModuleBase default should return the string "Unknown" ?

@vvolam
vvolam merged commit 79cc00e into sonic-net:master Aug 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants