Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp354720imu; Thu, 8 Nov 2018 03:07:35 -0800 (PST) X-Google-Smtp-Source: AJdET5ejBaF3frLEyS2E/l3UR9AwSqBdZynfQqh8aZWGlmZ0FDfyWmlFIqufR48jCLYzIuIyWLYE X-Received: by 2002:a17:902:30f:: with SMTP id 15-v6mr4121300pld.155.1541675255200; Thu, 08 Nov 2018 03:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541675255; cv=none; d=google.com; s=arc-20160816; b=HI4v45BF4FiYVZG+CkZxxHVQQBAF3GCHFz5PuRVOGiP12TRYxEvYWl90aJIz+naYjB 65UTBF37/fs2X3ue3mZFM+kbhG/ZMsL23pyVamv9tkiWhQfbQAUGaXdi+F86W8rLAjXs AMgbTScTvtS666M3sk4+NxwgKNLcwMhTB800jQectFTA/PALeLrpKIjXrdFSt3vVy7o1 QjWEIhEupaLEe8Uq4gF1hSVih9yfGX/H0OjL3gvSAiTribjQS3rRXN2UXinNb1RmQmh6 R5WvTQPVDhcOPJ0CyTlkZ9sJV12h31j/08daAfAszB3KFCct9xscGI+arOhD96erLXwt TEsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=VzX5Ck/FYxZrA5648+/MQI2Rsj/kE2LDDnXvutazdW4=; b=fn7kG4jmXKCGyd8KF8Sx6T3SDLnjYxpx8+vzTHxmeqbTMPZWW8ScCDrAAXu0e//X4c bwlvn2rTLzTTpOFG1nhDv5UVm8/wKr0mSm41AJBujpe49dOAdFxnnV9/3F8PqcW6r/Ym bJYFkxuUlwBnwvzq1ZW5Js6idEzTuJKekaDrvpqPJ3sXpnPPZcvzGW+HRCJTEUc7lhT+ AcTfXlCQ55hgsbcXT01ea65b1M6O80nO3NowrssI3TFz1hhX+bxz6OQ2WNvld/ykm7j9 VZLJHXRsILujqwTLVQShyaqpKA9L7FPiXn0+hNT0VZoeN8ZiUgokYTFMAhj6zQT6YXvE Hjew== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kRvyO25j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c27-v6si3549012pgc.461.2018.11.08.03.07.20; Thu, 08 Nov 2018 03:07:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=kRvyO25j; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726995AbeKHUlm (ORCPT + 99 others); Thu, 8 Nov 2018 15:41:42 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:55978 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbeKHUlm (ORCPT ); Thu, 8 Nov 2018 15:41:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=VzX5Ck/FYxZrA5648+/MQI2Rsj/kE2LDDnXvutazdW4=; b=kRvyO25j7dP9F2OiKbgPJA0D2 fx5iy9HQ2qpkbYJ7ZbrFH7CL5JQ7SF2EgogXzZ8A130yhGAB42cszbdhnGH7Ig/8WyFZFT8wIe5AG 6yVT1StFNEeSymM6A/tcnqqMrbaZOr7Q29vXALv88dLEEAFIps3Y/+52pHKVaIU5B081g0jvmf4eQ P6I/vtlFJR2K9wva348T9GZLvncEPcMiH0IriKhE0fkdfAp3Nkksk21jKTwUag2k+QV1YngFZ7WuX h61HmRJcBOHo8HLq7vJYEBK8Pk3WxeKbGrVIJYFqnR8I9Ri/a9iDFIIPzbdadMt6nMpNkI1SAfTij WtlYTFrzQ==; 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 1gKhkt-00078r-KQ; Thu, 08 Nov 2018 10:41:43 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A3FAD2029F883; Thu, 8 Nov 2018 11:41:41 +0100 (CET) Date: Thu, 8 Nov 2018 11:41:41 +0100 From: Peter Zijlstra To: Nadav Amit Cc: Ingo Molnar , LKML , X86 ML , "H. Peter Anvin" , Thomas Gleixner , Borislav Petkov , Dave Hansen , Andy Lutomirski , Kees Cook , Dave Hansen , Masami Hiramatsu Subject: Re: [PATCH v3 2/7] x86/jump_label: Use text_poke_early() during early_init Message-ID: <20181108104141.GR9761@hirez.programming.kicks-ass.net> References: <20181102232946.98461-1-namit@vmware.com> <20181102232946.98461-3-namit@vmware.com> <20181105140925.GD22467@hirez.programming.kicks-ass.net> <9A69025F-5B49-4A26-AB95-F6D36908983B@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9A69025F-5B49-4A26-AB95-F6D36908983B@vmware.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 07, 2018 at 07:13:03PM +0000, Nadav Amit wrote: > > diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c > > index aac0c1f7e354..ed5fe274a7d8 100644 > > --- a/arch/x86/kernel/jump_label.c > > +++ b/arch/x86/kernel/jump_label.c > > @@ -52,7 +52,12 @@ static void __ref __jump_label_transform(struct jump_entry *entry, > > jmp.offset = jump_entry_target(entry) - > > (jump_entry_code(entry) + JUMP_LABEL_NOP_SIZE); > > > > - if (early_boot_irqs_disabled) > > + /* > > + * As long as we're UP and not yet marked RO, we can use > > + * text_poke_early; SYSTEM_BOOTING guarantees both, as we switch to > > + * SYSTEM_SCHEDULING before going either. > > + */ > > + if (system_state == SYSTEM_BOOTING) > > poker = text_poke_early; > > > > if (type == JUMP_LABEL_JMP) { > > Thanks for this change, I will incorporate it. > > I wanted to point a small difference from my version. Although this version > ensures we are UP and the kernel is still RW, preemption is possible with > this version. I presume that it should not affect jump-labels, since it > switches between JMP and multi-byte NOPs. Right, we're never running the code we're going to change on UP.