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 D04ABCEFC4C for ; Tue, 8 Oct 2024 19:45:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CB5C6B008A; Tue, 8 Oct 2024 15:45:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 67B636B0098; Tue, 8 Oct 2024 15:45:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 542B56B0099; Tue, 8 Oct 2024 15:45:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 34DB66B008A for ; Tue, 8 Oct 2024 15:45:25 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 7E0A61208C9 for ; Tue, 8 Oct 2024 19:45:23 +0000 (UTC) X-FDA: 82651464168.07.D8509EB Received: from mail-qk1-f178.google.com (mail-qk1-f178.google.com [209.85.222.178]) by imf28.hostedemail.com (Postfix) with ESMTP id EC69AC0007 for ; Tue, 8 Oct 2024 19:45:22 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=dySofYg9; spf=pass (imf28.hostedemail.com: domain of gourry@gourry.net designates 209.85.222.178 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728416588; 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=KyOFo3K+fAZ65UEhLUHR8F6Og9mXsgjDoyxIBEdD5YY=; b=ulSrN6v59ATbM3zeWEVq3NqQ3Su01ns/Xf62ddggYrwRnetCn972F6ASq9Ymy0RtbdJ8rz IqT88u2reqetKuXhgLdkno2UOCS0uFV+wHbPb3GfhOJb8IttGes8iNn3hMy7XyKmNL6UTS FRYVzn5gfZq/WbAPCEt6j3liWtaIoc8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728416588; a=rsa-sha256; cv=none; b=4RLfkFEi+LDoOAK0MWW6FTEDyrY+dEWjtieVAYVkc8uuDpknSy/gYA82iPNPq+Bjyj0nnI 5GXv6PRrNvg+ku0v1dUWroMEqGxtexR4T6pfxFp7rVRL86MF5dFT9Vj8Gv/OVFQZYO5Mi3 PDIYTz8s1PtgwxyYI7pZAf2AfdsEPbw= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=dySofYg9; spf=pass (imf28.hostedemail.com: domain of gourry@gourry.net designates 209.85.222.178 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none Received: by mail-qk1-f178.google.com with SMTP id af79cd13be357-7afc67e9447so13743585a.1 for ; Tue, 08 Oct 2024 12:45:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1728416722; x=1729021522; 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=KyOFo3K+fAZ65UEhLUHR8F6Og9mXsgjDoyxIBEdD5YY=; b=dySofYg9Qtyhk8Vs+vfXLwfbP1hTqlICUtDt+tv1u0iS95PrL5P93ETP3yOkR9wURX 2hRs7d7oUh9CC8fQjHIqftfym4Lj/vjpbjNN2iYaSrc72/ZR/uyddl7JEI8Ee5izhatj JMYxEjtaZFbjsqutI7SRSFJGpjvfi/VwwmDsUca3PO/t9vsLbCy1Uhv92za7Qhrr2VfN G/uL35oB4QKJUwjd0sbCrArRRpQ0jGcH+agZqzRy+cL38fzfy3DYCIrA8VD4FMpacIDD PU+cyLt9Co/fFtfAg6GyXflmyr/TWRJpSgfSMhAdlF15406s0Dq37b/N1JwhekKBKpiz q0zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728416722; x=1729021522; 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=KyOFo3K+fAZ65UEhLUHR8F6Og9mXsgjDoyxIBEdD5YY=; b=HHScZkJ/yuY7zekKQBXH+Uu6qGeid4bgIp8SSD9yfBUqWG54e+480Kuup6BFDuE5Li sQ+X3Vu/cfMPkPBmh0B2HmjCYs0Gs6GmElUijzmxfh5/svGHtB3bHoBZI0KnKeTZ3wLx ZsmnCCH8tvNecwKL5gkfPHsQSulMFqGWvQYI8xeJxTBj5A8CtJ4nyrVJZEl0+LSQY0i1 +KZW1GrWdF3HV5fBIHTd0GG5lLkk1UxtKCp74wtGnykFEzAtb3JmYx94koo9OD//G8gq QdEb8Q9cCWUZpSBWC6uvpYudwQST63KNK5uAo8zZr7QbYt39KlFzGl4yXDXBaO6Uny/c eirQ== X-Forwarded-Encrypted: i=1; AJvYcCUJ8IcJnQdkzFL3qGvlvlO0qVXIHtsAppqh911MPqKjhaoebYTCAQCm4DNhR/lFLJ01X68RL3asBw==@kvack.org X-Gm-Message-State: AOJu0Yx+wJeNA+dfPm+vvUTbYR427LK/DtSfBcpt7lVw5Js1w66YyDSD A+rGDGy75p1Vfh7QNraXMgHutRqvMTRCuRKBO/mgP6i2IXihYYF/VFxxMzaDvTY= X-Google-Smtp-Source: AGHT+IH6XWnL5kwtHfTkxIDRb5j2x0rPOC89uj1NPmyIh5ioBCIwJgkV9Nl3E7AGtUXJH2g6+ElCWA== X-Received: by 2002:a05:620a:2415:b0:7a9:9f44:3f8 with SMTP id af79cd13be357-7affaf938demr42461885a.5.1728416721987; Tue, 08 Oct 2024 12:45:21 -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-7afcea7f657sm41246785a.0.2024.10.08.12.45.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2024 12:45:21 -0700 (PDT) Date: Tue, 8 Oct 2024 15:45:12 -0400 From: Gregory Price To: Ira Weiny Cc: David Hildenbrand , 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 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> <670582254a5db_2e172294fe@iweiny-mobl.notmuch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <670582254a5db_2e172294fe@iweiny-mobl.notmuch> X-Rspamd-Queue-Id: EC69AC0007 X-Stat-Signature: xpabjp5514wqki9oz93mzopjggfx9td4 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1728416722-990494 X-HE-Meta: U2FsdGVkX18at5rDTQCX/i27ijwKjUZhyiuloo4uCnsSL4HnJi8DDrglUbdqXATLONHDq+dr5Kze952ue4xQNZohnivvL/sgPm37TYKD8cVFSjJ2a12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1eOHdVBjkHvYPXrlpee7d56wDpBlaXloEoaqFx97uLutKesmNqIfh1SIJdXsbgeaIo2oSWoCSsdUKp9pxStfMapA+tWf64HcovNHdppvtBVAkBzAwhONxXmBtnDRCOm+NMoOai4r85BsWw== 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 Tue, Oct 08, 2024 at 02:04:05PM -0500, Ira Weiny wrote: > 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). > > Yea I think this is along the idea I had. But much clearer. > > Ira > Dan seems to think I can just extern without EXPORT, so let me see if I can get that working first. Then I'll see if I can add a lock bit. I'll see if i can make an arch_advise call that does away with some of the ifdef spaghetti. > > > > So this would basically amount to a lock-bit being set in the architecture, > > beyond which block size can no longer be changed and a big ol' splat > > can be generated that says "NO TOUCH". > > > > > Just imagine having various users of such an interface .. > > > > I don't wanna D: > > > > > > > > -- > > > Cheers, > > > > > > David / dhildenb > > > > >