linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  mm-commits@vger.kernel.org,
	linux-kernel@vger.kernel.org,  Huang Ying <ying.huang@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [GIT PULL] MM updates for 6.12-rc1
Date: Mon, 23 Sep 2024 09:13:44 -0700	[thread overview]
Message-ID: <CAHk-=wh1ZaVh2Tsc9tyXM7O1sL0eArxWHiqszZLj+MWe+f3Pwg@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdU3mfA_SuPqw8ZjkECnP456R=K49fg2yHdOznrSzvTjAg@mail.gmail.com>

On Mon, 23 Sept 2024 at 01:09, Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> BTW2, the following may not work with the default PHYSMEM_END due
> to integer overflow, on both 32-bit and 64-bit:
>
> mm/sparse.c:    unsigned long max_sparsemem_pfn = (PHYSMEM_END + 1) >>
> PAGE_SHIFT;

Good point.

I've committed a truly disgusting hack, which makes the default
PHYSMEM_END in the absence of a MAX_PHYSMEM_BITS value be

 (a) always a 64-bit type (ie unsigned long long)

 (b) be the maximum value to fit in 'phys_addr_t'

 (c) _but_ with the high bit always clear in 64 bits

so it's basically either 0xffff_ffff or 0x7fff_ffff_ffff_ffff.

The disgusting macro I came up for this for this is

 # define PHYSMEM_END   (((phys_addr_t)-1)&~(1ULL<<63))

and no, I'm not proud of it. This is all horrendous.

We need to fix it properly, with the proper fix probably being to
always have a valid value for MAX_PHYSMEM_BITS (and no, 64 is not a
valid value due to the overflow issue) but the quick hack hopefully
gets the build going.

Of course, I don't have the m68k cross-environment set up, thus the
"hopefully". Let's see if this works.

               Linus


      reply	other threads:[~2024-09-23 16:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20  9:33 Andrew Morton
2024-09-21 15:49 ` pr-tracker-bot
2024-09-22  9:32 ` Geert Uytterhoeven
2024-09-22 16:34   ` Linus Torvalds
2024-09-23  8:09     ` Geert Uytterhoeven
2024-09-23 16:13       ` Linus Torvalds [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='CAHk-=wh1ZaVh2Tsc9tyXM7O1sL0eArxWHiqszZLj+MWe+f3Pwg@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=ying.huang@intel.com \
    /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