From: Julien Grall <julien.grall@arm.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Tim Deegan <tim@xen.org>, Kevin Tian <kevin.tian@intel.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Razvan Cojocaru <rcojocaru@bitdefender.com>,
George Dunlap <george.dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
xen-devel@lists.xen.org, Paul Durrant <paul.durrant@citrix.com>,
Tamas K Lengyel <tamas@tklengyel.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Shane Wang <shane.wang@intel.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Gang Wei <gang.wei@intel.com>
Subject: Re: [PATCH v4 16/16] xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN
Date: Wed, 14 Mar 2018 17:02:35 +0000 [thread overview]
Message-ID: <a7b1dd2e-7028-1c93-e2ce-ccb3bc6349f5@arm.com> (raw)
In-Reply-To: <5A99850402000078001ADF1F@prv-mh.provo.novell.com>
Hi Jan,
On 03/02/2018 04:08 PM, Jan Beulich wrote:
>>>> On 21.02.18 at 15:02, <julien.grall@arm.com> wrote:
>> --- a/xen/arch/x86/pv/emul-priv-op.c
>> +++ b/xen/arch/x86/pv/emul-priv-op.c
>> @@ -43,16 +43,6 @@
>> #include "emulate.h"
>> #include "mm.h"
>>
>> -/* Override macros from asm/page.h to make them work with mfn_t */
>> -#undef mfn_to_page
>> -#define mfn_to_page(mfn) __mfn_to_page(mfn_x(mfn))
>> -#undef page_to_mfn
>> -#define page_to_mfn(pg) _mfn(__page_to_mfn(pg))
>> -
>> -/***********************
>> - * I/O emulation support
>> - */
>
> Why does this comment go away?
From an earlier review, Andrew said:
"If you're making this change, please take out the Descriptor Tables
comment like you do with I/O below, because the entire file is dedicated
to descriptor table support and it will save me one item on a cleanup
patch :)."
The descriptor one got remove by 634afe43ac "x86/pv: Rename
invalidate_shadow_ldt() to pv_destroy_ldt()". So it is not part of this
patch anymore.
>
>> @@ -478,10 +478,10 @@ extern paddr_t mem_hotplug;
>> #define SHARED_M2P(_e) ((_e) == SHARED_M2P_ENTRY)
>>
>> #define compat_machine_to_phys_mapping ((unsigned int
>> *)RDWR_COMPAT_MPT_VIRT_START)
>> -#define _set_gpfn_from_mfn(mfn, pfn) ({ \
>> - struct domain *d = page_get_owner(__mfn_to_page(mfn)); \
>> - unsigned long entry = (d && (d == dom_cow)) ? \
>> - SHARED_M2P_ENTRY : (pfn); \
>> +#define _set_gpfn_from_mfn(mfn, pfn) ({ \
>> + struct domain *d = page_get_owner(mfn_to_page(_mfn(mfn))); \
>> + unsigned long entry = (d && (d == dom_cow)) ? \
>> + SHARED_M2P_ENTRY : (pfn); \
>
> Please don't break the alignment of the backslashes here. It also looks
> like three of the four lines could be left alone altogether.
I am not sure why I modified the 3 other lines. I fixed it.
>
>> @@ -157,10 +157,10 @@ static inline l4_pgentry_t l4e_from_paddr(paddr_t pa, unsigned int flags)
>> #define l4e_from_intpte(intpte) ((l4_pgentry_t) { (intpte_t)(intpte) })
>>
>> /* Construct a pte from a page pointer and access flags. */
>> -#define l1e_from_page(page, flags) l1e_from_pfn(__page_to_mfn(page), (flags))
>> -#define l2e_from_page(page, flags) l2e_from_pfn(__page_to_mfn(page), (flags))
>> -#define l3e_from_page(page, flags) l3e_from_pfn(__page_to_mfn(page), (flags))
>> -#define l4e_from_page(page, flags) l4e_from_pfn(__page_to_mfn(page), (flags))
>> +#define l1e_from_page(page, flags) l1e_from_mfn(page_to_mfn(page), (flags))
>> +#define l2e_from_page(page, flags) l2e_from_mfn(page_to_mfn(page), (flags))
>> +#define l3e_from_page(page, flags) l3e_from_mfn(page_to_mfn(page), (flags))
>> +#define l4e_from_page(page, flags) l4e_from_mfn(page_to_mfn(page), (flags))
>
> Would again have been nice if you got rid of the extra parentheses
> here at the same time.
I admit, I don't spend my time trying to find the possible cleanup in
the x86 code. I just do mechanical change and when I get bored I do a
bit more.
>
>> @@ -240,12 +240,12 @@ void copy_page_sse2(void *, const void *);
>> #define __mfn_to_virt(mfn) (maddr_to_virt((paddr_t)(mfn) << PAGE_SHIFT))
>>
>> /* Convert between machine frame numbers and page-info structures. */
>> -#define __mfn_to_page(mfn) (frame_table + pfn_to_pdx(mfn))
>> -#define __page_to_mfn(pg) pdx_to_pfn((unsigned long)((pg) - frame_table))
>> +#define mfn_to_page(mfn) (frame_table + mfn_to_pdx(mfn))
>> +#define page_to_mfn(pg) pdx_to_mfn((unsigned long)((pg) - frame_table))
>>
>> /* Convert between machine addresses and page-info structures. */
>> -#define __maddr_to_page(ma) __mfn_to_page((ma) >> PAGE_SHIFT)
>> -#define __page_to_maddr(pg) ((paddr_t)__page_to_mfn(pg) << PAGE_SHIFT)
>> +#define __maddr_to_page(ma) mfn_to_page(maddr_to_mfn(ma))
>> +#define __page_to_maddr(pg) (mfn_to_maddr(page_to_mfn(pg)))
>
> Same here.
>
> With at least the first two items taken care of, relevant x86 pieces
> Acked-by: Jan Beulich <jbeulich@suse.com>
I don't plan to address the first one as Andrew were happy with it.
Cheers,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-03-14 17:02 UTC|newest]
Thread overview: 76+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-21 14:02 [PATCH v4 00/16] xen: Convert page_to_mfn and mfn_to_page to use typesafe MFN Julien Grall
2018-02-21 14:02 ` [PATCH v4 01/16] xen/tmem: Convert the file common/tmem_xen.c " Julien Grall
2018-02-21 14:02 ` [PATCH v4 02/16] xen/arm: setup: use maddr_to_mfn rather than _mfn(paddr_to_pfn(...)) Julien Grall
2018-02-21 14:02 ` [PATCH v4 03/16] xen/arm: mm: Use gaddr_to_gfn rather than _gfn(paddr_to_pfn(...)) Julien Grall
2018-02-21 14:02 ` [PATCH v4 04/16] xen/arm: mm: Remove unused M2P code Julien Grall
2018-02-21 14:02 ` [PATCH v4 05/16] xen/arm: mm: Remove unused relinquish_shared_pages Julien Grall
2018-02-21 14:02 ` [PATCH v4 06/16] xen/x86: Remove unused override of page_to_mfn/mfn_to_page Julien Grall
2018-03-01 11:20 ` George Dunlap
2018-03-02 14:42 ` Jan Beulich
2018-03-02 14:44 ` Julien Grall
2018-03-02 15:11 ` Jan Beulich
2018-03-05 13:29 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 07/16] xen/x86: mm: Switch x86/mm.c to use typesafe for virt_to_mfn Julien Grall
2018-03-02 14:45 ` Jan Beulich
2018-03-02 14:46 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 08/16] xen/mm: Drop the parameter mfn from populate_pt_range Julien Grall
2018-02-22 16:35 ` Wei Liu
2018-02-22 16:40 ` Julien Grall
2018-02-22 16:51 ` Wei Liu
2018-02-22 16:55 ` Julien Grall
2018-02-22 17:10 ` Wei Liu
2018-03-02 14:55 ` Jan Beulich
2018-03-05 13:43 ` Julien Grall
2018-03-05 14:00 ` Jan Beulich
2018-03-05 14:11 ` Julien Grall
2018-03-05 14:38 ` Jan Beulich
2018-03-09 17:29 ` Wei Liu
2018-03-11 19:30 ` Julien Grall
2018-03-12 6:36 ` Jan Beulich
2018-03-14 15:22 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 09/16] xen/pdx: Introduce helper to convert MFN <-> PDX Julien Grall
2018-02-22 16:39 ` Wei Liu
2018-02-21 14:02 ` [PATCH v4 10/16] xen/mm: Switch map_pages_to_xen to use MFN typesafe Julien Grall
2018-02-23 4:59 ` Tian, Kevin
2018-02-23 17:21 ` Wei Liu
2018-03-02 15:06 ` Jan Beulich
2018-03-02 15:08 ` Jan Beulich
2018-03-05 14:07 ` Julien Grall
2018-03-05 14:39 ` Jan Beulich
2018-03-05 14:44 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 11/16] xen/mm: Switch page_alloc.c to typesafe MFN Julien Grall
2018-02-23 17:21 ` Wei Liu
2018-03-02 15:18 ` Jan Beulich
2018-03-02 15:57 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 12/16] xen/mm: Switch common/memory.c to use " Julien Grall
2018-02-23 17:26 ` Wei Liu
2018-02-23 17:46 ` Julien Grall
2018-02-23 18:05 ` Wei Liu
2018-02-23 18:06 ` Julien Grall
2018-02-23 18:10 ` Wei Liu
2018-03-02 15:34 ` Jan Beulich
2018-03-05 14:18 ` Julien Grall
2018-03-05 14:41 ` Jan Beulich
2018-03-09 17:33 ` Wei Liu
2018-03-11 19:44 ` Julien Grall
2018-03-12 6:39 ` Jan Beulich
2018-03-14 16:08 ` Julien Grall
2018-02-21 14:02 ` [PATCH v4 13/16] xen/grant: Switch {create, replace}_grant_p2m_mapping to " Julien Grall
2018-02-23 17:29 ` Wei Liu
2018-03-02 15:38 ` Jan Beulich
2018-02-21 14:02 ` [PATCH v4 14/16] xen/grant: Switch common/grant_table.c to use " Julien Grall
2018-02-23 17:30 ` Wei Liu
2018-03-02 15:54 ` Jan Beulich
2018-03-02 15:59 ` Julien Grall
2018-03-02 16:12 ` Jan Beulich
2018-02-21 14:02 ` [PATCH v4 15/16] xen/x86: Switch mfn_to_page in x86_64/mm.c " Julien Grall
2018-03-02 15:57 ` Jan Beulich
2018-02-21 14:02 ` [PATCH v4 16/16] xen: Convert page_to_mfn and mfn_to_page " Julien Grall
2018-02-21 14:25 ` Razvan Cojocaru
2018-02-21 14:59 ` Paul Durrant
2018-02-21 23:20 ` Boris Ostrovsky
2018-02-23 4:59 ` Tian, Kevin
2018-02-23 17:31 ` Wei Liu
2018-03-02 16:08 ` Jan Beulich
2018-03-14 17:02 ` Julien Grall [this message]
2018-03-15 7:07 ` Jan Beulich
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=a7b1dd2e-7028-1c93-e2ce-ccb3bc6349f5@arm.com \
--to=julien.grall@arm.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=gang.wei@intel.com \
--cc=george.dunlap@eu.citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=paul.durrant@citrix.com \
--cc=rcojocaru@bitdefender.com \
--cc=shane.wang@intel.com \
--cc=sstabellini@kernel.org \
--cc=suravee.suthikulpanit@amd.com \
--cc=tamas@tklengyel.com \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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.