diff --git a/dumpstate/DumpstateDevice.cpp b/dumpstate/DumpstateDevice.cpp index 2b13a72e..251b9eb7 100755 --- a/dumpstate/DumpstateDevice.cpp +++ b/dumpstate/DumpstateDevice.cpp @@ -44,8 +44,6 @@ #define DIAG_MDLOG_NUMBER_BUGREPORT "persist.vendor.sys.modem.diag.mdlog_br_num" -#define UFS_BOOTDEVICE "ro.boot.bootdevice" - #define TCPDUMP_NUMBER_BUGREPORT "persist.vendor.tcpdump.log.br_num" #define TCPDUMP_PERSIST_PROPERTY "persist.vendor.tcpdump.log.alwayson" @@ -417,51 +415,47 @@ static void DumpUFS(int fd) { DumpFileToFd(fd, "UFS size", "/sys/block/sda/size"); DumpFileToFd(fd, "UFS show_hba", "/sys/kernel/debug/ufshcd0/show_hba"); - std::string bootdev = android::base::GetProperty(UFS_BOOTDEVICE, ""); - if (!bootdev.empty()) { - DumpFileToFd(fd, "UFS Slow IO Read", "/sys/devices/platform/soc/" + bootdev + "/slowio_read_cnt"); - DumpFileToFd(fd, "UFS Slow IO Write", "/sys/devices/platform/soc/" + bootdev + "/slowio_write_cnt"); - DumpFileToFd(fd, "UFS Slow IO Unmap", "/sys/devices/platform/soc/" + bootdev + "/slowio_unmap_cnt"); - DumpFileToFd(fd, "UFS Slow IO Sync", "/sys/devices/platform/soc/" + bootdev + "/slowio_sync_cnt"); - - std::string ufs_health = "for f in $(find /sys/devices/platform/soc/" + bootdev + "/health -type f); do if [[ -r $f && -f $f ]]; then echo --- $f; cat $f; echo ''; fi; done"; - RunCommandToFd(fd, "UFS health", {"/vendor/bin/sh", "-c", ufs_health.c_str()}); - RunCommandToFd(fd, "UFS err_stats", {"/vendor/bin/sh", "-c", - "path=\"/sys/devices/platform/soc/" + bootdev + "/err_stats\"; " - "for node in `ls $path/err_*`; do " - "printf \"%s:%d\\n\" $(basename $node) $(cat $node); done;"}); - RunCommandToFd(fd, "UFS io_stats", {"/vendor/bin/sh", "-c", - "path=\"/sys/devices/platform/soc/" + bootdev + "/io_stats\"; " - "printf \"\\t\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "ReadCnt ReadBytes WriteCnt WriteBytes RWCnt RWBytes; " - "str=$(cat $path/*_start); arr=($str); " - "printf \"Started: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " - "str=$(cat $path/*_complete); arr=($str); " - "printf \"Completed: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " - "str=$(cat $path/*_maxdiff); arr=($str); " - "printf \"MaxDiff: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " - "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; "}); - - RunCommandToFd(fd, "UFS req_stats", {"/vendor/bin/sh", "-c", - "path=\"/sys/devices/platform/soc/" + bootdev + "/req_stats\"; " - "printf \"\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "All Write Read Read\\(urg\\) Write\\(urg\\) Flush Discard; " - "str=$(cat $path/*_min); arr=($str); " - "printf \"Min:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_max); arr=($str); " - "printf \"Max:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_avg); arr=($str); " - "printf \"Avg.:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " - "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " - "str=$(cat $path/*_sum); arr=($str); " - "printf \"Count:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " - "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]};"}); - - } + DumpFileToFd(fd, "UFS Slow IO Read", "/dev/sys/block/bootdevice/slowio_read_cnt"); + DumpFileToFd(fd, "UFS Slow IO Write", "/dev/sys/block/bootdevice/slowio_write_cnt"); + DumpFileToFd(fd, "UFS Slow IO Unmap", "/dev/sys/block/bootdevice/slowio_unmap_cnt"); + DumpFileToFd(fd, "UFS Slow IO Sync", "/dev/sys/block/bootdevice/slowio_sync_cnt"); + + std::string ufs_health = "for f in $(find /dev/sys/block/bootdevice/health -type f); do if [[ -r $f && -f $f ]]; then echo --- $f; cat $f; echo ''; fi; done"; + RunCommandToFd(fd, "UFS health", {"/vendor/bin/sh", "-c", ufs_health.c_str()}); + RunCommandToFd(fd, "UFS err_stats", {"/vendor/bin/sh", "-c", + "path=\"/dev/sys/block/bootdevice/err_stats\"; " + "for node in `ls $path/err_*`; do " + "printf \"%s:%d\\n\" $(basename $node) $(cat $node); done;"}); + RunCommandToFd(fd, "UFS io_stats", {"/vendor/bin/sh", "-c", + "path=\"/dev/sys/block/bootdevice/io_stats\"; " + "printf \"\\t\\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "ReadCnt ReadBytes WriteCnt WriteBytes RWCnt RWBytes; " + "str=$(cat $path/*_start); arr=($str); " + "printf \"Started: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " + "str=$(cat $path/*_complete); arr=($str); " + "printf \"Completed: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; " + "str=$(cat $path/*_maxdiff); arr=($str); " + "printf \"MaxDiff: \\t%-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " + "${arr[1]} ${arr[0]} ${arr[5]} ${arr[4]} ${arr[3]} ${arr[2]}; "}); + + RunCommandToFd(fd, "UFS req_stats", {"/vendor/bin/sh", "-c", + "path=\"/dev/sys/block/bootdevice/req_stats\"; " + "printf \"\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "All Write Read Read\\(urg\\) Write\\(urg\\) Flush Discard; " + "str=$(cat $path/*_min); arr=($str); " + "printf \"Min:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " + "str=$(cat $path/*_max); arr=($str); " + "printf \"Max:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " + "str=$(cat $path/*_avg); arr=($str); " + "printf \"Avg.:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\" " + "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]}; " + "str=$(cat $path/*_sum); arr=($str); " + "printf \"Count:\\t%-10s %-10s %-10s %-10s %-10s %-10s %-10s\\n\\n\" " + "${arr[0]} ${arr[3]} ${arr[6]} ${arr[4]} ${arr[5]} ${arr[2]} ${arr[1]};"}); } static void DumpPower(int fd) { diff --git a/fstab.hardware b/fstab.hardware index 96f91c32..cdf1c2d4 100644 --- a/fstab.hardware +++ b/fstab.hardware @@ -7,6 +7,6 @@ vendor /vendor e product /product ext4 ro,barrier=1 wait,slotselect,avb,logical,first_stage_mount /dev/block/by-name/metadata /metadata ext4 noatime,nosuid,nodev,discard,sync wait,formattable,first_stage_mount,check,metadata_csum /dev/block/bootdevice/by-name/misc /misc emmc defaults defaults -/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier latemount,wait,check,quota,formattable,fileencryption=ice,reservedsize=128M,sysfs_path=/sys/devices/platform/soc/1d84000.ufshc,keydirectory=/metadata/vold/metadata_encryption,checkpoint=fs +/dev/block/bootdevice/by-name/userdata /data f2fs noatime,nosuid,nodev,discard,reserve_root=32768,resgid=1065,fsync_mode=nobarrier latemount,wait,check,quota,formattable,fileencryption=ice,reservedsize=128M,sysfs_path=/dev/sys/block/bootdevice,keydirectory=/metadata/vold/metadata_encryption,checkpoint=fs /devices/platform/soc/a600000.ssusb/a600000.dwc3* auto vfat defaults voldmanaged=usb:auto /dev/block/zram0 none swap defaults zramsize=2147483648,max_comp_streams=8,zram_backingdev_size=512M diff --git a/init.hardware.rc b/init.hardware.rc index cea93c8f..3769aa85 100644 --- a/init.hardware.rc +++ b/init.hardware.rc @@ -48,14 +48,17 @@ on early-init && property:ro.boot.mode=charger setprop vendor.skip.init 1 on init && property:vendor.skip.init=0 - # Disable UFS powersaving - write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 0 - # Disable powersaving write /sys/module/lpm_levels/parameters/sleep_disabled 1 - wait /dev/block/platform/soc/${ro.boot.bootdevice} - symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice + wait /dev/block/platform/${ro.boot.boot_devices} + symlink /dev/block/platform/${ro.boot.boot_devices} /dev/block/bootdevice + + # to access UFS/eMMC sysfs directly + symlink /sys/devices/platform/${ro.boot.boot_devices} /dev/sys/block/bootdevice + + # Disable UFS powersaving + write /dev/sys/block/bootdevice/clkgate_enable 0 # start qseecomd early as we mount system/ vendor/ early # vold needs keymaster that needs qseecomd @@ -379,13 +382,13 @@ on early-boot # Permission for Pixelstats chown system system /sys/class/misc/msm_cirrus_playback/resistance_left_right - chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/slowio_read_cnt - chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/slowio_write_cnt - chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/slowio_unmap_cnt - chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/slowio_sync_cnt + chown system system /dev/sys/block/bootdevice/slowio_read_cnt + chown system system /dev/sys/block/bootdevice/slowio_write_cnt + chown system system /dev/sys/block/bootdevice/slowio_unmap_cnt + chown system system /dev/sys/block/bootdevice/slowio_sync_cnt # Permission for Health Storage HAL - chown system system /sys/devices/platform/soc/${ro.boot.bootdevice}/manual_gc + chown system system /dev/sys/block/bootdevice/manual_gc # Permissions for reading display native color gamut chown system graphics /mnt/vendor/persist/display/native_gamut.csv diff --git a/init.power.rc b/init.power.rc index 01f1406d..42b0e0cc 100644 --- a/init.power.rc +++ b/init.power.rc @@ -104,7 +104,7 @@ on property:vendor.setup.power=1 write /sys/module/lpm_levels/parameters/sleep_disabled 0 # Enable UFS powersaving - write /sys/devices/platform/soc/${ro.boot.bootdevice}/clkgate_enable 1 + write /dev/sys/block/bootdevice/clkgate_enable 1 # Enable idle state listener write /sys/class/drm/card0/device/idle_encoder_mask 1 diff --git a/pixelstats/service.cpp b/pixelstats/service.cpp index befe8912..1e2271c0 100644 --- a/pixelstats/service.cpp +++ b/pixelstats/service.cpp @@ -28,7 +28,7 @@ using android::hardware::google::pixel::DropDetect; using android::hardware::google::pixel::SysfsCollector; using android::hardware::google::pixel::UeventListener; -#define UFSHC_PATH(filename) "/sys/devices/platform/soc/1d84000.ufshc/" #filename +#define UFSHC_PATH(filename) "/dev/sys/block/bootdevice/" #filename const struct SysfsCollector::SysfsPaths sysfs_paths = { .SlowioReadCntPath = UFSHC_PATH(slowio_read_cnt), .SlowioWriteCntPath = UFSHC_PATH(slowio_write_cnt),