All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>
Cc: xen-devel@lists.xensource.com,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
	david.vrabel@citrix.com, alex@alex.org.uk, dcrisan@flexiant.com
Subject: Re: [PATCH 2/3] xen/grant_table: use the new GNTTABOP_unmap_and_replace hypercall
Date: Mon, 22 Jul 2013 11:38:55 +0100	[thread overview]
Message-ID: <alpine.DEB.2.02.1307221132470.4893@kaball.uk.xensource.com> (raw)
In-Reply-To: <1374428686.4127.45.camel@hastur.hellion.org.uk>

On Sun, 21 Jul 2013, Ian Campbell wrote:
> > diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> > index 04c1b2d..0f7d00b 100644
> > --- a/drivers/xen/grant-table.c
> > +++ b/drivers/xen/grant-table.c
> > @@ -65,6 +65,8 @@ static grant_ref_t gnttab_free_head;
> >  static DEFINE_SPINLOCK(gnttab_list_lock);
> >  unsigned long xen_hvm_resume_frames;
> >  EXPORT_SYMBOL_GPL(xen_hvm_resume_frames);
> > +int __read_mostly gnttabop_unmap_and_replace = GNTTABOP_unmap_and_replace; 
> > +EXPORT_SYMBOL_GPL(gnttabop_unmap_and_replace);
> 
> I can see this getting set but not used, does it really need to be
> exported?

I use it in the next patch


> >  
> >  static union {
> >  	struct grant_entry_v1 *v1;
> > @@ -1238,6 +1240,12 @@ int gnttab_init(void)
> >  	gnttab_free_count = nr_init_grefs - NR_RESERVED_ENTRIES;
> >  	gnttab_free_head  = NR_RESERVED_ENTRIES;
> >  
> > +	ret = HYPERVISOR_grant_table_op(GNTTABOP_unmap_and_replace, NULL, 1);
> > +	if (ret == -ENOSYS) {
> > +		gnttabop_unmap_and_replace = GNTTABOP_unmap_and_replace_legacy;
> > +		pr_warn("GNTTABOP_unmap_and_replace unavailable, falling back to the racy legacy version\n");
> 
> Perhaps WARN_ONCE?

It's already going through that function just once: the function is
gnttab_init


> > +	}
> > +
> >  	printk("Grant table initialized\n");
> >  	return 0;
> >  
> > diff --git a/include/xen/grant_table.h b/include/xen/grant_table.h
> > index 694dcaf..867d1a7 100644
> > --- a/include/xen/grant_table.h
> > +++ b/include/xen/grant_table.h
> > @@ -179,6 +179,7 @@ int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
> >  void arch_gnttab_unmap(void *shared, unsigned long nr_gframes);
> >  
> >  extern unsigned long xen_hvm_resume_frames;
> > +extern int gnttabop_unmap_and_replace;
> >  unsigned int gnttab_max_grant_frames(void);
> >  
> >  #define gnttab_map_vaddr(map) ((void *)(map.host_virt_addr))
> > diff --git a/include/xen/interface/grant_table.h b/include/xen/interface/grant_table.h
> > index e40fae9..2a2b74f 100644
> > --- a/include/xen/interface/grant_table.h
> > +++ b/include/xen/interface/grant_table.h
> > @@ -408,15 +408,17 @@ DEFINE_GUEST_HANDLE_STRUCT(gnttab_query_size);
> >  /*
> >   * GNTTABOP_unmap_and_replace: Destroy one or more grant-reference mappings
> >   * tracked by <handle> but atomically replace the page table entry with one
> > - * pointing to the machine address under <new_addr>.  <new_addr> will be
> > - * redirected to the null entry.
> > + * pointing to the machine address under <new_addr>.
> > + * GNTTABOP_unmap_and_replace_legacy also redirects <new_addr> to the
> > + * null entry
> 
> I wonder if rather than _legacy (or _compat) if the old behaviour might
> be well described as "unmap_and_swap", since I think that is what
> clearing new_addr means?

Maybe GNTTABOP_unmap_and_swap is a better name. However it's still
pretty far from what we need. Should I work-around the limitations of the
current hypercall or implement a new one?
I don't think that doing both is a great strategy in this case.

  reply	other threads:[~2013-07-22 10:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-21 17:32 [PATCH 0/3] make ballooned out pages have a valid mapping at all times Stefano Stabellini
2013-07-21 17:32 ` [PATCH 1/3] xen/balloon: set a mapping for ballooned out pages Stefano Stabellini
2013-07-21 17:32 ` [PATCH 2/3] xen/grant_table: use the new GNTTABOP_unmap_and_replace hypercall Stefano Stabellini
2013-07-21 17:44   ` Ian Campbell
2013-07-22 10:38     ` Stefano Stabellini [this message]
2013-07-22 15:50       ` Ian Campbell
2013-07-23 14:08   ` Konrad Rzeszutek Wilk
2013-07-23 16:53     ` Stefano Stabellini
2013-07-21 17:32 ` [PATCH 3/3] xen/m2p: use GNTTABOP_unmap_and_replace to replace foreign grants with balloon_trade_page Stefano Stabellini
2013-07-21 17:49   ` Ian Campbell
2013-07-22 10:32     ` Stefano Stabellini
2013-07-22 11:40 ` [PATCH 0/3] make ballooned out pages have a valid mapping at all times David Vrabel
2013-07-22 15:35   ` Stefano Stabellini
2013-07-22 15:51     ` Ian Campbell

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=alpine.DEB.2.02.1307221132470.4893@kaball.uk.xensource.com \
    --to=stefano.stabellini@eu.citrix.com \
    --cc=alex@alex.org.uk \
    --cc=david.vrabel@citrix.com \
    --cc=dcrisan@flexiant.com \
    --cc=ian.campbell@citrix.com \
    --cc=xen-devel@lists.xensource.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.