FreeBSD Bugzilla – Attachment 198507 Details for
Bug 232466
nvme is not shut properly for suspend/resume
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Test patch for freezing devq
0001-nvme-Prevent-new-requests-from-being-added-after-flu.patch (text/plain), 3.49 KB, created by
Ben Widawsky
on 2018-10-23 18:39:38 UTC
(
hide
)
Description:
Test patch for freezing devq
Filename:
MIME Type:
Creator:
Ben Widawsky
Created:
2018-10-23 18:39:38 UTC
Size:
3.49 KB
patch
obsolete
>From ef562faeab5680aef5965a6f4ce91362a6edbd3d Mon Sep 17 00:00:00 2001 >From: Ben Widawsky <ben.widawsky@intel.com> >Date: Tue, 23 Oct 2018 11:37:32 -0700 >Subject: [PATCH] nvme: Prevent new requests from being added after flush > >--- > sys/cam/nvme/nvme_da.c | 28 +++++++++++++++++++++------- > 1 file changed, 21 insertions(+), 7 deletions(-) > >diff --git a/sys/cam/nvme/nvme_da.c b/sys/cam/nvme/nvme_da.c >index f83a038506a..40eeb8ebc56 100644 >--- a/sys/cam/nvme/nvme_da.c >+++ b/sys/cam/nvme/nvme_da.c >@@ -152,6 +152,7 @@ static int ndaerror(union ccb *ccb, u_int32_t cam_flags, > u_int32_t sense_flags); > static void ndashutdown(void *arg, int howto); > static void ndasuspend(void *arg); >+static void ndaresume(void *arg); > > #ifndef NDA_DEFAULT_SEND_ORDERED > #define NDA_DEFAULT_SEND_ORDERED 1 >@@ -201,12 +202,12 @@ static MALLOC_DEFINE(M_NVMEDA, "nvme_da", "nvme_da buffers"); > */ > > static void >-nda_nvme_flush(struct nda_softc *softc, struct ccb_nvmeio *nvmeio) >+nda_nvme_flush(struct nda_softc *softc, struct ccb_nvmeio *nvmeio, uint32_t flags) > { > cam_fill_nvmeio(nvmeio, > 0, /* retries */ > ndadone, /* cbfcnp */ >- CAM_DIR_NONE, /* flags */ >+ CAM_DIR_NONE | flags, /* flags */ > NULL, /* data_ptr */ > 0, /* dxfer_len */ > nda_default_timeout * 1000); /* timeout 30s */ >@@ -320,7 +321,7 @@ ndaclose(struct disk *dp) > cam_periph_hold(periph, PRIBIO) == 0) { > > ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); >- nda_nvme_flush(softc, &ccb->nvmeio); >+ nda_nvme_flush(softc, &ccb->nvmeio, 0); > error = cam_periph_runccb(ccb, ndaerror, /*cam_flags*/0, > /*sense_flags*/0, softc->disk->d_devstat); > >@@ -438,7 +439,7 @@ ndadump(void *arg, void *virtual, vm_offset_t physical, off_t offset, size_t len > xpt_setup_ccb(&nvmeio.ccb_h, periph->path, CAM_PRIORITY_NORMAL); > > nvmeio.ccb_state = NDA_CCB_DUMP; >- nda_nvme_flush(softc, &nvmeio); >+ nda_nvme_flush(softc, &nvmeio, 0); > error = cam_periph_runccb((union ccb *)&nvmeio, cam_periph_error, > 0, SF_NO_RECOVERY | SF_NO_RETRY, NULL); > if (error != 0) >@@ -465,10 +466,13 @@ ndainit(void) > /* Register our event handlers */ > if ((EVENTHANDLER_REGISTER(power_suspend, ndasuspend, > NULL, EVENTHANDLER_PRI_LAST)) == NULL) >- printf("ndainit: power event registration failed!\n"); >+ printf("ndainit: suspend event registration failed!\n"); > if ((EVENTHANDLER_REGISTER(shutdown_post_sync, ndashutdown, > NULL, SHUTDOWN_PRI_DEFAULT)) == NULL) > printf("ndainit: shutdown event registration failed!\n"); >+ if ((EVENTHANDLER_REGISTER(power_resume, ndaresume, >+ NULL, EVENTHANDLER_PRI_ANY)) == NULL) >+ printf("%s: resume event registration failed!\n", __func__); > } > } > >@@ -980,7 +984,7 @@ ndastart(struct cam_periph *periph, union ccb *start_ccb) > goto out; > } > case BIO_FLUSH: >- nda_nvme_flush(softc, nvmeio); >+ nda_nvme_flush(softc, nvmeio, 0); > break; > } > start_ccb->ccb_state = NDA_CCB_BUFFER_IO; >@@ -1186,7 +1190,7 @@ ndaflush(void) > } > > ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); >- nda_nvme_flush(softc, &ccb->nvmeio); >+ nda_nvme_flush(softc, &ccb->nvmeio, CAM_DEV_QFREEZE); > error = cam_periph_runccb(ccb, ndaerror, /*cam_flags*/0, > /*sense_flags*/ SF_NO_RECOVERY | SF_NO_RETRY, > softc->disk->d_devstat); >@@ -1210,3 +1214,13 @@ ndasuspend(void *arg) > > ndaflush(); > } >+ >+static void >+ndaresume(void *arg) >+{ >+ struct cam_periph *periph; >+ >+ CAM_PERIPH_FOREACH(periph, &ndadriver) { >+ cam_release_devq(periph->path, 0, 0, 0, FALSE); >+ } >+} >-- >2.19.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 232466
: 198507