Ubuntu 17.10 でサスペンド後に非常に遅くなる

Ubuntu 17.10 でサスペンド後に非常に遅くなる

昨日、Ubuntu 17.10 にアップデートしたのですが、サスペンドとウェイクアップが非常に遅くなります。たとえば、次のコマンドを実行します。

time docker-compose run web rspec --color spec/models/user_spec.rb:7

サスペンドまでに5秒かかり、1.47後。

確認したところgnome-system-monitor、すべて正常のようです。

いくつかベンチマークを実行したところ、停止前に次の結果が得られました。

~ sysbench cpu --threads=4 run

    WARNING: --num-threads is deprecated, use --threads instead
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 4
    Initializing random number generator from current time


    Prime numbers limit: 10000

    Initializing worker threads...

    Threads started!

    CPU speed:
        events per second:  3766.37

    General statistics:
        total time:                          10.0009s
        total number of events:              37672

    Latency (ms):
             min:                                  1.02
             avg:                                  1.06
             max:                                 10.94
             95th percentile:                      1.10
             sum:                              39990.91

    Threads fairness:
        events (avg/stddev):           9418.0000/36.06
        execution time (avg/stddev):   9.9977/0.00

~ sysbench memory --threads=4 run
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 4
    Initializing random number generator from current time


    Running memory speed test with the following options:
      block size: 1KiB
      total size: 102400MiB
      operation: write
      scope: global

    Initializing worker threads...

    Threads started!

    Total operations: 104857600 (12034664.21 per second)

    102400.00 MiB transferred (11752.60 MiB/sec)


    General statistics:
        total time:                          8.7111s
        total number of events:              104857600

    Latency (ms):
             min:                                  0.00
             avg:                                  0.00
             max:                                  6.78
             95th percentile:                      0.00
             sum:                              21761.44

    Threads fairness:
        events (avg/stddev):           26214400.0000/0.00
        execution time (avg/stddev):   5.4404/0.06

~ sysbench fileio --file-total-size=15G --file-test-mode=rndrw --max-requests=0 --file-num=64 --threads=4 run
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 4
    Initializing random number generator from current time


    Extra file open flags: 0
    64 files, 240MiB each
    15GiB total file size
    Block size 16KiB
    Number of IO requests: 0
    Read/Write ratio for combined random IO test: 1.50
    Periodic FSYNC enabled, calling fsync() each 100 requests.
    Calling fsync() at the end of test, Enabled.
    Using synchronous I/O mode
    Doing random r/w test
    Initializing worker threads...

    Threads started!


    File operations:
        reads/s:                      83.32
        writes/s:                     55.38
        fsyncs/s:                     85.50

    Throughput:
        read, MiB/s:                  1.30
        written, MiB/s:               0.87

    General statistics:
        total time:                          10.0912s
        total number of events:              2263

    Latency (ms):
             min:                                  0.00
             avg:                                 17.78
             max:                                584.69
             95th percentile:                     92.42
             sum:                              40229.56

    Threads fairness:
        events (avg/stddev):           565.7500/61.92
        execution time (avg/stddev):   10.0574/0.03

~ sysbench threads --threads=4 run
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 4
    Initializing random number generator from current time


    Initializing worker threads...

    Threads started!


    General statistics:
        total time:                          10.0002s
        total number of events:              203148

    Latency (ms):
             min:                                  0.14
             avg:                                  0.20
             max:                                  6.25
             95th percentile:                      0.21
             sum:                              39963.81

    Threads fairness:
        events (avg/stddev):           50787.0000/116.11
        execution time (avg/stddev):   9.9910/0.00

~ sysbench mutex run
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 1
    Initializing random number generator from current time


    Initializing worker threads...

    Threads started!


    General statistics:
        total time:                          0.1467s
        total number of events:              1

    Latency (ms):
             min:                                146.63
             avg:                                146.63
             max:                                146.63
             95th percentile:                    147.61
             sum:                                146.63

    Threads fairness:
        events (avg/stddev):           1.0000/0.00
        execution time (avg/stddev):   0.1466/0.00

そしてその後は:

~ sysbench cpu --threads=4 run
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 4
    Initializing random number generator from current time


    Prime numbers limit: 10000

    Initializing worker threads...

    Threads started!

    CPU speed:
        events per second:  3746.73

    General statistics:
        total time:                          10.0005s
        total number of events:              37474

    Latency (ms):
             min:                                  1.02
             avg:                                  1.07
             max:                                 12.04
             95th percentile:                      1.16
             sum:                              39992.93

    Threads fairness:
        events (avg/stddev):           9368.5000/452.12
        execution time (avg/stddev):   9.9982/0.00

~ sysbench memory --threads=4 run
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 4
    Initializing random number generator from current time


    Running memory speed test with the following options:
      block size: 1KiB
      total size: 102400MiB
      operation: write
      scope: global

    Initializing worker threads...

    Threads started!

    Total operations: 104857600 (11640930.78 per second)

    102400.00 MiB transferred (11368.10 MiB/sec)


    General statistics:
        total time:                          9.0057s
        total number of events:              104857600

    Latency (ms):
             min:                                  0.00
             avg:                                  0.00
             max:                                  6.41
             95th percentile:                      0.00
             sum:                              21740.13

    Threads fairness:
        events (avg/stddev):           26214400.0000/0.00
        execution time (avg/stddev):   5.4350/0.12

~ sysbench fileio --file-total-size=15G --file-test-mode=rndrw --max-requests=0 --file-num=64 --threads=4 run
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 4
    Initializing random number generator from current time


    Extra file open flags: 0
    64 files, 240MiB each
    15GiB total file size
    Block size 16KiB
    Number of IO requests: 0
    Read/Write ratio for combined random IO test: 1.50
    Periodic FSYNC enabled, calling fsync() each 100 requests.
    Calling fsync() at the end of test, Enabled.
    Using synchronous I/O mode
    Doing random r/w test
    Initializing worker threads...

    Threads started!


    File operations:
        reads/s:                      3.93
        writes/s:                     2.52
        fsyncs/s:                     1.81

    Throughput:
        read, MiB/s:                  0.06
        written, MiB/s:               0.04

    General statistics:
        total time:                          15.4994s
        total number of events:              128

    Latency (ms):
             min:                                  0.00
             avg:                                428.29
             max:                               6760.00
             95th percentile:                   1771.29
             sum:                              54820.53

    Threads fairness:
        events (avg/stddev):           32.0000/7.18
        execution time (avg/stddev):   13.7051/2.10


~ sysbench threads --threads=4 run
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 4
    Initializing random number generator from current time


    Initializing worker threads...

    Threads started!


    General statistics:
        total time:                          10.0002s
        total number of events:              201233

    Latency (ms):
             min:                                  0.14
             avg:                                  0.20
             max:                                 11.33
             95th percentile:                      0.22
             sum:                              39965.00

    Threads fairness:
        events (avg/stddev):           50308.2500/318.90
        execution time (avg/stddev):   9.9913/0.00

~ sysbench mutex run
    sysbench 1.0.8 (using system LuaJIT 2.0.4)

    Running the test with following options:
    Number of threads: 1
    Initializing random number generator from current time


    Initializing worker threads...

    Threads started!


    General statistics:
        total time:                          0.1603s
        total number of events:              1

    Latency (ms):
             min:                                160.21
             avg:                                160.21
             max:                                160.21
             95th percentile:                    161.51
             sum:                                160.21

    Threads fairness:
        events (avg/stddev):           1.0000/0.00
        execution time (avg/stddev):   0.1602/0.00

最も重要な違いは fileio にあるようです。編集: 間違っていました。もう一度テストをしてみたところ、total number of events: 1282最初のテストと似た結果になりました。

より多くの情報を得るためにこのテストを実行しました:

~ dd if=/dev/zero of=./largefile bs=1M count=1024
1024+0 records in
1024+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 1.2191 s, 881 MB/s
➜ dd if=./largefile of=/dev/null bs=4k
262144+0 records in
262144+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 0.174457 s, 6.2 GB/s

それは正しいようです。

私は持っているこれとdmesg

最も重要な行は次のとおりです。

[  117.822557] ACPI Error: [DSSP] Namespace lookup failure, AE_NOT_FOUND (20170531/psargs-364)
[  117.822561] ACPI Error: Method parse/execution failed \_SB.PCI0.SAT0.CHN1.DRV0._GTF, AE_NOT_FOUND (20170531/psparse-550)
[  117.822577] ACPI Error: [DSSP] Namespace lookup failure, AE_NOT_FOUND (20170531/psargs-364)
[  117.822579] ACPI Error: Method parse/execution failed \_SB.PCI0.SAT0.CHN1.DRV1._GTF, AE_NOT_FOUND (20170531/psparse-550)
[  117.822621] ACPI Error: [DSSP] Namespace lookup failure, AE_NOT_FOUND (20170531/psargs-364)
[  117.822623] ACPI Error: Method parse/execution failed \_SB.PCI0.SAT0.CHN0.DRV0._GTF, AE_NOT_FOUND (20170531/psparse-550)
[  117.822793] rtc_cmos 00:02: Alarms can be up to one month in the future
[  119.168408] ata1.01: failed to resume link (SControl 30)
[  119.323036] ACPI Error: [DSSP] Namespace lookup failure, AE_NOT_FOUND (20170531/psargs-364)
[  119.323043] ACPI Error: Method parse/execution failed \_SB.PCI0.SAT0.CHN0.DRV0._GTF, AE_NOT_FOUND (20170531/psparse-550)
[  120.781116] done.
[  123.636265] ata2.00: link is slow to respond, please be patient (ready=0)
[  127.848898] ata2.00: SRST failed (errno=-16)
[  129.051082] ACPI Error: [DSSP] Namespace lookup failure, AE_NOT_FOUND (20170531/psargs-364)
[  129.051093] ACPI Error: Method parse/execution failed \_SB.PCI0.SAT0.CHN1.DRV1._GTF, AE_NOT_FOUND (20170531/psparse-550)
[  129.205049] ACPI Error: [DSSP] Namespace lookup failure, AE_NOT_FOUND (20170531/psargs-364)
[  129.205059] ACPI Error: Method parse/execution failed \_SB.PCI0.SAT0.CHN1.DRV0._GTF, AE_NOT_FOUND (20170531/psparse-550)

ata2 と ACPI に何らかの問題があるようです。これは関連していると思いますが、どうすればよいかわかりません。これらの行は、サスペンドして復帰したときにのみ表示されます。

私のシステムに関する情報はこちら

Linux oscar 4.13.0-16-lowlatency #19-Ubuntu SMP PREEMPT Wed Oct 11 19:51:52 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

何か手がかりはありますか?

答え1

私にとって有効な解決策を見つけました (Ubuntu 20.04、DELL XPS 15)ここ幅広いシステムで動作するようです (Ubuntu 15.04、16.04、18.04、およびいくつかの Archlinux バージョンを確認しました)。そのため、あなたのシステムでも動作する可能性が高いです。

要約すると、次のことを試してください。

sudo apt install msr-tools
sudo modprobe msr
sudo rdmsr -a 0x19a

最後のコマンドが のみを返さない場合0(私の場合は 8 回返していました10)、次を実行します。

sudo wrmsr -a 0x19a 0x0

すぐに速度が上がるはずです。また、rdmsr上記と同じ方法で再度実行すると、今度は0s のみが返されるはずです。

関連情報