From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753331AbdCPSVM (ORCPT ); Thu, 16 Mar 2017 14:21:12 -0400 Received: from mail-it0-f47.google.com ([209.85.214.47]:36065 "EHLO mail-it0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753194AbdCPSVJ (ORCPT ); Thu, 16 Mar 2017 14:21:09 -0400 MIME-Version: 1.0 In-Reply-To: <20170316140913.653af64d@gandalf.local.home> References: <20170316172008.086705006@goodmis.org> <20170316172056.576095199@goodmis.org> <20170316140913.653af64d@gandalf.local.home> From: Linus Torvalds Date: Thu, 16 Mar 2017 11:19:44 -0700 X-Google-Sender-Auth: 4t1T3KqG8bXdelkg7mnuygBFMac Message-ID: Subject: Re: [PATCH 4/5 v3] ftrace/x86_32: Clean up ftrace_regs_caller To: Steven Rostedt Cc: Linux Kernel Mailing List , Ingo Molnar , Andrew Morton , Thomas Gleixner , Peter Zijlstra , Masami Hiramatsu , "H. Peter Anvin" , Andy Lutomirski , Josh Poimboeuf Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 16, 2017 at 11:09 AM, Steven Rostedt wrote: > + > + /* Since we don't care about cs, move flags there to simplify return */ > + movl 14*4(%esp), %eax > + movl %eax, 13*4(%esp) > + > + /* Move return ip back to its original location */ > + movl 12*4(%esp), %eax > + movl %eax, 14*4(%esp) Could this perhaps be removed entirely? The return code could instead do: ... restore all the normal registers .. # Now restore flags that is under the return address and our fake __KERNEL_CS pushl 8(%esp) popfl # and then return, skipping __KERNEL_CS and %flasg ret $8 which is smaller and simpler than (again) playing games with stack entries. Linus