Received: by 2002:ab2:6991:0:b0:1f7:f6c3:9cb1 with SMTP id v17csp684376lqo; Wed, 8 May 2024 11:26:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/bVGnvmQIywzbPOuRpL9PI7uNCXA507j//B4uMlrw3ItCRhJ2HpDxsvFXJYnFrZvOQQm9HTwcYmt8fNaK5wzNDUtM4dAzMvy5vBwejg== X-Google-Smtp-Source: AGHT+IE8SWgBKkMvIgwgfb3esRf1T9KmcC7r3pOAU1ebBkt2xrN+EGP2h4j4XFVjb2vrHL7nm2Cv X-Received: by 2002:a05:6300:8002:b0:1af:ad01:315f with SMTP id adf61e73a8af0-1afc8d8ed04mr3058469637.40.1715192800118; Wed, 08 May 2024 11:26:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715192800; cv=pass; d=google.com; s=arc-20160816; b=Mw/Ez4cMEd0DYyOoZip4vwiX8h3tbb7KQccAW3+4gLfE0oXVNG8/5CZQ6+8/LuJj9a Yn5QK7ycBktZKq/y3RULQsheXBZmXu7pqDAk85xjFWCGYYAIq2H1sgILN/cnJQG3rtcL /zaSk5g/PuQBNaInOnIQrkW/xoPn7I32O2r3AnaVrpI+y9B8mMsr0uwLihb6cw6xGPD7 bxtrxGlTlCjN5b+gPx79JrsqusY7tnOfIOre14OYoknLCQ6HgagsXav5W4Nw9gezlsFN VjrC34v+zyQUD3rtyYy3o8Uvu2Z4EwgWxceNY6jzTdPGZYVwoRtHM1rBglgHSRl2WVug +xOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=D8T+eyTvNUWPwIJq8yHMnr2Ap1GT801koHlLiAOjXsY=; fh=cY2M5pyFT4bUObSFz+Z/7SeN8zpECSJo3kJpEdw3e4k=; b=0a7ZKkAD1dT/91NwHmwpyKx2fMtaopVTnO9G1z0TIV+4kEzVf6jGuDNsEX0uM0z7bE cz+uvl1hIZU4TAghABWo/QR3a002dht2Q6H7iLvkTJultIcS7b8a4ztxvnHW3UO8QnO1 APdo4+gIVZ0Sh47beYdXyivu5U1pzwQxgBMCoMNW9LhiQmtqbFwufnTyHC8VW39njCjV +PnKeEj5mOuO2kHoB6q/L01TZlb4MdX6CUt+31gJm9+yQeB/X81AO0hmRwXn5INvE8lx pmAk2OCmgI5DOfW3BjfAuJKAuSyJYbAB8YuSGDhxRsKPOfCkvDHEYj6nTS+YUv+m0Pbv eOUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-173697-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173697-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d4-20020a056a00244400b006f3ebe86ea5si8972713pfj.193.2024.05.08.11.26.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 May 2024 11:26:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-173697-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; arc=pass (i=1 spf=pass spfdomain=ghiti.fr); spf=pass (google.com: domain of linux-kernel+bounces-173697-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-173697-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C1C6128657D for ; Wed, 8 May 2024 18:26:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FBD312C81D; Wed, 8 May 2024 18:26:34 +0000 (UTC) Received: from mslow1.mail.gandi.net (mslow1.mail.gandi.net [217.70.178.240]) (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 C48F454FAA for ; Wed, 8 May 2024 18:26:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.178.240 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715192793; cv=none; b=CYi7iWvgZvbnN6+4VkS5hk0AhAqEL51Cz/VtLLivq0Of2qXqG6wpq2Rs8FkKHJ9FWbQhAeAhkgg9T61JfRLRf9NY4GKOwdxrdBuJ4WWB1htdY4SuCk0/1NvM7q9ji1BRGe8nTC04emhPf2rIT7gbkL9pO02mPhnjT2dvullX7qE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715192793; c=relaxed/simple; bh=oIvO6wRDB+Tamjd+aYPlKckkBTBydH1MgXq4hju3B7o=; h=Message-ID:Date:MIME-Version:Subject:To:References:From: In-Reply-To:Content-Type; b=i3nSKv3uizK2kyZuTupbxHd0ndWH1m/tSpSNbRp1sJPYqZkglXI802PlVP/5Dm+JwGTHH30X1IyvALs4L7lr2H+I+Qn24/JcrUWfs4O4lHZjMJmv6KI7x3gYxLjtkoKtL4wdz+p5TVg4+jQiWlVzigRdLIAA4qLV7Kftt+pVhis= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr; spf=pass smtp.mailfrom=ghiti.fr; arc=none smtp.client-ip=217.70.178.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ghiti.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ghiti.fr Received: from relay2-d.mail.gandi.net (unknown [217.70.183.194]) by mslow1.mail.gandi.net (Postfix) with ESMTP id B92D0C546E for ; Wed, 8 May 2024 18:22:48 +0000 (UTC) Received: by mail.gandi.net (Postfix) with ESMTPSA id D5E4040005; Wed, 8 May 2024 18:22:43 +0000 (UTC) Message-ID: <43829e94-98ae-46a4-a3e6-dbabbe94d7c1@ghiti.fr> Date: Wed, 8 May 2024 20:22:43 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] riscv: Don't use hugepage mappings for vmemmap if it's not supported Content-Language: en-US To: Nam Cao , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240508173116.2866192-1-namcao@linutronix.de> From: Alexandre Ghiti In-Reply-To: <20240508173116.2866192-1-namcao@linutronix.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Flag: yes X-Spam-Level: ************************** X-GND-Spam-Score: 400 X-GND-Status: SPAM X-GND-Sasl: alex@ghiti.fr Hi Nam, On 08/05/2024 19:31, Nam Cao wrote: > Commit ff172d4818ad ("riscv: Use hugepage mappings for vmemmap") broke XIP > kernel, because huge pages are not supported on XIP kernel. I don't understand why XIP kernels can't support huge vmalloc mappings, so I think the right fix would be to enable such mappings on XIP. WDYT? Thanks, Alex > > Only use hugepage mapping if it is supported. > > Fixes: ff172d4818ad ("riscv: Use hugepage mappings for vmemmap") > Signed-off-by: Nam Cao > Cc: Alexandre Ghiti > Cc: > --- > arch/riscv/mm/init.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index 968761843203..c081e7d349b1 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -1414,6 +1414,8 @@ int __meminit vmemmap_check_pmd(pmd_t *pmdp, int node, > int __meminit vmemmap_populate(unsigned long start, unsigned long end, int node, > struct vmem_altmap *altmap) > { > + if (!IS_ENABLED(CONFIG_HAVE_ARCH_HUGE_VMAP)) > + return vmemmap_populate_basepages(start, end, node, NULL); > /* > * Note that SPARSEMEM_VMEMMAP is only selected for rv64 and that we > * can't use hugepage mappings for 2-level page table because in case of