Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753507AbcK0Tpn (ORCPT ); Sun, 27 Nov 2016 14:45:43 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:34412 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753096AbcK0Tpf (ORCPT ); Sun, 27 Nov 2016 14:45:35 -0500 Date: Mon, 28 Nov 2016 01:45:25 +0600 From: Alexnader Kuleshov To: Andy Lutomirski Cc: Alexnader Kuleshov , open list , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Paul Gortmaker , Jan Beulich , Tony Luck , Jianyu Zhan Subject: Re: Question: goal of twice disabling of preemption in exception handlers Message-ID: <20161127194525.GA4087@localhost.localdomain> References: <20161120175207.GA4354@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux X-Date: Sun Nov 27 22:56:55 +06 2016 User-Agent: Mutt/1.6.0-rc0 ((null)) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1011 Lines: 21 On 11-27-16, Andy Lutomirski wrote: > On Sun, Nov 20, 2016 at 9:52 AM, Alexnader Kuleshov > wrote: > > Hello everyone, > > > > Exception handlers which may run on IST stack disable and enable preemption > > twice. For example do_int3() [1]. This one calls ist_enter() which > > disables preemption with preempt_disable() every time without any conditions. > > And later do_int3() calls preempt_disable() again [2] before do_trap(). > > > > Of course we decrement preemption counter in the end of such exception > > handlers twice too. But what's actual purpose of doing this two times? > > > > [1] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/x86/kernel/traps.c?id=refs/tags/next-20161117#n530 > > [2] https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git/tree/arch/x86/kernel/traps.c?id=refs/tags/next-20161117#n566 > > > > Thank you. > > You could submit a patch to get rid of the extra one if you like. Thanks for reply. Will send a patch.