From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933280AbcHWApX (ORCPT ); Mon, 22 Aug 2016 20:45:23 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:59448 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932706AbcHWApV (ORCPT ); Mon, 22 Aug 2016 20:45:21 -0400 X-IBM-Helo: d03dlp01.boulder.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com Date: Mon, 22 Aug 2016 17:45:26 -0700 From: "Paul E. McKenney" To: Wanpeng Li Cc: "linux-kernel@vger.kernel.org" , Ingo Molnar , Lai Jiangshan , dipankar@in.ibm.com, Andrew Morton , Mathieu Desnoyers , Josh Triplett , Thomas Gleixner , Peter Zijlstra , Steven Rostedt , dhowells@redhat.com, edumazet@google.com, dvhart@linux.intel.com, =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , oleg@redhat.com, bobby.prani@gmail.com Subject: Re: [PATCH tip/core/rcu 3/5] sched: Make wake_up_nohz_cpu() handle CPUs going offline Reply-To: paulmck@linux.vnet.ibm.com References: <20160822152956.GA8160@linux.vnet.ibm.com> <1471879821-8974-3-git-send-email-paulmck@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16082300-0028-0000-0000-0000056D61C6 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00005631; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000183; SDB=6.00748303; UDB=6.00353147; IPR=6.00520968; BA=6.00004672; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00012426; XFM=3.00000011; UTC=2016-08-23 00:45:18 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16082300-0029-0000-0000-00002E965850 Message-Id: <20160823004526.GW3482@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-08-22_14:,, 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-1604210000 definitions=main-1608230006 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 23, 2016 at 06:57:20AM +0800, Wanpeng Li wrote: > 2016-08-22 23:30 GMT+08:00 Paul E. McKenney : > > Both timers and hrtimers are maintained on the outgoing CPU until > > CPU_DEAD time, at which point they are migrated to a surviving CPU. If a > > mod_timer() executes between CPU_DYING and CPU_DEAD time, x86 systems > > will splat in native_smp_send_reschedule() when attempting to wake up > > the just-now-offlined CPU, as shown below from a NO_HZ_FULL kernel: > > > > [ 7976.741556] WARNING: CPU: 0 PID: 661 at /home/paulmck/public_git/linux-rcu/arch/x86/kernel/smp.c:125 native_smp_send_reschedule+0x39/0x40 > > [ 7976.741595] Modules linked in: > > [ 7976.741595] CPU: 0 PID: 661 Comm: rcu_torture_rea Not tainted 4.7.0-rc2+ #1 > > [ 7976.741595] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 > > [ 7976.741595] 0000000000000000 ffff88000002fcc8 ffffffff8138ab2e 0000000000000000 > > [ 7976.741595] 0000000000000000 ffff88000002fd08 ffffffff8105cabc 0000007d1fd0ee18 > > [ 7976.741595] 0000000000000001 ffff88001fd16d40 ffff88001fd0ee00 ffff88001fd0ee00 > > [ 7976.741595] Call Trace: > > [ 7976.741595] [] dump_stack+0x67/0x99 > > [ 7976.741595] [] __warn+0xcc/0xf0 > > [ 7976.741595] [] warn_slowpath_null+0x18/0x20 > > [ 7976.741595] [] native_smp_send_reschedule+0x39/0x40 > > [ 7976.741595] [] wake_up_nohz_cpu+0x82/0x190 > > [ 7976.741595] [] internal_add_timer+0x7a/0x80 > > [ 7976.741595] [] mod_timer+0x187/0x2b0 > > [ 7976.741595] [] rcu_torture_reader+0x33d/0x380 > > [ 7976.741595] [] ? sched_torture_read_unlock+0x30/0x30 > > [ 7976.741595] [] ? rcu_bh_torture_read_lock+0x80/0x80 > > [ 7976.741595] [] kthread+0xdf/0x100 > > [ 7976.741595] [] ret_from_fork+0x1f/0x40 > > [ 7976.741595] [] ? kthread_create_on_node+0x200/0x200 > > > > However, in this case, the wakeup is redundant, because the timer > > migration will reprogram timer hardware as needed. Note that the fact > > that preemption is disabled does not avoid the splat, as the offline > > operation has already passed both the synchronize_sched() and the > > stop_machine() that would be blocked by disabled preemption. > > > > This commit therefore modifies wake_up_nohz_cpu() to avoid attempting > > to wake up offline CPUs. It also adds a comment stating that the > > caller must tolerate lost wakeups when the target CPU is going offline, > > and suggesting the CPU_DEAD notifier as a recovery mechanism. > > Interesting, I have a patch which posted several weeks ago fix another > similar issue, https://lkml.org/lkml/2016/8/4/143 Anyway, if my patch > also fixes your bug? I will see your several weeks and raise you more than a month: http://lkml.kernel.org/g/20160630175845.GA10269@linux.vnet.ibm.com So you try mine and then I will try yours. ;-) Especially given that I am not seeing how the code path in my trace above reaches your change in sched_can_stop_tick()... Thanx, Paul