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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B2EFEB64D7 for ; Tue, 13 Jun 2023 18:56:32 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9FA316B0075; Tue, 13 Jun 2023 14:56:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 982A16B0078; Tue, 13 Jun 2023 14:56:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 822D58E0002; Tue, 13 Jun 2023 14:56:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6A2CE6B0075 for ; Tue, 13 Jun 2023 14:56:31 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D2DAD1C81E4 for ; Tue, 13 Jun 2023 18:56:30 +0000 (UTC) X-FDA: 80898630540.13.2C9615F Received: from out-47.mta1.migadu.com (out-47.mta1.migadu.com [95.215.58.47]) by imf07.hostedemail.com (Postfix) with ESMTP id 3961740003 for ; Tue, 13 Jun 2023 18:56:26 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=UteSpuaA; spf=pass (imf07.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.47 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686682587; h=from:from:sender: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:dkim-signature; bh=cI/+VKexODe7tgazUH0uBbszHN+Sh5VjQJKMcYicSKU=; b=dDhZOPLM4wKyWqpJSfoXY7g98clT5OEIUYDYiwkT0r/q++ckAlg4lIAR1frMXwt9rTKFTJ rj57z2DY4EPlkMvPSZZYTKYBeFFXQoC0GP/yjzEcKx0KFVW0KjRUz2CWtiwJVs2Bnypwa8 Fm+4DYkmUjamLtGWgGQiwDFBQ1yO3tc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686682587; a=rsa-sha256; cv=none; b=VVFYwRulC6gP1ox7MrFdposhl5BMj5GpC8e+EYvlr40RVjLIUtHjLZtmhb/ukwaz5T0xfx jXouIeOou2X23dylThpTRIr+fc4n2nZ12LnctRMB7AwcSEUThAp5JPFi2Y9k/w78WyUdcT tywgJFjTJRq/WAIijrWrZ3ZH8GdSPbU= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=UteSpuaA; spf=pass (imf07.hostedemail.com: domain of kent.overstreet@linux.dev designates 95.215.58.47 as permitted sender) smtp.mailfrom=kent.overstreet@linux.dev; dmarc=pass (policy=none) header.from=linux.dev 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-Rspamd-Queue-Id: 3961740003 X-Rspam-User: X-Stat-Signature: ymi3ipk96663zdwdtpobkwojywfcx3n9 X-Rspamd-Server: rspam03 X-HE-Tag: 1686682586-463198 X-HE-Meta: U2FsdGVkX19juHGPxca/AqO0fLgYoUVLFu1E5Sw6z7+smGXKJGB9e8B+LL51pn1t03kF6cliMeCFovgkIeopNNCQ2DvMAV46ooDgIDfnSkzZ7z3nkris02U4m9290iwi3+usRA0QQXNQZDxxXfQCOqwFJIGx0W9z5AlrVRKaIqs0Fd4f9quhMPBlLNMj6MEe0ZTq8OXBWQ8LaJbeOm3IH8JhXfjYSx+4q70W1iCNWkBF9eBi0wgxXpcdZFGoKqdFOdTBhpIu8xwOd7u4V8TrK21JmnSUqnccHhgOJX5JvcmxJF3bexUf+auVnviJ0NmEQ0xwGmzr7l+sVnj7YK661jmj2tgYEGGnKc+VAJvQt/XgqStHYnzxQLHOsVAFJisLn8I/jfTAOrLR33SYIIpfN8wrSJ6/qaXGX2pI2wRQLsNyTmq6td2FWJ2GNZyib+edaDy6712Khsh3ncffocAO7tKYHFXsd5pU4Lc6wT0woefA5/wqDTYBlcVLGkcRXZqAqqTURY6t19M8tTU3xfnK2U98Vu3STcLFjyP1E9jyzDDbEPaShXHGyvMEswZ6gyjAro7gBp021O/ZOmNONwgJWH6rqe3eRthpMQEwj7DQSz9k4M2a5EMPSIYI42+fbiYDZhyuzhF4eYS7E19SgoE1akmIhdiNnColSgfmwlMWrS1zZFSn5jOZGg+PuJKPCsxFlSOpkPIQ+C5v8tjOB6X/1dvNzq8qXVqGOzD/xwNLU9jERSMtVTBUucv7sTjUfyZn5QIbZ69ON6hkFbb299HA8+sx/T5OvRqh26aadtr3F0KXOJr2DOvDWgSEYrv6v5SrLiif3aekWJ1kylrc4yABR88UDak3GCCTHjZYlmhkyPpN3TpZDMCaUAbRZHUH5kR8wCsn9b9rDohdAp0jhZroJef4ix02DxJACnkVwX/IjcT3dTBgE1EW3P4x1rQvPdzczDlBwI2A4LDbeYIJYYI InM+vuUT Nmn+LflW/ET4e+1wHzQ6P75jhVI2NzvXjQuS+0UvRar+iTC88Yffmoh8Wkf460kDQi79NJtVu0FIhKU86HvDf9axkOMDgcOmQ9Ok0c9dPGHe5GZk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.