Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp572939imm; Mon, 21 May 2018 10:32:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZryidUyw+WsK/JYHl0hRYoejzbk4UdeThYJCA+mYRdawrZIJI16JdMVVAbZoacb6RWQcjW7 X-Received: by 2002:a17:902:8e8b:: with SMTP id bg11-v6mr20895615plb.95.1526923969242; Mon, 21 May 2018 10:32:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526923969; cv=none; d=google.com; s=arc-20160816; b=YNTJS5x+SFBHuUoqw7p6nhbXTtgqtZetxxAxaZ+R1q4M+SiT7T7wTJTIjq75s3VKn1 gAPduFZWktGiMxUEW+6xyCVIKaBa1Tbqy3RuB23ZzlMhS1oO/vzE+Pdur8xEjjW80KAe bWvAB+DyXKRxXvWuOxl0O/BDzRSIr0jzFsEbIsARDbW4Eahjt/h8tI7NAw+DykaUZXzY f9uFGEwWsDvcB/SteITdf05Z6BzgmTaLafl0prk9d+gRxnlMaNNuSI+6vOr2tyb9bLkB N43hD2FgVUNEK1yQ1oKPotdOWMpcNiYITxisaQzc6BBRCDOLPnxgCAjsZv2khS5EFuh3 axDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=8D2LrXQY0oEyhmEX9zp4wqsymyZfTDV7SHqlrc96xMs=; b=PItD+czbmjWf77ST9RDY88sJSGCHX0h3D5M1wuuLmxlu7TvOy3Bwh5IRifOYVrBiDl LsEtDMJ8hTS/NH4d50PbSErvf5SeA5eMjwpurAmgSm0ql2kwHiywOCe+3vWuRSeI40sk CJLNxlHnYn9W3/S1CiJUF17f4m3CZTUHyrOeCOoueVfMUvPCJlHXvew/QyAkRb6JQuz4 kWNh9cbZczfysfpeH1k5pCeGUpmT7YjGEI5bXEW6prAfgmZKF2lAbQ7Mt7XAST7QJ2lv 7jkmIZv+yHlhthqQfE7HaZASVOhGV0uEhzU3QVoVdCV+h7gZ6DXngvxAfcV5XT1KfF2s SYvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LafI4G1P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2-v6si5201838pgf.432.2018.05.21.10.32.34; Mon, 21 May 2018 10:32:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LafI4G1P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753299AbeEURcY (ORCPT + 99 others); Mon, 21 May 2018 13:32:24 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:39850 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753097AbeEURcU (ORCPT ); Mon, 21 May 2018 13:32:20 -0400 Received: by mail-lf0-f67.google.com with SMTP id j193-v6so25051933lfg.6; Mon, 21 May 2018 10:32:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=8D2LrXQY0oEyhmEX9zp4wqsymyZfTDV7SHqlrc96xMs=; b=LafI4G1PUxbzqBRB0uWzZ0OqsXNUSwGAUbzltZMu+MWQVa+77yTLQ0R9DzaKPyfozZ ENBUCBRz0ogyKEO0TesXBll9539y3PdXPkAhv1hXIiVgO++J1IAZRbXhFQC+BqqchIGZ uogWGNu3OWUO5DOudpTHZxPwDwm+Gia2VRTJ81LjqNduTT57R7FDGmzl26i+n+PIppoa eTtDvxLQcGZ+CQ2mw7UB5w1pO9SDRIEIhG/dnIw0guFDO893NzVz7YVg4ddX8pvff3H2 AiGXZqMxL608w/z9rWlumQhGEc1hqk2eXX5qzGBTVHz7jdczRT1RrUz5ye0NYzqvz/Np 4mDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=8D2LrXQY0oEyhmEX9zp4wqsymyZfTDV7SHqlrc96xMs=; b=Sz0J85GTcdyETa8uOD6bcrq4obYtfviy/0V6XRfm7E2OMWhBL4wRsYGaE0tOkdnl5W TFYCAonfgBaRTI/tJxW8pdsqryRbVIaoSCaQhENbdMs0D49yTaZIo6gskgSMLfFeeYoz samFkLrQgZHx//WWtYF+5P869FFVDqSodVl7Id6cxNEP8qCbY5/hrsDigiBBe70ROoST wA0hR66DKhHvRj0tnkIVRUH/AW+v2nMCsnvNfBhGzyhu2XK1ngJVoaPwp94dvQsy+msc 9bBkhvCsbNSeakXsW5Cb0P7k3hMCWMpt9gtemTvVY1nUY5kz00fXbKFDJQ8ZRUoI7Opu kTdg== X-Gm-Message-State: ALKqPwc/l8d2ZNRuzrcmehVdEpCSVGPWa3bIeknSOIsPbzPkfP9rsfQT FQ+rSAuV88+yZ/tivDAcd+E= X-Received: by 2002:a2e:8018:: with SMTP id j24-v6mr12267142ljg.92.1526923938667; Mon, 21 May 2018 10:32:18 -0700 (PDT) Received: from [192.168.0.20] (41-17-94-178.pool.ukrtel.net. [178.94.17.41]) by smtp.googlemail.com with ESMTPSA id j15-v6sm2570620lji.89.2018.05.21.10.32.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 May 2018 10:32:17 -0700 (PDT) Subject: Re: [Xen-devel] [RFC 1/3] xen/balloon: Allow allocating DMA buffers To: Boris Ostrovsky , 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 References: <20180517082604.14828-1-andr2000@gmail.com> <20180517082604.14828-2-andr2000@gmail.com> <6a108876-19b7-49d0-3de2-9e10f984736c@oracle.com> <9541926e-001a-e41e-317c-dbff6d687761@gmail.com> <218e2bf7-490d-f89e-9866-27b7e3dbc835@oracle.com> From: Oleksandr Andrushchenko Message-ID: Date: Mon, 21 May 2018 20:32:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <218e2bf7-490d-f89e-9866-27b7e3dbc835@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> A commit message would be useful. >> Sure, v1 will have it >>>> Signed-off-by: Oleksandr Andrushchenko >>>> >>>> >>>>       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