{"id":794859,"url":"http://patchwork.ozlabs.org/api/patches/794859/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170728125416.j7gcgvnxgv2gq73u@tardis/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<20170728125416.j7gcgvnxgv2gq73u@tardis>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/20170728125416.j7gcgvnxgv2gq73u@tardis/","date":"2017-07-28T12:54:16","name":"RCU lockup issues when CONFIG_SOFTLOCKUP_DETECTOR=n - any one else seeing this?","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"bae23a9599516a37f833c9f569c30ce94dcda9e0","submitter":{"id":67102,"url":"http://patchwork.ozlabs.org/api/people/67102/?format=json","name":"Boqun Feng","email":"boqun.feng@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20170728125416.j7gcgvnxgv2gq73u@tardis/mbox/","series":[],"comments":"http://patchwork.ozlabs.org/api/patches/794859/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/794859/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>","X-Original-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":["patchwork-incoming@ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68])\n\t(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xJpkJ1rKgz9s65\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 28 Jul 2017 22:56:08 +1000 (AEST)","from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 3xJpkJ0XByzDrSL\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 28 Jul 2017 22:56:08 +1000 (AEST)","from mail-pf0-x241.google.com (mail-pf0-x241.google.com\n\t[IPv6:2607:f8b0:400e:c00::241])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128\n\tbits)) (No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 3xJphS6xVYzDrRd\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 28 Jul 2017 22:54:32 +1000 (AEST)","by mail-pf0-x241.google.com with SMTP id k72so17291827pfj.0\n\tfor <linuxppc-dev@lists.ozlabs.org>;\n\tFri, 28 Jul 2017 05:54:32 -0700 (PDT)","from localhost ([45.32.128.109]) by smtp.gmail.com with ESMTPSA id\n\tu13sm37713843pgq.75.2017.07.28.05.54.29\n\t(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);\n\tFri, 28 Jul 2017 05:54:30 -0700 (PDT)"],"Authentication-Results":["ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"An67snWt\"; dkim-atps=neutral","lists.ozlabs.org;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"An67snWt\"; dkim-atps=neutral","lists.ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"An67snWt\"; dkim-atps=neutral"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=date:from:to:cc:subject:message-id:references:mime-version\n\t:content-disposition:in-reply-to:user-agent;\n\tbh=3dxAWXRnKj6cNK3WuBZRq+thyyCEiE5wWSRzzzL1eZ0=;\n\tb=An67snWtsqD0zhAm9QwAFJE6/o9erRT02Nea7M5PaO9k9K99mVhHsjBXdKRPvDW7L8\n\tXcB9iwffvLcJyrcaa7yooau1+ExYoesmhDVa/CjAyGJ50/JloEhGxxam+KUsdP1Y3KOc\n\tdKNSKE2Hy8htkn79U1P0Y6H6ZkkAmQcCGdzmrpdS0FCdrBNWl94zkPHSR430ddDFjrBp\n\tHeTfLzjuw+Q+8x1v47MG8z4swEuBAA7wnkXodP5P8/ubgWA8rMSEpoYcijFVsRXouUE5\n\tw3RNrlNeG/dXwslgfS8wuabRzCz141pZPZw5RO2nrZwojGopOA4rIdIfaWDe+cTuiC6a\n\tZPfA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:references\n\t:mime-version:content-disposition:in-reply-to:user-agent;\n\tbh=3dxAWXRnKj6cNK3WuBZRq+thyyCEiE5wWSRzzzL1eZ0=;\n\tb=i8E8mh9LdgU3FauzzYHxi9PofXfyJB1Z1wNRywnO2TwE8jEHbWiFo9l5hpmtu+ShE2\n\tqka5+vbcCIuD43Kvjp8lmbaFhlXy4V1CWphIZdyY6BC2LhDqy0aXrq/4wvNd/4pPaxHO\n\tUprqOcgDPRwxv36wS7aNJvfmCWu/Nd6iCi1ucvt+xN5+yCqhh1pjDkDznv5jUPY6+xIj\n\tRyodlMOLqw9JK+kdZNnBbXrV4pthACd9YJ+KeHxoGArxzdmyN/jawywJ2gXGAphNsWGg\n\twDTLGSxrvD8rVcaMUtc3QvuDLR4SOx0zklXCZMlNq5eGRbDr2yPKafSiaaXtuCQJMeZH\n\tnajQ==","X-Gm-Message-State":"AIVw113MZdMwFMLb8JNtJRaM8cqcxvh2DVwNOjOQGY+xveGOUhphY432\n\tu4I5HiYQ8BI/Mw==","X-Received":"by 10.84.232.143 with SMTP id i15mr7909449plk.248.1501246471089; \n\tFri, 28 Jul 2017 05:54:31 -0700 (PDT)","Date":"Fri, 28 Jul 2017 20:54:16 +0800","From":"Boqun Feng <boqun.feng@gmail.com>","To":"Jonathan Cameron <Jonathan.Cameron@huawei.com>","Subject":"Re: RCU lockup issues when CONFIG_SOFTLOCKUP_DETECTOR=n - any one\n\telse seeing this?","Message-ID":"<20170728125416.j7gcgvnxgv2gq73u@tardis>","References":"<20170726.154540.150558937277891719.davem@davemloft.net>\n\t<20170726231505.GG3730@linux.vnet.ibm.com>\n\t<20170726.162200.1904949371593276937.davem@davemloft.net>\n\t<20170727014214.GH3730@linux.vnet.ibm.com>\n\t<20170727143400.23e4d2b2@roar.ozlabs.ibm.com>\n\t<20170727124913.GL3730@linux.vnet.ibm.com>\n\t<20170727144903.000022a1@huawei.com>\n\t<20170727173923.000001b2@huawei.com>\n\t<20170727165245.GD3730@linux.vnet.ibm.com>\n\t<20170728084411.00001ddb@huawei.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20170728084411.00001ddb@huawei.com>","User-Agent":"NeoMutt/20170609 (1.8.3)","X-BeenThere":"linuxppc-dev@lists.ozlabs.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List\n\t<linuxppc-dev.lists.ozlabs.org>","List-Unsubscribe":"<https://lists.ozlabs.org/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=unsubscribe>","List-Archive":"<http://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=help>","List-Subscribe":"<https://lists.ozlabs.org/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@lists.ozlabs.org?subject=subscribe>","Cc":"dzickus@redhat.com, sfr@canb.auug.org.au, linuxarm@huawei.com,\n\tNicholas Piggin <npiggin@gmail.com>, abdhalee@linux.vnet.ibm.com,\n\tsparclinux@vger.kernel.org, akpm@linux-foundation.org,\n\t\"Paul E. McKenney\" <paulmck@linux.vnet.ibm.com>,\n\tlinuxppc-dev@lists.ozlabs.org, David Miller <davem@davemloft.net>,\n\tlinux-arm-kernel@lists.infradead.org","Errors-To":"linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org","Sender":"\"Linuxppc-dev\"\n\t<linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org>"},"content":"Hi Jonathan,\n\nFWIW, there is wakeup-missing issue in swake_up() and swake_up_all():\n\n\thttps://marc.info/?l=linux-kernel&m=149750022019663\n\nand RCU begins to use swait/wake last year, so I thought this could be\nrelevant.\n\nCould you try the following patch and see if it works? Thanks.\n\nRegards,\nBoqun\n\n------------------>8\nSubject: [PATCH] swait: Remove the lockless swait_active() check in\n swake_up*()\n\nSteven Rostedt reported a potential race in RCU core because of\nswake_up():\n\n        CPU0                            CPU1\n        ----                            ----\n                                __call_rcu_core() {\n\n                                 spin_lock(rnp_root)\n                                 need_wake = __rcu_start_gp() {\n                                  rcu_start_gp_advanced() {\n                                   gp_flags = FLAG_INIT\n                                  }\n                                 }\n\n rcu_gp_kthread() {\n   swait_event_interruptible(wq,\n        gp_flags & FLAG_INIT) {\n   spin_lock(q->lock)\n\n                                *fetch wq->task_list here! *\n\n   list_add(wq->task_list, q->task_list)\n   spin_unlock(q->lock);\n\n   *fetch old value of gp_flags here *\n\n                                 spin_unlock(rnp_root)\n\n                                 rcu_gp_kthread_wake() {\n                                  swake_up(wq) {\n                                   swait_active(wq) {\n                                    list_empty(wq->task_list)\n\n                                   } * return false *\n\n  if (condition) * false *\n    schedule();\n\nIn this case, a wakeup is missed, which could cause the rcu_gp_kthread\nwaits for a long time.\n\nThe reason of this is that we do a lockless swait_active() check in\nswake_up(). To fix this, we can either 1) add a smp_mb() in swake_up()\nbefore swait_active() to provide the proper order or 2) simply remove\nthe swait_active() in swake_up().\n\nThe solution 2 not only fixes this problem but also keeps the swait and\nwait API as close as possible, as wake_up() doesn't provide a full\nbarrier and doesn't do a lockless check of the wait queue either.\nMoreover, there are users already using swait_active() to do their quick\nchecks for the wait queues, so it make less sense that swake_up() and\nswake_up_all() do this on their own.\n\nThis patch then removes the lockless swait_active() check in swake_up()\nand swake_up_all().\n\nReported-by: Steven Rostedt <rostedt@goodmis.org>\nSigned-off-by: Boqun Feng <boqun.feng@gmail.com>\n---\n kernel/sched/swait.c | 6 ------\n 1 file changed, 6 deletions(-)","diff":"diff --git a/kernel/sched/swait.c b/kernel/sched/swait.c\nindex 3d5610dcce11..2227e183e202 100644\n--- a/kernel/sched/swait.c\n+++ b/kernel/sched/swait.c\n@@ -33,9 +33,6 @@ void swake_up(struct swait_queue_head *q)\n {\n \tunsigned long flags;\n \n-\tif (!swait_active(q))\n-\t\treturn;\n-\n \traw_spin_lock_irqsave(&q->lock, flags);\n \tswake_up_locked(q);\n \traw_spin_unlock_irqrestore(&q->lock, flags);\n@@ -51,9 +48,6 @@ void swake_up_all(struct swait_queue_head *q)\n \tstruct swait_queue *curr;\n \tLIST_HEAD(tmp);\n \n-\tif (!swait_active(q))\n-\t\treturn;\n-\n \traw_spin_lock_irq(&q->lock);\n \tlist_splice_init(&q->task_list, &tmp);\n \twhile (!list_empty(&tmp)) {\n","prefixes":[]}