[Bug 2064042] Re: No proper power management

Dmitriy Zharov 2064042 at bugs.launchpad.net
Thu Oct 17 18:12:37 UTC 2024


>From a89e5292be8e73483519b419888eb636add3ce3c Mon Sep 17 00:00:00 2001
From: Dmitriy Zharov <contact at zharov.dev>
Date: Thu, 17 Oct 2024 12:32:30 +0200
Subject: [PATCH] Disabel FUA for KC3000

---
 drivers/nvme/host/core.c | 8 ++++++--
 drivers/nvme/host/nvme.h | 5 +++++
 drivers/nvme/host/pci.c  | 3 ++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 983909a600ad..1d2aeeac5ef1 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -2165,10 +2165,14 @@ static int nvme_update_ns_info_block(struct nvme_ns *ns,
 	    ns->head->ids.csi == NVME_CSI_ZNS)
 		nvme_update_zone_info(ns, &lim, &zi);
 
-	if (ns->ctrl->vwc & NVME_CTRL_VWC_PRESENT)
+	if (ns->ctrl->vwc & NVME_CTRL_VWC_PRESENT) {
 		lim.features |= BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA;
-	else
+		if(ns->ctrl->quirks & NVME_QUIRK_NO_FUA) {
+			lim.features &= ~ BLK_FEAT_FUA;
+		}
+	} else {
 		lim.features &= ~(BLK_FEAT_WRITE_CACHE | BLK_FEAT_FUA);
+	}
 
 	/*
 	 * Register a metadata profile for PI, or the plain non-integrity NVMe
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
index da57947130cc..255a870f2dd1 100644
--- a/drivers/nvme/host/nvme.h
+++ b/drivers/nvme/host/nvme.h
@@ -168,6 +168,11 @@ enum nvme_quirks {
 	 * MSI (but not MSI-X) interrupts are broken and never fire.
 	 */
 	NVME_QUIRK_BROKEN_MSI			= (1 << 21),
+
+	/*
+	 * Prefers a complete cache flush (REQ_POSTFLUSH) over Forced Unit Access (FUA) operation (REQ_FUA). 
+	 */
+	NVME_QUIRK_NO_FUA				= (1 << 22),	
 };
 
 /*
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index c0533f3f64cb..f651fe38bdd2 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -3517,7 +3517,8 @@ static const struct pci_device_id nvme_id_table[] = {
 	{ PCI_DEVICE(0x2646, 0x2263),   /* KINGSTON A2000 NVMe SSD  */
 		.driver_data = NVME_QUIRK_NO_DEEPEST_PS, },
 	{ PCI_DEVICE(0x2646, 0x5013),   /* Kingston KC3000, Kingston FURY Renegade */
-		.driver_data = NVME_QUIRK_NO_SECONDARY_TEMP_THRESH, },
+		.driver_data = NVME_QUIRK_NO_SECONDARY_TEMP_THRESH |
+				NVME_QUIRK_NO_FUA, },
 	{ PCI_DEVICE(0x2646, 0x5018),   /* KINGSTON OM8SFP4xxxxP OS21012 NVMe SSD */
 		.driver_data = NVME_QUIRK_DISABLE_WRITE_ZEROES, },
 	{ PCI_DEVICE(0x2646, 0x5016),   /* KINGSTON OM3PGP4xxxxP OS21011 NVMe SSD */
-- 
2.45.2

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to nvme-cli in Ubuntu.
https://bugs.launchpad.net/bugs/2064042

Title:
  No proper power management

Status in nvme-cli package in Ubuntu:
  New

Bug description:
  nvme shows that power management is enabled and device is most of the
  time in power state 4, but disk get hot (+50.9°C) and drains battery.
  The same disk has much lower temperatures (about 35C, similar to
  mainboard) when running Kubuntu 23.10

  root at nevo:~# uname -a
  Linux nevo 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  root at nevo:~# lsb_release -a
  No LSB modules are available.
  Distributor ID: Ubuntu
  Description:    Ubuntu 24.04 LTS
  Release:        24.04
  Codename:       noble
  root at nevo:~# nvme list
  Node                  Generic               SN                   Model                                    Namespace  Usage                      Format           FW Rev  
  --------------------- --------------------- -------------------- ---------------------------------------- ---------- -------------------------- ---------------- --------
  /dev/nvme0n1          /dev/ng0n1            50026B7686B2B506     KINGSTON SKC3000S1024G                   0x1          1.02  TB /   1.02  TB    512   B +  0 B   EIFK51.2
  root at nevo:~# nvme fw-log /dev/nvme0
  Firmware Log for device:nvme0
  afi  : 0x1
  frs1 : 0x322e31354b464945 (EIFK51.2)
  root at nevo:~# nvme get-feature -f 0x0c -H /dev/nvme0n1 
  get-feature:0x0c (Autonomous Power State Transition), Current value:0x00000001
          Autonomous Power State Transition Enable (APSTE): Enabled
          Auto PST Entries        .................
          Entry[ 0]   
          .................
          Idle Time Prior to Transition (ITPT): 100 ms
          Idle Transition Power State   (ITPS): 4
          .................
          Entry[ 1]   
          .................
          Idle Time Prior to Transition (ITPT): 100 ms
          Idle Transition Power State   (ITPS): 4
          .................
          Entry[ 2]   
          .................
          Idle Time Prior to Transition (ITPT): 100 ms
          Idle Transition Power State   (ITPS): 4
          .................
          Entry[ 3]   
          .................
          Idle Time Prior to Transition (ITPT): 100 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
          .................
  root at nevo:~# nvme get-feature -f 0x02 -H /dev/nvme0n1 
  get-feature:0x02 (Power Management), Current value:0x00000004
          Workload Hint (WH): 0 - No Workload
          Power State   (PS): 4

  ProblemType: Bug
  DistroRelease: Ubuntu 24.04
  Package: nvme-cli 2.8-1build2
  ProcVersionSignature: Ubuntu 6.8.0-31.31-generic 6.8.1
  Uname: Linux 6.8.0-31-generic x86_64
  ApportVersion: 2.28.1-0ubuntu2
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CurrentDesktop: KDE
  Date: Sun Apr 28 22:25:14 2024
  InstallationDate: Installed on 2024-04-27 (1 days ago)
  InstallationMedia: Kubuntu 24.04 LTS "Noble Numbat" - Release amd64 (20240425.1)
  SourcePackage: nvme-cli
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/nvme-cli/+bug/2064042/+subscriptions




More information about the foundations-bugs mailing list