All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alejandro Vallejo <alejandro.vallejo@cloud.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "Stefano Stabellini" <sstabellini@kernel.org>,
	"Julien Grall" <julien@xen.org>,
	"Bertrand Marquis" <bertrand.marquis@arm.com>,
	"Volodymyr Babchuk" <Volodymyr_Babchuk@epam.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.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 v2 2/5] mm: Factor out the pdx compression logic in ma/va converters
Date: Mon, 7 Aug 2023 17:26:31 +0100	[thread overview]
Message-ID: <64d11b39.050a0220.2ab40.c2cc@mx.google.com> (raw)
In-Reply-To: <db533ea3-8b1f-fb36-a0b8-d196f3a84f33@suse.com>

On Mon, Jul 31, 2023 at 05:15:19PM +0200, Jan Beulich wrote:
> On 28.07.2023 09:59, Alejandro Vallejo wrote:
> > --- a/xen/include/xen/pdx.h
> > +++ b/xen/include/xen/pdx.h
> > @@ -160,6 +160,31 @@ static inline unsigned long pdx_to_pfn(unsigned long pdx)
> >  #define mfn_to_pdx(mfn) pfn_to_pdx(mfn_x(mfn))
> >  #define pdx_to_mfn(pdx) _mfn(pdx_to_pfn(pdx))
> >  
> > +/**
> > + * Computes the offset into the direct map of an maddr
> > + *
> > + * @param ma Machine address
> > + * @return Offset on the direct map where that
> > + *         machine address can be accessed
> > + */
> > +static inline unsigned long maddr_to_directmapoff(uint64_t ma)
> 
> Was there prior agreement to use uint64_t here and ...
> 
> > +{
> > +    return ((ma & ma_top_mask) >> pfn_pdx_hole_shift) |
> > +           (ma & ma_va_bottom_mask);
> > +}
> > +
> > +/**
> > + * Computes a machine address given a direct map offset
> > + *
> > + * @param offset Offset into the direct map
> > + * @return Corresponding machine address of that virtual location
> > + */
> > +static inline uint64_t directmapoff_to_maddr(unsigned long offset)
> 
> ... here, not paddr_t?
The whole file uses uint64_t rather than paddr_t so I added the new code
using the existing convention. I can just as well make it paddr_t, it's
not a problem.

> 
> Also you use unsigned long for the offset here, but size_t for
> maddr_to_directmapoff()'s return value in __maddr_to_virt().
> Would be nice if this was consistent within the patch.
That's fair. I can leave it as "unsigned long" (seeing that a previous nit was
preferring that type over size_t).

> Especially since the names of the helper functions are longish,
> I'm afraid I'm not fully convinced of the transformation.
In what sense? If it's just naming style I'm happy to consider other names,
but taking compression logic out of non-pdx code is essential to removing
compiling it out.

> But I'm also not meaning to stand in the way, if everyone else wants to
> move in that direction.
> 
> Jan

Thanks,
Alejandro


  reply	other threads:[~2023-08-07 16:26 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-28  7:58 [PATCH v2 0/5] Make PDX compression optional Alejandro Vallejo
2023-07-28  7:58 ` [PATCH v2 1/5] arm/mm: Document the differences between arm32 and arm64 directmaps Alejandro Vallejo
2023-07-28  9:05   ` Julien Grall
2023-08-07 13:45     ` Julien Grall
2023-07-28  7:59 ` [PATCH v2 2/5] mm: Factor out the pdx compression logic in ma/va converters Alejandro Vallejo
2023-07-28  9:07   ` Julien Grall
2023-07-31 15:15   ` Jan Beulich
2023-08-07 16:26     ` Alejandro Vallejo [this message]
2023-08-08  6:05       ` Jan Beulich
2023-08-08  7:58         ` Julien Grall
2023-07-28  7:59 ` [PATCH v2 3/5] mm/pdx: Standardize region validation wrt pdx compression Alejandro Vallejo
2023-07-28 16:19   ` Julien Grall
2023-07-31 15:27   ` Jan Beulich
2023-08-07 16:50     ` Alejandro Vallejo
2023-07-28  7:59 ` [PATCH v2 4/5] pdx: Reorder pdx.[ch] Alejandro Vallejo
2023-07-28 16:20   ` Julien Grall
2023-07-28  7:59 ` [PATCH v2 5/5] pdx: Add CONFIG_HAS_PDX_COMPRESSION as a common Kconfig option Alejandro Vallejo
2023-07-28 16:27   ` Julien Grall
2023-07-28 16:36   ` Andrew Cooper
2023-07-28 16:58     ` Andrew Cooper
2023-07-31  8:00       ` Jan Beulich
2023-07-31 17:38         ` Andrew Cooper
2023-08-01  7:57           ` Jan Beulich
2023-08-07 16:06             ` Alejandro Vallejo
2023-08-08  6:17               ` Jan Beulich
2023-07-31  9:09     ` Julien Grall
2023-07-31 15:33   ` Jan Beulich
2023-08-07 17:48   ` Julien Grall
2023-08-08  9:52     ` Alejandro Vallejo

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=64d11b39.050a0220.2ab40.c2cc@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.