All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yu Zhang <yu.c.zhang@linux.intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Kevin Tian <kevin.tian@intel.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Tim Deegan <tim@xen.org>,
	George Dunlap <george.dunlap@citrix.com>,
	xen-devel@lists.xen.org, Paul Durrant <paul.durrant@citrix.com>,
	zhiyuan.lv@intel.com, JunNakajima <jun.nakajima@intel.com>
Subject: Re: [PATCH v4 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server.
Date: Tue, 21 Jun 2016 17:16:20 +0800	[thread overview]
Message-ID: <576905E4.7020407@linux.intel.com> (raw)
In-Reply-To: <5769157902000078000F71B7@prv-mh.provo.novell.com>



On 6/21/2016 4:22 PM, Jan Beulich wrote:
>>>> On 21.06.16 at 09:45, <yu.c.zhang@linux.intel.com> wrote:
>> On 6/20/2016 9:38 PM, Jan Beulich wrote:
>>>>>> On 20.06.16 at 14:06, <yu.c.zhang@linux.intel.com> wrote:
>>>> However, if live migration is started(all pte entries invalidated
>>>> again), resolve_misconfig() would
>>>> change both gfn A's and gfn B's p2m type back to p2m_ram_rw, which means
>>>> the emulation of
>>>> gfn B would fail.
>>> Why would it? Changes to p2m_ram_logdirty won't alter
>>> p2m_ioreq_server entries, and hence changes from it back to
>>> p2m_ram_rw won't either.
>> Oh, above example is based on the assumption that resolve_misconfig() is
>> extended
>> to handle the p2m_ioreq_server case(see my "Suppose resolve_misconfig()
>> is modified...").
>> The code change could be something like below:
>>
>> @@ -542,10 +542,14 @@ static int resolve_misconfig(struct p2m_domain
>> *p2m, unsigned long gfn)
>>
>> -                    if ( e.recalc && p2m_is_changeable(e.sa_p2mt) )
>> +                   if ( e.recalc )
>>                        {
>> -                         e.sa_p2mt = p2m_is_logdirty_range(p2m, gfn +
>> i, gfn + i)
>> -                                     ? p2m_ram_logdirty : p2m_ram_rw;
>> +                         if ( e.sa_p2mt == p2m_ioreq_server )
>> +                             e.sa_p2mt = p2m_ram_rw;
>> +                         else if ( p2m_is_changeable(e.sa_p2mt) )
>> +                             e.sa_p2mt = p2m_is_logdirty_range(p2m, gfn
>> + i, gfn + i)
>> +                                         ? p2m_ram_logdirty : p2m_ram_rw;
>> +
>>                             ept_p2m_type_to_flags(p2m, &e, e.sa_p2mt,
>> e.access);
>>                        }
>>                        e.recalc = 0;
>>
>> With changes like this, both p2m types of gfn A and gfn B from above example
>> would be set to p2m_ram_rw if log dirty is enabled.
> Above modification would convert _all_ p2m_ioreq_server into
> p2m_ram_rw, irrespective of log-dirty mode being active. Which
> I don't think is what you want.

Well, this is another situation I found very interesting: without log-dirty,
this approach actually works. :) And the reasons are:

- resolve_misconfig() will only recalculate entries which have e.recalc
flag set;

- For the outdated p2m_ioreq_server entries, this routine will reset
them back to p2m_ram_rw;

- For the new p2m_ioreq_server entries, their e.recalc flag will first
be cleared to 0 by ept_set_entry() -> resolve_misconfig() is used to
set the p2m type when hvmop_set_mem_type is invoked);

- Yet live migration will turn on the recalc flag for all entries again...

You can see this in steps 3> to 6> in my previous example. :)

>
>> So that's what I am worrying - if a user unintentionally typed "xl save"
>> during
>> the emulation process , the emulation would fail. We can let the
>> enable_logdirty()
>> return false if XenGT is detected, but we still wish to keep the log
>> dirty feature.
> Well, enabling log-dirty mode would succeed as soon as all
> p2m_ioreq_server pages got converted back to normal ones (by
> the device model). So an unintentional "xl save" would simply fail.
> Is there any problem with that?

Well, I agree.
Since this patchset is only about ioreq server change, my plan is to keep
the log dirty logic as it is for now, and in the future if we are gonna 
support
vGPU migration, we can consider to let "xl save" simply fail if the device
model side is not ready(i.e. not having finished its memory type cleaning
tasks).

>>> And then - didn't we mean to disable that part of XenGT during
>>> migration, i.e. temporarily accept the higher performance
>>> overhead without the p2m_ioreq_server entries? In which case
>>> flipping everything back to p2m_ram_rw after (completed or
>>> canceled) migration would be exactly what we want. The (new
>>> or previous) ioreq server should attach only afterwards, and
>>> can then freely re-establish any p2m_ioreq_server entries it
>>> deems necessary.
>>>
>> Well, I agree this part of XenGT should be disabled during migration.
>> But in such
>> case I think it's device model's job to trigger the p2m type
>> flipping(i.e. by calling
>> HVMOP_set_mem_type).
> I agree - this would seem to be the simpler model here, despite (as
> George validly says) the more consistent model would be for the
> hypervisor to do the cleanup. Such cleanup would imo be reasonable
> only if there was an easy way for the hypervisor to enumerate all
> p2m_ioreq_server pages.

Well, for me, the "easy way" means we should avoid traversing the whole ept
paging structure all at once, right? I have not figured out any clean 
solution
in hypervisor side, that's one reason I'd like to left this job to 
device model
side(another reason is that I do think device model should take this 
responsibility).

Thanks
Yu

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-06-21  9:16 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-19  9:05 [PATCH v4 0/3] x86/ioreq server: Introduce HVMMEM_ioreq_server mem type Yu Zhang
2016-05-19  9:05 ` [PATCH v4 1/3] x86/ioreq server: Rename p2m_mmio_write_dm to p2m_ioreq_server Yu Zhang
2016-06-14 10:04   ` Jan Beulich
2016-06-14 13:14     ` George Dunlap
2016-06-15 10:51     ` Yu Zhang
2016-05-19  9:05 ` [PATCH v4 2/3] x86/ioreq server: Add new functions to get/set memory types Yu Zhang
2016-05-19  9:05 ` [PATCH v4 3/3] x86/ioreq server: Add HVMOP to map guest ram with p2m_ioreq_server to an ioreq server Yu Zhang
2016-06-14 10:45   ` Jan Beulich
2016-06-14 13:13     ` George Dunlap
2016-06-14 13:31       ` Jan Beulich
2016-06-15  9:50         ` George Dunlap
2016-06-15 10:21           ` Jan Beulich
2016-06-15 11:28             ` George Dunlap
2016-06-16  9:30             ` Yu Zhang
2016-06-16  9:55               ` Jan Beulich
2016-06-17 10:17                 ` George Dunlap
2016-06-20  9:03                   ` Yu Zhang
2016-06-20 10:10                     ` George Dunlap
2016-06-20 10:25                       ` Jan Beulich
2016-06-20 10:32                         ` George Dunlap
2016-06-20 10:55                           ` Jan Beulich
2016-06-20 11:28                             ` Yu Zhang
2016-06-20 13:13                               ` George Dunlap
2016-06-21  7:42                                 ` Yu Zhang
2016-06-20 10:30                       ` Yu Zhang
2016-06-20 10:43                         ` George Dunlap
2016-06-20 10:45                         ` Jan Beulich
2016-06-20 11:06                           ` Yu Zhang
2016-06-20 11:20                             ` Jan Beulich
2016-06-20 12:06                               ` Yu Zhang
2016-06-20 13:38                                 ` Jan Beulich
2016-06-21  7:45                                   ` Yu Zhang
2016-06-21  8:22                                     ` Jan Beulich
2016-06-21  9:16                                       ` Yu Zhang [this message]
2016-06-21  9:47                                         ` Jan Beulich
2016-06-21 10:00                                           ` Yu Zhang
2016-06-21 14:38                                           ` George Dunlap
2016-06-22  6:39                                             ` Jan Beulich
2016-06-22  8:38                                               ` Yu Zhang
2016-06-22  9:11                                                 ` Jan Beulich
2016-06-22  9:16                                               ` George Dunlap
2016-06-22  9:29                                                 ` Jan Beulich
2016-06-22  9:47                                                   ` George Dunlap
2016-06-22 10:07                                                     ` Yu Zhang
2016-06-22 11:33                                                       ` George Dunlap
2016-06-23  7:37                                                         ` Yu Zhang
2016-06-23 10:33                                                           ` George Dunlap
2016-06-24  4:16                                                             ` Yu Zhang
2016-06-24  6:12                                                               ` Jan Beulich
2016-06-24  7:12                                                                 ` Yu Zhang
2016-06-24  8:01                                                                   ` Jan Beulich
2016-06-24  9:57                                                                     ` Yu Zhang
2016-06-24 10:27                                                                       ` Jan Beulich
2016-06-22 10:10                                                     ` Jan Beulich
2016-06-22 10:15                                                       ` George Dunlap
2016-06-22 11:50                                                         ` Jan Beulich
2016-06-15 10:52     ` Yu Zhang
2016-06-15 12:26       ` Jan Beulich
2016-06-16  9:32         ` Yu Zhang
2016-06-16 10:02           ` Jan Beulich
2016-06-16 11:18             ` Yu Zhang
2016-06-16 12:43               ` Jan Beulich
2016-06-20  9:05             ` Yu Zhang
2016-06-14 13:14   ` George Dunlap
2016-05-27  7:52 ` [PATCH v4 0/3] x86/ioreq server: Introduce HVMMEM_ioreq_server mem type Zhang, Yu C
2016-05-27 10:00   ` Jan Beulich
2016-05-27  9:51     ` Zhang, Yu C
2016-05-27 10:02     ` 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=576905E4.7020407@linux.intel.com \
    --to=yu.c.zhang@linux.intel.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=jun.nakajima@intel.com \
    --cc=kevin.tian@intel.com \
    --cc=paul.durrant@citrix.com \
    --cc=tim@xen.org \
    --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 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.