All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Liu <wei.liu2@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Keir Fraser <keir@xen.org>, Wei Liu <wei.liu2@citrix.com>,
	Jan Beulich <JBeulich@suse.com>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH 2/2] x86/HVM: cache attribute pinning adjustments
Date: Thu, 3 Mar 2016 12:10:21 +0000	[thread overview]
Message-ID: <20160303121020.GD5535@citrix.com> (raw)
In-Reply-To: <56D81A0F.4080602@citrix.com>

On Thu, Mar 03, 2016 at 11:03:43AM +0000, Andrew Cooper wrote:
[...]
> > @@ -587,20 +578,21 @@ static void free_pinned_cacheattr_entry(
> >      xfree(container_of(rcu, struct hvm_mem_pinned_cacheattr_range, rcu));
> >  }
> >  
> > -int32_t hvm_set_mem_pinned_cacheattr(
> > -    struct domain *d,
> > -    uint64_t gfn_start,
> > -    uint64_t gfn_end,
> > -    uint32_t  type)
> > +int hvm_set_mem_pinned_cacheattr(struct domain *d, uint64_t gfn_start,
> > +                                 uint64_t gfn_end, uint32_t type)
> >  {
> >      struct hvm_mem_pinned_cacheattr_range *range;
> >      int rc = 1;
> >  
> > -    if ( !is_hvm_domain(d) || gfn_end < gfn_start )
> > -        return 0;
> > +    if ( !is_hvm_domain(d) )
> > +        return -EOPNOTSUPP;
> 
> You introduce an asymmetry between set and get here, both in terms of
> the checks (hvm vs hvm_container), and assert vs plain failure.  Why is
> this?
> 
> I would suggest ASSERT(is_hvm_domain(d)) in both cases.
> 

I don't think we can have ASSERT() in the set function because it might
be called by untrusted entity. On the other hand, the get function can
only be used by hypervisor so the ASSERT should be fine.

Wei.

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

  reply	other threads:[~2016-03-03 12:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03  9:54 [PATCH 0/2] x86: more XSA-154 follow-ups Jan Beulich
2016-03-03 10:31 ` [PATCH 1/2] x86: use "unsigned int" for cache attribute values Jan Beulich
2016-03-03 10:36   ` Andrew Cooper
2016-03-03 10:31 ` [PATCH 2/2] x86/HVM: cache attribute pinning adjustments Jan Beulich
2016-03-03 11:03   ` Andrew Cooper
2016-03-03 12:10     ` Wei Liu [this message]
2016-03-03 12:12       ` Andrew Cooper
2016-03-03 12:19         ` Wei Liu
2016-03-03 12:46         ` Jan Beulich
2016-03-03 12:41     ` 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=20160303121020.GD5535@citrix.com \
    --to=wei.liu2@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --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.