All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Zhang, Xiong Y" <xiong.y.zhang@intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: "george.dunlap@eu.citrix.com" <george.dunlap@eu.citrix.com>,
	"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	"paul.durrant@citrix.com" <paul.durrant@citrix.com>,
	"yu.c.zhang@linux.intel.com" <yu.c.zhang@linux.intel.com>,
	"Lv, Zhiyuan" <zhiyuan.lv@intel.com>,
	"Zhang, Xiong Y" <xiong.y.zhang@intel.com>
Subject: Re: [PATCH] x86/ioreq server: Fix DomU couldn't reboot when using p2m_ioreq_server p2m_type
Date: Sat, 6 May 2017 01:51:10 +0000	[thread overview]
Message-ID: <8082FF9BCB2B054996454E47167FF4EC1C4DD6B3@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <590CAAEE02000078001573F1@prv-mh.provo.novell.com>

> >>> On 05.05.17 at 05:52, <xiong.y.zhang@intel.com> wrote:
> > 'commit 1679e0df3df6 ("x86/ioreq server: asynchronously reset
> > outstanding p2m_ioreq_server entries")' will call
> > p2m_change_entry_type_global() which set entry.recalc=1. Then
> > the following get_entry(p2m_ioreq_server) will return
> > p2m_ram_rw type.
> > But 'commit 6d774a951696 ("x86/ioreq server: synchronously reset
> > outstanding p2m_ioreq_server entries when an ioreq server unmaps")'
> > assume get_entry(p2m_ioreq_server) will return p2m_ioreq_server
> > type, then reset p2m_ioreq_server entries. The fact is the assumption
> > isn't true, and sysnchronously reset function couldn't work. Then
> > ioreq.entry_count is larger than zero after an ioreq server unmaps,
> > finally this results DomU couldn't reboot.
> 
> I've had trouble understanding this part already on v1 (btw, why is
> this one not tagged v2?), and since I still can't figure it I have to ask:
> Why is it that guest reboot is being impacted here? From what I recall
> a non-zero count should only prevent migration.
[Zhang, Xiong Y] Sorry, although they solve the same issue, the solution is
totally different, so I didn't mark this as V2, I will mark the following
as v2 with this solution.
During DomU reboot, it will first unmap ioreq server in shutdown process,
then it call map ioreq server in boot process. The following sentence in
p2m_set_ioreq_server() result mapping ioreq server failure, then DomU
couldn't continue booting.
If ( read_atomic(&p->ioreq.entry_count))
   goto out;
> 
> > This patch add a P2M_PRE_RECALC flag to p2m_query_t, then
> > get_entry(P2M_PRE_RECALC) will return p2m_ioreq_server type
> > for p2m_ioreq_server pfn, and finally change mem type through set_entry.
> 
> This looks to be a relatively little impact change, but nevertheless
> I'm wondering whether someone else (George?) may be able to
> think of some more elegant solution (I have to admit that, having
> suggested the one here, I can't).
> 
> > --- a/xen/arch/x86/mm/p2m-ept.c
> > +++ b/xen/arch/x86/mm/p2m-ept.c
> > @@ -991,8 +991,11 @@ static mfn_t ept_get_entry(struct p2m_domain
> *p2m,
> >
> >      if ( is_epte_valid(ept_entry) )
> >      {
> > -        *t = p2m_recalc_type(recalc || ept_entry->recalc,
> > -                             ept_entry->sa_p2mt, p2m, gfn);
> > +        if ( !(q & P2M_PRE_RECALC) )
> 
> Here and elsewhere you want to use likely(). And in fact I wonder
> whether overall it wouldn't be better to pass q (or just the boolean
> resulting from q & P2M_PRE_RECALC) to p2m_recalc_type(),
> avoiding these recurring if/else-s you add.
[Zhang, Xiong Y] Good suggestion, I will pass (q & P2M_PRE_RECALC) to
recalc bool parameter in p2m_recalc_type();
> 
> > --- a/xen/arch/x86/mm/p2m.c
> > +++ b/xen/arch/x86/mm/p2m.c
> > @@ -1020,6 +1020,8 @@ void p2m_finish_type_change(struct domain *d,
> >      p2m_type_t t;
> >      unsigned long gfn = gfn_x(first_gfn);
> >      unsigned long last_gfn = gfn + max_nr - 1;
> > +    mfn_t mfn;
> > +    p2m_access_t a;
> 
> Please put these variable declarations ...
> 
> > @@ -1029,10 +1031,10 @@ void p2m_finish_type_change(struct domain
> *d,
> >      last_gfn = min(last_gfn, p2m->max_mapped_pfn);
> >      while ( gfn <= last_gfn )
> >      {
> 
> ... here.
[Zhang, Xiong Y] ok, thanks
> 
> Jan


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

  reply	other threads:[~2017-05-06  1:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-05  3:52 [PATCH] x86/ioreq server: Fix DomU couldn't reboot when using p2m_ioreq_server p2m_type Xiong Zhang
2017-05-05 14:40 ` Jan Beulich
2017-05-06  1:51   ` Zhang, Xiong Y [this message]
2017-05-08  7:04     ` Jan Beulich
2017-05-08 10:52       ` Zhang, Xiong Y
2017-05-08 11:12         ` George Dunlap
2017-05-08 11:59           ` Zhang, Xiong Y
2017-05-08 12:13             ` Jan Beulich
2017-05-09  5:21           ` Yu Zhang
2017-05-09  9:24             ` George Dunlap
2017-05-08 13:26   ` George Dunlap
2017-05-08 13:55     ` George Dunlap
2017-05-08 15:47       ` Jan Beulich

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=8082FF9BCB2B054996454E47167FF4EC1C4DD6B3@SHSMSX104.ccr.corp.intel.com \
    --to=xiong.y.zhang@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=yu.c.zhang@linux.intel.com \
    --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.