lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 21 Jul 2015 12:30:02 +0200
From:	Roger Pau Monné <roger.pau@...rix.com>
To:	Julien Grall <julien.grall@...rix.com>,
	<xen-devel@...ts.xenproject.org>
CC:	<linux-arm-kernel@...ts.infradead.org>, <ian.campbell@...rix.com>,
	<stefano.stabellini@...citrix.com>, <linux-kernel@...r.kernel.org>,
	"Konrad Rzeszutek Wilk" <konrad.wilk@...cle.com>,
	Boris Ostrovsky <boris.ostrovsky@...cle.com>,
	David Vrabel <david.vrabel@...rix.com>
Subject: Re: [PATCH v2 07/20] block/xen-blkfront: split get_grant in 2

El 09/07/15 a les 22.42, Julien Grall ha escrit:
> Prepare the code to support 64KB page granularity. The first
> implementation will use a full Linux page per indirect and persistent
> grant. When non-persistent grant is used, each page of a bio request
> may be split in multiple grant.
> 
> Furthermore, the field page of the grant structure is only used to copy
> data from persistent grant or indirect grant. Avoid to set it for other
> use case as it will have no meaning given the page will be split in
> multiple grant.
> 
> Provide 2 functions, to setup indirect grant, the other for bio page.
> 
> Signed-off-by: Julien Grall <julien.grall@...rix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
> Cc: Roger Pau Monné <roger.pau@...rix.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@...cle.com>
> Cc: David Vrabel <david.vrabel@...rix.com>
> ---
>     Changes in v2:
>         - Patch added
> ---
>  drivers/block/xen-blkfront.c | 85 ++++++++++++++++++++++++++++++--------------
>  1 file changed, 59 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
> index 7b81d23..95fd067 100644
> --- a/drivers/block/xen-blkfront.c
> +++ b/drivers/block/xen-blkfront.c
> @@ -242,34 +242,77 @@ out_of_memory:
>  	return -ENOMEM;
>  }
>  
> -static struct grant *get_grant(grant_ref_t *gref_head,
> -			       struct page *page,
> -                               struct blkfront_info *info)
> +static struct grant *get_free_grant(struct blkfront_info *info)
>  {
>  	struct grant *gnt_list_entry;
> -	unsigned long buffer_mfn;
>  
>  	BUG_ON(list_empty(&info->grants));
>  	gnt_list_entry = list_first_entry(&info->grants, struct grant,
> -	                                  node);
> +					  node);

Stray change?

>  	list_del(&gnt_list_entry->node);
>  
> -	if (gnt_list_entry->gref != GRANT_INVALID_REF) {
> +	if (gnt_list_entry->gref != GRANT_INVALID_REF)
>  		info->persistent_gnts_c--;
> +
> +	return gnt_list_entry;
> +}
> +
> +static void grant_foreign_access(const struct grant *gnt_list_entry,
> +				 const struct blkfront_info *info)

Given that this is just a wrapper I would make it an inline function, or
even consider removing it and just call
gnttab_page_grant_foreign_access_ref directly.

> +{
> +	gnttab_page_grant_foreign_access_ref(gnt_list_entry->gref,
> +					     info->xbdev->otherend_id,
> +					     gnt_list_entry->page,
> +					     0);
> +}
> +
> +static struct grant *get_grant(grant_ref_t *gref_head,
> +			       unsigned long mfn,
> +			       struct blkfront_info *info)

Indentation.

> +{
> +	struct grant *gnt_list_entry = get_free_grant(info);
> +
> +	if (gnt_list_entry->gref != GRANT_INVALID_REF)
>  		return gnt_list_entry;
> +
> +	/* Assign a gref to this page */
> +	gnt_list_entry->gref = gnttab_claim_grant_reference(gref_head);
> +	BUG_ON(gnt_list_entry->gref == -ENOSPC);
> +	if (info->feature_persistent)
> +		grant_foreign_access(gnt_list_entry, info);
> +	else {
> +		/* Grant access to the MFN passed by the caller */
> +		gnttab_grant_foreign_access_ref(gnt_list_entry->gref,
> +			                        info->xbdev->otherend_id,
> +				                mfn, 0);
>  	}
>  
> +	return gnt_list_entry;
> +}
> +
> +static struct grant *get_indirect_grant(grant_ref_t *gref_head,
> +					struct blkfront_info *info)

Indentation.

Roger.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ