linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] apple-nvme: bug and perf fixes
@ 2025-02-11 18:25 Alyssa Rosenzweig
  2025-02-11 18:25 ` [PATCH 1/3] apple-nvme: Support coprocessors left idle Alyssa Rosenzweig
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Alyssa Rosenzweig @ 2025-02-11 18:25 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Philipp Zabel
  Cc: asahi, linux-arm-kernel, linux-nvme, linux-kernel,
	Alyssa Rosenzweig

This small series fixes three unrelated issues with the Apple NVMe
driver.

* fix NVMe on firmware/machine
* fix a power domain leak
* fix pathological driver performance with random writes

The first two are strict bug fixes, the last is technically an
optimization but given the measured 200x performance difference I do
consider to be a fix ;-)

Given the early stage of mainlining for these SoCs, none of this needs
to be backported.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
---
Hector Martin (2):
      apple-nvme: Support coprocessors left idle
      apple-nvme: Release power domains when probe fails

Jens Axboe (1):
      apple-nvme: defer cache flushes by a specified amount

 drivers/nvme/host/apple.c | 124 +++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 107 insertions(+), 17 deletions(-)
---
base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
change-id: 20250211-nvme-fixes-29c409c2553f

Best regards,
-- 
Alyssa Rosenzweig <alyssa@rosenzweig.io>



^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] apple-nvme: Support coprocessors left idle
  2025-02-11 18:25 [PATCH 0/3] apple-nvme: bug and perf fixes Alyssa Rosenzweig
@ 2025-02-11 18:25 ` Alyssa Rosenzweig
  2025-02-11 18:25 ` [PATCH 2/3] apple-nvme: Release power domains when probe fails Alyssa Rosenzweig
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Alyssa Rosenzweig @ 2025-02-11 18:25 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Philipp Zabel
  Cc: asahi, linux-arm-kernel, linux-nvme, linux-kernel,
	Alyssa Rosenzweig

From: Hector Martin <marcan@marcan.st>

iBoot on at least some firmwares/machines leaves ANS2 running, requiring
a wake command instead of a CPU boot (and if we reset ANS2 in that
state, everything breaks).

Only stop the CPU if RTKit was running, and only do the reset dance if
the CPU is stopped.

Normal shutdown handoff:
- RTKit not yet running
- CPU detected not running
- Reset
- CPU powerup
- RTKit boot wait

ANS2 left running/idle:
- RTKit not yet running
- CPU detected running
- RTKit wake message

Sleep/resume cycle:
- RTKit shutdown
- CPU stopped
- (sleep here)
- CPU detected not running
- Reset
- CPU powerup
- RTKit boot wait

Shutdown or device removal:
- RTKit shutdown
- CPU stopped

Therefore, the CPU running bit serves as a consistent flag of whether
the coprocessor is fully stopped or just idle.

Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
---
 drivers/nvme/host/apple.c | 53 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 36 insertions(+), 17 deletions(-)

diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
index 1de11b722f049abbc96a6bb62b072ac973b8c4aa..5e1c01a67ee81a36faa3da2f86a3a24fefcdfd6f 100644
--- a/drivers/nvme/host/apple.c
+++ b/drivers/nvme/host/apple.c
@@ -1011,25 +1011,37 @@ static void apple_nvme_reset_work(struct work_struct *work)
 		ret = apple_rtkit_shutdown(anv->rtk);
 		if (ret)
 			goto out;
+
+		writel(0, anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL);
 	}
 
-	writel(0, anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL);
+	/*
+	 * Only do the soft-reset if the CPU is not running, which means either we
+	 * or the previous stage shut it down cleanly.
+	 */
+	if (!(readl(anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL) &
+		APPLE_ANS_COPROC_CPU_CONTROL_RUN)) {
 
-	ret = reset_control_assert(anv->reset);
-	if (ret)
-		goto out;
+		ret = reset_control_assert(anv->reset);
+		if (ret)
+			goto out;
 
-	ret = apple_rtkit_reinit(anv->rtk);
-	if (ret)
-		goto out;
+		ret = apple_rtkit_reinit(anv->rtk);
+		if (ret)
+			goto out;
 
-	ret = reset_control_deassert(anv->reset);
-	if (ret)
-		goto out;
+		ret = reset_control_deassert(anv->reset);
+		if (ret)
+			goto out;
+
+		writel(APPLE_ANS_COPROC_CPU_CONTROL_RUN,
+		       anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL);
+
+		ret = apple_rtkit_boot(anv->rtk);
+	} else {
+		ret = apple_rtkit_wake(anv->rtk);
+	}
 
-	writel(APPLE_ANS_COPROC_CPU_CONTROL_RUN,
-	       anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL);
-	ret = apple_rtkit_boot(anv->rtk);
 	if (ret) {
 		dev_err(anv->dev, "ANS did not boot");
 		goto out;
@@ -1563,9 +1575,12 @@ static void apple_nvme_remove(struct platform_device *pdev)
 	apple_nvme_disable(anv, true);
 	nvme_uninit_ctrl(&anv->ctrl);
 
-	if (apple_rtkit_is_running(anv->rtk))
+	if (apple_rtkit_is_running(anv->rtk)) {
 		apple_rtkit_shutdown(anv->rtk);
 
+		writel(0, anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL);
+	}
+
 	apple_nvme_detach_genpd(anv);
 }
 
@@ -1574,8 +1589,11 @@ static void apple_nvme_shutdown(struct platform_device *pdev)
 	struct apple_nvme *anv = platform_get_drvdata(pdev);
 
 	apple_nvme_disable(anv, true);
-	if (apple_rtkit_is_running(anv->rtk))
+	if (apple_rtkit_is_running(anv->rtk)) {
 		apple_rtkit_shutdown(anv->rtk);
+
+		writel(0, anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL);
+	}
 }
 
 static int apple_nvme_resume(struct device *dev)
@@ -1592,10 +1610,11 @@ static int apple_nvme_suspend(struct device *dev)
 
 	apple_nvme_disable(anv, true);
 
-	if (apple_rtkit_is_running(anv->rtk))
+	if (apple_rtkit_is_running(anv->rtk)) {
 		ret = apple_rtkit_shutdown(anv->rtk);
 
-	writel(0, anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL);
+		writel(0, anv->mmio_coproc + APPLE_ANS_COPROC_CPU_CONTROL);
+	}
 
 	return ret;
 }

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] apple-nvme: Release power domains when probe fails
  2025-02-11 18:25 [PATCH 0/3] apple-nvme: bug and perf fixes Alyssa Rosenzweig
  2025-02-11 18:25 ` [PATCH 1/3] apple-nvme: Support coprocessors left idle Alyssa Rosenzweig
@ 2025-02-11 18:25 ` Alyssa Rosenzweig
  2025-02-11 18:25 ` [PATCH 3/3] apple-nvme: defer cache flushes by a specified amount Alyssa Rosenzweig
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Alyssa Rosenzweig @ 2025-02-11 18:25 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Philipp Zabel
  Cc: asahi, linux-arm-kernel, linux-nvme, linux-kernel,
	Alyssa Rosenzweig

From: Hector Martin <marcan@marcan.st>

Signed-off-by: Hector Martin <marcan@marcan.st>
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
---
 drivers/nvme/host/apple.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
index 5e1c01a67ee81a36faa3da2f86a3a24fefcdfd6f..a060f69558e76970bfba046cca5127243e8a51b7 100644
--- a/drivers/nvme/host/apple.c
+++ b/drivers/nvme/host/apple.c
@@ -1528,6 +1528,7 @@ static struct apple_nvme *apple_nvme_alloc(struct platform_device *pdev)
 
 	return anv;
 put_dev:
+	apple_nvme_detach_genpd(anv);
 	put_device(anv->dev);
 	return ERR_PTR(ret);
 }
@@ -1561,6 +1562,7 @@ static int apple_nvme_probe(struct platform_device *pdev)
 	nvme_uninit_ctrl(&anv->ctrl);
 out_put_ctrl:
 	nvme_put_ctrl(&anv->ctrl);
+	apple_nvme_detach_genpd(anv);
 	return ret;
 }
 

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] apple-nvme: defer cache flushes by a specified amount
  2025-02-11 18:25 [PATCH 0/3] apple-nvme: bug and perf fixes Alyssa Rosenzweig
  2025-02-11 18:25 ` [PATCH 1/3] apple-nvme: Support coprocessors left idle Alyssa Rosenzweig
  2025-02-11 18:25 ` [PATCH 2/3] apple-nvme: Release power domains when probe fails Alyssa Rosenzweig
@ 2025-02-11 18:25 ` Alyssa Rosenzweig
  2025-02-11 19:50   ` Jens Axboe
  2025-02-13  6:20   ` Christoph Hellwig
  2025-02-11 18:38 ` [PATCH 0/3] apple-nvme: bug and perf fixes Keith Busch
  2025-02-12 15:41 ` Neal Gompa
  4 siblings, 2 replies; 9+ messages in thread
From: Alyssa Rosenzweig @ 2025-02-11 18:25 UTC (permalink / raw)
  To: Hector Martin, Sven Peter, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Philipp Zabel
  Cc: asahi, linux-arm-kernel, linux-nvme, linux-kernel,
	Alyssa Rosenzweig

From: Jens Axboe <axboe@kernel.dk>

Cache flushes on the M1 nvme are really slow, taking 17-18 msec to
complete. This can slow down workloads considerably, pure random writes
end up being bound by the flush latency and hence run at 55-60 IOPS.

Add a deferred flush work around to provide better performance, at a
minimal risk. By default, flushes are delayed at most 1 second, but this
is configurable.

With this work-around, a pure random write workload runs at ~12K IOPS
rather than 56 IOPS.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
---
 drivers/nvme/host/apple.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 69 insertions(+)

diff --git a/drivers/nvme/host/apple.c b/drivers/nvme/host/apple.c
index a060f69558e76970bfba046cca5127243e8a51b7..2dfb0442d56195756df91e0fbc913b751c74d0ea 100644
--- a/drivers/nvme/host/apple.c
+++ b/drivers/nvme/host/apple.c
@@ -195,8 +195,20 @@ struct apple_nvme {
 
 	int irq;
 	spinlock_t lock;
+
+	/*
+	 * Delayed cache flush handling state
+	 */
+	struct nvme_ns *flush_ns;
+	unsigned long flush_interval;
+	unsigned long last_flush;
+	struct delayed_work flush_dwork;
 };
 
+unsigned int flush_interval = 1000;
+module_param(flush_interval, uint, 0644);
+MODULE_PARM_DESC(flush_interval, "Grace period in msecs between flushes");
+
 static_assert(sizeof(struct nvme_command) == 64);
 static_assert(sizeof(struct apple_nvmmu_tcb) == 128);
 
@@ -729,6 +741,26 @@ static int apple_nvme_remove_sq(struct apple_nvme *anv)
 	return nvme_submit_sync_cmd(anv->ctrl.admin_q, &c, NULL, 0);
 }
 
+static bool apple_nvme_delayed_flush(struct apple_nvme *anv, struct nvme_ns *ns,
+				     struct request *req)
+{
+	if (!anv->flush_interval || req_op(req) != REQ_OP_FLUSH)
+		return false;
+	if (delayed_work_pending(&anv->flush_dwork))
+		return true;
+	if (time_before(jiffies, anv->last_flush + anv->flush_interval)) {
+		kblockd_mod_delayed_work_on(WORK_CPU_UNBOUND, &anv->flush_dwork,
+						anv->flush_interval);
+		if (WARN_ON_ONCE(anv->flush_ns && anv->flush_ns != ns))
+			goto out;
+		anv->flush_ns = ns;
+		return true;
+	}
+out:
+	anv->last_flush = jiffies;
+	return false;
+}
+
 static blk_status_t apple_nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
 					const struct blk_mq_queue_data *bd)
 {
@@ -764,6 +796,12 @@ static blk_status_t apple_nvme_queue_rq(struct blk_mq_hw_ctx *hctx,
 	}
 
 	nvme_start_request(req);
+
+	if (apple_nvme_delayed_flush(anv, ns, req)) {
+		blk_mq_complete_request(req);
+		return BLK_STS_OK;
+	}
+
 	apple_nvme_submit_cmd(q, cmnd);
 	return BLK_STS_OK;
 
@@ -1398,6 +1436,28 @@ static void devm_apple_nvme_mempool_destroy(void *data)
 	mempool_destroy(data);
 }
 
+static void apple_nvme_flush_work(struct work_struct *work)
+{
+	struct nvme_command c = { };
+	struct apple_nvme *anv;
+	struct nvme_ns *ns;
+	int err;
+
+	anv = container_of(work, struct apple_nvme, flush_dwork.work);
+	ns = anv->flush_ns;
+	if (WARN_ON_ONCE(!ns))
+		return;
+
+	c.common.opcode = nvme_cmd_flush;
+	c.common.nsid = cpu_to_le32(anv->flush_ns->head->ns_id);
+	err = nvme_submit_sync_cmd(ns->queue, &c, NULL, 0);
+	if (err) {
+		dev_err(anv->dev, "Deferred flush failed: %d\n", err);
+	} else {
+		anv->last_flush = jiffies;
+	}
+}
+
 static struct apple_nvme *apple_nvme_alloc(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
@@ -1553,6 +1613,14 @@ static int apple_nvme_probe(struct platform_device *pdev)
 		goto out_uninit_ctrl;
 	}
 
+	if (flush_interval) {
+		anv->flush_interval = msecs_to_jiffies(flush_interval);
+		anv->flush_ns = NULL;
+		anv->last_flush = jiffies - anv->flush_interval;
+	}
+
+	INIT_DELAYED_WORK(&anv->flush_dwork, apple_nvme_flush_work);
+
 	nvme_reset_ctrl(&anv->ctrl);
 	async_schedule(apple_nvme_async_probe, anv);
 
@@ -1590,6 +1658,7 @@ static void apple_nvme_shutdown(struct platform_device *pdev)
 {
 	struct apple_nvme *anv = platform_get_drvdata(pdev);
 
+	flush_delayed_work(&anv->flush_dwork);
 	apple_nvme_disable(anv, true);
 	if (apple_rtkit_is_running(anv->rtk)) {
 		apple_rtkit_shutdown(anv->rtk);

-- 
2.48.1



^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] apple-nvme: bug and perf fixes
  2025-02-11 18:25 [PATCH 0/3] apple-nvme: bug and perf fixes Alyssa Rosenzweig
                   ` (2 preceding siblings ...)
  2025-02-11 18:25 ` [PATCH 3/3] apple-nvme: defer cache flushes by a specified amount Alyssa Rosenzweig
@ 2025-02-11 18:38 ` Keith Busch
  2025-02-12 15:41 ` Neal Gompa
  4 siblings, 0 replies; 9+ messages in thread
From: Keith Busch @ 2025-02-11 18:38 UTC (permalink / raw)
  To: Alyssa Rosenzweig
  Cc: Hector Martin, Sven Peter, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Philipp Zabel, asahi, linux-arm-kernel, linux-nvme,
	linux-kernel

On Tue, Feb 11, 2025 at 01:25:56PM -0500, Alyssa Rosenzweig wrote:
> This small series fixes three unrelated issues with the Apple NVMe
> driver.
> 
> * fix NVMe on firmware/machine
> * fix a power domain leak
> * fix pathological driver performance with random writes
> 
> The first two are strict bug fixes, the last is technically an
> optimization but given the measured 200x performance difference I do
> consider to be a fix ;-)

The last two patches look good to me.

I don't know anyone qualified to review the first patch, so I'll take
your word for it if no one replies in the next few days. :)


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] apple-nvme: defer cache flushes by a specified amount
  2025-02-11 18:25 ` [PATCH 3/3] apple-nvme: defer cache flushes by a specified amount Alyssa Rosenzweig
@ 2025-02-11 19:50   ` Jens Axboe
  2025-02-13  6:20   ` Christoph Hellwig
  1 sibling, 0 replies; 9+ messages in thread
From: Jens Axboe @ 2025-02-11 19:50 UTC (permalink / raw)
  To: Alyssa Rosenzweig, Hector Martin, Sven Peter, Keith Busch,
	Christoph Hellwig, Sagi Grimberg, Philipp Zabel
  Cc: asahi, linux-arm-kernel, linux-nvme, linux-kernel

On 2/11/25 11:25 AM, Alyssa Rosenzweig wrote:
> From: Jens Axboe <axboe@kernel.dk>
> 
> Cache flushes on the M1 nvme are really slow, taking 17-18 msec to
> complete. This can slow down workloads considerably, pure random writes
> end up being bound by the flush latency and hence run at 55-60 IOPS.
> 
> Add a deferred flush work around to provide better performance, at a
> minimal risk. By default, flushes are delayed at most 1 second, but this
> is configurable.
> 
> With this work-around, a pure random write workload runs at ~12K IOPS
> rather than 56 IOPS.

I knew this one would bite in the ass at some point down the line ;-)

I do think the feature is sane, and to my knowledge we haven't had any
issues with it since I originally wrote it 3 years ago. But I also
think it should probably go in the block layer proper, as other
devices might benefit from it.

That said, I'm fine with parking this in the apple nvme driver for
now, as we don't have to deal with multiple namespaces etc. Can
always get migrated to a core feature later, if desired.

-- 
Jens Axboe



^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 0/3] apple-nvme: bug and perf fixes
  2025-02-11 18:25 [PATCH 0/3] apple-nvme: bug and perf fixes Alyssa Rosenzweig
                   ` (3 preceding siblings ...)
  2025-02-11 18:38 ` [PATCH 0/3] apple-nvme: bug and perf fixes Keith Busch
@ 2025-02-12 15:41 ` Neal Gompa
  4 siblings, 0 replies; 9+ messages in thread
From: Neal Gompa @ 2025-02-12 15:41 UTC (permalink / raw)
  To: Alyssa Rosenzweig
  Cc: Hector Martin, Sven Peter, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Philipp Zabel, asahi,
	linux-arm-kernel, linux-nvme, linux-kernel

On Tue, Feb 11, 2025 at 1:26 PM Alyssa Rosenzweig <alyssa@rosenzweig.io> wrote:
>
> This small series fixes three unrelated issues with the Apple NVMe
> driver.
>
> * fix NVMe on firmware/machine
> * fix a power domain leak
> * fix pathological driver performance with random writes
>
> The first two are strict bug fixes, the last is technically an
> optimization but given the measured 200x performance difference I do
> consider to be a fix ;-)
>
> Given the early stage of mainlining for these SoCs, none of this needs
> to be backported.
>
> Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
> ---
> Hector Martin (2):
>       apple-nvme: Support coprocessors left idle
>       apple-nvme: Release power domains when probe fails
>
> Jens Axboe (1):
>       apple-nvme: defer cache flushes by a specified amount
>
>  drivers/nvme/host/apple.c | 124 +++++++++++++++++++++++++++++++++++++++-------
>  1 file changed, 107 insertions(+), 17 deletions(-)
> ---
> base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
> change-id: 20250211-nvme-fixes-29c409c2553f
>
> Best regards,
> --
> Alyssa Rosenzweig <alyssa@rosenzweig.io>
>
>

Series LGTM.

Reviewed-by: Neal Gompa <neal@gompa.dev>


-- 
真実はいつも一つ!/ Always, there's only one truth!


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] apple-nvme: defer cache flushes by a specified amount
  2025-02-11 18:25 ` [PATCH 3/3] apple-nvme: defer cache flushes by a specified amount Alyssa Rosenzweig
  2025-02-11 19:50   ` Jens Axboe
@ 2025-02-13  6:20   ` Christoph Hellwig
  2025-02-13 16:09     ` Alyssa Rosenzweig
  1 sibling, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2025-02-13  6:20 UTC (permalink / raw)
  To: Alyssa Rosenzweig
  Cc: Hector Martin, Sven Peter, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Philipp Zabel, asahi,
	linux-arm-kernel, linux-nvme, linux-kernel

On Tue, Feb 11, 2025 at 01:25:59PM -0500, Alyssa Rosenzweig wrote:
> From: Jens Axboe <axboe@kernel.dk>
> 
> Cache flushes on the M1 nvme are really slow, taking 17-18 msec to
> complete. This can slow down workloads considerably, pure random writes
> end up being bound by the flush latency and hence run at 55-60 IOPS.
> 
> Add a deferred flush work around to provide better performance, at a
> minimal risk. By default, flushes are delayed at most 1 second, but this
> is configurable.
> 
> With this work-around, a pure random write workload runs at ~12K IOPS
> rather than 56 IOPS.

Just as last time this really is not a driver feature.  Cache flushes
are slow on consumer hardware, it's just apple is worse than usual.
Breaking file system transactional guarantee by ignoring data integrity
command in the driver is a no-go.

If we want to allow an opt-in policy for those whole feel adventurous,
it belongs into the core flush state machine.  Fortunately the patch
author seems qualified to touch that :)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] apple-nvme: defer cache flushes by a specified amount
  2025-02-13  6:20   ` Christoph Hellwig
@ 2025-02-13 16:09     ` Alyssa Rosenzweig
  0 siblings, 0 replies; 9+ messages in thread
From: Alyssa Rosenzweig @ 2025-02-13 16:09 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Hector Martin, Sven Peter, Keith Busch, Jens Axboe, Sagi Grimberg,
	Philipp Zabel, asahi, linux-arm-kernel, linux-nvme, linux-kernel

> > Cache flushes on the M1 nvme are really slow, taking 17-18 msec to
> > complete. This can slow down workloads considerably, pure random writes
> > end up being bound by the flush latency and hence run at 55-60 IOPS.
> > 
> > Add a deferred flush work around to provide better performance, at a
> > minimal risk. By default, flushes are delayed at most 1 second, but this
> > is configurable.
> > 
> > With this work-around, a pure random write workload runs at ~12K IOPS
> > rather than 56 IOPS.
> 
> Just as last time this really is not a driver feature.  Cache flushes
> are slow on consumer hardware, it's just apple is worse than usual.
> Breaking file system transactional guarantee by ignoring data integrity
> command in the driver is a no-go.
> 
> If we want to allow an opt-in policy for those whole feel adventurous,
> it belongs into the core flush state machine.  Fortunately the patch
> author seems qualified to touch that :)

Fair enough. I didn't realize this patch was previously discussed, my
apologies. I'll drop this change in v2, and hopefully somebody is
inspired later to do that 'adventure'.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-02-13 16:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-11 18:25 [PATCH 0/3] apple-nvme: bug and perf fixes Alyssa Rosenzweig
2025-02-11 18:25 ` [PATCH 1/3] apple-nvme: Support coprocessors left idle Alyssa Rosenzweig
2025-02-11 18:25 ` [PATCH 2/3] apple-nvme: Release power domains when probe fails Alyssa Rosenzweig
2025-02-11 18:25 ` [PATCH 3/3] apple-nvme: defer cache flushes by a specified amount Alyssa Rosenzweig
2025-02-11 19:50   ` Jens Axboe
2025-02-13  6:20   ` Christoph Hellwig
2025-02-13 16:09     ` Alyssa Rosenzweig
2025-02-11 18:38 ` [PATCH 0/3] apple-nvme: bug and perf fixes Keith Busch
2025-02-12 15:41 ` Neal Gompa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).