From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f42.google.com (mail-qv1-f42.google.com [209.85.219.42]) (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 BA3701C830D for ; Fri, 1 Nov 2024 16:19:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730477956; cv=none; b=DsCLRxcxuDaRaask3PJcGX/uuc2FYUAcmWaS3dOFmOkt39WdxEa7o8lLCs8xl5hLIHohlEwIpFxI5cwh/VQicuU+HOJR3nLjjNAnqu0daGqCFVaEMkerOvdYSdbVp6PFwiTOoRcRwl5oLS7LUxp+MCcM0/Pks/fAXkHnn+fbb04= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730477956; c=relaxed/simple; bh=7vZSs69RDO63OeEMDEazP0OF0Z+XKQWHF6dHh01dYrE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CD7ngTUJtgBsCXBb0f1RJfH2GZFkkI6ycPxyV96SANKrHRCqbW1Bthv/jhqoZF74KRIjAh4K68D7jXMdTAxs2JvUyR/L+fsOqsRlP7mlg3okI6gZJOP3KJqeAz1K2o01QvJE5zZFKAc2+6WVSi2+t2YnUJy5NNLvfFyjTZQqTMQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net; spf=pass smtp.mailfrom=gourry.net; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b=Rbk8xxT4; arc=none smtp.client-ip=209.85.219.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=gourry.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gourry.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gourry.net header.i=@gourry.net header.b="Rbk8xxT4" Received: by mail-qv1-f42.google.com with SMTP id 6a1803df08f44-6cbd092f7f0so14946846d6.0 for ; Fri, 01 Nov 2024 09:19:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1730477952; x=1731082752; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=/bSsmwzcmIHT5+RxiruYL3qxqOwdT7Crq4ILwrDDOp0=; b=Rbk8xxT4U1VI6H8P1L1WQTx5K3niUcf9B8KeRlNhoYx8uC3Zc2sGc3utdE6jCz93ay icN8fDKpE+2WOsz4Bo0fT3Gu+xJF2bHenbTvANFNDRo7sf9e1RWlxL33+Gjngbuz6lWF RoVrO/qWMs5DVwbvongwhohCwOvQxfQVFhcHdRHAFpC0r1j6g9kWsaptV4AAripq2Ne4 eQm/0qqa0El/5Uj9DbEuUT2EfbWsSWiRQEwWzhSghcDnK+WTw9JRCevJNf3Nin4BkiC8 Zy6v9kpmiH27arBbDG1k0KwR7w0h2u6Wr0thWzjt2oXxF7qy2/dkQACdJ5freFWyRQGJ mCrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730477952; x=1731082752; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=/bSsmwzcmIHT5+RxiruYL3qxqOwdT7Crq4ILwrDDOp0=; b=R3ep6SlXetuafvWDTWOTETvX4ZefjKc7syQoUP4EfH0pPSeqTIOyBZ9dHOru+p1OkJ WVcQKsWpB0NZ296okJsi5nH9czh0VRKwOc/+LQlsrtVUZwevfIspwU/BZtU5jCTws6qP aLmQl/1ZFjFV1bdiFaO/pqraNFt3iNKc0ZYVt9JGOTOzwk/b8KtT3v6S1pVB930lWuho rvbAqOhwmvZs/+wo7De5ykyjwYr0up8M2BLxdaYPCQqJ9ofs7mTzVi8zh8x5iOqN23vl Wg9hzindfsKSmkpj/cYpnOZ9ovwHJY67JxIPao2nZcvr571GY7z9teMJ9L72QGOjAxet hbiQ== X-Forwarded-Encrypted: i=1; AJvYcCVO7DQeNAOoevR5THq8t5HxblIpgs1+TgNexL1sc24JS8ToNbStDz4Cja+Z/Sltr3/dg4adb/qjzLg=@vger.kernel.org X-Gm-Message-State: AOJu0YxEdJKU3hT/NpIU9EqzLs6Va//wauYbXhqG+ISuXFvIYdq1IW/C TFIANHbhgVIdV1kpozaVDjhCFSfEmdZDbdJdY6TKu9o8ohfqmh3SCPiw0/9QN+U= X-Google-Smtp-Source: AGHT+IGTAWGI1voqkTMjn2gIYEEJTU7/GErDE+jq8ITjtfWt5vaUbYn+bhb3Su6Je6dsCpv9c0kwAA== X-Received: by 2002:a0c:ec0c:0:b0:6d3:5274:f37e with SMTP id 6a1803df08f44-6d35274f42dmr81776906d6.40.1730477951529; Fri, 01 Nov 2024 09:19:11 -0700 (PDT) Received: from PC2K9PVX.TheFacebook.com (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b2f3a6fedcsm182877585a.78.2024.11.01.09.19.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Nov 2024 09:19:11 -0700 (PDT) Date: Fri, 1 Nov 2024 12:19:08 -0400 From: Gregory Price To: Borislav Petkov Cc: x86@kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, linux-mm@kvack.org, linux-cxl@vger.kernel.org, Jonathan.Cameron@huawei.com, dan.j.williams@intel.com, rrichter@amd.com, Terry.Bowman@amd.com, dave.jiang@intel.com, ira.weiny@intel.com, alison.schofield@intel.com, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, rafael@kernel.org, lenb@kernel.org, david@redhat.com, osalvador@suse.de, gregkh@linuxfoundation.org, akpm@linux-foundation.org, rppt@kernel.org Subject: Re: [PATCH v5 2/3] x86: probe memory block size advisement value during mm init Message-ID: References: <20241101134706.1185-1-gourry@gourry.net> <20241101134706.1185-3-gourry@gourry.net> <20241101155147.GBZyT5E190IxnQMzaP@fat_crate.local> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20241101155147.GBZyT5E190IxnQMzaP@fat_crate.local> On Fri, Nov 01, 2024 at 04:51:47PM +0100, Borislav Petkov wrote: > On Fri, Nov 01, 2024 at 09:47:04AM -0400, Gregory Price wrote: > > Systems with hotplug may provide an advisement value on what the > > memblock size should be. Probe this value when the rest of the > > configuration values are considered. > > > > The new heuristic is as follows > > > > 1) set_memory_block_size_order value if already set (cmdline param) > > 2) minimum block size if memory is less than large block limit > > 3) if no hotplug advice: Max block size if system is bare-metal, > > otherwise use end of memory alignment. > > 4) if hotplug advice: lesser of advice and end of memory alignment. > > > > Suggested-by: David Hildenbrand > > Signed-off-by: Gregory Price > > Acked-by: David Hildenbrand > > --- > > arch/x86/mm/init_64.c | 15 ++++++++++----- > > 1 file changed, 10 insertions(+), 5 deletions(-) > > > > diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c > > index ff253648706f..f1a495e998ce 100644 > > --- a/arch/x86/mm/init_64.c > > +++ b/arch/x86/mm/init_64.c > > @@ -1452,16 +1452,21 @@ static unsigned long probe_memory_block_size(void) > > } > > > > /* > > - * Use max block size to minimize overhead on bare metal, where > > - * alignment for memory hotplug isn't a concern. > > + * When hotplug alignment is not a concern, maximize blocksize > > + * to minimize overhead. Otherwise, align to the lesser of advice > > + * alignment and end of memory alignment. > > */ > > - if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) { > > + bz = memory_block_advised_max_size(); > > + if (!bz) { > > bz = MAX_BLOCK_SIZE; > > - goto done; > > + if (!boot_cpu_has(X86_FEATURE_HYPERVISOR)) > > s/boot_cpu_has/cpu_feature_enabled/ > > while at it. > I don't personally understand the implications of this switch off hand, probably warrants a separate patch submission if you think it's important given the original logic is boot_cpu_has and I don't want to increase scope change here. ~Gregory > -- > Regards/Gruss, > Boris. > > https://people.kernel.org/tglx/notes-about-netiquette