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 9C02E33D4F0; Thu, 16 Jul 2026 19:05:10 +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=1784228712; cv=none; b=c58j7U5Gp4dWL4Z/isOw73C0Co+o4bUgNdZVlqzg7Nq7x0HxnoVeHVTFgWLYz44u3d9yqrtXhncFtBVeeEYU5GLH8VK4Sq3iiBKLPsUYfOje5A8OlIOnLOwn3DrES46LbKQLrg9SLRwMbyWcnFDFGGN4TA2pnOQRhaSy0HF/q3E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784228712; c=relaxed/simple; bh=f1ULhbuK1iL4hbXSB2hrLrFezeJ/gE3hgeZAl2sOvUs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Vfj9UHIQ8r8+QiQzo2pCrLJlNLk/0v571GkJK0SF02tJGrLDVftDtL1ZGocNs+snvWOG4yI5zpenluz15zdzI1pHRfcSmLrpyGUXhThrqUrx8NWVGtLNV2EAAYViqXFmVUzcbCSZQNxouOhvs94otboiN3jCXtxe/EEgGnB6uvM= 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=gqrSwabc; 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="gqrSwabc" 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 3C1121477; Thu, 16 Jul 2026 12:05:05 -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 138523F66F; Thu, 16 Jul 2026 12:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784228709; bh=f1ULhbuK1iL4hbXSB2hrLrFezeJ/gE3hgeZAl2sOvUs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gqrSwabcapydV8BcaRXrJ+3InJ/tYr8/7EQjfec8M11rV1LYtTO+i0hHOG3fWMVI8 dzyFvALZUm6i3TwmO5xjMl+fdsthUr0DH07IaBF30UE5oiJvESqOEKP1mAzb+bHmtc WHJaM3g6tBoTuQz7uLK9ZM2XZRplDibEbr4kfqX4= Date: Thu, 16 Jul 2026 20:04:56 +0100 From: Yeoreum Yun To: Arnd Bergmann Cc: Pedro Falcato , Yeoreum Yun , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, linux-mips@vger.kernel.org, Linux-Arch , kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, x86@kernel.org, linux-mm@kvack.org, kasan-dev@googlegroups.com, "linux-csky@vger.kernel.org" , linux-m68k@lists.linux-m68k.org, "linux-openrisc@vger.kernel.org" , "David Hildenbrand (Red Hat)" , Russell King , Andrew Morton , Ankur Arora , Mike Rapoport , Magnus Lindholm , Christophe Leroy , Klara Modin , Huacai Chen , WANG Xuerui , "Kirill A. Shutemov" , zhangtianyang@loongson.cn, wangyuli@aosc.io, Thomas Bogendoerfer , Lorenzo Stoakes , Jason Gunthorpe , Catalin Marinas , Will Deacon , Ryan Roberts , Pasha Tatashin , Rohan McLure , Baolin Wang , Tejun Heo , Kevin Brodsky , Anup Patel , atish.patra@linux.dev, Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexandre Ghiti , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Johannes Weiner , Michal Hocko , qi.zheng@linux.dev, Shakeel Butt , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Anshuman Khandual , Yang Shi , chaitanyas.prakash@arm.com, Ard Biesheuvel , guoren , yang.li85200@gmail.com, Alexander Viro , Dinh Nguyen , "schuster.simon@siemens-energy.com" , Vivian Wang , junhui.liu@pigmoral.tech, Muchun Song , "Vishal Moola (Oracle)" , Nam Cao , Pavel Machek , djbw@kernel.org, yu-cheng.yu@intel.com, Baolu Lu , Jonathan Cameron , Coiby Xu , Andreas Larsson , "Liam R. Howlett" , "Vlastimil Babka (SUSE)" , Suren Baghdasaryan , Michal Hocko , Geert Uytterhoeven , Stafford Horne , Jonas Bonn , Stefan Kristiansson Subject: Re: [RFC PATCH 02/34] ARM: mm: make 2-level pgd_t a scalar Message-ID: References: <20260713135614.1618183-1-yeoreum.yun@arm.com> <20260713135614.1618183-3-yeoreum.yun@arm.com> Precedence: bulk X-Mailing-List: linux-csky@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: [...] > > Ugh. This isn't correct C code. It only works because the kernel passes > > -fno-strict-aliasing. > > I think the bigger problem is the code dereferencing the pgd > pointer in the first place: Since the pgd pair is written in > 32-bit units in __pmd_populate(), anything reading it would > technically have to operate on both entries. > > As the kernel relies on -fno-strict-aliasing, the type mismatch > is less of a problem than actually doing the potentially wrong > thing. > > As far as I can tell, we are however saved by pgd_val() > only ever being used for debug prints, where printing > the first entry is likely all that is needed to analyse > the real bug. > > > I would recommend either forcing a struct here, or > > using a u64 with bitmasks/shifts. > > That would require extra complexity for the big-endian > case though. Agree. And since the users of pgd_val() mostly uses with pmd_pfn(), pmd_page() and etc. I think it doesn't matter to return lower pmdval_t or higher one. Therefore, without considering endianess, it's enough with downcast like: #define pgd_val(x) ((pmdval_t)x) Could we apply this in next version? -- Sincerely, Yeoreum Yun