From: Juergen Gross <jgross@suse.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org
Subject: Re: [Xen-devel] [PATCH 1/4] xen: re-introduce support for grant v2 interface
Date: Tue, 12 Sep 2017 17:45:25 +0200 [thread overview]
Message-ID: <12021f54-9404-c92b-5368-440d14814dbd@suse.com> (raw)
In-Reply-To: <67503f2a-6d93-59c6-5a49-40fcb487859c@oracle.com>
On 12/09/17 17:41, Boris Ostrovsky wrote:
>
>> +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.
This patch is mostly a revert of David's patch removing grant v2 support
with just very few adaptions. I wanted to keep it as similar to the
former grant v2 support as possible.
Juergen
next prev parent reply other threads:[~2017-09-12 15:45 UTC|newest]
Thread overview: 26+ 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-12 15:41 ` [Xen-devel] " Boris Ostrovsky
2017-09-12 15:45 ` Juergen Gross [this message]
2017-09-08 14:48 ` [PATCH 2/4] xen: limit grant v2 interface to the v1 functionality Juergen Gross
2017-09-12 15:44 ` Boris Ostrovsky
2017-09-12 15:50 ` Juergen Gross
2017-09-12 16:05 ` Boris Ostrovsky
2017-09-12 16:09 ` Juergen Gross
2017-09-12 16:21 ` Boris Ostrovsky
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 14:45 ` Juergen Gross
2017-09-13 16:20 ` Boris Ostrovsky
2017-09-14 8:13 ` 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-08 14:48 ` [PATCH 4/4] xen: select grant interface version Juergen Gross
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:21 ` Jan Beulich
[not found] ` <59BBEFFC020000780017B8EF@suse.com>
2017-09-15 13:27 ` Juergen Gross
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=12021f54-9404-c92b-5368-440d14814dbd@suse.com \
--to=jgross@suse.com \
--cc=boris.ostrovsky@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox