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

[1/2] [WIP] health: Add support for storage stats and health #628

Closed
wants to merge 1 commit into from

Conversation

ix5
Copy link
Contributor

@ix5 ix5 commented Jul 14, 2019

health: Add support for storage stats and health

This implements the missing health@2.0 function calls:

  • get_storage_info()
  • get_disk_stats()

Also introduce a HealthTestingMock for debugging purposes. It is only available in userdebug/eng builds.
The prop persist.vendor.health.fake_storage=1 will trigger fake stats.

Storage health reporting is not available for UFS since there is no kernel support for UFS health as of 2019-07-12.

Since the SODP devices all have different emmc nodes, attempt to resolve /sys/block/mmcblk0 to e.g.
/sys/devices/platform/soc/7464900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0, which gives use the emmc node at /sys/devices/platform/soc/7464900.sdhci/mmc_host/mmc0/mmc0:0001

For UFS devices, construct the sysfs paths based on the property ro.boot.bootdevice, which would look like e.g. 7464900.ufshci, giving us a path such as: /sys/devices/platform/soc/7464900.ufshci.
(Currently unused of course)

The nodes will have to labeled in the individual platforms' sepolicy dirs:

SODP devices report pre-EOL info, two lifetime values and an EMMC revision.

Disk statistics are taken from the generic stat file, just as the default implemention of storaged and the crosshatch/bonito health HAL do.

health: Refactor and simplify, drop healthd shims

This change drastically simplifies the code, which had been written under the assumption that AOSP would drop healthd soon. The wrapper libraries make little sense, just drop them.
Update: The "simplify" commits have been split out into #647

@ix5 ix5 changed the title [WIP] health: Add support for storage stats and health, refactor & simplify [1/2] [WIP] health: Add support for storage stats and health, refactor & simplify Jul 14, 2019
@ix5 ix5 marked this pull request as ready for review July 29, 2019 19:53
@jerpelea jerpelea force-pushed the master branch 2 times, most recently from 3cc88ac to 784b86e Compare September 4, 2019 11:42
@ix5 ix5 changed the title [1/2] [WIP] health: Add support for storage stats and health, refactor & simplify [1/2] [WIP] health: Add support for storage stats and health Sep 30, 2019
@ix5 ix5 mentioned this pull request Sep 30, 2019
@jerpelea jerpelea force-pushed the master branch 3 times, most recently from 699ce56 to 5d1178b Compare October 3, 2019 13:16
@jerpelea
Copy link
Collaborator

jerpelea commented Nov 5, 2019

rebase please

@ix5
Copy link
Contributor Author

ix5 commented Nov 5, 2019

Rebased. This is NOT ready for merge! Still need testing on UFS devices and remove a few TODOs.

Code review on C++ files is appreciated :)

@jerpelea
Copy link
Collaborator

jerpelea commented Feb 5, 2020

updates?

@ix5
Copy link
Contributor Author

ix5 commented Feb 5, 2020

It's more of a toy functionality, android doesn't really use the stats for anything important.

@jerpelea jerpelea force-pushed the master branch 2 times, most recently from 120f053 to dea89a4 Compare February 25, 2020 11:44
@ix5
Copy link
Contributor Author

ix5 commented May 26, 2020

Ping @oshmoun @luk1337 @MarijnS95 for review ( & @kholk if not too busy / disgusted by C++)

This implements the missing health@2.0 function calls:
- get_storage_info()
- get_disk_stats()

Also introduce a HealthTestingMock for debugging purposes. It is only
available in userdebug/eng builds.
The prop "persist.vendor.health.fake_storage=1" will trigger fake stats.

Storage health reporting is not available for UFS since there is no
kernel support for UFS health as of 2019-07-12.

Since the SODP devices all have different emmc nodes, attempt to resolve
`/sys/block/mmcblk0` to e.g.
`/sys/devices/platform/soc/7464900.sdhci/mmc_host/mmc0/mmc0:0001/block/mmcblk0`,
which gives use the emmc node at
`/sys/devices/platform/soc/7464900.sdhci/mmc_host/mmc0/mmc0:0001`

For UFS devices, construct the sysfs paths based on the property
`ro.boot.bootdevice`, which would look like e.g. `7464900.ufshci`,
giving us a path such as: `/sys/devices/platform/soc/7464900.ufshci`.
(Currently unused of course)

The nodes will have to labeled in the individual platforms' sepolicy
dirs.

SODP devices report pre-EOL info, two lifetime values and an EMMC
revision.

Disk statistics are taken from the generic `stat` file, just as the
default implemention of `storaged` and the crosshatch/bonito health HAL
do.
@ix5
Copy link
Contributor Author

ix5 commented Jan 4, 2021

Still not really useful on Android 11

@ix5 ix5 closed this Jan 4, 2021
@ix5 ix5 deleted the health-storage-stats branch January 4, 2021 08:28
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.

2 participants