Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1802745rwd; Tue, 13 Jun 2023 14:36:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6KsH2rTRoqePZzk1jPUkNLPcJF0xp2ihR4KQdlSJBjwYjqd3igrc5fzIPq37kC62utYBY0 X-Received: by 2002:aa7:ce14:0:b0:514:ae18:1642 with SMTP id d20-20020aa7ce14000000b00514ae181642mr8086011edv.36.1686692217502; Tue, 13 Jun 2023 14:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686692217; cv=none; d=google.com; s=arc-20160816; b=g7UvUnxNLh+A3itwljHD5kvFDUZVrHlmc0+NRd4nlGxhTCfHqwGuH29P5KuPo9Vg1C uQqWC3XFBuZwYEceuiFlKkHOpHMd7PCJPQF0M7md6ugm3WQ/mf4kso6dsdX2r4eJAYIo +BfjLAY1Qqh4XAhXxOIxBtT6uiGGSoLwZ7SOmE/vZ8vhghYL574A64BpQn91Hajn05To FLy7f6BDAzxHyELC373JyNKS+zOgbCF7PtsNr35G/iIuqBzD2Ha0xPjmUZFKGKiGWTO6 gekyH5yfUfDClSxa3IQk02hqiOBGMihePKf0UhFoRorOA/SuAEpCtlFLypJRCF7yZ6bt tZxQ== 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:date:dkim-signature; bh=DWsBYCD6dBgItSGfxXeW8VT88qo9PQPzIfV//glZqj0=; b=BjbUbQAYmkhsp/tfBwTf+lg897o0OigYXTYvEIZqkF+k8doBKOoK6tnbflbTgDfm2p xv3+6dw7bC2I/2T/Z9wQYYCvoMC7I7Z54bFHNN8rHwQWlkpIhBykQ/5VD7FAhH2OcUX+ wxTUfPb5mg2lZ/4MeQgQDl0V7trIz4GIBqyuXE88D1of5IDpOvAVc3WeMw45DsjB+hDN Ez09tKCmyzKccPVEKTYcCay8RHKRwQktM9Xnu5d8J/QtAKd6nI4XQeRjVUhy9GsLAaWj od9Ju2jFSFj/bZqNz9lpr2mV+Cl2WDbbgWFy0oCyDT/GsYSuSeXp/cVZCVPoaYDwt+8e abVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ZwHrH/Ut"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be6-20020a0564021a2600b0051872bd531asi1588809edb.536.2023.06.13.14.36.32; Tue, 13 Jun 2023 14:36:57 -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=@kernel.org header.s=k20201202 header.b="ZwHrH/Ut"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234102AbjFMVKu (ORCPT + 99 others); Tue, 13 Jun 2023 17:10:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239627AbjFMVJm (ORCPT ); Tue, 13 Jun 2023 17:09:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 623131BC6; Tue, 13 Jun 2023 14:09:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 42CA961864; Tue, 13 Jun 2023 21:09:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1CA2C433C0; Tue, 13 Jun 2023 21:09:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686690580; bh=CnDPIeLogwBWCfXwDFCGYSnn6freMhcPiMKmnauZmK8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZwHrH/UtQy5gtJuV6CZdRxLuHzTaAkiUGIx/JgEU65AMLsBIKZ0sWdlw1vTEQYgdy gSLYt19YIoeRBe5zYzLlgTuRTMMo3kgRmlRYZUwN9+y0DX2gj67q8Dp8pJtQUo0gHp Oy60KuQPQMSSexOGqUQrMmT3Fgb1GBewXzaMMxDEmcoyUN9bNnKzEk/bEsVagentbs IrjokONRoY0TE+yzqvQqq0avTQyKOfbb7gZycLtP7znx6sVR7tnvKBFHLqFKSVwEs2 kIA6GPsL9JTaWmKMWc1Wdyo1oerK/huG9zsVu6RfIYfLEAg8ULTJ9IL3DRtm5ddTXF JrMlJp241w1cA== Date: Wed, 14 Jun 2023 00:09:00 +0300 From: Mike Rapoport To: Kent Overstreet 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: <20230613210900.GV52412@kernel.org> 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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Tue, Jun 13, 2023 at 02:56:14PM -0400, Kent Overstreet wrote: > 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. It's the other way around. The start + end comes from the need to restrict allocation to certain range because of the relative addressing. I don't see how a flag can help here. -- Sincerely yours, Mike.