From: ANNIE LI Subject: Re: [PATCH 1/2] xen/granttable: Support sub-page grants Date: Wed, 07 Dec 2011 11:36:36 +0800 Message-ID: <4EDEDF44.4000307@oracle.com> References: <4EDDF41E.8070200@oracle.com> <1323168999-4434-1-git-send-email-annie.li@oracle.com> <1323171726.23681.65.camel@zakaz.uk.xensource.com> <4EDE4EC4.8070802@goop.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4EDE4EC4.8070802@goop.org> Sender: linux-kernel-owner@vger.kernel.org To: Jeremy Fitzhardinge Cc: Ian Campbell , "xen-devel@lists.xensource.com" , "linux-kernel@vger.kernel.org" , "konrad.wilk@oracle.com" , "kurt.hackel@oracle.com" , Paul Durrant List-Id: xen-devel@lists.xenproject.org >> Returning -Esomething might be less drastic? ENOSYS perhaps? > Yeah, BUG_ON shouldn't be used for API misuse unless there's absolutely > no other way to handle it. OK, will change it, thanks. >>> + gnttab_shared.v2[ref].sub_page.frame = frame; >>> + gnttab_shared.v2[ref].sub_page.page_off = page_off; >>> + gnttab_shared.v2[ref].sub_page.length = length; >>> + gnttab_shared.v2[ref].hdr.domid = domid; >>> + wmb(); >>> + gnttab_shared.v2[ref].hdr.flags = >>> + GTF_permit_access | GTF_sub_page | flags; >>> +} >>> +EXPORT_SYMBOL_GPL(gnttab_grant_foreign_access_ref_subpage_v2); >>> + >>> +bool gnttab_subpage_trans_grants_available(void) >>> +{ >>> + return grant_table_version == 2; >>> +} >> It's not clear this adds anything over and above letting the user query >> the grant table version. It's hard to tell since there are no users >> presented here though. Perhaps separate subpage and transitive functions >> would be cleaner? > Well, in general, specifically testing for features rather than > interface versions is better. Ok, will split it into 2 functions and check the function pointer instead of grant table version, thanks. Thanks Annie