Linus Torvalds
bf4afc53b7
Convert 'alloc_obj' family to use the new default GFP_KERNEL argument
...
This was done entirely with mindless brute force, using
git grep -l '\<k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'
to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.
Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.
For the same reason the 'flex' versions will be done as a separate
conversion.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2026-02-21 17:09:51 -08:00
Kees Cook
69050f8d6d
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
...
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:
Single allocations: kmalloc(sizeof(TYPE), ...)
are replaced with: kmalloc_obj(TYPE, ...)
Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with: kmalloc_objs(TYPE, COUNT, ...)
Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...)
(where TYPE may also be *VAR)
The resulting allocations no longer return "void *", instead returning
"TYPE *".
Signed-off-by: Kees Cook <kees@kernel.org >
2026-02-21 01:02:28 -08:00
Sasha Finkelstein
7f3b11934f
drm/virtio: Support partial maps of GEM objects
...
Those are useful to implement coherent cross-vm mmap.
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com >
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com >
Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20250109-virtgpu-gem-partial-map-v1-1-a914b48776bd@gmail.com
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com >
[dmitry.osipenko@collabora.com: Corrected vm_size check to account vm_pgoff]
2025-01-25 00:16:57 +03:00
Suren Baghdasaryan
1c71222e5f
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 >
2023-02-09 16:51:39 -08:00
David Stevens
ea5ea3d8a1
drm/virtio: support mapping exported vram
...
Implement virtgpu specific map_dma_buf callback to support mapping
exported vram object dma-bufs. The dma-buf callback is used directly, as
vram objects don't have backing pages and thus can't implement the
drm_gem_object_funcs.get_sg_table callback.
Signed-off-by: David Stevens <stevensd@chromium.org >
Link: http://patchwork.freedesktop.org/patch/msgid/20210813005441.608293-1-stevensd@chromium.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
2021-08-16 14:09:40 +02:00
Chia-I Wu
ccae03f337
drm/virtio: fix prime export for vram objects
...
commit 16845c5d54 ("drm/virtio: implement blob resources: implement
vram object") and commit c6069a02fa ("drm/virtgpu: Set PRIME export
function in struct drm_gem_object_funcs") landed from different trees,
resulting in prime export never working for vram objects.
Cc: Gurchetan Singh <gurchetansingh@chromium.org >
Cc: Thomas Zimmermann <tzimmermann@suse.de >
Cc: Gerd Hoffmann <kraxel@redhat.com >
Signed-off-by: Chia-I Wu <olvaffe@gmail.com >
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org >
Link: http://patchwork.freedesktop.org/patch/msgid/20210107210743.269885-1-olvaffe@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
2021-01-11 08:49:48 +01:00
Chia-I Wu
b39100a55c
drm/virtio: align blob resources to page sizes
...
They trigger the BUG_ON() in drm_gem_private_object_init otherwise.
Signed-off-by: Chia-I Wu <olvaffe@gmail.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20201219031959.92932-1-olvaffe@gmail.com
Cc: Gurchetan Singh <gurchetansingh@chromium.org >
Cc: Gerd Hoffmann <kraxel@redhat.com >
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
2020-12-22 13:43:30 +01:00
Gerd Hoffmann
897b4d1aca
drm/virtio: implement blob resources: resource create blob ioctl
...
Implement resource create blob as specified.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-18-gurchetansingh@chromium.org
Co-developed-by: Gurchetan Singh <gurchetansingh@chromium.org >
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org >
2020-09-29 11:23:51 +02:00
Gerd Hoffmann
16845c5d54
drm/virtio: implement blob resources: implement vram object
...
A virtio-gpu vram object is based on range-based allocation.
No guest shmemfs backing, so we call drm_gem_private_object_init.
This is for host memory without any guest backing (atleast initially).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Acked-by: Tomeu Vizoso <tomeu.vizoso@collabora.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20200924003214.662-12-gurchetansingh@chromium.org
Co-developed-by: Gurchetan Singh <gurchetansingh@chromium.org >
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org >
2020-09-29 11:23:33 +02:00