From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Tamas K Lengyel <tamas@tklengyel.com>,
Wei Liu <wei.liu2@citrix.com>,
Razvan Cojocaru <rcojocaru@bitdefender.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Xen-devel <xen-devel@lists.xen.org>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [PATCH 04/14] x86/p2m: Fix locking in p2m_altp2m_lazy_copy()
Date: Wed, 5 Dec 2018 19:53:34 +0000 [thread overview]
Message-ID: <da060320-318f-0ca2-ea78-967c592373ad@citrix.com> (raw)
In-Reply-To: <5BF6C4E602000078001FEFCA@prv1-mh.provo.novell.com>
On 22/11/2018 15:01, Jan Beulich wrote:
>>>> On 21.11.18 at 14:21, <andrew.cooper3@citrix.com> wrote:
>> --- a/xen/arch/x86/mm/p2m.c
>> +++ b/xen/arch/x86/mm/p2m.c
>> @@ -2184,24 +2184,29 @@ bool_t p2m_altp2m_lazy_copy(struct vcpu *v, paddr_t gpa,
>> unsigned long mask;
>> mfn_t mfn;
>> int rv;
>> + bool ret;
>>
>> *ap2m = p2m_get_altp2m(v);
>>
>> mfn = get_gfn_type_access(*ap2m, gfn_x(gfn), &p2mt, &p2ma,
>> 0, &page_order);
>> - __put_gfn(*ap2m, gfn_x(gfn));
>>
>> + /* Entry already present in ap2m? Caller should handle the fault. */
>> if ( !mfn_eq(mfn, INVALID_MFN) )
>> - return 0;
>> + {
>> + ret = false;
>> + goto put_ap2m;
>> + }
>>
>> mfn = get_gfn_type_access(hp2m, gfn_x(gfn), &p2mt, &p2ma,
>> P2M_ALLOC, &page_order);
>> - __put_gfn(hp2m, gfn_x(gfn));
>>
>> + /* Entry not present in hp2m? Caller should handle the fault. */
>> if ( mfn_eq(mfn, INVALID_MFN) )
>> - return 0;
>> -
>> - p2m_lock(*ap2m);
>> + {
>> + ret = false;
>> + goto put_hp2m;
> Wouldn't this better be named "put_gfn" (or "drop_gfn" to avoid the
> name collision with the function)?
No - I don't think so. We have two separate refs to drop, one from the
hp2m and one from the ap2m.
This is why the labels are named symmetrically.
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2018-12-05 19:53 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 13:21 [PATCH 00/14] XSA-277 followup Andrew Cooper
2018-11-21 13:21 ` [PATCH 01/14] x86/soft-reset: Drop gfn reference after calling get_gfn_query() Andrew Cooper
2018-11-22 14:45 ` Jan Beulich
2018-11-21 13:21 ` [PATCH 02/14] x86/mem-sharing: Don't leave the altp2m lock held when nominating a page Andrew Cooper
2018-11-21 16:56 ` Tamas K Lengyel
2018-11-22 14:46 ` Jan Beulich
2018-11-21 13:21 ` [PATCH 03/14] AMD/IOMMU: Fix multiple reference counting errors Andrew Cooper
2018-11-22 14:51 ` Jan Beulich
2018-11-22 17:46 ` Andrew Cooper
2018-11-23 8:23 ` Jan Beulich
2018-11-23 16:03 ` Andrew Cooper
2018-11-26 9:05 ` Jan Beulich
2019-01-31 15:59 ` Woods, Brian
2018-11-21 13:21 ` [PATCH 04/14] x86/p2m: Fix locking in p2m_altp2m_lazy_copy() Andrew Cooper
2018-11-21 13:59 ` Razvan Cojocaru
2018-11-22 15:01 ` Jan Beulich
2018-12-05 19:53 ` Andrew Cooper [this message]
2018-11-21 13:21 ` [PATCH 05/14] x86/p2m: Don't overwrite p2m_altp2m_lazy_copy()'s callers p2m pointer Andrew Cooper
2018-11-21 14:07 ` Razvan Cojocaru
2018-11-22 15:03 ` Jan Beulich
2018-11-21 13:21 ` [PATCH 06/14] x86/hvm: Make the altp2m locking easier to follow Andrew Cooper
2018-11-21 14:43 ` Razvan Cojocaru
2018-11-22 15:08 ` Jan Beulich
2018-11-21 13:21 ` [PATCH 07/14] x86/p2m: Coding style cleanup Andrew Cooper
2018-11-22 15:12 ` Jan Beulich
2018-11-21 13:21 ` [PATCH 08/14] xen/memory: Drop ARM put_gfn() stub Andrew Cooper
2018-11-22 14:07 ` Julien Grall
2018-11-22 15:15 ` Jan Beulich
2018-11-21 13:21 ` [PATCH 09/14] x86/p2m: Switch the two_gfns infrastructure to using gfn_t Andrew Cooper
2018-11-21 17:06 ` Tamas K Lengyel
2018-11-22 15:17 ` Jan Beulich
2018-11-21 13:21 ` [PATCH 10/14] x86/mm: Switch {get, put}_gfn() " Andrew Cooper
2018-11-21 14:48 ` Razvan Cojocaru
2018-11-21 16:12 ` Paul Durrant
2018-11-22 15:34 ` Jan Beulich
2018-11-23 2:58 ` Tian, Kevin
2018-11-26 15:51 ` Woods, Brian
2018-11-21 13:21 ` [PATCH 11/14] xen/mm: Switch mfn_to_virt()/virt_to_mfn() to using mfn_t Andrew Cooper
2018-11-22 14:32 ` Julien Grall
2018-11-22 15:44 ` Jan Beulich
2018-11-22 15:49 ` Andrew Cooper
2018-11-21 13:21 ` [PATCH 12/14] xen/gnttab: Drop gnttab_create_{shared, status}_page() Andrew Cooper
2018-11-22 14:35 ` Julien Grall
2018-11-22 15:47 ` Jan Beulich
2018-11-21 13:21 ` [PATCH 13/14] xen/gnttab: Simplify gnttab_map_frame() Andrew Cooper
2018-11-22 14:36 ` Julien Grall
2018-11-22 15:48 ` Jan Beulich
2018-11-21 13:21 ` [PATCH 14/14] xen/gnttab: Minor improvements to arch header files Andrew Cooper
2018-11-22 15:51 ` Jan Beulich
2018-11-22 17:56 ` Andrew Cooper
2019-01-30 20:04 ` Julien Grall
2019-01-30 20:05 ` Andrew Cooper
2018-11-21 17:19 ` [PATCH 00/14] XSA-277 followup Tamas K Lengyel
2018-11-21 21:22 ` Andrew Cooper
2018-11-21 22:42 ` Tamas K Lengyel
2018-11-22 0:08 ` Andrew Cooper
2018-11-26 17:48 ` Tamas K Lengyel
2018-11-23 15:46 ` Roger Pau Monné
2019-01-30 18:36 ` Pings for 4.12 " Andrew Cooper
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=da060320-318f-0ca2-ea78-967c592373ad@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=rcojocaru@bitdefender.com \
--cc=roger.pau@citrix.com \
--cc=tamas@tklengyel.com \
--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).