Skip to contentSkip to conversation

ASPM powersupersave change NVMe SSD Samsung 960 PRO capacity to 0 and read-only

DISCUSSION Maik Broemme 4 participants 9 messages Dec 14, 2017 – Jan 11, 2018 PCI

lore
Share & tools
lore
#0 lore raw

Hi,

I have a Samsung 960 PRO NVMe SSD (Non-Volatile memory controller:
Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961). It works fine until I enable powersupersave via /sys/module/pcie_aspm/parameters/policy

ASPM is enabled in BIOS and works fine for all devices and in powersave mode. I'm able to reproduce this always at any time while the system is up and running via:

$> echo powersupersave > /sys/module/pcie_aspm/parameters/policy

The Linux kernel is 4.14.4 and APST for my device is working with powersave. As soon as I enable powersupersave I get:

[11535.142755] dpc 0000:00:10.0:pcie010: DPC containment event, status:0x1f09 source:0x0000
[11535.142760] dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable error detected, remove downstream devices
[11535.159999] nvme0n1: detected capacity change from 1024209543168 to 0
[11535.163502] print_req_error: I/O error, dev nvme0n1, sector 23072824
[11535.163545] EXT4-fs warning (device dm-1): ext4_end_bio:323: I/O error 10 writing to inode 404202 (offset 0 size 0 starting block 1703943)
[11535.163547] Buffer I/O error on device dm-1, logical block 1703943
[11535.163739] print_req_error: I/O error, dev nvme0n1, sector 94970176
[11535.163768] print_req_error: I/O error, dev nvme0n1, sector 1683511568
[11535.190820] blk_partition_remap: fail for partition 2
[11535.216636] blk_partition_remap: fail for partition 2
[11535.216673] blk_partition_remap: fail for partition 2
[11535.217870] blk_partition_remap: fail for partition 2
[11535.219894] nvme nvme0: failed to set APST feature (-19)
[11535.234716] blk_partition_remap: fail for partition 2
[11535.246037] blk_partition_remap: fail for partition 2
...
[11535.882960] blk_partition_remap: fail for partition 2
[11535.882962] blk_partition_remap: fail for partition 2
[11535.882966] Aborting journal on device dm-1-8.
[11535.883008] blk_partition_remap: fail for partition 2
[11535.883012] Buffer I/O error on dev dm-1, logical block 1081344, lost sync page write
[11535.883017] JBD2: Error -5 detected when updating journal superblock for dm-1-8.
[11535.883139] blk_partition_remap: fail for partition 2
[11535.883142] Buffer I/O error on dev dm-1, logical block 0, lost sync page write
[11535.883151] EXT4-fs error (device dm-1): ext4_journal_check_start:61: Detected aborted journal
[11535.883157] EXT4-fs (dm-1): Remounting filesystem read-only
[11535.883161] EXT4-fs (dm-1): previous I/O error to superblock detected
[11535.883167] blk_partition_remap: fail for partition 2
[11535.883168] Buffer I/O error on dev dm-1, logical block 0, lost sync page write
[11535.883219] blk_partition_remap: fail for partition 2
[11535.883226] blk_partition_remap: fail for partition 2
[11535.883263] systemd-journald[459]: Failed to create new system journal: Read-only file system

It looks like APST feature cannot be set anymore after enabling powersupersave. Also the PCIe device disappears completely from lspci output. Here is my nvme output before switching to powersupersave:

root@server:~# nvme get-feature -f 0x0c -H /dev/nvme0
get-feature:0xc (Autonomous Power State Transition), Current value:0x000001
	Autonomous Power State Transition Enable (APSTE): Enabled
	Auto PST Entries	.................
	Entry[ 0]   
	.................
	Idle Time Prior to Transition (ITPT): 71 ms
	Idle Transition Power State   (ITPS): 3
	.................
	Entry[ 1]   
	.................
	Idle Time Prior to Transition (ITPT): 71 ms
	Idle Transition Power State   (ITPS): 3
	.................
	Entry[ 2]   
	.................
	Idle Time Prior to Transition (ITPT): 71 ms
	Idle Transition Power State   (ITPS): 3
	.................
	Entry[ 3]   
	.................
	Idle Time Prior to Transition (ITPT): 400 ms
	Idle Transition Power State   (ITPS): 4
	.................
	Entry[ 4]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[ 5]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[ 6]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[ 7]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[ 8]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[ 9]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[10]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[11]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[12]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[13]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[14]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[15]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[16]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[17]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[18]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[19]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[20]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[21]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[22]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[23]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[24]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[25]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[26]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[27]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[28]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[29]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[30]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
	Entry[31]   
	.................
	Idle Time Prior to Transition (ITPT): 0 ms
	Idle Transition Power State   (ITPS): 0
	.................
       0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
0000: 18 47 00 00 00 00 00 00 18 47 00 00 00 00 00 00 ".G.......G......"
0010: 18 47 00 00 00 00 00 00 20 90 01 00 00 00 00 00 ".G.............."
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"
00f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 "................"

Any idea why the device is failing with powersupersave and how to avoid it? Especially how to enable it but skip certain broken devices as this is my boot device.

--Maik

#1 lore raw

[+cc Rajat, Keith, linux-kernel]

Quoted 11 lines · Maik Broemme

I have a Samsung 960 PRO NVMe SSD (Non-Volatile memory controller:
Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961). It works fine until I enable powersupersave via /sys/module/pcie_aspm/parameters/policy

ASPM is enabled in BIOS and works fine for all devices and in powersave mode. I'm able to reproduce this always at any time while the system is up and running via:

$> echo powersupersave > /sys/module/pcie_aspm/parameters/policy

Quoted 7 lines

The Linux kernel is 4.14.4 and APST for my device is working with powersave. As soon as I enable powersupersave I get:

[11535.142755] dpc 0000:00:10.0:pcie010: DPC containment event, status:0x1f09 source:0x0000
[11535.142760] dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable error detected, remove downstream devices
[11535.159999] nvme0n1: detected capacity change from 1024209543168 to 0

...

Can you start by opening a bug report at https://bugzilla.kernel.org,
category Drivers/PCI, and attaching the complete "lspci -vv" output (as root) and the complete dmesg log? Make sure you have a new enough lspci to decode the ASPM L1 Substates capability and the LTR bits. Source is at git://git.kernel.org/pub/scm/utils/pciutils/pciutils.git

powersupersave enables ASPM L1 Substates. Rajat, do you have any ideas about this or how we might debug it?

Keith, is this really all the information about the event that we can get out of DPC? Is there some AER logging we might be able to get via "lspci -vv"? Sounds like this is the boot disk, so Maik may not be able to run lspci after the DPC event. If there *is* any AER info, can we connect up the DPC event so we can print the AER info from the kernel?

I wonder if there's some way improper L1 Substate configuration could cause a DPC event. There are lots of knobs there that seem to depend on devices, and I'm not sure we have them all correct yet.

There are some recent changes in that area that are in linux-next:

PCI/ASPM: Enable Latency Tolerance Reporting when supported PCI/ASPM: Calculate LTR_L1.2_THRESHOLD from device characteristics PCI/ASPM: Use correct capability pointer to program LTR_L1.2_THRESHOLD PCI/ASPM: Account for downstream device's Port Common_Mode_Restore_Time

It's conceivable that they could have some bearing on this problem. If you could give this a whirl on linux-next, that would be interesting. If you do this, please also collect the "lspci -vv" output there so we can compare it with the v4.14 configuration.

Quoted 3 lines

It looks like APST feature cannot be set anymore after enabling powersupersave. Also the PCIe device disappears completely from lspci output.

My guess is this is to be expected after the DPC event. That basically disconnects the PCIe device from the system.

Quoted 3 lines

Any idea why the device is failing with powersupersave and how to avoid it? Especially how to enable it but skip certain broken devices as this is my boot device.

We could conceivably add a quirk if we find that L1SS is broken on this particular device. But L1SS is so new that I'd be more suspicious of the Linux code than the device.

Bjorn

#2 lore raw
Quoted 31 lines · Bjorn Helgaas

[+cc Rajat, Keith, linux-kernel]

Quoted 11 lines · Maik Broemme

I have a Samsung 960 PRO NVMe SSD (Non-Volatile memory controller:
Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961). It works fine until I enable powersupersave via /sys/module/pcie_aspm/parameters/policy

ASPM is enabled in BIOS and works fine for all devices and in powersave mode. I'm able to reproduce this always at any time while the system is up and running via:

$> echo powersupersave > /sys/module/pcie_aspm/parameters/policy

Quoted 7 lines

The Linux kernel is 4.14.4 and APST for my device is working with powersave. As soon as I enable powersupersave I get:

[11535.142755] dpc 0000:00:10.0:pcie010: DPC containment event, status:0x1f09 source:0x0000
[11535.142760] dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable error detected, remove downstream devices
[11535.159999] nvme0n1: detected capacity change from 1024209543168 to 0

...

Can you start by opening a bug report at https://bugzilla.kernel.org,
category Drivers/PCI, and attaching the complete "lspci -vv" output (as root) and the complete dmesg log? Make sure you have a new enough lspci to decode the ASPM L1 Substates capability and the LTR bits. Source is at git://git.kernel.org/pub/scm/utils/pciutils/pciutils.git

powersupersave enables ASPM L1 Substates. Rajat, do you have any ideas about this or how we might debug it?

Quoted 6 lines

Keith, is this really all the information about the event that we can get out of DPC? Is there some AER logging we might be able to get via "lspci -vv"? Sounds like this is the boot disk, so Maik may not be able to run lspci after the DPC event. If there *is* any AER info, can we connect up the DPC event so we can print the AER info from the kernel?

There should be information in the AER register. The base spec section 6.2.5 ("Sequence of Device Eror Signaling and Logging") says the corresponding bit in the AER Uncorrectable Error Status register should be set before triggerring DPC. The sequence ends with the DPC trigger, so the Linux AER service was never notified to handle the event.

As an enhancement to the DPC driver, we may be able to enqueue an AER event to see if that may provide additional details about the error. I can implement that enhanmcement, and should have something for consideration sometime in the next week.

On a side note, now that root ports are implementing DPC, we should probably consult the platform for AER firmware first. The PCIe specification strongly recommends linking DPC control to that of AER, so I'll try to add that check as well.

#3 lore raw
In reply to Bjorn Helgaas
Quoted 25 lines · Bjorn Helgaas

[+cc Rajat, Keith, linux-kernel]

Quoted 9 lines · Maik Broemme

I have a Samsung 960 PRO NVMe SSD (Non-Volatile memory controller:
Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961). It works fine until I enable powersupersave via /sys/module/pcie_aspm/parameters/policy

ASPM is enabled in BIOS and works fine for all devices and in powersave mode. I'm able to reproduce this always at any time while the system is up and running via:

Quoted 7 lines

$> echo powersupersave > /sys/module/pcie_aspm/parameters/policy

The Linux kernel is 4.14.4 and APST for my device is working with powersave. As soon as I enable powersupersave I get:

[11535.142755] dpc 0000:00:10.0:pcie010: DPC containment event,

status:0x1f09 source:0x0000

Quoted 1 line
[11535.142760] dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable

error detected, remove downstream devices

Quoted 2 lines
[11535.159999] nvme0n1: detected capacity change from 1024209543168 to 0

...

Quoted 9 lines

Can you start by opening a bug report at https://bugzilla.kernel.org,
category Drivers/PCI, and attaching the complete "lspci -vv" output (as root) and the complete dmesg log? Make sure you have a new enough lspci to decode the ASPM L1 Substates capability and the LTR bits. Source is at git://git.kernel.org/pub/scm/utils/pciutils/pciutils.git

powersupersave enables ASPM L1 Substates. Rajat, do you have any ideas about this or how we might debug it?

I know Maik mentioned that this is the boot device. Maik, is it possible to boot off something else so that we can do some more experiments on this port? If so,
- can you try to see if the device comes back if you switch the ASPM policy back from "powersupersave" -> powersave, and potentially do a rescan (echo 1 > /sys/bus/pci/rescan)?
- It would be good to get the complete lspci -vv for the root port (assuming device is connected to root port i.e. no switch). Specifically what does the Link status show?
- Also, do you know if your root port provides any debug registers that could tell the current L1 substate of the link (My system's root port had such register).
- I had usually resorted to a PCIe analyzer to peak at the packets when I was debugging it. Not sure if that is an option here.

I don't see any debug prints in aspm.c that we could enable. Even if I provide a patch, I suspect that the problem will start at the last step of the pcie_config_aspm_l1ss() i.e. as soon as we really enable it in HW. Maik, would you be open to take a debug patch that adds some debug prints and try it out (compile your kernel with that patch)?

Quoted 41 lines

Keith, is this really all the information about the event that we can get out of DPC? Is there some AER logging we might be able to get via "lspci -vv"? Sounds like this is the boot disk, so Maik may not be able to run lspci after the DPC event. If there *is* any AER info, can we connect up the DPC event so we can print the AER info from the kernel?

I wonder if there's some way improper L1 Substate configuration could cause a DPC event. There are lots of knobs there that seem to depend on devices, and I'm not sure we have them all correct yet.

There are some recent changes in that area that are in linux-next:

PCI/ASPM: Enable Latency Tolerance Reporting when supported PCI/ASPM: Calculate LTR_L1.2_THRESHOLD from device characteristics PCI/ASPM: Use correct capability pointer to program LTR_L1.2_THRESHOLD PCI/ASPM: Account for downstream device's Port Common_Mode_Restore_Time

It's conceivable that they could have some bearing on this problem. If you could give this a whirl on linux-next, that would be interesting. If you do this, please also collect the "lspci -vv" output there so we can compare it with the v4.14 configuration.

Quoted 3 lines

It looks like APST feature cannot be set anymore after enabling powersupersave. Also the PCIe device disappears completely from lspci output.

My guess is this is to be expected after the DPC event. That basically disconnects the PCIe device from the system.

Quoted 3 lines

Any idea why the device is failing with powersupersave and how to avoid it? Especially how to enable it but skip certain broken devices as this is my boot device.

We could conceivably add a quirk if we find that L1SS is broken on this particular device. But L1SS is so new that I'd be more suspicious of the Linux code than the device.

Bjorn

#4 lore raw
In reply to Bjorn Helgaas
Quoted 22 lines · Bjorn Helgaas

[+cc Rajat, Keith, linux-kernel]

Quoted 11 lines · Maik Broemme

I have a Samsung 960 PRO NVMe SSD (Non-Volatile memory controller:
Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961). It works fine until I enable powersupersave via /sys/module/pcie_aspm/parameters/policy

ASPM is enabled in BIOS and works fine for all devices and in powersave mode. I'm able to reproduce this always at any time while the system is up and running via:

$> echo powersupersave > /sys/module/pcie_aspm/parameters/policy

Quoted 7 lines

The Linux kernel is 4.14.4 and APST for my device is working with powersave. As soon as I enable powersupersave I get:

[11535.142755] dpc 0000:00:10.0:pcie010: DPC containment event, status:0x1f09 source:0x0000
[11535.142760] dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable error detected, remove downstream devices
[11535.159999] nvme0n1: detected capacity change from 1024209543168 to 0

...

Quoted 8 lines

Can you start by opening a bug report at https://bugzilla.kernel.org,
category Drivers/PCI, and attaching the complete "lspci -vv" output (as root) and the complete dmesg log? Make sure you have a new enough lspci to decode the ASPM L1 Substates capability and the LTR bits. Source is at git://git.kernel.org/pub/scm/utils/pciutils/pciutils.git

powersupersave enables ASPM L1 Substates. Rajat, do you have any ideas about this or how we might debug it?

I know Maik mentioned that this is the boot device. Maik, is it possible to boot off something else so that we can do some more experiments on this port? If so,
- can you try to see if the device comes back if you switch the ASPM policy back from "powersupersave" -> powersave, and potentially do a rescan (echo 1 > /sys/bus/pci/rescan)?
- It would be good to get the complete lspci -vv for the root port (assuming device is connected to root port i.e. no switch). Specifically what does the Link status show?
- Also, do you know if your root port provides any debug registers that could tell the current L1 substate of the link (My system's root port had such register).
- I had usually resorted to a PCIe analyzer to peak at the packets when I was debugging it. Not sure if that is an option here.

I don't see any debug prints in aspm.c that we could enable. Even if I provide a patch, I suspect that the problem will start at the last step of the pcie_config_aspm_l1ss() i.e. as soon as we really enable it in HW. Maik, would you be open to take a debug patch that adds some debug prints and try it out (compile your kernel with that patch)?

Quoted 40 lines

Keith, is this really all the information about the event that we can get out of DPC? Is there some AER logging we might be able to get via "lspci -vv"? Sounds like this is the boot disk, so Maik may not be able to run lspci after the DPC event. If there *is* any AER info, can we connect up the DPC event so we can print the AER info from the kernel?

I wonder if there's some way improper L1 Substate configuration could cause a DPC event. There are lots of knobs there that seem to depend on devices, and I'm not sure we have them all correct yet.

There are some recent changes in that area that are in linux-next:

PCI/ASPM: Enable Latency Tolerance Reporting when supported PCI/ASPM: Calculate LTR_L1.2_THRESHOLD from device characteristics PCI/ASPM: Use correct capability pointer to program LTR_L1.2_THRESHOLD PCI/ASPM: Account for downstream device's Port Common_Mode_Restore_Time

It's conceivable that they could have some bearing on this problem. If you could give this a whirl on linux-next, that would be interesting. If you do this, please also collect the "lspci -vv" output there so we can compare it with the v4.14 configuration.

Quoted 3 lines

It looks like APST feature cannot be set anymore after enabling powersupersave. Also the PCIe device disappears completely from lspci output.

My guess is this is to be expected after the DPC event. That basically disconnects the PCIe device from the system.

Quoted 3 lines

Any idea why the device is failing with powersupersave and how to avoid it? Especially how to enable it but skip certain broken devices as this is my boot device.

We could conceivably add a quirk if we find that L1SS is broken on this particular device. But L1SS is so new that I'd be more suspicious of the Linux code than the device.

Bjorn

#5 lore raw

Hi Rajat,

Quoted 33 lines · Rajat Jain
Quoted 22 lines · Bjorn Helgaas

[+cc Rajat, Keith, linux-kernel]

Quoted 11 lines · Maik Broemme

I have a Samsung 960 PRO NVMe SSD (Non-Volatile memory controller:
Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961). It works fine until I enable powersupersave via /sys/module/pcie_aspm/parameters/policy

ASPM is enabled in BIOS and works fine for all devices and in powersave mode. I'm able to reproduce this always at any time while the system is up and running via:

$> echo powersupersave > /sys/module/pcie_aspm/parameters/policy

Quoted 7 lines

The Linux kernel is 4.14.4 and APST for my device is working with powersave. As soon as I enable powersupersave I get:

[11535.142755] dpc 0000:00:10.0:pcie010: DPC containment event, status:0x1f09 source:0x0000
[11535.142760] dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable error detected, remove downstream devices
[11535.159999] nvme0n1: detected capacity change from 1024209543168 to 0

...

Quoted 8 lines

Can you start by opening a bug report at https://bugzilla.kernel.org,
category Drivers/PCI, and attaching the complete "lspci -vv" output (as root) and the complete dmesg log? Make sure you have a new enough lspci to decode the ASPM L1 Substates capability and the LTR bits. Source is at git://git.kernel.org/pub/scm/utils/pciutils/pciutils.git

powersupersave enables ASPM L1 Substates. Rajat, do you have any ideas about this or how we might debug it?

Quoted 6 lines

I know Maik mentioned that this is the boot device. Maik, is it possible to boot off something else so that we can do some more experiments on this port? If so,
- can you try to see if the device comes back if you switch the ASPM policy back from "powersupersave" -> powersave, and potentially do a rescan (echo 1 > /sys/bus/pci/rescan)?

Yes it is possible, will do later today.

Quoted 9 lines

- It would be good to get the complete lspci -vv for the root port (assuming device is connected to root port i.e. no switch). Specifically what does the Link status show?
- Also, do you know if your root port provides any debug registers that could tell the current L1 substate of the link (My system's root port had such register).
- I had usually resorted to a PCIe analyzer to peak at the packets when I was debugging it. Not sure if that is an option here.

Quoted 6 lines

I don't see any debug prints in aspm.c that we could enable. Even if I provide a patch, I suspect that the problem will start at the last step of the pcie_config_aspm_l1ss() i.e. as soon as we really enable it in HW. Maik, would you be open to take a debug patch that adds some debug prints and try it out (compile your kernel with that patch)?

Sure that is fine. I will also re-run later today with 4.15rc3.

Quoted 35 lines
Quoted 35 lines

Keith, is this really all the information about the event that we can get out of DPC? Is there some AER logging we might be able to get via "lspci -vv"? Sounds like this is the boot disk, so Maik may not be able to run lspci after the DPC event. If there *is* any AER info, can we connect up the DPC event so we can print the AER info from the kernel?

I wonder if there's some way improper L1 Substate configuration could cause a DPC event. There are lots of knobs there that seem to depend on devices, and I'm not sure we have them all correct yet.

There are some recent changes in that area that are in linux-next:

PCI/ASPM: Enable Latency Tolerance Reporting when supported PCI/ASPM: Calculate LTR_L1.2_THRESHOLD from device characteristics PCI/ASPM: Use correct capability pointer to program LTR_L1.2_THRESHOLD PCI/ASPM: Account for downstream device's Port Common_Mode_Restore_Time

It's conceivable that they could have some bearing on this problem. If you could give this a whirl on linux-next, that would be interesting. If you do this, please also collect the "lspci -vv" output there so we can compare it with the v4.14 configuration.

Quoted 3 lines

It looks like APST feature cannot be set anymore after enabling powersupersave. Also the PCIe device disappears completely from lspci output.

My guess is this is to be expected after the DPC event. That basically disconnects the PCIe device from the system.

Quoted 3 lines

Any idea why the device is failing with powersupersave and how to avoid it? Especially how to enable it but skip certain broken devices as this is my boot device.

Quoted 6 lines
Quoted 5 lines

We could conceivably add a quirk if we find that L1SS is broken on this particular device. But L1SS is so new that I'd be more suspicious of the Linux code than the device.

Bjorn

--Maik

#6 lore raw

Hi Rajat,

Quoted 36 lines · Maik Broemme

Hi Rajat,

Quoted 33 lines · Rajat Jain
Quoted 30 lines · Bjorn Helgaas

[+cc Rajat, Keith, linux-kernel]

Quoted 11 lines · Maik Broemme

I have a Samsung 960 PRO NVMe SSD (Non-Volatile memory controller:
Samsung Electronics Co Ltd NVMe SSD Controller SM961/PM961). It works fine until I enable powersupersave via /sys/module/pcie_aspm/parameters/policy

ASPM is enabled in BIOS and works fine for all devices and in powersave mode. I'm able to reproduce this always at any time while the system is up and running via:

$> echo powersupersave > /sys/module/pcie_aspm/parameters/policy

Quoted 7 lines

The Linux kernel is 4.14.4 and APST for my device is working with powersave. As soon as I enable powersupersave I get:

[11535.142755] dpc 0000:00:10.0:pcie010: DPC containment event, status:0x1f09 source:0x0000
[11535.142760] dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable error detected, remove downstream devices
[11535.159999] nvme0n1: detected capacity change from 1024209543168 to 0

...

Can you start by opening a bug report at https://bugzilla.kernel.org,
category Drivers/PCI, and attaching the complete "lspci -vv" output (as root) and the complete dmesg log? Make sure you have a new enough lspci to decode the ASPM L1 Substates capability and the LTR bits. Source is at git://git.kernel.org/pub/scm/utils/pciutils/pciutils.git

powersupersave enables ASPM L1 Substates. Rajat, do you have any ideas about this or how we might debug it?

Quoted 9 lines
Quoted 6 lines

I know Maik mentioned that this is the boot device. Maik, is it possible to boot off something else so that we can do some more experiments on this port? If so,
- can you try to see if the device comes back if you switch the ASPM policy back from "powersupersave" -> powersave, and potentially do a rescan (echo 1 > /sys/bus/pci/rescan)?

Yes it is possible, will do later today.

I've re-run the test with 4.15rc7.r111.g5f615b97cdea and the following patches from Keith:

[PATCH 1/4] PCI/AER: Return approrpiate value when AER is not supported [PATCH 2/4] PCI/AER: Provide API for getting AER information [PATCH 3/4] PCI/DPC: Enable DPC in conjuction with AER [PATCH 4/4] PCI/DPC: Print AER status in DPC event handling

The issue is still the same. Additionally to the output before I see now:

Jan 11 18:34:45 server.theraso.int kernel: dpc 0000:00:10.0:pcie010: DPC containment event, status:0x1f09 source:0x0000
Jan 11 18:34:45 server.theraso.int kernel: dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable error detected, remove downstream devices
Jan 11 18:34:45 server.theraso.int kernel: pcieport 0000:00:10.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, id=0080(Receiver ID)
Jan 11 18:34:45 server.theraso.int kernel: pcieport 0000:00:10.0:   device [8086:19aa] error status/mask=00000020/00000000
Jan 11 18:34:45 server.theraso.int kernel: pcieport 0000:00:10.0:    [ 5] Surprise Down Error    (First)
Jan 11 18:34:46 server.theraso.int kernel: nvme0n1: detected capacity change from 1024209543168 to 0
Quoted 53 lines
Quoted 9 lines

- It would be good to get the complete lspci -vv for the root port (assuming device is connected to root port i.e. no switch). Specifically what does the Link status show?
- Also, do you know if your root port provides any debug registers that could tell the current L1 substate of the link (My system's root port had such register).
- I had usually resorted to a PCIe analyzer to peak at the packets when I was debugging it. Not sure if that is an option here.

Quoted 6 lines

I don't see any debug prints in aspm.c that we could enable. Even if I provide a patch, I suspect that the problem will start at the last step of the pcie_config_aspm_l1ss() i.e. as soon as we really enable it in HW. Maik, would you be open to take a debug patch that adds some debug prints and try it out (compile your kernel with that patch)?

Sure that is fine. I will also re-run later today with 4.15rc3.

Quoted 35 lines
Quoted 35 lines

Keith, is this really all the information about the event that we can get out of DPC? Is there some AER logging we might be able to get via "lspci -vv"? Sounds like this is the boot disk, so Maik may not be able to run lspci after the DPC event. If there *is* any AER info, can we connect up the DPC event so we can print the AER info from the kernel?

I wonder if there's some way improper L1 Substate configuration could cause a DPC event. There are lots of knobs there that seem to depend on devices, and I'm not sure we have them all correct yet.

There are some recent changes in that area that are in linux-next:

PCI/ASPM: Enable Latency Tolerance Reporting when supported PCI/ASPM: Calculate LTR_L1.2_THRESHOLD from device characteristics PCI/ASPM: Use correct capability pointer to program LTR_L1.2_THRESHOLD PCI/ASPM: Account for downstream device's Port Common_Mode_Restore_Time

It's conceivable that they could have some bearing on this problem. If you could give this a whirl on linux-next, that would be interesting. If you do this, please also collect the "lspci -vv" output there so we can compare it with the v4.14 configuration.

Quoted 3 lines

It looks like APST feature cannot be set anymore after enabling powersupersave. Also the PCIe device disappears completely from lspci output.

My guess is this is to be expected after the DPC event. That basically disconnects the PCIe device from the system.

Quoted 3 lines

Any idea why the device is failing with powersupersave and how to avoid it? Especially how to enable it but skip certain broken devices as this is my boot device.

Quoted 8 lines
Quoted 6 lines
Quoted 5 lines

We could conceivably add a quirk if we find that L1SS is broken on this particular device. But L1SS is so new that I'd be more suspicious of the Linux code than the device.

Bjorn

--Maik

--Maik

#7 lore raw
Quoted 8 lines · Maik Broemme

I've re-run the test with 4.15rc7.r111.g5f615b97cdea and the following patches from Keith:

[PATCH 1/4] PCI/AER: Return approrpiate value when AER is not supported [PATCH 2/4] PCI/AER: Provide API for getting AER information [PATCH 3/4] PCI/DPC: Enable DPC in conjuction with AER [PATCH 4/4] PCI/DPC: Print AER status in DPC event handling

Quoted 8 lines

The issue is still the same. Additionally to the output before I see now:

Jan 11 18:34:45 server.theraso.int kernel: dpc 0000:00:10.0:pcie010: DPC containment event, status:0x1f09 source:0x0000
Jan 11 18:34:45 server.theraso.int kernel: dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable error detected, remove downstream devices
Jan 11 18:34:45 server.theraso.int kernel: pcieport 0000:00:10.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, id=0080(Receiver ID)
Jan 11 18:34:45 server.theraso.int kernel: pcieport 0000:00:10.0:   device [8086:19aa] error status/mask=00000020/00000000
Jan 11 18:34:45 server.theraso.int kernel: pcieport 0000:00:10.0:    [ 5] Surprise Down Error    (First)
Jan 11 18:34:46 server.theraso.int kernel: nvme0n1: detected capacity change from 1024209543168 to 0

Okay, so that series wasn't going to fix anything, but at least it gets some visibility into what's happened. The DPC was triggered due to a Surprise Down uncorrectable error, so the power settting is causing the link to fail.

The NVMe driver has quirks specifically for this vendor's devices to fence off NVMe specific automated power settings. Your observations appear to align with the same issues.

#8 lore raw
Quoted 18 lines · Keith Busch
Quoted 8 lines · Maik Broemme

I've re-run the test with 4.15rc7.r111.g5f615b97cdea and the following patches from Keith:

[PATCH 1/4] PCI/AER: Return approrpiate value when AER is not supported [PATCH 2/4] PCI/AER: Provide API for getting AER information [PATCH 3/4] PCI/DPC: Enable DPC in conjuction with AER [PATCH 4/4] PCI/DPC: Print AER status in DPC event handling

Quoted 8 lines

The issue is still the same. Additionally to the output before I see now:

Jan 11 18:34:45 server.theraso.int kernel: dpc 0000:00:10.0:pcie010: DPC containment event, status:0x1f09 source:0x0000
Jan 11 18:34:45 server.theraso.int kernel: dpc 0000:00:10.0:pcie010: DPC unmasked uncorrectable error detected, remove downstream devices
Jan 11 18:34:45 server.theraso.int kernel: pcieport 0000:00:10.0: PCIe Bus Error: severity=Uncorrected (Non-Fatal), type=Transaction Layer, id=0080(Receiver ID)
Jan 11 18:34:45 server.theraso.int kernel: pcieport 0000:00:10.0:   device [8086:19aa] error status/mask=00000020/00000000
Jan 11 18:34:45 server.theraso.int kernel: pcieport 0000:00:10.0:    [ 5] Surprise Down Error    (First)
Jan 11 18:34:46 server.theraso.int kernel: nvme0n1: detected capacity change from 1024209543168 to 0
Quoted 8 lines

Okay, so that series wasn't going to fix anything, but at least it gets some visibility into what's happened. The DPC was triggered due to a Surprise Down uncorrectable error, so the power settting is causing the link to fail.

The NVMe driver has quirks specifically for this vendor's devices to fence off NVMe specific automated power settings. Your observations appear to align with the same issues.

Agree.

                /*
                 * Samsung SSD 960 EVO drops off the PCIe bus after system
                 * suspend on a Ryzen board, ASUS PRIME B350M-A.
                 */
                if (dmi_match(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC.") &&
                    dmi_match(DMI_BOARD_NAME, "PRIME B350M-A"))
                        return NVME_QUIRK_NO_APST;

It seems that the attempt to save extrapower using ASPM L1 substates is causing it to fall off. Sorry but I suspect that it may be difficult to debug without a pcie analyzer, some debugging directions can be:

- Assuming this is a hotpluggable device, try with another NVMe to verify if the issue is specific to this device.
- Can you please try switch the ASPM policy back from "powersupersave" -> powersave, and potentially do a rescan (echo 1 > /sys/bus/pci/rescan), and see if the device comes back (and goes away again when you switch back to supersave)?
- May be put some debug prints in pcie_config_aspm_l1ss() to see writing to which register causes the device to fall off (most likely this would be the last statement, but just throwing ideas).
- May be dump the timing parameters link->l1ss.ctl1 and link->l1ss.ctl2 from aspm_calc_l1ss_info(), and try to play with them a little.