Score:0

/proc/diskstats reports incorrect disk read stats in 5.11.0-46 HWE kernel in Ubuntu 20.04. 5.4.0-94 kernel is OK

uy flag

Hd-idle stopped working when I installed the 5.11 HWE kernel on Ubuntu 20.04. I eventually found that /proc/diskstats was reporting phantom disk read activity. Here are the stats for one of my drives running under 5.4.0. I've underlined the disk read counter that's used by hd-idle to check disk activity:

grep sdg /proc/diskstats 
   8      96 sdg 12758 4 793104 49835 446 0 7840 262 0 47720 39172 0 0 0 0
                         ------
   8      97 sdg1 12606 4 787936 49248 446 0 7840 262 0 47308 38712 0 0 0 0
   8     105 sdg9 41 0 576 94 0 0 0 0 0 112 68 0 0 0 0

The HWE kernel (5.11) reports continuously increasing disk reads on the raw device at maybe 5 to 10 reads per second and this prevents hd-idle from spinning down the drive. Note that there's no read activity on the individual partitions.

The disk itself appears to be really idle because I can force it to spin-down (using 'hd-idle -t sdg') and it doesn't immediately spin back up.

So, it appears the 5.11 HWE kernel is reporting phantom read I/O that isn't really there. As I said in the title, the 5.4 kernel works correctly.

This drive is one of six hard drives that are members of a ZFS zpool and all of them have this issue. My other, system, drives are an NVME SSD and a 2.5" SSD and I don't know if they also report phantom disk reads because they never go completely idle.

FWIW, I searched launchpad and bugzilla.kernel.org and I don't see any bugs or reports that match this behavior.

Update 01/17/22: Same problem occurs on Linux 5.8.0-63. Here's another demonstration (on 5.8.0) of the issue where diskstats shows reads occurring to a drive that's actually spun down and sleeping:

$ sudo hd-idle -t sdg
$ hddtemp /dev/sdg
/dev/sdg: HGST HDN726040ALE614: drive is sleeping
$ grep sdg /proc/diskstats
   8      96 sdg 6272 2 48966 34365 345 1 5952 315 0 21544 34858 0 0 0 0 12 177
   8      97 sdg1 3279 2 42088 29129 345 1 5952 315 0 16584 29445 0 0 0 0 0 0
   8     105 sdg9 41 0 576 86 0 0 0 0 0 104 86 0 0 0 0 0 0
$ sleep 5
$ grep sdg /proc/diskstats
   8      96 sdg 6302 2 48986 34367 345 1 5952 315 0 21580 34860 0 0 0 0 12 177
   8      97 sdg1 3279 2 42088 29129 345 1 5952 315 0 16584 29445 0 0 0 0 0 0
   8     105 sdg9 41 0 576 86 0 0 0 0 0 104 86 0 0 0 0 0 0
$ hddtemp /dev/sdg
/dev/sdg: HGST HDN726040ALE614: drive is sleeping
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.