From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f71.google.com (mail-wm0-f71.google.com [74.125.82.71]) by kanga.kvack.org (Postfix) with ESMTP id B3F1F6B0006 for ; Tue, 6 Mar 2018 07:27:03 -0500 (EST) Received: by mail-wm0-f71.google.com with SMTP id u83so6078747wmb.3 for ; Tue, 06 Mar 2018 04:27:03 -0800 (PST) Received: from theia.8bytes.org (8bytes.org. [2a01:238:4383:600:38bc:a715:4b6d:a889]) by mx.google.com with ESMTPS id n8si3599829edd.444.2018.03.06.04.27.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Mar 2018 04:27:02 -0800 (PST) Date: Tue, 6 Mar 2018 13:27:01 +0100 From: Joerg Roedel Subject: Re: [PATCH 11/34] x86/entry/32: Handle Entry from Kernel-Mode on Entry-Stack Message-ID: <20180306122701.GX16484@8bytes.org> References: <1520245563-8444-1-git-send-email-joro@8bytes.org> <1520245563-8444-12-git-send-email-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Brian Gerst Cc: Thomas Gleixner , Ingo Molnar , "H . Peter Anvin" , the arch/x86 maintainers , Linux Kernel Mailing List , Linux-MM , Linus Torvalds , Andy Lutomirski , Dave Hansen , Josh Poimboeuf , Juergen Gross , Peter Zijlstra , Borislav Petkov , Jiri Kosina , Boris Ostrovsky , David Laight , Denys Vlasenko , Eduardo Valentin , Greg KH , Will Deacon , "Liguori, Anthony" , Daniel Gruss , Hugh Dickins , Kees Cook , Andrea Arcangeli , Waiman Long , Pavel Machek , Joerg Roedel Hi Brian, On Mon, Mar 05, 2018 at 11:41:01AM -0500, Brian Gerst wrote: > We can keep the same process as the existing debug/NMI handlers - > leave the current exception pt_regs on the entry stack and just switch > to the task stack for the call to the handler. Then switch back to > the entry stack and continue. No copying needed. I looked into this and things are a bit more complicated than in the NMI and debug handlers. The current code after pt_regs is set up relies on %esp pointing to the pt_regs structure. But if pt_regs could be on another stack we need to carry the pt_regs pointer in another register through the whole ret_from_exception code-path until we actually switch back the stack. Since the code-path is used for all stack/cr3 entry/exit cases we need to setup the extra pt_regs pointer unconditionally and update all places that reference it through %esp. It can certainly be done but it looks like another major surgery in the entry code to optimize a slow-path for handling unlikely segment-loading exceptions and debug traps. I am not sure if it's worth it. Regards, Joerg -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org