From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752900AbbBYJp7 (ORCPT ); Wed, 25 Feb 2015 04:45:59 -0500 Received: from mail-wi0-f171.google.com ([209.85.212.171]:63019 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751720AbbBYJp4 (ORCPT ); Wed, 25 Feb 2015 04:45:56 -0500 Date: Wed, 25 Feb 2015 10:45:50 +0100 From: Ingo Molnar To: Andy Lutomirski Cc: Denys Vlasenko , Linus Torvalds , Steven Rostedt , Borislav Petkov , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , X86 ML , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 2/4] x86: get rid of KERNEL_STACK_OFFSET Message-ID: <20150225094550.GB6676@gmail.com> References: <1424803895-4420-1-git-send-email-dvlasenk@redhat.com> <1424803895-4420-2-git-send-email-dvlasenk@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Andy Lutomirski wrote: > - BUG_ON(((current_stack_pointer() ^ this_cpu_read_stable(kernel_stack)) > + BUG_ON(((current_stack_pointer() ^ > + (this_cpu_read_stable(kernel_stack) - 1)) > & ~(THREAD_SIZE - 1)) != 0); > > preempt_count_sub(HARDIRQ_OFFSET); > > I added that in and applied this patch. So this is not just slightly buggy, it's fundamentally wrong as well as it removes the possibility of an RSP value optimization from the 64-bit path, see my previous mail. The right solution would be to make SAVE_ARGS recognize when KERNEL_STACK_OFFSET == args-offset and omit the RSP fixup in that case, or to simply use a __SAVE_ARGS for the 64-bit path, knowing that RSP has the right value already. Please also add comments that explain the relationship between percpu::kernel_stack, KERNEL_STACK_OFFSET and the 64-bit system call entry code. Also, guys, please slow down a bit and be more careful. Andy, could you please send me all currently pending entry bits pending in your tree, because all the in-flight changes make it hard for me to review patches? Please (re-)send all patches as well as part of the submission. Thanks, Ingo