All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Stefano Stabellini <sstabellini@kernel.org>, WeiLiu <wl@xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Tamas K Lengyel <tamas@tklengyel.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v3 13/14] xen/mm: Convert {s, g}et_gpfn_from_mfn() to use typesafe MFN
Date: Wed, 5 Jun 2019 12:03:52 +0100	[thread overview]
Message-ID: <8270ed07-74af-aeb2-40c9-3d218d09d51d@arm.com> (raw)
In-Reply-To: <5CF7A1090200007800235782@prv1-mh.provo.novell.com>

Hi Jan,

Sorry, I seem to have missed the comments on this patch while respinning the series.

I will look at it and address them in v4.

Cheers,

On 05/06/2019 12:01, Jan Beulich wrote:
>>>> On 03.06.19 at 18:03, <julien.grall@arm.com> wrote:
>> --- a/xen/arch/x86/x86_64/traps.c
>> +++ b/xen/arch/x86/x86_64/traps.c
>> @@ -184,7 +184,8 @@ void vcpu_show_registers(const struct vcpu *v)
>>   
>>   void show_page_walk(unsigned long addr)
>>   {
>> -    unsigned long pfn, mfn = read_cr3() >> PAGE_SHIFT;
>> +    unsigned long pfn;
>> +    mfn_t mfn = maddr_to_mfn(read_cr3());
> 
> Quoting my v1 comment:
> 
> "I realize you simply take what has been there and transform it, but
>   maddr_to_mfn() (other than shifting by PAGE_SHIFT) is not truly
>   applicable here: What the CR3 register holds is not a physical address,
>   both the low twelve bits as well as the high twelve ones have different
>   meaning. The shift is correct currently because the high ones are
>   (right now) zero on reads. Please consider AND-ing with
>   X86_CR3_ADDR_MASK (or keeping the shift)."
> 
> FOAD by "please consider" I don't mean "leave it as is will be fine as
> well", but to do one of the two possible changes, with a preference
> towards the AND-ing, as that's the ultimately correct approach.
> 
>> --- a/xen/common/page_alloc.c
>> +++ b/xen/common/page_alloc.c
>> @@ -1416,7 +1416,7 @@ static void free_heap_pages(
>>   
>>           /* This page is not a guest frame any more. */
>>           page_set_owner(&pg[i], NULL); /* set_gpfn_from_mfn snoops pg owner */
>> -        set_gpfn_from_mfn(mfn_x(mfn) + i, INVALID_M2P_ENTRY);
>> +        set_pfn_from_mfn(mfn_add(mfn, + i), INVALID_M2P_ENTRY);
> 
> Quoting my v1 comment again: "Stray leftover + ?"
> 
>> --- a/xen/include/asm-x86/mm.h
>> +++ b/xen/include/asm-x86/mm.h
>> @@ -492,22 +492,26 @@ extern struct domain *dom_xen, *dom_io, *dom_cow;	/* for vmcoreinfo */
>>    */
>>   extern bool machine_to_phys_mapping_valid;
>>   
>> -static inline void set_gpfn_from_mfn(unsigned long mfn, unsigned long pfn)
>> +static inline void set_pfn_from_mfn(mfn_t mfn, unsigned long pfn)
>>   {
>> -    struct domain *d = page_get_owner(mfn_to_page(_mfn(mfn)));
>> +    const unsigned long mfn_ = mfn_x(mfn);
>> +    struct domain *d = page_get_owner(mfn_to_page(mfn));
> 
> const? (Or is this a place where I've similarly asked on an earlier
> patch already?)
> 
> Btw, the cheaper (in terms of code churn) change here would seem to
> be to name the function parameter mfn_, and the local variable mfn.
> That'll also reduce the number of uses of the unfortunate trailing-
> underscore-name.
> 
> Jan
> 
> 

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-06-05 11:04 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-03 16:03 [PATCH v3 00/14] xen/arm: Properly disable M2P on Arm Julien Grall
2019-06-03 16:03 ` [Xen-devel] " Julien Grall
2019-06-03 16:03 ` [PATCH v3 01/14] xen/x86: Make mfn_to_gfn typesafe Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-04 16:06   ` Jan Beulich
2019-07-29 12:13   ` Julien Grall
2019-08-19 13:50     ` George Dunlap
2019-06-03 16:03 ` [PATCH v3 02/14] xen/x86: Use mfn_to_gfn rather than mfn_to_gmfn Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-03 16:03 ` [PATCH v3 03/14] xen/grant-table: Make arch specific macros typesafe Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-03 16:03 ` [PATCH v3 04/14] xen: Convert hotplug page function to use typesafe MFN Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-03 16:03 ` [PATCH v3 05/14] xen: Convert is_xen_fixed_mfn " Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-03 16:03 ` [PATCH v3 06/14] xen: Convert is_xen_heap_mfn " Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-03 16:03 ` [PATCH v3 07/14] xen: Introduce HAS_M2P config and use to protect mfn_to_gmfn call Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-04 16:14   ` Jan Beulich
2019-06-04 16:22     ` Julien Grall
2019-06-05  7:14       ` Jan Beulich
2019-06-05  9:35         ` Julien Grall
2019-06-05 10:10           ` Jan Beulich
2019-07-29 12:08             ` Julien Grall
2019-06-03 16:03 ` [PATCH v3 08/14] xen: Remove mfn_to_gmfn macro Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-03 16:03 ` [PATCH v3 09/14] xen/x86: mm: Re-implement set_gpfn_from_mfn() as a static inline function Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-04 16:21   ` Jan Beulich
2019-06-04 16:23     ` Julien Grall
2019-06-05  7:18       ` Jan Beulich
2019-06-03 16:03 ` [PATCH v3 10/14] xen/x86: pv: Convert update_intpte() to use typesafe MFN Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-03 16:03 ` [PATCH v3 11/14] xen/x86: p2m: Remove duplicate error message in p2m_pt_audit_p2m() Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-05 10:43   ` Jan Beulich
2019-06-05 10:44     ` Julien Grall
2019-06-03 16:03 ` [PATCH v3 12/14] xen/x86: p2m: Rework printk format in audit_p2m() Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-03 16:03 ` [PATCH v3 13/14] xen/mm: Convert {s, g}et_gpfn_from_mfn() to use typesafe MFN Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-05 11:01   ` Jan Beulich
2019-06-05 11:03     ` Julien Grall [this message]
2019-06-03 16:03 ` [PATCH v3 14/14] xen/mm: Provide dummy M2P-related helpers when !CONFIG_HAVE_M2P Julien Grall
2019-06-03 16:03   ` [Xen-devel] " Julien Grall
2019-06-05 11:07   ` Jan Beulich
2019-06-05 11:17     ` Julien Grall

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=8270ed07-74af-aeb2-40c9-3d218d09d51d@arm.com \
    --to=julien.grall@arm.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=konrad.wilk@oracle.com \
    --cc=roger.pau@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tamas@tklengyel.com \
    --cc=tim@xen.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.