* [RESEND PATCH 1/3] staging: media: atomisp: Convert kmap() to kmap_local_page()
2022-07-07 20:07 [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page() Fabio M. De Francesco
@ 2022-07-07 20:07 ` Fabio M. De Francesco
2022-07-07 20:07 ` [RESEND PATCH 2/3] staging: media: atomisp: Use kmap_local_page() in hmm_set() Fabio M. De Francesco
` (2 subsequent siblings)
3 siblings, 0 replies; 8+ messages in thread
From: Fabio M. De Francesco @ 2022-07-07 20:07 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Hans Verkuil, Tsuchiya Yuto, Martiros Shakhzadyan, Hans de Goede,
linux-media, linux-staging, linux-kernel, Ira Weiny
Cc: Fabio M. De Francesco
The use of kmap() is being deprecated in favor of kmap_local_page() where
it is feasible. With kmap_local_page(), the mapping is per thread, CPU
local and not globally visible.
load_and_flush_by_kmap() is a function where the use of kmap_local_page()
in place of kmap() is correctly suited.
Convert load_and_flush_by_kmap() from kmap() to kmap_local_page().
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
drivers/staging/media/atomisp/pci/hmm/hmm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
index c1cda16f2dc0..6394385b6637 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
@@ -350,7 +350,7 @@ static int load_and_flush_by_kmap(ia_css_ptr virt, void *data,
idx = (virt - bo->start) >> PAGE_SHIFT;
offset = (virt - bo->start) - (idx << PAGE_SHIFT);
- src = (char *)kmap(bo->page_obj[idx].page) + offset;
+ src = (char *)kmap_local_page(bo->page_obj[idx].page) + offset;
if ((bytes + offset) >= PAGE_SIZE) {
len = PAGE_SIZE - offset;
@@ -369,7 +369,7 @@ static int load_and_flush_by_kmap(ia_css_ptr virt, void *data,
clflush_cache_range(src, len);
- kunmap(bo->page_obj[idx].page);
+ kunmap_local(src);
}
return 0;
--
2.36.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [RESEND PATCH 2/3] staging: media: atomisp: Use kmap_local_page() in hmm_set()
2022-07-07 20:07 [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page() Fabio M. De Francesco
2022-07-07 20:07 ` [RESEND PATCH 1/3] staging: media: atomisp: Convert kmap() " Fabio M. De Francesco
@ 2022-07-07 20:07 ` Fabio M. De Francesco
2022-07-07 20:07 ` [RESEND PATCH 3/3] staging: media: atomisp: Use kmap_local_page() in hmm_store() Fabio M. De Francesco
2022-07-08 15:55 ` [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page() Hans de Goede
3 siblings, 0 replies; 8+ messages in thread
From: Fabio M. De Francesco @ 2022-07-07 20:07 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Hans Verkuil, Tsuchiya Yuto, Martiros Shakhzadyan, Hans de Goede,
linux-media, linux-staging, linux-kernel, Ira Weiny
Cc: Fabio M. De Francesco
The use of kmap() is being deprecated in favor of kmap_local_page()
where it is feasible. In file pci/hmm/hmm.c, function hmm_set() calls
kmap() / kunmap() where kmap_local_page() can instead do the mapping.
With kmap_local_page(), the mapping is per thread, CPU local and not
globally visible. Therefore, hmm_set()() is a function where the use
of kmap_local_page() in place of kmap() is correctly suited.
Convert the calls of kmap() / kunmap() to kmap_local_page() /
kunmap_local().
Tested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
drivers/staging/media/atomisp/pci/hmm/hmm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
index 6394385b6637..46ac082cd3f1 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
@@ -563,7 +563,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
idx = (virt - bo->start) >> PAGE_SHIFT;
offset = (virt - bo->start) - (idx << PAGE_SHIFT);
- des = (char *)kmap(bo->page_obj[idx].page) + offset;
+ des = (char *)kmap_local_page(bo->page_obj[idx].page) + offset;
if ((bytes + offset) >= PAGE_SIZE) {
len = PAGE_SIZE - offset;
@@ -579,7 +579,7 @@ int hmm_set(ia_css_ptr virt, int c, unsigned int bytes)
clflush_cache_range(des, len);
- kunmap(bo->page_obj[idx].page);
+ kunmap_local(des);
}
return 0;
--
2.36.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* [RESEND PATCH 3/3] staging: media: atomisp: Use kmap_local_page() in hmm_store()
2022-07-07 20:07 [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page() Fabio M. De Francesco
2022-07-07 20:07 ` [RESEND PATCH 1/3] staging: media: atomisp: Convert kmap() " Fabio M. De Francesco
2022-07-07 20:07 ` [RESEND PATCH 2/3] staging: media: atomisp: Use kmap_local_page() in hmm_set() Fabio M. De Francesco
@ 2022-07-07 20:07 ` Fabio M. De Francesco
2022-07-08 15:55 ` [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page() Hans de Goede
3 siblings, 0 replies; 8+ messages in thread
From: Fabio M. De Francesco @ 2022-07-07 20:07 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Sakari Ailus, Greg Kroah-Hartman,
Hans Verkuil, Tsuchiya Yuto, Martiros Shakhzadyan, Hans de Goede,
linux-media, linux-staging, linux-kernel, Ira Weiny
Cc: Fabio M. De Francesco
The use of kmap() is being deprecated in favor of kmap_local_page()
where it is feasible. The same is true for kmap_atomic().
In file pci/hmm/hmm.c, function hmm_store() test if we are in atomic
context and, if so, it calls kmap_atomic(), if not, it calls kmap().
First of all, in_atomic() shouldn't be used in drivers. This macro
cannot always detect atomic context; in particular, it cannot know
about held spinlocks in non-preemptible kernels.
Notwithstanding what it is said above, this code doesn't need to care
whether or not it is executing in atomic context. It can simply use
kmap_local_page() / kunmap_local() that can instead do the mapping /
unmapping regardless of the context.
With kmap_local_page(), the mapping is per thread, CPU local and not
globally visible. Therefore, hmm_store()() is a function where the use
of kmap_local_page() in place of both kmap() and kmap_atomic() is
correctly suited.
Convert the calls of kmap() / kunmap() and kmap_atomic() /
kunmap_atomic() to kmap_local_page() / kunmap_local() and drop the
unnecessary tests which test if the code is in atomic context.
Tested-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Fabio M. De Francesco <fmdefrancesco@gmail.com>
---
drivers/staging/media/atomisp/pci/hmm/hmm.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/media/atomisp/pci/hmm/hmm.c b/drivers/staging/media/atomisp/pci/hmm/hmm.c
index 46ac082cd3f1..54188197c3dc 100644
--- a/drivers/staging/media/atomisp/pci/hmm/hmm.c
+++ b/drivers/staging/media/atomisp/pci/hmm/hmm.c
@@ -482,10 +482,7 @@ int hmm_store(ia_css_ptr virt, const void *data, unsigned int bytes)
idx = (virt - bo->start) >> PAGE_SHIFT;
offset = (virt - bo->start) - (idx << PAGE_SHIFT);
- if (in_atomic())
- des = (char *)kmap_atomic(bo->page_obj[idx].page);
- else
- des = (char *)kmap(bo->page_obj[idx].page);
+ des = (char *)kmap_local_page(bo->page_obj[idx].page);
if (!des) {
dev_err(atomisp_dev,
@@ -512,14 +509,7 @@ int hmm_store(ia_css_ptr virt, const void *data, unsigned int bytes)
clflush_cache_range(des, len);
- if (in_atomic())
- /*
- * Note: kunmap_atomic requires return addr from
- * kmap_atomic, not the page. See linux/highmem.h
- */
- kunmap_atomic(des - offset);
- else
- kunmap(bo->page_obj[idx].page);
+ kunmap_local(des);
}
return 0;
--
2.36.1
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page()
2022-07-07 20:07 [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page() Fabio M. De Francesco
` (2 preceding siblings ...)
2022-07-07 20:07 ` [RESEND PATCH 3/3] staging: media: atomisp: Use kmap_local_page() in hmm_store() Fabio M. De Francesco
@ 2022-07-08 15:55 ` Hans de Goede
2022-07-09 16:46 ` Mauro Carvalho Chehab
3 siblings, 1 reply; 8+ messages in thread
From: Hans de Goede @ 2022-07-08 15:55 UTC (permalink / raw)
To: Fabio M. De Francesco, Mauro Carvalho Chehab, Sakari Ailus,
Greg Kroah-Hartman, Hans Verkuil, Tsuchiya Yuto,
Martiros Shakhzadyan, linux-media, linux-staging, linux-kernel,
Ira Weiny
Hi,
On 7/7/22 22:07, Fabio M. De Francesco wrote:
> After waiting months, I'm resending three conversions to
> kmap_local_page(). I'd like to ask if there is anything which prevents
> these patches from being accepted.
>
> Please note that these patches were submitted on April 2022.
>
> For you convenience here are the links to the patches, the "Reviewed-by:"
> and "Tested-by:" tags:
>
> [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_store()
> https://lore.kernel.org/lkml/20220413225531.9425-1-fmdefrancesco@gmail.com/
> https://lore.kernel.org/lkml/Yli+R7iLZKqO8kVP@iweiny-desk3/
> https://lore.kernel.org/lkml/2d096f20-dbaa-1d49-96e9-a7ae6c19f7fe@redhat.com/
>
> [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set()
> https://lore.kernel.org/lkml/20220413212210.18494-1-fmdefrancesco@gmail.com/
> https://lore.kernel.org/lkml/YldNhErgt53RqYp7@iweiny-desk3/
> https://lore.kernel.org/lkml/0b04ad1a-e442-1728-ef2c-bab386a4c64c@redhat.com/
>
> [PATCH] staging: media: atomisp: Convert kmap() to kmap_local_page()
> https://lore.kernel.org/lkml/20220408223129.3844-1-fmdefrancesco@gmail.com/
> https://lore.kernel.org/lkml/b0aed731-b56f-4378-b50e-fc0cbccbdb84@redhat.com/
>
> Fabio M. De Francesco (3):
> staging: media: atomisp: Convert kmap() to kmap_local_page()
> staging: media: atomisp: Use kmap_local_page() in hmm_set()
> staging: media: atomisp: Use kmap_local_page() in hmm_store()
Thanks, the entire series looks good to me:
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Regards,
Hans
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page()
2022-07-08 15:55 ` [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page() Hans de Goede
@ 2022-07-09 16:46 ` Mauro Carvalho Chehab
2022-07-12 10:43 ` Fabio M. De Francesco
0 siblings, 1 reply; 8+ messages in thread
From: Mauro Carvalho Chehab @ 2022-07-09 16:46 UTC (permalink / raw)
To: Hans de Goede
Cc: Fabio M. De Francesco, Sakari Ailus, Greg Kroah-Hartman,
Hans Verkuil, Tsuchiya Yuto, Martiros Shakhzadyan, linux-media,
linux-staging, linux-kernel, Ira Weiny
Em Fri, 8 Jul 2022 17:55:26 +0200
Hans de Goede <hdegoede@redhat.com> escreveu:
> Hi,
>
> On 7/7/22 22:07, Fabio M. De Francesco wrote:
> > After waiting months, I'm resending three conversions to
> > kmap_local_page(). I'd like to ask if there is anything which prevents
> > these patches from being accepted.
> >
> > Please note that these patches were submitted on April 2022.
> >
> > For you convenience here are the links to the patches, the "Reviewed-by:"
> > and "Tested-by:" tags:
> >
> > [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_store()
> > https://lore.kernel.org/lkml/20220413225531.9425-1-fmdefrancesco@gmail.com/
> > https://lore.kernel.org/lkml/Yli+R7iLZKqO8kVP@iweiny-desk3/
> > https://lore.kernel.org/lkml/2d096f20-dbaa-1d49-96e9-a7ae6c19f7fe@redhat.com/
> >
> > [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set()
> > https://lore.kernel.org/lkml/20220413212210.18494-1-fmdefrancesco@gmail.com/
> > https://lore.kernel.org/lkml/YldNhErgt53RqYp7@iweiny-desk3/
> > https://lore.kernel.org/lkml/0b04ad1a-e442-1728-ef2c-bab386a4c64c@redhat.com/
> >
> > [PATCH] staging: media: atomisp: Convert kmap() to kmap_local_page()
> > https://lore.kernel.org/lkml/20220408223129.3844-1-fmdefrancesco@gmail.com/
> > https://lore.kernel.org/lkml/b0aed731-b56f-4378-b50e-fc0cbccbdb84@redhat.com/
> >
> > Fabio M. De Francesco (3):
> > staging: media: atomisp: Convert kmap() to kmap_local_page()
> > staging: media: atomisp: Use kmap_local_page() in hmm_set()
> > staging: media: atomisp: Use kmap_local_page() in hmm_store()
>
> Thanks, the entire series looks good to me:
>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Yesterday, I applied all pending patches at media-stage, including those.
Please check if everything is ok, as I had to solve some trivial
conflicts.
Regards,
Mauro
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page()
2022-07-09 16:46 ` Mauro Carvalho Chehab
@ 2022-07-12 10:43 ` Fabio M. De Francesco
2022-07-15 16:10 ` Hans de Goede
0 siblings, 1 reply; 8+ messages in thread
From: Fabio M. De Francesco @ 2022-07-12 10:43 UTC (permalink / raw)
To: Hans de Goede, Mauro Carvalho Chehab
Cc: Sakari Ailus, Greg Kroah-Hartman, Hans Verkuil, Tsuchiya Yuto,
Martiros Shakhzadyan, linux-media, linux-staging, linux-kernel,
Ira Weiny
On sabato 9 luglio 2022 18:46:45 CEST Mauro Carvalho Chehab wrote:
> Em Fri, 8 Jul 2022 17:55:26 +0200
> Hans de Goede <hdegoede@redhat.com> escreveu:
>
> > Hi,
> >
> > On 7/7/22 22:07, Fabio M. De Francesco wrote:
> > > After waiting months, I'm resending three conversions to
> > > kmap_local_page(). I'd like to ask if there is anything which
prevents
> > > these patches from being accepted.
> > >
> > > Please note that these patches were submitted on April 2022.
> > >
> > > For you convenience here are the links to the patches, the "Reviewed-
by:"
> > > and "Tested-by:" tags:
> > >
> > > [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_store()
> > > https://lore.kernel.org/lkml/20220413225531.9425-1-fmdefrancesco@gmail.com/
> > > https://lore.kernel.org/lkml/Yli+R7iLZKqO8kVP@iweiny-desk3/
> > > https://lore.kernel.org/lkml/2d096f20-dbaa-1d49-96e9-a7ae6c19f7fe@redhat.com/
> > >
> > > [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set()
> > > https://lore.kernel.org/lkml/20220413212210.18494-1-fmdefrancesco@gmail.com/
> > > https://lore.kernel.org/lkml/YldNhErgt53RqYp7@iweiny-desk3/
> > > https://lore.kernel.org/lkml/0b04ad1a-e442-1728-ef2c-bab386a4c64c@redhat.com/
> > >
> > > [PATCH] staging: media: atomisp: Convert kmap() to kmap_local_page()
> > > https://lore.kernel.org/lkml/20220408223129.3844-1-fmdefrancesco@gmail.com/
> > > https://lore.kernel.org/lkml/b0aed731-b56f-4378-b50e-fc0cbccbdb84@redhat.com/
> > >
> > > Fabio M. De Francesco (3):
> > > staging: media: atomisp: Convert kmap() to kmap_local_page()
> > > staging: media: atomisp: Use kmap_local_page() in hmm_set()
> > > staging: media: atomisp: Use kmap_local_page() in hmm_store()
> >
> > Thanks, the entire series looks good to me:
> >
> > Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>
> Yesterday, I applied all pending patches at media-stage, including those.
> Please check if everything is ok, as I had to solve some trivial
> conflicts.
>
> Regards,
> Mauro
>
I just checked those patches at media-stage and everything seems fine.
Thanks for applying them.
Regards,
Fabio
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [RESEND PATCH 0/3] staging: media: atomisp: Convert to kmap_local_page()
2022-07-12 10:43 ` Fabio M. De Francesco
@ 2022-07-15 16:10 ` Hans de Goede
0 siblings, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2022-07-15 16:10 UTC (permalink / raw)
To: Fabio M. De Francesco, Mauro Carvalho Chehab
Cc: Sakari Ailus, Greg Kroah-Hartman, Hans Verkuil, Tsuchiya Yuto,
Martiros Shakhzadyan, linux-media, linux-staging, linux-kernel,
Ira Weiny
Hi,
On 7/12/22 12:43, Fabio M. De Francesco wrote:
> On sabato 9 luglio 2022 18:46:45 CEST Mauro Carvalho Chehab wrote:
>> Em Fri, 8 Jul 2022 17:55:26 +0200
>> Hans de Goede <hdegoede@redhat.com> escreveu:
>>
>>> Hi,
>>>
>>> On 7/7/22 22:07, Fabio M. De Francesco wrote:
>>>> After waiting months, I'm resending three conversions to
>>>> kmap_local_page(). I'd like to ask if there is anything which
> prevents
>>>> these patches from being accepted.
>>>>
>>>> Please note that these patches were submitted on April 2022.
>>>>
>>>> For you convenience here are the links to the patches, the "Reviewed-
> by:"
>>>> and "Tested-by:" tags:
>>>>
>>>> [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_store()
>>>> https://lore.kernel.org/lkml/20220413225531.9425-1-fmdefrancesco@gmail.com/
>>>> https://lore.kernel.org/lkml/Yli+R7iLZKqO8kVP@iweiny-desk3/
>>>> https://lore.kernel.org/lkml/2d096f20-dbaa-1d49-96e9-a7ae6c19f7fe@redhat.com/
>>>>
>>>> [PATCH] staging: media: atomisp: Use kmap_local_page() in hmm_set()
>>>> https://lore.kernel.org/lkml/20220413212210.18494-1-fmdefrancesco@gmail.com/
>>>> https://lore.kernel.org/lkml/YldNhErgt53RqYp7@iweiny-desk3/
>>>> https://lore.kernel.org/lkml/0b04ad1a-e442-1728-ef2c-bab386a4c64c@redhat.com/
>>>>
>>>> [PATCH] staging: media: atomisp: Convert kmap() to kmap_local_page()
>>>> https://lore.kernel.org/lkml/20220408223129.3844-1-fmdefrancesco@gmail.com/
>>>> https://lore.kernel.org/lkml/b0aed731-b56f-4378-b50e-fc0cbccbdb84@redhat.com/
>>>>
>>>> Fabio M. De Francesco (3):
>>>> staging: media: atomisp: Convert kmap() to kmap_local_page()
>>>> staging: media: atomisp: Use kmap_local_page() in hmm_set()
>>>> staging: media: atomisp: Use kmap_local_page() in hmm_store()
>>>
>>> Thanks, the entire series looks good to me:
>>>
>>> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>>
>> Yesterday, I applied all pending patches at media-stage, including those.
>> Please check if everything is ok, as I had to solve some trivial
>> conflicts.
>>
>> Regards,
>> Mauro
>>
> I just checked those patches at media-stage and everything seems fine.
> Thanks for applying them.
The landing of my series in media-stage looks good too,
Thanks.
Regards,
Hans
^ permalink raw reply [flat|nested] 8+ messages in thread