Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758031AbbGQNL0 (ORCPT ); Fri, 17 Jul 2015 09:11:26 -0400 Received: from smtp.citrix.com ([66.165.176.89]:13115 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754587AbbGQNLZ (ORCPT ); Fri, 17 Jul 2015 09:11:25 -0400 X-IronPort-AV: E=Sophos;i="5.15,496,1432598400"; d="scan'208";a="281970908" Message-ID: <55A8FEC2.1030307@citrix.com> Date: Fri, 17 Jul 2015 14:10:26 +0100 From: Julien Grall User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: Stefano Stabellini CC: , , David Vrabel , , Boris Ostrovsky , Subject: Re: [Xen-devel] [PATCH v2 03/20] xen/grant: Introduce helpers to split a page into grant References: <1436474552-31789-1-git-send-email-julien.grall@citrix.com> <1436474552-31789-4-git-send-email-julien.grall@citrix.com> <55A7D6AC.5060004@citrix.com> In-Reply-To: <55A7D6AC.5060004@citrix.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1689 Lines: 50 On 16/07/15 17:07, Julien Grall wrote: >>> + pfn = xen_page_to_pfn(page) + (offset >> XEN_PAGE_SHIFT); >>> + >>> + while (len) { >>> + glen = min_t(unsigned int, XEN_PAGE_SIZE - goffset, len); >> >> Similarly I don't think we want to support glen != XEN_PAGE_SIZE here > > See my answer above. > >> >> >>> + fn(pfn_to_mfn(pfn), goffset, &glen, data); >> >> Allowing the callee to change glen makes the interface more complex and >> certainly doesn't match the gnttab_foreach_grant function name anymore. > > Why? Each time the callback is called, there is a new grant allocated. As discussed IRL, I will rename this function into gnttab_foreach_grant_in_range. > >> If netback needs it, could it just do the work inside its own function? >> I would rather keep gnttab_foreach_grant simple and move the complexity >> there. > > Moving the complexity in netback means adding a loop in the callback > which will do exactly the same as this loop. > > That also means to use XEN_PAGE_SIZE & co which I'm trying to avoid in > order to not confuse the developer. If they are hidden it likely mean > less problem on 64KB when the developper is working on 4KB. > > IHMO, the complexity is not so bad and will be more lisible than yet > another loop. After the IRL talk, I will give a look if I can move the "netback problem" in a different helper. We can see later if we could improve the code. Regards, -- Julien Grall -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/