Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1185891 > unrolled thread

Re: [PATCH v2 02/20] xen: Introduce a function to split a Linux page into Xen page

Started byStefano Stabellini <stefano.stabellini@eu.citrix.com>
First post2015-07-16 16:30 +0200
Last post2015-07-16 17:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v2 02/20] xen: Introduce a function to split a Linux page  into Xen page Stefano Stabellini <stefano.stabellini@eu.citrix.com> - 2015-07-16 16:30 +0200
    Re: [Xen-devel] [PATCH v2 02/20] xen: Introduce a function to split  a Linux page into Xen page Julien Grall <julien.grall@citrix.com> - 2015-07-16 17:00 +0200

#1185891 — Re: [PATCH v2 02/20] xen: Introduce a function to split a Linux page into Xen page

FromStefano Stabellini <stefano.stabellini@eu.citrix.com>
Date2015-07-16 16:30 +0200
SubjectRe: [PATCH v2 02/20] xen: Introduce a function to split a Linux page into Xen page
Message-ID<pMSkF-Sa-1@gated-at.bofh.it>
On Thu, 9 Jul 2015, Julien Grall wrote:
> The Xen interface is always using 4KB page. This means that a Linux page
> may be split across multiple Xen page when the page granularity is not
> the same.
> 
> This helper will break down a Linux page into 4KB chunk and call the
> helper on each of them.
> 
> Signed-off-by: Julien Grall <julien.grall@citrix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> ---
>     Changes in v2:
>         - Patch added
> ---
>  include/xen/page.h | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/include/xen/page.h b/include/xen/page.h
> index 8ebd37b..b1f7722 100644
> --- a/include/xen/page.h
> +++ b/include/xen/page.h
> @@ -39,4 +39,24 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS];
>  
>  extern unsigned long xen_released_pages;
>  
> +typedef int (*xen_pfn_fn_t)(struct page *page, unsigned long pfn, void *data);
> +/* Break down the page in 4KB granularity and call fn foreach xen pfn */
> +static inline int xen_apply_to_page(struct page *page, xen_pfn_fn_t fn,
> +				    void *data)
> +{
> +	unsigned long pfn = xen_page_to_pfn(page);
> +	int i;
> +	int ret;

please initialize ret to 0


> +	for (i = 0; i < XEN_PFN_PER_PAGE; i++, pfn++) {
> +		ret = fn(page, pfn, data);
> +		if (ret)
> +			return ret;
> +	}
> +
> +	return ret;
> +}
> +
> +
>  #endif	/* _XEN_PAGE_H */


Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

--
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/

[toc] | [next] | [standalone]


#1185934 — Re: [Xen-devel] [PATCH v2 02/20] xen: Introduce a function to split a Linux page into Xen page

FromJulien Grall <julien.grall@citrix.com>
Date2015-07-16 17:00 +0200
SubjectRe: [Xen-devel] [PATCH v2 02/20] xen: Introduce a function to split a Linux page into Xen page
Message-ID<pMSNI-1qq-11@gated-at.bofh.it>
In reply to#1185891
Hi Stefano,

On 16/07/2015 16:23, Stefano Stabellini wrote:
>> diff --git a/include/xen/page.h b/include/xen/page.h
>> index 8ebd37b..b1f7722 100644
>> --- a/include/xen/page.h
>> +++ b/include/xen/page.h
>> @@ -39,4 +39,24 @@ struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS];
>>
>>   extern unsigned long xen_released_pages;
>>
>> +typedef int (*xen_pfn_fn_t)(struct page *page, unsigned long pfn, void *data);
>> +/* Break down the page in 4KB granularity and call fn foreach xen pfn */
>> +static inline int xen_apply_to_page(struct page *page, xen_pfn_fn_t fn,
>> +				    void *data)
>> +{
>> +	unsigned long pfn = xen_page_to_pfn(page);
>> +	int i;
>> +	int ret;
>
> please initialize ret to 0

Hmmm... right. I'm not sure why the compiler didn't catch it.

>
>> +	for (i = 0; i < XEN_PFN_PER_PAGE; i++, pfn++) {
>> +		ret = fn(page, pfn, data);
>> +		if (ret)
>> +			return ret;
>> +	}
>> +
>> +	return ret;
>> +}
>> +
>> +
>>   #endif	/* _XEN_PAGE_H */
>
>
> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>

Thank you,

-- 
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/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web