diff mbox

[17/20,SCSI] mpt3sas: Use alloc_ordered_workqueue() API instead of create_singlethread_workqueue() API

Message ID 1434102153-38581-18-git-send-email-Sreekanth.Reddy@avagotech.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sreekanth Reddy June 12, 2015, 9:42 a.m. UTC
Created a thread using alloc_ordered_workqueue() API in order to process
the works from firmware Work-queue sequentially instead of
create_singlethread_workqueue() API.

Signed-off-by: Sreekanth Reddy <Sreekanth.Reddy@avagotech.com>
---
 drivers/scsi/mpt3sas/mpt3sas_scsih.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Joe Lawrence June 12, 2015, 9:03 p.m. UTC | #1
On 06/12/2015 05:42 AM, Sreekanth Reddy wrote:
...
> +#if defined(alloc_ordered_workqueue)
> +	ioc->firmware_event_thread = alloc_ordered_workqueue(
> +		ioc->firmware_event_name, WQ_MEM_RECLAIM);
> +#else
> +		ioc->firmware_event_thread = create_singlethread_workqueue(
>  	    ioc->firmware_event_name);
> +#endif

Hi Sreekanth,

I think the upstream version of this code can safely assume
alloc_ordered_workqueue is defined, no?

Regards,

-- Joe
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sreekanth Reddy June 15, 2015, 10:56 a.m. UTC | #2
On Sat, Jun 13, 2015 at 2:33 AM, Joe Lawrence <joe.lawrence@stratus.com> wrote:
> On 06/12/2015 05:42 AM, Sreekanth Reddy wrote:
> ...
>> +#if defined(alloc_ordered_workqueue)
>> +     ioc->firmware_event_thread = alloc_ordered_workqueue(
>> +             ioc->firmware_event_name, WQ_MEM_RECLAIM);
>> +#else
>> +             ioc->firmware_event_thread = create_singlethread_workqueue(
>>           ioc->firmware_event_name);
>> +#endif
>
> Hi Sreekanth,
>
> I think the upstream version of this code can safely assume
> alloc_ordered_workqueue is defined, no?

yes, upstream version of this code can safely assume that
alloc_ordered_workqueue is defined.

While working in-house, I observed that some of the older kernels
doesn't defined this macro, so I have added this else section.

>
> Regards,
>
> -- Joe
James Bottomley June 15, 2015, 9:05 p.m. UTC | #3
On Mon, 2015-06-15 at 16:26 +0530, Sreekanth Reddy wrote:
> On Sat, Jun 13, 2015 at 2:33 AM, Joe Lawrence <joe.lawrence@stratus.com> wrote:
> > On 06/12/2015 05:42 AM, Sreekanth Reddy wrote:
> > ...
> >> +#if defined(alloc_ordered_workqueue)
> >> +     ioc->firmware_event_thread = alloc_ordered_workqueue(
> >> +             ioc->firmware_event_name, WQ_MEM_RECLAIM);
> >> +#else
> >> +             ioc->firmware_event_thread = create_singlethread_workqueue(
> >>           ioc->firmware_event_name);
> >> +#endif
> >
> > Hi Sreekanth,
> >
> > I think the upstream version of this code can safely assume
> > alloc_ordered_workqueue is defined, no?
> 
> yes, upstream version of this code can safely assume that
> alloc_ordered_workqueue is defined.
> 
> While working in-house, I observed that some of the older kernels
> doesn't defined this macro, so I have added this else section.

The driver has to be defined for the current kernel.  If you maintain a
backport, that's fine, but not in the upstream driver.  The reasons are
fairly pragmatic: this code in the #else clause can't be compiled so
it's just junk to the upstream driver and the static checkers will find
it and you'll attract a flock of patches removing dead code.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sreekanth Reddy June 16, 2015, 5:03 a.m. UTC | #4
On Tue, Jun 16, 2015 at 2:35 AM, James Bottomley
<James.Bottomley@hansenpartnership.com> wrote:
> On Mon, 2015-06-15 at 16:26 +0530, Sreekanth Reddy wrote:
>> On Sat, Jun 13, 2015 at 2:33 AM, Joe Lawrence <joe.lawrence@stratus.com> wrote:
>> > On 06/12/2015 05:42 AM, Sreekanth Reddy wrote:
>> > ...
>> >> +#if defined(alloc_ordered_workqueue)
>> >> +     ioc->firmware_event_thread = alloc_ordered_workqueue(
>> >> +             ioc->firmware_event_name, WQ_MEM_RECLAIM);
>> >> +#else
>> >> +             ioc->firmware_event_thread = create_singlethread_workqueue(
>> >>           ioc->firmware_event_name);
>> >> +#endif
>> >
>> > Hi Sreekanth,
>> >
>> > I think the upstream version of this code can safely assume
>> > alloc_ordered_workqueue is defined, no?
>>
>> yes, upstream version of this code can safely assume that
>> alloc_ordered_workqueue is defined.
>>
>> While working in-house, I observed that some of the older kernels
>> doesn't defined this macro, so I have added this else section.
>
> The driver has to be defined for the current kernel.  If you maintain a
> backport, that's fine, but not in the upstream driver.  The reasons are
> fairly pragmatic: this code in the #else clause can't be compiled so
> it's just junk to the upstream driver and the static checkers will find
> it and you'll attract a flock of patches removing dead code.
>
Accepted. I will post next version of this patch by removing the else section.

Thanks,
Sreekanth


> James
>
>
diff mbox

Patch

diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
index 837c22a..42bb731 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
@@ -8024,8 +8024,13 @@  _scsih_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* event thread */
 	snprintf(ioc->firmware_event_name, sizeof(ioc->firmware_event_name),
 	    "fw_event%d", ioc->id);
-	ioc->firmware_event_thread = create_singlethread_workqueue(
+#if defined(alloc_ordered_workqueue)
+	ioc->firmware_event_thread = alloc_ordered_workqueue(
+		ioc->firmware_event_name, WQ_MEM_RECLAIM);
+#else
+		ioc->firmware_event_thread = create_singlethread_workqueue(
 	    ioc->firmware_event_name);
+#endif
 	if (!ioc->firmware_event_thread) {
 		pr_err(MPT3SAS_FMT "failure at %s:%d/%s()!\n",
 		    ioc->name, __FILE__, __LINE__, __func__);