Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[E1031] add platform specific reboot command support #15889

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions device/celestica/x86_64-cel_e1031-r0/platform_reboot
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

CPLD_SETREG_PATH="/sys/bus/platform/devices/e1031.smc/setreg"

# Board level power cycle
echo "0x0113 0xAA" > ${CPLD_SETREG_PATH}
Copy link
Contributor

@prgeor prgeor Jul 18, 2023

Choose a reason for hiding this comment

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

@qnos is the filesystem unmounted at this stage? if not, it can cause FS corruption

Copy link
Contributor Author

@qnos qnos Jul 18, 2023

Choose a reason for hiding this comment

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

@qnos is the filesystem unmounted at this stage? if not, it can cause FS corruption

Understand your concern, I will add fs umount logic before power cycle. Thanks.

10 changes: 10 additions & 0 deletions device/celestica/x86_64-cel_e1031-r0/platform_update_reboot_cause
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

REBOOT_USER=$(logname)
REBOOT_TIME=$(date)
REBOOT_CAUSE_FILE="/host/reboot-cause/reboot-cause.txt"

echo "User issued 'reboot' with platform-specific command [User: ${REBOOT_USER}, Time: ${REBOOT_TIME}]" > ${REBOOT_CAUSE_FILE}
sync
/sbin/fstrim -av
Copy link
Contributor

Choose a reason for hiding this comment

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

@qnos why do we need trim at this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@qnos why do we need trim at this point?

Cold reboot is a kind of force power cycle, add fstrim to try reducing the disk segment before force reboot. Commonly in non-test environment, cold reboot wouldn't be called frequently, so it wouldn't do harm to SSD health and lifecycle. Even in test environment, hundreds of reboot test would introduce obvious effect to SSD.

Copy link
Contributor

Choose a reason for hiding this comment

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

@qnos reducing the disk segment means? how cold reboot affects SSD health/life?

Copy link
Contributor Author

@qnos qnos Jul 28, 2023

Choose a reason for hiding this comment

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

@qnos reducing the disk segment means? how cold reboot affects SSD health/life?

fstrim could be used for disk defragmentation, i meant using fstrim(called by cold reboot script) too frequently would affect SSD health. But in reboot case, that wouldn't be frequent.

Copy link
Contributor

Choose a reason for hiding this comment

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

@qnos I think Prince's questions is on why we need do this fstrim here? Since we already have cronjob to do daily fstrim, it seems like unnecessary to do fstrim before power-cycle. Do you have any other concern to have this operation here? If not, I think we'd better remove it since it is not related to the power-cycle.

sleep 2
Loading