All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Henry Wang <Henry.Wang@arm.com>,
	Community Manager <community.manager@xenproject.org>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	George Dunlap <george.dunlap@citrix.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 2/2] domain: expose newly introduced hypercalls as XENFEAT
Date: Mon, 16 Oct 2023 15:00:35 +0200	[thread overview]
Message-ID: <ZS0z89xtFzkmK8_d@macbook> (raw)
In-Reply-To: <b8c03b77-d4bf-3be7-2090-e76e6849b085@suse.com>

On Mon, Oct 16, 2023 at 02:35:44PM +0200, Jan Beulich wrote:
> On 06.10.2023 15:00, Roger Pau Monne wrote:
> > --- a/xen/arch/x86/domain.c
> > +++ b/xen/arch/x86/domain.c
> > @@ -1580,6 +1580,10 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arg)
> >      {
> >          struct vcpu_register_time_memory_area area;
> >  
> > +        rc = -ENOSYS;
> > +        if ( 0 /* TODO: Dom's XENFEAT_vcpu_time_phys_area setting */ )
> > +            break;
> > +
> >          rc = -EFAULT;
> >          if ( copy_from_guest(&area.addr.p, arg, 1) )
> >              break;
> > --- a/xen/common/domain.c
> > +++ b/xen/common/domain.c
> > @@ -1998,6 +1998,10 @@ long common_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg)
> >      {
> >          struct vcpu_register_runstate_memory_area area;
> >  
> > +        rc = -ENOSYS;
> > +        if ( 0 /* TODO: Dom's XENFEAT_runstate_phys_area setting */ )
> > +            break;
> > +
> >          rc = -EFAULT;
> >          if ( copy_from_guest(&area.addr.p, arg, 1) )
> >              break;
> 
> ENOSYS is not correct here. EPERM, EACCES, or EOPNOTSUPP would all be more
> correct.

I don't think so, common_vcpu_op() default case does return -ENOSYS,
and the point of this path is to mimic the behavior of an hypervisor
that doesn't have the hypercalls implemented, hence -ENOSYS is the
correct behavior.

> 
> > --- a/xen/common/kernel.c
> > +++ b/xen/common/kernel.c
> > @@ -607,7 +607,11 @@ long do_xen_version(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
> >          switch ( fi.submap_idx )
> >          {
> >          case 0:
> > -            fi.submap = (1U << XENFEAT_memory_op_vnode_supported);
> > +            fi.submap = (1U << XENFEAT_memory_op_vnode_supported) |
> > +#ifdef CONFIG_X86
> > +                        (1U << XENFEAT_vcpu_time_phys_area) |
> > +#endif
> > +                        (1U << XENFEAT_runstate_phys_area);
> 
> No provisions here for the "disabled for this domain" case?

TBH I'm not sure the `if ( 0` above are of much help, if we ever want
to provide toolstack overwrites for those it's fairly easy to spot the
paths that need to be patched anyway.

Thanks, Roger.


  reply	other threads:[~2023-10-16 13:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 13:00 [PATCH v2 0/2] domain: followup for phys address mapping series Roger Pau Monne
2023-10-06 13:00 ` [PATCH v2 1/2] domain: fix misaligned unmap address in {,un}map_guest_area() Roger Pau Monne
2023-10-06 14:02   ` Henry Wang
2023-10-06 14:04   ` Julien Grall
2023-10-16 12:30   ` Jan Beulich
2023-10-16 12:44     ` Roger Pau Monné
2023-10-06 13:00 ` [PATCH v2 2/2] domain: expose newly introduced hypercalls as XENFEAT Roger Pau Monne
2023-10-06 13:05   ` Andrew Cooper
2023-10-06 13:19     ` Roger Pau Monné
2023-10-06 14:47       ` Andrew Cooper
2023-10-06 14:02     ` Henry Wang
2023-10-16 12:35   ` Jan Beulich
2023-10-16 13:00     ` Roger Pau Monné [this message]
2023-10-16 13:58       ` Jan Beulich
2023-10-16 14:01         ` Roger Pau Monné
2023-10-16 14:04           ` Jan Beulich
2023-10-16 14:39             ` Roger Pau Monné

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=ZS0z89xtFzkmK8_d@macbook \
    --to=roger.pau@citrix.com \
    --cc=Henry.Wang@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=community.manager@xenproject.org \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --cc=wl@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.