Hi
Am 01.05.24 um 08:55 schrieb Adrián Larumbe:
> When Panfrost must pin an object that is being prepared a dma-buf
> attachment for on behalf of another driver, the core drm gem object pinning
> code already takes a lock on the object's dma reservation.
>
> However, Panfrost GEM object's pinning callback would eventually try taking
> the lock on the same dma reservation when delegating pinning of the object
> onto the shmem subsystem, which led to a deadlock.
>
> This can be shown by enabling CONFIG_DEBUG_WW_MUTEX_SLOWPATH, which throws
> the following recursive locking situation:
>
> weston/3440 is trying to acquire lock:
> ffff000000e235a0 (reservation_ww_class_mutex){+.+.}-{3:3}, at: drm_gem_shmem_pin+0x34/0xb8 [drm_shmem_helper]
> but task is already holding lock:
> ffff000000e235a0 (reservation_ww_class_mutex){+.+.}-{3:3}, at: drm_gem_pin+0x2c/0x80 [drm]
>
> Fix it by assuming the object's reservation had already been locked by the
> time we reach panfrost_gem_pin.
Maybe say that the reservation lock has been taken in drm_gem_pin()
>
> Do the same thing for the Lima driver, as it most likely suffers from the
> same issue.
Please split this patch into one for panfrost and one for lima. To each
patch, you can add
Reviewed-by: Thomas Zimmermann <tzimmermann(a)suse.de>
Best regards
Thomas
>
> Cc: Thomas Zimmermann <tzimmermann(a)suse.de>
> Cc: Dmitry Osipenko <dmitry.osipenko(a)collabora.com>
> Cc: Boris Brezillon <boris.brezillon(a)collabora.com>
> Cc: Steven Price <steven.price(a)arm.com>
> Fixes: a78027847226 ("drm/gem: Acquire reservation lock in drm_gem_{pin/unpin}()")
> Signed-off-by: Adrián Larumbe <adrian.larumbe(a)collabora.com>
> ---
> drivers/gpu/drm/lima/lima_gem.c | 2 +-
> drivers/gpu/drm/panfrost/panfrost_gem.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_gem.c
> index 7ea244d876ca..c4e0f9faaa47 100644
> --- a/drivers/gpu/drm/lima/lima_gem.c
> +++ b/drivers/gpu/drm/lima/lima_gem.c
> @@ -185,7 +185,7 @@ static int lima_gem_pin(struct drm_gem_object *obj)
> if (bo->heap_size)
> return -EINVAL;
>
> - return drm_gem_shmem_pin(&bo->base);
> + return drm_gem_shmem_object_pin(obj);
> }
>
> static int lima_gem_vmap(struct drm_gem_object *obj, struct iosys_map *map)
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c
> index d47b40b82b0b..f268bd5c2884 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gem.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c
> @@ -192,7 +192,7 @@ static int panfrost_gem_pin(struct drm_gem_object *obj)
> if (bo->is_heap)
> return -EINVAL;
>
> - return drm_gem_shmem_pin(&bo->base);
> + return drm_gem_shmem_object_pin(obj);
> }
>
> static enum drm_gem_object_status panfrost_gem_status(struct drm_gem_object *obj)
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)
On Fri, Apr 26, 2024 at 07:22:34PM +0200, Alexandre Mergnat wrote:
> Add audio clock wrapper and audio tuner control.
Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.
On 26/04/2024 19:22, Alexandre Mergnat wrote:
> regulators:
> type: object
> $ref: /schemas/regulator/mediatek,mt6357-regulator.yaml
> @@ -83,6 +111,12 @@ examples:
> interrupt-controller;
> #interrupt-cells = <2>;
>
> + audio-codec {
> + mediatek,micbias0-microvolt = <1700000>;
> + mediatek,micbias1-microvolt = <1700000>;
> + vaud28-supply = <&mt6357_vaud28_reg>;
And now you should see how odd it looks. Supplies are part of entire
chip, not subblock, even if they supply dedicated domain within that chip.
That's why I asked to put it in the parent node.
Best regards,
Krzysztof
On 23/04/2024 19:07, Alexandre Mergnat wrote:
>
>
> On 09/04/2024 17:55, Krzysztof Kozlowski wrote:
>>> +
>>> +additionalProperties: false
>>> +
>>> +examples:
>>> + - |
>>> + codec {
>>> + mediatek,micbias0-microvolt = <1900000>;
>>> + mediatek,micbias1-microvolt = <1700000>;
>>> + mediatek,vaud28-supply = <&mt6357_vaud28_reg>;
>> Sorry, this does not work. Change voltage to 1111111 and check the results.
>
> Actually it's worst ! I've removed the required property (vaud28-supply) but the dt check pass.
> Same behavior for some other docs like mt6359.yaml
Yeah, the schema is not applied. There is nothing selecting it, so this
is no-op schema. I don't know what exactly you want to describe, but
usually either you miss compatible or this should be just part of parent
node.
>
> The at24.yaml doc works as expected, then I tried compare an find the issue, without success...
>
> I've replaced "codec" by "audio-codec", according to [1].
> I've tried multiple manner to implement the example code, without success. I'm wondering if what I
> try to do is the correct way or parse-able by the dt_check.
>
> If I drop this file and implement all these new properties into the MFD PMIC documentation directly,
> I've the expected dt_check result (function to good or wrong parameters)
Yes.
Best regards,
Krzysztof
On 4/21/24 19:39, Adrián Larumbe wrote:
> When Panfrost must pin an object that is being prepared a dma-buf
> attachment for on behalf of another driver, the core drm gem object pinning
> code already takes a lock on the object's dma reservation.
>
> However, Panfrost GEM object's pinning callback would eventually try taking
> the lock on the same dma reservation when delegating pinning of the object
> onto the shmem subsystem, which led to a deadlock.
>
> This can be shown by enabling CONFIG_DEBUG_WW_MUTEX_SLOWPATH, which throws
> the following recursive locking situation:
>
> weston/3440 is trying to acquire lock:
> ffff000000e235a0 (reservation_ww_class_mutex){+.+.}-{3:3}, at: drm_gem_shmem_pin+0x34/0xb8 [drm_shmem_helper]
> but task is already holding lock:
> ffff000000e235a0 (reservation_ww_class_mutex){+.+.}-{3:3}, at: drm_gem_pin+0x2c/0x80 [drm]
>
> Fix it by assuming the object's reservation had already been locked by the
> time we reach panfrost_gem_pin.
>
> Cc: Thomas Zimmermann <tzimmermann(a)suse.de>
> Cc: Dmitry Osipenko <dmitry.osipenko(a)collabora.com>
> Cc: Boris Brezillon <boris.brezillon(a)collabora.com>
> Cc: Steven Price <steven.price(a)arm.com>
> Fixes: a78027847226 ("drm/gem: Acquire reservation lock in drm_gem_{pin/unpin}()")
> Signed-off-by: Adrián Larumbe <adrian.larumbe(a)collabora.com>
> ---
> drivers/gpu/drm/panfrost/panfrost_gem.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c
> index d47b40b82b0b..6c26652d425d 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_gem.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c
> @@ -192,7 +192,12 @@ static int panfrost_gem_pin(struct drm_gem_object *obj)
> if (bo->is_heap)
> return -EINVAL;
>
> - return drm_gem_shmem_pin(&bo->base);
> + /*
> + * Pinning can only happen in response to a prime attachment request from
> + * another driver, but that's already being handled by drm_gem_pin
> + */
> + drm_WARN_ON(obj->dev, obj->import_attach);
> + return drm_gem_shmem_pin_locked(&bo->base);
> }
Will be better to use drm_gem_shmem_object_pin() to avoid such problem
in future
Please also fix the Lima driver
--
Best regards,
Dmitry
On Tue, Apr 09, 2024 at 02:06:05PM +0200, Pascal FONTAIN wrote:
> From: Andrew Davis <afd(a)ti.com>
>
> This new export type exposes to userspace the SRAM area as a DMA-BUF
> Heap,
> this allows for allocations of DMA-BUFs that can be consumed by various
> DMA-BUF supporting devices.
>
> Signed-off-by: Andrew Davis <afd(a)ti.com>
> Tested-by: Pascal Fontain <pascal.fontain(a)bachmann.info>
When sending on a patch from someone else, you too must sign off on it
as per our documenation. Please read it and understand what you are
agreeing to when you do that for a new version please.
> ---
> drivers/misc/Kconfig | 7 +
> drivers/misc/Makefile | 1 +
> drivers/misc/sram-dma-heap.c | 246 +++++++++++++++++++++++++++++++++++
> drivers/misc/sram.c | 6 +
> drivers/misc/sram.h | 16 +++
> 5 files changed, 276 insertions(+)
> create mode 100644 drivers/misc/sram-dma-heap.c
>
> diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> index 9e4ad4d61f06..e6674e913168 100644
> --- a/drivers/misc/Kconfig
> +++ b/drivers/misc/Kconfig
> @@ -448,6 +448,13 @@ config SRAM
> config SRAM_EXEC
> bool
>
> +config SRAM_DMA_HEAP
> + bool "Export on-chip SRAM pools using DMA-Heaps"
> + depends on DMABUF_HEAPS && SRAM
> + help
> + This driver allows the export of on-chip SRAM marked as both pool
> + and exportable to userspace using the DMA-Heaps interface.
What will use this in userspace?
thanks,
greg k-h
Well checkpatch.pl still complained:
ERROR: trailing whitespace
#157: FILE: Documentation/driver-api/dma-buf.rst:80:
+ If llseek on dma-buf FDs isn't supported the kernel will report
-ESPIPE for all^M$
That actually looks like you used a Windows line ending.
I fixed it up and pushed the patch, but please take a bit more care next
time.
Thanks,
Christian.
Am 17.04.24 um 06:59 schrieb Baruch Siach:
> Use 'supported' instead of 'support'. 'support' makes no sense in this
> context.
>
> Signed-off-by: Baruch Siach <baruch(a)tkos.co.il>
> ---
> v2: Add commit log message (Christian König)
> ---
> Documentation/driver-api/dma-buf.rst | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/Documentation/driver-api/dma-buf.rst b/Documentation/driver-api/dma-buf.rst
> index 0c153d79ccc4..29abf1eebf9f 100644
> --- a/Documentation/driver-api/dma-buf.rst
> +++ b/Documentation/driver-api/dma-buf.rst
> @@ -77,7 +77,7 @@ consider though:
> the usual size discover pattern size = SEEK_END(0); SEEK_SET(0). Every other
> llseek operation will report -EINVAL.
>
> - If llseek on dma-buf FDs isn't support the kernel will report -ESPIPE for all
> + If llseek on dma-buf FDs isn't supported the kernel will report -ESPIPE for all
> cases. Userspace can use this to detect support for discovering the dma-buf
> size using llseek.
>
Hi,
Le mercredi 03 avril 2024 à 18:26 +0800, Shawn Sung a écrit :
> From: "Jason-JH.Lin" <jason-jh.lin(a)mediatek.com>
>
> Add DRM_MTK_GEM_CREATE_ENCRYPTED flag to allow user to allocate
Is "ENCRYPTED" a proper naming ? My expectation is that this would hold data in
a PROTECTED memory region but that no cryptographic algorithm will be involved.
Nicolas
> a secure buffer to support secure video path feature.
>
> Signed-off-by: Jason-JH.Lin <jason-jh.lin(a)mediatek.com>
> Signed-off-by: Hsiao Chien Sung <shawn.sung(a)mediatek.com>
> ---
> include/uapi/drm/mediatek_drm.h | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/include/uapi/drm/mediatek_drm.h b/include/uapi/drm/mediatek_drm.h
> index b0dea00bacbc4..e9125de3a24ad 100644
> --- a/include/uapi/drm/mediatek_drm.h
> +++ b/include/uapi/drm/mediatek_drm.h
> @@ -54,6 +54,7 @@ struct drm_mtk_gem_map_off {
>
> #define DRM_MTK_GEM_CREATE 0x00
> #define DRM_MTK_GEM_MAP_OFFSET 0x01
> +#define DRM_MTK_GEM_CREATE_ENCRYPTED 0x02
>
> #define DRM_IOCTL_MTK_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + \
> DRM_MTK_GEM_CREATE, struct drm_mtk_gem_create)