All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksandr Andrushchenko <andr2000@gmail.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
	jgross@suse.com, konrad.wilk@oracle.com
Cc: daniel.vetter@intel.com, matthew.d.roper@intel.com,
	dongwon.kim@intel.com,
	Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Subject: Re: [Xen-devel] [RFC 1/3] xen/balloon: Allow allocating DMA buffers
Date: Mon, 21 May 2018 20:32:15 +0300	[thread overview]
Message-ID: <a08e7d0d-f7d5-6b7e-979b-8a17060482f0@gmail.com> (raw)
In-Reply-To: <218e2bf7-490d-f89e-9866-27b7e3dbc835@oracle.com>

On 05/21/2018 07:35 PM, Boris Ostrovsky wrote:
> On 05/21/2018 01:40 AM, Oleksandr Andrushchenko wrote:
>> On 05/19/2018 01:04 AM, Boris Ostrovsky wrote:
>>> On 05/17/2018 04:26 AM, Oleksandr Andrushchenko wrote:
>>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>> A commit message would be useful.
>> Sure, v1 will have it
>>>> Signed-off-by: Oleksandr Andrushchenko
>>>> <oleksandr_andrushchenko@epam.com>
>>>>
>>>>        for (i = 0; i < nr_pages; i++) {
>>>> -        page = alloc_page(gfp);
>>>> -        if (page == NULL) {
>>>> -            nr_pages = i;
>>>> -            state = BP_EAGAIN;
>>>> -            break;
>>>> +        if (ext_pages) {
>>>> +            page = ext_pages[i];
>>>> +        } else {
>>>> +            page = alloc_page(gfp);
>>>> +            if (page == NULL) {
>>>> +                nr_pages = i;
>>>> +                state = BP_EAGAIN;
>>>> +                break;
>>>> +            }
>>>>            }
>>>>            scrub_page(page);
>>>>            list_add(&page->lru, &pages);
>>>> @@ -529,7 +565,7 @@ static enum bp_state
>>>> decrease_reservation(unsigned long nr_pages, gfp_t gfp)
>>>>        i = 0;
>>>>        list_for_each_entry_safe(page, tmp, &pages, lru) {
>>>>            /* XENMEM_decrease_reservation requires a GFN */
>>>> -        frame_list[i++] = xen_page_to_gfn(page);
>>>> +        frames[i++] = xen_page_to_gfn(page);
>>>>      #ifdef CONFIG_XEN_HAVE_PVMMU
>>>>            /*
>>>> @@ -552,18 +588,22 @@ static enum bp_state
>>>> decrease_reservation(unsigned long nr_pages, gfp_t gfp)
>>>>    #endif
>>>>            list_del(&page->lru);
>>>>    -        balloon_append(page);
>>>> +        if (!ext_pages)
>>>> +            balloon_append(page);
>>> So what you are proposing is not really ballooning. You are just
>>> piggybacking on existing interfaces, aren't you?
>> Sort of. Basically I need to {increase|decrease}_reservation, not
>> actually
>> allocating ballooned pages.
>> Do you think I can simply EXPORT_SYMBOL for
>> {increase|decrease}_reservation?
>> Any other suggestion?
>
> I am actually wondering how much of that code you end up reusing. You
> pretty much create new code paths in both routines and common code ends
> up being essentially the hypercall.
Well, I hoped that it would be easier to maintain if I modify existing code
to support both use-cases, but I am also ok to create new routines if this
seems to be reasonable - please let me know
>   So the question is --- would it make
> sense to do all of this separately from the balloon driver?
This can be done, but which driver will host this code then? If we move from
the balloon driver, then this could go to either gntdev or grant-table.
What's your preference?
>
> -boris
Thank you,
Oleksandr

WARNING: multiple messages have this Message-ID (diff)
From: Oleksandr Andrushchenko <andr2000@gmail.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org,
	jgross@suse.com, konrad.wilk@oracle.com
Cc: daniel.vetter@intel.com, dongwon.kim@intel.com,
	Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Subject: Re: [Xen-devel] [RFC 1/3] xen/balloon: Allow allocating DMA buffers
Date: Mon, 21 May 2018 20:32:15 +0300	[thread overview]
Message-ID: <a08e7d0d-f7d5-6b7e-979b-8a17060482f0@gmail.com> (raw)
In-Reply-To: <218e2bf7-490d-f89e-9866-27b7e3dbc835@oracle.com>

On 05/21/2018 07:35 PM, Boris Ostrovsky wrote:
> On 05/21/2018 01:40 AM, Oleksandr Andrushchenko wrote:
>> On 05/19/2018 01:04 AM, Boris Ostrovsky wrote:
>>> On 05/17/2018 04:26 AM, Oleksandr Andrushchenko wrote:
>>>> From: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
>>> A commit message would be useful.
>> Sure, v1 will have it
>>>> Signed-off-by: Oleksandr Andrushchenko
>>>> <oleksandr_andrushchenko@epam.com>
>>>>
>>>>        for (i = 0; i < nr_pages; i++) {
>>>> -        page = alloc_page(gfp);
>>>> -        if (page == NULL) {
>>>> -            nr_pages = i;
>>>> -            state = BP_EAGAIN;
>>>> -            break;
>>>> +        if (ext_pages) {
>>>> +            page = ext_pages[i];
>>>> +        } else {
>>>> +            page = alloc_page(gfp);
>>>> +            if (page == NULL) {
>>>> +                nr_pages = i;
>>>> +                state = BP_EAGAIN;
>>>> +                break;
>>>> +            }
>>>>            }
>>>>            scrub_page(page);
>>>>            list_add(&page->lru, &pages);
>>>> @@ -529,7 +565,7 @@ static enum bp_state
>>>> decrease_reservation(unsigned long nr_pages, gfp_t gfp)
>>>>        i = 0;
>>>>        list_for_each_entry_safe(page, tmp, &pages, lru) {
>>>>            /* XENMEM_decrease_reservation requires a GFN */
>>>> -        frame_list[i++] = xen_page_to_gfn(page);
>>>> +        frames[i++] = xen_page_to_gfn(page);
>>>>      #ifdef CONFIG_XEN_HAVE_PVMMU
>>>>            /*
>>>> @@ -552,18 +588,22 @@ static enum bp_state
>>>> decrease_reservation(unsigned long nr_pages, gfp_t gfp)
>>>>    #endif
>>>>            list_del(&page->lru);
>>>>    -        balloon_append(page);
>>>> +        if (!ext_pages)
>>>> +            balloon_append(page);
>>> So what you are proposing is not really ballooning. You are just
>>> piggybacking on existing interfaces, aren't you?
>> Sort of. Basically I need to {increase|decrease}_reservation, not
>> actually
>> allocating ballooned pages.
>> Do you think I can simply EXPORT_SYMBOL for
>> {increase|decrease}_reservation?
>> Any other suggestion?
>
> I am actually wondering how much of that code you end up reusing. You
> pretty much create new code paths in both routines and common code ends
> up being essentially the hypercall.
Well, I hoped that it would be easier to maintain if I modify existing code
to support both use-cases, but I am also ok to create new routines if this
seems to be reasonable - please let me know
>   So the question is --- would it make
> sense to do all of this separately from the balloon driver?
This can be done, but which driver will host this code then? If we move from
the balloon driver, then this could go to either gntdev or grant-table.
What's your preference?
>
> -boris
Thank you,
Oleksandr
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-05-21 17:32 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-17  8:26 [Xen-devel][RFC 0/3] dma-buf support for gntdev Oleksandr Andrushchenko
2018-05-17  8:26 ` Oleksandr Andrushchenko
2018-05-17  8:26 ` [RFC 1/3] xen/balloon: Allow allocating DMA buffers Oleksandr Andrushchenko
2018-05-17  8:26 ` [Xen-devel][RFC " Oleksandr Andrushchenko
2018-05-17  8:26   ` Oleksandr Andrushchenko
2018-05-18 22:04   ` [RFC " Boris Ostrovsky
2018-05-18 22:04   ` [Xen-devel] " Boris Ostrovsky
2018-05-21  5:40     ` Oleksandr Andrushchenko
2018-05-21  5:40     ` [Xen-devel] " Oleksandr Andrushchenko
2018-05-21  5:40       ` Oleksandr Andrushchenko
2018-05-21 16:35       ` Boris Ostrovsky
2018-05-21 17:32         ` Oleksandr Andrushchenko [this message]
2018-05-21 17:32           ` Oleksandr Andrushchenko
2018-05-21 18:53           ` Boris Ostrovsky
2018-05-21 18:53           ` [Xen-devel] " Boris Ostrovsky
2018-05-21 19:13             ` Oleksandr Andrushchenko
2018-05-21 20:36               ` Boris Ostrovsky
2018-05-21 20:36               ` [Xen-devel] " Boris Ostrovsky
2018-05-22  5:55                 ` Oleksandr Andrushchenko
2018-05-22 14:33                   ` Boris Ostrovsky
2018-05-22 15:00                     ` Oleksandr Andrushchenko
2018-05-22 15:00                     ` [Xen-devel] " Oleksandr Andrushchenko
2018-05-22 15:00                       ` Oleksandr Andrushchenko
2018-05-22 18:02                       ` Boris Ostrovsky
2018-05-22 18:27                         ` Oleksandr Andrushchenko
2018-05-22 18:27                         ` [Xen-devel] " Oleksandr Andrushchenko
2018-05-22 18:27                           ` Oleksandr Andrushchenko
2018-05-22 19:09                           ` Boris Ostrovsky
2018-05-22 19:09                           ` Boris Ostrovsky
2018-05-22 18:02                       ` Boris Ostrovsky
2018-05-22 14:33                   ` Boris Ostrovsky
2018-05-22  5:55                 ` Oleksandr Andrushchenko
2018-05-21 19:13             ` Oleksandr Andrushchenko
2018-05-21 17:32         ` Oleksandr Andrushchenko
2018-05-21 16:35       ` Boris Ostrovsky
2018-05-17  8:26 ` [RFC 2/3] xen/grant-table: Extend API to work with " Oleksandr Andrushchenko
2018-05-17  8:26 ` [Xen-devel][RFC " Oleksandr Andrushchenko
2018-05-17  8:26   ` Oleksandr Andrushchenko
2018-05-18 22:19   ` [RFC " Boris Ostrovsky
2018-05-18 22:19   ` [Xen-devel][RFC " Boris Ostrovsky
2018-05-21  5:44     ` Oleksandr Andrushchenko
2018-05-21  5:44       ` Oleksandr Andrushchenko
2018-05-21  5:44     ` [RFC " Oleksandr Andrushchenko
2018-05-17  8:26 ` [Xen-devel][RFC 3/3] xen/gntdev: Add support for Linux dma buffers Oleksandr Andrushchenko
2018-05-17  8:26   ` Oleksandr Andrushchenko
2018-05-21 21:31   ` [RFC " Dongwon Kim
2018-05-21 21:31   ` [Xen-devel][RFC " Dongwon Kim
2018-05-21 21:31     ` Dongwon Kim
2018-05-22  5:57     ` [RFC " Oleksandr Andrushchenko
2018-05-22  5:57     ` [Xen-devel][RFC " Oleksandr Andrushchenko
2018-05-22  5:57       ` Oleksandr Andrushchenko
2018-05-17  8:26 ` [RFC " Oleksandr Andrushchenko

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=a08e7d0d-f7d5-6b7e-979b-8a17060482f0@gmail.com \
    --to=andr2000@gmail.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=daniel.vetter@intel.com \
    --cc=dongwon.kim@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=matthew.d.roper@intel.com \
    --cc=oleksandr_andrushchenko@epam.com \
    --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.