From: Yu Zhang <yu.c.zhang@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Paul Durrant <paul.durrant@citrix.com>,
zhiyuan.lv@intel.com, xen-devel@lists.xen.org
Subject: Re: [PATCH v10 6/6] x86/ioreq server: Synchronously reset outstanding p2m_ioreq_server entries when an ioreq server unmaps.
Date: Wed, 5 Apr 2017 17:11:06 +0800 [thread overview]
Message-ID: <58E4B4AA.5050303@linux.intel.com> (raw)
In-Reply-To: <58E284FA020000780014C2F0@prv-mh.provo.novell.com>
On 4/3/2017 11:23 PM, Jan Beulich wrote:
>>>> On 02.04.17 at 14:24, <yu.c.zhang@linux.intel.com> wrote:
>> After an ioreq server has unmapped, the remaining p2m_ioreq_server
>> entries need to be reset back to p2m_ram_rw. This patch does this
>> synchronously by iterating the p2m table.
>>
>> The synchronous resetting is necessary because we need to guarantee
>> the p2m table is clean before another ioreq server is mapped. And
>> since the sweeping of p2m table could be time consuming, it is done
>> with hypercall continuation.
>>
>> Signed-off-by: Yu Zhang <yu.c.zhang@linux.intel.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> albeit I think ...
>
>> --- a/xen/arch/x86/mm/p2m.c
>> +++ b/xen/arch/x86/mm/p2m.c
>> @@ -1031,6 +1031,35 @@ void p2m_change_type_range(struct domain *d,
>> p2m_unlock(p2m);
>> }
>>
>> +/* Synchronously modify the p2m type for a range of gfns from ot to nt. */
>> +void p2m_finish_type_change(struct domain *d,
>> + gfn_t first_gfn, unsigned long max_nr,
>> + p2m_type_t ot, p2m_type_t nt)
>> +{
>> + struct p2m_domain *p2m = p2m_get_hostp2m(d);
>> + p2m_type_t t;
>> + unsigned long gfn = gfn_x(first_gfn);
>> + unsigned long last_gfn = gfn + max_nr - 1;
>> +
>> + ASSERT(ot != nt);
>> + ASSERT(p2m_is_changeable(ot) && p2m_is_changeable(nt));
>> +
>> + p2m_lock(p2m);
>> +
>> + last_gfn = min(last_gfn, p2m->max_mapped_pfn);
>> + while ( gfn <= last_gfn )
>> + {
>> + get_gfn_query_unlocked(d, gfn, &t);
>> +
>> + if ( t == ot )
>> + p2m_change_type_one(d, gfn, t, nt);
>> +
>> + gfn++;
>> + }
>> +
>> + p2m_unlock(p2m);
>> +}
> ... this could be improved for reduction of overall latency: A fixed
> limit as input if not very useful, as it does matter quite a bit whether
> need to call p2m_change_type_one(). Doing 256 iteration with no
> single call is going to be pretty fast I think, so it would be desirable
> to weigh differently iterations with and without call to that function.
Oh, thanks for your advice, very enlightening.
With code freeze date approaching, how about we solve this in a separate
patch? :)
I've drafted one, and will send it out in another mail. Hope the
direction is correct.
B.R.
Yu
> Jan
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> https://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-04-05 9:11 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-02 12:24 [PATCH v10 0/6] x86/ioreq server: Introduce HVMMEM_ioreq_server mem type Yu Zhang
2017-04-02 12:24 ` [PATCH v10 1/6] x86/ioreq server: Release the p2m lock after mmio is handled Yu Zhang
2017-04-02 12:24 ` [PATCH v10 2/6] x86/ioreq server: Add DMOP to map guest ram with p2m_ioreq_server to an ioreq server Yu Zhang
2017-04-03 14:21 ` Jan Beulich
2017-04-05 13:48 ` George Dunlap
2017-04-02 12:24 ` [PATCH v10 3/6] x86/ioreq server: Add device model wrappers for new DMOP Yu Zhang
2017-04-03 8:13 ` Paul Durrant
2017-04-03 9:28 ` Wei Liu
2017-04-05 6:53 ` Yu Zhang
2017-04-05 9:21 ` Jan Beulich
2017-04-05 9:22 ` Yu Zhang
2017-04-05 9:38 ` Jan Beulich
2017-04-05 10:08 ` Wei Liu
2017-04-05 10:20 ` Wei Liu
2017-04-05 10:21 ` Yu Zhang
2017-04-05 10:21 ` Yu Zhang
2017-04-05 10:33 ` Wei Liu
2017-04-05 10:26 ` Yu Zhang
2017-04-05 10:46 ` Jan Beulich
2017-04-05 10:50 ` Yu Zhang
2017-04-02 12:24 ` [PATCH v10 4/6] x86/ioreq server: Handle read-modify-write cases for p2m_ioreq_server pages Yu Zhang
2017-04-02 12:24 ` [PATCH v10 5/6] x86/ioreq server: Asynchronously reset outstanding p2m_ioreq_server entries Yu Zhang
2017-04-03 14:36 ` Jan Beulich
2017-04-03 14:38 ` Jan Beulich
2017-04-05 7:18 ` Yu Zhang
2017-04-05 8:11 ` Jan Beulich
2017-04-05 14:41 ` George Dunlap
2017-04-05 16:22 ` Yu Zhang
2017-04-05 16:35 ` George Dunlap
2017-04-05 16:32 ` Yu Zhang
2017-04-05 17:01 ` George Dunlap
2017-04-05 17:18 ` Yu Zhang
2017-04-05 17:28 ` Yu Zhang
2017-04-05 18:02 ` Yu Zhang
2017-04-05 18:04 ` Yu Zhang
2017-04-06 7:48 ` Jan Beulich
2017-04-06 8:27 ` Yu Zhang
2017-04-06 8:44 ` Jan Beulich
2017-04-06 7:43 ` Jan Beulich
2017-04-05 17:29 ` George Dunlap
2017-04-02 12:24 ` [PATCH v10 6/6] x86/ioreq server: Synchronously reset outstanding p2m_ioreq_server entries when an ioreq server unmaps Yu Zhang
2017-04-03 8:16 ` Paul Durrant
2017-04-03 15:23 ` Jan Beulich
2017-04-05 9:11 ` Yu Zhang [this message]
2017-04-05 9:41 ` Jan Beulich
2017-04-05 14:46 ` George Dunlap
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=58E4B4AA.5050303@linux.intel.com \
--to=yu.c.zhang@linux.intel.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=george.dunlap@eu.citrix.com \
--cc=paul.durrant@citrix.com \
--cc=xen-devel@lists.xen.org \
--cc=zhiyuan.lv@intel.com \
/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).