Skip to content

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

Closed
ix5 wants to merge 1 commit into
sonyxperiadev:masterfrom
ix5:health-storage-stats
Closed

[1/2] [WIP] health: Add support for storage stats and health#628
ix5 wants to merge 1 commit into
sonyxperiadev:masterfrom
ix5:health-storage-stats

Conversation

@ix5
Copy link
Copy Markdown
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 force-pushed the health-storage-stats branch from 39d66d4 to 4f9bd17 Compare July 26, 2019 13:53
@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
Copy Markdown
Collaborator

jerpelea commented Nov 5, 2019

rebase please

@ix5 ix5 force-pushed the health-storage-stats branch from 4f9bd17 to 912b29c Compare November 5, 2019 19:06
@ix5
Copy link
Copy Markdown
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
Copy Markdown
Collaborator

jerpelea commented Feb 5, 2020

updates?

@ix5
Copy link
Copy Markdown
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
Copy Markdown
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 ix5 force-pushed the health-storage-stats branch from 912b29c to 58f9f64 Compare May 29, 2020 21:49
@jerpelea jerpelea force-pushed the master branch 3 times, most recently from 436c964 to 68bc1eb Compare July 2, 2020 08:29
@jerpelea jerpelea force-pushed the master branch 2 times, most recently from b818544 to d165b35 Compare September 2, 2020 13:52
@jerpelea jerpelea force-pushed the master branch 2 times, most recently from 9aed031 to 317ff7e Compare September 15, 2020 13:54
@ix5
Copy link
Copy Markdown
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