From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033674AbdEWUor (ORCPT ); Tue, 23 May 2017 16:44:47 -0400 Received: from smtprelay0042.hostedemail.com ([216.40.44.42]:33588 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1161342AbdEWUjA (ORCPT ); Tue, 23 May 2017 16:39:00 -0400 X-Session-Marker: 726F737465647440676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2904:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3868:3870:3871:3872:3873:3874:4250:5007:6261:7875:7903:8660:8957:9010:10004:10400:10848:10967:11232:11658:11914:12296:12740:12760:12895:13069:13137:13148:13150:13230:13231:13311:13357:13439:13618:14039:14096:14097:14181:14659:14721:21080:21324:21433:21627:30012:30045:30051:30054:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: look29_886a9a4f66501 X-Filterd-Recvd-Size: 3205 Date: Tue, 23 May 2017 16:38:53 -0400 From: Steven Rostedt To: "Paul E. McKenney" Cc: Ingo Molnar , linux-kernel@vger.kernel.org, Peter Zijlstra , Thomas Gleixner Subject: Re: Use case for TASKS_RCU Message-ID: <20170523163853.70773f4a@vmware.local.home> In-Reply-To: <20170523200035.GW3956@linux.vnet.ibm.com> References: <20170515182354.GA25440@linux.vnet.ibm.com> <20170516062233.tyz7ze7ilmbkxtjc@gmail.com> <20170516122354.GB3956@linux.vnet.ibm.com> <20170519062331.52dhungzvcsdxdgo@gmail.com> <20170519133550.GD3956@linux.vnet.ibm.com> <20170519100421.27298063@gandalf.local.home> <20170519102331.0d5a8536@gandalf.local.home> <20170519190609.GE3956@linux.vnet.ibm.com> <20170523000036.GA13506@linux.vnet.ibm.com> <20170523153939.7122e892@vmware.local.home> <20170523200035.GW3956@linux.vnet.ibm.com> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 23 May 2017 13:00:35 -0700 "Paul E. McKenney" wrote: > > > Unfortunately, it does not work, as I should have known ahead of > > > time from the dyntick-idle experience. Not all context switches > > > go through context_switch(). :-/ > > > > Wait. What context switch doesn't go through a context switch? Or do > > you mean a user/kernel context switch? > > I mean that putting printk() before and after the call to > context_switch() can show tasks switching out twice without switching > in and vice versa. No sign of lost printk()s, and I also confirmed > this behavior using a flag in task_struct. I hope you meant trace_printk()s' as printk is a huge overhead and can cause side effects. > > One way that this can happen on some architectures is via the "helper" > mechanism, where the task sleeps normally, but where a later interrupt > or exception takes on its context "behind the scenes" in the arch > code. This is what messed up my attempt to use a simple > interrupt-nesting counter for RCU dynticks some years back. What I > counted on there was that the idle loop would never do that sort of > thing, so I could zero the count when entering idle from process > context. > > But I have not yet found a similar trick for counting voluntary > context switches. > > I also tried making context_switch() look like a momentary quiescent > state, but of course that means that tasks that block forever also > block the grace period forever. At which point, I need to scan the > task list to find them. And that pretty much brings me back to the > current RCU-tasks implementation. :-/ > Nothing should block in a preempted state forever, and if it does, that means we want to wait forever. Because it could be preempted on the trampoline. -- Steve