sonic-buildimage/device/celestica/x86_64-cel_seastone-r0
Ikki Zhu db12b8c9c0
dx010 fix possible cpld race read issue (#15339)
#### Why I did it
fix possible cpld race read issue between watchdog and reboot cause process

##### Work item tracking
- Microsoft ADO **(number only)**:

#### How I did it
Use flock to limit parallel access to cpld sys file

#### How to verify it
It can be simulate and verified with following python script

```python3
import signal
import subprocess
import threading

exit_flag = False

def run_command(cmd):
    status = True
    result = ""
    try:
        p = subprocess.Popen(
            cmd, shell=True, universal_newlines=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        raw_data, err = p.communicate()
        if err == '':
            result = raw_data.strip()
    except:
        status = False
    return status, result

def get_cpld_reg_value(getreg_path, register):
    #cmd = "echo {1} > {0}; cat {0}".format(getreg_path, register)
    cmd = "flock {0} -c 'echo {1} > {0}; cat {0}'".format(getreg_path,
register)
    status, result = run_command(cmd)
    return result if status else None

def cpld_read(thread_num, cpld_reg):
    while not exit_flag:
        val
= get_cpld_reg_value("/sys/devices/platform/dx010_cpld/getreg",
cpld_reg)
        print(f"Thread {thread_num}: get cpld reg {cpld_reg}, value
{val}")

def signal_handler(sig, frame):
    global exit_flag
    print("Ctrl+C detected. Quitting...")
    exit_flag = True

if __name__ == '__main__':
    # Register the signal handler for Ctrl+C
    signal.signal(signal.SIGINT, signal_handler)

    t1 = threading.Thread(target=cpld_read, args=(1, '0x103',))
    t2 = threading.Thread(target=cpld_read, args=(2, '0x141',))
    t1.start()
    t2.start()
    t1.join()
    t2.join()
```
2023-06-20 16:21:08 -07:00
..
Celestica-DX010-C32 [201811][DX010] enable LPM (#12641) 2022-11-09 08:16:03 -08:00
Celestica-DX010-D48C8 [201811][DX010] enable LPM (#12641) 2022-11-09 08:16:03 -08:00
led-code [Celestica]: Update port led code for seastone-xp (#2476) 2019-01-23 18:44:19 -08:00
plugins [pcie.yaml] Move pcie configuration file path to platform directory (#6475) 2021-03-04 21:23:05 +00:00
Seastone-DX010 [DPB Seastone] On boarding DPB feature to Seastone HWSKUs (#4235) 2020-09-18 15:29:29 -07:00
Seastone-DX010-10-50 [DPB Seastone] On boarding DPB feature to Seastone HWSKUs (#4235) 2020-09-18 15:29:29 -07:00
Seastone-DX010-25-50 [DPB Seastone] On boarding DPB feature to Seastone HWSKUs (#4235) 2020-09-18 15:29:29 -07:00
Seastone-DX010-50 [DPB Seastone] On boarding DPB feature to Seastone HWSKUs (#4235) 2020-09-18 15:29:29 -07:00
Seastone-DX010-50-40 [DPB Seastone] On boarding DPB feature to Seastone HWSKUs (#4235) 2020-09-18 15:29:29 -07:00
Seastone-DX010-50-50-40 [Seastone] Add new HWSKU for 48x50G+8x40G (#4156) 2020-04-04 22:52:34 -07:00
sonic_platform dx010 fix possible cpld race read issue (#15339) 2023-06-20 16:21:08 -07:00
default_sku [updategraph] add support to use preset config instead of default minigraph (#2050) 2018-09-21 22:01:10 -07:00
fancontrol-B2F [device/celestica]: Add thermalctld support on DX010 platform APIs (#6089) 2021-01-19 01:09:54 -08:00
fancontrol-F2B [device/celestica]: Add thermalctld support on DX010 platform APIs (#6089) 2021-01-19 01:09:54 -08:00
installer.conf [device/celestica] seastone add gpio_ich driver module blacklist (#2691) 2019-03-25 15:49:35 -07:00
led_proc_init.soc Replace CRLF line endings with LF (#932) 2017-09-01 15:28:46 -07:00
pcie.yaml [pcie.yaml] Move pcie configuration file path to platform directory (#6475) 2021-03-04 21:23:05 +00:00
platform_components.json [DX010 platform] fix dx010 platform testcase issues (#13595) 2023-02-16 17:52:12 +00:00
platform.json add psu fans status led available config (#13926) 2023-02-28 08:18:28 +00:00
pmon_daemon_control.json [device/celestica]: Fix xcvrd error (#3979) 2020-01-10 12:50:51 -08:00
sensors.conf [device/celestica]: Implement thermal base API based on the new platform API (#3220) 2019-08-05 09:01:50 -07:00
system_health_monitoring_config.json [Celestica Seastone] fix multi sonic platform issues (#13356) 2023-01-19 19:18:21 +00:00
th-seastone-dx010-config-flex-all.bcm [202012] Disable ALPM distributed hitbit thread that is used for debug purpose only but interfered with Other functional operations (#9190) 2021-11-08 11:50:44 -08:00
thermal_overload_control.sh [device/celestica]: Add thermalctld support on DX010 platform APIs (#6089) 2021-01-19 01:09:54 -08:00
thermal_policy.json [device/celestica]: Add thermalctld support on DX010 platform APIs (#6089) 2021-01-19 01:09:54 -08:00