Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1973044ybi; Mon, 1 Jul 2019 03:54:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwPsTNEuIXBYboUz/FmBTYythw25hpZr9ML1XnElnTSEMFfiSMf4TwTzNfk+1WJJ1Dj/Vvv X-Received: by 2002:a17:902:8f87:: with SMTP id z7mr27806917plo.65.1561978474972; Mon, 01 Jul 2019 03:54:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561978474; cv=none; d=google.com; s=arc-20160816; b=MZ4gdJ9jf6Bj1oXt+mJjlPkblwNeCAaCwf90PYZmzbjvLoGwdtT6qoEBK5EfEeFrno aVe08aKVLbN4FP+bT1DijREOXHcw9poMcbYxD01cTCSt2F51kzd6QEBssnSbEO29rA4B x+fHob3c7ig+cVaabuQtRC+I2KRSWbUcLh7oMWbtQY0GCvYWaGRHQ+TkmmrEEZyXMmK3 ruC18iWd9r+Zriavl45qe+RwFFhjKOzpuEWpqlSV+jc8V51hXE6f8AZq/NYl52+qQSab SgBQQ+JptA5t7X/Vn/VpMnpHu01bZrcbCHDvoD0zC8dllVlRPAAEMLBabjYJ9jAXBqm5 kILg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jRQOuot/3DREIfxSXRdJMtvHKLC9IjBUX/bzg6FhxEk=; b=AfoSv+HGHpeVwsAcMouy4StwRKfN8NnGew4KYxiscdKpj3cmJf3i9fLYKSJujk0T5m SWYk+7U42raDDCCPJ0H0igAFtjtjWV8SYAH8rCfb02M6TtW2u0cW89teWUxDpr/BA7ZB 63mmaOV/T9GY/nzF8uFh8vj9CekHtX/sBb8t2kw5VKnxGaJ2tuGUjwn79bhG7ue5T8PV /upRsPbLX1yk+Rrwr+AkCB/qHrhFJbvtR3+B/+lsfLyH4lqCm6hSa2dG0p+82oTmfFu9 zPdQ8yLDSjCW/w2t8HsyWqGf8tS3dZhCeSd6N+D0ZTrI/1Nfde88C4sT+qv0Ax91uhlP dC4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ekic6LOM; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d32si10474519pgm.570.2019.07.01.03.54.19; Mon, 01 Jul 2019 03:54:34 -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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ekic6LOM; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728531AbfGAJqa (ORCPT + 99 others); Mon, 1 Jul 2019 05:46:30 -0400 Received: from merlin.infradead.org ([205.233.59.134]:33798 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726652AbfGAJqa (ORCPT ); Mon, 1 Jul 2019 05:46:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=jRQOuot/3DREIfxSXRdJMtvHKLC9IjBUX/bzg6FhxEk=; b=ekic6LOMRWZa+p+/oLNO3RAQv a4zs6w9e9ZTyO78XG+X7TJggUq9Zv4oDACdUCDz6usc1jr2S1/SuX31Jyx5cSiH4V3us92GV6qMLT 0GXYn8S9dxxY+2j/iHCx719O7w8Ht4IeJBtWtReNykiN2dMJCVFf/1gbiDyZaVqcJdiX9Xn3CGK4V 5AFRxTaZ6ORkIX19AJ3BR+M0ugmolyeERJ0WTPHR3dJKNjBAZqQeBzI+tHs+LYhPj1Oc1+n7l7LgE rR7QomvUzds+wnTAphG8WKvJEQ7ZkqMfHXGaqbSIXhi+tL6ob0D9roPWMZn+Zue6odRoRpTF54DGe U6Lj/N7Bw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hhssp-0005NY-H6; Mon, 01 Jul 2019 09:45:59 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 396C920963E23; Mon, 1 Jul 2019 11:45:58 +0200 (CEST) Date: Mon, 1 Jul 2019 11:45:58 +0200 From: Peter Zijlstra To: Scott Wood Cc: "Paul E. McKenney" , Joel Fernandes , Steven Rostedt , Sebastian Andrzej Siewior , rcu , LKML , Thomas Gleixner , Ingo Molnar , Josh Triplett , Mathieu Desnoyers , Lai Jiangshan Subject: Re: [RFC] Deadlock via recursive wakeup via RCU with threadirqs Message-ID: <20190701094558.GS3402@hirez.programming.kicks-ass.net> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 28, 2019 at 03:01:36PM -0500, Scott Wood wrote: > 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]. Correct, smp_send_reschedule() might not work for self, not all hardware can self-IPI. > 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. All good points; and those are all solved with irq_work. That provides a 'clean' IRQ context.