Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8252833rwl; Tue, 10 Jan 2023 10:54:00 -0800 (PST) X-Google-Smtp-Source: AMrXdXvTKeTUY7Ah/y/bWCFyhiC/o21MxQVwraCXUarIdlFk0caBWi8LnI7S3KmrJmr6iumf55// X-Received: by 2002:a05:6a20:4c20:b0:b0:c30:1de with SMTP id fm32-20020a056a204c2000b000b00c3001demr74242812pzb.61.1673376840573; Tue, 10 Jan 2023 10:54:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673376840; cv=none; d=google.com; s=arc-20160816; b=TSA/mTOJq5VuyPsaH8Ln1A9haFlU+Ne7GRWuZ+G5BpsceBLxP7NnyxnIhtxzkfo7DY XzMMLivnzTASKNxQoCf/FZ9+hBplr9C9GG8sl3NrqILYS194K27Dtap2uCFHUJURbLSe mtdUxDAssNyW16Ki6uiwdiTPaQ2A4kpAImedTN5e5bT+si4dgU6C45xJuFbjcaFGx6wN zOPH+EtDOuT3hg9NILjYP51/QmrlugMwXH11apeuS+kWxQwmOITXkRzsRVmRUZFlHnqd fXaZmM5g/LmCjehI3KFrYkFofZiDBHeVMdfM+2+JoQXzqtOQaLk7Ay9UUNoYsJIzCJ6r URXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=5+oILeexzh7iOyGyGO6Kw/nY+5vq529ebtP/RusdIkQ=; b=WlRKRSbpUR48QUk98Qdd5hbx8EStQzyYzJ3d9yytHSMa9zBe8z7DKhWXZXznQucAur lWMJQCGqf5tQA5Z2lD/3Pxrkr/qlW21TpnuYexHtQRuWKcNaP3KqtK3k2M5YQNAHuJ7Y QkhsuLmrRhOYQ+7Q9agONF3SgRqJtUQBR0w42BZDCtxKF2aOUiyG4GVebZwWO1hlF3W2 KjXs5qg1cwaDQi7cyC5Ot023wuW1gqJtmJJhto1oyz+g07ASkYnAHGTpMtnB8nG8Njq7 EkivMP/j7/D+4UcFTpWc6+6OK6/J6paD/M1FDEiziaLkkybb3/ILQZlrsb2KAanPLiMl PsvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CSsqhlGs; 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 i9-20020a63b309000000b004a35ab22b58si12074564pgf.614.2023.01.10.10.53.54; Tue, 10 Jan 2023 10:54:00 -0800 (PST) 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=CSsqhlGs; 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 S239398AbjAJSha (ORCPT + 53 others); Tue, 10 Jan 2023 13:37:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239572AbjAJShN (ORCPT ); Tue, 10 Jan 2023 13:37:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF55A59501; Tue, 10 Jan 2023 10:32:11 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id 4D3CAB81908; Tue, 10 Jan 2023 18:32:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F06FAC43398; Tue, 10 Jan 2023 18:32:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1673375529; bh=QUdSPSJ1dS3+KOPixtik4EX+QpdImlvJMwhGplzoJI4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=CSsqhlGsZ3rRP6uogxNQuvYFRLwxQJkenVKpMsdfhh4VCenx4M2sOzB4c5cubXYVE Zp6PZXsbBcAQ1md7ssc9o/pna7r9YbilGa92ctHfDXSZx4VJWwTMAxcFgNM5KkZ7OD muIFhcHZ9gBcnfvZZHoYeC94JvDCuuOd+Ho1dVM7kZ3vQa4ZZEbmgB2wMP6WnqIxn/ Bc/ek0tDQOWVXcxYE2a23jB2+F7ZAldB1W2X5HyuShyfZRgX8aFpGEjOZnknglWsnN MA6E691iXWt2TZ+Lo1D7Tjg7nP9w/IGuS5LFd79fF0HFevblP3Hv5hTeKbSiJr8pWO gr9Ak3EVCOumA== Received: by mail-lj1-f179.google.com with SMTP id p25so7278801ljn.12; Tue, 10 Jan 2023 10:32:08 -0800 (PST) X-Gm-Message-State: AFqh2krCEq6Gt4vXrHVsM25oXqnEvws13/+kgUBM+qAcokYmtcUSlfOh 3IMNJaT6dooknfrooh7ZFygSAAnPr7TihBIaMhM= X-Received: by 2002:a2e:bd11:0:b0:280:54b:9ed5 with SMTP id n17-20020a2ebd11000000b00280054b9ed5mr994803ljq.414.1673375526906; Tue, 10 Jan 2023 10:32:06 -0800 (PST) MIME-Version: 1.0 References: <20230106220959.3398792-1-song@kernel.org> In-Reply-To: <20230106220959.3398792-1-song@kernel.org> From: Song Liu Date: Tue, 10 Jan 2023 10:31:54 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH/RFC] module: replace module_layout with module_memory To: linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org, Christoph Hellwig Cc: songliubraving@fb.com, Luis Chamberlain , Thomas Gleixner , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" 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 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 + Christoph Hi folks, Could you please share your comments on this work? If there isn't major issue with it, maybe we can ship it in 6.3? (so we don't pile too many changes in one big set). Thanks, Song On Fri, Jan 6, 2023 at 2:10 PM Song Liu wrote: > > module_layout manages different types of memory (text, data, rodata, etc.) > in one allocation, which is problematic for some reasons: > > 1. It is hard to enable CONFIG_STRICT_MODULE_RWX. > 2. It is hard to use huge pages in modules (and not break strict rwx). > 3. Many archs uses module_layout for arch-specific data, but it is not > obvious how these data are used (are they RO, RX, or RW?) > > Improve the scenario by replacing 2 (or 3) module_layout per module with > up to 7 module_memory per module: > > MOD_MEM_TYPE_TEXT, > MOD_MEM_TYPE_DATA, > MOD_MEM_TYPE_RODATA, > MOD_MEM_TYPE_RO_AFTER_INIT, > MOD_MEM_TYPE_INIT_TEXT, > MOD_MEM_TYPE_INIT_DATA, > MOD_MEM_TYPE_INIT_RODATA, > > and allocating them separately. > > Various archs use module_layout for different data. These data are put > into different module_memory based on their location in module_layout. > IOW, data that used to go with text is allocated with MOD_MEM_TYPE_TEXT; > data that used to go with data is allocated with MOD_MEM_TYPE_DATA, etc. > > Signed-off-by: Song Liu > Cc: Luis Chamberlain > Cc: Thomas Gleixner > Cc: Peter Zijlstra [...]