From patchwork Tue Nov 27 23:51:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10701637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B750A13BB for ; Tue, 27 Nov 2018 23:52:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7BAE2C967 for ; Tue, 27 Nov 2018 23:52:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C0812C9D5; Tue, 27 Nov 2018 23:52:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EDD62C967 for ; Tue, 27 Nov 2018 23:52:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726659AbeK1KwO (ORCPT ); Wed, 28 Nov 2018 05:52:14 -0500 Received: from com-out001.mailprotect.be ([83.217.72.83]:42213 "EHLO com-out001.mailprotect.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbeK1KwN (ORCPT ); Wed, 28 Nov 2018 05:52:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mailprotect.be; s=mail; h=Content-Transfer-Encoding:MIME-Version:References :In-Reply-To:Message-Id:Date:Subject:Cc:To:From:reply-to:sender:bcc: content-type; bh=CIW4ca3J7tThMZAt5DVTaHtq1JHj3x1aBYzBVt8qX08=; b=o7DjLxB434+L 6P31iyyVULHGCN87pF7LiEwSAb7ZZP0Eg6AwfcZ4ukbQ2VqL4HN4bBfTSLXktPf8k7GeZ5fTK2awi TSNDUCIfvlwHMnHzOAxgm5tpA3qgDpRJPZgA6KsSg41z1cUeqYGoeAE7o7J5IYIHt2CJRTAD92X+A EN253ECLpGGKVZdRryu4zNbEBs46NOKM52epYdHBG4vC9Ww3M4u76kKC9gvT75cFTYFgxyDT9rt/F BaioTUjFX4zkCMVeBp2RFzZ348OHE05JVR79wb0n3M08B7uUzLrNLHohuRNpikRuiVYRGJTCXo7ov uwveXDuCHsPMt6wHe3VWEw==; Received: from smtp-auth.mailprotect.be ([178.208.39.159]) by com-mpt-out001.mailprotect.be with esmtp (Exim 4.89) (envelope-from ) id 1gRn9a-000A1p-TB; Wed, 28 Nov 2018 00:52:31 +0100 Received: from desktop-bart.svl.corp.google.com (unknown [104.133.8.89]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp-auth.mailprotect.be (Postfix) with ESMTPSA id 04BD2C03F9; Wed, 28 Nov 2018 00:52:25 +0100 (CET) From: Bart Van Assche To: "Martin K . Petersen" Cc: Christoph Hellwig , target-devel@vger.kernel.org, Bart Van Assche , Nicholas Bellinger , Mike Christie , David Disseldorp , Hannes Reinecke Subject: [PATCH v2 05/10] target/core: Use system workqueues for TMF Date: Tue, 27 Nov 2018 15:51:59 -0800 Message-Id: <20181127235204.186731-6-bvanassche@acm.org> X-Mailer: git-send-email 2.20.0.rc0.387.gc7a69e6b6c-goog In-Reply-To: <20181127235204.186731-1-bvanassche@acm.org> References: <20181127235204.186731-1-bvanassche@acm.org> MIME-Version: 1.0 X-Originating-IP: 178.208.39.159 X-SpamExperts-Domain: mailprotect.be X-SpamExperts-Username: 178.208.39.128/27 Authentication-Results: mailprotect.be; auth=pass smtp.auth=178.208.39.128/27@mailprotect.be X-SpamExperts-Outgoing-Class: ham X-SpamExperts-Outgoing-Evidence: Combined (0.01) X-Recommended-Action: accept X-Filter-ID: EX5BVjFpneJeBchSMxfU5hABmM3gea5gOSz7nWl1cMd602E9L7XzfQH6nu9C/Fh9KJzpNe6xgvOx q3u0UDjvO1tLifGj39bI0bcPyaJsYTagCTS5H5Pie2sCQ3gGSzr06cM7U7xDGmYwNG93LVnxwxjk yGQYCd08t3lHobjxX/OigDGQOIiVUN5rGO3B5zfVpnsdsF0/474T9aStD4uEKVG9P9yTThxC66Ku Xb0HO3W8nbMwgkUuW83PKbk25YSnvgtxKKcMIJ7ptgUxRg53TuCt4QJNIvyoxb4710Nl6KAZZ+9r UkyLOOkgJ9eTXvOC4trOptRiSOXsXUvIrRE5GvvvWJBNmCbFjwnxFiK3wvBI2C8QBYsWIMCVBHpa 7Qj+JYN6Crh9DXUDEtWWsjsNUWDlGPaDR+Aes7asAZpVFyfMODodi5MLJiAvrVIiQFNhc8S+HKYI 1vbaqYoREZsvVKq8YZ9/SG1CqFB/T9oOuGkszjGcI+mbLJLuOAP016dVWgH88tf6uZ3Odz3W94Ik DCkIj7lUenMOpFxPb4a0gTxJECCYsMoByn2L5D4ESJJSPTtI2NWSXQ8+P45Rhlff/V8o9A8S4+tr vYumJM3atRPpj3GbeSYQbpjOFT4aGmRsFCWUldd4Zfx8AzM82qsIbx1/rxbQicf/5tMwo2bfwweZ +eEX1T91V5n3FsMEfdSIIO3fJ9DGWEJopzxygkVT7yk4xAm9D8KTeKJT7gNACPfxVynFIF3Xrs2K JHQMxL9Pga9lSGLsEntA55GTrob+bwU0pkWukw/5GtMnr6abkRnGole9t63Xd7+C0fxeF9o+LOCQ TrSFM7snLE/cSYe0laqW2xg/HY4alqklDBtTqXGJI9CnVA3fjMGyg48sBVMwSw4LvlF4kd5XJtyi c4/Tu+J4YfXDApCFS5UnqSvzTBMZqJNdbvPaUyoCdu6Y7CHSkG34KkwBCHXe+q6DmHcPHCOANQpD Nj3hyAWLG/mWh9UtJEE8oUMEuPfGxBbNSZrpkgCIMo7V3eOzJJ/4nSzNzW4P2kDC4uGq3HDl7GPw DDt+pvlHhV6a5QjptwQBGybQnI83ChkUX8F6u4X0g9iAwvJfZx3lGs1VZ0iZG6egppXkjOrhVptJ 8gZRjxEnfx1IYQ/4lg9Ffvqg9IG0EE8tjDWZlB+G9Jc9fWekhCkYETsycmIe9DyBCzx4I5obgO+2 ucHiHFYFX/uMKqFwmrSG6vY4ocfmWv3Fe9Iziczdq+A= X-Report-Abuse-To: spam@com-mpt-mgt001.mailprotect.be Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A quote from SAM-5: "The order in which task management requests are processed is not specified by the SCSI architecture model. The SCSI architecture model does not require in-order delivery of such task management requests or processing by the task manager in the order received. To guarantee the processing order of task management requests referencing sent to a specific logical unit, an application client should not have more than one such task management request pending to that logical unit." This means that it is safe to use the system workqueues instead of tmr_wq for processing TMFs. An intended side effect of this patch is that it enables concurrent processing of TMFs. Reviewed-by: Christoph Hellwig Cc: Nicholas Bellinger Cc: Mike Christie Cc: David Disseldorp Cc: Hannes Reinecke Signed-off-by: Bart Van Assche --- drivers/target/target_core_device.c | 16 ---------------- drivers/target/target_core_transport.c | 2 +- include/target/target_core_base.h | 1 - 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/target/target_core_device.c b/drivers/target/target_core_device.c index c6b1122ee097..d452d2059946 100644 --- a/drivers/target/target_core_device.c +++ b/drivers/target/target_core_device.c @@ -985,18 +985,6 @@ int target_configure_device(struct se_device *dev) if (ret) goto out_destroy_device; - /* - * Startup the struct se_device processing thread - */ - dev->tmr_wq = alloc_workqueue("tmr-%s", WQ_MEM_RECLAIM | WQ_UNBOUND, 1, - dev->transport->name); - if (!dev->tmr_wq) { - pr_err("Unable to create tmr workqueue for %s\n", - dev->transport->name); - ret = -ENOMEM; - goto out_free_alua; - } - /* * Setup work_queue for QUEUE_FULL */ @@ -1025,8 +1013,6 @@ int target_configure_device(struct se_device *dev) return 0; -out_free_alua: - core_alua_free_lu_gp_mem(dev); out_destroy_device: dev->transport->destroy_device(dev); out_free_index: @@ -1045,8 +1031,6 @@ void target_free_device(struct se_device *dev) WARN_ON(!list_empty(&dev->dev_sep_list)); if (target_dev_configured(dev)) { - destroy_workqueue(dev->tmr_wq); - dev->transport->destroy_device(dev); mutex_lock(&device_mutex); diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index f429eece950b..eab5fa2248af 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -3412,7 +3412,7 @@ int transport_generic_handle_tmr( } INIT_WORK(&cmd->work, target_tmr_work); - queue_work(cmd->se_dev->tmr_wq, &cmd->work); + schedule_work(&cmd->work); return 0; } EXPORT_SYMBOL(transport_generic_handle_tmr); diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 067da330ed9c..67130841d421 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -794,7 +794,6 @@ struct se_device { struct t10_pr_registration *dev_pr_res_holder; struct list_head dev_sep_list; struct list_head dev_tmr_list; - struct workqueue_struct *tmr_wq; struct work_struct qf_work_queue; struct list_head delayed_cmd_list; struct list_head state_list;