All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Alison Schofield <alison.schofield@intel.com>,
	Dan Williams <dan.j.williams@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	Mike Rapoport <rppt@kernel.org>,
	"Huang, Ying" <ying.huang@intel.com>, <x86@kernel.org>,
	<linux-cxl@vger.kernel.org>
Subject: Re: [PATCH] x86/numa: Make numa_fill_memblks() @end parameter exclusive
Date: Wed, 3 Jan 2024 12:18:17 -0800	[thread overview]
Message-ID: <6595c10982cf_8dc6829433@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <ZZWsOxhYRAdPNNCv@aschofie-mobl2>

Alison Schofield wrote:
> On Tue, Jan 02, 2024 at 03:42:50PM -0800, Dan Williams wrote:
> > 
> > So I realize I asked for the minimal fix before a wider cleanup to
> > 'struct numa_memblk' to use 'struct range', but I want to see some of
> > that cleanup now. How about the below (only compile-tested) to at least
> > convert numa_fill_memblks(), since it is new, and then circle back
> > sometime later to move 'struct numa_memblk' to embed a 'struct range'
> > directly? I.e. save touching legacy code for later, but fix the bug in
> > the new code with some modernization. This also documents that
> > numa_add_memblk() expects an inclusive argument.
> > 
> > Note that this would be 3 patches, the minimal logic fix as you have it
> > without the comment changes since they become moot later, the
> > introduction of range_overlaps() with namespace conflict fixup with the
> > btrfs version, and using range_overlaps() to cleanup numa_fill_memblks()
> 
> Hi Dan,
> 
> Your idea to use struct range in struct numa_memblk comes as tremendous
> relief after staring at open coded usage of start/end in numa_memblk.
> 
> With that acknowledged, the minimal fix to the overlap issue could be
> either in x86 or acpi.

I don't see how it could be in acpi since there are currently
conflicting {in,ex}clusive usages of @end numa_fill_memblk(), right?

I.e.:
...
start < bi->end && end >= bi->start)
...
blk[count - 1]->end = max(blk[count - 1]->end, end);

> We're at x86 because we wanted to be 'like'
> numa_add_memblks(). A partial cleanup now makes numa_fill_memblks()
> diverge further.

Yes, but numa_add_memblks() parity is not necessarily a virtue, however
memblock (with an 'o') parity might be, see below:

>  And, to avoid the partial cleanup from being throw-away work, it
>  seems we'd want to define the full cleanup ahead of time.

Are you referring to throwing away this cleanup work for the eventual
memblock conversion, then yes, I agree, if this is just talking about
the numa_memblk with 'struct range' conversion, then I disagree.

> Also recall that we have a bigger hope of replacing this whole
> numa memblk usage with the "Memblock" (with an 'o') API.

2 wrinkles here...

1/ From a practical standpoint is anyone actively working on this? I
   would definitely stand down from the numa_memblk conversion in favor of
   memblock, but it has been years since this idea was floated, and I doubt
   it shows up anytime soon. However, "be more like memblock" is a good
   idea.

2/ memblock appears to be doing inclusive range math, which shoots holes
   in my position that numa_add_memblk() is an anti-pattern that merits
   conversion. I.e. "be more like memblock" contra-indicates a 'struct
   range' conversion.

> Maybe I need clarification on what you are suggesting wrt 3 patches?
> Are you saying you would not merge the minimal fix unless the partial
> clean up patches are included in the same set?

I think your memblock observation points to a third way. Lets uplevel
and steal memblock_addrs_overlap() and use it for this broken
comparison. That nods to an eventual full memblock conversion and keeps
the inclusive math status quo in memblock and numa_memblk related code.

> Also, is this something that has to be merged through x86 or might
> you be able to take it though cxl tree? Yes, that's me worrying 
> about the review and intake burden this puts on x86.

I can always merge things through cxl.git with an x86 Acked-by, or a
"holler if you don't want this to go through cxl.git" approach. Lets
keep maintainer busy-ness concerns separate from where the best long
term place for the changes to land.

  reply	other threads:[~2024-01-03 20:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-02 21:32 [PATCH] x86/numa: Make numa_fill_memblks() @end parameter exclusive alison.schofield
2024-01-02 23:42 ` Dan Williams
2024-01-03 18:49   ` Alison Schofield
2024-01-03 20:18     ` Dan Williams [this message]
2024-01-08 17:41       ` Alison Schofield
2024-01-08 17:59         ` Dan Williams

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=6595c10982cf_8dc6829433@dwillia2-xfh.jf.intel.com.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=alison.schofield@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rppt@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.