All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Juergen Gross <jgross@suse.com>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org
Subject: Re: [PATCH 1/4] xen: re-introduce support for grant v2 interface
Date: Tue, 12 Sep 2017 11:41:19 -0400	[thread overview]
Message-ID: <67503f2a-6d93-59c6-5a49-40fcb487859c__19051.4906462797$1505335837$gmane$org@oracle.com> (raw)
In-Reply-To: <20170908144849.2958-2-jgross@suse.com>


> +int arch_gnttab_map_status(uint64_t *frames, unsigned long nr_gframes,
> +			   unsigned long max_nr_gframes,
> +			   grant_status_t **__shared)
> +{
> +	grant_status_t *shared = *__shared;
> +	unsigned long addr;
> +	unsigned long i;
> +
> +	if (shared == NULL)
> +		*__shared = shared = gnttab_status_vm_area.area->addr;
> +
> +	addr = (unsigned long)shared;
> +
> +	for (i = 0; i < nr_gframes; i++) {
> +		set_pte_at(&init_mm, addr, gnttab_status_vm_area.ptes[i],
> +			   mfn_pte(frames[i], PAGE_KERNEL));
> +		addr += PAGE_SIZE;
> +	}
> +
> +	return 0;
> +}

This looks pretty much identical to arch_gnttab_map_shared() except for
gnttab_shared_vm_area vs. gnttab_status_vm_area,which can be passed in
as a parameter.

> +
>  void arch_gnttab_unmap(void *shared, unsigned long nr_gframes)
>  {
> +	pte_t **ptes;
>  	unsigned long addr;
>  	unsigned long i;
>  
> +	if (shared == gnttab_status_vm_area.area->addr)
> +		ptes = gnttab_status_vm_area.ptes;
> +	else
> +		ptes = gnttab_shared_vm_area.ptes;
> +
>  	addr = (unsigned long)shared;
>  
>  	for (i = 0; i < nr_gframes; i++) {
> -		set_pte_at(&init_mm, addr, gnttab_shared_vm_area.ptes[i],
> -			   __pte(0));
> +		set_pte_at(&init_mm, addr, ptes[i], __pte(0));
>  		addr += PAGE_SIZE;
>  	}

And this too looks like can be factored out (to something like
arch_update_gnttab()). But perhaps not in this patch.

>  }
> @@ -102,12 +129,35 @@ static int arch_gnttab_valloc(struct gnttab_vm_area *area, unsigned nr_frames)
>  	return 0;
>  }
>  
> -int arch_gnttab_init(unsigned long nr_shared)
> +static void arch_gnttab_vfree(struct gnttab_vm_area *area)
>  {
> +	free_vm_area(area->area);
> +	kfree(area->ptes);
> +}

Not sure there is need for this routine. It is used only once.

Also, as an overall comment -- It feels like there may be too many
BUG_ON()s.


-boris

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

  reply	other threads:[~2017-09-12 15:41 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-08 14:48 [PATCH 0/4] xen: grant table interface v2 support Juergen Gross
2017-09-08 14:48 ` [PATCH 1/4] xen: re-introduce support for grant v2 interface Juergen Gross
2017-09-08 14:48   ` Juergen Gross
2017-09-12 15:41   ` Boris Ostrovsky [this message]
2017-09-12 15:41   ` [Xen-devel] " Boris Ostrovsky
2017-09-12 15:45     ` Juergen Gross
2017-09-12 15:45       ` Juergen Gross
2017-09-08 14:48 ` [PATCH 2/4] xen: limit grant v2 interface to the v1 functionality Juergen Gross
2017-09-08 14:48 ` Juergen Gross
2017-09-12 15:44   ` Boris Ostrovsky
2017-09-12 15:44   ` Boris Ostrovsky
2017-09-12 15:50     ` Juergen Gross
2017-09-12 15:50       ` Juergen Gross
2017-09-12 16:05       ` Boris Ostrovsky
2017-09-12 16:05       ` Boris Ostrovsky
2017-09-12 16:09         ` Juergen Gross
2017-09-12 16:21           ` Boris Ostrovsky
2017-09-12 16:21           ` Boris Ostrovsky
2017-09-12 18:18             ` Juergen Gross
2017-09-12 18:18             ` Juergen Gross
2017-09-13 13:22               ` Boris Ostrovsky
2017-09-13 13:38                 ` Juergen Gross
2017-09-13 13:50                   ` Boris Ostrovsky
2017-09-13 13:50                     ` Boris Ostrovsky
2017-09-13 14:45                     ` Juergen Gross
2017-09-13 16:20                       ` Boris Ostrovsky
2017-09-13 16:20                       ` Boris Ostrovsky
2017-09-14  8:13                         ` Juergen Gross
2017-09-14  8:13                         ` Juergen Gross
2017-09-13 14:45                     ` Juergen Gross
2017-09-13 13:38                 ` Juergen Gross
2017-09-13 13:22               ` Boris Ostrovsky
2017-09-12 16:09         ` Juergen Gross
2017-09-08 14:48 ` [PATCH 3/4] xen: add grant interface version dependent constants to gnttab_ops Juergen Gross
2017-09-12 16:02   ` Boris Ostrovsky
2017-09-12 16:02   ` Boris Ostrovsky
2017-09-08 14:48 ` Juergen Gross
2017-09-08 14:48 ` [PATCH 4/4] xen: select grant interface version Juergen Gross
2017-09-08 14:48 ` Juergen Gross
2017-09-12 16:21   ` Boris Ostrovsky
2017-09-12 16:21   ` [Xen-devel] " Boris Ostrovsky
2017-09-12 18:54   ` Andrew Cooper
2017-09-13  9:23     ` Juergen Gross
2017-09-15 13:00       ` Juergen Gross
2017-09-15 13:00       ` [Xen-devel] " Juergen Gross
2017-09-15 13:21         ` Jan Beulich
2017-09-15 13:21         ` [Xen-devel] " Jan Beulich
     [not found]         ` <59BBEFFC020000780017B8EF@suse.com>
2017-09-15 13:27           ` Juergen Gross
2017-09-15 13:27           ` [Xen-devel] " Juergen Gross
2017-09-13  9:23     ` Juergen Gross
2017-09-12 18:54   ` Andrew Cooper

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='67503f2a-6d93-59c6-5a49-40fcb487859c__19051.4906462797$1505335837$gmane$org@oracle.com' \
    --to=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.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.