History log of /linux-master/drivers/staging/media/atomisp/pci/hmm/hmm_bo.c
Revision Date Author Comments
# 1c71222e 26-Jan-2023 Suren Baghdasaryan <surenb@google.com>

mm: replace vma->vm_flags direct modifications with modifier calls

Replace direct modifications to vma->vm_flags with calls to modifier
functions to be able to track flag changes and to keep vma locking
correctness.

[akpm@linux-foundation.org: fix drivers/misc/open-dice.c, per Hyeonggon Yoo]
Link: https://lkml.kernel.org/r/20230126193752.297968-5-surenb@google.com
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Mel Gorman <mgorman@techsingularity.net>
Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Reviewed-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Arjun Roy <arjunroy@google.com>
Cc: Axel Rasmussen <axelrasmussen@google.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: David Rientjes <rientjes@google.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Greg Thelen <gthelen@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Joel Fernandes <joelaf@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Laurent Dufour <ldufour@linux.ibm.com>
Cc: Lorenzo Stoakes <lstoakes@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Minchan Kim <minchan@google.com>
Cc: Paul E. McKenney <paulmck@kernel.org>
Cc: Peter Oskolkov <posk@google.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Punit Agrawal <punit.agrawal@bytedance.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Shakeel Butt <shakeelb@google.com>
Cc: Soheil Hassas Yeganeh <soheil@google.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>


# f5cb5ada 08-Nov-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: Drop userptr support from hmm

After the conversion to videobuf2 userptr support is no longer needed,
drop it.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# ac8dd062 23-Oct-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: Log an error on failing to alloc private-mem

I managed to trigger an atomisp_css_start() error by pushing my test
system towards an OOM situation, this resulted in the following errors:

atomisp-isp2 0000:00:03.0: alloc pages err...
atomisp-isp2 0000:00:03.0: hmm_bo_alloc_pages failed.
atomisp-isp2 0000:00:03.0: stream[0] start error.

But it is not entirely clear what the root cause of
the "alloc pages err..." error is. I suspect the root cause is
alloc_pages_bulk_array() failing. Add a log message to make
the root cause more clear if this is hit again.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 931d87d2 26-Sep-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: Add hmm_create_from_vmalloc_buf() function

Add a new hmm creating function to create a vmm object from a vmalloc-ed
kernel buffer. This is a preparation patch for adding videobuf2 (and
working MMAP mode) support.

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 30cf7e90 21-Aug-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: hmm_bo: Drop PFN code path from alloc_user_pages()

alloc_user_pages() is only ever called on qbuf for USERPTR buffers which
always hits the get_user_pages_fast() path, so the pin_user_pages() path
can be removed.

Getting the vma then also is no longer necessary since that is only
done to determine which path to use.

And this also removes the only users of the mem_type struct hmm_bo member,
so remove that as well.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 3df52e58 13-Aug-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: hmm_bo: Rewrite free_private_pages() using pages_array helper funcs

Rewrite free_private_pages() using pages_array helper funcs.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 2691ecc0 13-Aug-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: hmm_bo: Rewrite alloc_private_pages() using pages_array helper funcs

Rewrite alloc_private_pages() using pages_array helper funcs.

Note alloc_pages_bulk_array() skips non NULL pages, so switch
the allocating of the pages pointer array to kcalloc to ensure
the pages are initially all set to NULL.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# fce48bf1 13-Aug-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: hmm_bo: Further simplify alloc_private_pages()

Further simplify alloc_private_pages().

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 8519635c 13-Aug-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: hmm_bo: Simplify alloc_private_pages()

Since lack_mem starts initialized to true, alloc_private_pages() will
always set order to HMM_MIN_ORDER aka 0 / will always alloc 1 page at
a time.

So all the magic to decrease order if allocs fail is not necessary
and can be removed.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 3a68900a 15-Jun-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: remove hmm_page_object

hmm_page_object only stores a struct page pointer, so we can just use
the hmm_bo.pages page pointer array everywhere.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-33-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# f9599127 15-Jun-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: drop HMM_BO_SHARE type

HMM_BO_SHARE is not supported by the hmm_bo code at all, drop it.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-32-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 975c343f 15-Jun-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: drop highmem var/arg from the hmm code

highmem is always false, drop it.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-31-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 90612317 15-Jun-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: drop unused ATOMISP_MAP_FLAG_* flags

Drop the ATOMISP_MAP_FLAG_CACHED flag, it is never set anywhere;
also drop the matching "cached" parameter to hmm[_bo]_alloc which
value was derived form the never set flag.

Drop the ATOMISP_MAP_FLAG_NOFLUSH, it is not used anywhere.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-27-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# b03d581b 15-Jun-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: removed unused hmm_bo_get_page_info() function

hmm_bo_get_page_info() is not used anywhere, remove it.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-17-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 2c997495 15-Jun-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: drop hmm_page_type

Since the hmm-pool code has been removed this now always gets set
to HMM_PAGE_TYPE_GENERAL, so just remove it.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-16-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 454da4d2 15-Jun-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: remove hmm_mem_stats

Without pool support the (optional) debug logging done by these is
not really meaningful, drop it all.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-13-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# c35f36b7 15-Jun-2022 Hans de Goede <hdegoede@redhat.com>

media: atomisp: remove hmm pool code

Since we never register any pools, this is all dead code,
remove it.

Link: https://lore.kernel.org/linux-media/20220615205037.16549-12-hdegoede@redhat.com
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>


# 16a5dcf7 27-Sep-2020 Souptick Joarder <jrdr.linux@gmail.com>

media: atomisp: Fixed error handling path

Inside alloc_user_pages() based on flag value either pin_user_pages()
or get_user_pages_fast() will be called. However, these API might fail.

But free_user_pages() called in error handling path doesn't bother
about return value and will try to unpin bo->pgnr pages, which is
incorrect.

Fix this by passing the page_nr to free_user_pages(). If page_nr > 0
pages will be unpinned based on bo->mem_type. This will also take care
of non error handling path.

allocation")

Link: https://lore.kernel.org/linux-media/1601219284-13275-1-git-send-email-jrdr.linux@gmail.com
Fixes: 14a638ab96c5 ("media: atomisp: use pin_user_pages() for memory
Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# df561f66 23-Aug-2020 Gustavo A. R. Silva <gustavoars@kernel.org>

treewide: Use fallthrough pseudo-keyword

Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>


# 5b552b19 30-May-2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: atomisp: re-enable warnings again

For most warnings, the current code is OK. There are still
some issues with implicit-fallthough warnings.

Solve those and re-enable all warnings for this driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# f5fbb83f 29-May-2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: atomisp: add SPDX headers

This driver is licensed under GPL 2.0, as stated inside their
headers.

Add the proper tag there. We should probably latter cleanup
the reduntant licensing text, but this could be done later,
after we get rid of other abstraction layers.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 14a638ab 25-May-2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: atomisp: use pin_user_pages() for memory allocation

Instead of using a hacked version of an old copy of
get_user_pages(), use pin_user_pages().

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# e19718f6 26-May-2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: atomisp: add debug message to help debugging hmm code

The hmm code is partially based on a fork from 3.10 code,
and has bugs.

Add debug there to help tracking what happens there.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 576680cd 26-May-2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: atomisp: hmm_bo: untag user pointers

The kernel ABI was extended to allow pass tagged user pointers.

Untag the pointers in this function.

Fixes: d93445225cd3 ("uaccess: add noop untagged_addr definition")
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 89154dd5 08-Jun-2020 Michel Lespinasse <walken@google.com>

mmap locking API: convert mmap_sem call sites missed by coccinelle

Convert the last few remaining mmap_sem rwsem calls to use the new mmap
locking API. These were missed by coccinelle for some reason (I think
coccinelle does not support some of the preprocessor constructs in these
files ?)

[akpm@linux-foundation.org: convert linux-next leftovers]
[akpm@linux-foundation.org: more linux-next leftovers]
[akpm@linux-foundation.org: more linux-next leftovers]

Signed-off-by: Michel Lespinasse <walken@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Reviewed-by: Laurent Dufour <ldufour@linux.ibm.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: David Rientjes <rientjes@google.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Liam Howlett <Liam.Howlett@oracle.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ying Han <yinghan@google.com>
Link: http://lkml.kernel.org/r/20200520052908.204642-6-walken@google.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 5f1e9dd5 13-May-2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: atomisp: get rid of __bo_alloc() macro

Simplify the hmm_bo a little bit by removing this
macro. This will avoid printing twice errors when
allocations happen.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>


# 9d4fa1a1 30-Apr-2020 Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

media: atomisp: cleanup directory hierarchy

This driver has very long directories without a good
reason (IMHO). Let's drop two directories from such hierarchy,
in order to simplify things a little bit and make the dir
output a bit more readable.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>