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

Resource leak #114

Open
QiAnXinCodeSafe opened this issue Jan 16, 2020 · 0 comments
Open

Resource leak #114

QiAnXinCodeSafe opened this issue Jan 16, 2020 · 0 comments

Comments

@QiAnXinCodeSafe
Copy link

Stream is opened

fp = fopen(TPM_VERSION_LOCATION, "r");

‘fp’ never closed

facebook-github-bot pushed a commit that referenced this issue May 26, 2020
Summary:
Fixes #110 Solution: Add print limitation.

#114 #116 #117  Seems to be false alarms.
However there is a possible memory leak in
https://github.com/facebook/openbmc/blob/de522bcdf9ea26e52a81b9a4a69326774bb87a07/common/recipes-core/fw-util/files/tpm2.cpp#L45
Opening pipeline should be closed at the end of process.
Pull Request resolved: #119

Reviewed By: benwei13

Pulled By: williamspatrick

fbshipit-source-id: 6f08ce26f4
facebook-github-bot pushed a commit that referenced this issue Nov 19, 2020
Summary:
Updates setup_i2c.sh to add an additional ISL device on pim8ddm PIMs. Additionally, the device names are updated for the SMB ISL/RAA chips to take advantage of the new ISL driver functionality added in [https://github.com/facebookexternal/openbmc.arista/issues/107](https://github.com/facebookexternal/openbmc.arista/pull/107).

lm_sensors is also updated to account for multiple PIM types. Currently, lm_sensors cannot handle sensor differences between pim16q and pim8ddm due to the single elbert.conf configuration file. This change adds two subsequent sensor config file templates, pim16q.conf and pim8ddm.conf, which are used by pim_enable.sh to dynamically apply sensor labels and thresholds based on PIM type. The generated config files can be found in /etc/sensors.d/ (lm_sensors applies all configs found in this directory):

The i2c CIT test is also updated to reflect the device name changes.

```
root@bmc-oob:~# ls /etc/sensors.d/ -al
drwxr-xr-x    2 root     root             0 Nov 18 10:41 .
drwxr-xr-x   33 root     root             0 Nov 18 10:41 ..
-rw-r--r--    1 root     root           776 Nov 18 09:58 .pim16q.conf
-rw-r--r--    1 root     root          1878 Nov 18 09:58 .pim8ddm.conf
-rw-r--r--    1 root     root          7058 Nov 18 09:58 elbert.conf
-rw-r--r--    1 root     root           708 Nov 18 10:41 pim2.conf
-rw-r--r--    1 root     root          1699 Nov 18 10:41 pim3.conf
-rw-r--r--    1 root     root           708 Nov 18 10:41 pim4.conf
-rw-r--r--    1 root     root           708 Nov 18 10:41 pim5.conf
-rw-r--r--    1 root     root           708 Nov 18 10:41 pim6.conf
-rw-r--r--    1 root     root           708 Nov 18 10:41 pim7.conf
-rw-r--r--    1 root     root           708 Nov 18 10:41 pim8.conf
-rw-r--r--    1 root     root           708 Nov 18 10:41 pim9.conf
-rw-r--r--    1 root     root            87 Nov 18 08:46 sensors.conf
```

### Testing

Verified on Elbert with the following PIMs:
```
root@bmc-oob:~# pim_types.sh
PIM 2: PIM16Q
PIM 3: PIM8DDM
PIM 4: PIM16Q
PIM 5: PIM16Q
PIM 6: PIM16Q
PIM 7: PIM16Q
PIM 8: PIM16Q
PIM 9: PIM16Q
```

Focusing on PIMs 2 and 3, note that sensors differ between PIM types:
```
# PIM2
root@bmc-oob:~# sensors | grep i2c-16
lm73-i2c-16-4a
pmbus-i2c-16-16
ucd9090-i2c-16-4e
pmbus-i2c-16-18

# PIM3
root@bmc-oob:~# sensors | grep i2c-17
ucd9090-i2c-17-4e
pmbus-i2c-17-16
isl68224-i2c-17-54 <-- pim8ddm specific ISL
lm73-i2c-17-4a
pmbus-i2c-17-18
```

The ISL68224 on pim8ddm supports voltage monitoring on 3 voltage loops, which the new driver supports:
```
root@bmc-oob:~# sensors isl68224-i2c-17-54
isl68224-i2c-17-54
Adapter: i2c-2-mux (chan_id 1)
PIM3 ISL Vin:        +12.02 V  (crit min =  +0.00 V, min =  +0.00 V)
                               (max = +18.00 V, crit max = +16.00 V)
PIM3 ISL Vmon:        +0.00 V
PIM3 ISL Vout Loop0:  +0.90 V  (crit min =  +0.81 V, crit max =  +0.99 V)
PIM3 ISL Vout Loop1:  +1.55 V  (crit min =  +1.47 V, crit max =  +1.63 V)
PIM3 ISL Vout Loop2:  +1.85 V  (crit min =  +1.76 V, crit max =  +1.94 V)
PIM3 ISL Temp1:       +45.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
PIM3 ISL Temp2:       +47.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
PIM3 ISL Temp3:       +45.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
PIM3 ISL Temp4:       +41.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
PIM3 ISL Temp5:        +0.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
PIM3 ISL Temp6:        +0.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
PIM3 ISL Temp7:        +0.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
PIM3 ISL Pin Loop0:   20.00 W
PIM3 ISL Pin Loop1:   28.00 W
PIM3 ISL Pin Loop2:   16.00 W
PIM3 ISL Pout Loop0:  16.00 W
PIM3 ISL Pout Loop1:  24.00 W
PIM3 ISL Pout Loop2:  14.00 W
PIM3 ISL Iin Loop0:   +1.76 A  (max = +150.00 A, crit max = +50.00 A)
PIM3 ISL Iin Loop1:   +2.38 A  (max = +150.00 A, crit max = +50.00 A)
PIM3 ISL Iin Loop2:   +1.37 A  (max = +150.00 A, crit max = +50.00 A)
PIM3 ISL Iout Loop0: +18.80 A  (max = +3276.70 A, crit max = +126.00 A)
PIM3 ISL Iout Loop1: +15.80 A  (max = +3276.70 A, crit max = +26.00 A)
PIM3 ISL Iout Loop2:  +7.80 A  (max = +3276.70 A, crit max = +12.00 A)
```

The updated ISL driver allows additional sensors on the TH4 ISL/RAA:
```
root@bmc-oob:~# sensors raa228228-i2c-3-60
raa228228-i2c-3-60
Adapter: 1e78a200.i2c-bus
TH4 VRD1 Vin:        +12.04 V  (crit min =  +0.00 V, min =  +0.00 V)
                               (max = +18.00 V, crit max = +16.00 V)
TH4 VRD1 Vmon:        -0.02 V
TH4 VRD1 Vout Loop0:  +0.89 V  (crit min =  +0.80 V, crit max =  +0.98 V)
TH4 VRD1 Temp1:       +33.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD1 Temp2:        +0.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD1 Temp3:        +0.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD1 Pin:         39.00 W
TH4 VRD1 Pout Loop0:  34.00 W
TH4 VRD1 Iin:         +3.23 A  (max = +150.00 A, crit max = +50.00 A)
TH4 VRD1 Iout Loop0: +38.50 A  (max = +400.00 A, crit max = +715.00 A)

root@bmc-oob:~# sensors isl68226-i2c-3-62
isl68226-i2c-3-62
Adapter: 1e78a200.i2c-bus
TH4 VRD2 Vin:        +12.08 V  (crit min =  +0.00 V, min =  +0.00 V)
                               (max = +18.00 V, crit max = +16.00 V)
TH4 VRD2 Vmon:        +0.00 V
TH4 VRD2 Vout Loop0:  +0.75 V  (crit min =  +0.68 V, crit max =  +0.82 V)
TH4 VRD2 Vout Loop1:  +1.20 V  (crit min =  +1.08 V, crit max =  +1.32 V)
TH4 VRD2 Vout Loop2:  +1.20 V  (crit min =  +1.08 V, crit max =  +1.32 V)
TH4 VRD2 Temp1:       +33.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD2 Temp2:       +33.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD2 Temp3:       +31.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD2 Temp4:       +26.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD2 Temp5:        +0.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD2 Temp6:        +0.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD2 Temp7:        +0.0 C  (high = +110.0 C, crit low = -40.0 C)
                               (crit = +125.0 C)
TH4 VRD2 Pin Loop0:    2.00 W
TH4 VRD2 Pin Loop1:    0.00 W
TH4 VRD2 Pin Loop2:    0.00 W
TH4 VRD2 Pout Loop0:   2.00 W
TH4 VRD2 Pout Loop1: -1000.00 mW
TH4 VRD2 Pout Loop2: -1000.00 mW
TH4 VRD2 Iin Loop0:   +0.23 A  (max = +150.00 A, crit max = +50.00 A)
TH4 VRD2 Iin Loop1:   +0.08 A  (max = +150.00 A, crit max = +50.00 A)
TH4 VRD2 Iin Loop2:   +0.05 A  (max = +150.00 A, crit max = +50.00 A)
TH4 VRD2 Iout Loop0:  +3.30 A  (max = +3276.70 A, crit max = +191.00 A)
TH4 VRD2 Iout Loop1:  +0.00 A  (max = +3276.70 A, crit max = +20.00 A)
TH4 VRD2 Iout Loop2:  -0.30 A  (max = +3276.70 A, crit max = +20.00 A)
```

test_i2c.py passes for Elbert:
```
root@bmc-oob:/usr/local/bin/tests2# python3 cit_runner.py --platform elbert -r tests.elbert.test_i2c
test_i2c_tree (tests.elbert.test_i2c.ElbertI2cTest)
check if i2c devices are created and drivers are binded properly. ... ok

----------------------------------------------------------------------
Ran 1 test in 4.279s

OK
```

Pull Request resolved: facebookexternal/openbmc.arista#114

Reviewed By: mikechoifb

fbshipit-source-id: e835a38ba3
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

No branches or pull requests

1 participant