From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E7F721844; Wed, 15 Mar 2023 04:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=+fm5gg8/Uq1/hUSLsqOYKZ0U8+Rw/L1J+vCsy9qYulw=; b=PNMDtgDfbAKs7C81TxBZ7XX2IW vQYJN7bIcIcaqYIfNAYJNfsPJYgAMzBhcAQdu7HAk6CzE0MLJgU4Yq9VMj01zEV7obc/6+vU2rGbA QnV5EK3cgHvMqyUhG4v2DK5X6jguWC5CzFkFZ7g4GE1iahvvWqaCaMmEk7fesaHYcOiKASIH8I6bW 1dUYUL89JoCsQeKyJ0w1xdk2Gwrhe8h4ND/oCvj66s8e4Ds7UFIpy7FQgxS1dHAS64J4ABN/pWU6f t1GDgQQkZO9aM1Cctd3kpTAefO23JazZSwEmWe2z1wBTVJTQZJta9AdB98sV1CRr0rfon4MplE3TD iL7hRT6g==; Received: from [2601:1c2:980:9ec0::df2f] by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1pcIxb-00CIsX-2K; Wed, 15 Mar 2023 04:41:59 +0000 Message-ID: <79fbd52a-9eff-d1d8-e607-41ff52261ad4@infradead.org> Date: Tue, 14 Mar 2023 21:41:59 -0700 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 6.2 073/211] swiotlb: mark swiotlb_memblock_alloc() as __init Content-Language: en-US To: Alexey Kardashevskiy Cc: patches@lists.linux.dev, Christoph Hellwig , iommu@lists.linux.dev, Mike Rapoport , linux-mm@kvack.org, Sasha Levin , Greg Kroah-Hartman , stable@vger.kernel.org References: <20230310133718.689332661@linuxfoundation.org> <20230310133721.005935440@linuxfoundation.org> <2e14e654-e4f1-8c4a-a0ac-60f5e036659a@amd.com> From: Randy Dunlap In-Reply-To: <2e14e654-e4f1-8c4a-a0ac-60f5e036659a@amd.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi, On 3/14/23 01:54, Alexey Kardashevskiy wrote: > > > On 11/3/23 00:37, Greg Kroah-Hartman wrote: >> From: Randy Dunlap >> >> [ Upstream commit 9b07d27d0fbb7f7441aa986859a0f53ec93a0335 ] >> >> swiotlb_memblock_alloc() calls memblock_alloc(), which calls >> (__init) memblock_alloc_try_nid(). However, swiotlb_membloc_alloc() >> can be marked as __init since it is only called by swiotlb_init_remap(), >> which is already marked as __init. This prevents a modpost build >> warning/error: >> >> WARNING: modpost: vmlinux.o: section mismatch in reference: swiotlb_memblock_alloc (section: .text) -> memblock_alloc_try_nid (section: .init.text) >> WARNING: modpost: vmlinux.o: section mismatch in reference: swiotlb_memblock_alloc (section: .text) -> memblock_alloc_try_nid (section: .init.text) >> >> This fixes the build warning/error seen on ARM64, PPC64, S390, i386, >> and x86_64. > > Did you do something special in your config to get these warnings? Or it is your toolchain? I tested with whatever comes with Ubuntu2210 and Fedora36 and neither printed the warning and I want to see those :-/ Thanks, > I have no idea how I got these build warnings. I am using gcc-12.2.0. I don't know what .config file settings that I used. I just tried about 6 different ARCH builds without this patch applied and I cannot recreate the build warnings/errors. Sorry I couldn't help you with this. > >> >> Fixes: 8d58aa484920 ("swiotlb: reduce the swiotlb buffer size on allocation failure") >> Signed-off-by: Randy Dunlap >> Cc: Alexey Kardashevskiy >> Cc: Christoph Hellwig >> Cc: iommu@lists.linux.dev >> Cc: Mike Rapoport >> Cc: linux-mm@kvack.org >> Signed-off-by: Christoph Hellwig >> Signed-off-by: Sasha Levin >> --- >>   kernel/dma/swiotlb.c | 3 ++- >>   1 file changed, 2 insertions(+), 1 deletion(-) >> >> diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c >> index a34c38bbe28f1..ef3bc3a5bbed3 100644 >> --- a/kernel/dma/swiotlb.c >> +++ b/kernel/dma/swiotlb.c >> @@ -300,7 +300,8 @@ static void swiotlb_init_io_tlb_mem(struct io_tlb_mem *mem, phys_addr_t start, >>       return; >>   } >>   -static void *swiotlb_memblock_alloc(unsigned long nslabs, unsigned int flags, >> +static void __init *swiotlb_memblock_alloc(unsigned long nslabs, >> +        unsigned int flags, >>           int (*remap)(void *tlb, unsigned long nslabs)) >>   { >>       size_t bytes = PAGE_ALIGN(nslabs << IO_TLB_SHIFT); > -- ~Randy