fboss icon indicating copy to clipboard operation
fboss copied to clipboard

Fix platform_manager SPI creation failure

Open jun2zhou opened this issue 2 months ago • 0 comments

Pre-submission checklist

  • [x] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running pip install -r requirements-dev.txt && pre-commit install
  • [x] pre-commit run image

Summary

Fixed a occasional Failure issue in creation of SMB_SPI_MASTER_1_DEVICE_1. The loading of the kernel driver and the creation of associated devices require an uncertain period of time. To prevent device creation failures, we need to implement readiness checks for the sysfs nodes corresponding to the kernel driver and its associated devices. This constitutes the fundamental solution to mitigate issues arising from delays in kernel driver loading and device creation.

  1. Enhance FBOSS platform_manager logic: Add explicit checking and waiting steps for SPI sysfs node creation (both master bus and device nodes).

  2. Check sysfs nodes, example for spi0.0:

/sys/devices/pci0000:14/0000:14:04.0/0000:17:00.0/fboss_iob_pci.spi_master.1075/spi_master/spi0/spi0.0/ /sys/bus/spi/drivers/spidev/spi0.0 /dev/spidev0.0

Test Plan

  1. add delays in spi driver code fboss_iob_spi.c that helps for issue reproduce.
image 2. run cmd without fix: /opt/fboss/bin/platform_manager_hw_test -enable_pkg_mgmnt=false --gtest_filter=PlatformManagerHwTest.ExploreAfterUnloadingKmods image 3. run cmd with fix: image image

jun2zhou avatar Nov 27 '25 03:11 jun2zhou