Message ID | 20220830210509.1919493-1-bvanassche@acm.org |
---|---|
Headers | show |
Series | Prepare for constifying SCSI host templates | expand |
On 30/08/2022 22:05, Bart Van Assche wrote: + Krzysztof This is the same topic as what Krzysztof was working on in https://lore.kernel.org/linux-scsi/6f28acde-2177-0bc7-b06d-c704153489c0@linaro.org/ And at least we have the scsi_host_template.module issue to solve - any plan or progress for that? Thanks, John > Hi Martin, > > This patch series prepares for constifying SCSI host templates by moving the > members that are not constant out of the SCSI host template. Please consider > this patch series for the next merge window. > > Thanks, > > Bart. > > Changes compared to v1: fix the CONFIG_SCSI_PROC_FS=n build. > > Bart Van Assche (2): > scsi: esas2r: Introduce scsi_template_proc_dir() > scsi: core: Introduce a new list for SCSI proc directory entries > > drivers/scsi/esas2r/esas2r_main.c | 18 +++-- > drivers/scsi/scsi_proc.c | 106 ++++++++++++++++++++++++++---- > include/scsi/scsi_host.h | 18 ++--- > 3 files changed, 110 insertions(+), 32 deletions(-) > > .
On 01/09/2022 16:23, John Garry wrote: > On 30/08/2022 22:05, Bart Van Assche wrote: > > + Krzysztof > > This is the same topic as what Krzysztof was working on in > https://lore.kernel.org/linux-scsi/6f28acde-2177-0bc7-b06d-c704153489c0@linaro.org/ > > And at least we have the scsi_host_template.module issue to solve - any > plan or progress for that? I won't have time to work on that anytime soon, so feel free to pickup my patchset and rework or continue on your own. Best regards, Krzysztof
On 9/8/22 08:04, Krzysztof Kozlowski wrote: > On 01/09/2022 16:23, John Garry wrote: >> On 30/08/2022 22:05, Bart Van Assche wrote: >> >> + Krzysztof >> >> This is the same topic as what Krzysztof was working on in >> https://lore.kernel.org/linux-scsi/6f28acde-2177-0bc7-b06d-c704153489c0@linaro.org/ >> >> And at least we have the scsi_host_template.module issue to solve - any >> plan or progress for that? > > I won't have time to work on that anytime soon, so feel free to pickup > my patchset and rework or continue on your own. Thanks for the feedback Krzysztof. I will keep you in Cc when I repost this patch series. Bart.
On 9/1/22 07:23, John Garry wrote: > And at least we have the scsi_host_template.module issue to solve - any plan or progress for that? Hi John, How about the following (entirely untested) patch? Subject: [PATCH] scsi: core: Rework the code for dropping the kernel module reference Instead of clearing the host template module pointer if the LLD kernel module is being unloaded, set the 'drop_module_ref' SCSI device member. This patch prepares for constifying the SCSI host template. Signed-off-by: Bart Van Assche <bvanassche@acm.org> --- drivers/scsi/scsi_sysfs.c | 7 +++---- include/scsi/scsi_device.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 5d61f58399dc..822ae60a64b9 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -454,7 +454,7 @@ static void scsi_device_dev_release_usercontext(struct work_struct *work) sdev = container_of(work, struct scsi_device, ew.work); - mod = sdev->host->hostt->module; + mod = sdev->drop_module_ref ? sdev->host->hostt->module : NULL; scsi_dh_release_device(sdev); @@ -525,9 +525,8 @@ static void scsi_device_dev_release(struct device *dev) { struct scsi_device *sdp = to_scsi_device(dev); - /* Set module pointer as NULL in case of module unloading */ - if (!try_module_get(sdp->host->hostt->module)) - sdp->host->hostt->module = NULL; + if (try_module_get(sdp->host->hostt->module)) + sdp->drop_module_ref = true; execute_in_process_context(scsi_device_dev_release_usercontext, &sdp->ew); diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 2493bd65351a..b03176b69056 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -214,6 +214,7 @@ struct scsi_device { * creation time */ unsigned ignore_media_change:1; /* Ignore MEDIA CHANGE on resume */ unsigned silence_suspend:1; /* Do not print runtime PM related messages */ + unsigned drop_module_ref:1; unsigned int queue_stopped; /* request queue is quiesced */ bool offline_already; /* Device offline message logged */