Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1404304lqp; Mon, 15 Apr 2024 05:51:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW6xOv8rHa30W81ZCG8xFizK/KYCaeTNwQMxjy8CG1izIwfP4h8WyFZnN1/fsZ9sEl76Ck5ZpONSrBcNxPGhHjeOtI5MluODl6+MbLlSA== X-Google-Smtp-Source: AGHT+IHT9vSxu4B8Ouk8cWYiVIHOqJAYP1SAHC3JcuztwZQtWQcvIsEGezlVNwsk/8hmbcy35V87 X-Received: by 2002:a05:622a:1386:b0:434:8048:5edc with SMTP id o6-20020a05622a138600b0043480485edcmr11233661qtk.27.1713185516428; Mon, 15 Apr 2024 05:51:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713185516; cv=pass; d=google.com; s=arc-20160816; b=HnmOc2hXtPHi/pdDNyNUa7b9AU8v4xJGV2XvR3o++Q5ldelJTRuGZnz5iCpYwK3q1n hPsvZiFVfleKcn9nSd7j7ZOedIz5pfvSHt/Rq+zJu7pEoFb4cFVFQtpAiIf2THoA5t3v DQ6VEQr/BPC+NGtB3nJZCibeSlkK8zxY+vHtksLrS5TRtxh4CzumcEC3tUctRTEkKC18 UZHTRU8kQOV3KCLnFHy5CroBwB+gyJcVC29+/ZjgI7mJQJ3Hhkbzj8uT7L/6JxIvIQ3G jwN9hUjR+0Y5Gi7tEYDXkDy0DPlfnrPYXYSHfwEF28fFJtJbTE11D0VvleGRLq5tdJ1n lZRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SnC5QhRh3mlXbiY7BQLXM/Gh385CPpYbuU5jeG1ji44=; fh=tROHmlDfjfg1+6mmbznJmnGY/ElJJ4kXP2rXhFrxSAI=; b=0LD+I7UNgVt0BxsZeLMk9i3RhAn3WVsyOV0sRD8Ak2kYe54zt7XbaCJNms0shrEJ8d 4D+lZrrKB7cC1dEBXTZMWrnPM6rhRPZLSN0jmyRc8cRAKbgmYBq2CbpWniCWcR6DZKZv m0xX/ANw2e9kHJIlys6wP1mPxd3ux5KPkYmrJ1blQsJSpDKw6jwW/lAB9lyB/WRmCHGX vhudwktYtdlO1XndJ3Mi6n/Hs4B0YYRE0ZiiJ3eizRVGENtX1B8ABL0byAZH3HkxTAOA ziJqftcC0SChq7oBq4UHmltgCxVo0xO81UpZot9V044ReGVqvuUuLQgTa7Uy0Qlg/YLL PL6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hKFfLh3Z; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-144722-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144722-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 2-20020ac85702000000b00434674d56cbsi10148879qtw.680.2024.04.15.05.51.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 05:51:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144722-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=hKFfLh3Z; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-144722-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144722-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C33771C218CD for ; Mon, 15 Apr 2024 08:04:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4437C36B1D; Mon, 15 Apr 2024 08:03:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="hKFfLh3Z" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C82052C868; Mon, 15 Apr 2024 08:03:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713168236; cv=none; b=HWF4GD2Lxmj906WHA4TLryPBM5gIvdUvuiItwD71mM4VcDQ83wv1Bl5lR7NGw8+RqugD1739KjaEOVObfqiQ52bEWok6yUlCSlWhHpiUH0QsCv7nS0kLb050/lDHRXrnWSbEHJC1KgpFIaYCYNvcEarSZfkBsAc8Sa7VDeStzIo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713168236; c=relaxed/simple; bh=uAA0xNw3uXQEeAj18M82ry2VhWPmemP8F66GIQVJJSo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=rm+izJIVMHv2b3ER5HvDOyanVNOjJPEbRWmDw25wQYLRzjUVIhty5tPZDfEFNwdg7WAIW4XkyYwPmgQm1v2RQeRyaowT8067IkJ6Fz3Md4dWSuUpj4ds46VZ8tIywQoqCOsT1l6j+xmY+fSLxjcYxTOZx7GXLBZIzrcqfuxEjtM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=hKFfLh3Z; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=SnC5QhRh3mlXbiY7BQLXM/Gh385CPpYbuU5jeG1ji44=; b=hKFfLh3ZzFSzJGPDsRiopYa0ZT efNxCJqPzVqpITxLJsqCQRDO/uvf69qkc9BXqmWr7IXteAQce+itGNJYH8NcZtrv9mowEIaYK6OnE zu1E4zjHKlTRzhIC1ZV1QOADiXZdrVLff1qYNP1JR24KuBKOy5EmbA81XuxsDuKJyy+iJ89PdOUI/ efJhNT73J6k+ohWLAe+NOaJ0tLI7iHDK5KHmXtq9go12IpYLvh58Vu6qfltj09NU88Ez/5/ao6M2e ksvVbHfa9e2PLeJq7LlMBgltQx/i+r0JGyYLxMjQF0iD8WvUaOibeLqFhJKeJcs34Gs9iz6tlyZPZ lKITRWCQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1rwHJC-0000000FFhi-3aDy; Mon, 15 Apr 2024 08:03:22 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 12C5730040C; Mon, 15 Apr 2024 10:03:22 +0200 (CEST) Date: Mon, 15 Apr 2024 10:03:21 +0200 From: Peter Zijlstra To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, Alexandre Ghiti , Andrew Morton , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Donald Dutile , Eric Chanudet , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Luis Chamberlain , Mark Rutland , Michael Ellerman , Nadav Amit , Palmer Dabbelt , Puranjay Mohan , Rick Edgecombe , Russell King , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v4 06/15] mm/execmem, arch: convert simple overrides of module_alloc to execmem Message-ID: <20240415080321.GG40213@noisy.programming.kicks-ass.net> References: <20240411160051.2093261-1-rppt@kernel.org> <20240411160051.2093261-7-rppt@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240411160051.2093261-7-rppt@kernel.org> On Thu, Apr 11, 2024 at 07:00:42PM +0300, Mike Rapoport wrote: > +static struct execmem_info execmem_info __ro_after_init = { > + .ranges = { > + [EXECMEM_DEFAULT] = { > + .start = MODULES_VADDR, > + .end = MODULES_END, > + .alignment = 1, > + }, > + }, > +}; > + > +struct execmem_info __init *execmem_arch_setup(void) > { > + execmem_info.ranges[EXECMEM_DEFAULT].pgprot = PAGE_KERNEL; > + > + return &execmem_info; > } > +static struct execmem_info execmem_info __ro_after_init = { > + .ranges = { > + [EXECMEM_DEFAULT] = { > + .start = MODULES_VADDR, > + .end = MODULES_END, > + .pgprot = PAGE_KERNEL_EXEC, > + .alignment = 1, > + }, > + }, > +}; > + > +struct execmem_info __init *execmem_arch_setup(void) > { > + return &execmem_info; > } > +static struct execmem_info execmem_info __ro_after_init = { > + .ranges = { > + [EXECMEM_DEFAULT] = { > + .pgprot = PAGE_KERNEL_RWX, > + .alignment = 1, > + }, > + }, > +}; > + > +struct execmem_info __init *execmem_arch_setup(void) > { > + execmem_info.ranges[EXECMEM_DEFAULT].start = VMALLOC_START; > + execmem_info.ranges[EXECMEM_DEFAULT].end = VMALLOC_END; > + > + return &execmem_info; > } > +static struct execmem_info execmem_info __ro_after_init = { > + .ranges = { > + [EXECMEM_DEFAULT] = { > + .pgprot = PAGE_KERNEL, > + .alignment = 1, > + }, > + }, > +}; > + > +struct execmem_info __init *execmem_arch_setup(void) > { > + execmem_info.ranges[EXECMEM_DEFAULT].start = MODULES_VADDR; > + execmem_info.ranges[EXECMEM_DEFAULT].end = MODULES_END; > + > + return &execmem_info; > } > +static struct execmem_info execmem_info __ro_after_init = { > + .ranges = { > + [EXECMEM_DEFAULT] = { > #ifdef CONFIG_SPARC64 > + .start = MODULES_VADDR, > + .end = MODULES_END, > #else > + .start = VMALLOC_START, > + .end = VMALLOC_END, > +#endif > + .alignment = 1, > + }, > + }, > +}; > + > +struct execmem_info __init *execmem_arch_setup(void) > { > + execmem_info.ranges[EXECMEM_DEFAULT].pgprot = PAGE_KERNEL; > > + return &execmem_info; > } I'm amazed by the weird and inconsistent breakup of initializations. What exactly is wrong with something like: static struct execmem_info execmem_info __ro_after_init; struct execmem_info __init *execmem_arch_setup(void) { execmem_info = (struct execmem_info){ .ranges = { [EXECMEM_DEFAULT] = { .start = MODULES_VADDR, .end = MODULES_END, .pgprot = PAGE_KERNEL, .alignment = 1, }, }, }; return &execmem_info; }