Xen-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Stefano Stabellini <sstabellini@kernel.org>
To: Simon Leiner <simon@leiner.me>
Cc: xen-devel@lists.xenproject.org, sstabellini@kernel.org,
	jgross@suse.com,  julien@xen.org
Subject: Re: [PATCH 1/2] xen/xenbus: Fix granting of vmalloc'd memory
Date: Tue, 25 Aug 2020 16:55:11 -0700 (PDT)
Message-ID: <alpine.DEB.2.21.2008251655020.24407@sstabellini-ThinkPad-T480s> (raw)
In-Reply-To: <20200825093153.35500-1-simon@leiner.me>

On Tue, 25 Aug 2020, Simon Leiner wrote:
> On some architectures (like ARM), virt_to_gfn cannot be used for
> vmalloc'd memory because of its reliance on virt_to_phys. This patch
> introduces a check for vmalloc'd addresses and obtains the PFN using
> vmalloc_to_pfn in that case.
> 
> Signed-off-by: Simon Leiner <simon@leiner.me>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  drivers/xen/xenbus/xenbus_client.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/xen/xenbus/xenbus_client.c b/drivers/xen/xenbus/xenbus_client.c
> index 786fbb7d8be0..907bcbb93afb 100644
> --- a/drivers/xen/xenbus/xenbus_client.c
> +++ b/drivers/xen/xenbus/xenbus_client.c
> @@ -379,8 +379,14 @@ int xenbus_grant_ring(struct xenbus_device *dev, void *vaddr,
>  	int i, j;
>  
>  	for (i = 0; i < nr_pages; i++) {
> -		err = gnttab_grant_foreign_access(dev->otherend_id,
> -						  virt_to_gfn(vaddr), 0);
> +		unsigned long gfn;
> +
> +		if (is_vmalloc_addr(vaddr))
> +			gfn = pfn_to_gfn(vmalloc_to_pfn(vaddr));
> +		else
> +			gfn = virt_to_gfn(vaddr);
> +
> +		err = gnttab_grant_foreign_access(dev->otherend_id, gfn, 0);
>  		if (err < 0) {
>  			xenbus_dev_fatal(dev, err,
>  					 "granting access to ring page");
> -- 
> 2.24.3 (Apple Git-128)
> 


      parent reply index

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Aw: [Linux] [ARM] Granting memory obtained from the DMA API>
2020-08-25  9:31 ` Simon Leiner
2020-08-25  9:31   ` [PATCH 2/2] arm/xen: Add misuse warning to virt_to_gfn Simon Leiner
2020-08-25 12:16     ` Jan Beulich
2020-08-25 23:48       ` Stefano Stabellini
2020-08-26  6:20         ` Jan Beulich
2020-08-26  7:50           ` Simon Leiner
2020-08-26  7:59             ` Jürgen Groß
2020-08-26  8:14               ` Simon Leiner
2020-08-26  8:27                 ` Jürgen Groß
2020-08-26  8:30                   ` Simon Leiner
2020-08-25 23:58     ` Stefano Stabellini
2020-08-26 18:37     ` Julien Grall
2020-08-27  5:21       ` Jürgen Groß
2020-08-27  8:24         ` Julien Grall
2020-08-27  8:35           ` Jürgen Groß
2020-08-27 16:04             ` Stefano Stabellini
2020-08-25 23:55   ` Stefano Stabellini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.21.2008251655020.24407@sstabellini-ThinkPad-T480s \
    --to=sstabellini@kernel.org \
    --cc=jgross@suse.com \
    --cc=julien@xen.org \
    --cc=simon@leiner.me \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Xen-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/xen-devel/0 xen-devel/git/0.git
	git clone --mirror https://lore.kernel.org/xen-devel/1 xen-devel/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 xen-devel xen-devel/ https://lore.kernel.org/xen-devel \
		xen-devel@lists.xenproject.org xen-devel@lists.xen.org
	public-inbox-index xen-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.xenproject.lists.xen-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git