From: Allen Pais <apais@linux.microsoft.com>
To: linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
target-devel@vger.kernel.org, megaraidlinux.pdl@broadcom.com,
jejb@linux.ibm.com, hare@suse.com, martin.petersen@oracle.com,
linuxdrivers@attotech.com, tyreld@linux.ibm.com,
mpe@ellerman.id.au, npiggin@gmail.com,
christophe.leroy@csgroup.eu, aneesh.kumar@kernel.org,
naveen.n.rao@linux.ibm.com, artur.paszkiewicz@intel.co,
kashyap.desai@broadcom.com, sumit.saxena@broadcom.com,
shivasharan.srikanteshwara@broadcom.com,
chandrakanth.patil@broadcom.com, jinpu.wang@cloud.ionos.com
Subject: [PATCH 0/1] Convert tasklets to bottom half workqueues
Date: Thu, 2 May 2024 20:34:32 +0000 [thread overview]
Message-ID: <20240502203433.15811-1-apais@linux.microsoft.com> (raw)
I am submitting this patch which converts instances of tasklets
in drivers/scsi/* to bottom half workqueues. I appreciate your
feedback and suggestion on the changes.
Note: The patch is only compile tested.
In the patcheset, you will notice *FIXME* in two places:
1. pm8001/pm8001_init.c @ pm8001_work(struct work_struct *t)
2. pmcraid.c @ pmcraid_work_function(struct work_struct *t)
The current implementation limits context-aware processing
within work functions due to the lack of a mechanism to identify
the source work_struct in the array. The proposed solution wraps
each work_struct with a struct work_wrapper, adding crucial context
like the array index and a reference to the parent data structure.
Ex:
#define SOME_CONSTANT 10
struct xxx_data {
.....
struct work_struct work[SOME_CONSTANT]:
.....
};
The xxx_data module currently uses an array of work_structs
for scheduling work, but it lacks the ability to identify which
array element is associated with a specific invocation of the work
function. This limitation prevents the execution of context-specific
actions based on the source of the work request.
The proposed solution is to introduce a struct work_wrapper that
encapsulates each work_struct along with additional metadata,
including an index and a pointer to the parent xxx_data structure.
This enhancement allows the work function to access necessary
context information.
Changes:
1. Definition of struct work_wrapper:
struct work_wrapper {
struct work_struct work;
struct xxx_data *data;
int index;
};
struct xxx_data {
struct work_wrapper work[SOME_CONSTANT];
};
During initialization:
for (int i = 0; i < SOME_CONSTANT; i++) {
p->work[i].data = p;
p->work[i].index = i;
INIT_WORK(&p->work[i].work, work_func);
}
And it's usage in the handler:
void work_func(struct work_struct *t)
{
struct work_wrapper *wrapper = from_work(wrapper, t, work);
struct xxx_data *a = wrapper->data;
int index = wrapper->index;
....
}
If the above is solution is acceptable, I can have the same
incorporated in version 2.
Thanks.
Allen Pais (1):
[RFC] scsi: Convert from tasklet to BH workqueue
drivers/scsi/aic7xxx/aic7xxx_osm.c | 2 +-
drivers/scsi/aic94xx/aic94xx_hwi.c | 14 ++--
drivers/scsi/aic94xx/aic94xx_hwi.h | 5 +-
drivers/scsi/aic94xx/aic94xx_scb.c | 36 +++++-----
drivers/scsi/aic94xx/aic94xx_task.c | 14 ++--
drivers/scsi/aic94xx/aic94xx_tmf.c | 34 +++++-----
drivers/scsi/esas2r/esas2r.h | 12 ++--
drivers/scsi/esas2r/esas2r_init.c | 14 ++--
drivers/scsi/esas2r/esas2r_int.c | 18 ++---
drivers/scsi/esas2r/esas2r_io.c | 2 +-
drivers/scsi/esas2r/esas2r_main.c | 16 ++---
drivers/scsi/ibmvscsi/ibmvfc.c | 16 ++---
drivers/scsi/ibmvscsi/ibmvfc.h | 3 +-
drivers/scsi/ibmvscsi/ibmvscsi.c | 16 ++---
drivers/scsi/ibmvscsi/ibmvscsi.h | 3 +-
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 15 ++---
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h | 3 +-
drivers/scsi/isci/host.c | 12 ++--
drivers/scsi/isci/host.h | 8 +--
drivers/scsi/isci/init.c | 4 +-
drivers/scsi/megaraid/mega_common.h | 5 +-
drivers/scsi/megaraid/megaraid_mbox.c | 21 +++---
drivers/scsi/megaraid/megaraid_sas.h | 4 +-
drivers/scsi/megaraid/megaraid_sas_base.c | 32 +++++----
drivers/scsi/megaraid/megaraid_sas_fusion.c | 16 ++---
drivers/scsi/mvsas/mv_init.c | 27 ++++----
drivers/scsi/mvsas/mv_sas.h | 9 +--
drivers/scsi/pm8001/pm8001_init.c | 57 ++++++++--------
drivers/scsi/pm8001/pm8001_sas.h | 2 +-
drivers/scsi/pmcraid.c | 75 ++++++++++-----------
drivers/scsi/pmcraid.h | 5 +-
31 files changed, 249 insertions(+), 251 deletions(-)
--
2.17.1
WARNING: multiple messages have this Message-ID (diff)
From: Allen Pais <apais@linux.microsoft.com>
To: linux-scsi@vger.kernel.org
Cc: tyreld@linux.ibm.com, hare@suse.com, linuxdrivers@attotech.com,
martin.petersen@oracle.com,
shivasharan.srikanteshwara@broadcom.com, jejb@linux.ibm.com,
linux-kernel@vger.kernel.org, npiggin@gmail.com,
kashyap.desai@broadcom.com, aneesh.kumar@kernel.org,
sumit.saxena@broadcom.com, chandrakanth.patil@broadcom.com,
target-devel@vger.kernel.org, artur.paszkiewicz@intel.co,
naveen.n.rao@linux.ibm.com, jinpu.wang@cloud.ionos.com,
linuxppc-dev@lists.ozlabs.org, megaraidlinux.pdl@broadcom.com
Subject: [PATCH 0/1] Convert tasklets to bottom half workqueues
Date: Thu, 2 May 2024 20:34:32 +0000 [thread overview]
Message-ID: <20240502203433.15811-1-apais@linux.microsoft.com> (raw)
I am submitting this patch which converts instances of tasklets
in drivers/scsi/* to bottom half workqueues. I appreciate your
feedback and suggestion on the changes.
Note: The patch is only compile tested.
In the patcheset, you will notice *FIXME* in two places:
1. pm8001/pm8001_init.c @ pm8001_work(struct work_struct *t)
2. pmcraid.c @ pmcraid_work_function(struct work_struct *t)
The current implementation limits context-aware processing
within work functions due to the lack of a mechanism to identify
the source work_struct in the array. The proposed solution wraps
each work_struct with a struct work_wrapper, adding crucial context
like the array index and a reference to the parent data structure.
Ex:
#define SOME_CONSTANT 10
struct xxx_data {
.....
struct work_struct work[SOME_CONSTANT]:
.....
};
The xxx_data module currently uses an array of work_structs
for scheduling work, but it lacks the ability to identify which
array element is associated with a specific invocation of the work
function. This limitation prevents the execution of context-specific
actions based on the source of the work request.
The proposed solution is to introduce a struct work_wrapper that
encapsulates each work_struct along with additional metadata,
including an index and a pointer to the parent xxx_data structure.
This enhancement allows the work function to access necessary
context information.
Changes:
1. Definition of struct work_wrapper:
struct work_wrapper {
struct work_struct work;
struct xxx_data *data;
int index;
};
struct xxx_data {
struct work_wrapper work[SOME_CONSTANT];
};
During initialization:
for (int i = 0; i < SOME_CONSTANT; i++) {
p->work[i].data = p;
p->work[i].index = i;
INIT_WORK(&p->work[i].work, work_func);
}
And it's usage in the handler:
void work_func(struct work_struct *t)
{
struct work_wrapper *wrapper = from_work(wrapper, t, work);
struct xxx_data *a = wrapper->data;
int index = wrapper->index;
....
}
If the above is solution is acceptable, I can have the same
incorporated in version 2.
Thanks.
Allen Pais (1):
[RFC] scsi: Convert from tasklet to BH workqueue
drivers/scsi/aic7xxx/aic7xxx_osm.c | 2 +-
drivers/scsi/aic94xx/aic94xx_hwi.c | 14 ++--
drivers/scsi/aic94xx/aic94xx_hwi.h | 5 +-
drivers/scsi/aic94xx/aic94xx_scb.c | 36 +++++-----
drivers/scsi/aic94xx/aic94xx_task.c | 14 ++--
drivers/scsi/aic94xx/aic94xx_tmf.c | 34 +++++-----
drivers/scsi/esas2r/esas2r.h | 12 ++--
drivers/scsi/esas2r/esas2r_init.c | 14 ++--
drivers/scsi/esas2r/esas2r_int.c | 18 ++---
drivers/scsi/esas2r/esas2r_io.c | 2 +-
drivers/scsi/esas2r/esas2r_main.c | 16 ++---
drivers/scsi/ibmvscsi/ibmvfc.c | 16 ++---
drivers/scsi/ibmvscsi/ibmvfc.h | 3 +-
drivers/scsi/ibmvscsi/ibmvscsi.c | 16 ++---
drivers/scsi/ibmvscsi/ibmvscsi.h | 3 +-
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 15 ++---
drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.h | 3 +-
drivers/scsi/isci/host.c | 12 ++--
drivers/scsi/isci/host.h | 8 +--
drivers/scsi/isci/init.c | 4 +-
drivers/scsi/megaraid/mega_common.h | 5 +-
drivers/scsi/megaraid/megaraid_mbox.c | 21 +++---
drivers/scsi/megaraid/megaraid_sas.h | 4 +-
drivers/scsi/megaraid/megaraid_sas_base.c | 32 +++++----
drivers/scsi/megaraid/megaraid_sas_fusion.c | 16 ++---
drivers/scsi/mvsas/mv_init.c | 27 ++++----
drivers/scsi/mvsas/mv_sas.h | 9 +--
drivers/scsi/pm8001/pm8001_init.c | 57 ++++++++--------
drivers/scsi/pm8001/pm8001_sas.h | 2 +-
drivers/scsi/pmcraid.c | 75 ++++++++++-----------
drivers/scsi/pmcraid.h | 5 +-
31 files changed, 249 insertions(+), 251 deletions(-)
--
2.17.1
next reply other threads:[~2024-05-02 20:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 20:34 Allen Pais [this message]
2024-05-02 20:34 ` [PATCH 0/1] Convert tasklets to bottom half workqueues Allen Pais
2024-05-02 20:34 ` [PATCH] [RFC] scsi: Convert from tasklet to BH workqueue Allen Pais
2024-05-02 20:34 ` Allen Pais
2024-05-03 2:03 ` Michael Ellerman
2024-05-03 2:03 ` Michael Ellerman
2024-05-03 15:32 ` Allen Pais
2024-05-03 15:32 ` Allen Pais
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240502203433.15811-1-apais@linux.microsoft.com \
--to=apais@linux.microsoft.com \
--cc=aneesh.kumar@kernel.org \
--cc=artur.paszkiewicz@intel.co \
--cc=chandrakanth.patil@broadcom.com \
--cc=christophe.leroy@csgroup.eu \
--cc=hare@suse.com \
--cc=jejb@linux.ibm.com \
--cc=jinpu.wang@cloud.ionos.com \
--cc=kashyap.desai@broadcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxdrivers@attotech.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=martin.petersen@oracle.com \
--cc=megaraidlinux.pdl@broadcom.com \
--cc=mpe@ellerman.id.au \
--cc=naveen.n.rao@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=shivasharan.srikanteshwara@broadcom.com \
--cc=sumit.saxena@broadcom.com \
--cc=target-devel@vger.kernel.org \
--cc=tyreld@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.