From patchwork Fri May 26 05:15:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Song Liu X-Patchwork-Id: 9872 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp239060vqr; Thu, 25 May 2023 22:20:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4JpflPjuqMTdHDQsSe08eySK73NVyjMoFuLj5TfBdIHAANdVXcGnC0NGD+9sLqszZmeEvO X-Received: by 2002:a05:6a20:4429:b0:10c:2fce:96cc with SMTP id ce41-20020a056a20442900b0010c2fce96ccmr825861pzb.34.1685078442113; Thu, 25 May 2023 22:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685078442; cv=none; d=google.com; s=arc-20160816; b=NYPXaVSOk/sTIHS9PkUBSDhiWlm0sKlaKzo9BJdxmG3IoNr2vNnkFlOoh4H5+4Y89f PZOOT48U7yJiMttVbChNEgF3DJ8yX9+741VBTsrOxBwEWa45AX9MrBzBEogBVLmhykcP h9TqpQU4sGyl6KijUyCqgApFM2I+hhMo4sK7BU6dyAC/IokL9vwYhSeGjHF9WkAqTZZn kd44wjQ0sI0IVXnUhoCVfhfD0gEWkLtBBJMyyuxo2KMGYr3RDGxZVQDLsAppZnndfmrn 1YEbYIkGxqBNTm/SgShu5MZi4JE45colyzBk981kOQMegYSHmwxIG0YOIudBZMlKUChI R4SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from; bh=Kwc7N6vv2sFOcL5m34GkCh6AVSk1gScOwyg/aKwtGWo=; b=oWXG9t4Rtpt+9V7khOSHUOvQIWjXyklmelfQCfHtDntkVEW6u9LVwGthV88XQZo3In eCkKgU1FyqltYcK8+49idw2Iptx5WhlXQGKRXgzVmzI9unVwStoWHqA06Cjhm6DcRa4/ 8VoGx73vpPJI4VWxCClWQJNUwiVQPCkJJvZ5ZqqvtcetmpIDt0XeKW2/nSdvD8FmMV+f 9VwpnwYHLieRkrGGs/CVRGi3V9RWBX6H4E8c0RUKBw0TxLU0cdWfKaPwmjuvQqRubbzj j75bqxXJmwzGI03jaCMIjB/vgrgMvfO+9vsF42GFaqHeZuaQ5EpDfkFhy6Je5daIowV0 R2fw== ARC-Authentication-Results: i=1; mx.google.com; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m21-20020a638c15000000b0053417caf94csi3001969pgd.722.2023.05.25.22.20.28; Thu, 25 May 2023 22:20:42 -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; 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 S241979AbjEZFQP convert rfc822-to-8bit (ORCPT + 99 others); Fri, 26 May 2023 01:16:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbjEZFQM (ORCPT ); Fri, 26 May 2023 01:16:12 -0400 Received: from mx0b-00082601.pphosted.com (mx0b-00082601.pphosted.com [67.231.153.30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3ADE187 for ; Thu, 25 May 2023 22:16:11 -0700 (PDT) Received: from pps.filterd (m0109331.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34PKnwNZ009618 for ; Thu, 25 May 2023 22:16:10 -0700 Received: from mail.thefacebook.com ([163.114.132.120]) by mx0a-00082601.pphosted.com (PPS) with ESMTPS id 3qt3t6q3mp-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Thu, 25 May 2023 22:16:10 -0700 Received: from twshared18891.17.frc2.facebook.com (2620:10d:c085:108::8) by mail.thefacebook.com (2620:10d:c085:21d::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Thu, 25 May 2023 22:16:07 -0700 Received: by devbig932.frc1.facebook.com (Postfix, from userid 4523) id 60E301E38AFE6; Thu, 25 May 2023 22:15:53 -0700 (PDT) From: Song Liu To: CC: , , , , , , , Song Liu Subject: [PATCH 0/3] Type aware module allocator Date: Thu, 25 May 2023 22:15:26 -0700 Message-ID: <20230526051529.3387103-1-song@kernel.org> X-Mailer: git-send-email 2.34.1 X-FB-Internal: Safe X-Proofpoint-ORIG-GUID: 7VxM5-OhACkQs5pdd26HVY8ObZNuINL- X-Proofpoint-GUID: 7VxM5-OhACkQs5pdd26HVY8ObZNuINL- X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-05-26_01,2023-05-25_03,2023-05-22_02 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766932812492473781?= X-GMAIL-MSGID: =?utf-8?q?1766932812492473781?= 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 the new allocator (modules, BPF, ftrace, kprobe). The set does not contain a binpack allocator to enable sharing huge pages 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. [1] https://lore.kernel.org/linux-mm/20221107223921.3451913-1-song@kernel.org/ [2] https://lore.kernel.org/all/20230308094106.227365-1-rppt@kernel.org/ Song Liu (3): module: Introduce module_alloc_type ftrace: Add swap_func to ftrace_process_locs() x86/module: Use module_alloc_type arch/x86/kernel/alternative.c | 37 ++++-- arch/x86/kernel/ftrace.c | 44 ++++--- arch/x86/kernel/kprobes/core.c | 8 +- arch/x86/kernel/module.c | 114 +++++++++++------ arch/x86/kernel/unwind_orc.c | 13 +- arch/x86/net/bpf_jit_comp.c | 22 +++- include/linux/ftrace.h | 2 + include/linux/module.h | 6 + include/linux/moduleloader.h | 75 ++++++++++++ init/main.c | 1 + kernel/bpf/bpf_struct_ops.c | 10 +- kernel/bpf/core.c | 26 ++-- kernel/bpf/trampoline.c | 6 +- kernel/kprobes.c | 6 +- kernel/module/internal.h | 3 + kernel/module/main.c | 217 +++++++++++++++++++++++++++++++-- kernel/module/strict_rwx.c | 4 + kernel/trace/ftrace.c | 13 +- 18 files changed, 493 insertions(+), 114 deletions(-) --- 2.34.1