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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 41C29C43458 for ; Fri, 26 Jun 2026 15:05:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:Subject:Cc:To: From:Message-Id:Date:Mime-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=slL13JK2iMr5lj+gOrRuqzMox17/cjsfwRNlXJycNZk=; b=Y8x3IBC/Wp1HZC Q6xzhMiXZbTlKY6RZp3HWuCfFasujhd4mgg1Rwb6rdqfekg2gSOZ/RwJnumZUjjjiq6XpDEgJfLtI D5Y/NvTJF5hivuOEi+IHGDawv+H/tb/GCBWPRxHhc2BCMs/wkaSMqVF2ICBx8OT6W4ziezYjzr4sl hjExX0rTgshQNx2o7pIjAvzoLY5CkiNqAPCJILWPi/+YExZTgjjNY4orXgKtG0MGlT7yvie66TNj7 5P7NLieXsC/i/s5LtlIsAB3E1z2LKxi5zqUwpyF04gO+FXsOzUZBUGCkT1uaJRZigkfCI7W6B6GyT 0YLavHOyv8F5V35xourg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wd87O-0000000BWXq-3iHY; Fri, 26 Jun 2026 15:05:22 +0000 Received: from out-170.mta0.migadu.com ([2001:41d0:1004:224b::aa]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wd87H-0000000BWVO-3RoU for linux-riscv@lists.infradead.org; Fri, 26 Jun 2026 15:05:20 +0000 Mime-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1782486297; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z/3t6es/Sh5NFgNAr92B/NG50RTxtozIvYYF+FgF2iA=; b=ka0GYaflSKkPFQ7rFhIGoeEDcZfUQi/jBpWMJl+inaTs6Ay8kTJp9zdbYmSenvlQJh+XR+ XB172PGZ4cpCqyqeulNT+N+xr0AurrQi4xrcP61whLGk9uJ8pOP+saDL+I6rAvgBdS3Po7 QQIlkgcah948ts7waig31URzqiuDpu0= Date: Fri, 26 Jun 2026 15:04:48 +0000 Message-Id: X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: "Brendan Jackman" To: "Brendan Jackman" , "Lorenzo Stoakes" , "Kalyazin, Nikita" Cc: "kvm@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-mm@kvack.org" , "bpf@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "kernel@xen0n.name" , "linux-riscv@lists.infradead.org" , "pbonzini@redhat.com" , "corbet@lwn.net" , "maz@kernel.org" , "oupton@kernel.org" , "suzuki.poulose@arm.com" , "yuzenghui@huawei.com" , "will@kernel.org" , "seanjc@google.com" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "luto@kernel.org" , "willy@infradead.org" , "akpm@linux-foundation.org" , "david@kernel.org" , "lorenzo.stoakes@oracle.com" , "vbabka@kernel.org" , "rppt@kernel.org" , "surenb@google.com" , "mhocko@suse.com" , "ast@kernel.org" , "daniel@iogearbox.net" , "andrii@kernel.org" , "martin.lau@linux.dev" , "eddyz87@gmail.com" , "song@kernel.org" , "yonghong.song@linux.dev" , "john.fastabend@gmail.com" , "kpsingh@kernel.org" , "haoluo@google.com" , "jolsa@kernel.org" , "jhubbard@nvidia.com" , "jannh@google.com" , "pfalcato@suse.de" , "skhan@linuxfoundation.org" , "riel@surriel.com" , "ryan.roberts@arm.com" , "jgross@suse.com" , "yu-cheng.yu@intel.com" , "kas@kernel.org" , "coxu@redhat.com" , "ackerleytng@google.com" , "yosry@kernel.org" , "ajones@ventanamicro.com" , "maobibo@loongson.cn" , "prsampat@amd.com" , "wu.fei9@sanechips.com.cn" , "mlevitsk@redhat.com" , "jthoughton@google.com" , "agordeev@linux.ibm.com" , "alex@ghiti.fr" , "aou@eecs.berkeley.edu" , "borntraeger@linux.ibm.com" , "chenhuacai@kernel.org" , "baolu.lu@linux.intel.com" , "dev.jain@arm.com" , "gor@linux.ibm.com" , "hca@linux.ibm.com" , "palmer@dabbelt.com" , "pjw@kernel.org" , "shijie@os.amperecomputing.com" , "svens@linux.ibm.com" , "thuth@redhat.com" , "Liam.Howlett@oracle.com" , "urezki@gmail.com" , "zhengqi.arch@bytedance.com" , "pavel@kernel.org" , "yangyicong@hisilicon.com" , "vannapurve@google.com" , "jackmanb@google.com" , "patrick.roy@linux.dev" , "Thomson, Jack" , "Itazuri, Takahiro" , "Manwaring, Derek" Subject: Re: [PATCH v12 01/16] set_memory: set_direct_map_* to take address References: <20260410151746.61150-1-kalyazin@amazon.com> <20260410151746.61150-2-kalyazin@amazon.com> In-Reply-To: X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260626_080515_993753_F3043361 X-CRM114-Status: GOOD ( 17.30 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Fri Jun 26, 2026 at 2:38 PM UTC, Brendan Jackman wrote: > On Tue Apr 21, 2026 at 2:43 PM UTC, Lorenzo Stoakes wrote: >> On Fri, Apr 10, 2026 at 03:17:58PM +0000, Kalyazin, Nikita wrote: >>> From: Nikita Kalyazin >>> >>> Let's convert set_direct_map_*() to take an address instead of a page to >>> prepare for adding helpers that operate on folios; it will be more >>> efficient to convert from a folio directly to an address without going >>> through a page first. > > Why is this more efficient? Isn't it a purely compile-time conversion? > > Indeed in the current implementation folio_address() is > page_address(&folio->page) so it still goes through a page anyway, no? > > I might be missing context here about how this will look in the > memdesc future. Sorry I failed to do the history search here, this was suggested by Willy during the review here: https://lore.kernel.org/kvm/aWkN4yzwPtotaTeq@casper.infradead.org/ Matthew Wilcox wrote: > The implementation isn't the greatest. None of the implementations > of set_direct_map_valid_noflush() actually do anything with the struct > page; they all call page_address() or page_to_virt() (fundamentally the > same thing). But IMO the struct page isn't there to carry runtime information, it's a type hint that this API operates on physical pages. Yes this is already implied by the name but it also gives us a certain amount of safety since it avoids unaligned or non-physmap addresses at compile time. > So converting folio->page->address is a bit inefficient. ... but yeah now I see this comes from Willy I definitely suspect I'm missing memdesc insight here. > It feels like we should change set_direct_map_valid_noflush() to take a > const void * and pass either page_address() or folio_address(), depending > whether the caller has a page or a folio. What do you think? _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv