Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1730957
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Boris Ostrovsky <boris.ostrovsky@oracle.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [Xen-devel] [PATCH 1/4] xen: re-introduce support for grant v2 interface |
| Date | Tue, 12 Sep 2017 17:50:02 +0200 |
| Message-ID | <uoVBL-37Z-9@gated-at.bofh.it> (permalink) |
| References | <unu0V-Sv-3@gated-at.bofh.it> <unu0V-Sv-1@gated-at.bofh.it> |
| X-Original-To | Juergen Gross <jgross@suse.com>, linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Source-IP | aserv0022.oracle.com [141.146.126.234] |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 70 |
| Organization | linux.* mail to news gateway |
| X-Original-Date | Tue, 12 Sep 2017 11:41:19 -0400 |
| X-Original-Message-ID | <67503f2a-6d93-59c6-5a49-40fcb487859c@oracle.com> |
| X-Original-References | <20170908144849.2958-1-jgross@suse.com> <20170908144849.2958-2-jgross@suse.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1730957 |
Show key headers only | View raw
> +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
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
Re: [Xen-devel] [PATCH 1/4] xen: re-introduce support for grant v2 interface Boris Ostrovsky <boris.ostrovsky@oracle.com> - 2017-09-12 17:50 +0200
csiph-web