From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753955AbcI1SAt (ORCPT ); Wed, 28 Sep 2016 14:00:49 -0400 Received: from smtprelay4.synopsys.com ([198.182.47.9]:55158 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753866AbcI1SAg (ORCPT ); Wed, 28 Sep 2016 14:00:36 -0400 Subject: Re: NMI for ARC To: Peter Zijlstra References: <1445286926.3913.13.camel@synopsys.com> <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> CC: arcml , Alexey Brodkin , lkml , "Andy Lutomirski" Newsgroups: gmane.linux.kernel.arc,gmane.linux.kernel From: Vineet Gupta Message-ID: <3b5cbc7c-ed5c-af95-8dc9-25fd92277e98@synopsys.com> Date: Wed, 28 Sep 2016 10:58:06 -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: <20160928071642.GU2794@worktop> Content-Type: text/plain; charset="windows-1252" 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 12:16 AM, Peter Zijlstra wrote: >> 1. Is it OK in general to short-circuit preemption off irq checks for NMI style >> > interrupts. > Yes. If the NMI returns to kernel space you must not attempt preemption > for reasons you found :-), if the NMI returns to userspace you should do > the normal return to user bits, I think. Just to add, eliding preemption check in return path might not be sufficient as we could still have timer intr leading to scheduler_tick() - whcih is what i found as well ;-) So scheduler nevertheless needs to be told to not reschedule in this code path. So eliding preempt-off-irq just becomes an optimization for NMI code paths IMHO. Now I was a stupid fool, fudging preemption counts in low level code, to achieve this, whereas we have nice generic nmi_{enter,exit}() and in_nmi() helpers which can be used. Thx, -Vineet