From: "Arnd Bergmann" <arnd@arndb.de>
To: "Stefan Wahren" <wahrenst@gmx.net>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Phil Elwell" <phil@raspberrypi.com>,
"laurent.pinchart" <laurent.pinchart@ideasonboard.com>
Cc: "Will Deacon" <will@kernel.org>, "Christoph Hellwig" <hch@lst.de>,
"Florian Fainelli" <florian.fainelli@broadcom.com>,
"Robin Murphy" <robin.murphy@arm.com>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
linux-staging@lists.linux.dev
Subject: Re: WARNING: drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:364 vchiq_prepare_bulk_data
Date: Mon, 10 Jun 2024 08:00:26 +0200 [thread overview]
Message-ID: <9d603d43-0f8a-4f9b-b11b-9e7543f421b9@app.fastmail.com> (raw)
In-Reply-To: <ad2b7034-ecc9-4d6e-844c-bfe32fb5b23c@gmx.net>
On Mon, Jun 10, 2024, at 00:24, Stefan Wahren wrote:
>
> After that i'm getting the following warning:
>
> create_pagelist: block 1, DMA address 0x00000000f5f62800 doesn't
> align with PAGE_MASK 0xfffffffffffff000
>
> Then i bisected the issue to this commit:
>
> commit 1c1a429efd4ee8ca244cc2401365c983cda4ed76
> Author: Catalin Marinas <catalin.marinas@arm.com>
> Date: Mon Jun 12 16:32:01 2023 +0100
>
> arm64: enable ARCH_WANT_KMALLOC_DMA_BOUNCE for arm64
>
> With the DMA bouncing of unaligned kmalloc() buffers now in place,
> enable
> it for arm64 to allow the kmalloc-{8,16,32,48,96} caches. In addition,
> always create the swiotlb buffer even when the end of RAM is within the
> 32-bit physical address range (the swiotlb buffer can still be
> disabled on
> the kernel command line).
>
> So how can the root cause of these warnings be fixed?
> Or is the specific WARN_ON() now obsolete?
>
It appears that the buffer that gets passed to the device
has a start address and length that both come from user
space, and in this case crosses a page boundary, and the
second half is not aligned to ARCH_KMALLOC_MINALIGN.
This means it's not actually a kmalloc buffer that goes
wrong, but userspace passing something that is problematic,
see also the comment above create_pagelist().
If that is a correct interpretation of what is going on,
one way to solve it would be to add the same logic for
vchiq user buffers that we have for kmalloc buffers:
if either the start or the size of the user buffer in
vchiq_irq_queue_bulk_tx_rx() are unaligned, just
allocate a new kernel buffer for the whole thing instead
of pinning the user buffer.
Arnd
next prev parent reply other threads:[~2024-06-10 6:00 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-09 22:24 WARNING: drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:364 vchiq_prepare_bulk_data Stefan Wahren
2024-06-10 6:00 ` Arnd Bergmann [this message]
2024-06-10 8:26 ` Phil Elwell
2024-06-10 9:00 ` Arnd Bergmann
2024-06-10 9:15 ` Laurent Pinchart
2024-06-10 9:19 ` Arnd Bergmann
2024-06-10 9:24 ` Phil Elwell
2024-06-10 10:09 ` Arnd Bergmann
2024-06-10 10:25 ` Robin Murphy
2024-06-11 10:47 ` Stefan Wahren
2024-06-11 11:08 ` Arnd Bergmann
2024-06-11 11:37 ` Stefan Wahren
2024-06-11 12:14 ` Arnd Bergmann
2024-06-11 13:09 ` Stefan Wahren
2024-06-11 13:35 ` Robin Murphy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9d603d43-0f8a-4f9b-b11b-9e7543f421b9@app.fastmail.com \
--to=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=florian.fainelli@broadcom.com \
--cc=gregkh@linuxfoundation.org \
--cc=hch@lst.de \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-staging@lists.linux.dev \
--cc=phil@raspberrypi.com \
--cc=robin.murphy@arm.com \
--cc=wahrenst@gmx.net \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox