All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	Liang Z Li <liang.z.li@intel.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: Yang Z Zhang <yang.z.zhang@intel.com>,
	"keir@xen.org" <keir@xen.org>, Kevin Tian <kevin.tian@intel.com>,
	Eddie Dong <eddie.dong@intel.com>, Tim Deegan <tim@xen.org>
Subject: Re: about the funtion call memory_type_changed()
Date: Fri, 16 Jan 2015 11:59:54 +0000	[thread overview]
Message-ID: <54B8FD3A.1080401@citrix.com> (raw)
In-Reply-To: <54B90A140200007800055BEA@mail.emea.novell.com>

On 16/01/15 11:54, Jan Beulich wrote:
>>>> On 16.01.15 at 11:46, <andrew.cooper3@citrix.com> wrote:
>> On 16/01/15 10:29, Li, Liang Z wrote:
>>> I found the restore process of the live migration is quit long, so I try to 
>> find out what's going on.
>>> By debugging, I found the most time consuming process is restore the VM's 
>> MTRR MSR,
>>> The process is done in the function hvm_load_mtrr_msr(), it will call the
>>> memory_type_changed(), which eventually call the time consuming function
>>> flush_all().
>>>
>>> All this is caused by adding the memory_type_changed in your patch, here is 
>> the link
>>> http://lists.xen.org/archives/html/xen-devel/2014-03/msg03792.html,
>>>
>>> I am not sure if it's necessary to call flush_all, even it's necessary,  
>> call the function
>>>  hvm_load_mtrr_msr one time will cause dozens call of flush_all, and each 
>> call of the
>>>  flush_all function will consume about 8 milliseconds, in my test 
>> environment, the VM
>>>  has 4 VCPUs, the hvm_load_mtrr_msr() will be called four times, and totally 
>> consumes
>>>  about 500 milliseconds. Obviously, there are too many flush_all calls.
>>>
>>>  I think something should be done to solve this issue, do you think so?
>> The flush_all() cant be avoided completely, as it is permitted to use
>> sethvmcontext on an already-running VM.  In this case, the flush
>> certainly does need to happen if altering the MTRRs has had a real
>> effect on dirty cache lines.
> Plus the actual functions calling memory_type_changed() in mtrr.c
> can also be called while the VM is already running.
>
>> However, having a batching mechanism across hvm_load_mtrr_msr() with a
>> single flush at the end seems like a wise move.
> And that shouldn't be very difficult to achieve. Furthermore perhaps
> it would be possible to check whether the VM did run at all already,
> and if it didn't we could avoid the flush altogether in the context load
> case?

I am not sure whether we currently have that information available. 
Guests are currently created with a single ref in the systemcontroller
pause count, and require an unpause hypercall to get going.

That said, the overwhelmingly common case is that the only hvmsetcontext
hypercall made on a domain will be during construction, so there are
probably many improvements to be had by knowing there is no dirty state
to flush.

~Andrew

  reply	other threads:[~2015-01-16 11:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16 10:29 about the funtion call memory_type_changed() Li, Liang Z
2015-01-16 10:46 ` Andrew Cooper
2015-01-16 11:54   ` Jan Beulich
2015-01-16 11:59     ` Andrew Cooper [this message]
2015-01-21 10:15     ` Li, Liang Z
2015-01-21 10:31       ` Jan Beulich
2015-01-21 11:14         ` Li, Liang Z
2015-01-21 11:21           ` Jan Beulich
2015-01-22  4:28             ` Li, Liang Z
2015-01-22  5:07               ` Tian, Kevin
2015-01-22  5:15         ` Tian, Kevin
2015-01-22  7:44           ` Zhang, Yang Z
2015-01-22  9:13             ` Jan Beulich
2015-01-23  5:55               ` Li, Liang Z
2015-01-23  6:11                 ` 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=54B8FD3A.1080401@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=eddie.dong@intel.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=liang.z.li@intel.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    --cc=yang.z.zhang@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 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.