From patchwork Sat Dec 17 18:55:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 34258 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp1640125wrn; Sat, 17 Dec 2022 11:09:17 -0800 (PST) X-Google-Smtp-Source: AA0mqf6VTKQmj6M+L+7PcfEuoIi5RsgllZDsMi+N0P7HjIo/YlurbHck2qscp5gyX9YeDU2FcSVG X-Received: by 2002:a05:6a21:158a:b0:9d:efbe:a116 with SMTP id nr10-20020a056a21158a00b0009defbea116mr18750562pzb.38.1671304156984; Sat, 17 Dec 2022 11:09:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671304156; cv=none; d=google.com; s=arc-20160816; b=kJ3ktj+Fz70VnIOZqhAbb9X/0S/qvXOI0j5gdsnntCSIehqSMCCwteSuPYeCc591hu AeLkuCFC4N08RqJoEyzHjrp8eRs0cIr3Uh3PeAOKhD1TFPSEA8P7d3Xhpq6K70DURkag mQBMzXra+dkvvfrlFmuG9n8IB4sBeRzqUxRdiHm6XAFAqtQK7pthyNupsACJ3QL44/Ex mDYi8Z2FqwyTAmEI6pddLOKM4B2Zeb8yKaMoDZNUK8lEFmUNE6PUBWBmOx+p2wqkXBXZ 4mdiC3lQSkQ2gwjQl3EeKVY3+MsqyU10Efzxo43ZCq2ApuD/gOjoq4rq66zwr3VV9u7G f8Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=6AwGJM7EnQb/mbTiit2gzsS6CqaERs5CQtZQmK0M83c=; b=n+KFrBqBIlXQzXfFxsZiXRMReuJuqD8u0TWLFA/9ARLC4ruKvFgrf8FUjTW6H5JilO iI5egWhmHsve4T/gUuglRpZOc0i1Zp3soSOlWLk5np82MoYFvAg975LxgS3wPsKkBxIC D3RQaX3MuV+oZMQtLwDQoHVJgqi7f4IUcxftDOoYu/hfh1d/CXLtlB5cgTBFvWgiD0+S /Fg6rvTgyYwS4soWQOgfe7EtBBHH392Cc1UtVY/VFXyUwsM7ixu7oJNpRIlgHJ7Hnm81 braeDUEyvk2xsLo5JVdykt8fePcFo6mrOgIfWceebnQyOAubd9b5xa2LRFqD5WoGbAB3 WeBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Z+XUkZzB; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a17090acc0a00b002196afcdfc8si11349698pju.96.2022.12.17.11.09.04; Sat, 17 Dec 2022 11:09:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Z+XUkZzB; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230350AbiLQS56 (ORCPT + 99 others); Sat, 17 Dec 2022 13:57:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230102AbiLQSzl (ORCPT ); Sat, 17 Dec 2022 13:55:41 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABB18F26; Sat, 17 Dec 2022 10:55:39 -0800 (PST) Date: Sat, 17 Dec 2022 18:55:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1671303335; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6AwGJM7EnQb/mbTiit2gzsS6CqaERs5CQtZQmK0M83c=; b=Z+XUkZzByJsRGZ7RSU0WHpLK77dbS3Qmt5Rfu2bwPayDEUj1IuadoVMVql5ybMtoT9cCo5 Lecx66eum0nAZlyzu1KbpzUQSymAZ4oPla0Pjt447gn281xrAwxDhL02fivT3HEAn7czUh N+TU676j5AyKgHPvlgREIg2jXoFxxVTfq9MsWVFYWFM0GPDNTIuy286lqm/SArF8EPTe2M ZK7SBKAOvvRfHggCHlhJBZkukJnM7YQQEp+BxucNSGeWdkG4njOOSMGS0jjmvS1PsaGfp/ V82vMElGwWIkXAJt/FNjw/w3oCU4bIVI18NGWLFi5N1rmtGHf4OfQnY8ikSxpg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1671303335; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6AwGJM7EnQb/mbTiit2gzsS6CqaERs5CQtZQmK0M83c=; b=jZqmcPHtiapwvvpqhNKPzT+X8A41p0Q4kXlZ2qIIYQjjhQN82b5WsgSBV1Wpcr6Bn6yipV itbMK6cMKmwYBjAw== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/mm] x86/ftrace: Remove SYSTEM_BOOTING exceptions Cc: "Peter Zijlstra (Intel)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20221025201057.945960823@infradead.org> References: <20221025201057.945960823@infradead.org> MIME-Version: 1.0 Message-ID: <167130333517.4906.15894678655600602703.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747691830837220819?= X-GMAIL-MSGID: =?utf-8?q?1752489427815206732?= The following commit has been merged into the x86/mm branch of tip: Commit-ID: eb7d389d5b2b3c453332abc41c3eea73290cc006 Gitweb: https://git.kernel.org/tip/eb7d389d5b2b3c453332abc41c3eea73290cc006 Author: Peter Zijlstra AuthorDate: Tue, 25 Oct 2022 21:39:47 +02:00 Committer: Dave Hansen CommitterDate: Thu, 15 Dec 2022 10:37:26 -08:00 x86/ftrace: Remove SYSTEM_BOOTING exceptions Now that text_poke is available before ftrace, remove the SYSTEM_BOOTING exceptions. Specifically, this cures a W+X case during boot. Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20221025201057.945960823@infradead.org --- arch/x86/kernel/alternative.c | 10 ---------- arch/x86/kernel/ftrace.c | 3 +-- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 5cadcea..e240351 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c @@ -1681,11 +1681,6 @@ void __ref text_poke_queue(void *addr, const void *opcode, size_t len, const voi { struct text_poke_loc *tp; - if (unlikely(system_state == SYSTEM_BOOTING)) { - text_poke_early(addr, opcode, len); - return; - } - text_poke_flush(addr); tp = &tp_vec[tp_vec_nr++]; @@ -1707,11 +1702,6 @@ void __ref text_poke_bp(void *addr, const void *opcode, size_t len, const void * { struct text_poke_loc tp; - if (unlikely(system_state == SYSTEM_BOOTING)) { - text_poke_early(addr, opcode, len); - return; - } - text_poke_loc_init(&tp, addr, opcode, len, emulate); text_poke_bp_batch(&tp, 1); } diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c index bd16500..43628b8 100644 --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -415,8 +415,7 @@ create_trampoline(struct ftrace_ops *ops, unsigned int *tramp_size) set_vm_flush_reset_perms(trampoline); - if (likely(system_state != SYSTEM_BOOTING)) - set_memory_ro((unsigned long)trampoline, npages); + set_memory_ro((unsigned long)trampoline, npages); set_memory_x((unsigned long)trampoline, npages); return (unsigned long)trampoline; fail: