Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 17 Dec 2002 23:40:29 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 17 Dec 2002 23:40:29 -0500 Received: from neon-gw-l3.transmeta.com ([63.209.4.196]:44304 "EHLO neon-gw.transmeta.com") by vger.kernel.org with ESMTP id ; Tue, 17 Dec 2002 23:40:28 -0500 Date: Tue, 17 Dec 2002 20:49:17 -0800 (PST) From: Linus Torvalds To: "H. Peter Anvin" cc: Ulrich Drepper , Matti Aarnio , Hugh Dickins , Dave Jones , Ingo Molnar , Subject: Re: Intel P6 vs P7 system call performance In-Reply-To: <3DFFFBF1.7000507@transmeta.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1535 Lines: 36 On Tue, 17 Dec 2002, H. Peter Anvin wrote: > > This confuses me -- there seems to be no reason this shouldn't work as > long as %esp == %ebp on sysexit. The SYSEXIT-trashed GPRs seem like a > bigger problem. The thing is, the argument save area == the kernel stack frame. This is part of the reason why Linux has very fast system calls - there is absolutely _zero_ extraneous setup. No argument fetching and marshalling, it's all part of just setting up the regular kernel stack. So to get the right argument in arg6, the argument _needs_ to be saved in the %ebp entry on the kernel stack. Which means that on return from the system call (which may not actually be through a "sysenter" at all, if signals happen it will go through the generic paths), %ebp will have been updated as part of the kernel stack unwinding. Which is ok for a regular fast system call (ebp will get restored immediately), but it is NOT ok for the system call restart case, since in that case we want %ebp to contain the old stack pointer, not the sixth argument. If we just save the stack pointer value (== the initial %ebx value), the right thing will get restored, but then system calls will see the stack pointer value as arg6 - because of the 1:1 relationship between arguments and stack save. Linus - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/