[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 2/5] mm: Factor out the pdx compression logic in ma/va converters


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 31 Jul 2023 17:15:19 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=7WWRE1l7TrgEFtXxBf/7xoEUBU43Vy6Z4xGD/r5ngYg=; b=nF3fdYpLgtJohbI2L3bNOZdDyoZUp/gyFeaic8I8UgCbeL0tMAb0ud5nPOp5hweuJlqrrImFxYVdklC3b6qWSJbVPl70rsAjFaAeCkpcpKoeSQkcVju8ZN3OABD6yMAiBRN1jkaMBr47+WlP6y0NzI3od9SVxkwcGwjYF/j+S+BqT9ts5hY/2/YzTSY9bnq/u3d0+z30sV00m5qGcJy/Gi9p7fGZdhDEe0R8lF+miONyFN4lF/QZ5esdgng6WofSidMjiyVZthYn/skR91xbdPy5261g4Obj4joucCH4wKbMfepaG+O1315ackyIZmrPp83diCqNhJIA74h2Bf7NeA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TRnfRIfi8Yv1LpQq4RsB3++hNbmfu+0apVW5cydhEpW89LNFy8EILuXVpDM7CPb49tMVDXX359lrZkaTEwkN5CfI01MeYdfWgUYy2RsLGz3fqcXXwEPU3y4PE1Npe0LGr/euSe9sEQhRpbCG9q0wMyKxytuVLUzc3Imjo5N9AlGAYIFz97GtuTuMZaurcWRZrK5CLEycAvyAnX6Sm1vE02Smpqr5QXnNyeLTjsvw5aeWiTtZJYrs3ydLTjo/Ig/Bv/wpoQ03J9GD1OpEslGUJyl6XLDFlym0N3q18fZUpwAdSyMlV5mij3t6FyliAacGsxFpehdL+K2xl2i/w5ryUg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 31 Jul 2023 15:15:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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?

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.

Especially since the names of the helper functions are longish,
I'm afraid I'm not fully convinced of the transformation. But I'm
also not meaning to stand in the way, if everyone else wants to
move in that direction.

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.