git: eb4d2eab0719 - stable/13 - Add some nvme initialization routines to TSLOG

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Fri, 21 Jan 2022 02:26:48 UTC
The branch stable/13 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=eb4d2eab0719744a9926f596dd4a20a3559af67c

commit eb4d2eab0719744a9926f596dd4a20a3559af67c
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2021-09-05 19:48:43 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2022-01-21 02:07:30 +0000

    Add some nvme initialization routines to TSLOG
    
    About 335 ms of EC2 instance boot time is being spent here.
    
    (cherry picked from commit bad42df9bfcb8d77bdec04ea1f9acd874c762740)
---
 sys/dev/nvme/nvme_ctrlr.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c
index 52eab6254d89..833bf328584a 100644
--- a/sys/dev/nvme/nvme_ctrlr.c
+++ b/sys/dev/nvme/nvme_ctrlr.c
@@ -407,6 +407,7 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr)
 {
 	int err;
 
+	TSENTER();
 	nvme_ctrlr_disable_qpairs(ctrlr);
 
 	pause("nvmehwreset", hz / 10);
@@ -414,7 +415,9 @@ nvme_ctrlr_hw_reset(struct nvme_controller *ctrlr)
 	err = nvme_ctrlr_disable(ctrlr);
 	if (err != 0)
 		return err;
-	return (nvme_ctrlr_enable(ctrlr));
+	err = nvme_ctrlr_enable(ctrlr);
+	TSEXIT();
+	return (err);
 }
 
 void
@@ -1045,6 +1048,8 @@ nvme_ctrlr_start(void *ctrlr_arg, bool resetting)
 	uint32_t old_num_io_queues;
 	int i;
 
+	TSENTER();
+
 	/*
 	 * Only reset adminq here when we are restarting the
 	 *  controller after a reset.  During initialization,
@@ -1117,6 +1122,7 @@ nvme_ctrlr_start(void *ctrlr_arg, bool resetting)
 
 	for (i = 0; i < ctrlr->num_io_queues; i++)
 		nvme_io_qpair_enable(&ctrlr->ioq[i]);
+	TSEXIT();
 }
 
 void
@@ -1124,6 +1130,8 @@ nvme_ctrlr_start_config_hook(void *arg)
 {
 	struct nvme_controller *ctrlr = arg;
 
+	TSENTER();
+
 	/*
 	 * Reset controller twice to ensure we do a transition from cc.en==1 to
 	 * cc.en==0.  This is because we don't really know what status the
@@ -1155,6 +1163,7 @@ fail:
 
 	ctrlr->is_initialized = 1;
 	nvme_notify_new_controller(ctrlr);
+	TSEXIT();
 }
 
 static void