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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id AB884C77B7E for ; Thu, 1 Jun 2023 10:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=4sW821C6/uWEfCVVfkA13a0D/OjYo1H93k+SZoEIyiY=; b=JCvAx5lzrBDs5z rWbdEb2O/F3+EWR1YxRHQr+/4IP8c2vp99rzSJTVcLeXR2X0p/7NAdJzJlZlPE5yybm0+i2AxIUZk AgLGRbcFtq5mB5ssMnJxwkzwugtWBKzpnyYJ5XaR9NUFLdyPyxEJC8q0RYrTTc92KAsNcb7fqsfU/ 2S0vClNNi0npO837a9GPdBp6fWOkqpguogJZyP65OlkkbHaCd0CmN5Hba/bhqF6OFFySvyu8XpBmX BWg8Of5C1+8TmbKWaSoIYjksiJRkpzcIUnVxMYEovgkVufP+DO39CqzSHz6zylx3TC+j5/xRCfW4Y RgwxxLHOfnWsOr3ZvPEA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q4faA-0032Dl-0q; Thu, 01 Jun 2023 10:31:02 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q4fa7-0032AZ-17; Thu, 01 Jun 2023 10:30:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=eO/OU9rxkp8hXKcShXmqMYIGO9NNy/sl1o++FVK8OV8=; b=j5qEB66OyejLhukROTeex8RZO2 8KI1zzfHFM0FSLCqza9uhEVgX/c6zEyu5qHGxX7CJjO0P8cMHhiatrGDyBr1rwPhvt1GBzYI3w9hK 7k0I9xbsAZWFem/1PDEo2VNDt00sI8oyAzzTxJA4uo4MvXyvrVy0amUmV0Fe6tnUgHehB/WpCQHa0 E82Y4vUZviXiJKDYelnzUm/Nrm/arC8TppikUDhcTNAzuZOH6BUuoSoQ5fKrxoZnJc+dZbGtWiKRX XlzWY1ePr9L+jMWFfjfVYehLflBFoPhhFwj8zZHz6jYQh5Ua/7Uf898zVO4+XMxyKyYJVXo3IJNI+ 6+NetZlw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1q4fa1-008HDp-EN; Thu, 01 Jun 2023 10:30:53 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3A54F30031F; Thu, 1 Jun 2023 12:30:51 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0D9D021484ABB; Thu, 1 Jun 2023 12:30:51 +0200 (CEST) Date: Thu, 1 Jun 2023 12:30:50 +0200 From: Peter Zijlstra To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, Andrew Morton , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Luis Chamberlain , Michael Ellerman , "Naveen N. Rao" , Palmer Dabbelt , Russell King , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 12/13] x86/jitalloc: prepare to allocate exectuatble memory as ROX Message-ID: <20230601103050.GT4253@hirez.programming.kicks-ass.net> References: <20230601101257.530867-1-rppt@kernel.org> <20230601101257.530867-13-rppt@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230601101257.530867-13-rppt@kernel.org> X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Thu, Jun 01, 2023 at 01:12:56PM +0300, Mike Rapoport wrote: > +static void __init_or_module do_text_poke(void *addr, const void *opcode, size_t len) > +{ > + if (system_state < SYSTEM_RUNNING) { > + text_poke_early(addr, opcode, len); > + } else { > + mutex_lock(&text_mutex); > + text_poke(addr, opcode, len); > + mutex_unlock(&text_mutex); > + } > +} So I don't much like do_text_poke(); why? > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c > index aa99536b824c..d50595f2c1a6 100644 > --- a/arch/x86/kernel/ftrace.c > +++ b/arch/x86/kernel/ftrace.c > @@ -118,10 +118,13 @@ ftrace_modify_code_direct(unsigned long ip, const char *old_code, > return ret; > > /* replace the text with the new text */ > - if (ftrace_poke_late) > + if (ftrace_poke_late) { > text_poke_queue((void *)ip, new_code, MCOUNT_INSN_SIZE, NULL); > - else > - text_poke_early((void *)ip, new_code, MCOUNT_INSN_SIZE); > + } else { > + mutex_lock(&text_mutex); > + text_poke((void *)ip, new_code, MCOUNT_INSN_SIZE); > + mutex_unlock(&text_mutex); > + } > return 0; > } And in the above case it's actively wrong for loosing the _queue() thing. _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52B2B21CD9 for ; Thu, 1 Jun 2023 10:31:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=eO/OU9rxkp8hXKcShXmqMYIGO9NNy/sl1o++FVK8OV8=; b=j5qEB66OyejLhukROTeex8RZO2 8KI1zzfHFM0FSLCqza9uhEVgX/c6zEyu5qHGxX7CJjO0P8cMHhiatrGDyBr1rwPhvt1GBzYI3w9hK 7k0I9xbsAZWFem/1PDEo2VNDt00sI8oyAzzTxJA4uo4MvXyvrVy0amUmV0Fe6tnUgHehB/WpCQHa0 E82Y4vUZviXiJKDYelnzUm/Nrm/arC8TppikUDhcTNAzuZOH6BUuoSoQ5fKrxoZnJc+dZbGtWiKRX XlzWY1ePr9L+jMWFfjfVYehLflBFoPhhFwj8zZHz6jYQh5Ua/7Uf898zVO4+XMxyKyYJVXo3IJNI+ 6+NetZlw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1q4fa1-008HDp-EN; Thu, 01 Jun 2023 10:30:53 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3A54F30031F; Thu, 1 Jun 2023 12:30:51 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0D9D021484ABB; Thu, 1 Jun 2023 12:30:51 +0200 (CEST) Date: Thu, 1 Jun 2023 12:30:50 +0200 From: Peter Zijlstra To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, Andrew Morton , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Luis Chamberlain , Michael Ellerman , "Naveen N. Rao" , Palmer Dabbelt , Russell King , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 12/13] x86/jitalloc: prepare to allocate exectuatble memory as ROX Message-ID: <20230601103050.GT4253@hirez.programming.kicks-ass.net> References: <20230601101257.530867-1-rppt@kernel.org> <20230601101257.530867-13-rppt@kernel.org> Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230601101257.530867-13-rppt@kernel.org> On Thu, Jun 01, 2023 at 01:12:56PM +0300, Mike Rapoport wrote: > +static void __init_or_module do_text_poke(void *addr, const void *opcode, size_t len) > +{ > + if (system_state < SYSTEM_RUNNING) { > + text_poke_early(addr, opcode, len); > + } else { > + mutex_lock(&text_mutex); > + text_poke(addr, opcode, len); > + mutex_unlock(&text_mutex); > + } > +} So I don't much like do_text_poke(); why? > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c > index aa99536b824c..d50595f2c1a6 100644 > --- a/arch/x86/kernel/ftrace.c > +++ b/arch/x86/kernel/ftrace.c > @@ -118,10 +118,13 @@ ftrace_modify_code_direct(unsigned long ip, const char *old_code, > return ret; > > /* replace the text with the new text */ > - if (ftrace_poke_late) > + if (ftrace_poke_late) { > text_poke_queue((void *)ip, new_code, MCOUNT_INSN_SIZE, NULL); > - else > - text_poke_early((void *)ip, new_code, MCOUNT_INSN_SIZE); > + } else { > + mutex_lock(&text_mutex); > + text_poke((void *)ip, new_code, MCOUNT_INSN_SIZE); > + mutex_unlock(&text_mutex); > + } > return 0; > } And in the above case it's actively wrong for loosing the _queue() thing. 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0F6BEC77B7E for ; Thu, 1 Jun 2023 10:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc: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=E3DGMCsPkTh4MW/1dLiyaMHrRgRhFGBBCzGaJWct/io=; b=wNgQoA98kUQpax qI7ewEoYoQ5QFAjLVqnV+WnigJFH4cXBIZ6dPQ54LBYUugNLQzDZBP4zzHmpZ3ozGiGNs7frBw+aG i7kOvQoqaUJ0hd3PeDQ+O6CuKpkbwRmhF+NutT2kLYCyu3peBLxFcSGgI3GV21dlfLZqoN65d3V1u 5hmWgXiFD33yitnpOLJ8osamdN03Pg7pomFAWBJL0XhEFMidb0UM2SOgRCeoloYMTe6+ssWgry+mb SvHw9UJvw7sB0P7n5rOI5jTUNdQj1mghvMdlxA2bWhvJNpHyMSvWvEhENDkTBaWmce3tz4I1qG7D0 nYe2sVODzbk8zHudXeNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q4fa9-0032Co-2P; Thu, 01 Jun 2023 10:31:01 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q4fa7-0032AZ-17; Thu, 01 Jun 2023 10:30:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=eO/OU9rxkp8hXKcShXmqMYIGO9NNy/sl1o++FVK8OV8=; b=j5qEB66OyejLhukROTeex8RZO2 8KI1zzfHFM0FSLCqza9uhEVgX/c6zEyu5qHGxX7CJjO0P8cMHhiatrGDyBr1rwPhvt1GBzYI3w9hK 7k0I9xbsAZWFem/1PDEo2VNDt00sI8oyAzzTxJA4uo4MvXyvrVy0amUmV0Fe6tnUgHehB/WpCQHa0 E82Y4vUZviXiJKDYelnzUm/Nrm/arC8TppikUDhcTNAzuZOH6BUuoSoQ5fKrxoZnJc+dZbGtWiKRX XlzWY1ePr9L+jMWFfjfVYehLflBFoPhhFwj8zZHz6jYQh5Ua/7Uf898zVO4+XMxyKyYJVXo3IJNI+ 6+NetZlw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1q4fa1-008HDp-EN; Thu, 01 Jun 2023 10:30:53 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3A54F30031F; Thu, 1 Jun 2023 12:30:51 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0D9D021484ABB; Thu, 1 Jun 2023 12:30:51 +0200 (CEST) Date: Thu, 1 Jun 2023 12:30:50 +0200 From: Peter Zijlstra To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, Andrew Morton , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Luis Chamberlain , Michael Ellerman , "Naveen N. Rao" , Palmer Dabbelt , Russell King , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH 12/13] x86/jitalloc: prepare to allocate exectuatble memory as ROX Message-ID: <20230601103050.GT4253@hirez.programming.kicks-ass.net> References: <20230601101257.530867-1-rppt@kernel.org> <20230601101257.530867-13-rppt@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230601101257.530867-13-rppt@kernel.org> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jun 01, 2023 at 01:12:56PM +0300, Mike Rapoport wrote: > +static void __init_or_module do_text_poke(void *addr, const void *opcode, size_t len) > +{ > + if (system_state < SYSTEM_RUNNING) { > + text_poke_early(addr, opcode, len); > + } else { > + mutex_lock(&text_mutex); > + text_poke(addr, opcode, len); > + mutex_unlock(&text_mutex); > + } > +} So I don't much like do_text_poke(); why? > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c > index aa99536b824c..d50595f2c1a6 100644 > --- a/arch/x86/kernel/ftrace.c > +++ b/arch/x86/kernel/ftrace.c > @@ -118,10 +118,13 @@ ftrace_modify_code_direct(unsigned long ip, const char *old_code, > return ret; > > /* replace the text with the new text */ > - if (ftrace_poke_late) > + if (ftrace_poke_late) { > text_poke_queue((void *)ip, new_code, MCOUNT_INSN_SIZE, NULL); > - else > - text_poke_early((void *)ip, new_code, MCOUNT_INSN_SIZE); > + } else { > + mutex_lock(&text_mutex); > + text_poke((void *)ip, new_code, MCOUNT_INSN_SIZE); > + mutex_unlock(&text_mutex); > + } > return 0; > } And in the above case it's actively wrong for loosing the _queue() thing. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21B98C77B7A for ; Thu, 1 Jun 2023 10:32:32 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4QX2Wf4C7vz3dxl for ; Thu, 1 Jun 2023 20:32:30 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=j5qEB66O; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=infradead.org (client-ip=2001:8b0:10b:1236::1; helo=casper.infradead.org; envelope-from=peterz@infradead.org; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=infradead.org header.i=@infradead.org header.a=rsa-sha256 header.s=casper.20170209 header.b=j5qEB66O; dkim-atps=neutral Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4QX2Vd709Nz2xCd for ; Thu, 1 Jun 2023 20:31:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=eO/OU9rxkp8hXKcShXmqMYIGO9NNy/sl1o++FVK8OV8=; b=j5qEB66OyejLhukROTeex8RZO2 8KI1zzfHFM0FSLCqza9uhEVgX/c6zEyu5qHGxX7CJjO0P8cMHhiatrGDyBr1rwPhvt1GBzYI3w9hK 7k0I9xbsAZWFem/1PDEo2VNDt00sI8oyAzzTxJA4uo4MvXyvrVy0amUmV0Fe6tnUgHehB/WpCQHa0 E82Y4vUZviXiJKDYelnzUm/Nrm/arC8TppikUDhcTNAzuZOH6BUuoSoQ5fKrxoZnJc+dZbGtWiKRX XlzWY1ePr9L+jMWFfjfVYehLflBFoPhhFwj8zZHz6jYQh5Ua/7Uf898zVO4+XMxyKyYJVXo3IJNI+ 6+NetZlw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1q4fa1-008HDp-EN; Thu, 01 Jun 2023 10:30:53 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 3A54F30031F; Thu, 1 Jun 2023 12:30:51 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 0D9D021484ABB; Thu, 1 Jun 2023 12:30:51 +0200 (CEST) Date: Thu, 1 Jun 2023 12:30:50 +0200 From: Peter Zijlstra To: Mike Rapoport Subject: Re: [PATCH 12/13] x86/jitalloc: prepare to allocate exectuatble memory as ROX Message-ID: <20230601103050.GT4253@hirez.programming.kicks-ass.net> References: <20230601101257.530867-1-rppt@kernel.org> <20230601101257.530867-13-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230601101257.530867-13-rppt@kernel.org> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: x86@kernel.org, Catalin Marinas , linux-mips@vger.kernel.org, Song Liu , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , linux-s390@vger.kernel.org, Helge Deller , Huacai Chen , Russell King , "Naveen N. Rao" , linux-trace-kernel@vger.kernel.org, Heiko Carstens , Steven Rostedt , loongarch@lists.linux.dev, Thomas Gleixner , Andrew Morton , linux-arm-kernel@lists.infradead.org, Thomas Bogendoerfer , linux-parisc@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, Kent Overstreet , linux-kernel@vger.kernel.org, Dinh Nguyen , Luis Chamberlain , Palmer Dabbelt , bpf@vger.kernel.org, linuxppc-dev@lists.ozla bs.org, "David S. Miller" , linux-modules@vger.kernel.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Jun 01, 2023 at 01:12:56PM +0300, Mike Rapoport wrote: > +static void __init_or_module do_text_poke(void *addr, const void *opcode, size_t len) > +{ > + if (system_state < SYSTEM_RUNNING) { > + text_poke_early(addr, opcode, len); > + } else { > + mutex_lock(&text_mutex); > + text_poke(addr, opcode, len); > + mutex_unlock(&text_mutex); > + } > +} So I don't much like do_text_poke(); why? > diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c > index aa99536b824c..d50595f2c1a6 100644 > --- a/arch/x86/kernel/ftrace.c > +++ b/arch/x86/kernel/ftrace.c > @@ -118,10 +118,13 @@ ftrace_modify_code_direct(unsigned long ip, const char *old_code, > return ret; > > /* replace the text with the new text */ > - if (ftrace_poke_late) > + if (ftrace_poke_late) { > text_poke_queue((void *)ip, new_code, MCOUNT_INSN_SIZE, NULL); > - else > - text_poke_early((void *)ip, new_code, MCOUNT_INSN_SIZE); > + } else { > + mutex_lock(&text_mutex); > + text_poke((void *)ip, new_code, MCOUNT_INSN_SIZE); > + mutex_unlock(&text_mutex); > + } > return 0; > } And in the above case it's actively wrong for loosing the _queue() thing.