Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1658813rwd; Tue, 13 Jun 2023 12:10:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6vD/2VBY6xOm9WqMchYP30vKvdD1yS+gP04UW2jwoTofy7rlnpb51adwTh5rAfs4Au+gHA X-Received: by 2002:a17:907:6d96:b0:978:8979:c66c with SMTP id sb22-20020a1709076d9600b009788979c66cmr13438066ejc.18.1686683428276; Tue, 13 Jun 2023 12:10:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686683428; cv=none; d=google.com; s=arc-20160816; b=EobImB7yf2viDfp98RQENvmv2v90l4xge6KiNxrylcw6dbGFEIHn8XrPgvWmmF0xC5 AvfkVfmMl59HzkFFlP+BqJKwH/NpjPnAMO5WPweO1xiPcrvGw+wwcBgivHrdGwDghAAd mW59NHY2OQIw6l7llxXUS5Tad7qrJ1EuH2f8GIS0CHXos1qfXcnAsYBuDiCmohx4z/be wA8iEy603jPf8/9g34V6I2e4Nytnva+Rc/r8lS2inAdT0hEOWW9FZqK3EbMhFdUUbdFp bTuQjTpp3weOn1lT2cB847kU2Kh1BX6+5Wfd8onPU9mOj4BI9csFmbgujk+EczxB4P8R 3lAA== 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=cI/+VKexODe7tgazUH0uBbszHN+Sh5VjQJKMcYicSKU=; b=Gw1GAXDON+AMMIjTOnBW6ImE5aLZlrfZQf7yf8WI6xA+fV1BgBLD2KZ+zRdywy94an mhiNvKHATnfohZUPa0UMe0opOVRfwQb7xV7UO+NF2yKRpIa1AKyvNofCVNVL98x2ePyl GNhf+DXHvQv6g8zLDxufN9B2JeCrhJ8tT/yRWl6Lj2fO9IUl/lurltsGX/sMTkp8KsOD 1CJVaWHEnAq8wQ4BoZzelBwVq2g3KGzOHHcMVMuUZmtvLUxBqXyH/nYuj1oyolqoPOIO FzfCepGiGXLIyLkdf2CE0yVaMKVCYFdO8nhGdANPpM9woEf8Nq+Y9F2cdeQ1H8tlZYrS zYaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=UteSpuaA; 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 v24-20020a17090690d800b00977878c3965si6886427ejw.824.2023.06.13.12.10.01; Tue, 13 Jun 2023 12:10:28 -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=UteSpuaA; 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 S240312AbjFMS42 (ORCPT + 99 others); Tue, 13 Jun 2023 14:56:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233024AbjFMS40 (ORCPT ); Tue, 13 Jun 2023 14:56:26 -0400 Received: from out-18.mta1.migadu.com (out-18.mta1.migadu.com [95.215.58.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D4D3B5 for ; Tue, 13 Jun 2023 11:56:24 -0700 (PDT) Date: Tue, 13 Jun 2023 14:56:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1686682581; 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=cI/+VKexODe7tgazUH0uBbszHN+Sh5VjQJKMcYicSKU=; b=UteSpuaAfbQ2NCJDHT0DaE6LH+0KCxqxliA1u1CiHpYLEp/BHx0yHT4z2wyOm1k0K155IH 1TdtqXMsJtk9bqAzUZ31aQXTksL2s2n1Q4RGfHebraQUDr3MhWO8yy+4wsaox2mGxQ3YRe XgmITo5ci4OCni1zywcC85bIuHv1vdI= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Mike Rapoport Cc: Song Liu , Mark Rutland , linux-kernel@vger.kernel.org, Andrew Morton , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Heiko Carstens , Helge Deller , Huacai Chen , Luis Chamberlain , Michael Ellerman , "Naveen N. Rao" , Palmer Dabbelt , 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 00/13] mm: jit/text allocator Message-ID: References: <20230601101257.530867-1-rppt@kernel.org> <20230605092040.GB3460@kernel.org> <20230608184116.GJ52412@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230608184116.GJ52412@kernel.org> 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=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 On Thu, Jun 08, 2023 at 09:41:16PM +0300, Mike Rapoport wrote: > On Tue, Jun 06, 2023 at 11:21:59AM -0700, Song Liu wrote: > > On Mon, Jun 5, 2023 at 3:09 AM Mark Rutland wrote: > > > > [...] > > > > > > > > Can you give more detail on what parameters you need? If the only extra > > > > > > parameter is just "does this allocation need to live close to kernel > > > > > > text", that's not that big of a deal. > > > > > > > > > > My thinking was that we at least need the start + end for each caller. That > > > > > might be it, tbh. > > > > > > > > Do you mean that modules will have something like > > > > > > > > jit_text_alloc(size, MODULES_START, MODULES_END); > > > > > > > > and kprobes will have > > > > > > > > jit_text_alloc(size, KPROBES_START, KPROBES_END); > > > > ? > > > > > > Yes. > > > > How about we start with two APIs: > > jit_text_alloc(size); > > jit_text_alloc_range(size, start, end); > > > > AFAICT, arm64 is the only arch that requires the latter API. And TBH, I am > > not quite convinced it is needed. > > Right now arm64 and riscv override bpf and kprobes allocations to use the > entire vmalloc address space, but having the ability to allocate generated > code outside of modules area may be useful for other architectures. > > Still the start + end for the callers feels backwards to me because the > callers do not define the ranges, but rather the architectures, so we still > need a way for architectures to define how they want allocate memory for > the generated code. So, the start + end just comes from the need to keep relative pointers under a certain size. I think this could be just a flag, I see no reason to expose actual addresses here.