From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933461AbcI1WpD (ORCPT ); Wed, 28 Sep 2016 18:45:03 -0400 Received: from smtprelay4.synopsys.com ([198.182.47.9]:60134 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932651AbcI1Woz (ORCPT ); Wed, 28 Sep 2016 18:44:55 -0400 Subject: Re: NMI for ARC To: Andy Lutomirski , Peter Zijlstra References: <20151117110749.GT3816@twins.programming.kicks-ass.net> <564B0E18.3040207@synopsys.com> <20151117122401.GY3816@twins.programming.kicks-ass.net> <20151117122540.GL11639@twins.programming.kicks-ass.net> <564B2341.4030409@synopsys.com> <20151117131538.GZ3816@twins.programming.kicks-ass.net> <3b23d64c-2579-b72e-645a-e7ece3c1a3c6@synopsys.com> <20160928071642.GU2794@worktop> <20160928203748.GU5012@twins.programming.kicks-ass.net> CC: Alexey Brodkin , arcml , lkml Newsgroups: gmane.linux.kernel,gmane.linux.kernel.arc From: Vineet Gupta Message-ID: <671e1614-8847-8a5f-676d-b312e4abd097@synopsys.com> Date: Wed, 28 Sep 2016 15:44:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.9.131.247] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/28/2016 03:26 PM, Andy Lutomirski wrote: >>>>> 2. The low level return code, resume_user_mode_begin and/or resume_kernel_mode >>>>> > > >> require interrupt safety, does that need to be NMI safe as well. We ofcourse want >>>>> > > >> the very late register restore parts to be non-interruptible, but is this required >>>>> > > >> before we call prrempt_schedule_irq() off of asm code. >>>> > > > >>>> > > > Urgh, I'm never quite sure on the details here, I've Cc'ed Andy who >>>> > > > might actually know this off the top of his head. I'll try and dig >>>> > > > through x86 to see what it does. >>> > > >>> > > On x86, it's quite simple. IRQs are *always* off during the final >>> > > register restore, and we don't re-check for preemption there. x86 >>> > > handles preemption after turning off IRQs, and IRQs are guaranteed to >>> > > stay off until we actually return to userspace. >>> > > >>> > > The code is almost entirely in C in arch/x86/entry/common.c. There >>> > > isn't anything particularly x86-speficic in there. >> > >> > Right, so what I think Vineet is asking is if we need to disable NMIs as >> > well, we cannot on x86 disable NMIs so no. >> > > The same argument works here, too: an NMI won't set TIF_NEED_RESCHED > without sending an IPI, so we can't miss a wakeup. The case I saw was different: timer intr (normal prio) comes in - scheduler_tick() sets TIF_NEED_RESCHED and before this intr return, it gets interrupted by perf intr (higher prio) and we decide not to follow through on preemption because a nested intr can't return to userspace anyways.