From: Hongyan Xia <hx242@xen.org>
To: Jan Beulich <jbeulich@suse.com>, Wei Liu <wl@xen.org>
Cc: xen-devel@lists.xenproject.org,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Andrew Cooper" <andrew.cooper3@citrix.com>
Subject: Re: [PATCH 5/5] x86_64/mm: map and unmap page tables in destroy_m2p_mapping
Date: Tue, 07 Apr 2020 17:23:44 +0100 [thread overview]
Message-ID: <6507a4a619c80afce01f2eaeef1f0d772aaadfef.camel@xen.org> (raw)
In-Reply-To: <7981c892-0e5c-03fb-679c-94f023a5c9fc@suse.com>
On Wed, 2020-04-01 at 14:40 +0200, Jan Beulich wrote:
> On 23.03.2020 10:41, Hongyan Xia wrote:
> > @@ -297,26 +298,33 @@ static void destroy_m2p_mapping(struct
> > mem_hotadd_info *info)
> > continue;
> > }
> >
> > - l2_ro_mpt = l3e_to_l2e(l3_ro_mpt[l3_table_offset(va)]);
> > + l2_ro_mpt =
> > map_l2t_from_l3e(l3_ro_mpt[l3_table_offset(va)]);
> > if (!(l2e_get_flags(l2_ro_mpt[l2_table_offset(va)]) &
> > _PAGE_PRESENT))
> > {
> > i = ( i & ~((1UL << (L2_PAGETABLE_SHIFT - 3)) - 1)) +
> > (1UL << (L2_PAGETABLE_SHIFT - 3)) ;
> > + UNMAP_DOMAIN_PAGE(l2_ro_mpt);
> > continue;
> > }
> >
> > pt_pfn = l2e_get_pfn(l2_ro_mpt[l2_table_offset(va)]);
> > if ( hotadd_mem_valid(pt_pfn, info) )
> > {
> > + l2_pgentry_t *l2t;
> > +
> > destroy_xen_mappings(rwva, rwva + (1UL <<
> > L2_PAGETABLE_SHIFT));
> >
> > - l2_ro_mpt =
> > l3e_to_l2e(l3_ro_mpt[l3_table_offset(va)]);
> > - l2e_write(&l2_ro_mpt[l2_table_offset(va)],
> > l2e_empty());
> > + l2t =
> > map_l2t_from_l3e(l3_ro_mpt[l3_table_offset(va)]);
>
> Why a 2nd mapping of the same L3 entry that you've already mapped
> into l2_ro_mpt?
> > + l2e_write(&l2t[l2_table_offset(va)], l2e_empty());
> > + UNMAP_DOMAIN_PAGE(l2t);
>
> If this then weren't to go away, it should again be the lowercase
> variant imo, as the variable's scope ends here.
Hmm, I don't see a reason why l2_ro_mpt needs to be mapped again either
(and don't see why it was re-derived in the original code), so yes, I
think the map and unmap can just be dropped. Will revise.
Hongyan
next prev parent reply other threads:[~2020-04-07 16:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 9:41 [Xen-devel] [PATCH 0/5] use new API for Xen page tables Hongyan Xia
2020-03-23 9:41 ` [Xen-devel] [PATCH 1/5] x86/shim: map and unmap page tables in replace_va_mapping Hongyan Xia
2020-04-01 12:11 ` Jan Beulich
2020-03-23 9:41 ` [Xen-devel] [PATCH 2/5] x86_64/mm: map and unmap page tables in m2p_mapped Hongyan Xia
2020-04-01 12:19 ` Jan Beulich
2020-03-23 9:41 ` [Xen-devel] [PATCH 3/5] x86_64/mm: map and unmap page tables in share_hotadd_m2p_table Hongyan Xia
2020-04-01 12:29 ` Jan Beulich
2020-04-07 15:11 ` Hongyan Xia
2020-04-07 15:14 ` Jan Beulich
2020-04-08 9:32 ` Hongyan Xia
2020-03-23 9:41 ` [Xen-devel] [PATCH 4/5] x86_64/mm: map and unmap page tables in destroy_compat_m2p_mapping Hongyan Xia
2020-03-23 9:41 ` [Xen-devel] [PATCH 5/5] x86_64/mm: map and unmap page tables in destroy_m2p_mapping Hongyan Xia
2020-04-01 12:40 ` Jan Beulich
2020-04-07 16:23 ` Hongyan Xia [this message]
2020-03-29 15:06 ` [Xen-devel] [PATCH 0/5] use new API for Xen page tables Wei Liu
2020-03-30 8:25 ` Hongyan Xia
2020-04-06 8:27 ` Hongyan Xia
2020-04-06 11:03 ` Jan Beulich
2020-04-07 14:28 ` Hongyan Xia
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=6507a4a619c80afce01f2eaeef1f0d772aaadfef.camel@xen.org \
--to=hx242@xen.org \
--cc=andrew.cooper3@citrix.com \
--cc=jbeulich@suse.com \
--cc=roger.pau@citrix.com \
--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 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).