Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp6864029rwr; Tue, 9 May 2023 23:54:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5UgRCZ+p5+z2NWcYS4vzfP3wrp/nXAHvq6PC0mTYqhlHPQmHgwqBMa43Ub9+FMTlKSiVDP X-Received: by 2002:a05:6a20:d70b:b0:f3:33fb:a62b with SMTP id iz11-20020a056a20d70b00b000f333fba62bmr18109338pzb.9.1683701687747; Tue, 09 May 2023 23:54:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683701687; cv=none; d=google.com; s=arc-20160816; b=oHyWKU0j0RbKy+socyGcZOKtW+Q1s+NkB5AKgB0WY7kcKbrKv/am1j0KtRPe+bJYe/ V34xqUxc2CS90oM72jh2YVH7EOw3zaZL6ykjtz+HFw38+YPwsl5WiDrljeqMlNGDCOG2 OvoGbOlApvzgZRRX8KzgEtsVajcwvfMFNOTNxtsnFVjjfTj/UNM637xB/1L8xREtSFAM sPckQYE8N+UGrkzxLxkFQ+YF4m2w15S/lIxXCRZOjKzhwFSPiGSUiYoLHXRZyrG2mxL/ OP5fyYmhlWX6lDOpOfC5aOBv2AlaqCSwO9Dur1lrYdV5UOgGh55xQCWFysofUtRCHGLw Q4Wg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5EB3H26177kp/TlxxPXNY1ikt5OyzffGmKJRfLlnjfM=; b=Mc3ISM+6w4kBUrETPND8uF5PMika5WxlBlK8gzyVtg440c9AZzaY9p6RbosnoxWFVz JpU6nc5u3HH9y3WWLxO7gJX0BokeBVBTMDFzcFMte3F3LtNJJ98i75W0DdJ2eZh4wJ4F SzkHhlaIMPpeZvenHY9wppzpm9QMGW5XY/2wBjsYMiX+7RG6h7YzOqcrkRRLyTNWPOCe 6fDR/c5XMHEybeHRB6oUEAxeRNLPHrUVAWF5bD1MX3R76t9QXDg7Hw4hN3hEIrrmlFF1 u9YwnKIdLbKPsTJv/LtmEP3HQ2nWeL5Uxuwv1+PWp59tu9IDaS9pcZAER4tk6sQpTRiq WWUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lk0Vpdvs; 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 i123-20020a625481000000b00644568452e6si4160970pfb.318.2023.05.09.23.54.34; Tue, 09 May 2023 23:54:47 -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=lk0Vpdvs; 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 S236094AbjEJGs7 (ORCPT + 99 others); Wed, 10 May 2023 02:48:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236040AbjEJGsy (ORCPT ); Wed, 10 May 2023 02:48:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF4564486; Tue, 9 May 2023 23:48:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C83063850; Wed, 10 May 2023 06:48:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ABB8C4339B; Wed, 10 May 2023 06:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683701331; bh=QKjgd6OZtwhEvhLfeWWvvsdF4yk6O8j8A4mBRN11HD0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lk0VpdvsyWLksbyhs4Z1NrZD4LJ5QdonevQNcOvcM08T8L86PE+W/YSP3gsHMx3Ld w1J7Nd3oXb/24AuzE7CSRHMqV4Vp/rvChYoxweyGfvz3C28Fj0bBOGnYnwPOjobo1u sbpuRlRS/vjD/hdOuVmEHDBuVBJZoEOuucgK9evjOGWdNyu3JfpEGgoSXQe+LgUU2O LRrLbSjXFK+KUi6ayXDB2eE8cfZnJPh6h6Id2KALDryzK6frofDa/Wkm1C6elVCaxi 5YMu3r6iAplHyprHXOpc1ZQQe081HNKMLHEZ9m0NVIfwlvAx9aYQCpfu048N+hbljJ LU6+Nyr8QwVeg== Date: Tue, 9 May 2023 23:48:49 -0700 From: Eric Biggers To: Kent Overstreet Cc: Lorenzo Stoakes , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-bcachefs@vger.kernel.org, Kent Overstreet , Andrew Morton , Uladzislau Rezki , linux-mm@kvack.org Subject: Re: [PATCH 07/32] mm: Bring back vmalloc_exec Message-ID: <20230510064849.GC1851@quark.localdomain> References: <20230509165657.1735798-1-kent.overstreet@linux.dev> <20230509165657.1735798-8-kent.overstreet@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Tue, May 09, 2023 at 05:29:10PM -0400, Kent Overstreet wrote: > On Tue, May 09, 2023 at 02:12:41PM -0700, Lorenzo Stoakes wrote: > > On Tue, May 09, 2023 at 01:46:09PM -0700, Christoph Hellwig wrote: > > > On Tue, May 09, 2023 at 12:56:32PM -0400, Kent Overstreet wrote: > > > > From: Kent Overstreet > > > > > > > > This is needed for bcachefs, which dynamically generates per-btree node > > > > unpack functions. > > > > > > No, we will never add back a way for random code allocating executable > > > memory in kernel space. > > > > Yeah I think I glossed over this aspect a bit as it looks ostensibly like simply > > reinstating a helper function because the code is now used in more than one > > place (at lsf/mm so a little distracted :) > > > > But it being exported is a problem. Perhaps there's another way of acheving the > > same aim without having to do so? > > None that I see. > > The background is that bcachefs generates a per btree node unpack > function, based on the packed format for that btree node, for unpacking > keys within that node. The unpack function is only ~50 bytes, and for > locality we want it to be located with the btree node's other in-memory > lookup tables so they can be prefetched all at once. > > Here's the codegen: > > https://evilpiepirate.org/git/bcachefs.git/tree/fs/bcachefs/bkey.c#n727 Well, it's a cool trick, but it's not clear that it actually belongs in production kernel code. What else in the kernel actually does dynamic codegen? Just BPF, I think? Among other issues, this is entirely architecture-specific, and it may cause interoperability issues with various other features, including security features. Is it really safe to leave a W&X page around, for example? What seems to be missing is any explanation for what we're actually getting from this extremely unusual solution that cannot be gained any other way. What is unique about bcachefs that it really needs something like this? - Eric