All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Vallejo <alejandro.vallejo@cloud.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>,
	Xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 4/8] build: Remove CONFIG_HAS_PDX
Date: Tue, 18 Jul 2023 14:35:27 +0100	[thread overview]
Message-ID: <64b69520.170a0220.8de7a.4a1b@mx.google.com> (raw)
In-Reply-To: <d9cd0bfa-52f9-94a3-0226-aa85d49a58a5@suse.com>

On Tue, Jul 18, 2023 at 11:38:14AM +0200, Jan Beulich wrote:
> On 18.07.2023 11:35, Andrew Cooper wrote:
> > On 18/07/2023 10:19 am, Jan Beulich wrote:
> >> On 17.07.2023 18:03, Alejandro Vallejo wrote:
> >>> It's set everywhere and can't be turned off because it's presence is
> >>> assumed in several parts of the codebase. This is an initial patch towards
> >>> adding a more fine-grained CONFIG_HAS_PDX_COMPRESSION that can actually be
> >>> disabled on systems that don't typically benefit from it.
> >>>
> >>> No functional change.
> >>>
> >>> Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
> >> On its own I don't think this is okay, as it's unclear whether it would
> >> affect RISC-V or PPC in a negative way.
> > 
> > Neither could compile without layering violations of PDX logic in common
> > code, and neither have got that far yet.
> > 
> > Now is an excellent time to be doing this, because it removes work for
> > RISC-V/PPC...
> > 
> >>  If at all, it should only go in
> >> together with the later re-introduction of a CONFIG_*.
I could merge this patch with patch 8. I do feel they tackle different
matters, but when HAS_PDX goes away doesn't matter.

> >> Still I question
> >> whether that new CONFIG_HAS_PDX_COMPRESSION (which imo ought to be
> >> CONFIG_PDX_COMPRESSION)
Sure, I'll change that in v2.

> >> then wouldn't better depend on the arch-selected
> >> HAS_PDX, such that it wouldn't wrongly be offered to choose a value when
> >> compression isn't supported in the first place.
There are several concepts to consider:

  * Frame numbers (mfn)
  * Frame table indices (pdx)
  * Mapping between the 2 (pdx_to_pfn/pfn_to_pdx)

  (I purposefully ignore the directmap. There's a similar argument for it)

An arch opting out of pdx and an arch opting out of pdx compression are in
the exact same situation, except the later has the ability to easily toggle
it back on. Using pdx (_not_ compression) as a first-class type has several
advantages.

  1. It allows common code to deal with pdx too. There are some conversions
     to/from pdx that have to do with arch-specific code calling common
     code or vice-versa. This is particularly bad in the presence of
     compression This is particularly bad in the presence of compression
     because it implies fairly frequent reads of global state.
  2. It allows a port to get pdx-compression for free if it opts into it;
     and more importantly, the ability to toggle it.
  3. Simplifies the compression removal logic. Otherwise #ifdefs need to be
     sprinkled around any architecture that may want to toggle it and
     that's several orders of magnitude more difficult to read.

TL;DR: There is not a benefit in a new port purposefuilly avoiding PDX.
It's just a name for a particular index. It's _compression_ that makes it
have a whacky relationship with mfns and might want toggling.

Incidentally, note that common/numa.c does use PDX.

> > 
> > ... although I do agree that the resulting option shouldn't be user
> > selectable.  It's a property of the architecture, not something a user
> > should be worrying about.
> 
> I disagree. Exotic x86 hardware may or may not want supporting, which
> can only be determined by the build meister, as long as this is indeed
> meant to become a build-time decision (rather than a runtime one; see
> my response to the cover letter of this series).
> 
> Jan
I won't get into x86, because I have never seen such exotic hardware, but
ARM definitely has a lot more heterogeneous system designs where it might
be needed on a system-by-system basis.

Alejandro


  reply	other threads:[~2023-07-18 13:35 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17 16:03 [PATCH 0/8] Make PDX compression optional Alejandro Vallejo
2023-07-17 16:03 ` [PATCH 1/8] mm/pdx: Add comments throughout the codebase for pdx Alejandro Vallejo
2023-07-18  9:14   ` Jan Beulich
2023-07-17 16:03 ` [PATCH 2/8] arm/mm: Document the differences between arm32 and arm64 directmaps Alejandro Vallejo
2023-07-20 20:05   ` Julien Grall
2023-07-21 15:09     ` Alejandro Vallejo
2023-07-21 17:51       ` Julien Grall
2023-07-17 16:03 ` [PATCH 3/8] pdx: Mark pdx hole description globals readonly after boot Alejandro Vallejo
2023-07-18  9:14   ` Jan Beulich
2023-07-17 16:03 ` [PATCH 4/8] build: Remove CONFIG_HAS_PDX Alejandro Vallejo
2023-07-18  9:19   ` Jan Beulich
2023-07-18  9:35     ` Andrew Cooper
2023-07-18  9:38       ` Jan Beulich
2023-07-18 13:35         ` Alejandro Vallejo [this message]
2023-07-17 16:03 ` [PATCH 5/8] mm: Factor out the pdx compression logic in ma/va converters Alejandro Vallejo
2023-07-21 16:11   ` Julien Grall
2023-07-17 16:03 ` [PATCH 6/8] mm/pdx: Standardize region validation wrt pdx compression Alejandro Vallejo
2023-07-21 17:05   ` Julien Grall
2023-07-24 12:18     ` Alejandro Vallejo
2023-07-24 18:20       ` Julien Grall
2023-07-25  6:51         ` Jan Beulich
2023-07-25 14:27           ` Julien Grall
2023-07-25 14:34             ` Jan Beulich
2023-07-27 10:14               ` Alejandro Vallejo
2023-07-27 10:19                 ` Jan Beulich
2023-07-17 16:03 ` [PATCH 7/8] pdx: Reorder pdx.[ch] Alejandro Vallejo
2023-07-17 16:24   ` Alejandro Vallejo
2023-07-17 16:03 ` [PATCH 8/8] pdx: Add CONFIG_HAS_PDX_COMPRESSION as a Kconfig option Alejandro Vallejo
2023-07-18  9:33 ` [PATCH 0/8] Make PDX compression optional Jan Beulich
2023-07-18 12:58   ` Alejandro Vallejo
2023-07-18 13:06     ` Jan Beulich
2023-07-18 13:40       ` Alejandro Vallejo
2023-07-20 22:00 ` Julien Grall
2023-07-20 22:13   ` Andrew Cooper

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=64b69520.170a0220.8de7a.4a1b@mx.google.com \
    --to=alejandro.vallejo@cloud.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=bertrand.marquis@arm.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 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.