From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD7B8D16275 for ; Mon, 14 Oct 2024 14:26:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05B286B0082; Mon, 14 Oct 2024 10:26:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 030F86B0083; Mon, 14 Oct 2024 10:26:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E3B236B0085; Mon, 14 Oct 2024 10:26:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C53906B0082 for ; Mon, 14 Oct 2024 10:26:13 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 27186120E83 for ; Mon, 14 Oct 2024 14:26:06 +0000 (UTC) X-FDA: 82672432542.28.47D8948 Received: from mail-qv1-f53.google.com (mail-qv1-f53.google.com [209.85.219.53]) by imf26.hostedemail.com (Postfix) with ESMTP id AF2AA140011 for ; Mon, 14 Oct 2024 14:26:06 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=BCxYGP4N; dmarc=none; spf=pass (imf26.hostedemail.com: domain of gourry@gourry.net designates 209.85.219.53 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728915866; a=rsa-sha256; cv=none; b=I9M9VfRsQC7GoNXGTC+wVzLFUk4WclkNUqU5ka2S0UnUc1xN+9sZVGagtS71VkwKmevjnq pUyxg0dQ4kVkffD8RWle6mz3HZ0hICT9IHmnHtuYnmClNVUh9pizN8GKAn475aTQtsTZBP gMnG1+9ZThfFEz7HajbK1bRwd0t2dUE= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=BCxYGP4N; dmarc=none; spf=pass (imf26.hostedemail.com: domain of gourry@gourry.net designates 209.85.219.53 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728915866; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=anv9z4HoBbgTwjW9gAOi/r1vARKs2+DF0HVNB5McWeI=; b=vE7T2zZ9a87s2C9uhHNmYCIDUIBZGXTDZ3vaXUsLE6m6fMGfeeA45eBGj5TtXb9TpW2TKc LAcORJ0fggcQ1K7sbRZaG9Kj1kWumoup2Sn5oRs4bNqW/Lfp4mhWhGMLbeYdr7KgEmujZR U+zviiLtu3Jgh+o0VOZ8iPzp4Dj1o74= Received: by mail-qv1-f53.google.com with SMTP id 6a1803df08f44-6cbd12b38b4so37155916d6.2 for ; Mon, 14 Oct 2024 07:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1728915970; x=1729520770; darn=kvack.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=anv9z4HoBbgTwjW9gAOi/r1vARKs2+DF0HVNB5McWeI=; b=BCxYGP4NnnHO8C8vlUbwhXrnGWdZggIiSUbjwWk2RGqesSOEHHtrAOJyAzSMlpsf7k OG8OIkC7neVmIKpsgh93183EzT1caGAQxgvmpxyPYpL+KHE4nCt6KUu2aXpA0uaqbH04 6T2BGguJ/aMbA0TR4of8w2lPvwroXmtgV9GCSZK8U5cMq+2ihC+uk8xQZIRDnXuw764T 0cfHfAclV7kJ3r8TgBePGj9FeVP1vFmqpT413nFuficUq1NtqB1vML6WGSCqnayVdX/1 cCScax0QWu/NiKPlvYt6f8YwOtaqem8ku8K/NZbllK+DnLFPhcBK/3r4gnHSIGvQaQL+ uUhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728915970; x=1729520770; 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=anv9z4HoBbgTwjW9gAOi/r1vARKs2+DF0HVNB5McWeI=; b=lyrcJVvl3GvFVa0oN3nm2IM2sPUt2rz2M5X28cPJLEvseN1LZyosofuNrefNWfCEyV +oeDkcWIuoiGedkWB75FxtDyZMx7/sIqB/ufWDqkbxxaqyeB79w/oYnTsuCpGwX6CzFm WCUxNJzXPTrAbg7laA0gHMK7YnP9p1Du77BMkDR66VWML/Fc9C2nXBA9eRSIALtVEjBw 5UZx2OfvQYPkI7twuvY3sQc643yHncNV4qEJvhqvZpC+bKzoM+RJA0OS8CY1EB4PpHju dJvMTp3z7k9UjLY9kfMvvGSMQafjxaF/quJYMUrvR5n43vNGW4PtDpKM5mfvhjBBgjtS SAhQ== X-Forwarded-Encrypted: i=1; AJvYcCUDqtFtMoL8yT35Ve4RnR1+FcLqX5qlkPn3v6EiA4gBokHze+TiJxuHBsoXK/0K4f2R/T0GkBXptA==@kvack.org X-Gm-Message-State: AOJu0YwE5rI3eQcph3ODuch4zZPdGpASJVw8sYrUFFdufbMIsAsY5VwM IN6VUofVooi0KgumSjKMGlAeCIgTc+2TC5wuFPa6wUtNwixgkElikQBjW2b020o= X-Google-Smtp-Source: AGHT+IFxwrq0IX7iujFFTia13QSgyyrVvlmERbSC45tKLbajzwfSC6P8rE18RQITkbME9o3sDxgBcw== X-Received: by 2002:a05:6214:3110:b0:6cc:42d:bb6 with SMTP id 6a1803df08f44-6cc042d0cbamr84258196d6.16.1728915970271; Mon, 14 Oct 2024 07:26:10 -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 6a1803df08f44-6cbe85b79f6sm45970486d6.51.2024.10.14.07.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Oct 2024 07:26:09 -0700 (PDT) Date: Mon, 14 Oct 2024 10:25:51 -0400 From: Gregory Price To: David Hildenbrand Cc: linux-cxl@vger.kernel.org, x86@kernel.org, linux-mm@kvack.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, dave.hansen@linux.intel.com, luto@kernel.org, peterz@infradead.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, osalvador@suse.de, gregkh@linuxfoundation.org, rafael@kernel.org, akpm@linux-foundation.org, dan.j.williams@intel.com, Jonathan.Cameron@huawei.com, alison.schofield@intel.com, rrichter@amd.com, terry.bowman@amd.com, lenb@kernel.org, dave.jiang@intel.com, ira.weiny@intel.com Subject: Re: [PATCH 1/3] memory: extern memory_block_size_bytes and set_memory_block_size_order Message-ID: References: <20241008044355.4325-1-gourry@gourry.net> <20241008044355.4325-2-gourry@gourry.net> <039e8c87-c5da-4469-b10e-e57dd5662cff@redhat.com> <2c854e5e-c200-4ed9-bf21-778779af7e5b@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2c854e5e-c200-4ed9-bf21-778779af7e5b@redhat.com> X-Rspamd-Queue-Id: AF2AA140011 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: q6th1c5tqhqdc91r5ox1zqomaf3c15at X-HE-Tag: 1728915966-642507 X-HE-Meta: U2FsdGVkX1+5mV1abDR3XxQKoCMh1O53DMc49K5d/pYDB+tKlZY74GJfUvImAM09ilTuBcqP/eR10PPCDlvujxZjkuN83ZEYLJ2XHg45t+lUc7FtiVLP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tD4u4bg4uH34VRDBRxncAW21sQO5xa9LFSn3Qfti55Srm0irjahAMtIonzDl+z5Kav9cg2tptJWc9+jqEXBl/FLZ8yBleRd/SD8tXhUdobv6K9uNfatl0ChBvXy//0XmppytU2FFVOUA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Mon, Oct 14, 2024 at 01:54:27PM +0200, David Hildenbrand wrote: > On 08.10.24 17:21, Gregory Price wrote: > > On Tue, Oct 08, 2024 at 05:02:33PM +0200, David Hildenbrand wrote: > > > On 08.10.24 16:51, Gregory Price wrote: > > > > > > +int __weak set_memory_block_size_order(unsigned int order) > > > > > > +{ > > > > > > + return -ENODEV; > > > > > > +} > > > > > > +EXPORT_SYMBOL_GPL(set_memory_block_size_order); > > > > > > > > > > I can understand what you are trying to achieve, but letting arbitrary > > > > > modules mess with this sounds like a bad idea. > > > > > > > > > > > > > I suppose the alternative is trying to scan the CEDT from inside each > > > > machine, rather than the ACPI driver? Seems less maintainable. > > > > > > > > I don't entirely disagree with your comment. I hummed and hawwed over > > > > externing this - hence the warning in the x86 machine. > > > > > > > > Open to better answers. > > > > > > Maybe an interface to add more restrictions on the maximum size might be > > > better (instead of setting the size/order, you would impose another upper > > > limit). > > > > That is effectively what set_memory_block_size_order is, though. Once > > blocks are exposed to the allocators, its no longer safe to change the > > size (in part because it was built assuming it wouldn't change, but I > > imagine there are other dragons waiting in the shadows to bite me). > > Yes, we must run very early. > > How is this supposed to interact with code like > > set_block_size() > > that also calls set_memory_block_size_order() on UV systems (assuming there > will be CXL support sooner or later?)? > > Tying the other email to this one - just clarifying the way forward here. It sounds like you're saying at a minimum drop EXPORT tags to prevent modules from calling it - but it also sounds like built-ins need to be prevented from touching it as well after a certain point in early boot. Do you think I should go down the advise() path as suggested by Ira, just adding a arch_lock_blocksize() bit and have set_..._order check it, or should we just move towards each architecture having to go through the ACPI:CEDT itself? Doesn't sound like we've quite hit a consensus on where the actual adjustment logic should land - just that this shouldn't be touched by modules. ~Gregory