Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp550267rdh; Wed, 14 Feb 2024 05:04:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXrOoJmZvERIlh2l2LUDbv3Gqjmc+ELIINfnat369e9PPKLq/k+nwVET3Wbt2Em+KUzzXA1s3K7BK3yq3sCjzyAUTpXfVZhyzAxwo/Hzw== X-Google-Smtp-Source: AGHT+IGi/e/gGeFNZqxbeYxFnsmMNGLH6KBtcUFGEs9q7GDn8mRs4kvxHSM5lfgzcK9+JGQqo/YR X-Received: by 2002:a17:902:c085:b0:1db:4ff7:ff48 with SMTP id j5-20020a170902c08500b001db4ff7ff48mr2285441pld.4.1707915871790; Wed, 14 Feb 2024 05:04:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707915871; cv=pass; d=google.com; s=arc-20160816; b=esRs1jXoW8YEaJuhYSYR8uKJdkdlciLglc0oTe5DSM/xP44MbLrBZjKs2SHw/DyzON EbVIS9emH+gfo1LW7Hry4XzBjPj8IeAL/kcul5ndYJeTGbRSxYlAeeS3Lu+YVuME1OWn 5M+35zE5t9yVSImzi+KQ8ufSzimMT2fXYrq4NzrNlDnn2Tf6/MXeTg9NIdOrBiFb9mXp 0nE7nl7XHJ0LF8iRKCCr+4ATi1WD+fzRLZ6Yszn1dVCY/A0UCeh+1HSs8KoFtDRTM/Uf 9CYhdbk4dhUYBkV6bcaPQ0viqKmJTY6YiT/jKRZP4fntaIa7uvCn7vaXkuEJA0eWhZwJ /vgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=GY7SyO6DdWt4KGxuog+0hZ4WNb0gii73bMjT/XYvQ/w=; fh=nBCFhpgf3+FQjFS7RoNCMgy3jY9COEYwNgCW35sGcl0=; b=cfeAEu/Am6Fj9kJnO/fmv1+aRoDf8r7ubaCzXIK0UqsMwhAeD1vBBRaGaV9npWFcf6 fLJ/yziTSVlc3OyW+swcONezCvT3HnUFyk08bS1bAKsfxxIQ4mVXWb3oEEJWSBnVCHMF L0N7OWksqRxE4gPH/RNGjRHvE418Kx59kbglQpenxNPS1cCcDP3VcDRpCfEklxiKHg+9 idpsoo2hREVA9WeILSXsCSF8cAX8+az4xpa3J4G0eI6SkCo6bQzJIibco8VmUbsDUP4d ZHb8wEITnFEPiUNV8eitH31RgSMS9V5/8iCX54CyIBAqIucIfp1ywuiQ6WU+ZNl+gPzI t78w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AvcT8YJo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-65245-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCVNBRoPtP/dV0cJuwkS/qLGLU9g4TjOOU9TCbcDzSyJR5IppCJ0cEdFdQRAuR8AZVeusL7MCTzd+Xi4Db92tHS5v3XZ8eP86qyOQYOT8Q== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t18-20020a170902d21200b001db28c458a4si3644897ply.262.2024.02.14.05.04.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 05:04:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65245-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AvcT8YJo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-65245-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65245-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C31A628A8A4 for ; Wed, 14 Feb 2024 13:04:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78D1E5338D; Wed, 14 Feb 2024 13:03:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="AvcT8YJo" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 976D21B813; Wed, 14 Feb 2024 13:03:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707915834; cv=none; b=AbtcI12rcK0k+LFosUNwilX5LDGML94EqQ2QUAqs4qJJySDSWXDwpjVNoCbSmhqyuRzHLTGHKsM0cuu5iswQZZvYJMeV9JGnEB/UubS8LAp/9dwl2JJtvRitcOPvPqzB49/n03J7WlJkhFAov0qlX2jGvgGxguE2H4Gn0HpyWyQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707915834; c=relaxed/simple; bh=Y5cCv6WN3AG3tMIqacma1w2YSEMZ6JaBHyisxC12c9w=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UXwdbTZSOrryKwlob7xGvdHrK4UUVzJn84vpVQdAP6stEDNCDdGfHvgLeWIGTD+5iSzKQP4j1qTKWTuON/7bWW9lEeZq5FN31HCjLE3FoXMrYIx8dv13bEhRLBx9CgVmOj6cspIu2LMje01qFLxhDLQ2GR8+/jI0IwGBc7nLgwY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=AvcT8YJo; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FED8C43143; Wed, 14 Feb 2024 13:03:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707915834; bh=Y5cCv6WN3AG3tMIqacma1w2YSEMZ6JaBHyisxC12c9w=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=AvcT8YJoQNZs8sfRDTkmYygA8l0Kza6K8KEPY6U7YF/29oo0kvqwp44UZBHOO9osR TK4RFyjNq+qR4wlkN6n+/wJeiSFhvBNfCAObgM80sJtGSwoUvEgYM7erDzssa3Fx8B rxHRY+UhSYZjUxn+MgyDUGzHqPBf7DIS2+9n2BX6DogXsBakeZgX3CVQ6HNVmQJ2H9 yg/6H+xw9ZzE5Sxgpwj4QToZs1eY5dOaaUEd2NWIZNm3z+/fcmPObmj+mQtJQzz4e3 leKlh4ZGTJMSOlFYXtUASBH4/14g80J141xiKM29JjkRFxnMLfX5eKDJcXmKTbLqrx cYW5Fi/ic4yUA== Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5638aa9a5c2so529040a12.3; Wed, 14 Feb 2024 05:03:54 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWD6j/DH0k7FIsBz9pEDIpD8O8mzLMWlyx9IzfvbXEUGGoOQO/vT2OHGcnqNWdYdXVO/ROcW6ElcmFJLpNFgtkPpuxueGhmfpU/u+ndLuG+SJNzXmAX07OuJjsxmyO1j3A5d6f/7N2LJkPK8dOpwbL5z0LWsfYK94qc911wogbZ3P2N3vMHUfVQ98BddLknqdh24pK9kuwXy+9j1DWu0aY/xXU= X-Gm-Message-State: AOJu0YwqZyjH+kx1ouDtvBdKHvfwwQicj386I1Xn5gNDdtZmfdbN2x+q 7ZirB/LGfgQSufG3l/iN1qcFXTnisuguHLg0N1VsYjikMFrlGkidyaiIT+tnMoJuJpkPyhmhtLZ 6F8rFK+Sj/J/Y0c9lZOQUG1gLZ18= X-Received: by 2002:a05:6402:514f:b0:562:9f3:afeb with SMTP id n15-20020a056402514f00b0056209f3afebmr1987648edd.20.1707915832828; Wed, 14 Feb 2024 05:03:52 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <1707524971-146908-1-git-send-email-quic_obabatun@quicinc.com> <1707524971-146908-2-git-send-email-quic_obabatun@quicinc.com> In-Reply-To: <1707524971-146908-2-git-send-email-quic_obabatun@quicinc.com> From: Huacai Chen Date: Wed, 14 Feb 2024 21:03:49 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] loongarch: Call arch_mem_init() before platform_init() in the init sequence To: Oreoluwa Babatunde Cc: jonas@southpole.se, stefan.kristiansson@saunalahti.fi, shorne@gmail.com, ysato@users.sourceforge.jp, dalias@libc.org, glaubitz@physik.fu-berlin.de, robh+dt@kernel.org, frowand.list@gmail.com, linux-openrisc@vger.kernel.org, loongarch@lists.linux.dev, linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, kernel@quicinc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, Oreoluwa, On Sat, Feb 10, 2024 at 8:29=E2=80=AFAM Oreoluwa Babatunde wrote: > > The platform_init() function which is called during device bootup > contains a few calls to memblock_alloc(). > This is an issue because these allocations are done before reserved > memory regions are set aside in arch_mem_init(). > This means that there is a possibility for memblock to allocate memory > from any of the reserved memory regions. > > Hence, move the call to arch_mem_init() to be earlier in the init > sequence so that all reserved memory is set aside before any allocations > are made with memblock. > > Signed-off-by: Oreoluwa Babatunde > --- > arch/loongarch/kernel/setup.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/loongarch/kernel/setup.c b/arch/loongarch/kernel/setup.= c > index edf2bba..66c307c 100644 > --- a/arch/loongarch/kernel/setup.c > +++ b/arch/loongarch/kernel/setup.c > @@ -597,8 +597,8 @@ void __init setup_arch(char **cmdline_p) > parse_early_param(); > reserve_initrd_mem(); > > - platform_init(); > arch_mem_init(cmdline_p); > + platform_init(); Thank you for your patch, but I think we cannot simply exchange their order. If I'm right, you try to move all memblock_reserve() as early as possible, but both arch_mem_init() and platform_init() call memblock_reserve(), we should do a complete refactor for this. And since it works with the existing order, we can simply keep it as is now. Huacai > > resource_init(); > #ifdef CONFIG_SMP > --