Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753659AbbBXTaJ (ORCPT ); Tue, 24 Feb 2015 14:30:09 -0500 Received: from smtprelay0216.hostedemail.com ([216.40.44.216]:41669 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753508AbbBXTaH (ORCPT ); Tue, 24 Feb 2015 14:30:07 -0500 X-Session-Marker: 6E657665747340676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2553:2559:2562:3138:3139:3140:3141:3142:3352:3622:3653:3865:3866:3867:3868:3870:3872:5007:6261:6742:7558:7808:7875:7903:10004:10400:10848:10967:11026:11232:11473:11658:11914:12295:12438:12517:12519:12740:13069:13311:13357:14040:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: bath66_1de2ecb1bf546 X-Filterd-Recvd-Size: 2321 Date: Tue, 24 Feb 2015 14:30:04 -0500 From: Steven Rostedt To: Denys Vlasenko Cc: Andy Lutomirski , Linus Torvalds , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET Message-ID: <20150224143004.7bbc8cf2@gandalf.local.home> In-Reply-To: <1424803895-4420-2-git-send-email-dvlasenk@redhat.com> References: <1424803895-4420-1-git-send-email-dvlasenk@redhat.com> <1424803895-4420-2-git-send-email-dvlasenk@redhat.com> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1289 Lines: 32 On Tue, 24 Feb 2015 19:51:33 +0100 Denys Vlasenko wrote: > PER_CPU_VAR(kernel_stack) was set up in a way where it points > five stack slots below the top of stack. > > Presumably, it was done to avoid one "sub $5*8,%rsp" > in syscall/sysenter code paths, where iret frame needs to be > created by hand. > > Ironically, none of them benefit from this optimization, > since all of them need to allocate additional data on stack > (struct pt_regs), so they still have to perform subtraction. > And ia32_sysenter_target even needs to *undo* this optimization: > it constructs iret stack with pushes instead of movs, > so it needs to start right at the top. > > This patch eliminates KERNEL_STACK_OFFSET. > PER_CPU_VAR(kernel_stack) now points directly to top of stack. > pt_regs allocations are adjusted to allocate iret frame as well. > I always thought the KERNEL_STACK_OFFSET wasn't an optimization, but a buffer from the real top of stack, in case we had any off by one bugs, it wouldn't crash the system. -- Steve -- 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/