From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1176CC43381 for ; Thu, 14 Feb 2019 19:35:14 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CD8BF21B1C for ; Thu, 14 Feb 2019 19:35:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AzDT5nJr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CD8BF21B1C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+Sj0TBPhuTU+oOvl3gT+kpbDU10eSrB/oyz4/h2Wqe4=; b=AzDT5nJraf0YgG Q6E7lThb18WQ7QDoY2Ca7Nzdo1v55sW1fkDK4hrxy7Qm3cG5ejhKJ987dzvzaSuRS8ySUqdhy8CqA YaPZB5rih2NeLSUqezlmNns/aVvzd1reXXIPTdTwLsWPwVosZN4mXRHI9ucIaLFUVD6U/ELYdZvYl JkRT1n14kT8+KFAUXJ8ihnE6dP91i0qOFAEykWtQcDBLB8t2d3XTkQYO5hdtLF9cbyI7fE2C8KSF1 7Ki86FqmfPRObmPciNeVlttVr4TIu41uyh8xxEWAxGKCbTTLXfGmeeiNJ6X2Rw+TdfaAalOkjwZ2k X/1tws9KEA1qlJoN5+uA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMms-0000Hv-KM; Thu, 14 Feb 2019 19:35:10 +0000 Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1guMmH-0007cB-QL; Thu, 14 Feb 2019 19:34:33 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 45F2E20297D44; Thu, 14 Feb 2019 20:34:32 +0100 (CET) Date: Thu, 14 Feb 2019 20:34:32 +0100 From: Peter Zijlstra To: Brian Gerst Subject: Re: [PATCH] sched/x86: Save [ER]FLAGS on context switch Message-ID: <20190214193432.GR32477@hirez.programming.kicks-ass.net> References: <20190213140025.GB6346@brain-police> <20190213142524.GW32494@hirez.programming.kicks-ass.net> <20190213144145.GY32494@hirez.programming.kicks-ass.net> <20190213154532.GQ32534@hirez.programming.kicks-ass.net> <20190213222146.GC32494@hirez.programming.kicks-ass.net> <20190214101429.GD32494@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Denys Vlasenko , Josh Poimboeuf , Julien Thierry , Catalin Marinas , valentin.schneider@arm.com, Will Deacon , Linux Kernel Mailing List , Andy Lutomirski , Ingo Molnar , James Morse , Andy Lutomirski , "H. Peter Anvin" , Borislav Petkov , Thomas Gleixner , Linus Torvalds , Ingo Molnar , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Feb 14, 2019 at 11:18:01AM -0500, Brian Gerst wrote: > > --- a/arch/x86/include/asm/switch_to.h > > +++ b/arch/x86/include/asm/switch_to.h > > @@ -40,6 +40,7 @@ asmlinkage void ret_from_fork(void); > > * order of the fields must match the code in __switch_to_asm(). > > */ > > struct inactive_task_frame { > > + unsigned long flags; > > #ifdef CONFIG_X86_64 > > unsigned long r15; > > unsigned long r14; > > flags should be initialized in copy_thread_tls(). I think the new > stack is zeroed already, but it would be better to explicitly set it. Ah indeed. I somehow misread that code and thought we got initialized with a copy of current. Something like the below, right? --- --- a/arch/x86/kernel/process_32.c +++ b/arch/x86/kernel/process_32.c @@ -127,6 +127,7 @@ int copy_thread_tls(unsigned long clone_ struct task_struct *tsk; int err; + frame->flags = 0; frame->bp = 0; frame->ret_addr = (unsigned long) ret_from_fork; p->thread.sp = (unsigned long) fork_frame; --- a/arch/x86/kernel/process_64.c +++ b/arch/x86/kernel/process_64.c @@ -392,6 +392,7 @@ int copy_thread_tls(unsigned long clone_ childregs = task_pt_regs(p); fork_frame = container_of(childregs, struct fork_frame, regs); frame = &fork_frame->frame; + frame->flags = 0; frame->bp = 0; frame->ret_addr = (unsigned long) ret_from_fork; p->thread.sp = (unsigned long) fork_frame; _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel