Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10167441rwd; Wed, 21 Jun 2023 17:52:21 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6QVTBMFJklfGKsFdFg5gquvRKyeMIjDPWq3nbSpMhYmPS+BYWSfrziSs6kxwYrDyMPblRj X-Received: by 2002:a05:620a:2850:b0:762:552f:a00e with SMTP id h16-20020a05620a285000b00762552fa00emr15516731qkp.19.1687395141596; Wed, 21 Jun 2023 17:52:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687395141; cv=none; d=google.com; s=arc-20160816; b=KJgYmziWoViFYfaSKITVnsduvCKckPDEDMBeXfv2lR5bqJgYv0MhWhRc26FgvEYTWF +IorArLWIZqhrzzDvcHRJ+aAxWUYgELKLeP2JQySWnBZuZTstVAeKdJhIR8CFsT58jFs fIsQX5yUtWdgkVMf8ZPI0g2WKeM1C7MkIUbwX59hmXjPGXuwS1pfHjODooajT01Hdcu5 t+jwR+P0msszjFlDC2mb+6WdmzaHtTAliPD1xVOQbyDBiOHeMZ937Q6vVvCexJG3UCBs 7J/ZE0FxgJnRT39k5vmzuAVhbiPsZMfQHmXSEmC5A6PsRnS7HYILWco6/PGYKMQC6KEf H57w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=Mc4fpIkxrmWFX77cuCPTRDrtxqTugNNR8tCOrUF27gs=; b=XubfbGYKw9GzmAFrlCLstZVLYfKsOalUiWkJnXYKln14c7MBx+T2RVAqa0WPt/KcGD HJAjrZdUtR15tX4G02rtyXoQSiNlF0u5WOneImWtF41G8rkQLCB9P8FmlDqvDDM7dRG2 i/S2kxJ9t9Hpt69p8OIzvpMY0CU0vgpe5nIVGq0iTDkwN84CIk4+WLDSGpqNb19ixEN0 WFxqxDuv1GcYah7ME+NFPVKwVHwhtX5DaTLNOLpR7P2/7twMMTG3EDReqNgs0+SHlDi7 Nm0LqGa41FlBKjQX2+wlQCxMi6tj64GNy/I1Bv26w82Mac3J1V/B6HIW0l1kp26R22wM eZ+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b=C8B1vtlP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u70-20020a637949000000b00534e68cc8f5si638065pgc.270.2023.06.21.17.52.06; Wed, 21 Jun 2023 17:52:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20221208.gappssmtp.com header.s=20221208 header.b=C8B1vtlP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230096AbjFVAKR (ORCPT + 99 others); Wed, 21 Jun 2023 20:10:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229759AbjFVAKP (ORCPT ); Wed, 21 Jun 2023 20:10:15 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93C28C2 for ; Wed, 21 Jun 2023 17:10:07 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-1b51414b080so38771445ad.0 for ; Wed, 21 Jun 2023 17:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20221208.gappssmtp.com; s=20221208; t=1687392607; x=1689984607; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=Mc4fpIkxrmWFX77cuCPTRDrtxqTugNNR8tCOrUF27gs=; b=C8B1vtlPll32edOWojj5xYY/mysKxmH0KcDH0IMNPBiQmP1y8ZQ2vxUdcbLo20jpOh HxoupZR/BRBmpes+fYctj+Z/0grfYdi5s/OxwLd+aO5Y9GEKhvuEp1m6vXFhbRiiKZt9 fes9KO0UhH8i2XYPMbeZq2QOLpeWG+yupcJX0qCfHcyJY/M42vw7iKBWcgHsf5JhSs+S CZiTL6uJpQvNmfDzVl588IPYk33bhNacC03OEA92hsA3YaRvvP9PjQzILKpzrbDNlXA1 4cpd22jujSNuv7pgqYWUnAL0R4q1eQnd9lvvz7UJkdyzHbnzn3gDbYiJZH7yhzgidpp0 2bYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687392607; x=1689984607; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Mc4fpIkxrmWFX77cuCPTRDrtxqTugNNR8tCOrUF27gs=; b=DMfX9ITN7zx/XLzqTlHseav8rnsZmgxpWm3oGfP30o9z3BP+lS/H0KHPT9ue7rFD0A uRvxCE2XgfdowbA2zHnq6Ae5IrO599WiutL+7P+20WeAUz6ddJsZKUQKjJXuzPMYwzfw ZjuseS3Qq+urKT4aD6737+D/0X/PNB5nldxq4DpGJpc/g0KkSmgmdxiix+OIZEf8m4Wr k62l6HOEaNkmDwOFhIbtmJcmDRXwaujLSCdhRUXR9PZZHuRHT74Eb/5eqC6jl9cK0c4M 9wQ8ec727vGlhF2srU8UVGgJjT720kLWyQSew4RkHuXYmEAQekwvnvZRHROMhLNETg8s /ddA== X-Gm-Message-State: AC+VfDxd0dbpNshEw8i26Cp7xo+q8sxCDBDywCwav577RG1JxKpwogUb 62WY075CtLlzqE9L7inciHr8ENCmNXn7HJNnwhs= X-Received: by 2002:aca:2b05:0:b0:39d:5610:b779 with SMTP id i5-20020aca2b05000000b0039d5610b779mr17396238oik.49.1687391819292; Wed, 21 Jun 2023 16:56:59 -0700 (PDT) Received: from localhost ([50.221.140.188]) by smtp.gmail.com with ESMTPSA id p14-20020a63e64e000000b005533c53f550sm3654119pgj.45.2023.06.21.16.56.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 16:56:58 -0700 (PDT) Date: Wed, 21 Jun 2023 16:56:58 -0700 (PDT) X-Google-Original-Date: Wed, 21 Jun 2023 16:56:18 PDT (-0700) Subject: Re: [PATCH 3/7] riscv: mm: Refactor create_linear_mapping_range() for hot add In-Reply-To: <20230512145737.985671-4-bjorn@kernel.org> CC: Paul Walmsley , aou@eecs.berkeley.edu, linux-riscv@lists.infradead.org, Bjorn Topel , linux-kernel@vger.kernel.org, linux-mm@kvack.org, david@redhat.com, osalvador@suse.de, virtualization@lists.linux-foundation.org, linux@rivosinc.com, alexghiti@rivosinc.com From: Palmer Dabbelt To: bjorn@kernel.org Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 12 May 2023 07:57:33 PDT (-0700), bjorn@kernel.org wrote: > From: Björn Töpel > > Add a parameter to the direct map setup function, so it can be used in > arch_add_memory() later. > > Signed-off-by: Björn Töpel > --- > arch/riscv/mm/init.c | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) > > diff --git a/arch/riscv/mm/init.c b/arch/riscv/mm/init.c > index e974ff6ef036..aea8ccb3f4ae 100644 > --- a/arch/riscv/mm/init.c > +++ b/arch/riscv/mm/init.c > @@ -1247,18 +1247,19 @@ asmlinkage void __init setup_vm(uintptr_t dtb_pa) > pt_ops_set_fixmap(); > } > > -static void __init create_linear_mapping_range(phys_addr_t start, > - phys_addr_t end) > +static void __meminit create_linear_mapping_range(phys_addr_t start, phys_addr_t end, > + struct mhp_params *params) Sorry if I missed a v2, but it looks like this fails to build under CONFIG_MEMORY_HOTPLUG=n (as struct mhp_params isn't defined) -- unless I screwed up some merge conflict, but doesn't look like it here. I'm getting CC arch/riscv/mm/init.o arch/riscv/mm/init.c:1252:58: warning: ‘struct mhp_params’ declared inside parameter list will not be visible outside of this definition or declaration 1252 | struct mhp_params *params) | ^~~~~~~~~~ arch/riscv/mm/init.c: In function ‘create_linear_mapping_range’: arch/riscv/mm/init.c:1261:42: error: invalid use of undefined type ‘struct mhp_params’ 1261 | pgprot = params ? params->pgprot : pgprot_from_va(va); | ^~ make[3]: *** [scripts/Makefile.build:252: arch/riscv/mm/init.o] Error 1 make[2]: *** [scripts/Makefile.build:494: arch/riscv/mm] Error 2 make[1]: *** [scripts/Makefile.build:494: arch/riscv] Error 2 make: *** [Makefile:2026: .] Error 2 patchwork is saying something similar . > { > phys_addr_t pa; > uintptr_t va, map_size; > > for (pa = start; pa < end; pa += map_size) { > + pgprot_t pgprot; > + > va = (uintptr_t)__va(pa); > + pgprot = params ? params->pgprot : pgprot_from_va(va); > map_size = best_map_size(pa, end - pa); > - > - create_pgd_mapping(swapper_pg_dir, va, pa, map_size, > - pgprot_from_va(va)); > + create_pgd_mapping(swapper_pg_dir, va, pa, map_size, pgprot); > } > } > > @@ -1288,13 +1289,12 @@ static void __init create_linear_mapping_page_table(void) > if (end >= __pa(PAGE_OFFSET) + memory_limit) > end = __pa(PAGE_OFFSET) + memory_limit; > > - create_linear_mapping_range(start, end); > + create_linear_mapping_range(start, end, NULL); > } > > #ifdef CONFIG_STRICT_KERNEL_RWX > - create_linear_mapping_range(ktext_start, ktext_start + ktext_size); > - create_linear_mapping_range(krodata_start, > - krodata_start + krodata_size); > + create_linear_mapping_range(ktext_start, ktext_start + ktext_size, NULL); > + create_linear_mapping_range(krodata_start, krodata_start + krodata_size, NULL); > > memblock_clear_nomap(ktext_start, ktext_size); > memblock_clear_nomap(krodata_start, krodata_size);