Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1428749ybl; Fri, 23 Aug 2019 20:12:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEJF+jhOOSMGxQ2//p4S7O2V0wdWAsCcYVlxKEG3LOcYIyPdubAKV+XV3lWCPJKrIKefjn X-Received: by 2002:aa7:85d6:: with SMTP id z22mr8489753pfn.262.1566616358458; Fri, 23 Aug 2019 20:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566616358; cv=none; d=google.com; s=arc-20160816; b=Sh5DgEV4Mhyzp+vfS+MSg6f8+dNKuPJU61b+oExoIALWx/MMAa5bWq7I/XsR9WHSnH +/5kDGXIoV3Z5CvSzDAo0i+cfVjwpqnDLH0wypjDNQcjNQ/XcEgVamZ6YFyods0U2gIE OwIIlIpuuxxmZnK5RsO8hkAbgm14bG8e0fxyhmQECyiNxw5d8ZevlHl4w77WiqrvFhmB lIshsu3AJVxLSmTdYznjk0AT0U+HKWN9AxPwzWdUKIKygq5MHNyWDh0dJh3Reh9aPiHZ jxNRZqHQETZ93Ct42Gv1M03WdxhrJgclNONJbGc3zdnvJOqnW3IYeu7KgYnbU3Tj9tSH O4/w== 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=DVBI8U7MFOnPxjWhHMMwybf2/kLkyMHy0il0nS4Axi0=; b=Q4AvFmiFBk/uLmdTyel13thElF8qnhJhcERR4v4hmJ4pOccqWJ3BR5SqChkND5CO6X 5HSTKZ1SaoMnVhgdwS4O1b5vCvsuh1jLeMhvbte3rejnYwy2Rt/elel1ZXGJe1cGasVr vqZaDU3fik3fQJP3cgUxANEVqNTQHHHAFOR66TrwqIsey9G3gBORoNX0QiEncsyjmRum tR1Ont46m4Ptp/gBD4NuxGwZ5A7S4vtBAksjQ/yyNitckz76L2n4VtY+fLmcmMCDV9so +W3UOkgSFQNLdFJtRu5LuW7trZ2mwZFk4Dz/EG2KphmGxODr34gUyNBoiO3HRkHlIjQe T9ww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=l1NSD7h1; 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 d21si3972907pls.146.2019.08.23.20.12.22; Fri, 23 Aug 2019 20:12:38 -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=pass header.i=@joelfernandes.org header.s=google header.b=l1NSD7h1; 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 S1726999AbfHXDKS (ORCPT + 99 others); Fri, 23 Aug 2019 23:10:18 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33587 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725782AbfHXDKR (ORCPT ); Fri, 23 Aug 2019 23:10:17 -0400 Received: by mail-pg1-f194.google.com with SMTP id n190so6864989pgn.0 for ; Fri, 23 Aug 2019 20:10:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DVBI8U7MFOnPxjWhHMMwybf2/kLkyMHy0il0nS4Axi0=; b=l1NSD7h148KAJcPivD8eUnKxCYAG3N6oF973lbgEtLDfhIil0+SA2FTru/1hxnuhMw g1FdzQifGVVSfO8F6fFdEI69eX4OFfue8lN9f5fNHvyQTiSo/FdBf7519chN2jakBzM4 6vzlRCf/4CazOdKya+viL47qFWrGoaP6tuLCY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DVBI8U7MFOnPxjWhHMMwybf2/kLkyMHy0il0nS4Axi0=; b=fBe1LOUNzVI01oI/l7VWoX778Wg9osYMadNYq2JSCpi5+NFV8b5UtG/KCvDwJM8WXK T9TswNGpBliq011Mi8XIFbOfVxiyLfm6r3nodY86oaAYEt1ZHQIFYpQyYwS0vejzn4Wi S2tQonG6dWP9+sWl0yXQkIB1AlAGipXoJdJHRpCrYOEFlIAbCc9zwm7TeRCyYFQ8Fvf/ /kb4yQMVN68Qd0Vt/L0VUab57K9sufKFSjjn+AAnbGJcZ5ux6yRf2JfHjbKbR9yHuDyt SVXh3MdYi/AMz98YESQBnlGG4NGugob8zvpk6beKudp/JPmvgdOKNxiFcNQVv8Ww+znN qOLw== X-Gm-Message-State: APjAAAX0F3s/XOgJxx73AY0/x5NLk5x7r4dJPVTYIlGM8aLJ/LcDOqKP 4AolZsWoiYz8UlbDYem7hVru7Q== X-Received: by 2002:a62:83c9:: with SMTP id h192mr8587378pfe.57.1566616217208; Fri, 23 Aug 2019 20:10:17 -0700 (PDT) Received: from localhost ([2620:15c:6:12:9c46:e0da:efbf:69cc]) by smtp.gmail.com with ESMTPSA id k64sm3706998pge.65.2019.08.23.20.10.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Aug 2019 20:10:16 -0700 (PDT) Date: Fri, 23 Aug 2019 23:10:14 -0400 From: Joel Fernandes To: Scott Wood Cc: Sebastian Andrzej Siewior , linux-rt-users@vger.kernel.org, linux-kernel@vger.kernel.org, "Paul E . McKenney" , 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: <20190824031014.GB2731@google.com> References: <20190821231906.4224-1-swood@redhat.com> <20190821231906.4224-3-swood@redhat.com> <20190823162024.47t7br6ecfclzgkw@linutronix.de> <433936e4c720e6b81f9b297fefaa592fd8a961ad.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <433936e4c720e6b81f9b297fefaa592fd8a961ad.camel@redhat.com> 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, Aug 23, 2019 at 02:28:46PM -0500, Scott Wood wrote: > On Fri, 2019-08-23 at 18:20 +0200, Sebastian Andrzej Siewior wrote: > > On 2019-08-21 18:19:05 [-0500], Scott Wood wrote: > > > Without this, rcu_note_context_switch() will complain if an RCU read > > > lock is held when migrate_enable() calls stop_one_cpu(). > > > > > > Signed-off-by: Scott Wood > > > --- > > > v2: Added comment. > > > > > > If my migrate disable changes aren't taken, then pin_current_cpu() > > > will also need to use sleeping_lock_inc() because calling > > > __read_rt_lock() bypasses the usual place it's done. > > > > > > include/linux/sched.h | 4 ++-- > > > kernel/rcu/tree_plugin.h | 2 +- > > > kernel/sched/core.c | 8 ++++++++ > > > 3 files changed, 11 insertions(+), 3 deletions(-) > > > > > > --- a/kernel/sched/core.c > > > +++ b/kernel/sched/core.c > > > @@ -7405,7 +7405,15 @@ void migrate_enable(void) > > > unpin_current_cpu(); > > > preempt_lazy_enable(); > > > preempt_enable(); > > > + > > > + /* > > > + * sleeping_lock_inc suppresses a debug check for > > > + * sleeping inside an RCU read side critical section > > > + */ > > > + sleeping_lock_inc(); > > > stop_one_cpu(task_cpu(p), migration_cpu_stop, &arg); > > > + sleeping_lock_dec(); > > > > this looks like an ugly hack. This sleeping_lock_inc() is used where we > > actually hold a sleeping lock and schedule() which is okay. But this > > would mean we hold a RCU lock and schedule() anyway. Is that okay? > > Perhaps the name should be changed, but the concept is the same -- RT- > specific sleeping which should be considered involuntary for the purpose of > debug checks. Voluntary sleeping is not allowed in an RCU critical section > because it will break the critical section on certain flavors of RCU, but > that doesn't apply to the flavor used on RT. Sleeping for a long time in an > RCU critical section would also be a bad thing, but that also doesn't apply > here. I think the name should definitely be changed. At best, it is super confusing to call it "sleeping_lock" for this scenario. In fact here, you are not even blocking on a lock. Maybe "sleeping_allowed" or some such. thanks, - Joel