From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88379353A84 for ; Wed, 22 Jul 2026 17:37:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784741873; cv=none; b=f9WOv08A5ifIkCX+sK2CHCX2yWzQmLBhp90awJhHg2bHPpJP1b2yeiHyCw7FqWYCyuY0CmMtX1cxYIMc7OEhO9v7H4mVNPcO3ljGWxlUj6v+joSJ3JmGOQM6Rmk/TbFGHH2jz8LamWPRiyUnWSEI1y0u+F38tLN3NP+nwaif7K0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784741873; c=relaxed/simple; bh=JnKvBjo2fOfq9jvwV+JUrWEAgatydjsNYlPbheLKhxc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=crm6a+SI7EAv6tUbPQDT8gtz/p4VJ35AYIjM+ERTmhngjaQQoB3KXVKsjYDI+AhafGXkm8CAHWvpoNTntO1toTjfNMB2g+rL8mzIcMxz47uzxdQGYfwNxawsYmpeqDaFWVNqGy03+hRMgBHQXnysi00X46DUPEos5OkLIwOUZ0E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=QAyoeG7P; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="QAyoeG7P" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C4C9A168F; Wed, 22 Jul 2026 10:37:46 -0700 (PDT) Received: from e129823.arm.com (e129823.arm.com [10.2.213.3]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 074493F66F; Wed, 22 Jul 2026 10:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784741871; bh=JnKvBjo2fOfq9jvwV+JUrWEAgatydjsNYlPbheLKhxc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QAyoeG7PKBAcoDg4Vx9aVKdN0VlATPEViq8WVRyZilegBBahIiktHRv2hfoEoCbzO UJkF9NKxVlB1ZkC22HyEA1xzj6R0ZAmD2eyyzrJ2PtRBpEmkwyyZGygxHNSHMhB+yJ cFBkNBXczoT10ntHra7/zJDISGpvjgKKjsxCrn3c= Date: Wed, 22 Jul 2026 18:37:42 +0100 From: Yeoreum Yun To: Dave Hansen Cc: Yeoreum Yun , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Catalin Marinas , Will Deacon , Arnd Bergmann , Andrew Morton , Kairui Song , Qi Zheng , Shakeel Butt , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Lorenzo Stoakes , Tianrui Zhao , Bibo Mao , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jonas Bonn , Stefan Kristiansson , Stafford Horne , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-openrisc@vger.kernel.org Subject: Re: [PATCH RFC v2 13/20] x86: mm: carve out the generic compile-time folded pgtable case in effective_prot() Message-ID: References: <20260722-dummy_ptxp3-v2-0-d9e4bad31e0a@arm.com> <20260722-dummy_ptxp3-v2-13-d9e4bad31e0a@arm.com> Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: > On 7/22/26 08:30, Yeoreum Yun wrote: > > struct pg_state { > > struct ptdump_state ptdump; > > + int first_level; > > int level; > > pgprotval_t current_prot; > > pgprotval_t effective_prot; > > There is zero reason on x86 to hold this value in a data structure. It > is 100% determined at boot time or earlier. Pre-5-level-paging it's a > compile-time constant. > > On x86, it never varies per-mm. However, mm_pXd_folded() requires to mm for other architecture like s390. might save the mm instead of first_level and calls the ptdump_pt_level_first() with static inline version would make the constant comparison. So it requires to save *mm* structure in here. [...] -- Sincerely, Yeoreum Yun 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 1D000C44536 for ; Wed, 22 Jul 2026 17:38:09 +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:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=yBGSHHxqzmd2ZkKQ4OTay+QYuVsNkltjE8pJDYlqd3g=; b=1BoR5NTu8eazbt 6l6OMqmWXqjs/Pf5yx0CHdbLiU2tNL1d8J9Br3eusWkIuOLO2SWBTyQZae2rPiHoRIH1HypoAntAl xk6EIK6B2tCC2thiWCmgSQtrtXRLOFvDMOQZQT8VN+XC5W9ixtuobHFgMI5q0TiS0jf2DNlhmNoPS cnt96szCVUviDTWGLSkL11p3KzFxrZ2UtaEHWN2if5vAm/dmEpA2mSWqdXULgMJXwO4KZyzPkqI1N t4cjNGO5BT7L4uXqxhoqgZlfaE5mAO6itfKrxc3oyfV9T1aojwen7asuc9lxs6ieNupQ2B42acqXJ ZYd6ub7O1QHSXc5i/IDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wmatJ-0000000CUA7-3tzS; Wed, 22 Jul 2026 17:37:57 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wmatI-0000000CU9a-0gj9; Wed, 22 Jul 2026 17:37:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9b0lYAChp/dlK8UrMEe9sgRuRXi4DJ+u7ef6sfSwFo8=; b=ZVU9GAXiu8QBjnuTHwYIk1zn7M IHdXTcLzvPaYRamKYFIPHKGEWESPJH5XK9jfGLnAm5iN2hgVyd281OLvscWa5s6rLzYmDJuyoYsOy 1PlJo53L7HfOgXzscH/OVc595Nx4tZFBMLYma5TYzLaZm9Q87e5zhBw+jYDcvWA2/Fkdpwh8B3F9x DVyqHWYBpyJIzEbxyEWusPs7jwvK8Wai18ASThporA9Z/ee/I0TeSFMuBt9DpwKU8vqY0i2IR0dCz 6iMY95iezh+AELPQXXJSwFGLC+LhbFutzWrC6hnr51DpST6dEeimHi//XFHOhbO40fvV4bXY1L+b3 09Af3XrA==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.99.2 #2 (Red Hat Linux)) id 1wmatF-000000015Cm-0Nvh; Wed, 22 Jul 2026 17:37:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C4C9A168F; Wed, 22 Jul 2026 10:37:46 -0700 (PDT) Received: from e129823.arm.com (e129823.arm.com [10.2.213.3]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 074493F66F; Wed, 22 Jul 2026 10:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784741871; bh=JnKvBjo2fOfq9jvwV+JUrWEAgatydjsNYlPbheLKhxc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QAyoeG7PKBAcoDg4Vx9aVKdN0VlATPEViq8WVRyZilegBBahIiktHRv2hfoEoCbzO UJkF9NKxVlB1ZkC22HyEA1xzj6R0ZAmD2eyyzrJ2PtRBpEmkwyyZGygxHNSHMhB+yJ cFBkNBXczoT10ntHra7/zJDISGpvjgKKjsxCrn3c= Date: Wed, 22 Jul 2026 18:37:42 +0100 From: Yeoreum Yun To: Dave Hansen Cc: Yeoreum Yun , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Catalin Marinas , Will Deacon , Arnd Bergmann , Andrew Morton , Kairui Song , Qi Zheng , Shakeel Butt , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Lorenzo Stoakes , Tianrui Zhao , Bibo Mao , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jonas Bonn , Stefan Kristiansson , Stafford Horne , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-openrisc@vger.kernel.org Subject: Re: [PATCH RFC v2 13/20] x86: mm: carve out the generic compile-time folded pgtable case in effective_prot() Message-ID: References: <20260722-dummy_ptxp3-v2-0-d9e4bad31e0a@arm.com> <20260722-dummy_ptxp3-v2-13-d9e4bad31e0a@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260722_183753_298530_7A772C1F X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. 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 7/22/26 08:30, Yeoreum Yun wrote: > > struct pg_state { > > struct ptdump_state ptdump; > > + int first_level; > > int level; > > pgprotval_t current_prot; > > pgprotval_t effective_prot; > > There is zero reason on x86 to hold this value in a data structure. It > is 100% determined at boot time or earlier. Pre-5-level-paging it's a > compile-time constant. > > On x86, it never varies per-mm. However, mm_pXd_folded() requires to mm for other architecture like s390. might save the mm instead of first_level and calls the ptdump_pt_level_first() with static inline version would make the constant comparison. So it requires to save *mm* structure in here. [...] -- Sincerely, Yeoreum Yun _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 36BCCC4453C for ; Wed, 22 Jul 2026 17:37:58 +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:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XoUXYCJ/jWt1zBdOO++VWOfu8XF4Dkja7Dlh5SBen+Y=; b=0GY1AsFugVfZk0 YyttL4G/WuHWKoqpUzfOSTdxX4NSlyyN0FKs9OTETfd7W8vcI07LH0UfmKtouwOUnumTIpWBpP/sn tpPmdx1l9Q6qstVfld9/r3BBntR22vKg9ehvMAB1T78n6uB79xhcRo9n5D725XV2JzRJ4gl+NF7tR 88OmcKZZZKnNdcihCGeNm0pBl2zlOG7n+EUy/vs7ZwpXbMjiN6fZ44/WPonzWhOnUVXgo6OLTBfSm /5t89uBlmjggDem1T/GZIpxps8FnqL5dFmQKXS7HbKrb2LMsLzyDZJXd9fMj+SM/940F79/1NO75X R1Yt3OpvJRDJvfl2aIsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1wmatJ-0000000CUA3-3ewi; Wed, 22 Jul 2026 17:37:57 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1wmatI-0000000CU9a-0gj9; Wed, 22 Jul 2026 17:37:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=9b0lYAChp/dlK8UrMEe9sgRuRXi4DJ+u7ef6sfSwFo8=; b=ZVU9GAXiu8QBjnuTHwYIk1zn7M IHdXTcLzvPaYRamKYFIPHKGEWESPJH5XK9jfGLnAm5iN2hgVyd281OLvscWa5s6rLzYmDJuyoYsOy 1PlJo53L7HfOgXzscH/OVc595Nx4tZFBMLYma5TYzLaZm9Q87e5zhBw+jYDcvWA2/Fkdpwh8B3F9x DVyqHWYBpyJIzEbxyEWusPs7jwvK8Wai18ASThporA9Z/ee/I0TeSFMuBt9DpwKU8vqY0i2IR0dCz 6iMY95iezh+AELPQXXJSwFGLC+LhbFutzWrC6hnr51DpST6dEeimHi//XFHOhbO40fvV4bXY1L+b3 09Af3XrA==; Received: from foss.arm.com ([217.140.110.172]) by desiato.infradead.org with esmtp (Exim 4.99.2 #2 (Red Hat Linux)) id 1wmatF-000000015Cm-0Nvh; Wed, 22 Jul 2026 17:37:54 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C4C9A168F; Wed, 22 Jul 2026 10:37:46 -0700 (PDT) Received: from e129823.arm.com (e129823.arm.com [10.2.213.3]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 074493F66F; Wed, 22 Jul 2026 10:37:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784741871; bh=JnKvBjo2fOfq9jvwV+JUrWEAgatydjsNYlPbheLKhxc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=QAyoeG7PKBAcoDg4Vx9aVKdN0VlATPEViq8WVRyZilegBBahIiktHRv2hfoEoCbzO UJkF9NKxVlB1ZkC22HyEA1xzj6R0ZAmD2eyyzrJ2PtRBpEmkwyyZGygxHNSHMhB+yJ cFBkNBXczoT10ntHra7/zJDISGpvjgKKjsxCrn3c= Date: Wed, 22 Jul 2026 18:37:42 +0100 From: Yeoreum Yun To: Dave Hansen Cc: Yeoreum Yun , Russell King , Huacai Chen , WANG Xuerui , Thomas Bogendoerfer , Catalin Marinas , Will Deacon , Arnd Bergmann , Andrew Morton , Kairui Song , Qi Zheng , Shakeel Butt , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Johannes Weiner , David Hildenbrand , Michal Hocko , Lorenzo Stoakes , Tianrui Zhao , Bibo Mao , Anup Patel , Atish Patra , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jonas Bonn , Stefan Kristiansson , Stafford Horne , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-openrisc@vger.kernel.org Subject: Re: [PATCH RFC v2 13/20] x86: mm: carve out the generic compile-time folded pgtable case in effective_prot() Message-ID: References: <20260722-dummy_ptxp3-v2-0-d9e4bad31e0a@arm.com> <20260722-dummy_ptxp3-v2-13-d9e4bad31e0a@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260722_183753_298530_7A772C1F X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. X-BeenThere: kvm-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: "kvm-riscv" Errors-To: kvm-riscv-bounces+kvm-riscv=archiver.kernel.org@lists.infradead.org > On 7/22/26 08:30, Yeoreum Yun wrote: > > struct pg_state { > > struct ptdump_state ptdump; > > + int first_level; > > int level; > > pgprotval_t current_prot; > > pgprotval_t effective_prot; > > There is zero reason on x86 to hold this value in a data structure. It > is 100% determined at boot time or earlier. Pre-5-level-paging it's a > compile-time constant. > > On x86, it never varies per-mm. However, mm_pXd_folded() requires to mm for other architecture like s390. might save the mm instead of first_level and calls the ptdump_pt_level_first() with static inline version would make the constant comparison. So it requires to save *mm* structure in here. [...] -- Sincerely, Yeoreum Yun -- kvm-riscv mailing list kvm-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kvm-riscv