mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Xie Yongji <xieyongji@bytedance.com>,
	mst@redhat.com, xiaodong.liu@intel.com,
	maxime.coquelin@redhat.com, stefanha@redhat.com
Cc: songmuchun@bytedance.com,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/5] vduse: Use memcpy_{to,from}_page() in do_bounce()
Date: Wed, 13 Jul 2022 13:59:17 +0800	[thread overview]
Message-ID: <44610c2a-9fd1-8d15-a792-a96900e89424@redhat.com> (raw)
In-Reply-To: <20220706050503.171-3-xieyongji@bytedance.com>


在 2022/7/6 13:05, Xie Yongji 写道:
> kmap_atomic() is being deprecated in favor of kmap_local_page().
>
> The use of kmap_atomic() in do_bounce() is all thread local therefore
> kmap_local_page() is a sufficient replacement.
>
> Convert to kmap_local_page() but, instead of open coding it,
> use the helpers memcpy_to_page() and memcpy_from_page().
>
> Signed-off-by: Xie Yongji <xieyongji@bytedance.com>


Acked-by: Jason Wang <jasowang@redhat.com>


> ---
>   drivers/vdpa/vdpa_user/iova_domain.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/vdpa/vdpa_user/iova_domain.c b/drivers/vdpa/vdpa_user/iova_domain.c
> index bca1f0b8850c..50d7c08d5450 100644
> --- a/drivers/vdpa/vdpa_user/iova_domain.c
> +++ b/drivers/vdpa/vdpa_user/iova_domain.c
> @@ -138,18 +138,17 @@ static void do_bounce(phys_addr_t orig, void *addr, size_t size,
>   {
>   	unsigned long pfn = PFN_DOWN(orig);
>   	unsigned int offset = offset_in_page(orig);
> -	char *buffer;
> +	struct page *page;
>   	unsigned int sz = 0;
>   
>   	while (size) {
>   		sz = min_t(size_t, PAGE_SIZE - offset, size);
>   
> -		buffer = kmap_atomic(pfn_to_page(pfn));
> +		page = pfn_to_page(pfn);
>   		if (dir == DMA_TO_DEVICE)
> -			memcpy(addr, buffer + offset, sz);
> +			memcpy_from_page(addr, page, offset, sz);
>   		else
> -			memcpy(buffer + offset, addr, sz);
> -		kunmap_atomic(buffer);
> +			memcpy_to_page(page, offset, addr, sz);
>   
>   		size -= sz;
>   		pfn++;


  reply	other threads:[~2022-07-13  5:59 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06  5:04 [PATCH v2 0/5] VDUSE: Support registering userspace memory as bounce buffer Xie Yongji
2022-07-06  5:04 ` [PATCH v2 1/5] vduse: Remove unnecessary spin lock protection Xie Yongji
2022-07-13  5:43   ` Jason Wang
2022-07-13 11:08     ` Yongji Xie
2022-07-14  2:27       ` Jason Wang
2022-07-14  6:06         ` Yongji Xie
2022-07-13  5:57   ` Michael S. Tsirkin
2022-07-13 10:39     ` Yongji Xie
2022-07-06  5:05 ` [PATCH v2 2/5] vduse: Use memcpy_{to,from}_page() in do_bounce() Xie Yongji
2022-07-13  5:59   ` Jason Wang [this message]
2022-07-06  5:05 ` [PATCH v2 3/5] vduse: Support using userspace pages as bounce buffer Xie Yongji
2022-07-06  5:05 ` [PATCH v2 4/5] vduse: Support querying IOLTB information Xie Yongji
2022-07-14  2:51   ` Jason Wang
2022-07-14  5:58     ` Yongji Xie
2022-07-06  5:05 ` [PATCH v2 5/5] vduse: Support registering userspace memory for IOTLB Xie Yongji
2022-07-06  6:08   ` kernel test robot
2022-07-07 23:01   ` kernel test robot
2022-07-08  1:14   ` kernel test robot
2022-07-06  9:30 ` [PATCH v2 0/5] VDUSE: Support registering userspace memory as bounce buffer Jason Wang
2022-07-06 10:15   ` Yongji Xie
2022-07-08  8:38     ` Jason Wang
2022-07-08  9:53       ` Yongji Xie
2022-07-11  6:02         ` Jason Wang
2022-07-11  7:24           ` Yongji Xie
2022-07-14  2:59             ` Jason Wang

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=44610c2a-9fd1-8d15-a792-a96900e89424@redhat.com \
    --to=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=mst@redhat.com \
    --cc=songmuchun@bytedance.com \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=xiaodong.liu@intel.com \
    --cc=xieyongji@bytedance.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®