public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
From: Andrew Donnellan <ajd@linux.ibm.com>
To: "Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] powerpc/mm: Use pte_advance_pfn() in set_huge_pte_at()
Date: Mon, 12 Jan 2026 15:23:38 +1100	[thread overview]
Message-ID: <15b33dda3ccf6889dbd46b0a0f4edfe633b968f5.camel@linux.ibm.com> (raw)
In-Reply-To: <2462a770-7da3-4b42-99ed-6ffd4d44b4f4@kernel.org>

On Thu, 2025-12-18 at 19:29 +0100, Christophe Leroy (CS GROUP) wrote:
> >   	for (i = 0; i < sz / pdsize; i++, ptep++, addr += pdsize) {
> >   		__set_pte_at(mm, addr, ptep, pte, 0);
> > -		pte = __pte(pte_val(pte) + ((unsigned long long)pdsize /
> > PAGE_SIZE << PFN_PTE_SHIFT));
> > +		pte = pte_advance_pfn(pte, pdsize / PAGE_SIZE);
> 
> How can this work ?
> 
> pdsize is 4M, PAGE_SIZE is 4k so pdsize/PAGE_SIZE is 0x400.
> 
> PFN_PTE_SHIFT is 24.
> 
> 0x400 << 24 is more than what an unsigned long can contain in 
> pte_advance_pfn()

Ah, in spite of the explicit unsigned long long cast that should've reminded me
otherwise, I forgot that a long isn't 64 bits on 32 bit machines.
> 



-- 
Andrew Donnellan    OzLabs, ADL Canberra
ajd@linux.ibm.com   IBM Australia Limited


      reply	other threads:[~2026-01-12  4:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 16:21 [PATCH] powerpc/mm: Use pte_advance_pfn() in set_huge_pte_at() Andrew Donnellan
2025-12-18 18:29 ` Christophe Leroy (CS GROUP)
2026-01-12  4:23   ` Andrew Donnellan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15b33dda3ccf6889dbd46b0a0f4edfe633b968f5.camel@linux.ibm.com \
    --to=ajd@linux.ibm.com \
    --cc=chleroy@kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox