[PATCH] xen/blkback: use kmap_local_page()

flyingpenghao@gmail.com posted 1 patch 1 month, 3 weeks ago
Failed in applying to current master (apply log)
There is a newer version of this series
drivers/block/xen-blkback/blkback.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] xen/blkback: use kmap_local_page()
Posted by flyingpenghao@gmail.com 1 month, 3 weeks ago
From: Peng Hao <flyingpeng@tencent.com>

From: Peng Hao <flyingpeng@tencent.com>

Use kmap_local_page() instead of kmap_atomic() which has been
deprecated.

Signed-off-by: Peng Hao <flyingpeng@tencent.com>
---
 drivers/block/xen-blkback/blkback.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 4defd7f387c7..cce534f43292 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -937,8 +937,8 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req,
 		if ((n % SEGS_PER_INDIRECT_FRAME) == 0) {
 			/* Map indirect segments */
 			if (segments)
-				kunmap_atomic(segments);
-			segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
+				kunmap_local(segments);
+			segments = kmap_local_page(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
 		}
 		i = n % SEGS_PER_INDIRECT_FRAME;
 
-- 
2.31.1
Re: [PATCH] xen/blkback: use kmap_local_page()
Posted by Roger Pau Monné 1 month, 3 weeks ago
On Wed, Mar 06, 2024 at 01:15:48PM +0800, flyingpenghao@gmail.com wrote:
> From: Peng Hao <flyingpeng@tencent.com>
> 
> From: Peng Hao <flyingpeng@tencent.com>
> 
> Use kmap_local_page() instead of kmap_atomic() which has been
> deprecated.
> 
> Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> ---
>  drivers/block/xen-blkback/blkback.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
> index 4defd7f387c7..cce534f43292 100644
> --- a/drivers/block/xen-blkback/blkback.c
> +++ b/drivers/block/xen-blkback/blkback.c
> @@ -937,8 +937,8 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req,
>  		if ((n % SEGS_PER_INDIRECT_FRAME) == 0) {
>  			/* Map indirect segments */
>  			if (segments)
> -				kunmap_atomic(segments);
> -			segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
> +				kunmap_local(segments);
> +			segments = kmap_local_page(pages[n/SEGS_PER_INDIRECT_FRAME]->page);

Don't you need to also switch to kunmap_local() then instead of
kunmap_atomic()?

Thanks, Roger.
Re: [PATCH] xen/blkback: use kmap_local_page()
Posted by Hao Peng 1 month, 2 weeks ago
On Wed, Mar 6, 2024 at 4:41 PM Roger Pau Monné <roger.pau@citrix.com> wrote:
>
> On Wed, Mar 06, 2024 at 01:15:48PM +0800, flyingpenghao@gmail.com wrote:
> > From: Peng Hao <flyingpeng@tencent.com>
> >
> > From: Peng Hao <flyingpeng@tencent.com>
> >
> > Use kmap_local_page() instead of kmap_atomic() which has been
> > deprecated.
> >
> > Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> > ---
> >  drivers/block/xen-blkback/blkback.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
> > index 4defd7f387c7..cce534f43292 100644
> > --- a/drivers/block/xen-blkback/blkback.c
> > +++ b/drivers/block/xen-blkback/blkback.c
> > @@ -937,8 +937,8 @@ static int xen_blkbk_parse_indirect(struct blkif_request *req,
> >               if ((n % SEGS_PER_INDIRECT_FRAME) == 0) {
> >                       /* Map indirect segments */
> >                       if (segments)
> > -                             kunmap_atomic(segments);
> > -                     segments = kmap_atomic(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
> > +                             kunmap_local(segments);
> > +                     segments = kmap_local_page(pages[n/SEGS_PER_INDIRECT_FRAME]->page);
>
> Don't you need to also switch to kunmap_local() then instead of
> kunmap_atomic()?
 kmap_local() and  kunmap_local() are paired.
 I found that I missed a modification, I will re-issue patch v2
 Thanks.
>
> Thanks, Roger.