Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1646113rwd; Sat, 27 May 2023 23:25:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7P1RlM8p0N0jBaBEsRdq6qUo4iPj7NOSa6tJM27AkPEw7sGfK7JHEUk2nWR9e017hEqJWo X-Received: by 2002:a17:90a:9b0e:b0:256:69e2:7b7b with SMTP id f14-20020a17090a9b0e00b0025669e27b7bmr1165392pjp.7.1685255099676; Sat, 27 May 2023 23:24:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685255099; cv=none; d=google.com; s=arc-20160816; b=CNXs0MXgVQzKWI/rVLLoym5F7SU8nC0qFDu+jZ1IF67h95ZhCxPFSIKxUTltSydEX6 b/rx36ZqSHuNMRztJgVE/09xp1TuyP60jO8SnkTCpe9aOjduRTXgFtXG4jAkfK1ybSBX PRzdrD+NCwg+KCxWt3Kl1R1eGfGHiDnQ8jNT5PZ9lbhap0g/OXiznan7HBCzfrfhD2nE SnL4WlyMYTDs9PnfCi0ewA3t3o4MQNAmV7iRa+Th9g0SRsUiBIeWd7M/ny5uZcpaVRAF 0sAQ99VN4ayooPv2vdoeKulCsO8IIZdZsFGgKteNEr1OrNUyL+WzwJSVrhBg8VrpBPst G0rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=snJsYpgUWy+sW/MbYC1vdikaXeWm4JXAeQnv2EYir60=; b=mX+KFwFOPV1ovPNIbl/nRyYaNM2JMX6RSCGvnnqiT9/S9hJyh5L0OcmejM9vmo50Qk uNKpXY3AwfN4/R0xzbKafAWLS6uxKOCKTYN5CUxzdn0TYLxlemupA4V7YyghfLRE37x2 6NAjIctAZBfK0oNm7DI5toXTneKtX9B0P1hN2txRjt/cd7vd86HUOWixOpD7xjp796QH CFIJUkbLd9yG6zRkMYEoLUs4EuI7v4BjNvXynp6Rf4BsiBowNV9cuuXa9bGVmkMcIUW3 2b3FsoaaChx5reeTn7RQUDw1SLlYt/NJKhx0n4WDnRDQeWusroYC2pFN4UgLIv6yUy3O ZOdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PgPrso6v; 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 n20-20020a17090ade9400b0024b011026aesi2524021pjv.76.2023.05.27.23.24.44; Sat, 27 May 2023 23:24:59 -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=PgPrso6v; 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 S229492AbjE1F6y (ORCPT + 99 others); Sun, 28 May 2023 01:58:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjE1F6x (ORCPT ); Sun, 28 May 2023 01:58:53 -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 647FFD8 for ; Sat, 27 May 2023 22:58: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 CF01B60B63 for ; Sun, 28 May 2023 05:58:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B94AC4339B; Sun, 28 May 2023 05:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685253531; bh=snJsYpgUWy+sW/MbYC1vdikaXeWm4JXAeQnv2EYir60=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=PgPrso6v1AymYqAgyx8vsn1/v0QsnJ+kVXmB4yzU6zM+T/WWplSqvn77YDV+2R9m1 yTD+YOjAuBIma9KFBAnM+CSBoNvkct9KH1dmN2OpJNHMdiHEzrV1I3Gu6l73HTfYRQ 0HNAFCx0mrkIEk0WQ4qSDEp8diYSviG5paZPV31fdY4ghSm+Pjz9qpNYbkjEkpOd6G lk3/W0oj8WQruZtuVsU2EtvR0avI02ICKl18HJ9qwnzDPLFaeuQn6GiKe8Z6K5SRQF pNJR1hl7PcusXG+ElM+hlYGmlaSqWqC5suCrhfWzi39yeYjM1mYZabjCHleWuHrJZ4 GDwd62o7rNGxA== Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-2afb2875491so21969761fa.1; Sat, 27 May 2023 22:58:51 -0700 (PDT) X-Gm-Message-State: AC+VfDwi7ookzPHKVu/NYAmKlMzVgAeWW/Mu6KrV4snw+tpzy4OwjzBc 7xEAtyeNPAuca6Z5SLTLKkoCUqfAWLG+2Zg6B88= X-Received: by 2002:a2e:808c:0:b0:2ad:92b9:83b4 with SMTP id i12-20020a2e808c000000b002ad92b983b4mr3208515ljg.5.1685253529235; Sat, 27 May 2023 22:58:49 -0700 (PDT) MIME-Version: 1.0 References: <20230526051529.3387103-1-song@kernel.org> In-Reply-To: From: Song Liu Date: Sat, 27 May 2023 22:58:37 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/3] Type aware module allocator To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, mcgrof@kernel.org, peterz@infradead.org, tglx@linutronix.de, x86@kernel.org, rppt@kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 Sat, May 27, 2023 at 12:04=E2=80=AFAM Kent Overstreet wrote: > > On Thu, May 25, 2023 at 10:15:26PM -0700, Song Liu wrote: > > This set implements the second part of module type aware allocator > > (module_alloc_type), which was discussed in [1]. This part contains the > > interface of the new allocator, as well as changes in x86 code to use t= he > > new allocator (modules, BPF, ftrace, kprobe). > > > > The set does not contain a binpack allocator to enable sharing huge pag= es > > among different allocations. But this set defines the interface used by > > the binpack allocator. [2] has some discussion on different options of = the > > binpack allocator. > > I'm afraid the more I look at this patchset the more it appears to be > complete nonsense. I don't think it is nonsense, as you clearly got most of the points here. := ) > > The exposed interface appears to be both for specifying architecture > dependent options (which should be hidden inside the allocator > internals!) _and_ a general purpose interface for module/bpf/kprobes - > but it's not very clear, and the rational appears to be completely > missing. The rationale is to have something to replace module_alloc(). Therefore, it needs to handle architecture specific requirements, and provide interface to all current users of module_alloc(). It may look a little weir= d at the moment, because the actual allocator logic is very thin. But that's where we will plug in the next step of the work. > > I think this needs to back to the drawing board and we need something > simpler just targeted at executable memory; architecture specific > options should definitely _not_ be part of the exposed interface. I don't think we are exposing architecture specific options to users. Some layer need to handle arch specifics. If the new allocator is built on top of module_alloc, module_alloc is handling that. If the new allocator is to replace module_alloc, it needs to handle arch specifics. > > The memory protection interface also needs to go, we've got a better > interface to model after (text_poke(), although that code needs work > too!). And the instruction fill features need a thorough justification > if they're to be included. I guess the first step to use text_poke() is to make it available on all archs? That doesn't seem easy to me. Thanks, Song