Linux IOMMU Development
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Yangyu Chen <cyy@cyyself.name>
Cc: iommu@lists.linux.dev,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH -fixes] dma-mapping: add default implementation to arch_dma_{set|clear}_uncached
Date: Tue, 9 Jul 2024 12:53:41 +0100	[thread overview]
Message-ID: <55b3b816-23f5-40ae-a1fb-5820cb8de0de@arm.com> (raw)
In-Reply-To: <tencent_651BC4D11C9730062064ACB186AF4A904005@qq.com>

On 09/07/2024 12:39 pm, Yangyu Chen wrote:
> 
> 
>> On Jul 9, 2024, at 19:19, Christoph Hellwig <hch@lst.de> wrote:
>>
>> On Tue, Jul 09, 2024 at 05:25:29PM +0800, Yangyu Chen wrote:
>>> Currently, we have some code in kernel/dma/direct.c which references
>>> arch_dma_set_uncached and arch_dma_clear_uncached. However, many
>>> architectures do not provide these symbols, and the code currently
>>> relies on compiler optimization to cut the unnecessary code. When the
>>> compiler fails to optimize it, the code will reference the symbol and
>>> cause a link error. I found this bug when developing some new extensions
>>> for RISC-V on LLVM. The error message is shown below:
>>
>> Same comment as for the last one.  I think your compiler misbehaves,
>> and the typical reason for that would be if you disable all
>> optimizations.
>>
> 
> The reason is that some optimizations failed to apply after adding
> some passes. I will fix the compiler later. Whatever, we should not
> rely on this optimization to get the code being successfully compiled.

We rely on unreachable code being optimised out *all over* the place - 
it's kind of the main point of constructs like IS_ENABLED(), and why the 
kernel as a whole does not and will not support being compiled with -O0. 
Frankly I'm quite surprised that this one would be the only case you hit 
if your compiler is not doing that properly.

Thanks,
Robin.

      parent reply	other threads:[~2024-07-09 11:53 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09  9:25 [PATCH -fixes] dma-mapping: add default implementation to arch_dma_{set|clear}_uncached Yangyu Chen
2024-07-09 11:19 ` Christoph Hellwig
2024-07-09 11:39   ` Yangyu Chen
2024-07-09 11:46     ` Christoph Hellwig
2024-07-09 12:22       ` Yangyu Chen
2024-07-09 15:52         ` Robin Murphy
2024-07-09 16:29           ` Yangyu Chen
2024-07-09 11:53     ` Robin Murphy [this message]

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=55b3b816-23f5-40ae-a1fb-5820cb8de0de@arm.com \
    --to=robin.murphy@arm.com \
    --cc=cyy@cyyself.name \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    /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