All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Tim Deegan <tim@xen.org>, Wei Liu <wei.liu2@citrix.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Subject: Re: [PATCH v4 2/4] p2m: change write_p2m_entry to return an error code
Date: Tue, 19 Feb 2019 05:28:58 -0700	[thread overview]
Message-ID: <5C6BF68A0200007800217F91@prv1-mh.provo.novell.com> (raw)
In-Reply-To: <20190219115614.cslr7ge5h6ldj5xp@Air-de-Roger>

>>> On 19.02.19 at 12:56, <roger.pau@citrix.com> wrote:
> On Tue, Feb 19, 2019 at 02:05:37AM -0700, Jan Beulich wrote:
>> >>> On 18.02.19 at 18:27, <roger.pau@citrix.com> wrote:
>> > --- a/xen/arch/x86/mm/p2m-pt.c
>> > +++ b/xen/arch/x86/mm/p2m-pt.c
>> > @@ -184,6 +184,7 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
>> >      l1_pgentry_t *p2m_entry, new_entry;
>> >      void *next;
>> >      unsigned int flags;
>> > +    int rc;
>> >  
>> >      if ( !(p2m_entry = p2m_find_entry(*table, gfn_remainder, gfn,
>> >                                        shift, max)) )
>> > @@ -202,7 +203,13 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
>> >          new_entry = l1e_from_mfn(mfn, P2M_BASE_FLAGS | _PAGE_RW);
>> >  
>> >          p2m_add_iommu_flags(&new_entry, level, 
> IOMMUF_readable|IOMMUF_writable);
>> > -        p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
>> > +        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 
> 1);
>> > +        if ( rc )
>> > +        {
>> > +            ASSERT_UNREACHABLE();
>> > +            p2m_free_ptp(p2m, mfn_to_page(mfn));
>> > +            return rc;
>> > +        }
>> >      }
>> >      else if ( flags & _PAGE_PSE )
>> >      {
>> > @@ -250,14 +257,27 @@ p2m_next_level(struct p2m_domain *p2m, void **table,
>> >          {
>> >              new_entry = l1e_from_pfn(pfn | (i << ((level - 1) * 
> PAGETABLE_ORDER)),
>> >                                       flags);
>> > -            p2m->write_p2m_entry(p2m, gfn, l1_entry + i, new_entry, level);
>> > +            rc = p2m->write_p2m_entry(p2m, gfn, l1_entry + i, new_entry, 
> level);
>> > +            if ( rc )
>> > +            {
>> > +                ASSERT_UNREACHABLE();
>> > +                unmap_domain_page(l1_entry);
>> > +                p2m_free_ptp(p2m, mfn_to_page(mfn));
>> > +                return rc;
>> > +            }
>> >          }
>> >  
>> >          unmap_domain_page(l1_entry);
>> >  
>> >          new_entry = l1e_from_mfn(mfn, P2M_BASE_FLAGS | _PAGE_RW);
>> >          p2m_add_iommu_flags(&new_entry, level, IOMMUF_readable|IOMMUF_writable);
>> > -        p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
>> > +        rc = p2m->write_p2m_entry(p2m, gfn, p2m_entry, new_entry, level + 1);
>> > +        if ( rc )
>> > +        {
>> > +            ASSERT_UNREACHABLE();
>> > +            p2m_free_ptp(p2m, mfn_to_page(mfn));
>> > +            return rc;
>> > +        }
>> >      }
>> >      else
>> >          ASSERT(flags & _PAGE_PRESENT);
>> 
>> Personally I would find it quite desirable if there was just one instance of
>> this error handling you add, which doesn't look overly difficult to arrange
>> for.
> 
> Sure. Would you be fine with me adding a label?

Personally (again) I'd prefer if you got away without, which (as said before)
doesn't look overly difficult to arrange for.

Jan



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

  reply	other threads:[~2019-02-19 12:31 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-18 17:27 [PATCH v4 0/4] pvh/dom0/shadow/amd fixes Roger Pau Monne
2019-02-18 17:27 ` [PATCH v4 1/4] x86/mm: split p2m ioreq server pages special handling into helper Roger Pau Monne
2019-02-19  5:47   ` Tian, Kevin
2019-02-19 10:15     ` Roger Pau Monné
2019-02-19  8:49   ` Jan Beulich
2019-02-19 11:22     ` Roger Pau Monné
2019-02-18 17:27 ` [PATCH v4 2/4] p2m: change write_p2m_entry to return an error code Roger Pau Monne
2019-02-19  9:05   ` Jan Beulich
2019-02-19 11:56     ` Roger Pau Monné
2019-02-19 12:28       ` Jan Beulich [this message]
2019-02-18 17:27 ` [PATCH v4 3/4] x86/mm: handle foreign mappings in p2m_entry_modify Roger Pau Monne
2019-02-19  6:14   ` Tian, Kevin
2019-02-19  8:39     ` Jan Beulich
2019-02-19 13:53     ` George Dunlap
2019-02-19 14:00     ` Roger Pau Monné
2019-02-21  6:26       ` Tian, Kevin
2019-02-18 17:27 ` [PATCH v4 4/4] npt/shadow: allow getting foreign page table entries Roger Pau Monne
2019-02-19  8:40   ` 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=5C6BF68A0200007800217F91@prv1-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --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 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.