Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934116AbcLAMdY (ORCPT ); Thu, 1 Dec 2016 07:33:24 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49814 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934089AbcLAMdV (ORCPT ); Thu, 1 Dec 2016 07:33:21 -0500 Date: Thu, 1 Dec 2016 04:33:16 -0800 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Josh Poimboeuf , Petr Mladek , Vince Weaver , "linux-kernel@vger.kernel.org" , Ingo Molnar , Arnaldo Carvalho de Melo , "dvyukov@google.com" Subject: Re: perf: fuzzer BUG: KASAN: stack-out-of-bounds in __unwind_start Reply-To: paulmck@linux.vnet.ibm.com References: <20161129124323.GJ3092@twins.programming.kicks-ass.net> <20161129151004.GU3924@linux.vnet.ibm.com> <20161129162920.GF21230@pathway.suse.cz> <20161129171038.GN3092@twins.programming.kicks-ass.net> <20161129193935.GE3924@linux.vnet.ibm.com> <20161129195204.GG3045@worktop.programming.kicks-ass.net> <20161129200711.GF3924@linux.vnet.ibm.com> <20161129203259.GA28037@linux.vnet.ibm.com> <20161130191303.prvrgkvijqzydexg@treble> <20161201055235.GG3092@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161201055235.GG3092@twins.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16120112-0016-0000-0000-0000054FADAC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006173; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000193; SDB=6.00787824; UDB=6.00381133; IPR=6.00565500; BA=6.00004935; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013502; XFM=3.00000011; UTC=2016-12-01 12:33:17 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16120112-0017-0000-0000-0000351D1DFD Message-Id: <20161201123316.GZ3924@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-12-01_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1612010219 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1377 Lines: 33 On Thu, Dec 01, 2016 at 06:52:35AM +0100, Peter Zijlstra wrote: > On Wed, Nov 30, 2016 at 01:13:03PM -0600, Josh Poimboeuf wrote: > > This question was probably intended for other folks, but I should point > > out that idle tasks *do* invoke the scheduler. cpu_idle_loop() calls > > schedule_preempt_disabled(). > > Right, but that doesn't matter I think. The below will simply not call > rcu_note_voluntary_context_switch() from the idle task, which would be > fine I think. > > > > So is the following a sensible approach, or should I look elsewhere? > > > > > > #define cond_resched_rcu_qs() \ > > > do { \ > > > if (!is_idle_task(current) && !cond_resched()) \ > > > rcu_note_voluntary_context_switch(current); \ > > You should reverse your conditions though: > > if (!cond_resched() && !is_idle_task(current)) > rcu_note_voluntary_context_switch(current); > > That way we'll still do cond_resched() and you only gate the RCU call. This makes it illegal at early boot. This is not a problem with the surviving cond_resched_rcu_qs(), but one of the candidates really was called at boot time. If I reverse the order as you say, I can just as well leave of the "!is_idle_task(current)". So I will just drop this patch until such time as someone actually needs to add a cond_resched_rcu_qs() that sometimes gets invoked at boot time. Thanx, Paul