Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2927142lqo; Tue, 14 May 2024 13:51:12 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWN02qEVVMbqQN3zb8qlICZo/X3RX7Snz/wMQWpTpjy147y31fPrIHS+6/8SFolIrsUhGb0tgd1/dEyed1Gh+mSwiJlEo7+VTwIlCgHqA== X-Google-Smtp-Source: AGHT+IGwgiOHoomlWUYFxGfgd9DjCtRZSy/4stY6vW7ZmXuBZyaScuR4QFBdywBNYsI8ZGiNFWnI X-Received: by 2002:a05:6a20:969b:b0:1af:cf0c:95a1 with SMTP id adf61e73a8af0-1afde0dc82bmr12481122637.21.1715719872495; Tue, 14 May 2024 13:51:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715719872; cv=pass; d=google.com; s=arc-20160816; b=uDWOevCFMLRRcuvlAlhHTT9n+53XaxPgCxfm6LikHX/UbhRsnaFqlC+a/h0mykmV9X PVhV7Lc0KmJpnshXMkJp2Q410/WnIukoOb+nbNyi12EZgyeRd4za4bp0xS+xmVMe8cMy QZCsrKIajc93moUZMwgCmMLGGgyVcOXmxkcbpU0oPCaiJ8URlVqwZkg+M/kEaGSn6DGW vhOhILo/hBZ1wsBGcdCnqsDOHU+80WjQ/adfG6KwloWn5opF0oa0jhXOxYY+Ka5wn6hD ZjsTqNfECmQJJiUIjZSILboFhxWm9LjbnbBzntBhI6+EHNoX0unFcHpdKjYiwopRmZwJ Jw3Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=G8/TImExnPcn0/P4PnWsqrauOrC1YnmySZaU3kuuKQg=; fh=wEiMiW2Sn0oGK4b8yKj/oMA/PpvDwOj4jA+xBYuqt3Y=; b=qr4HUNB2nCcfkZ8IbtPbeXn9LpBieekie3DIIDZb1Kgy76cnDMDYQw3PJ1+TXqj0p2 A9bdjAze6MLhmOSox3d4eMK1G98ZCySVii7U/G4/zPvpei9t3y8JZGl7xNhFq6dHUtYw t3u4nG6W6tdYAFADXTSJHUJmOy9wcCtFj2VYhrs5OO4Bot0wd4s/QUS5y0m6wcB+pmLC /FtWzMHxyCg9uG6i7zHo3WTqj50facdlWH0mIW6L6s3qRwhLRaK44lhAfZlwk95TwoKq hZOkG1F/iIVb6EP212GCCDphjzLlSFdaBuWOELQeRj5gWggtn9JxRLp7Bp293iAJOYwu CqMA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mKTR+aaK; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mKTR+aaK; dkim=neutral (no key) header.i=@suse.de; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-179160-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c26a435si123438165ad.612.2024.05.14.13.51.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 13:51:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179160-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mKTR+aaK; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=mKTR+aaK; dkim=neutral (no key) header.i=@suse.de; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-179160-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179160-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 9CE8CB2288F for ; Tue, 14 May 2024 20:50:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C853C18131F; Tue, 14 May 2024 20:49:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="mKTR+aaK"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="k9frE569"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="mKTR+aaK"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="k9frE569" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A9082A1D4 for ; Tue, 14 May 2024 20:49:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715719789; cv=none; b=laSr0U1FI6ANup6+8s47UZZWyht2t9Ij7GdSydSC5SelEuy0v4/9CSiWWIizSvhVpAtd7eXWLm8Iv7w8NCsVz5fVtdg4y/onAOfQ6CRk2tK2+15gToC7ySCocLgDxRN+1yQ/hWELQntSfrEdw606fyJ5rc02guspsScAjzrltds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715719789; c=relaxed/simple; bh=JWldUvsrnIWGGZLfJMS4s8rA7OagaQQUPi1HdgCX6b8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=s7LUaJc2BH0taaayIiF+Nr7QEdzurNdXJMfkUn3ikOSI4kiXum5oza2er9d3OsxWwF0/uJ7FzQpwWCM6kvM72Y6gwE7ndTOEtk0eXpUmOEhUARFihcz9HGc4LVZoaj/X8RjcULSPWf+rsp/lHqODc+K7b1I+tJv0VRxaM0PYUHc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=mKTR+aaK; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=k9frE569; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=mKTR+aaK; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=k9frE569; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 862361FB6C; Tue, 14 May 2024 20:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715719786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G8/TImExnPcn0/P4PnWsqrauOrC1YnmySZaU3kuuKQg=; b=mKTR+aaKzODX7Bm5w+mkknOuaO+jQQbCeLDym0is6AC8PmHYyN73dBi0/hYTnEDofuxj8I Kx6PgXdk12mRN2ld6Yd4E5D27Hlf5mWPJFCGPgE+QXWp915yIRKXeXXDemrCc4ZBJYCb1k WOoKWXyX5jM/nzSiNnnqm5xz7ai09fQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715719786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G8/TImExnPcn0/P4PnWsqrauOrC1YnmySZaU3kuuKQg=; b=k9frE569ZnCt5JYUlUd2v5N4OV51TvkKRoEmTpdpMQ2eEuLOUzTKFZAGFr82Xh1MKEl6Qr 0iBt6+BWhUaPkCDg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715719786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G8/TImExnPcn0/P4PnWsqrauOrC1YnmySZaU3kuuKQg=; b=mKTR+aaKzODX7Bm5w+mkknOuaO+jQQbCeLDym0is6AC8PmHYyN73dBi0/hYTnEDofuxj8I Kx6PgXdk12mRN2ld6Yd4E5D27Hlf5mWPJFCGPgE+QXWp915yIRKXeXXDemrCc4ZBJYCb1k WOoKWXyX5jM/nzSiNnnqm5xz7ai09fQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715719786; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G8/TImExnPcn0/P4PnWsqrauOrC1YnmySZaU3kuuKQg=; b=k9frE569ZnCt5JYUlUd2v5N4OV51TvkKRoEmTpdpMQ2eEuLOUzTKFZAGFr82Xh1MKEl6Qr 0iBt6+BWhUaPkCDg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 92F761372E; Tue, 14 May 2024 20:49:45 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id F3YiIWnOQ2aMJAAAD6G6ig (envelope-from ); Tue, 14 May 2024 20:49:45 +0000 Date: Tue, 14 May 2024 22:49:44 +0200 From: Oscar Salvador To: =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= Cc: Alexandre Ghiti , Albert Ou , David Hildenbrand , Palmer Dabbelt , Paul Walmsley , linux-riscv@lists.infradead.org, =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Andrew Bresticker , Chethan Seshadri , Lorenzo Stoakes , Santosh Mamila , Sivakumar Munnangi , Sunil V L , linux-kernel@vger.kernel.org, linux-mm@kvack.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v2 4/8] riscv: mm: Add memory hotplugging support Message-ID: References: <20240514140446.538622-1-bjorn@kernel.org> <20240514140446.538622-5-bjorn@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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240514140446.538622-5-bjorn@kernel.org> X-Spam-Level: X-Spamd-Result: default: False [-2.63 / 50.00]; BAYES_HAM(-1.33)[90.33%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[17]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[rivosinc.com,eecs.berkeley.edu,redhat.com,dabbelt.com,sifive.com,lists.infradead.org,catalinasystems.io,gmail.com,ventanamicro.com,vger.kernel.org,kvack.org,lists.linux-foundation.org]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_DN_SOME(0.00)[] X-Spam-Score: -2.63 X-Spam-Flag: NO On Tue, May 14, 2024 at 04:04:42PM +0200, Bj?rn T?pel wrote: > +static void __meminit free_vmemmap_storage(struct page *page, size_t size, > + struct vmem_altmap *altmap) > +{ > + if (altmap) > + vmem_altmap_free(altmap, size >> PAGE_SHIFT); > + else > + free_pages((unsigned long)page_address(page), get_order(size)); David already pointed this out, but can check arch/x86/mm/init_64.c:free_pagetable(). You will see that we have to do some magic for bootmem memory (DIMMs which were not hotplugged but already present) > +#ifdef CONFIG_SPARSEMEM_VMEMMAP > +void __ref vmemmap_free(unsigned long start, unsigned long end, struct vmem_altmap *altmap) > +{ > + remove_pgd_mapping(start, end, true, altmap); > +} > +#endif /* CONFIG_SPARSEMEM_VMEMMAP */ > +#endif /* CONFIG_MEMORY_HOTPLUG */ I will comment on the patch where you add support for hotplug and the dependency, but on a track in LSFMM today, we decided that most likely we will drop memory-hotplug support for !CONFIG_SPARSEMEM_VMEMMAP environments. So, since you are adding this plain fresh, please consider to tight the hotplug dependency to CONFIG_SPARSEMEM_VMEMMAP. As a bonus, you will only have to maintain one flavour of functions. -- Oscar Salvador SUSE Labs