From: Julien Grall <julien.grall@linaro.org>
To: Paul Durrant <Paul.Durrant@citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: Kevin Tian <kevin.tian@intel.com>,
Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
Razvan Cojocaru <rcojocaru@bitdefender.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Jun Nakajima <jun.nakajima@intel.com>,
Andrew Cooper <Andrew.Cooper3@citrix.com>,
"Tim (Xen.org)" <tim@xen.org>,
George Dunlap <George.Dunlap@citrix.com>,
Julien Grall <julien.grall@arm.com>,
Tamas K Lengyel <tamas@tklengyel.com>,
Jan Beulich <jbeulich@suse.com>,
Shane Wang <shane.wang@intel.com>,
Ian Jackson <Ian.Jackson@citrix.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Gang Wei <gang.wei@intel.com>
Subject: Re: [PATCH v2 9/9] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN
Date: Fri, 6 Oct 2017 11:49:13 +0100 [thread overview]
Message-ID: <3e427451-4fa2-7e9f-5d7a-dfa23d0ab35b@linaro.org> (raw)
In-Reply-To: <73c55f21a19b4831b011044c43fa9dbb@AMSPEX02CL03.citrite.net>
Hi Paul,
On 06/10/17 10:11, Paul Durrant wrote:
>> diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
>> index 0410b1e86b..1e7a0c6c40 100644
>> --- a/xen/arch/arm/p2m.c
>> +++ b/xen/arch/arm/p2m.c
>> @@ -38,12 +38,6 @@ static unsigned int __read_mostly max_vmid =
>> MAX_VMID_8_BIT;
>>
>> #define P2M_ROOT_PAGES (1<<P2M_ROOT_ORDER)
>>
>> -/* Override macros from asm/mm.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))
>> -
>> unsigned int __read_mostly p2m_ipa_bits;
>>
>> /* Helpers to lookup the properties of each level */
>> @@ -98,7 +92,7 @@ void dump_p2m_lookup(struct domain *d, paddr_t
>> addr)
>> printk("dom%d IPA 0x%"PRIpaddr"\n", d->domain_id, addr);
>>
>> printk("P2M @ %p mfn:0x%lx\n",
>> - p2m->root, __page_to_mfn(p2m->root));
>> + p2m->root, mfn_x(page_to_mfn(p2m->root)));
>
> The format specifier should really be using PRI_mfn now. Same goes for others below.
Similarly we could do much more clean-up in each chunk. So where do I
stop? That's why I wrote down in this comment I will not handle all the
clean-up...
>> diff --git a/xen/arch/x86/pv/descriptor-tables.c
>> b/xen/arch/x86/pv/descriptor-tables.c
>> index 81973af124..f2b20f9910 100644
>> --- a/xen/arch/x86/pv/descriptor-tables.c
>> +++ b/xen/arch/x86/pv/descriptor-tables.c
>> @@ -25,16 +25,6 @@
>> #include <asm/p2m.h>
>> #include <asm/pv/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))
>> -
>> -/*******************
>> - * Descriptor Tables
>> - */
>> -
>
> Is the comment wrong?
[...]
>> diff --git a/xen/arch/x86/pv/emul-priv-op.c b/xen/arch/x86/pv/emul-priv-
>> op.c
>> index dd90713acf..9ccbd021ef 100644
>> --- 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
>> - */
>> -
>
> What's wrong with the comment?
The file is dedicated to I/O emulation support as said in the header and
the name. I can understand why it was there given there was macros
defined not related to I/O. Now they are dropped, why would you need a
comment to separate includes and the code?
[...]
>> diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
>> index 86506f3747..b85394d1f9 100644
>> --- a/xen/arch/x86/traps.c
>> +++ b/xen/arch/x86/traps.c
>> @@ -811,7 +811,7 @@ int wrmsr_hypervisor_regs(uint32_t idx, uint64_t val)
>>
>> gdprintk(XENLOG_WARNING,
>> "Bad GMFN %lx (MFN %lx) to MSR %08x\n",
>> - gmfn, page ? page_to_mfn(page) : -1UL, base);
>> + gmfn, page ? mfn_x(page_to_mfn(page)) : -1UL, base);
>
> Would this not be better as mfn_x(page ? page_to_mfn(page) : INVALID_MFN), as you have done elsewhere?
See above.
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-10-06 10:49 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-05 17:42 [PATCH v2 0/9] xen: Convert __page_to_mfn and __mfn_to_page to use typesafe MFN Julien Grall
2017-10-05 17:42 ` [PATCH v2 1/9] xen/arm: domain_build: Clean-up insert_11_bank Julien Grall
2017-10-05 17:42 ` [PATCH v2 2/9] xen/arm32: mm: Rework is_xen_heap_page to avoid nameclash Julien Grall
2017-10-05 17:42 ` [PATCH v2 3/9] xen/x86: mem_sharing: Use copy_domain_page in __mem_sharing_unshare_page Julien Grall
2017-10-05 17:49 ` Andrew Cooper
2017-10-05 17:52 ` Tamas K Lengyel
2017-10-05 17:42 ` [PATCH v2 4/9] xen/x86: Use maddr_to_page and maddr_to_mfn to avoid open-coded >> PAGE_SHIFT Julien Grall
2017-10-05 17:42 ` [PATCH v2 5/9] xen/kimage: Remove defined but unused variables Julien Grall
2017-10-05 17:42 ` [PATCH v2 6/9] xen/kexec, kimage: Convert kexec and kimage to use typesafe mfn_t Julien Grall
2017-10-05 17:51 ` Andrew Cooper
2017-10-05 17:42 ` [PATCH v2 7/9] xen/xenoprof: Convert the file to use typesafe MFN Julien Grall
2017-10-05 17:42 ` [PATCH v2 8/9] xen/tmem: Convert the file common/tmem_xen.c " Julien Grall
2017-10-05 17:42 ` [PATCH v2 9/9] xen: Convert __page_to_mfn and __mfn_to_page " Julien Grall
2017-10-05 17:59 ` Andrew Cooper
2017-10-05 18:31 ` Razvan Cojocaru
2017-10-06 9:11 ` Paul Durrant
2017-10-06 10:49 ` Julien Grall [this message]
2017-10-06 10:55 ` Paul Durrant
2017-10-06 11:00 ` Julien Grall
2017-10-06 11:44 ` Paul Durrant
2017-10-06 13:02 ` Boris Ostrovsky
2017-10-09 11:42 ` Jan Beulich
2017-10-09 12:20 ` Julien Grall
2017-10-09 13:40 ` Jan Beulich
2017-10-09 13:48 ` Julien Grall
2017-10-09 14:07 ` Jan Beulich
2017-10-10 5:18 ` Tian, Kevin
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=3e427451-4fa2-7e9f-5d7a-dfa23d0ab35b@linaro.org \
--to=julien.grall@linaro.org \
--cc=Andrew.Cooper3@citrix.com \
--cc=George.Dunlap@citrix.com \
--cc=Ian.Jackson@citrix.com \
--cc=Paul.Durrant@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=gang.wei@intel.com \
--cc=jbeulich@suse.com \
--cc=julien.grall@arm.com \
--cc=jun.nakajima@intel.com \
--cc=kevin.tian@intel.com \
--cc=konrad.wilk@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).