From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21866C433EF for ; Wed, 2 Feb 2022 23:49:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9F6118D011F; Wed, 2 Feb 2022 18:49:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A5F28D0119; Wed, 2 Feb 2022 18:49:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 822E68D011F; Wed, 2 Feb 2022 18:49:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0149.hostedemail.com [216.40.44.149]) by kanga.kvack.org (Postfix) with ESMTP id 6E1918D0119 for ; Wed, 2 Feb 2022 18:49:03 -0500 (EST) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2A571181BF883 for ; Wed, 2 Feb 2022 23:49:03 +0000 (UTC) X-FDA: 79099482966.04.747B932 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf19.hostedemail.com (Postfix) with ESMTP id 723E21A000A for ; Wed, 2 Feb 2022 23:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=dcnAz8tCoaicOwm8UwBmt1xaDF3i1/7+mqYajUH4SfM=; b=GlERCyG3JxZhciig/yUUTOOt7N qDoQxeWCdsfxJmVQC80mVru0TdX48Bwquf6XlXLN6cKFPd0tqQEtcIZ0guQ8UznK2bwgiK+aX9QyM tg0vhEoUE314QlaB3x2ldubznkAfUFvaqRGlBG/QV8ADLL/bR5YQyNFHFs74NZqoflXmUEB1yzFcd YNQmFeDMhVGvUY3iXOvG302NzsrFECQ0ifrcpwzlnD8zntWf+rWtUqZ7OHGjqOBoNDXrcjiOimMhe qlvny4kHhR/csemsRaASlE9jSggbTVPgM++bWyxk/ytynA8TPgRCaxKOJNPv7nsTZBYyjju9Y1DWt ly8Ba3tQ==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFPMu-00H5lz-Mt; Wed, 02 Feb 2022 23:48:56 +0000 Date: Wed, 2 Feb 2022 15:48:56 -0800 From: Luis Chamberlain To: Christophe Leroy Cc: Jessica Yu , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "kgdb-bugreport@lists.sourceforge.net" , "linux-mm@kvack.org" , "linux-arch@vger.kernel.org" Subject: Re: [PATCH v3 3/6] modules: Introduce data_layout Message-ID: References: <230bfd896f24ca7a9281783aaa8c0ebfebd0bc7e.1643475473.git.christophe.leroy@csgroup.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <230bfd896f24ca7a9281783aaa8c0ebfebd0bc7e.1643475473.git.christophe.leroy@csgroup.eu> X-Stat-Signature: reeppg1kkkug8jej8soxem147wxzxy6a X-Rspam-User: nil Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=bombadil.20210309 header.b=GlERCyG3; spf=none (imf19.hostedemail.com: domain of mcgrof@infradead.org has no SPF policy when checking 198.137.202.133) smtp.mailfrom=mcgrof@infradead.org; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=kernel.org (policy=none) X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 723E21A000A X-HE-Tag: 1643845742-582609 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Jan 29, 2022 at 05:02:07PM +0000, Christophe Leroy wrote: > diff --git a/kernel/module.c b/kernel/module.c > index 163e32e39064..11f51e17fb9f 100644 > --- a/kernel/module.c > +++ b/kernel/module.c > @@ -81,6 +81,8 @@ > /* If this is set, the section belongs in the init part of the module */ > #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1)) > > +#define data_layout core_layout > + > /* > * Mutex protects: > * 1) List of modules (also safely readable with preempt_disable), > @@ -2451,7 +2454,10 @@ static void layout_sections(struct module *mod, struct load_info *info) > || s->sh_entsize != ~0UL > || module_init_layout_section(sname)) > continue; > - s->sh_entsize = get_offset(mod, &mod->core_layout.size, s, i); > + if (m) > + s->sh_entsize = get_offset(mod, &mod->data_layout.size, s, i); > + else > + s->sh_entsize = get_offset(mod, &mod->core_layout.size, s, i); > pr_debug("\t%s\n", sname); Huh why is this branching here, given you just used mod->data_layout in all other areas? > @@ -3468,6 +3474,8 @@ static int move_module(struct module *mod, struct load_info *info) > if (shdr->sh_entsize & INIT_OFFSET_MASK) > dest = mod->init_layout.base > + (shdr->sh_entsize & ~INIT_OFFSET_MASK); > + else if (!(shdr->sh_flags & SHF_EXECINSTR)) > + dest = mod->data_layout.base + shdr->sh_entsize; > else > dest = mod->core_layout.base + shdr->sh_entsize; > Likewise here. Luis