LINUX.ORG.RU

Запись на NVME вешает систему на сервере HP DL580

 , ,


1

5

Всех приветствую! Прошу помочь советом/подсказкой по следующему вопросу: Имеется 2шт PCIE Intel Optane P3605 1.6TB c последней прошивкой на них (8DV1RA13). Прошивка BIOS сервера DL580 тоже обновлена до последней версии. При продолжительной записи больших объемов данных (от ~50Гб до 500Гб) на любой из nvme вешается операционная система (Пробовались CentOS 7, Ubuntu 20.04(ядра 5.4, 5.8), openSUSE 15.0).

Виснет рандомно относительно записанного объема (может и на ~50Гб и на ~100Гб и т.д.), но стабильно зависнет если лить файл 500Гб! От ФС это никак не зависит, т.к. пробовалось записывать и напрямую в устройство:

sudo dd if=/dev/zero of=/dev/nvme0n1 bs=1G count=600 status=progress

НО! Если записывать с флагом oflag=direct, то запись всегда проходит нормально:

sudo dd if=/dev/zero of=/dev/nvme0n1 bs=1G count=600 oflag=direct status=progress

Пробовались следующие флаги ядра (безуспешно):nvme_core.default_ps_max_latency_us=0 pcie_aspm=off acpi=off

Вот примеры ошибок которые можно наблюдать в dmesg:

[  699.476926] ------------[ cut here ]------------
[  699.476931] kernel BUG at fs/ext4/inode.c:2339!
[  699.476945] invalid opcode: 0000 [#1] SMP PTI
[  699.476951] CPU: 4 PID: 564 Comm: kworker/u129:2 Tainted: P           OE     5.4.0-72-generic #80-Ubuntu
[  699.476952] Hardware name: HP ProLiant DL580 G7, BIOS P65 05/21/2018
[  699.476967] Workqueue: writeback wb_workfn (flush-9:0)
[  699.476974] RIP: 0010:mpage_process_page_bufs+0xb4/0x120
[  699.476978] Code: 8b 02 25 00 12 00 00 89 47 38 48 8b 52 08 83 c3 01 48 39 f2 75 9f 8b 47 34 85 c0 74 5b 31 c0 44 39 e3 5b 41 5c 0f 92 c0 5d c3 <0f> 0b 3d ff 07 00 00 77 a0 8b 4f 30 01 c1 39 cb 75 97 48 8b 0a 44
[  699.476980] RSP: 0018:ffffa2090e33b910 EFLAGS: 00010202
[  699.476983] RAX: 98ec322dca35fbdc RBX: 000000000101b3c0 RCX: 000000000000000c
[  699.476984] RDX: ffff916df1800068 RSI: ffff916df1800068 RDI: ffffa2090e33ba90
[  699.476986] RBP: ffffa2090e33b920 R08: 0000001245ce9000 R09: ffffffffffffffff
[  699.476987] R10: ffff916e01ffd690 R11: 0000000000000000 R12: 0000000001245ce9
[  699.476989] R13: ffffdbd2e2c7e380 R14: ffff912d6634a8e8 R15: ffffa2090e33ba90
[  699.476991] FS:  0000000000000000(0000) GS:ffff912d9f900000(0000) knlGS:0000000000000000
[  699.476993] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  699.476995] CR2: 0000563b26aef008 CR3: 0000003ab8c0a000 CR4: 00000000000006e0
[  699.476996] Call Trace:
[  699.477004]  mpage_prepare_extent_to_map+0x1ee/0x2d0
[  699.477010]  ext4_writepages+0x5ab/0x950
[  699.477018]  ? update_nohz_stats+0x44/0x60
[  699.477024]  ? cpumask_next_and+0x1e/0x20
[  699.477027]  ? update_sd_lb_stats+0x6d2/0x7d0
[  699.477036]  do_writepages+0x43/0xd0
[  699.477038]  ? mpage_map_and_submit_extent+0x4b0/0x4b0
[  699.477040]  ? do_writepages+0x43/0xd0
[  699.477042]  ? find_busiest_group+0x49/0x520
[  699.477045]  __writeback_single_inode+0x40/0x300
[  699.477048]  writeback_sb_inodes+0x22d/0x4b0
[  699.477052]  __writeback_inodes_wb+0x56/0xf0
[  699.477054]  wb_writeback+0x20c/0x2f0
[  699.477057]  ? 0xffffffff88000000
[  699.477059]  ? cpumask_next+0x1b/0x20
[  699.477062]  wb_workfn+0x3a5/0x4f0
[  699.477066]  ? ttwu_do_activate+0x5b/0x70
[  699.477074]  process_one_work+0x1eb/0x3b0
[  699.477077]  worker_thread+0x4d/0x400
[  699.477081]  kthread+0x104/0x140
[  699.477083]  ? process_one_work+0x3b0/0x3b0
[  699.477086]  ? kthread_park+0x90/0x90
[  699.477094]  ret_from_fork+0x35/0x40
[  699.477097] Modules linked in: dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua snd_hda_codec_hdmi intel_powerclamp ipmi_ssif coretemp snd_hda_intel snd_intel_dspcfg snd_hda_codec joydev input_leds kvm_intel snd_hda_core kvm snd_hwdep snd_pcm snd_timer intel_cstate serio_raw snd soundcore hpilo ipmi_si ipmi_devintf ipmi_msghandler i7core_edac mac_hid acpi_power_meter nvidia_uvm(OE) sch_fq_codel ip_tables x_tables autofs4 btrfs zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid0 multipath linear nvidia_drm(POE) nvidia_modeset(POE) nvidia(POE) radeon i2c_algo_bit ttm drm_kms_helper syscopyarea sysfillrect sysimgblt raid1 fb_sys_fops hid_generic usbhid nvme uas gpio_ich hpsa usb_storage nvme_core psmouse drm hid pata_acpi lpc_ich scsi_transport_sas netxen_nic
[  699.477151] ---[ end trace 2cc63b9800bd0a9b ]---
[  618.000536] general protection fault: 0000 [#1] SMP PTI                                                                                                                                                [86/1065]
[  618.000536] CPU: 8 PID: 445 Comm: kworker/8:1H Tainted: P           OE     5.4.0-72-generic #80-Ubuntu 
[  618.000536] Hardware name: HP ProLiant DL580 G7, BIOS P65 05/21/2018                                                                                                                                            
[  618.000536] Workqueue: kblockd blk_mq_run_work_fn                                                     
[  618.000536] RIP: 0010:__kmalloc+0xa9/0x290                                                            
[  618.000536] Code: 08 65 4c 03 05 70 b7 d7 7a 49 83 78 10 00 4d 8b 20 0f 84 a5 01 00 00 4d 85 e4 0f 84 9c 01 00 00 41 8b 41 20 49 8b 39 4c 01 e0 <48> 8b 18 48 89 c1 49 33 99 70 01 00 00 4c 89 e0 48 0f c9 48 31
 cb                                                                                                                                                                                                                
[  618.000892] RSP: 0018:ffffb2b1c0d9bb68 EFLAGS: 00010282
[  618.001042] RAX: 9bfc73113d72df64 RBX: 0000000000000000 RCX: 0000000000000009
[  618.003055] RDX: 000000000000f9cd RSI: 0000000000092a20 RDI: 00000000000301a0
[  618.003055] RBP: ffffb2b1c0d9bb98 R08: ffff9974ff6301a0 R09: ffff9974f3006840
[  618.003282] R10: 0000000000000001 R11: ffff9974e3c87a00 R12: 9bfc73113d72df64
[  618.003282] R13: 0000000000092a20 R14: 0000000000000fe8 R15: ffff9974f3006840
[  618.003288] FS:  0000000000000000(0000) GS:ffff9974ff600000(0000) knlGS:0000000000000000
[  618.003288] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033                           
[  618.003290] CR2: 000055ffdbfa6f28 CR3: 0000000bf8e0a000 CR4: 00000000000006e0
[  618.003290] Call Trace:                                                                               
[  618.003290]  ? mempool_kmalloc+0x17/0x20
[  618.003290]  mempool_kmalloc+0x17/0x20                                                                                                                                                                          
[  618.003290]  mempool_alloc+0x64/0x180                                                                                                                                                                           
[  618.003290]  ? dma_pool_alloc+0xa2/0x1e0                                                                                                                                                                        
[  618.003290]  nvme_map_data+0x63/0x990 [nvme]                                                                                                                                                                    
[  618.003290]  ? blk_add_timer+0x5b/0xa0          
[  618.003290]  nvme_queue_rq+0xa2/0x1d0 [nvme]
[  618.003290]  blk_mq_dispatch_rq_list+0x93/0x610                                                                                                                                                                 
[  618.003297]  ? blk_mq_flush_busy_ctxs+0xf7/0x110                                                      
[  618.003297]  blk_mq_sched_dispatch_requests+0x162/0x180
[  618.003297]  __blk_mq_run_hw_queue+0x5a/0x110                                                         
[  618.003297]  blk_mq_run_work_fn+0x1b/0x20                                                             
[  618.003304]  process_one_work+0x1eb/0x3b0                                                             
[  618.003304]  worker_thread+0x4d/0x400                                                                 
[  618.003304]  kthread+0x104/0x140                                                                      
[  618.003311]  ? process_one_work+0x3b0/0x3b0
[  618.003311]  ? kthread_park+0x90/0x90                                                                 
[  618.003311]  ret_from_fork+0x35/0x40                                                                  
[  618.003311] Modules linked in: dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec input_leds joydev mac_hid snd_hda_core snd_hwdep snd_pcm intel
_powerclamp snd_timer snd coretemp soundcore kvm_intel hpilo i7core_edac ipmi_si ipmi_devintf kvm ipmi_msghandler intel_cstate serio_raw nvidia_uvm(OE) sch_fq_codel ip_tables x_tables autofs4 btrfs zstd_compress
 raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear nvidia_drm(POE) nvidia_modeset(POE) radeon i2c_algo_bit nvidia(POE) ttm drm_kms_help
er syscopyarea hid_generic sysfillrect sysimgblt gpio_ich usbhid fb_sys_fops uas hpsa nvme psmouse hid usb_storage drm lpc_ich pata_acpi scsi_transport_sas nvme_core netxen_nic
[  618.043362] ---[ end trace 41e6ea2bfdc8eae9 ]---

доп информация:

# intelmas show -smart -intelssd 0
- 0 Intel SSD DC P3600 Series CVMD511500H31P6KGN -

Bootloader : 8B1B012E
Capacity : 1600.32 GB
CurrentPercent : 100.00
DevicePath : /dev/nvme0n1
DeviceStatus : Healthy
Firmware : 8DV1RA13
FirmwareUpdateAvailable : No known update for SSD. If an update is expected, please contact your SSD Vendor representative about firmware update for this drive.
Index : 0
MaximumLBA : 3125627567
ModelNumber : INTEL SSDPEDME016T4S
NamespaceId : 1
ProductFamily : Intel SSD DC P3600 Series
SMARTEnabled : True
SectorDataSize : 512
SerialNumber : CVMD511500H31P6KGN


#free -h
              total        used        free      shared  buff/cache   available
Mem:          377Gi       460Mi       376Gi       1.0Mi       472Mi       375Gi
Swap:          12Gi          0B        12Gi

#cat  /sys/block/nvme0n1/queue/write_cache
write through

#cat /sys/block/nvme0n1/queue/max_hw_sectors_kb
128

#cat  /sys/block/nvme0n1/queue/max_sectors_kb
128

#cat  /sys/block/nvme0n1/queue/nr_requests
1023

Со всеми этими параметрами пробовали играться, пока безрезультатно.

Update1:

Пробовали менять следующие значения (безрезультатно):

vm.dirty_background_bytes
vm.dirty_background_ratio
vm.dirty_background_ratio
vm.dirty_expire_centisecs
vm.dirty_ratio
vm.dirty_writeback_centisecs

Например:

$ sudo sysctl -a|grep vm.dirty_
vm.dirty_background_bytes = 1048576
vm.dirty_background_ratio = 0
vm.dirty_bytes = 1048576
vm.dirty_expire_centisecs = 1
vm.dirty_ratio = 0
vm.dirty_writeback_centisecs = 1

Smart:

#sudo nvme smart-log /dev/nvme0n1 
Smart Log for NVME device:nvme0n1 namespace-id:ffffffff
critical_warning                    : 0
temperature                         : 37 C
available_spare                     : 100%
available_spare_threshold           : 10%
percentage_used                     : 0%
data_units_read                     : 2,101,367
data_units_written                  : 3,015,266
host_read_commands                  : 756,212,170
host_write_commands                 : 112,599,228
controller_busy_time                : 60
power_cycles                        : 135
power_on_hours                      : 30,683
unsafe_shutdowns                    : 100
media_errors                        : 0
num_err_log_entries                 : 0
Warning Temperature Time            : 0
Critical Composite Temperature Time : 0
Thermal Management T1 Trans Count   : 0
Thermal Management T2 Trans Count   : 0
Thermal Management T1 Total Time    : 0
Thermal Management T2 Total Time    : 0



#sudo smartctl -a /dev/nvme0n1 
smartctl 7.1 2019-12-30 r5022 [x86_64-linux-5.4.0-72-generic] (local build)
Copyright (C) 2002-19, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       INTEL SSDPEDME016T4S
Serial Number:                      CVMD511500H31P6KGN
Firmware Version:                   8DV1RA13
PCI Vendor ID:                      0x8086
PCI Vendor Subsystem ID:            0x108e
IEEE OUI Identifier:                0x5cd2e4
Controller ID:                      0
Number of Namespaces:               1
Namespace 1 Size/Capacity:          1,600,321,314,816 [1.60 TB]
Namespace 1 Formatted LBA Size:     512
Local Time is:                      Mon May  3 07:38:17 2021 UTC
Firmware Updates (0x02):            1 Slot
Optional Admin Commands (0x0006):   Format Frmw_DL
Optional NVM Commands (0x0006):     Wr_Unc DS_Mngmt
Maximum Data Transfer Size:         32 Pages

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +    25.00W       -        -    0  0  0  0        0       0

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         2
 1 -     512       8         2
 2 -     512      16         2
 3 -    4096       0         0
 4 -    4096       8         0
 5 -    4096      64         0
 6 -    4096     128         0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        37 Celsius
Available Spare:                    100%
Available Spare Threshold:          10%
Percentage Used:                    0%
Data Units Read:                    2,101,376 [1.07 TB]
Data Units Written:                 3,015,266 [1.54 TB]
Host Read Commands:                 756,212,370
Host Write Commands:                112,599,228
Controller Busy Time:               60
Power Cycles:                       135
Power On Hours:                     30,683
Unsafe Shutdowns:                   100
Media and Data Integrity Errors:    0
Error Information Log Entries:      0

Error Information (NVMe Log 0x01, max 64 entries)
No Errors Logged

Подскажите в каком направлении дальше копать, уже уйму всего перепробовали.

вешается операционная система

С большим vm.dirty_bytes можно почти любую систему повесить.

Разумеется, отключение кэша записи решает проблему.

hakavlad ★★ ()
Ответ на: комментарий от hakavlad

Да, забыл указать (проапдейтил сообщение). Одно из первых что попробовали это уменьшить: vm.dirty_background_ratio и vm.dirty_ratio до 1, что в МБ даже меньше чем на других серверах, но безрезультатно.

Сейчас попробовали уменьшить еще (теперь и в байтах) до 64000000 и даже до 1048576. Увы, не решает проблему…

altman2k ()
Ответ на: комментарий от altman2k

ах! тогда могу предложить безопасное средство копирования:

#!/usr/bin/env python3
"""xcp
usage:
./xcp source dest_file
"""

import os
from time import monotonic, sleep
from sys import argv, exit
import threading


def start_thread(func, *a, **k):
    """ run function in a new thread
    """
    threading.Thread(target=func, args=a, kwargs=k, daemon=True).start()

fd = dict()

x = dict()

MIB = 1024**2

chunk_size = MIB

fd['FINISH_READER'] = False

if_path, of_path = argv[1:]

if_size0 = os.stat(if_path).st_size


fd['r'] = 0
fd['w'] = 0

try:
    fd[if_path] = open(if_path, 'rb')
except Exception as e:
    print(e)
    exit(1)

try:
    fd[of_path] = open(of_path, 'wb')
except Exception as e:
    print(e)
    exit(1)

print('source file: {}, size: {} MiB'.format(if_path, round(
    os.stat(if_path).st_size / MIB, 1)))
print('destination file: {}, size: {} MiB'.format(of_path, round(
    os.stat(of_path).st_size / MIB, 1)))
print('-------\n')

t0 = monotonic()

def reader():
    """
    """
    c = 0
    while True:
        if len(x) >= 50:
            sleep(0.1)
            continue
        chunk = fd[if_path].read(chunk_size)
        x[c] = chunk
        if len(chunk) == 0:
            fd['FINISH_READER'] = True
            break
        c += 1
        fd['r'] += len(chunk)

start_thread(reader)

c = 0

while True:
    try:
        chunk = x[c]
        try:
            fd[of_path].write(chunk)
        except OSError as e:

            print(e)
            os.fsync(fd[of_path])
            exit(1)

        del x[c]

        os.fsync(fd[of_path])


    except KeyError:
        sleep(0.1)
        continue
    c += 1

    fd['w'] += len(chunk)

    t = monotonic() - t0
    speed = fd['w'] / MIB / t

    print('\033Mread {}M; written {}M in {}s ({}M/s)'.format(
        round(fd['r'] / MIB, 1), round(fd['w'] / MIB, 1), round(t, 1), round(speed, 1)
        ))

    if fd['w'] == fd['r'] and fd['FINISH_READER']:
        os.fsync(fd[of_path])
        break

t = monotonic() - t0
speed = fd['w'] / MIB / t

print('-------')
print('OK; read {}M; written {}M in {}s ({}M/s)'.format(
    round(fd['r'] / MIB, 1), round(fd['w'] / MIB, 1), round(t, 1), round(speed, 1)
    ))

Вывод примерно такой:

$ ./xcp a b
source file: a, size: 390.5 MiB
destination file: b, size: 0.0 MiB
-------
read 390.5M; written 390.5M in 42.7s (9.1M/s)
-------
OK; read 390.5M; written 390.5M in 42.7s (9.1M/s)

Копирует чанками по мегабайту, выполняет fsync периодически. Прогресс отображает.

hakavlad ★★ ()
Последнее исправление: hakavlad (всего исправлений: 1)