Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp820337ybl; Wed, 28 Aug 2019 05:56:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSS+NKSW3/xnzAQ3HU9FQp4jqRubKYeGBkm40VaHpEHKO7OWD2SM/2a2PlS5nICQ2uO/A7 X-Received: by 2002:a17:90a:17ab:: with SMTP id q40mr4209138pja.106.1566996968059; Wed, 28 Aug 2019 05:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566996968; cv=none; d=google.com; s=arc-20160816; b=NlTvABM9jN2+Sis0hFfoWnaAPfJZlyZZk+Gpty/1KGPmIs0OJJ+eZIvjljMuEN1PSW 4ZIQG3eiAKBbFNh0e7ubLbO3IIz8PjOvlfEUlbPQaLgfzdyUKvtIYJU5sUSF3KY60Trc BBsNY4Y1oV4gBsabVUGwiDBuO9kMP01IrQlYi3pfus1g0eoTDOHr0bCe1I8HSvaSh6bM rF+pd+yD71J+YK2wXAZmtzubZBl6jwOU6IlKK+OimObxGFBQZtLhd/Ac63A+we+v8DpM xrlCSaXbIRfSg6rQByguxjNuE6/hkH2cYmcmnZr+2h4zVJsrFW0gDL5d8u+C4pRtEQ7p 5sew== 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:reply-to:message-id :subject:cc:to:from:date; bh=CUDHyyxTeMKS99Q3sHfYSjM9ainadpWPJJdb6F2TUSs=; b=pVx90sdALDYB/XCWutXadQyUoSmAYnTUXkjtn+OVq4htpEH6t11iLxpGXFHcUC8Omk ubc8L3aY8NnynoHqg+tqvYrvi3XpwoAcy72DylEX0QBJA3Dp1M1iv9CQSfWuJOAs9TMy JRKxbjUrGQ7Ibxxp5v7B2x/CVKZG+7d66OE5RsM8cB96Mx4CMDnqLahkQqkDNKUdQRjV 5SDNsPgGAXCPoDfpWXpVuEB7NfXjQs5Q0WhWc6p3poiebnx2QqzjfaqWIqMhTuIzauCL qU0R4PYjsZOfYFLbc6TncaDGij/UEzRV7ARuvukSgYAgw0ZlI/08KPUhI0j/pPTvYMTO zokg== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 200si2527775pfu.152.2019.08.28.05.55.51; Wed, 28 Aug 2019 05:56:08 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726428AbfH1Myk (ORCPT + 99 others); Wed, 28 Aug 2019 08:54:40 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59970 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726368AbfH1Myk (ORCPT ); Wed, 28 Aug 2019 08:54:40 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x7SCqvWG084245; Wed, 28 Aug 2019 08:54:29 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 2unqr3wq1q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Aug 2019 08:54:29 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.27/8.16.0.27) with SMTP id x7SCrx01087890; Wed, 28 Aug 2019 08:54:28 -0400 Received: from ppma02dal.us.ibm.com (a.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.10]) by mx0b-001b2d01.pphosted.com with ESMTP id 2unqr3wq0h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Aug 2019 08:54:28 -0400 Received: from pps.filterd (ppma02dal.us.ibm.com [127.0.0.1]) by ppma02dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x7SCnmOH004111; Wed, 28 Aug 2019 12:54:27 GMT Received: from b01cxnp22036.gho.pok.ibm.com (b01cxnp22036.gho.pok.ibm.com [9.57.198.26]) by ppma02dal.us.ibm.com with ESMTP id 2un65jybhe-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 28 Aug 2019 12:54:27 +0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x7SCsQRp15270712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 28 Aug 2019 12:54:26 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E57CB2064; Wed, 28 Aug 2019 12:54:26 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C909B205F; Wed, 28 Aug 2019 12:54:26 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.80.209.133]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 28 Aug 2019 12:54:26 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id D011416C15A4; Wed, 28 Aug 2019 05:54:26 -0700 (PDT) Date: Wed, 28 Aug 2019 05:54:26 -0700 From: "Paul E. McKenney" To: Sebastian Andrzej Siewior Cc: Joel Fernandes , Scott Wood , linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Peter Zijlstra , Juri Lelli , Clark Williams Subject: Re: [PATCH RT v2 2/3] sched: migrate_enable: Use sleeping_lock to indicate involuntary sleep Message-ID: <20190828125426.GO26530@linux.ibm.com> Reply-To: paulmck@kernel.org References: <20190821231906.4224-1-swood@redhat.com> <20190821231906.4224-3-swood@redhat.com> <20190823162024.47t7br6ecfclzgkw@linutronix.de> <433936e4c720e6b81f9b297fefaa592fd8a961ad.camel@redhat.com> <20190824031014.GB2731@google.com> <20190826152523.dcjbsgyyir4zjdol@linutronix.de> <20190826162945.GE28441@linux.ibm.com> <20190827092333.jp3darw7teyyw67g@linutronix.de> <20190827155306.GF26530@linux.ibm.com> <20190828092739.46mrffvzjv6v3de5@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190828092739.46mrffvzjv6v3de5@linutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-08-28_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1908280138 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 28, 2019 at 11:27:39AM +0200, Sebastian Andrzej Siewior wrote: > On 2019-08-27 08:53:06 [-0700], Paul E. McKenney wrote: > > > > On the other hand, within a PREEMPT=n kernel, the call to schedule() > > > > would split even an rcu_read_lock() critical section. Which is why I > > > > asked earlier if sleeping_lock_inc() and sleeping_lock_dec() are no-ops > > > > in !PREEMPT_RT_BASE kernels. We would after all want the usual lockdep > > > > complaints in that case. > > > > > > sleeping_lock_inc() +dec() is only RT specific. It is part of RT's > > > spin_lock() implementation and used by RCU (rcu_note_context_switch()) > > > to not complain if invoked within a critical section. > > > > Then this is being called when we have something like this, correct? > > > > DEFINE_SPINLOCK(mylock); // As opposed to DEFINE_RAW_SPINLOCK(). > > > > ... > > > > rcu_read_lock(); > > do_something(); > > spin_lock(&mylock); // Can block in -rt, thus needs sleeping_lock_inc() > > ... > > rcu_read_unlock(); > > > > Without sleeping_lock_inc(), lockdep would complain about a voluntary > > schedule within an RCU read-side critical section. But in -rt, voluntary > > schedules due to sleeping on a "spinlock" are OK. > > > > Am I understanding this correctly? > > Everything perfect except that it is not lockdep complaining but the > WARN_ON_ONCE() in rcu_note_context_switch(). This one, right? WARN_ON_ONCE(!preempt && t->rcu_read_lock_nesting > 0); Another approach would be to change that WARN_ON_ONCE(). This fix might be too extreme, as it would suppress other issues: WARN_ON_ONCE(IS_ENABLED(CONFIG_PREEMPT_RT_BASE) && !preempt && t->rcu_read_lock_nesting > 0); But maybe what is happening under the covers is that preempt is being set when sleeping on a spinlock. Is that the case? Thanx, Paul