Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3679925ybd; Fri, 28 Jun 2019 13:03:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqzc3eCrz60nOWrclwj6iXfGzQjy89ago6K46iSgi7d13kJFs9C5elxraiz7sAxXZeun4Wyg X-Received: by 2002:a17:902:748c:: with SMTP id h12mr7997188pll.208.1561752213444; Fri, 28 Jun 2019 13:03:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561752213; cv=none; d=google.com; s=arc-20160816; b=djNl+kdBQo5BZ82MVeq/3pOA8y2KTsCjOt7JIYHyj7YupoHUnVzu1owXuL5TqfdcLF CfZLWPnJ1Iy8Y6f7+cetrjQ7QkoxeX6Z78SLTCII93e9gERhHk4x2CbJLRX2FM6veAMj Oaq0OMNZmDwxWYTx6AW7Gtdnf5Gqsm/rfT2oe0kdKDrh6cBYa+f1Mfq17rxr/NzRnlPK 2rYwdTjYlklYIYav0EjQy3YqCOIuCS727XgoQFp7zrPsTwGmM13P6mc81NA4iK9WZKuL z7h0pdyCRb+YdMtXsFTOFOyeAusEQq2nPE5CXqS6cElGyqkAWZqpMi02sXIP4RAO2yrd Thww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=k+h1EEPK7qutYbAaT8yxd85QhhAwaRUuxz24uX+kTC8=; b=DPAPhlR39cJV5rZ4lnybBitM9IkpvjO1X0myi42dka0IWhTjJ6jIFmKz/DBUhoFVL9 uKE8pUpGCLm056Lfmc1uNKSISTykVr29ClgEz7zH1xtwzRSzV71JfLrEsQTLrkkxFSjS Xz9y2znpaI9PnQUzYfGIJpyPla63egBVh169nZlq7g567QL2wSjYyjhD9XN/7JjzjGw8 oFT830wySKXyLHvAL9dJMzkRq8zB1FYKtTM5S9pRUN1MrBvPJWb+QN7i3OihHtFVRvVs PMADXXD9onQZO8GwHLsVh6KhQu111Xd9YpnF4VyAYLg+zbqwQKiAAFzpSKnix+M7Tt9x x9Bw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r63si2167254plb.136.2019.06.28.13.03.16; Fri, 28 Jun 2019 13:03:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727080AbfF1UBu (ORCPT + 99 others); Fri, 28 Jun 2019 16:01:50 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53494 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726809AbfF1UBt (ORCPT ); Fri, 28 Jun 2019 16:01:49 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0AC413086234; Fri, 28 Jun 2019 20:01:39 +0000 (UTC) Received: from ovpn-116-138.phx2.redhat.com (ovpn-116-138.phx2.redhat.com [10.3.116.138]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3B8335C88A; Fri, 28 Jun 2019 20:01:37 +0000 (UTC) Message-ID: Subject: Re: [RFC] Deadlock via recursive wakeup via RCU with threadirqs From: Scott Wood To: Peter Zijlstra , "Paul E. McKenney" Cc: Joel Fernandes , Steven Rostedt , Sebastian Andrzej Siewior , rcu , LKML , Thomas Gleixner , Ingo Molnar , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan Date: Fri, 28 Jun 2019 15:01:36 -0500 In-Reply-To: <20190628141522.GF3402@hirez.programming.kicks-ass.net> References: <20190627142436.GD215968@google.com> <20190627103455.01014276@gandalf.local.home> <20190627153031.GA249127@google.com> <20190627155506.GU26519@linux.ibm.com> <20190627173831.GW26519@linux.ibm.com> <20190627181638.GA209455@google.com> <20190627184107.GA26519@linux.ibm.com> <13761fee4b71cc004ad0d6709875ce917ff28fce.camel@redhat.com> <20190627203612.GD26519@linux.ibm.com> <20190628141522.GF3402@hirez.programming.kicks-ass.net> Organization: Red Hat Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Fri, 28 Jun 2019 20:01:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2019-06-28 at 16:15 +0200, Peter Zijlstra wrote: > On Thu, Jun 27, 2019 at 01:36:12PM -0700, Paul E. McKenney wrote: > > On Thu, Jun 27, 2019 at 03:17:27PM -0500, Scott Wood wrote: > > > On Thu, 2019-06-27 at 11:41 -0700, Paul E. McKenney wrote: > > > > Of course, unconditionally refusing to do the wakeup might not be > > > > happy > > > > thing for NO_HZ_FULL kernels that don't implement IRQ work. > > > > > > Couldn't smp_send_reschedule() be used instead? > > > > Good point. If current -rcu doesn't fix things for Sebastian's case, > > that would be well worth looking at. But there must be some reason > > why Peter Zijlstra didn't suggest it when he instead suggested using > > the IRQ work approach. > > > > Peter, thoughts? > > I've not exactly kept up with the thread; but irq_work allows you to run > some actual code on the remote CPU which is often useful and it is only > a little more expensive than smp_send_reschedule(). > > Also, just smp_send_reschedule() doesn't really do anything without > first poking TIF_NEED_RESCHED (or other scheduler state) and if you want > to do both, there's other helpers you should use, like resched_cpu(). resched_cpu() will not send an IPI to the current CPU[1]. Plus, the RCU code needs to set need_resched even in cases where it doesn't need to send the IPI. And worst of all, resched_cpu() takes the rq lock which is the deadlock scenario we're trying to avoid. -Scott [1] Which makes me nervous about latency if there are any wakeups with irqs disabled, without a preempt_enable() after irqs are enabled again, and not inside an interrupt.