Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.2/patches/833402/?format=api
{ "id": 833402, "url": "http://patchwork.ozlabs.org/api/1.2/patches/833402/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20171102151206.tvfsotckcqgnj3ky@linutronix.de/", "project": { "id": 28, "url": "http://patchwork.ozlabs.org/api/1.2/projects/28/?format=api", "name": "Linux PCI development", "link_name": "linux-pci", "list_id": "linux-pci.vger.kernel.org", "list_email": "linux-pci@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20171102151206.tvfsotckcqgnj3ky@linutronix.de>", "list_archive_url": null, "date": "2017-11-02T15:12:06", "name": "[v3] pci/switchtec: Don't use completion's wait queue", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "edfb1becf4005ea1ac6aed5fdbd89483103065ac", "submitter": { "id": 86, "url": "http://patchwork.ozlabs.org/api/1.2/people/86/?format=api", "name": "Sebastian Andrzej Siewior", "email": "bigeasy@linutronix.de" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20171102151206.tvfsotckcqgnj3ky@linutronix.de/mbox/", "series": [ { "id": 11529, "url": "http://patchwork.ozlabs.org/api/1.2/series/11529/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=11529", "date": "2017-11-02T15:12:06", "name": "[v3] pci/switchtec: Don't use completion's wait queue", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/11529/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/833402/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/833402/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<linux-pci-owner@vger.kernel.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yST8V0Ysnz9sDB\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 3 Nov 2017 02:12:10 +1100 (AEDT)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S933593AbdKBPMI convert rfc822-to-8bit (ORCPT\n\t<rfc822;incoming@patchwork.ozlabs.org>);\n\tThu, 2 Nov 2017 11:12:08 -0400", "from Galois.linutronix.de ([146.0.238.70]:54675 \"EHLO\n\tGalois.linutronix.de\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S932724AbdKBPMI (ORCPT\n\t<rfc822;linux-pci@vger.kernel.org>); Thu, 2 Nov 2017 11:12:08 -0400", "from bigeasy by Galois.linutronix.de with local (Exim 4.80)\n\t(envelope-from <bigeasy@linutronix.de>)\n\tid 1eAH9g-0000D7-JT; Thu, 02 Nov 2017 16:11:40 +0100" ], "Date": "Thu, 2 Nov 2017 16:12:06 +0100", "From": "Sebastian Andrzej Siewior <bigeasy@linutronix.de>", "To": "Logan Gunthorpe <logang@deltatee.com>", "Cc": "linux-pci@vger.kernel.org, tglx@linutronix.de,\n\tKurt Schwemmer <kurt.schwemmer@microsemi.com>", "Subject": "[PATCH v3] pci/switchtec: Don't use completion's wait queue", "Message-ID": "<20171102151206.tvfsotckcqgnj3ky@linutronix.de>", "References": "<20171004095007.19148-1-bigeasy@linutronix.de>\n\t<dfd717ac-a775-f30c-4d41-2da68e08ff54@deltatee.com>\n\t<20171005105100.2nf4ih2fgq6dax5g@linutronix.de>\n\t<0ae3975a-b1b1-fb8b-2f90-ff103da9d178@deltatee.com>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=utf-8", "Content-Disposition": "inline", "Content-Transfer-Encoding": "8BIT", "In-Reply-To": "<0ae3975a-b1b1-fb8b-2f90-ff103da9d178@deltatee.com>", "User-Agent": "NeoMutt/20170609 (1.8.3)", "Sender": "linux-pci-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<linux-pci.vger.kernel.org>", "X-Mailing-List": "linux-pci@vger.kernel.org" }, "content": "The poll callback is using completion's wait_queue_head_t member and\nputs it in poll_wait() so the poll() caller gets a wakeup after command\ncompleted. This does not work on RT because we don't have a\nwait_queue_head_t in our completion implementation. Nobody in tree does\nlike that in tree so this is the only driver that breaks.\n\nInstead of using the completion here is waitqueue with a status flag as\nsuggested by Logan.\n\nI don't have the HW so I have no idea if it works as expected, so please\ntest it.\n\nCc: Kurt Schwemmer <kurt.schwemmer@microsemi.com>\nCc: Logan Gunthorpe <logang@deltatee.com>\nSigned-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>\n---\nv2…v3: add missing\n\t stuser->cmd_done = true;\n spotted by Logan.\n\n drivers/pci/switch/switchtec.c | 22 +++++++++++++---------\n 1 file changed, 13 insertions(+), 9 deletions(-)", "diff": "--- a/drivers/pci/switch/switchtec.c\n+++ b/drivers/pci/switch/switchtec.c\n@@ -306,10 +306,11 @@ struct switchtec_user {\n \n \tenum mrpc_state state;\n \n-\tstruct completion comp;\n+\twait_queue_head_t cmd_comp;\n \tstruct kref kref;\n \tstruct list_head list;\n \n+\tbool cmd_done;\n \tu32 cmd;\n \tu32 status;\n \tu32 return_code;\n@@ -331,7 +332,7 @@ static struct switchtec_user *stuser_cre\n \tstuser->stdev = stdev;\n \tkref_init(&stuser->kref);\n \tINIT_LIST_HEAD(&stuser->list);\n-\tinit_completion(&stuser->comp);\n+\tinit_waitqueue_head(&stuser->cmd_comp);\n \tstuser->event_cnt = atomic_read(&stdev->event_cnt);\n \n \tdev_dbg(&stdev->dev, \"%s: %p\\n\", __func__, stuser);\n@@ -414,7 +415,7 @@ static int mrpc_queue_cmd(struct switcht\n \tkref_get(&stuser->kref);\n \tstuser->read_len = sizeof(stuser->data);\n \tstuser_set_state(stuser, MRPC_QUEUED);\n-\tinit_completion(&stuser->comp);\n+\tstuser->cmd_done = false;\n \tlist_add_tail(&stuser->list, &stdev->mrpc_queue);\n \n \tmrpc_cmd_submit(stdev);\n@@ -451,7 +452,8 @@ static void mrpc_complete_cmd(struct swi\n \t\t stuser->read_len);\n \n out:\n-\tcomplete_all(&stuser->comp);\n+\tstuser->cmd_done = true;\n+\twake_up_interruptible(&stuser->cmd_comp);\n \tlist_del_init(&stuser->list);\n \tstuser_put(stuser);\n \tstdev->mrpc_busy = 0;\n@@ -721,10 +723,11 @@ static ssize_t switchtec_dev_read(struct\n \tmutex_unlock(&stdev->mrpc_mutex);\n \n \tif (filp->f_flags & O_NONBLOCK) {\n-\t\tif (!try_wait_for_completion(&stuser->comp))\n+\t\tif (!stuser->cmd_done)\n \t\t\treturn -EAGAIN;\n \t} else {\n-\t\trc = wait_for_completion_interruptible(&stuser->comp);\n+\t\trc = wait_event_interruptible(stuser->cmd_comp,\n+\t\t\t\t\t stuser->cmd_done);\n \t\tif (rc < 0)\n \t\t\treturn rc;\n \t}\n@@ -772,7 +775,7 @@ static unsigned int switchtec_dev_poll(s\n \tstruct switchtec_dev *stdev = stuser->stdev;\n \tint ret = 0;\n \n-\tpoll_wait(filp, &stuser->comp.wait, wait);\n+\tpoll_wait(filp, &stuser->cmd_comp, wait);\n \tpoll_wait(filp, &stdev->event_wq, wait);\n \n \tif (lock_mutex_and_test_alive(stdev))\n@@ -780,7 +783,7 @@ static unsigned int switchtec_dev_poll(s\n \n \tmutex_unlock(&stdev->mrpc_mutex);\n \n-\tif (try_wait_for_completion(&stuser->comp))\n+\tif (stuser->cmd_done)\n \t\tret |= POLLIN | POLLRDNORM;\n \n \tif (stuser->event_cnt != atomic_read(&stdev->event_cnt))\n@@ -1255,7 +1258,8 @@ static void stdev_kill(struct switchtec_\n \n \t/* Wake up and kill any users waiting on an MRPC request */\n \tlist_for_each_entry_safe(stuser, tmpuser, &stdev->mrpc_queue, list) {\n-\t\tcomplete_all(&stuser->comp);\n+\t\tstuser->cmd_done = true;\n+\t\twake_up_interruptible(&stuser->cmd_comp);\n \t\tlist_del_init(&stuser->list);\n \t\tstuser_put(stuser);\n \t}\n", "prefixes": [ "v3" ] }