Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4431843rwd; Sat, 17 Jun 2023 13:41:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ76vU8ZFJlqQ7qu71Qz6FYP30enIh+OWVJcV60fGi3qON/kMrgicpA3kC/qFXN1dcosfoKr X-Received: by 2002:a05:6870:32cf:b0:1aa:f3:5b3b with SMTP id r15-20020a05687032cf00b001aa00f35b3bmr2471766oac.17.1687034515803; Sat, 17 Jun 2023 13:41:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687034515; cv=none; d=google.com; s=arc-20160816; b=s2SwtTJ75oJDThOHmFJXBMzTsR9NWIvc8BIsh01IvqEGoNj/UgBGL/v3fy2B5m2x+i hxbRuucLSSOYInBvB+zlAu7c7mIax7wCEZQ+hMWYzAY4EOcu03He9TAfAEJXWeuLRBZW hAQwZn55eX8l50c9zX2BzTc4Yf0m7X+IplajYLhFC+SEu0zXTe+LLKzo28ahBtXJLBEK 8PdgqHNSf8HLcoxiuuHe+kRf8GmMiL4z0NPI33QnTqJfZrP/IRD/x1vv0vAQzP7JYj4i 89ieSVGsMk1615HKQ7IgM1gXO9G6BdGdQwzx3Gage2uFnvLEaLOdMT8N4UxMXaUypTWe Zfag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=q0VmYCbqCGEwwRm9p2gHyBMkJehgKoo9YX+I+uEXlwI=; b=UDC/0rSRJuK2A1tARNeLBVPxSDuOyLTQ6Dgxml5MCIr8J9NmBynYTZD0DhgZJ6gMDG +708+IXN1l9+gCNRY/XYLfRcKYE/ksheIsWlX4Dr9pkesGQfEUXbYxz3LnuZM0a2MGsO hG6UZCknGxXjzjAxrRGZBKkM9OrmAsID7Ul/Pz3KlTaqgNaJUZTfLpnCETr2Ec5X06xa JN1BxkX0FgQ/0ZAS095ZlLpHF9+V4CEh5vo7PLQgQ3qgONmg4s8Tg6gKqNBv1I6693F1 RQZ0koR0aY6MLmDGRn1Gw77GdJMGsm++4DeEkyNP7ltSdcNndJEVCTrAZ/Dh4Lf/cs7A SrAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=dfNjewHV; 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=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k6-20020a634b46000000b005439273f2a4si17247034pgl.139.2023.06.17.13.41.42; Sat, 17 Jun 2023 13:41:55 -0700 (PDT) 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=@linux.dev header.s=key1 header.b=dfNjewHV; 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=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231174AbjFQUhp (ORCPT + 99 others); Sat, 17 Jun 2023 16:37:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231967AbjFQUhl (ORCPT ); Sat, 17 Jun 2023 16:37:41 -0400 Received: from out-47.mta1.migadu.com (out-47.mta1.migadu.com [95.215.58.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9397C19B0 for ; Sat, 17 Jun 2023 13:37:37 -0700 (PDT) Date: Sat, 17 Jun 2023 16:37:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1687034256; h=from:from: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=q0VmYCbqCGEwwRm9p2gHyBMkJehgKoo9YX+I+uEXlwI=; b=dfNjewHVuYudVnc8TKpcch6UyyxsC62EekInr+KCF+/d5W19oLEbYgWNkxwMPmu6LU+6YJ DDxDUAUrcbSRUp/oMghsBWa2J9HukZTCZ/JGCQrtkNxjPDHNM3pSHNKVBsHXTHpr3HEdfU c38+ELnaz0YDpRbuK0hGGk55HYtUVFk= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Song Liu Cc: Mike Rapoport , linux-kernel@vger.kernel.org, Andrew Morton , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Heiko Carstens , Helge Deller , Huacai Chen , Luis Chamberlain , Mark Rutland , Michael Ellerman , Nadav Amit , "Naveen N. Rao" , Palmer Dabbelt , Puranjay Mohan , Rick Edgecombe , Russell King , 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 v2 07/12] arm64, execmem: extend execmem_params for generated code definitions Message-ID: References: <20230616085038.4121892-1-rppt@kernel.org> <20230616085038.4121892-8-rppt@kernel.org> <20230617065759.GT52412@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable 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 On Sat, Jun 17, 2023 at 09:38:17AM -0700, Song Liu wrote: > On Sat, Jun 17, 2023 at 8:37 AM Kent Overstreet > wrote: > > > > On Sat, Jun 17, 2023 at 09:57:59AM +0300, Mike Rapoport wrote: > > > > This is growing fast. :) We have 3 now: text, data, jit. And it will be > > > > 5 when we split data into rw data, ro data, ro after init data. I wonder > > > > whether we should still do some type enum here. But we can revisit > > > > this topic later. > > > > > > I don't think we'd need 5. Four at most :) > > > > > > I don't know yet what would be the best way to differentiate RW and RO > > > data, but ro_after_init surely won't need a new type. It either will be > > > allocated as RW and then the caller will have to set it RO after > > > initialization is done, or it will be allocated as RO and the caller will > > > have to do something like text_poke to update it. > > > > Perhaps ro_after_init could use the same allocation interface and share > > pages with ro pages - if we just added a refcount for "this page > > currently needs to be rw, module is still loading?" > > If we don't relax rules with read only, we will have to separate rw, ro, > and ro_after_init. But we can still have page sharing: > > Two modules can put rw data on the same page. > With text poke (ro data poke to be accurate), two modules can put > ro data on the same page. > > > text_poke() approach wouldn't be workable, you'd have to audit and fix > > all module init code in the entire kernel. > > Agreed. For this reason, each module has to have its own page(s) for > ro_after_init data. Relaxing page permissions to allow for page sharing could also be a config option. For archs with 64k pages it seems worthwhile.